@fugood/bricks-cli 2.26.0-beta.32 → 2.26.0-beta.34

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/1809.js ADDED
@@ -0,0 +1 @@
1
+ export const __rspack_esm_id=1809;export const __rspack_esm_ids=[1809];export const __webpack_modules__={35912(e,r,s){s.r(r),s.d(r,{PASSCODE_PERMISSIONS:()=>l,buildNewPasscode:()=>h,formatImageVersions:()=>E,mediaApiUrl:()=>p,parseDuration:()=>m,parseFileTypes:()=>c,parsePasscodePermissions:()=>u,presentBox:()=>f,presentPasscode:()=>_,runConfirmed:()=>w,scrubSecret:()=>L});var t,o=s(99436),n=s(67996),a=s(58021),i=["code"],l=["ALL","READ_ONLY","POST_ONLY","DELETE"],d={s:1,m:60,h:3600,d:86400,w:604800},p=(e,r=process.env)=>{var s;if(r.BRICKS_MEDIA_API_URL)return r.BRICKS_MEDIA_API_URL.replace(/\/$/,"");try{s=new URL(e)}catch{return null}return"localhost"===s.hostname||"127.0.0.1"===s.hostname?"http://localhost:3002":/^display(-[a-z0-9]+)?\.bricks\.tools$/.test(s.hostname)?`${s.protocol}//${s.hostname.replace(/^display/,"media")}`:null},c=e=>e?e.split(",").map(e=>e.trim().toUpperCase()).filter(Boolean):void 0,m=e=>{var r=String(e).trim().match(/^(\d+)\s*([smhdw]?)$/i),s=r?Number(r[1])*d[(r[2]||"s").toLowerCase()]:0;if(!s||s>31536e7)throw Error(`Invalid duration "${e}". Use seconds or a number with s, m, h, d or w.`);return s},u=e=>{if(!e)return["ALL"];var r=[...new Set(e.split(",").map(e=>e.trim().toUpperCase().replace(/-/g,"_")).filter(Boolean))],s=r.filter(e=>!l.includes(e));if(s.length>0)throw Error(`Unknown passcode permission: ${s.join(", ")}. Use ${l.join(", ")}.`);if(r.includes("ALL")&&r.length>1)throw Error("Passcode permission ALL cannot be combined with other permissions");return r.length>0?r:["ALL"]},h=({name:e,code:r,expiresIn:s,permissions:t})=>{var o=(e||"Passcode").trim();if(2>Buffer.byteLength(o))throw Error("Passcode name must be at least 2 characters");if("string"!=typeof r||6>Buffer.byteLength(r))throw Error("Passcode code must be at least 6 characters");return{name:o,code:r,enableExpired:null!=s,expireSeconds:null!=s?m(s):3600,permissions:u(t)}},_=(e,{showCodes:r=!1,now:s=Date.now()}={})=>{let t;var o=e.code,a={...n(e,i),expired:!!(e.enableExpired&&e.expiredAt&&(t=e.expiredAt,Date.parse(/(?:z|[+-]\d\d:?\d\d)$/i.test(t)?t:`${t}Z`)<s))};return e.enableExpired||(a.expiredAt=null),r&&null!=o&&(a.code=o),a},f=(e,r)=>e&&{...e,...e.passcodes&&{passcodes:e.passcodes.map(e=>_(e,r))}},L=(e,r)=>r?String(e).split(r).join("***"):String(e),w=(t=o(function*({message:e,yes:r,json:s,action:t,confirm:o=a.n}){return(yield o({message:e,autoYes:r,json:s}))?{cancelled:!1,result:yield t()}:{cancelled:!0}}),function(e){return t.apply(this,arguments)}),E=e=>(e.meta?.imageVersions||[]).map(e=>`${e.width}x${e.height} ${e.strategy||""}`.trim()).join(", ")}};
package/lib/2486.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=2486;export const __rspack_esm_ids=[2486];export const __webpack_modules__={421(e,r,a){a.r(r),a.d(r,{buildDoctorReport:()=>h,renderDoctorReport:()=>v});var i,o,t=a(99436),s=a(85382),n=a(31802),c=a(8479),l=a(7586),p=a(47988),u=(i=t(function*(){try{return yield Promise.all([a.e(1826),a.e(3781),a.e(7281),a.e(1010),a.e(9439)]).then(a.bind(a,70114)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),k=(e,r,a)=>({severity:e,code:r,message:a}),h=(o=t(function*({version:e="2.26.0-beta.32",mcpCheck:r=u}={}){var a=(0,p.getCurrentProfile)(),i=(0,p.getCurrentProfileSource)(),o=(0,n.getConnectionContext)(a),t=o.tokenInfo,h=o.auth,d=o.baseUrl,v=o.activityLogBaseUrl,m=[],w={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:p.CONFIG_PATH,baseUrl:d,activityLogBaseUrl:v},auth:{available:!!h,source:h?"config":"missing",kind:h?.kind||null,workspaceId:t?.workspaceId||null,workspaceName:t?.workspaceName||null,createdAt:t?.createdAt||null,tokenPreview:h?.kind==="token"?(0,l.$l)(h.token):null},connectivity:{workspace:{ok:!1,skipped:!h,error:null}},capabilities:{zeroArgMode:(0,c.isInteractiveTerminal)()?"interactive":"help",mcp:{available:!1,error:null}},issues:m};if(h)try{var b=yield(0,s.createClient)(d,h).workspace();w.connectivity.workspace={ok:!0,skipped:!1,error:null,id:b?._id||t.workspaceId||null,name:b?.name||t.workspaceName||null},w.auth.workspaceId=b?._id||w.auth.workspaceId,w.auth.workspaceName=b?.name||w.auth.workspaceName}catch(e){w.connectivity.workspace={ok:!1,skipped:!1,error:e.message},m.push(k("error","workspace_unreachable",`Workspace query failed for ${d}: ${e.message}`))}else m.push(k("warning","auth_missing","No usable credential for the current profile."));var f=yield r();return w.capabilities.mcp={available:f.available,error:f.error||null},f.available||m.push(k("warning","mcp_unavailable",`MCP stdio server is unavailable: ${f.error||"Unknown error"}`)),w.ok=0===m.length,w}),function(){return o.apply(this,arguments)}),d=(e,r,a)=>`${e.padEnd(14)} ${r}${a?` ${a}`:""}`,v=e=>{var r=[];if(r.push("BRICKS CLI Doctor"),r.push("─".repeat(60)),r.push(d("CLI","OK",`bricks v${e.cli.version}`)),r.push(d("Profile","OK",`${e.profile.name} (${e.profile.source})`)),r.push(d("BRICKS API","OK",e.config.baseUrl)),r.push(d("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace",i=[e.auth.source,e.auth.kind,e.auth.tokenPreview].filter(Boolean).join(", ");r.push(d("Auth","OK",i?`${a} (${i})`:a))}else r.push(d("Auth","WARN","No usable credential for the current profile"));if(e.connectivity.workspace.skipped)r.push(d("Workspace","WARN","Skipped because no credential is available"));else if(e.connectivity.workspace.ok){var o=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";r.push(d("Workspace","OK",o))}else r.push(d("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?r.push(d("MCP","OK","STDIO server import is available")):r.push(d("MCP","WARN",e.capabilities.mcp.error)),r.push(d("Zero-arg mode",((e,r=!1)=>e?"OK":r?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(r.push("─".repeat(60)),r.push("Issues"),e.issues.forEach(e=>{r.push(`- [${e.severity}] ${e.message}`)})),r.join("\n")}}};
1
+ export const __rspack_esm_id=2486;export const __rspack_esm_ids=[2486];export const __webpack_modules__={421(e,r,a){a.r(r),a.d(r,{buildDoctorReport:()=>h,renderDoctorReport:()=>v});var i,o,t=a(99436),s=a(85382),n=a(31802),c=a(8479),l=a(7586),p=a(47988),u=(i=t(function*(){try{return yield Promise.all([a.e(1826),a.e(3781),a.e(7281),a.e(1010),a.e(9439)]).then(a.bind(a,70114)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),k=(e,r,a)=>({severity:e,code:r,message:a}),h=(o=t(function*({version:e="2.26.0-beta.34",mcpCheck:r=u}={}){var a=(0,p.getCurrentProfile)(),i=(0,p.getCurrentProfileSource)(),o=(0,n.getConnectionContext)(a),t=o.tokenInfo,h=o.auth,d=o.baseUrl,v=o.activityLogBaseUrl,m=[],w={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:p.CONFIG_PATH,baseUrl:d,activityLogBaseUrl:v},auth:{available:!!h,source:h?"config":"missing",kind:h?.kind||null,workspaceId:t?.workspaceId||null,workspaceName:t?.workspaceName||null,createdAt:t?.createdAt||null,tokenPreview:h?.kind==="token"?(0,l.$l)(h.token):null},connectivity:{workspace:{ok:!1,skipped:!h,error:null}},capabilities:{zeroArgMode:(0,c.isInteractiveTerminal)()?"interactive":"help",mcp:{available:!1,error:null}},issues:m};if(h)try{var b=yield(0,s.createClient)(d,h).workspace();w.connectivity.workspace={ok:!0,skipped:!1,error:null,id:b?._id||t.workspaceId||null,name:b?.name||t.workspaceName||null},w.auth.workspaceId=b?._id||w.auth.workspaceId,w.auth.workspaceName=b?.name||w.auth.workspaceName}catch(e){w.connectivity.workspace={ok:!1,skipped:!1,error:e.message},m.push(k("error","workspace_unreachable",`Workspace query failed for ${d}: ${e.message}`))}else m.push(k("warning","auth_missing","No usable credential for the current profile."));var f=yield r();return w.capabilities.mcp={available:f.available,error:f.error||null},f.available||m.push(k("warning","mcp_unavailable",`MCP stdio server is unavailable: ${f.error||"Unknown error"}`)),w.ok=0===m.length,w}),function(){return o.apply(this,arguments)}),d=(e,r,a)=>`${e.padEnd(14)} ${r}${a?` ${a}`:""}`,v=e=>{var r=[];if(r.push("BRICKS CLI Doctor"),r.push("─".repeat(60)),r.push(d("CLI","OK",`bricks v${e.cli.version}`)),r.push(d("Profile","OK",`${e.profile.name} (${e.profile.source})`)),r.push(d("BRICKS API","OK",e.config.baseUrl)),r.push(d("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace",i=[e.auth.source,e.auth.kind,e.auth.tokenPreview].filter(Boolean).join(", ");r.push(d("Auth","OK",i?`${a} (${i})`:a))}else r.push(d("Auth","WARN","No usable credential for the current profile"));if(e.connectivity.workspace.skipped)r.push(d("Workspace","WARN","Skipped because no credential is available"));else if(e.connectivity.workspace.ok){var o=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";r.push(d("Workspace","OK",o))}else r.push(d("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?r.push(d("MCP","OK","STDIO server import is available")):r.push(d("MCP","WARN",e.capabilities.mcp.error)),r.push(d("Zero-arg mode",((e,r=!1)=>e?"OK":r?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(r.push("─".repeat(60)),r.push("Issues"),e.issues.forEach(e=>{r.push(`- [${e.severity}] ${e.message}`)})),r.join("\n")}}};
package/lib/638.js ADDED
@@ -0,0 +1 @@
1
+ export const __rspack_esm_id=638;export const __rspack_esm_ids=[638];export const __webpack_modules__={75149(r,t,e){e.r(t),e.d(t,{createFetchForUrl:()=>o});var s=e(79657),_=e(64007);function o(r){var t=process.env.HTTPS_PROXY||process.env.https_proxy;if(!t||!r.startsWith("https://"))return s.Ay;var e=new _(t);return(r,t={})=>(0,s.Ay)(r,{...t,agent:e})}}};
package/lib/6818.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.26.0-beta.32")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)(?:[\\/]|$)/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
1
+ export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.26.0-beta.34")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)(?:[\\/]|$)/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
package/lib/7294.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as e from"ink";import*as r from"react";import*as t from"react/jsx-runtime";export const __rspack_esm_id=7294;export const __rspack_esm_ids=[7294];export const __webpack_modules__={8498(r){r.exports=e},51649(e){e.exports=r},71178(e){e.exports=t},94685(e,r,t){t.r(r),t.d(r,{AppList:()=>k,CONTROL_ACTIONS:()=>h,MainMenu:()=>S,Header:()=>v,ModuleDetail:()=>O,ONLINE_THRESHOLD_MS:()=>m.RZ,ShortEditEditor:()=>J,MediaFileList:()=>$,App:()=>eo,DeviceDetail:()=>A,VIEWS:()=>x,runInteractiveMode:()=>es,DeviceList:()=>I,MediaBoxList:()=>R,Loading:()=>T,DeviceControl:()=>B,ProjectInitView:()=>ei,GroupDetail:()=>M,ModuleList:()=>L,MediaBoxDetail:()=>U,GroupList:()=>P,Footer:()=>j,DeviceStatus:()=>b,AppDetail:()=>w,DeviceScreenshot:()=>C,MediaFileDetail:()=>G});var n,l=t(99436),i=t(51649),o=t(8498),a=t(68832),s=t(85382),c=t(47988),u=t(31802),d=t(60450),x={MAIN:"main",DEVICES:"devices",DEVICE_DETAIL:"device_detail",DEVICE_CONTROL:"device_control",DEVICE_SCREENSHOT:"device_screenshot",APPS:"apps",APP_DETAIL:"app_detail",APP_SHORT_EDIT:"app_short_edit",APP_PROJECT_INIT:"app_project_init",MODULES:"modules",MODULE_DETAIL:"module_detail",MODULE_SHORT_EDIT:"module_short_edit",MODULE_PROJECT_INIT:"module_project_init",GROUPS:"groups",GROUP_DETAIL:"group_detail",MEDIA_BOXES:"media_boxes",MEDIA_BOX_DETAIL:"media_box_detail",MEDIA_FILES:"media_files",MEDIA_FILE_DETAIL:"media_file_detail",ACTIVITY_LOG:"activity_log"},h=[{label:"Refresh Application",value:"refresh"},{label:"Clear Cache",value:"clear-cache"},{label:"Take Screenshot",value:"take-screenshot"},{label:"Open System Menu",value:"system-menu-open"},{label:"Close System Menu",value:"system-menu-close"},{label:"Open Debug Panel",value:"debug-panel-open"},{label:"Close Debug Panel",value:"debug-panel-close"},{label:"Enable Logging",value:"logging-on"},{label:"Disable Logging",value:"logging-off"},{label:"← Back",value:"back"}],f=t(47882),m=t(9683),p=t(71178),y=(e,r=!0)=>{var t=Math.floor(60),n=a((0,i.useState)(t),2),l=n[0],o=n[1],s=a((0,i.useState)(null),2),c=s[0],u=s[1],d=(0,i.useRef)(e);(0,i.useEffect)(()=>{d.current=e},[e]);var x=(0,i.useCallback)(()=>{o(t),u(Date.now())},[t]);return(0,i.useEffect)(()=>{if(r){var e=setInterval(()=>{o(e=>e<=1?(d.current?.(),u(Date.now()),t):e-1)},1e3);return()=>clearInterval(e)}},[r,t]),(0,i.useEffect)(()=>{r&&(o(t),u(Date.now()))},[r,t]),{countdown:l,lastRefreshTime:c,resetCountdown:x}},g=({countdown:e,lastRefreshTime:r})=>(0,p.jsx)(o.Box,{children:(0,p.jsxs)(o.Text,{color:"gray",children:["Next refresh in ",(0,p.jsxs)(o.Text,{color:"cyan",children:[e,"s"]}),r&&(0,p.jsxs)(o.Text,{color:"gray",children:[" (last: ",r?new Date(r).toLocaleTimeString():null,")"]})]})}),v=({workspace:e,view:r})=>(0,p.jsxs)(o.Box,{flexDirection:"column",marginBottom:1,children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"BRICKS CLI"}),(0,p.jsx)(o.Text,{color:"gray",children:" - Interactive Mode"})]}),(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:"Workspace: "}),(0,p.jsx)(o.Text,{color:"green",children:e?.name||"Not connected"}),(0,p.jsx)(o.Text,{color:"gray",children:" | View: "}),(0,p.jsx)(o.Text,{color:"yellow",children:r})]}),(0,p.jsx)(o.Text,{color:"gray",children:"─".repeat(60)})]}),j=()=>(0,p.jsxs)(o.Box,{marginTop:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"gray",children:"─".repeat(60)}),(0,p.jsxs)(o.Text,{color:"gray",children:["Press ",(0,p.jsx)(o.Text,{color:"cyan",children:"q"})," to quit, ",(0,p.jsx)(o.Text,{color:"cyan",children:"Esc"})," to go back"]})]}),T=({text:e})=>(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"green",children:(0,p.jsx)(f.A,{type:"dots"})}),(0,p.jsxs)(o.Text,{children:[" ",e||"Loading..."]})]}),b=({lastAliveTime:e})=>{var r=(0,m.Ed)(e);return(0,p.jsx)(o.Text,{color:r.tone,children:(0,m.mz)(r)})},_=t(48724),S=({onSelect:e,mediaEnabled:r,activityLogEnabled:t})=>{var n=[{label:"Devices",value:x.DEVICES},{label:"Applications",value:x.APPS},{label:"Modules",value:x.MODULES},{label:"Device Groups",value:x.GROUPS},...r?[{label:"Media Flow",value:x.MEDIA_BOXES}]:[],...t?[{label:"Activity Log",value:x.ACTIVITY_LOG}]:[],{label:"Exit",value:"exit"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Main Menu"}),(0,p.jsx)(_.Ay,{items:n,onSelect:e})]})},E="1"===process.env.BRICKS_CLI_DISTRIBUTION,D=e=>{var r=a((0,i.useState)(null),2),n=r[0],l=r[1];return((0,i.useEffect)(()=>{if(!E){var e=!0;return t.e(8166).then(t.bind(t,29557)).then(r=>{e&&l(()=>r.default)}).catch(()=>{e&&l(!1)}),()=>{e=!1}}},[]),E||!1===n)?(0,p.jsx)(o.Text,{color:"gray",children:"Image preview is not available in this CLI build."}):n?(0,p.jsx)(n,{...e}):(0,p.jsx)(T,{text:"Preparing image preview..."})},I=({devices:e,loading:r,onSelect:t,countdown:n,lastRefreshTime:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading devices..."});if(!e?.length)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"yellow",children:"No devices found"}),(0,p.jsx)(g,{countdown:n,lastRefreshTime:l})]});var i=[...e.map(e=>{var r,t,n,l,i=(r=e.entry_detail?.watch_dog_timer?.last_alive_time,n=(t=(0,m.Ed)(r)).glyph,l=t.label,`${n} ${l}`);return{label:`${i} - ${e.name||e.device_name}`,value:e._id,device:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{marginBottom:1,children:[(0,p.jsxs)(o.Text,{bold:!0,children:["Devices (",e.length,")"]}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:n,lastRefreshTime:l})]}),(0,p.jsx)(_.Ay,{items:i,onSelect:t})]})},A=({device:e,loading:r,error:t,onSelect:n,mediaEnabled:l,countdown:i,lastRefreshTime:a})=>{if(r)return(0,p.jsx)(T,{text:"Loading device..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Device not found"});var s=[{label:"Control Device",value:"control"},...l?[{label:"View Screenshot",value:"screenshot"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],c=e.entry_detail,u=c?.screen,d=c?.update,x=c?.local_sync;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||e.device_name}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:i,lastRefreshTime:a})]}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:"Status: "}),(0,p.jsx)(b,{lastAliveTime:c?.watch_dog_timer?.last_alive_time})]}),(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),c?.application&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Application"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" Name: ",c.application.name]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" Mode: ",c.operation_mode||"N/A"]})]}),u&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Screen"}),u.resolution&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Resolution: ",u.resolution.width,"x",u.resolution.height,u.resolution.scale&&` @${u.resolution.scale}x`]}),u.orientation&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Orientation: ",u.orientation]}),u.touch&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Touch:"," ",u.touch.available?`Yes (${u.touch.touch_point} points)`:"No"]})]}),(c?.memory_usage||c?.disk_usage)&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"System"}),c.memory_usage&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Memory: ",Math.round(100*c.memory_usage),"%"]}),c.disk_usage&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Disk: ",Math.round(100*c.disk_usage),"%"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Capabilities"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Sound: ",c?.sound?.available?"✓":"✗"," | ","Camera: ",c?.camera?.available?"✓":"✗"," | ","Audio In: ",c?.audio_in?.available?"✓":"✗"]})]}),x&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Local Sync"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Role: ",x.is_main?"Main":"Peer",x.peer_count>0&&` | Peers: ${x.peer_count}`,x.mean_latency&&` | Latency: ${x.mean_latency}ms`]})]}),d&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Update"}),(0,p.jsxs)(o.Text,{color:d.need_update?"yellow":"gray",children:[" ","Status: ",d.need_update?"⚠ Update available":"✓ Up to date"]}),d.current_version&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Version: ",d.current_version]})]})]}),(0,p.jsx)(_.Ay,{items:s,onSelect:n})]})},B=({device:e,onSelect:r,controlling:t,controlResult:n})=>(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Control: ",e?.name||e?.device_name]}),t&&(0,p.jsx)(T,{text:"Sending command..."}),n&&(0,p.jsx)(o.Text,{color:n.success?"green":"red",children:n.message}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:h,onSelect:r})})]}),C=({device:e,screenshot:r,loading:t,error:n,onSelect:l})=>{var i=r?.file?.meta,a=i?.originalWidth!=null&&i?.originalHeight!=null,s=i?.originalFileSize!=null;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Screenshot: ",e?.name||e?.device_name||"Unknown"]}),t&&(0,p.jsx)(T,{text:"Loading screenshot..."}),n&&(0,p.jsx)(o.Box,{marginY:1,children:(0,p.jsx)(o.Text,{color:"red",children:String(n)})}),!t&&!n&&r&&(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Box,{height:30,children:(0,p.jsx)(D,{src:r.path,width:80,alt:"Device screenshot"})}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Screenshot Details"}),(0,p.jsxs)(o.Box,{marginY:1,children:[(0,p.jsx)(o.Text,{color:"green",children:"Screenshot saved to: "}),(0,p.jsx)(o.Text,{color:"cyan",children:String(r.path||"")})]}),a&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",String(i.originalWidth),"x",String(i.originalHeight)]}),s&&(0,p.jsxs)(o.Text,{color:"gray",children:["File: ",(Number(i.originalFileSize)/1024).toFixed(1)," KB"]}),r.file?.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:["Updated: ",new Date(r.file.updatedAt).toLocaleString()]})]})]}),!t&&!n&&!r&&(0,p.jsx)(o.Box,{marginY:1,children:(0,p.jsx)(o.Text,{color:"yellow",children:"No screenshot available. Try taking a new one."})}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:[{label:"Take New Screenshot",value:"take"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:l})})]})},k=({apps:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading applications..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No applications found"});var n=[...e.map(e=>({label:`${e.has_unreleased_changes?"●":"○"} ${e.name}`,value:e._id,app:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Applications (",e.length,")"]}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},w=({app:e,loading:r,error:t,onSelect:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading application..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Application not found"});var l=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],i=e.devices?.length||0,a=e.devices?.filter(e=>"online"===e.status)?.length||0;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Version"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,p.jsxs)(o.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]}),e.current_version_details&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Released: v",e.current_version_details.version||"N/A"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Devices"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Total: ",i,i>0&&` (${a} online)`]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Features"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Canvas Control: ",e.canvas_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Device Control: ",e.device_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:e.lock?.enabled?"yellow":"gray",children:[" ","Lock: ",e.lock?.enabled?"\uD83D\uDD12 Locked":"\uD83D\uDD13 Unlocked"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:l,onSelect:n})]})},L=({modules:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading modules..."});var n=[...(e||[]).map(e=>({label:`${e.current_version?"●":"○"} ${e.name}`,value:e._id,module:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Modules (",e?.length||0,")"]}),!e?.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No modules found"}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},O=({module:e,loading:r,error:t,onSelect:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading module..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Module not found"});var l=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Version"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,p.jsxs)(o.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Usage"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Used in: ",e.use_count?.total_count||0," application(s)"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Settings"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Public: ",e.is_public?"✓ Yes":"✗ No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modifiable: ",e.is_allow_modify?"✓ Yes":"✗ No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]})]}),e.expose_properties?.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Exposed Properties"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.expose_properties.length," properties exposed"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:l,onSelect:n})]})},P=({groups:e,loading:r,onSelect:t,countdown:n,lastRefreshTime:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading device groups..."});var i=[...(e||[]).map(e=>({label:`📁 ${e.name} (${e.devices?.length||0} devices)`,value:e._id,group:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{marginBottom:1,children:[(0,p.jsxs)(o.Text,{bold:!0,children:["Device Groups (",e?.length||0,")"]}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:n,lastRefreshTime:l})]}),!e?.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No device groups found"}),(0,p.jsx)(_.Ay,{items:i,onSelect:t})]})},N=({loading:e,groupDevices:r})=>e?(0,p.jsx)(T,{text:"Loading devices..."}):r?.length?(0,p.jsxs)(p.Fragment,{children:[r.slice(0,10).map(e=>(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:" "}),(0,p.jsx)(b,{lastAliveTime:e.entry_detail?.watch_dog_timer?.last_alive_time}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.name||e.device_name]}),e.device_target_name&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","(",e.device_target_name,")"]})]},e._id)),r.length>10&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","... and ",r.length-10," more"]})]}):(0,p.jsx)(o.Text,{color:"gray",children:" No devices in this group"}),M=({group:e,groupDevices:r,loading:t,error:n,onSelect:l,countdown:i,lastRefreshTime:a})=>t&&!e?(0,p.jsx)(T,{text:"Loading device group..."}):n?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",n]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]}):e?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:i,lastRefreshTime:a})]}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsxs)(o.Text,{bold:!0,color:"white",children:["Devices (",e.devices?.length||0,")"]}),(0,p.jsx)(N,{loading:t,groupDevices:r})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:l})]}):(0,p.jsx)(o.Text,{color:"red",children:"Device group not found"}),R=({boxes:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading media boxes..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No media boxes found"});var n=[...e.map(e=>({label:`📦 ${e.name||"Unnamed"}`,value:e.id,box:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Media Boxes (",e.length,")"]}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},U=({box:e,loading:r,error:t,onSelect:n})=>r&&!e?(0,p.jsx)(T,{text:"Loading media box..."}):t?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]}):e?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e.id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),null!=e.size&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",e.size]}),e.passcodes?.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsxs)(o.Text,{bold:!0,color:"white",children:["Passcodes (",e.passcodes.length,")"]}),e.passcodes.slice(0,5).map(e=>(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.name||"Passcode",": ",e.code]},e.id)),e.passcodes.length>5&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","... and ",e.passcodes.length-5," more"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"List Files",value:"files"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})]}):(0,p.jsx)(o.Text,{color:"red",children:"Media box not found"}),$=({files:e,loading:r,onSelect:t,box:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading media files..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No media files found"});var l=[...e.map(e=>{var r;return{label:`${"Image"===(r=e.fileType)?"\uD83D\uDDBC":"Video"===r?"\uD83C\uDF9E":"Audio"===r?"\uD83C\uDFB5":"\uD83D\uDCC4"} ${e.name||"Unnamed"}`,value:e.id,file:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Media Files (",e.length,")",n?.name?` - ${n.name}`:""]}),(0,p.jsx)(_.Ay,{items:l,onSelect:t})]})},G=({file:e,loading:r,error:t,onSelect:n})=>{if(r&&!e)return(0,p.jsx)(T,{text:"Loading media file..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Media file not found"});var l=e.meta,i=(0,d.buildScreenshotUrl)(e),a=(0,d.buildScreenshotUrl)(e,{preferThumbnail:!0}),s=!!(a&&a!==i);return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e.id]}),(0,p.jsxs)(o.Text,{color:"gray",children:["Box ID: ",e.boxId]}),(0,p.jsxs)(o.Text,{color:"gray",children:["Type: ",e.fileType]}),e.userTags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.userTags.join(", ")]}),l?.originalWidth!=null&&l?.originalHeight!=null&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",l.originalWidth,"x",l.originalHeight]}),l?.originalFileSize!=null&&(0,p.jsxs)(o.Text,{color:"gray",children:["File: ",(Number(l.originalFileSize)/1024).toFixed(1)," KB"]}),i&&(0,p.jsxs)(o.Text,{color:"gray",children:["Original URL: ",i]}),s&&(0,p.jsxs)(o.Text,{color:"gray",children:["Thumbnail URL: ",a]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})]})},F=t(88161),V=(e,r)=>{if(!e)return"";var t="string"==typeof e?e:JSON.stringify(e);return t.length>r?t.slice(0,r-1)+"…":t},H=({onBack:e})=>{var r=a((0,i.useState)([]),2),t=r[0],n=r[1],s=a((0,i.useState)(!0),2),d=s[0],x=s[1],h=a((0,i.useState)(null),2),f=h[0],m=h[1];return(0,i.useEffect)(()=>{var e,r=(0,c.getCurrentProfile)(),t=(0,u.getConnectionContext)(r),i=t.auth,o=t.activityLogBaseUrl;if(!i){m("Not logged in. Run `bricks auth login` first."),x(!1);return}if(!o){m("Activity log URL not configured."),x(!1);return}var a=(0,F.createActivityLogClient)(o,i),s=new Date(Date.now()-36e5).toISOString(),d=new Date().toISOString(),h=new AbortController;return(e=l(function*(){try{var e=yield a.collectEvents({start_time:s,end_time:d},{limit:50,signal:h.signal});n(e)}catch(e){"AbortError"!==e.name&&m(e.message)}x(!1)}),function(){return e.apply(this,arguments)})(),()=>h.abort()},[]),(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Activity Log (last 1h)"}),d&&(0,p.jsx)(T,{text:"Fetching events..."}),f&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",f]}),!d&&!f&&0===t.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No events found in the last hour"}),!d&&t.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginBottom:1,children:[(0,p.jsxs)(o.Text,{color:"gray",children:["Timestamp".padEnd(22)," ","Type".padEnd(12)," ","Device".padEnd(14)," ","Event Name".padEnd(24)," Sender"]}),t.map((e,r)=>(0,p.jsxs)(o.Text,{children:[new Date(e.timestamp).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z").padEnd(22)," ",V(e.event_type||"",12).padEnd(12)," ",V(e.device_id||"",14).padEnd(14)," ",V(e.event_name||"",24).padEnd(24)," ",V(e.sender||"",16)]},r)),t.length>=50&&(0,p.jsxs)(o.Text,{color:"yellow",children:["Showing first ",50," events"]})]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:r=>"back"===r.value&&e()})]})},z=t(29253),Y=t(44618),q=["B","C","G","D"],J=({instanceType:e,instance:r,client:t,onDone:n,onCancel:s})=>{var c,u=(0,o.useApp)().exit,d=a((0,i.useState)("select_ref"),2),x=d[0],h=d[1],f=a((0,i.useState)(""),2),m=f[0],y=f[1],g=a((0,i.useState)("search"),2),v=g[0],j=g[1],b=a((0,i.useState)(null),2),S=b[0],E=b[1],D=a((0,i.useState)(null),2),I=D[0],A=D[1],B=a((0,i.useState)(""),2),C=B[0],k=B[1],w=a((0,i.useState)(""),2),L=w[0],O=w[1],P=a((0,i.useState)(null),2),N=P[0],M=P[1],R=r?.short_edit?.ref_map||{},U=Object.entries(R).filter(([,e])=>e&&!e.hide),$=(0,Y.V)(R,{keyword:m,types:q}),G=$.flatMap(e=>[{label:e.label,value:`__header_${e.prefix}__`,isHeader:!0},...e.refs.map(({shortId:e,ref:r})=>({label:`${r.title||e} (${e})`,value:e,ref:r}))]),F=[...m?[{label:"↻ Clear Search",value:"__clear_search__"}]:[],{label:"← Back",value:"__back__"}],V=G.length>0?[...G,...F]:F,H=V.findIndex(e=>!e.isHeader&&!e.value?.startsWith("__"));(0,o.useInput)((e,r)=>{r.tab&&"select_ref"===x?j(e=>"search"===e?"list":"search"):(r.escape&&("select_ref"===x&&s(),"input_path"===x&&h("select_ref"),"input_content"===x&&h("input_path"),"confirm"===x&&h("input_content"),"done"===x&&s()),"q"===e&&"input_path"!==x&&"input_content"!==x&&("select_ref"!==x||"search"!==v)&&u())},{isActive:!0});var J=(c=l(function*(){if(t&&r?._id&&S){h("submitting"),M(null);try{var l={shortId:S,path:C.trim(),content:(e=>{var r=e.trim();if(""===r)return null;try{return JSON.parse(r)}catch{return r}})(L),forwardDataLink:!0};I?.inner_ref?.pid&&(l.innerRefParentShortId=I.inner_ref.pid),"application"===e?yield t.shortEditApplication({id:r._id,list:[l]}):yield t.shortEditModule({id:r._id,list:[l]}),yield n(),h("done")}catch(e){M(e.message),h("confirm")}}}),function(){return c.apply(this,arguments)});return r?.short_edit?.enabled?0===U.length?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"yellow",children:"No Short Edit references found."}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:s})]}):"select_ref"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,children:"Short Edit References"}),(0,p.jsx)(o.Text,{color:"gray",dimColor:!0,children:"Showing: Brick, Canvas, Generator, Data"}),(0,p.jsxs)(o.Box,{marginTop:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"gray",children:"Search (title or shortId)"}),(0,p.jsx)(z.A,{value:m,placeholder:"type to filter, Enter to focus list",onChange:e=>y(e),onSubmit:()=>j("list"),focus:"search"===v}),(0,p.jsx)(o.Text,{color:"gray",dimColor:!0,children:"Press Tab to switch focus"})]}),(0,p.jsxs)(o.Box,{marginTop:1,children:[0===$.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No references match your search."}),(0,p.jsx)(_.Ay,{items:V,isFocused:"list"===v,initialIndex:H>-1?H:0,indicatorComponent:()=>null,itemComponent:({label:e,isSelected:r,isHeader:t})=>t?(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(o.Text,{bold:!0,color:"white",children:e})}):(0,p.jsxs)(o.Text,{color:r?"blue":void 0,children:[r?"❯":" "," ",e]}),onSelect:e=>{if("__back__"===e.value)return void s();if("__clear_search__"===e.value){y(""),j("search");return}e.isHeader||(E(e.value),A(e.ref),h("input_path"))}})]})]}):"input_path"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Reference:"," ",(0,p.jsxs)(o.Text,{color:"cyan",children:[I?.title||S," (",S,")"]})]}),(0,p.jsx)(o.Text,{marginTop:1,children:"Enter property path (e.g. title, property.backgroundColor)"}),N&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",N]}),(0,p.jsx)(z.A,{value:C,placeholder:"path",onChange:e=>{k(e),N&&M(null)},onSubmit:e=>{var r=e.trim();r?(k(r),h("input_content")):M("Path is required")},focus:!0})]}):"input_content"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C})]}),(0,p.jsx)(o.Text,{marginTop:1,children:"Enter new content (JSON or plain text). Empty to clear."}),N&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",N]}),(0,p.jsx)(z.A,{value:L,placeholder:"content",onChange:e=>{O(e),N&&M(null)},onSubmit:()=>h("confirm"),focus:!0})]}):"submitting"===x?(0,p.jsx)(T,{text:"Applying short edit..."}):"done"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"green",children:"Short edit applied successfully."}),(0,p.jsx)(_.Ay,{items:[{label:"Edit another property",value:"again"},{label:"← Back",value:"back"}],onSelect:e=>{"again"===e.value?(h("select_ref"),E(null),A(null),k(""),O(""),M(null)):s()}})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Confirm Short Edit"}),(0,p.jsxs)(o.Text,{children:["Reference:"," ",(0,p.jsxs)(o.Text,{color:"cyan",children:[I?.title||S," (",S,")"]})]}),(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C})]}),(0,p.jsxs)(o.Text,{children:["Content: ",(0,p.jsx)(o.Text,{color:"cyan",children:L||"<empty>"})]}),N&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",N]}),(0,p.jsx)(_.Ay,{items:[{label:"Apply",value:"apply"},{label:"Edit Path",value:"edit_path"},{label:"Edit Content",value:"edit_content"},{label:"← Back",value:"back"}],onSelect:e=>{"apply"===e.value&&J(),"edit_path"===e.value&&h("input_path"),"edit_content"===e.value&&h("input_content"),"back"===e.value&&s()}})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"yellow",children:["Short Edit is not enabled for this ",e,"."]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:s})]})},K=t(16928),W=t(79896),X=t(10750),Q=t(77768),Z="options",ee="output_dir",er="confirm",et="generating",en="post_install",el="done",ei=({type:e,instance:r,client:t,onDone:n,onCancel:s})=>{var c,u=(0,o.useApp)().exit,d=a((0,i.useState)(Z),2),x=d[0],h=d[1],m=a((0,i.useState)({setupGitHubActions:!0,setupAgents:!0,setupClaudeCode:!0,setupGeminiCLI:!1,runBunInstall:!0,initGit:!0}),2),y=m[0],g=m[1],v=a((0,i.useState)(process.cwd()),2),j=v[0],T=v[1],b=a((0,i.useState)(""),2),S=b[0],E=b[1],D=a((0,i.useState)(null),2),I=D[0],A=D[1],B=a((0,i.useState)(null),2),C=B[0],k=B[1],w=X(r?.name||"bricks-ctor"),L=K.resolve(j,w),O=(0,i.useCallback)(e=>{"back"===e.value?s():"continue"===e.value?h(ee):g(r=>({...r,[e.value]:!r[e.value]}))},[s]),P=(0,i.useCallback)(()=>{W.existsSync(L)?A(`Directory already exists: ${L}`):(A(null),h(er))},[L]),N=(0,i.useCallback)((c=l(function*(n){if("back"===n.value)return void h(ee);if("cancel"===n.value)return void s();if("confirm"===n.value){h(et);try{E("Fetching project from BRICKS...");var l="application"===e,i=l?t.queries.applicationProject:t.queries.moduleProject,o=(yield t.query(i,{id:r._id,buildApplicationOnly:!1,setupGitHubActions:y.setupGitHubActions,setupAgents:y.setupAgents,setupClaudeCode:y.setupClaudeCode,setupGeminiCLI:y.setupGeminiCLI}))[l?"applicationProject":"moduleProject"];if(!o?.files)throw Error("Failed to fetch project files");E("Creating project directory..."),W.mkdirSync(L,{recursive:!0}),E(`Writing ${o.files.length} files...`);var a=yield(0,Q.KN)(o.files,L);(0,Q.oz)(a),h(en);var c={path:L,files:o.files.length,bunInstalled:!1,gitInitialized:!1};Object.assign(c,(yield(0,Q.o0)(L,{install:y.runBunInstall,git:y.initGit,onStatus:E}))),k(c),h(el)}catch(e){A(e.message),h(Z)}}}),function(e){return c.apply(this,arguments)}),[t,r,e,y,L,s]),M=(0,i.useCallback)(e=>{"exit"===e.value?u():n()},[u,n]);if(x===Z){var R=[{label:`${y.setupGitHubActions?"[x]":"[ ]"} GitHub Actions workflow`,value:"setupGitHubActions"},{label:`${y.setupAgents?"[x]":"[ ]"} AGENTS.md`,value:"setupAgents"},{label:`${y.setupClaudeCode?"[x]":"[ ]"} CLAUDE.md`,value:"setupClaudeCode"},{label:`${y.setupGeminiCLI?"[x]":"[ ]"} GEMINI.md`,value:"setupGeminiCLI"},{label:`${y.runBunInstall?"[x]":"[ ]"} Run bun install after generation`,value:"runBunInstall"},{label:`${y.initGit?"[x]":"[ ]"} Initialize git repository`,value:"initGit"},{label:"→ Continue",value:"continue"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Initialize BRICKS Project: ",r?.name||"Untitled"]}),(0,p.jsx)(o.Text,{color:"gray",marginBottom:1,children:"Select options for project generation (press Enter to toggle)"}),I&&(0,p.jsxs)(o.Text,{color:"red",marginBottom:1,children:["Error: ",I]}),(0,p.jsx)(_.Ay,{items:R,onSelect:O})]})}return x===ee?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Output Directory"}),(0,p.jsx)(o.Text,{color:"gray",marginBottom:1,children:"Enter the parent directory for the project:"}),I&&(0,p.jsx)(o.Text,{color:"red",marginBottom:1,children:I}),(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{children:"Directory: "}),(0,p.jsx)(z.A,{value:j,onChange:T,onSubmit:P})]}),(0,p.jsxs)(o.Text,{color:"gray",marginTop:1,children:["Project will be created at: ",L]})]}):x===er?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Confirm Project Generation"}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Name: ",(0,p.jsx)(o.Text,{color:"green",children:r?.name||"Untitled"})]}),(0,p.jsxs)(o.Text,{children:["Type: ",(0,p.jsx)(o.Text,{color:"yellow",children:e})]}),(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:L})]}),(0,p.jsx)(o.Text,{color:"gray",marginTop:1,children:"Options:"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - GitHub Actions: ",y.setupGitHubActions?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - AGENTS.md: ",y.setupAgents?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - CLAUDE.md: ",y.setupClaudeCode?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - GEMINI.md: ",y.setupGeminiCLI?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - Run bun install: ",y.runBunInstall?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - Initialize git: ",y.initGit?"Yes":"No"]})]}),(0,p.jsx)(_.Ay,{items:[{label:"Confirm & Generate",value:"confirm"},{label:"← Change Directory",value:"back"},{label:"Cancel",value:"cancel"}],onSelect:N})]}):x===et||x===en?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Generating Project..."}),(0,p.jsxs)(o.Box,{marginY:1,children:[(0,p.jsx)(o.Text,{color:"green",children:(0,p.jsx)(f.A,{type:"dots"})}),(0,p.jsxs)(o.Text,{children:[" ",S]})]})]}):x===el&&C?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"green",children:"Project initialized successfully!"}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C.path})]}),(0,p.jsxs)(o.Text,{children:["Files: ",(0,p.jsx)(o.Text,{color:"green",children:C.files})]}),(0,p.jsxs)(o.Text,{children:["Dependencies:"," ",(0,p.jsx)(o.Text,{color:C.bunInstalled?"green":"yellow",children:C.bunInstalled?"Installed":"Not installed (run bun install manually)"})]}),(0,p.jsxs)(o.Text,{children:["Git:"," ",(0,p.jsx)(o.Text,{color:C.gitInitialized?"green":"yellow",children:C.gitInitialized?"Initialized":"Not initialized"})]})]}),(0,p.jsx)(o.Text,{bold:!0,marginY:1,children:"Next steps:"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" cd ",w]}),!C.bunInstalled&&(0,p.jsx)(o.Text,{color:"gray",children:" bun install"}),(0,p.jsx)(o.Text,{color:"gray",children:" bun invoke-simulator"}),(0,p.jsxs)(o.Text,{color:"gray",marginTop:1,children:["For more information, see ",w,"/README.md"]}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:[{label:"← Back to Detail",value:"back"},{label:"Exit CLI",value:"exit"}],onSelect:M})})]}):null};let eo=()=>{var e,r,t,n,h,f,m,g,b=(0,o.useApp)().exit,_=a((0,i.useState)(x.MAIN),2),E=_[0],D=_[1],N=a((0,i.useState)(null),2),F=N[0],V=N[1],z=a((0,i.useState)(null),2),Y=z[0],q=z[1],K=a((0,i.useState)(!0),2),W=K[0],X=K[1],Q=a((0,i.useState)(null),2),Z=Q[0],ee=Q[1],er=a((0,i.useState)(!1),2),et=er[0],en=er[1],el=a((0,i.useState)([]),2),eo=el[0],ea=el[1],es=a((0,i.useState)(null),2),ec=es[0],eu=es[1],ed=a((0,i.useState)([]),2),ex=ed[0],eh=ed[1],ef=a((0,i.useState)(null),2),em=ef[0],ep=ef[1],ey=a((0,i.useState)([]),2),eg=ey[0],ev=ey[1],ej=a((0,i.useState)(null),2),eT=ej[0],eb=ej[1],e_=a((0,i.useState)([]),2),eS=e_[0],eE=e_[1],eD=a((0,i.useState)(null),2),eI=eD[0],eA=eD[1],eB=a((0,i.useState)([]),2),eC=eB[0],ek=eB[1],ew=a((0,i.useState)(!1),2),eL=ew[0],eO=ew[1],eP=a((0,i.useState)(null),2),eN=eP[0],eM=eP[1],eR=a((0,i.useState)(null),2),eU=eR[0],e$=eR[1],eG=a((0,i.useState)(null),2),eF=eG[0],eV=eG[1],eH=a((0,i.useState)(null),2),ez=eH[0],eY=eH[1],eq=a((0,i.useState)([]),2),eJ=eq[0],eK=eq[1],eW=a((0,i.useState)(null),2),eX=eW[0],eQ=eW[1],eZ=a((0,i.useState)([]),2),e0=eZ[0],e1=eZ[1],e2=a((0,i.useState)(null),2),e6=e2[0],e4=e2[1],e8=E===x.DEVICES,e7=E===x.DEVICE_DETAIL,e9=E===x.GROUPS,e5=E===x.GROUP_DETAIL;(0,i.useEffect)(()=>{var e=(0,c.getCurrentProfile)(),r=(0,u.getConnectionContext)(e),t=r.auth,n=r.baseUrl;if(en(!!r.activityLogBaseUrl),!t){ee("Not logged in. Run `bricks auth login` first."),X(!1);return}var l=(0,s.createClient)(n,t);V(l),l.workspace().then(e=>{q(e),X(!1)}).catch(e=>{ee(e.message),X(!1)})},[]),(0,o.useInput)((e,r)=>{"q"===e&&b(),r.escape&&(E===x.DEVICE_CONTROL?(D(x.DEVICE_DETAIL),eM(null)):E===x.DEVICE_SCREENSHOT?(D(x.DEVICE_DETAIL),eV(null),eY(null)):E===x.DEVICE_DETAIL?(D(x.DEVICES),eu(null)):E===x.APP_DETAIL?(D(x.APPS),ep(null)):E===x.MODULE_DETAIL?(D(x.MODULES),eb(null)):E===x.GROUP_DETAIL?(D(x.GROUPS),eA(null),ek([])):E===x.MEDIA_FILE_DETAIL?(D(x.MEDIA_FILES),e4(null)):E===x.MEDIA_FILES?(D(x.MEDIA_BOX_DETAIL),e4(null)):E===x.MEDIA_BOX_DETAIL?(D(x.MEDIA_BOXES),eQ(null),e1([])):E===x.MEDIA_BOXES?D(x.MAIN):E!==x.MAIN&&D(x.MAIN))},{isActive:E!==x.APP_SHORT_EDIT&&E!==x.MODULE_SHORT_EDIT&&E!==x.APP_PROJECT_INIT&&E!==x.MODULE_PROJECT_INIT});var e3=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.devices({});ea(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),re=(0,i.useCallback)((e=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.device({id:e});eu(r)}catch(e){e$(e.message)}X(!1)}}),function(r){return e.apply(this,arguments)}),[F]),rr=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.applications({});eh(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rt=(0,i.useCallback)((r=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.application({id:e});ep(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return r.apply(this,arguments)}),[F]),rn=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.modules({});ev(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rl=(0,i.useCallback)((t=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.module({id:e});eb(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return t.apply(this,arguments)}),[F]),ri=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.deviceGroups({});eE(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),ro=(0,i.useCallback)((n=l(function*(e){if(F){X(!0),e$(null);try{var r=yield Promise.all([F.deviceGroup({id:e}),F.devicesByGroup({id:e})]),t=a(r,2),n=t[0],l=t[1];eA(n),ek(l||[])}catch(e){e$(e.message)}X(!1)}}),function(e){return n.apply(this,arguments)}),[F]),ra=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.mediaBoxes();eK(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rs=(0,i.useCallback)((h=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.mediaBox({id:e});eQ(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return h.apply(this,arguments)}),[F]),rc=(0,i.useCallback)((f=l(function*(e){if(F){X(!0);try{var r=yield F.mediaFiles({boxId:e});e1(r||[])}catch(e){ee(e.message)}X(!1)}}),function(e){return f.apply(this,arguments)}),[F]),ru=(0,i.useCallback)((m=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.mediaFile({id:e});e4(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return m.apply(this,arguments)}),[F]),rd=(0,i.useCallback)((g=l(function*(e){if(F&&ec){eO(!0),eM(null);try{yield F.controlDevice({id:ec._id,type:e}),eM({success:!0,message:`Command sent: ${e}`})}catch(e){eM({success:!1,message:e.message})}eO(!1)}}),function(e){return g.apply(this,arguments)}),[F,ec]),rx=(0,i.useCallback)(l(function*(e=!1){if(F&&ec&&Y){X(!0),eY(null),eV(null);try{e&&(yield F.controlDevice({id:ec._id,type:"take-screenshot"}),yield new Promise(e=>setTimeout(e,3e3)));var r=yield(0,d.fetchAndSaveScreenshot)(F,Y,ec._id,null,{preferThumbnail:!0});r.error?eY(r.error):eV(r)}catch(e){eY(e.message)}X(!1)}}),[F,ec,Y]),rh=y((0,i.useCallback)(()=>{F&&e3()},[F,e3]),e8),rf=y((0,i.useCallback)(()=>{F&&ec&&re(ec._id)},[F,ec,re]),e7),rm=y((0,i.useCallback)(()=>{F&&ri()},[F,ri]),e9),rp=y((0,i.useCallback)(()=>{F&&eI&&ro(eI._id)},[F,eI,ro]),e5);return W&&!Y?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(v,{workspace:Y,view:E}),(0,p.jsx)(T,{text:"Connecting to workspace..."})]}):Z&&!Y?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(v,{workspace:Y,view:E}),(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",Z]}),(0,p.jsx)(j,{})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(v,{workspace:Y,view:E}),E===x.MAIN&&(0,p.jsx)(S,{onSelect:e=>{"exit"===e.value?b():(D(e.value),e.value===x.DEVICES?e3():e.value===x.APPS?rr():e.value===x.MODULES?rn():e.value===x.GROUPS?ri():e.value===x.MEDIA_BOXES&&ra())},mediaEnabled:(0,d.isMediaEnabled)(Y),activityLogEnabled:et}),E===x.DEVICES&&(0,p.jsx)(I,{devices:eo,loading:W,onSelect:e=>{if("back"===e.value)return void D(x.MAIN);if("refresh"===e.value){e3(),rh.resetCountdown();return}eu(null),X(!0),D(x.DEVICE_DETAIL),re(e.value)},countdown:rh.countdown,lastRefreshTime:rh.lastRefreshTime}),E===x.DEVICE_DETAIL&&(0,p.jsx)(A,{device:ec,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.DEVICES),eu(null);return}if("refresh"===e.value){re(ec._id),rf.resetCountdown();return}"control"===e.value&&(D(x.DEVICE_CONTROL),eM(null)),"screenshot"===e.value&&(D(x.DEVICE_SCREENSHOT),eV(null),eY(null),rx(!1))},mediaEnabled:(0,d.isMediaEnabled)(Y),countdown:rf.countdown,lastRefreshTime:rf.lastRefreshTime}),E===x.DEVICE_CONTROL&&(0,p.jsx)(B,{device:ec,onSelect:e=>{if("back"===e.value){D(x.DEVICE_DETAIL),eM(null);return}rd(e.value)},controlling:eL,controlResult:eN}),E===x.DEVICE_SCREENSHOT&&(0,p.jsx)(C,{device:ec,screenshot:eF,loading:W,error:ez,onSelect:e=>{if("back"===e.value){D(x.DEVICE_DETAIL),eV(null),eY(null);return}"refresh"===e.value?rx(!1):"take"===e.value&&rx(!0)}}),E===x.APPS&&(0,p.jsx)(k,{apps:ex,loading:W,onSelect:e=>{"back"===e.value?D(x.MAIN):"refresh"===e.value?rr():(ep(null),X(!0),D(x.APP_DETAIL),rt(e.value))}}),E===x.APP_DETAIL&&(0,p.jsx)(w,{app:em,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.APPS),ep(null);return}"refresh"===e.value?rt(em._id):("short_edit"===e.value&&(D(x.APP_SHORT_EDIT),e$(null)),"project_init"===e.value&&(D(x.APP_PROJECT_INIT),e$(null)))}}),E===x.APP_SHORT_EDIT&&(0,p.jsx)(J,{instanceType:"application",instance:em,client:F,onDone:l(function*(){return rt(em._id)}),onCancel:()=>D(x.APP_DETAIL)}),E===x.APP_PROJECT_INIT&&(0,p.jsx)(ei,{type:"application",instance:em,client:F,onDone:()=>D(x.APP_DETAIL),onCancel:()=>D(x.APP_DETAIL)}),E===x.MODULES&&(0,p.jsx)(L,{modules:eg,loading:W,onSelect:e=>{"back"===e.value?D(x.MAIN):"refresh"===e.value?rn():(eb(null),X(!0),D(x.MODULE_DETAIL),rl(e.value))}}),E===x.MODULE_DETAIL&&(0,p.jsx)(O,{module:eT,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.MODULES),eb(null);return}"refresh"===e.value?rl(eT._id):("short_edit"===e.value&&(D(x.MODULE_SHORT_EDIT),e$(null)),"project_init"===e.value&&(D(x.MODULE_PROJECT_INIT),e$(null)))}}),E===x.MODULE_SHORT_EDIT&&(0,p.jsx)(J,{instanceType:"module",instance:eT,client:F,onDone:l(function*(){return rl(eT._id)}),onCancel:()=>D(x.MODULE_DETAIL)}),E===x.MODULE_PROJECT_INIT&&(0,p.jsx)(ei,{type:"module",instance:eT,client:F,onDone:()=>D(x.MODULE_DETAIL),onCancel:()=>D(x.MODULE_DETAIL)}),E===x.GROUPS&&(0,p.jsx)(P,{groups:eS,loading:W,onSelect:e=>{if("back"===e.value)return void D(x.MAIN);if("refresh"===e.value){ri(),rm.resetCountdown();return}eA(null),ek([]),X(!0),D(x.GROUP_DETAIL),ro(e.value)},countdown:rm.countdown,lastRefreshTime:rm.lastRefreshTime}),E===x.GROUP_DETAIL&&(0,p.jsx)(M,{group:eI,groupDevices:eC,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.GROUPS),eA(null),ek([]);return}"refresh"===e.value&&(ro(eI._id),rp.resetCountdown())},countdown:rp.countdown,lastRefreshTime:rp.lastRefreshTime}),E===x.ACTIVITY_LOG&&(0,p.jsx)(H,{onBack:()=>D(x.MAIN)}),E===x.MEDIA_BOXES&&(0,p.jsx)(R,{boxes:eJ,loading:W,onSelect:e=>{"back"===e.value?D(x.MAIN):"refresh"===e.value?ra():(eQ(null),e1([]),X(!0),D(x.MEDIA_BOX_DETAIL),rs(e.value))}}),E===x.MEDIA_BOX_DETAIL&&(0,p.jsx)(U,{box:eX,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.MEDIA_BOXES),eQ(null),e1([]);return}"refresh"===e.value?rs(eX.id):"files"===e.value&&(e1([]),e4(null),D(x.MEDIA_FILES),rc(eX.id))}}),E===x.MEDIA_FILES&&(0,p.jsx)($,{files:e0,box:eX,loading:W,onSelect:e=>{if("back"===e.value){D(x.MEDIA_BOX_DETAIL),e4(null);return}"refresh"===e.value?rc(eX.id):(e4(null),X(!0),D(x.MEDIA_FILE_DETAIL),ru(e.value))}}),E===x.MEDIA_FILE_DETAIL&&(0,p.jsx)(G,{file:e6,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.MEDIA_FILES),e4(null);return}"refresh"===e.value&&ru(e6.id)}}),(0,p.jsx)(j,{})]})};var ea="1"===process.env.BRICKS_CLI_DISTRIBUTION,es=(n=l(function*(){if(ea)return void(0,o.render)((0,p.jsx)(eo,{}));var e=(yield t.e(8166).then(t.bind(t,29557))).TerminalInfoProvider;(0,o.render)((0,p.jsx)(e,{children:(0,p.jsx)(eo,{})}))}),function(){return n.apply(this,arguments)})},88161(e,r,t){t.r(r),t.d(r,{ActivityLogClient:()=>w,createActivityLogClient:()=>L});var n,l,i,o,a,s=t(67996),c=t(99436),u=t(5018),d=t(44668),x=t(4275),h=t(32235),f=t(62192),m=t(79657),p=t(64007);function y(e){var r,t,n,l=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);l--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new g(r.call(e));t="@@asyncIterator",n="@@iterator"}throw TypeError("Object is not async iterable")}function g(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(g=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new g(e)}function*v(e){if(e.errors?.length)throw Error(e.errors.map(e=>e.message).join("\n"));if(e.data){for(var r of Object.values(e.data))if(Array.isArray(r))for(var t of r)yield t}if(Array.isArray(e.incremental)){for(var n of e.incremental)if(Array.isArray(n.items))for(var l of n.items)yield l}}function j(){return(j=x(function*(e){var r=e.headers.get("content-type")||"";if(r.includes("application/json")){var t=yield h(e.json());if(t.errors?.length)throw Error(t.errors.map(e=>e.message).join("\n"));var n=Object.keys(t.data||{})[0];if(n&&Array.isArray(t.data[n]))for(var l of t.data[n])yield l;return}var i=r.match(/boundary="?([^";]+)"?/),o=i?i[1]:"-",a=`--${o}`,s="",c=!1,u=new TextDecoder,d=e=>{for(var r=0;-1!==(r=e.indexOf(a,r));){if(0===r||"\n"===e[r-1])return r;r+=a.length}return -1},x=function*(){for(var e;-1!==(e=d(s));){var r=s.slice(0,e);(s=s.slice(e+a.length)).startsWith("\r\n")?s=s.slice(2):s.startsWith("\n")&&(s=s.slice(1));var t=r.indexOf("\r\n\r\n"),n=-1!==t?r.slice(t+4).trim():r.trim();if(n){var l=void 0;try{l=JSON.parse(n)}catch{continue}if(yield*v(l),!1===l.hasNext){c=!0;return}}}};try{var m=!1,p=!1;try{for(var g,j,T=y(e.body);m=!(j=yield h(T.next())).done;m=!1){var b=j.value;if(s+=u.decode(b,{stream:!0}),yield*f(y(x()),h),c)break}}catch(e){p=!0,g=e}finally{try{m&&null!=T.return&&(yield h(T.return()))}finally{if(p)throw g}}}catch(e){if(!e.message?.includes("Premature close")||!c)throw e}if(!c&&s.trim()){var _,S=s.indexOf("\r\n\r\n"),E=-1!==S?s.slice(S+4).trim():s.trim();if(E&&!E.startsWith("--")){try{_=JSON.parse(E)}catch{}_&&(yield*f(y(v(_)),h),!1===_.hasNext&&(c=!0))}}e.body?.destroy()})).apply(this,arguments)}function T(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(T=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new T(e)}var b=Buffer.from("\r\n\r\n"),_=Buffer.from("\n\n"),S=e=>{var r=e.indexOf(b),t=b.length;if(-1===r&&(r=e.indexOf(_),t=_.length),-1===r)return null;var n=(e=>{var r={};for(var t of e.toString("latin1").split(/\r?\n/)){var n=t.indexOf(":");n<=0||(r[t.slice(0,n).trim().toLowerCase()]=t.slice(n+1).trim())}return r})(e.subarray(0,r)),l=e.subarray(r+t);if(!l.length)return null;var i=Number.parseInt(n["content-length"],10);return(Number.isInteger(i)&&i>=0&&i<=l.length?l=l.subarray(0,i):l.length>=2&&13===l[l.length-2]&&10===l[l.length-1]?l=l.subarray(0,l.length-2):l.length>=1&&10===l[l.length-1]&&(l=l.subarray(0,l.length-1)),l.length)?{headers:n,body:l}:null},E=(e,r)=>{for(var t=0;-1!==(t=e.indexOf(r,t));){if(0===t||10===e[t-1])return t;t+=r.length}return -1};function D(){return(D=x(function*(e){var r=e.headers.get("content-type")||"",t=r.match(/boundary="?([^";]+)"?/);if(!t)throw Error(`Expected a multipart stream, got "${r||"no content-type"}"`);var n=Buffer.from(`--${t[1]}`),l=Buffer.alloc(0);try{var i=!1,o=!1;try{for(var a,s,c=function(e){var r,t,n,l=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);l--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new T(r.call(e));t="@@asyncIterator",n="@@iterator"}throw TypeError("Object is not async iterable")}(e.body);i=!(s=yield h(c.next())).done;i=!1){var u=s.value;l=l.length?Buffer.concat([l,u]):Buffer.from(u);for(var d=void 0;-1!==(d=E(l,n));){var x=l.subarray(0,d);l=l.subarray(d+n.length);var f=x.length>4?S(x):null;if(f){var m=f.headers["x-timestamp"],p=m?Date.parse(m):NaN;yield{...f,timestamp:Number.isNaN(p)?null:p}}}}}catch(e){o=!0,a=e}finally{try{i&&null!=c.return&&(yield h(c.return()))}finally{if(o)throw a}}}finally{e.body?.destroy?.()}var y=l.length>4?S(l):null;if(y){var g=y.headers["x-timestamp"],v=g?Date.parse(g):NaN;yield{...y,timestamp:Number.isNaN(v)?null:v}}})).apply(this,arguments)}var I=`
1
+ import*as e from"ink";import*as r from"react";import*as t from"react/jsx-runtime";export const __rspack_esm_id=7294;export const __rspack_esm_ids=[7294];export const __webpack_modules__={8498(r){r.exports=e},51649(e){e.exports=r},71178(e){e.exports=t},94685(e,r,t){t.r(r),t.d(r,{AppList:()=>k,CONTROL_ACTIONS:()=>h,MainMenu:()=>S,Header:()=>v,ModuleDetail:()=>O,ONLINE_THRESHOLD_MS:()=>m.RZ,ShortEditEditor:()=>J,MediaFileList:()=>$,App:()=>eo,DeviceDetail:()=>A,VIEWS:()=>x,runInteractiveMode:()=>es,DeviceList:()=>I,MediaBoxList:()=>R,Loading:()=>T,DeviceControl:()=>B,ProjectInitView:()=>ei,GroupDetail:()=>M,ModuleList:()=>L,MediaBoxDetail:()=>U,GroupList:()=>P,Footer:()=>j,DeviceStatus:()=>b,AppDetail:()=>w,DeviceScreenshot:()=>C,MediaFileDetail:()=>G});var n,l=t(99436),i=t(51649),o=t(8498),a=t(68832),s=t(85382),c=t(47988),u=t(31802),d=t(60450),x={MAIN:"main",DEVICES:"devices",DEVICE_DETAIL:"device_detail",DEVICE_CONTROL:"device_control",DEVICE_SCREENSHOT:"device_screenshot",APPS:"apps",APP_DETAIL:"app_detail",APP_SHORT_EDIT:"app_short_edit",APP_PROJECT_INIT:"app_project_init",MODULES:"modules",MODULE_DETAIL:"module_detail",MODULE_SHORT_EDIT:"module_short_edit",MODULE_PROJECT_INIT:"module_project_init",GROUPS:"groups",GROUP_DETAIL:"group_detail",MEDIA_BOXES:"media_boxes",MEDIA_BOX_DETAIL:"media_box_detail",MEDIA_FILES:"media_files",MEDIA_FILE_DETAIL:"media_file_detail",ACTIVITY_LOG:"activity_log"},h=[{label:"Refresh Application",value:"refresh"},{label:"Clear Cache",value:"clear-cache"},{label:"Take Screenshot",value:"take-screenshot"},{label:"Open System Menu",value:"system-menu-open"},{label:"Close System Menu",value:"system-menu-close"},{label:"Open Debug Panel",value:"debug-panel-open"},{label:"Close Debug Panel",value:"debug-panel-close"},{label:"Enable Logging",value:"logging-on"},{label:"Disable Logging",value:"logging-off"},{label:"← Back",value:"back"}],f=t(47882),m=t(9683),p=t(71178),y=(e,r=!0)=>{var t=Math.floor(60),n=a((0,i.useState)(t),2),l=n[0],o=n[1],s=a((0,i.useState)(null),2),c=s[0],u=s[1],d=(0,i.useRef)(e);(0,i.useEffect)(()=>{d.current=e},[e]);var x=(0,i.useCallback)(()=>{o(t),u(Date.now())},[t]);return(0,i.useEffect)(()=>{if(r){var e=setInterval(()=>{o(e=>e<=1?(d.current?.(),u(Date.now()),t):e-1)},1e3);return()=>clearInterval(e)}},[r,t]),(0,i.useEffect)(()=>{r&&(o(t),u(Date.now()))},[r,t]),{countdown:l,lastRefreshTime:c,resetCountdown:x}},g=({countdown:e,lastRefreshTime:r})=>(0,p.jsx)(o.Box,{children:(0,p.jsxs)(o.Text,{color:"gray",children:["Next refresh in ",(0,p.jsxs)(o.Text,{color:"cyan",children:[e,"s"]}),r&&(0,p.jsxs)(o.Text,{color:"gray",children:[" (last: ",r?new Date(r).toLocaleTimeString():null,")"]})]})}),v=({workspace:e,view:r})=>(0,p.jsxs)(o.Box,{flexDirection:"column",marginBottom:1,children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"BRICKS CLI"}),(0,p.jsx)(o.Text,{color:"gray",children:" - Interactive Mode"})]}),(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:"Workspace: "}),(0,p.jsx)(o.Text,{color:"green",children:e?.name||"Not connected"}),(0,p.jsx)(o.Text,{color:"gray",children:" | View: "}),(0,p.jsx)(o.Text,{color:"yellow",children:r})]}),(0,p.jsx)(o.Text,{color:"gray",children:"─".repeat(60)})]}),j=()=>(0,p.jsxs)(o.Box,{marginTop:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"gray",children:"─".repeat(60)}),(0,p.jsxs)(o.Text,{color:"gray",children:["Press ",(0,p.jsx)(o.Text,{color:"cyan",children:"q"})," to quit, ",(0,p.jsx)(o.Text,{color:"cyan",children:"Esc"})," to go back"]})]}),T=({text:e})=>(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"green",children:(0,p.jsx)(f.A,{type:"dots"})}),(0,p.jsxs)(o.Text,{children:[" ",e||"Loading..."]})]}),b=({lastAliveTime:e})=>{var r=(0,m.Ed)(e);return(0,p.jsx)(o.Text,{color:r.tone,children:(0,m.mz)(r)})},_=t(48724),S=({onSelect:e,mediaEnabled:r,activityLogEnabled:t})=>{var n=[{label:"Devices",value:x.DEVICES},{label:"Applications",value:x.APPS},{label:"Modules",value:x.MODULES},{label:"Device Groups",value:x.GROUPS},...r?[{label:"Media Flow",value:x.MEDIA_BOXES}]:[],...t?[{label:"Activity Log",value:x.ACTIVITY_LOG}]:[],{label:"Exit",value:"exit"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Main Menu"}),(0,p.jsx)(_.Ay,{items:n,onSelect:e})]})},E="1"===process.env.BRICKS_CLI_DISTRIBUTION,D=e=>{var r=a((0,i.useState)(null),2),n=r[0],l=r[1];return((0,i.useEffect)(()=>{if(!E){var e=!0;return t.e(8166).then(t.bind(t,29557)).then(r=>{e&&l(()=>r.default)}).catch(()=>{e&&l(!1)}),()=>{e=!1}}},[]),E||!1===n)?(0,p.jsx)(o.Text,{color:"gray",children:"Image preview is not available in this CLI build."}):n?(0,p.jsx)(n,{...e}):(0,p.jsx)(T,{text:"Preparing image preview..."})},I=({devices:e,loading:r,onSelect:t,countdown:n,lastRefreshTime:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading devices..."});if(!e?.length)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"yellow",children:"No devices found"}),(0,p.jsx)(g,{countdown:n,lastRefreshTime:l})]});var i=[...e.map(e=>{var r,t,n,l,i=(r=e.entry_detail?.watch_dog_timer?.last_alive_time,n=(t=(0,m.Ed)(r)).glyph,l=t.label,`${n} ${l}`);return{label:`${i} - ${e.name||e.device_name}`,value:e._id,device:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{marginBottom:1,children:[(0,p.jsxs)(o.Text,{bold:!0,children:["Devices (",e.length,")"]}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:n,lastRefreshTime:l})]}),(0,p.jsx)(_.Ay,{items:i,onSelect:t})]})},A=({device:e,loading:r,error:t,onSelect:n,mediaEnabled:l,countdown:i,lastRefreshTime:a})=>{if(r)return(0,p.jsx)(T,{text:"Loading device..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Device not found"});var s=[{label:"Control Device",value:"control"},...l?[{label:"View Screenshot",value:"screenshot"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],c=e.entry_detail,u=c?.screen,d=c?.update,x=c?.local_sync;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||e.device_name}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:i,lastRefreshTime:a})]}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:"Status: "}),(0,p.jsx)(b,{lastAliveTime:c?.watch_dog_timer?.last_alive_time})]}),(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),c?.application&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Application"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" Name: ",c.application.name]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" Mode: ",c.operation_mode||"N/A"]})]}),u&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Screen"}),u.resolution&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Resolution: ",u.resolution.width,"x",u.resolution.height,u.resolution.scale&&` @${u.resolution.scale}x`]}),u.orientation&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Orientation: ",u.orientation]}),u.touch&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Touch:"," ",u.touch.available?`Yes (${u.touch.touch_point} points)`:"No"]})]}),(c?.memory_usage||c?.disk_usage)&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"System"}),c.memory_usage&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Memory: ",Math.round(100*c.memory_usage),"%"]}),c.disk_usage&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Disk: ",Math.round(100*c.disk_usage),"%"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Capabilities"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Sound: ",c?.sound?.available?"✓":"✗"," | ","Camera: ",c?.camera?.available?"✓":"✗"," | ","Audio In: ",c?.audio_in?.available?"✓":"✗"]})]}),x&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Local Sync"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Role: ",x.is_main?"Main":"Peer",x.peer_count>0&&` | Peers: ${x.peer_count}`,x.mean_latency&&` | Latency: ${x.mean_latency}ms`]})]}),d&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Update"}),(0,p.jsxs)(o.Text,{color:d.need_update?"yellow":"gray",children:[" ","Status: ",d.need_update?"⚠ Update available":"✓ Up to date"]}),d.current_version&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Version: ",d.current_version]})]})]}),(0,p.jsx)(_.Ay,{items:s,onSelect:n})]})},B=({device:e,onSelect:r,controlling:t,controlResult:n})=>(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Control: ",e?.name||e?.device_name]}),t&&(0,p.jsx)(T,{text:"Sending command..."}),n&&(0,p.jsx)(o.Text,{color:n.success?"green":"red",children:n.message}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:h,onSelect:r})})]}),C=({device:e,screenshot:r,loading:t,error:n,onSelect:l})=>{var i=r?.file?.meta,a=i?.originalWidth!=null&&i?.originalHeight!=null,s=i?.originalFileSize!=null;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Screenshot: ",e?.name||e?.device_name||"Unknown"]}),t&&(0,p.jsx)(T,{text:"Loading screenshot..."}),n&&(0,p.jsx)(o.Box,{marginY:1,children:(0,p.jsx)(o.Text,{color:"red",children:String(n)})}),!t&&!n&&r&&(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Box,{height:30,children:(0,p.jsx)(D,{src:r.path,width:80,alt:"Device screenshot"})}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Screenshot Details"}),(0,p.jsxs)(o.Box,{marginY:1,children:[(0,p.jsx)(o.Text,{color:"green",children:"Screenshot saved to: "}),(0,p.jsx)(o.Text,{color:"cyan",children:String(r.path||"")})]}),a&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",String(i.originalWidth),"x",String(i.originalHeight)]}),s&&(0,p.jsxs)(o.Text,{color:"gray",children:["File: ",(Number(i.originalFileSize)/1024).toFixed(1)," KB"]}),r.file?.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:["Updated: ",new Date(r.file.updatedAt).toLocaleString()]})]})]}),!t&&!n&&!r&&(0,p.jsx)(o.Box,{marginY:1,children:(0,p.jsx)(o.Text,{color:"yellow",children:"No screenshot available. Try taking a new one."})}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:[{label:"Take New Screenshot",value:"take"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:l})})]})},k=({apps:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading applications..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No applications found"});var n=[...e.map(e=>({label:`${e.has_unreleased_changes?"●":"○"} ${e.name}`,value:e._id,app:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Applications (",e.length,")"]}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},w=({app:e,loading:r,error:t,onSelect:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading application..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Application not found"});var l=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],i=e.devices?.length||0,a=e.devices?.filter(e=>"online"===e.status)?.length||0;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Version"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,p.jsxs)(o.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]}),e.current_version_details&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Released: v",e.current_version_details.version||"N/A"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Devices"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Total: ",i,i>0&&` (${a} online)`]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Features"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Canvas Control: ",e.canvas_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Device Control: ",e.device_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:e.lock?.enabled?"yellow":"gray",children:[" ","Lock: ",e.lock?.enabled?"\uD83D\uDD12 Locked":"\uD83D\uDD13 Unlocked"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:l,onSelect:n})]})},L=({modules:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading modules..."});var n=[...(e||[]).map(e=>({label:`${e.current_version?"●":"○"} ${e.name}`,value:e._id,module:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Modules (",e?.length||0,")"]}),!e?.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No modules found"}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},O=({module:e,loading:r,error:t,onSelect:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading module..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Module not found"});var l=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Version"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,p.jsxs)(o.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Usage"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Used in: ",e.use_count?.total_count||0," application(s)"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Settings"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Public: ",e.is_public?"✓ Yes":"✗ No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modifiable: ",e.is_allow_modify?"✓ Yes":"✗ No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]})]}),e.expose_properties?.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Exposed Properties"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.expose_properties.length," properties exposed"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:l,onSelect:n})]})},P=({groups:e,loading:r,onSelect:t,countdown:n,lastRefreshTime:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading device groups..."});var i=[...(e||[]).map(e=>({label:`📁 ${e.name} (${e.devices?.length||0} devices)`,value:e._id,group:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{marginBottom:1,children:[(0,p.jsxs)(o.Text,{bold:!0,children:["Device Groups (",e?.length||0,")"]}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:n,lastRefreshTime:l})]}),!e?.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No device groups found"}),(0,p.jsx)(_.Ay,{items:i,onSelect:t})]})},N=({loading:e,groupDevices:r})=>e?(0,p.jsx)(T,{text:"Loading devices..."}):r?.length?(0,p.jsxs)(p.Fragment,{children:[r.slice(0,10).map(e=>(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:" "}),(0,p.jsx)(b,{lastAliveTime:e.entry_detail?.watch_dog_timer?.last_alive_time}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.name||e.device_name]}),e.device_target_name&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","(",e.device_target_name,")"]})]},e._id)),r.length>10&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","... and ",r.length-10," more"]})]}):(0,p.jsx)(o.Text,{color:"gray",children:" No devices in this group"}),M=({group:e,groupDevices:r,loading:t,error:n,onSelect:l,countdown:i,lastRefreshTime:a})=>t&&!e?(0,p.jsx)(T,{text:"Loading device group..."}):n?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",n]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]}):e?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(g,{countdown:i,lastRefreshTime:a})]}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsxs)(o.Text,{bold:!0,color:"white",children:["Devices (",e.devices?.length||0,")"]}),(0,p.jsx)(N,{loading:t,groupDevices:r})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:l})]}):(0,p.jsx)(o.Text,{color:"red",children:"Device group not found"}),R=({boxes:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading media boxes..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No media boxes found"});var n=[...e.map(e=>({label:`📦 ${e.name||"Unnamed"}`,value:e.id,box:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Media Boxes (",e.length,")"]}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},U=({box:e,loading:r,error:t,onSelect:n})=>r&&!e?(0,p.jsx)(T,{text:"Loading media box..."}):t?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]}):e?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e.id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),null!=e.size&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",e.size]}),e.passcodes?.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsxs)(o.Text,{bold:!0,color:"white",children:["Passcodes (",e.passcodes.length,")"]}),e.passcodes.slice(0,5).map(e=>(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.name||"Passcode"," (",(e.permissions||[]).join(", "),e.enableExpired?`, expires ${e.expiredAt} UTC`:"",")"]},e.id)),e.passcodes.length>5&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","... and ",e.passcodes.length-5," more"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"List Files",value:"files"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})]}):(0,p.jsx)(o.Text,{color:"red",children:"Media box not found"}),$=({files:e,loading:r,onSelect:t,box:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading media files..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No media files found"});var l=[...e.map(e=>{var r;return{label:`${"Image"===(r=e.fileType)?"\uD83D\uDDBC":"Video"===r?"\uD83C\uDF9E":"Audio"===r?"\uD83C\uDFB5":"\uD83D\uDCC4"} ${e.name||"Unnamed"}`,value:e.id,file:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Media Files (",e.length,")",n?.name?` - ${n.name}`:""]}),(0,p.jsx)(_.Ay,{items:l,onSelect:t})]})},G=({file:e,loading:r,error:t,onSelect:n})=>{if(r&&!e)return(0,p.jsx)(T,{text:"Loading media file..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Media file not found"});var l=e.meta,i=(0,d.buildScreenshotUrl)(e),a=(0,d.buildScreenshotUrl)(e,{preferThumbnail:!0}),s=!!(a&&a!==i);return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e.id]}),(0,p.jsxs)(o.Text,{color:"gray",children:["Box ID: ",e.boxId]}),(0,p.jsxs)(o.Text,{color:"gray",children:["Type: ",e.fileType]}),e.userTags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.userTags.join(", ")]}),l?.originalWidth!=null&&l?.originalHeight!=null&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",l.originalWidth,"x",l.originalHeight]}),l?.originalFileSize!=null&&(0,p.jsxs)(o.Text,{color:"gray",children:["File: ",(Number(l.originalFileSize)/1024).toFixed(1)," KB"]}),i&&(0,p.jsxs)(o.Text,{color:"gray",children:["Original URL: ",i]}),s&&(0,p.jsxs)(o.Text,{color:"gray",children:["Thumbnail URL: ",a]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})]})},F=t(88161),V=(e,r)=>{if(!e)return"";var t="string"==typeof e?e:JSON.stringify(e);return t.length>r?t.slice(0,r-1)+"…":t},H=({onBack:e})=>{var r=a((0,i.useState)([]),2),t=r[0],n=r[1],s=a((0,i.useState)(!0),2),d=s[0],x=s[1],h=a((0,i.useState)(null),2),f=h[0],m=h[1];return(0,i.useEffect)(()=>{var e,r=(0,c.getCurrentProfile)(),t=(0,u.getConnectionContext)(r),i=t.auth,o=t.activityLogBaseUrl;if(!i){m("Not logged in. Run `bricks auth login` first."),x(!1);return}if(!o){m("Activity log URL not configured."),x(!1);return}var a=(0,F.createActivityLogClient)(o,i),s=new Date(Date.now()-36e5).toISOString(),d=new Date().toISOString(),h=new AbortController;return(e=l(function*(){try{var e=yield a.collectEvents({start_time:s,end_time:d},{limit:50,signal:h.signal});n(e)}catch(e){"AbortError"!==e.name&&m(e.message)}x(!1)}),function(){return e.apply(this,arguments)})(),()=>h.abort()},[]),(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Activity Log (last 1h)"}),d&&(0,p.jsx)(T,{text:"Fetching events..."}),f&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",f]}),!d&&!f&&0===t.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No events found in the last hour"}),!d&&t.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginBottom:1,children:[(0,p.jsxs)(o.Text,{color:"gray",children:["Timestamp".padEnd(22)," ","Type".padEnd(12)," ","Device".padEnd(14)," ","Event Name".padEnd(24)," Sender"]}),t.map((e,r)=>(0,p.jsxs)(o.Text,{children:[new Date(e.timestamp).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z").padEnd(22)," ",V(e.event_type||"",12).padEnd(12)," ",V(e.device_id||"",14).padEnd(14)," ",V(e.event_name||"",24).padEnd(24)," ",V(e.sender||"",16)]},r)),t.length>=50&&(0,p.jsxs)(o.Text,{color:"yellow",children:["Showing first ",50," events"]})]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:r=>"back"===r.value&&e()})]})},z=t(29253),Y=t(44618),q=["B","C","G","D"],J=({instanceType:e,instance:r,client:t,onDone:n,onCancel:s})=>{var c,u=(0,o.useApp)().exit,d=a((0,i.useState)("select_ref"),2),x=d[0],h=d[1],f=a((0,i.useState)(""),2),m=f[0],y=f[1],g=a((0,i.useState)("search"),2),v=g[0],j=g[1],b=a((0,i.useState)(null),2),S=b[0],E=b[1],D=a((0,i.useState)(null),2),I=D[0],A=D[1],B=a((0,i.useState)(""),2),C=B[0],k=B[1],w=a((0,i.useState)(""),2),L=w[0],O=w[1],P=a((0,i.useState)(null),2),N=P[0],M=P[1],R=r?.short_edit?.ref_map||{},U=Object.entries(R).filter(([,e])=>e&&!e.hide),$=(0,Y.V)(R,{keyword:m,types:q}),G=$.flatMap(e=>[{label:e.label,value:`__header_${e.prefix}__`,isHeader:!0},...e.refs.map(({shortId:e,ref:r})=>({label:`${r.title||e} (${e})`,value:e,ref:r}))]),F=[...m?[{label:"↻ Clear Search",value:"__clear_search__"}]:[],{label:"← Back",value:"__back__"}],V=G.length>0?[...G,...F]:F,H=V.findIndex(e=>!e.isHeader&&!e.value?.startsWith("__"));(0,o.useInput)((e,r)=>{r.tab&&"select_ref"===x?j(e=>"search"===e?"list":"search"):(r.escape&&("select_ref"===x&&s(),"input_path"===x&&h("select_ref"),"input_content"===x&&h("input_path"),"confirm"===x&&h("input_content"),"done"===x&&s()),"q"===e&&"input_path"!==x&&"input_content"!==x&&("select_ref"!==x||"search"!==v)&&u())},{isActive:!0});var J=(c=l(function*(){if(t&&r?._id&&S){h("submitting"),M(null);try{var l={shortId:S,path:C.trim(),content:(e=>{var r=e.trim();if(""===r)return null;try{return JSON.parse(r)}catch{return r}})(L),forwardDataLink:!0};I?.inner_ref?.pid&&(l.innerRefParentShortId=I.inner_ref.pid),"application"===e?yield t.shortEditApplication({id:r._id,list:[l]}):yield t.shortEditModule({id:r._id,list:[l]}),yield n(),h("done")}catch(e){M(e.message),h("confirm")}}}),function(){return c.apply(this,arguments)});return r?.short_edit?.enabled?0===U.length?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"yellow",children:"No Short Edit references found."}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:s})]}):"select_ref"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,children:"Short Edit References"}),(0,p.jsx)(o.Text,{color:"gray",dimColor:!0,children:"Showing: Brick, Canvas, Generator, Data"}),(0,p.jsxs)(o.Box,{marginTop:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"gray",children:"Search (title or shortId)"}),(0,p.jsx)(z.A,{value:m,placeholder:"type to filter, Enter to focus list",onChange:e=>y(e),onSubmit:()=>j("list"),focus:"search"===v}),(0,p.jsx)(o.Text,{color:"gray",dimColor:!0,children:"Press Tab to switch focus"})]}),(0,p.jsxs)(o.Box,{marginTop:1,children:[0===$.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No references match your search."}),(0,p.jsx)(_.Ay,{items:V,isFocused:"list"===v,initialIndex:H>-1?H:0,indicatorComponent:()=>null,itemComponent:({label:e,isSelected:r,isHeader:t})=>t?(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(o.Text,{bold:!0,color:"white",children:e})}):(0,p.jsxs)(o.Text,{color:r?"blue":void 0,children:[r?"❯":" "," ",e]}),onSelect:e=>{if("__back__"===e.value)return void s();if("__clear_search__"===e.value){y(""),j("search");return}e.isHeader||(E(e.value),A(e.ref),h("input_path"))}})]})]}):"input_path"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Reference:"," ",(0,p.jsxs)(o.Text,{color:"cyan",children:[I?.title||S," (",S,")"]})]}),(0,p.jsx)(o.Text,{marginTop:1,children:"Enter property path (e.g. title, property.backgroundColor)"}),N&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",N]}),(0,p.jsx)(z.A,{value:C,placeholder:"path",onChange:e=>{k(e),N&&M(null)},onSubmit:e=>{var r=e.trim();r?(k(r),h("input_content")):M("Path is required")},focus:!0})]}):"input_content"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C})]}),(0,p.jsx)(o.Text,{marginTop:1,children:"Enter new content (JSON or plain text). Empty to clear."}),N&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",N]}),(0,p.jsx)(z.A,{value:L,placeholder:"content",onChange:e=>{O(e),N&&M(null)},onSubmit:()=>h("confirm"),focus:!0})]}):"submitting"===x?(0,p.jsx)(T,{text:"Applying short edit..."}):"done"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"green",children:"Short edit applied successfully."}),(0,p.jsx)(_.Ay,{items:[{label:"Edit another property",value:"again"},{label:"← Back",value:"back"}],onSelect:e=>{"again"===e.value?(h("select_ref"),E(null),A(null),k(""),O(""),M(null)):s()}})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Confirm Short Edit"}),(0,p.jsxs)(o.Text,{children:["Reference:"," ",(0,p.jsxs)(o.Text,{color:"cyan",children:[I?.title||S," (",S,")"]})]}),(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C})]}),(0,p.jsxs)(o.Text,{children:["Content: ",(0,p.jsx)(o.Text,{color:"cyan",children:L||"<empty>"})]}),N&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",N]}),(0,p.jsx)(_.Ay,{items:[{label:"Apply",value:"apply"},{label:"Edit Path",value:"edit_path"},{label:"Edit Content",value:"edit_content"},{label:"← Back",value:"back"}],onSelect:e=>{"apply"===e.value&&J(),"edit_path"===e.value&&h("input_path"),"edit_content"===e.value&&h("input_content"),"back"===e.value&&s()}})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"yellow",children:["Short Edit is not enabled for this ",e,"."]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:s})]})},K=t(16928),W=t(79896),X=t(10750),Q=t(77768),Z="options",ee="output_dir",er="confirm",et="generating",en="post_install",el="done",ei=({type:e,instance:r,client:t,onDone:n,onCancel:s})=>{var c,u=(0,o.useApp)().exit,d=a((0,i.useState)(Z),2),x=d[0],h=d[1],m=a((0,i.useState)({setupGitHubActions:!0,setupAgents:!0,setupClaudeCode:!0,setupGeminiCLI:!1,runBunInstall:!0,initGit:!0}),2),y=m[0],g=m[1],v=a((0,i.useState)(process.cwd()),2),j=v[0],T=v[1],b=a((0,i.useState)(""),2),S=b[0],E=b[1],D=a((0,i.useState)(null),2),I=D[0],A=D[1],B=a((0,i.useState)(null),2),C=B[0],k=B[1],w=X(r?.name||"bricks-ctor"),L=K.resolve(j,w),O=(0,i.useCallback)(e=>{"back"===e.value?s():"continue"===e.value?h(ee):g(r=>({...r,[e.value]:!r[e.value]}))},[s]),P=(0,i.useCallback)(()=>{W.existsSync(L)?A(`Directory already exists: ${L}`):(A(null),h(er))},[L]),N=(0,i.useCallback)((c=l(function*(n){if("back"===n.value)return void h(ee);if("cancel"===n.value)return void s();if("confirm"===n.value){h(et);try{E("Fetching project from BRICKS...");var l="application"===e,i=l?t.queries.applicationProject:t.queries.moduleProject,o=(yield t.query(i,{id:r._id,buildApplicationOnly:!1,setupGitHubActions:y.setupGitHubActions,setupAgents:y.setupAgents,setupClaudeCode:y.setupClaudeCode,setupGeminiCLI:y.setupGeminiCLI}))[l?"applicationProject":"moduleProject"];if(!o?.files)throw Error("Failed to fetch project files");E("Creating project directory..."),W.mkdirSync(L,{recursive:!0}),E(`Writing ${o.files.length} files...`);var a=yield(0,Q.KN)(o.files,L);(0,Q.oz)(a),h(en);var c={path:L,files:o.files.length,bunInstalled:!1,gitInitialized:!1};Object.assign(c,(yield(0,Q.o0)(L,{install:y.runBunInstall,git:y.initGit,onStatus:E}))),k(c),h(el)}catch(e){A(e.message),h(Z)}}}),function(e){return c.apply(this,arguments)}),[t,r,e,y,L,s]),M=(0,i.useCallback)(e=>{"exit"===e.value?u():n()},[u,n]);if(x===Z){var R=[{label:`${y.setupGitHubActions?"[x]":"[ ]"} GitHub Actions workflow`,value:"setupGitHubActions"},{label:`${y.setupAgents?"[x]":"[ ]"} AGENTS.md`,value:"setupAgents"},{label:`${y.setupClaudeCode?"[x]":"[ ]"} CLAUDE.md`,value:"setupClaudeCode"},{label:`${y.setupGeminiCLI?"[x]":"[ ]"} GEMINI.md`,value:"setupGeminiCLI"},{label:`${y.runBunInstall?"[x]":"[ ]"} Run bun install after generation`,value:"runBunInstall"},{label:`${y.initGit?"[x]":"[ ]"} Initialize git repository`,value:"initGit"},{label:"→ Continue",value:"continue"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Initialize BRICKS Project: ",r?.name||"Untitled"]}),(0,p.jsx)(o.Text,{color:"gray",marginBottom:1,children:"Select options for project generation (press Enter to toggle)"}),I&&(0,p.jsxs)(o.Text,{color:"red",marginBottom:1,children:["Error: ",I]}),(0,p.jsx)(_.Ay,{items:R,onSelect:O})]})}return x===ee?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Output Directory"}),(0,p.jsx)(o.Text,{color:"gray",marginBottom:1,children:"Enter the parent directory for the project:"}),I&&(0,p.jsx)(o.Text,{color:"red",marginBottom:1,children:I}),(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{children:"Directory: "}),(0,p.jsx)(z.A,{value:j,onChange:T,onSubmit:P})]}),(0,p.jsxs)(o.Text,{color:"gray",marginTop:1,children:["Project will be created at: ",L]})]}):x===er?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Confirm Project Generation"}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Name: ",(0,p.jsx)(o.Text,{color:"green",children:r?.name||"Untitled"})]}),(0,p.jsxs)(o.Text,{children:["Type: ",(0,p.jsx)(o.Text,{color:"yellow",children:e})]}),(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:L})]}),(0,p.jsx)(o.Text,{color:"gray",marginTop:1,children:"Options:"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - GitHub Actions: ",y.setupGitHubActions?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - AGENTS.md: ",y.setupAgents?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - CLAUDE.md: ",y.setupClaudeCode?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - GEMINI.md: ",y.setupGeminiCLI?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - Run bun install: ",y.runBunInstall?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - Initialize git: ",y.initGit?"Yes":"No"]})]}),(0,p.jsx)(_.Ay,{items:[{label:"Confirm & Generate",value:"confirm"},{label:"← Change Directory",value:"back"},{label:"Cancel",value:"cancel"}],onSelect:N})]}):x===et||x===en?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Generating Project..."}),(0,p.jsxs)(o.Box,{marginY:1,children:[(0,p.jsx)(o.Text,{color:"green",children:(0,p.jsx)(f.A,{type:"dots"})}),(0,p.jsxs)(o.Text,{children:[" ",S]})]})]}):x===el&&C?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"green",children:"Project initialized successfully!"}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C.path})]}),(0,p.jsxs)(o.Text,{children:["Files: ",(0,p.jsx)(o.Text,{color:"green",children:C.files})]}),(0,p.jsxs)(o.Text,{children:["Dependencies:"," ",(0,p.jsx)(o.Text,{color:C.bunInstalled?"green":"yellow",children:C.bunInstalled?"Installed":"Not installed (run bun install manually)"})]}),(0,p.jsxs)(o.Text,{children:["Git:"," ",(0,p.jsx)(o.Text,{color:C.gitInitialized?"green":"yellow",children:C.gitInitialized?"Initialized":"Not initialized"})]})]}),(0,p.jsx)(o.Text,{bold:!0,marginY:1,children:"Next steps:"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" cd ",w]}),!C.bunInstalled&&(0,p.jsx)(o.Text,{color:"gray",children:" bun install"}),(0,p.jsx)(o.Text,{color:"gray",children:" bun invoke-simulator"}),(0,p.jsxs)(o.Text,{color:"gray",marginTop:1,children:["For more information, see ",w,"/README.md"]}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:[{label:"← Back to Detail",value:"back"},{label:"Exit CLI",value:"exit"}],onSelect:M})})]}):null};let eo=()=>{var e,r,t,n,h,f,m,g,b=(0,o.useApp)().exit,_=a((0,i.useState)(x.MAIN),2),E=_[0],D=_[1],N=a((0,i.useState)(null),2),F=N[0],V=N[1],z=a((0,i.useState)(null),2),Y=z[0],q=z[1],K=a((0,i.useState)(!0),2),W=K[0],X=K[1],Q=a((0,i.useState)(null),2),Z=Q[0],ee=Q[1],er=a((0,i.useState)(!1),2),et=er[0],en=er[1],el=a((0,i.useState)([]),2),eo=el[0],ea=el[1],es=a((0,i.useState)(null),2),ec=es[0],eu=es[1],ed=a((0,i.useState)([]),2),ex=ed[0],eh=ed[1],ef=a((0,i.useState)(null),2),em=ef[0],ep=ef[1],ey=a((0,i.useState)([]),2),eg=ey[0],ev=ey[1],ej=a((0,i.useState)(null),2),eT=ej[0],eb=ej[1],e_=a((0,i.useState)([]),2),eS=e_[0],eE=e_[1],eD=a((0,i.useState)(null),2),eI=eD[0],eA=eD[1],eB=a((0,i.useState)([]),2),eC=eB[0],ek=eB[1],ew=a((0,i.useState)(!1),2),eL=ew[0],eO=ew[1],eP=a((0,i.useState)(null),2),eN=eP[0],eM=eP[1],eR=a((0,i.useState)(null),2),eU=eR[0],e$=eR[1],eG=a((0,i.useState)(null),2),eF=eG[0],eV=eG[1],eH=a((0,i.useState)(null),2),ez=eH[0],eY=eH[1],eq=a((0,i.useState)([]),2),eJ=eq[0],eK=eq[1],eW=a((0,i.useState)(null),2),eX=eW[0],eQ=eW[1],eZ=a((0,i.useState)([]),2),e0=eZ[0],e1=eZ[1],e2=a((0,i.useState)(null),2),e6=e2[0],e4=e2[1],e8=E===x.DEVICES,e7=E===x.DEVICE_DETAIL,e9=E===x.GROUPS,e5=E===x.GROUP_DETAIL;(0,i.useEffect)(()=>{var e=(0,c.getCurrentProfile)(),r=(0,u.getConnectionContext)(e),t=r.auth,n=r.baseUrl;if(en(!!r.activityLogBaseUrl),!t){ee("Not logged in. Run `bricks auth login` first."),X(!1);return}var l=(0,s.createClient)(n,t);V(l),l.workspace().then(e=>{q(e),X(!1)}).catch(e=>{ee(e.message),X(!1)})},[]),(0,o.useInput)((e,r)=>{"q"===e&&b(),r.escape&&(E===x.DEVICE_CONTROL?(D(x.DEVICE_DETAIL),eM(null)):E===x.DEVICE_SCREENSHOT?(D(x.DEVICE_DETAIL),eV(null),eY(null)):E===x.DEVICE_DETAIL?(D(x.DEVICES),eu(null)):E===x.APP_DETAIL?(D(x.APPS),ep(null)):E===x.MODULE_DETAIL?(D(x.MODULES),eb(null)):E===x.GROUP_DETAIL?(D(x.GROUPS),eA(null),ek([])):E===x.MEDIA_FILE_DETAIL?(D(x.MEDIA_FILES),e4(null)):E===x.MEDIA_FILES?(D(x.MEDIA_BOX_DETAIL),e4(null)):E===x.MEDIA_BOX_DETAIL?(D(x.MEDIA_BOXES),eQ(null),e1([])):E===x.MEDIA_BOXES?D(x.MAIN):E!==x.MAIN&&D(x.MAIN))},{isActive:E!==x.APP_SHORT_EDIT&&E!==x.MODULE_SHORT_EDIT&&E!==x.APP_PROJECT_INIT&&E!==x.MODULE_PROJECT_INIT});var e3=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.devices({});ea(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),re=(0,i.useCallback)((e=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.device({id:e});eu(r)}catch(e){e$(e.message)}X(!1)}}),function(r){return e.apply(this,arguments)}),[F]),rr=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.applications({});eh(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rt=(0,i.useCallback)((r=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.application({id:e});ep(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return r.apply(this,arguments)}),[F]),rn=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.modules({});ev(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rl=(0,i.useCallback)((t=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.module({id:e});eb(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return t.apply(this,arguments)}),[F]),ri=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.deviceGroups({});eE(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),ro=(0,i.useCallback)((n=l(function*(e){if(F){X(!0),e$(null);try{var r=yield Promise.all([F.deviceGroup({id:e}),F.devicesByGroup({id:e})]),t=a(r,2),n=t[0],l=t[1];eA(n),ek(l||[])}catch(e){e$(e.message)}X(!1)}}),function(e){return n.apply(this,arguments)}),[F]),ra=(0,i.useCallback)(l(function*(){if(F){X(!0);try{var e=yield F.mediaBoxes();eK(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rs=(0,i.useCallback)((h=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.mediaBox({id:e});eQ(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return h.apply(this,arguments)}),[F]),rc=(0,i.useCallback)((f=l(function*(e){if(F){X(!0);try{var r=yield F.mediaFiles({boxId:e});e1(r||[])}catch(e){ee(e.message)}X(!1)}}),function(e){return f.apply(this,arguments)}),[F]),ru=(0,i.useCallback)((m=l(function*(e){if(F){X(!0),e$(null);try{var r=yield F.mediaFile({id:e});e4(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return m.apply(this,arguments)}),[F]),rd=(0,i.useCallback)((g=l(function*(e){if(F&&ec){eO(!0),eM(null);try{yield F.controlDevice({id:ec._id,type:e}),eM({success:!0,message:`Command sent: ${e}`})}catch(e){eM({success:!1,message:e.message})}eO(!1)}}),function(e){return g.apply(this,arguments)}),[F,ec]),rx=(0,i.useCallback)(l(function*(e=!1){if(F&&ec&&Y){X(!0),eY(null),eV(null);try{e&&(yield F.controlDevice({id:ec._id,type:"take-screenshot"}),yield new Promise(e=>setTimeout(e,3e3)));var r=yield(0,d.fetchAndSaveScreenshot)(F,Y,ec._id,null,{preferThumbnail:!0});r.error?eY(r.error):eV(r)}catch(e){eY(e.message)}X(!1)}}),[F,ec,Y]),rh=y((0,i.useCallback)(()=>{F&&e3()},[F,e3]),e8),rf=y((0,i.useCallback)(()=>{F&&ec&&re(ec._id)},[F,ec,re]),e7),rm=y((0,i.useCallback)(()=>{F&&ri()},[F,ri]),e9),rp=y((0,i.useCallback)(()=>{F&&eI&&ro(eI._id)},[F,eI,ro]),e5);return W&&!Y?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(v,{workspace:Y,view:E}),(0,p.jsx)(T,{text:"Connecting to workspace..."})]}):Z&&!Y?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(v,{workspace:Y,view:E}),(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",Z]}),(0,p.jsx)(j,{})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(v,{workspace:Y,view:E}),E===x.MAIN&&(0,p.jsx)(S,{onSelect:e=>{"exit"===e.value?b():(D(e.value),e.value===x.DEVICES?e3():e.value===x.APPS?rr():e.value===x.MODULES?rn():e.value===x.GROUPS?ri():e.value===x.MEDIA_BOXES&&ra())},mediaEnabled:(0,d.isMediaEnabled)(Y),activityLogEnabled:et}),E===x.DEVICES&&(0,p.jsx)(I,{devices:eo,loading:W,onSelect:e=>{if("back"===e.value)return void D(x.MAIN);if("refresh"===e.value){e3(),rh.resetCountdown();return}eu(null),X(!0),D(x.DEVICE_DETAIL),re(e.value)},countdown:rh.countdown,lastRefreshTime:rh.lastRefreshTime}),E===x.DEVICE_DETAIL&&(0,p.jsx)(A,{device:ec,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.DEVICES),eu(null);return}if("refresh"===e.value){re(ec._id),rf.resetCountdown();return}"control"===e.value&&(D(x.DEVICE_CONTROL),eM(null)),"screenshot"===e.value&&(D(x.DEVICE_SCREENSHOT),eV(null),eY(null),rx(!1))},mediaEnabled:(0,d.isMediaEnabled)(Y),countdown:rf.countdown,lastRefreshTime:rf.lastRefreshTime}),E===x.DEVICE_CONTROL&&(0,p.jsx)(B,{device:ec,onSelect:e=>{if("back"===e.value){D(x.DEVICE_DETAIL),eM(null);return}rd(e.value)},controlling:eL,controlResult:eN}),E===x.DEVICE_SCREENSHOT&&(0,p.jsx)(C,{device:ec,screenshot:eF,loading:W,error:ez,onSelect:e=>{if("back"===e.value){D(x.DEVICE_DETAIL),eV(null),eY(null);return}"refresh"===e.value?rx(!1):"take"===e.value&&rx(!0)}}),E===x.APPS&&(0,p.jsx)(k,{apps:ex,loading:W,onSelect:e=>{"back"===e.value?D(x.MAIN):"refresh"===e.value?rr():(ep(null),X(!0),D(x.APP_DETAIL),rt(e.value))}}),E===x.APP_DETAIL&&(0,p.jsx)(w,{app:em,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.APPS),ep(null);return}"refresh"===e.value?rt(em._id):("short_edit"===e.value&&(D(x.APP_SHORT_EDIT),e$(null)),"project_init"===e.value&&(D(x.APP_PROJECT_INIT),e$(null)))}}),E===x.APP_SHORT_EDIT&&(0,p.jsx)(J,{instanceType:"application",instance:em,client:F,onDone:l(function*(){return rt(em._id)}),onCancel:()=>D(x.APP_DETAIL)}),E===x.APP_PROJECT_INIT&&(0,p.jsx)(ei,{type:"application",instance:em,client:F,onDone:()=>D(x.APP_DETAIL),onCancel:()=>D(x.APP_DETAIL)}),E===x.MODULES&&(0,p.jsx)(L,{modules:eg,loading:W,onSelect:e=>{"back"===e.value?D(x.MAIN):"refresh"===e.value?rn():(eb(null),X(!0),D(x.MODULE_DETAIL),rl(e.value))}}),E===x.MODULE_DETAIL&&(0,p.jsx)(O,{module:eT,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.MODULES),eb(null);return}"refresh"===e.value?rl(eT._id):("short_edit"===e.value&&(D(x.MODULE_SHORT_EDIT),e$(null)),"project_init"===e.value&&(D(x.MODULE_PROJECT_INIT),e$(null)))}}),E===x.MODULE_SHORT_EDIT&&(0,p.jsx)(J,{instanceType:"module",instance:eT,client:F,onDone:l(function*(){return rl(eT._id)}),onCancel:()=>D(x.MODULE_DETAIL)}),E===x.MODULE_PROJECT_INIT&&(0,p.jsx)(ei,{type:"module",instance:eT,client:F,onDone:()=>D(x.MODULE_DETAIL),onCancel:()=>D(x.MODULE_DETAIL)}),E===x.GROUPS&&(0,p.jsx)(P,{groups:eS,loading:W,onSelect:e=>{if("back"===e.value)return void D(x.MAIN);if("refresh"===e.value){ri(),rm.resetCountdown();return}eA(null),ek([]),X(!0),D(x.GROUP_DETAIL),ro(e.value)},countdown:rm.countdown,lastRefreshTime:rm.lastRefreshTime}),E===x.GROUP_DETAIL&&(0,p.jsx)(M,{group:eI,groupDevices:eC,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.GROUPS),eA(null),ek([]);return}"refresh"===e.value&&(ro(eI._id),rp.resetCountdown())},countdown:rp.countdown,lastRefreshTime:rp.lastRefreshTime}),E===x.ACTIVITY_LOG&&(0,p.jsx)(H,{onBack:()=>D(x.MAIN)}),E===x.MEDIA_BOXES&&(0,p.jsx)(R,{boxes:eJ,loading:W,onSelect:e=>{"back"===e.value?D(x.MAIN):"refresh"===e.value?ra():(eQ(null),e1([]),X(!0),D(x.MEDIA_BOX_DETAIL),rs(e.value))}}),E===x.MEDIA_BOX_DETAIL&&(0,p.jsx)(U,{box:eX,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.MEDIA_BOXES),eQ(null),e1([]);return}"refresh"===e.value?rs(eX.id):"files"===e.value&&(e1([]),e4(null),D(x.MEDIA_FILES),rc(eX.id))}}),E===x.MEDIA_FILES&&(0,p.jsx)($,{files:e0,box:eX,loading:W,onSelect:e=>{if("back"===e.value){D(x.MEDIA_BOX_DETAIL),e4(null);return}"refresh"===e.value?rc(eX.id):(e4(null),X(!0),D(x.MEDIA_FILE_DETAIL),ru(e.value))}}),E===x.MEDIA_FILE_DETAIL&&(0,p.jsx)(G,{file:e6,loading:W,error:eU,onSelect:e=>{if("back"===e.value){D(x.MEDIA_FILES),e4(null);return}"refresh"===e.value&&ru(e6.id)}}),(0,p.jsx)(j,{})]})};var ea="1"===process.env.BRICKS_CLI_DISTRIBUTION,es=(n=l(function*(){if(ea)return void(0,o.render)((0,p.jsx)(eo,{}));var e=(yield t.e(8166).then(t.bind(t,29557))).TerminalInfoProvider;(0,o.render)((0,p.jsx)(e,{children:(0,p.jsx)(eo,{})}))}),function(){return n.apply(this,arguments)})},88161(e,r,t){t.r(r),t.d(r,{ActivityLogClient:()=>w,createActivityLogClient:()=>L});var n,l,i,o,a,s=t(67996),c=t(99436),u=t(5018),d=t(44668),x=t(4275),h=t(32235),f=t(62192),m=t(79657),p=t(64007);function y(e){var r,t,n,l=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);l--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new g(r.call(e));t="@@asyncIterator",n="@@iterator"}throw TypeError("Object is not async iterable")}function g(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(g=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new g(e)}function*v(e){if(e.errors?.length)throw Error(e.errors.map(e=>e.message).join("\n"));if(e.data){for(var r of Object.values(e.data))if(Array.isArray(r))for(var t of r)yield t}if(Array.isArray(e.incremental)){for(var n of e.incremental)if(Array.isArray(n.items))for(var l of n.items)yield l}}function j(){return(j=x(function*(e){var r=e.headers.get("content-type")||"";if(r.includes("application/json")){var t=yield h(e.json());if(t.errors?.length)throw Error(t.errors.map(e=>e.message).join("\n"));var n=Object.keys(t.data||{})[0];if(n&&Array.isArray(t.data[n]))for(var l of t.data[n])yield l;return}var i=r.match(/boundary="?([^";]+)"?/),o=i?i[1]:"-",a=`--${o}`,s="",c=!1,u=new TextDecoder,d=e=>{for(var r=0;-1!==(r=e.indexOf(a,r));){if(0===r||"\n"===e[r-1])return r;r+=a.length}return -1},x=function*(){for(var e;-1!==(e=d(s));){var r=s.slice(0,e);(s=s.slice(e+a.length)).startsWith("\r\n")?s=s.slice(2):s.startsWith("\n")&&(s=s.slice(1));var t=r.indexOf("\r\n\r\n"),n=-1!==t?r.slice(t+4).trim():r.trim();if(n){var l=void 0;try{l=JSON.parse(n)}catch{continue}if(yield*v(l),!1===l.hasNext){c=!0;return}}}};try{var m=!1,p=!1;try{for(var g,j,T=y(e.body);m=!(j=yield h(T.next())).done;m=!1){var b=j.value;if(s+=u.decode(b,{stream:!0}),yield*f(y(x()),h),c)break}}catch(e){p=!0,g=e}finally{try{m&&null!=T.return&&(yield h(T.return()))}finally{if(p)throw g}}}catch(e){if(!e.message?.includes("Premature close")||!c)throw e}if(!c&&s.trim()){var _,S=s.indexOf("\r\n\r\n"),E=-1!==S?s.slice(S+4).trim():s.trim();if(E&&!E.startsWith("--")){try{_=JSON.parse(E)}catch{}_&&(yield*f(y(v(_)),h),!1===_.hasNext&&(c=!0))}}e.body?.destroy()})).apply(this,arguments)}function T(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(T=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new T(e)}var b=Buffer.from("\r\n\r\n"),_=Buffer.from("\n\n"),S=e=>{var r=e.indexOf(b),t=b.length;if(-1===r&&(r=e.indexOf(_),t=_.length),-1===r)return null;var n=(e=>{var r={};for(var t of e.toString("latin1").split(/\r?\n/)){var n=t.indexOf(":");n<=0||(r[t.slice(0,n).trim().toLowerCase()]=t.slice(n+1).trim())}return r})(e.subarray(0,r)),l=e.subarray(r+t);if(!l.length)return null;var i=Number.parseInt(n["content-length"],10);return(Number.isInteger(i)&&i>=0&&i<=l.length?l=l.subarray(0,i):l.length>=2&&13===l[l.length-2]&&10===l[l.length-1]?l=l.subarray(0,l.length-2):l.length>=1&&10===l[l.length-1]&&(l=l.subarray(0,l.length-1)),l.length)?{headers:n,body:l}:null},E=(e,r)=>{for(var t=0;-1!==(t=e.indexOf(r,t));){if(0===t||10===e[t-1])return t;t+=r.length}return -1};function D(){return(D=x(function*(e){var r=e.headers.get("content-type")||"",t=r.match(/boundary="?([^";]+)"?/);if(!t)throw Error(`Expected a multipart stream, got "${r||"no content-type"}"`);var n=Buffer.from(`--${t[1]}`),l=Buffer.alloc(0);try{var i=!1,o=!1;try{for(var a,s,c=function(e){var r,t,n,l=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);l--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new T(r.call(e));t="@@asyncIterator",n="@@iterator"}throw TypeError("Object is not async iterable")}(e.body);i=!(s=yield h(c.next())).done;i=!1){var u=s.value;l=l.length?Buffer.concat([l,u]):Buffer.from(u);for(var d=void 0;-1!==(d=E(l,n));){var x=l.subarray(0,d);l=l.subarray(d+n.length);var f=x.length>4?S(x):null;if(f){var m=f.headers["x-timestamp"],p=m?Date.parse(m):NaN;yield{...f,timestamp:Number.isNaN(p)?null:p}}}}}catch(e){o=!0,a=e}finally{try{i&&null!=c.return&&(yield h(c.return()))}finally{if(o)throw a}}}finally{e.body?.destroy?.()}var y=l.length>4?S(l):null;if(y){var g=y.headers["x-timestamp"],v=g?Date.parse(g):NaN;yield{...y,timestamp:Number.isNaN(v)?null:v}}})).apply(this,arguments)}var I=`
2
2
  query AL_events($filter: EventsFilter!) {
3
3
  events(filter: $filter) @stream {
4
4
  device_id
package/lib/7494.js CHANGED
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export const __webpack_modules__={59957(e,r,t){t.r(r),t.d(r,{BricksControllerClient:()=>m,createControllerClient:()=>v});var n,a,o,i=t(99436),s=t(5018),l=t(44668),c=t(54506),p=t(78549),u=t(94370),d=t(75149),h=c.ApolloClient,k=c.InMemoryCache,f=c.HttpLink,y=p.o,m=l(function e(r,t){s(this,e),this.baseUrl=r,this.endpoint="/api/graphql";var n,a=new f({uri:`${r}${this.endpoint}`,fetch:(0,d.P)(r)}),o=y((n=i(function*(e,{headers:r}){return{headers:{...r,authorization:`Bearer ${yield t()}`}}}),function(e,r){return n.apply(this,arguments)}));this.apolloClient=new h({link:o.concat(a),cache:new k,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"workspaces",value:(n=i(function*(){for(var e=(0,u.default)`
1
+ export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export const __webpack_modules__={59957(e,r,t){t.r(r),t.d(r,{BricksControllerClient:()=>m,createControllerClient:()=>v});var n,a,o,i=t(99436),l=t(5018),s=t(44668),c=t(54506),p=t(78549),u=t(94370),h=t(75149),d=c.ApolloClient,k=c.InMemoryCache,f=c.HttpLink,y=p.o,m=s(function e(r,t){l(this,e),this.baseUrl=r,this.endpoint="/api/graphql";var n,a=new f({uri:`${r}${this.endpoint}`,fetch:(0,h.createFetchForUrl)(r)}),o=y((n=i(function*(e,{headers:r}){return{headers:{...r,authorization:`Bearer ${yield t()}`}}}),function(e,r){return n.apply(this,arguments)}));this.apolloClient=new d({link:o.concat(a),cache:new k,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"workspaces",value:(n=i(function*(){for(var e=(0,u.default)`
2
2
  query cliWorkspaces($paginate: Paginate) {
3
3
  workspaces(paginate: $paginate) {
4
4
  _id
@@ -41,4 +41,4 @@ export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export co
41
41
  }
42
42
  }
43
43
  }
44
- `,n=yield this.apolloClient.mutate({mutation:t,variables:{id:e,tokens:r},errorPolicy:"all",fetchPolicy:"no-cache"}),a=n.data,o=n.errors;if(o?.length>0)throw Error(o.map(({message:e})=>e).join("\n"));return a.updateWorkspaceTokens.newTokens}),function(e){return o.apply(this,arguments)})}]),v=(e,r)=>new m(e,r)},75149(e,r,t){t.d(r,{P:()=>o});var n=t(79657),a=t(64007);function o(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return n.Ay;var t=new a(r);return(e,r={})=>(0,n.Ay)(e,{...r,agent:t})}}};
44
+ `,n=yield this.apolloClient.mutate({mutation:t,variables:{id:e,tokens:r},errorPolicy:"all",fetchPolicy:"no-cache"}),a=n.data,o=n.errors;if(o?.length>0)throw Error(o.map(({message:e})=>e).join("\n"));return a.updateWorkspaceTokens.newTokens}),function(e){return o.apply(this,arguments)})}]),v=(e,r)=>new m(e,r)},75149(e,r,t){t.r(r),t.d(r,{createFetchForUrl:()=>o});var n=t(79657),a=t(64007);function o(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return n.Ay;var t=new a(r);return(e,r={})=>(0,n.Ay)(e,{...r,agent:t})}}};