@fugood/bricks-cli 2.24.0-beta.7 → 2.24.0

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/779.js ADDED
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__=779;export const __webpack_esm_ids__=[779];export const __webpack_esm_modules__={18779:(e,l,r)=>{r.d(l,{App:()=>ae,AppDetail:()=>C,AppList:()=>B,CONTROL_ACTIONS:()=>h,DeviceControl:()=>I,DeviceDetail:()=>S,DeviceList:()=>E,DeviceScreenshot:()=>A,DeviceStatus:()=>y,Footer:()=>v,GroupDetail:()=>M,GroupList:()=>w,Header:()=>p,Loading:()=>_,MainMenu:()=>D,MediaBoxDetail:()=>R,MediaBoxList:()=>O,MediaFileDetail:()=>U,MediaFileList:()=>N,ModuleDetail:()=>L,ModuleList:()=>k,ONLINE_THRESHOLD_MS:()=>g,ProjectInitView:()=>oe,ShortEditEditor:()=>z,VIEWS:()=>u,runInteractiveMode:()=>se}),r.r(l);var t,n=r(51649),i=r(8498),o=r(29557),a=r(99436),s=r(68832),c=r(50700),d=r(74752),x=r(47336),u={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"}],g=3e5,m=r(47882),j=r(71178),T=(e,l=!0)=>{var r=Math.floor(60),t=(0,n.useState)(r),i=s(t,2),o=i[0],a=i[1],c=(0,n.useState)(null),d=s(c,2),x=d[0],u=d[1],h=(0,n.useRef)(e);(0,n.useEffect)(()=>{h.current=e},[e]);var g=(0,n.useCallback)(()=>{a(r),u(Date.now())},[r]);return(0,n.useEffect)(()=>{if(l){var e=setInterval(()=>{a(e=>e<=1?(h.current?.(),u(Date.now()),r):e-1)},1e3);return()=>clearInterval(e)}},[l,r]),(0,n.useEffect)(()=>{l&&(a(r),u(Date.now()))},[l,r]),{countdown:o,lastRefreshTime:x,resetCountdown:g}},f=({countdown:e,lastRefreshTime:l})=>(0,j.jsx)(i.Box,{children:(0,j.jsxs)(i.Text,{color:"gray",children:["Next refresh in ",(0,j.jsxs)(i.Text,{color:"cyan",children:[e,"s"]}),l&&(0,j.jsxs)(i.Text,{color:"gray",children:[" (last: ",l?new Date(l).toLocaleTimeString():null,")"]})]})}),p=({workspace:e,view:l})=>(0,j.jsxs)(i.Box,{flexDirection:"column",marginBottom:1,children:[(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:"BRICKS CLI"}),(0,j.jsx)(i.Text,{color:"gray",children:" - Interactive Mode"})]}),(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{color:"gray",children:"Workspace: "}),(0,j.jsx)(i.Text,{color:"green",children:e?.name||"Not connected"}),(0,j.jsx)(i.Text,{color:"gray",children:" | View: "}),(0,j.jsx)(i.Text,{color:"yellow",children:l})]}),(0,j.jsx)(i.Text,{color:"gray",children:"─".repeat(60)})]}),v=()=>(0,j.jsxs)(i.Box,{marginTop:1,flexDirection:"column",children:[(0,j.jsx)(i.Text,{color:"gray",children:"─".repeat(60)}),(0,j.jsxs)(i.Text,{color:"gray",children:["Press ",(0,j.jsx)(i.Text,{color:"cyan",children:"q"})," to quit, ",(0,j.jsx)(i.Text,{color:"cyan",children:"Esc"})," to go back"]})]}),_=({text:e})=>(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{color:"green",children:(0,j.jsx)(m.A,{type:"dots"})}),(0,j.jsxs)(i.Text,{children:[" ",e||"Loading..."]})]}),y=({lastAliveTime:e})=>{if(!e)return(0,j.jsx)(i.Text,{color:"gray",children:"○ Unknown"});var l=Date.now()-new Date(e).getTime();if(l<=g)return(0,j.jsx)(i.Text,{color:"green",children:"● Online"});var r=Math.floor(l/6e4);if(r<60)return(0,j.jsxs)(i.Text,{color:"yellow",children:["○ Offline (",r,"m ago)"]});var t=Math.floor(r/60);if(t<24)return(0,j.jsxs)(i.Text,{color:"red",children:["○ Offline (",t,"h ago)"]});var n=Math.floor(t/24);return(0,j.jsxs)(i.Text,{color:"red",children:["○ Offline (",n,"d ago)"]})},b=r(25291),D=({onSelect:e,mediaEnabled:l,activityLogEnabled:r})=>{var t=[{label:"Devices",value:u.DEVICES},{label:"Applications",value:u.APPS},{label:"Modules",value:u.MODULES},{label:"Device Groups",value:u.GROUPS},...l?[{label:"Media Flow",value:u.MEDIA_BOXES}]:[],...r?[{label:"Activity Log",value:u.ACTIVITY_LOG}]:[],{label:"Exit",value:"exit"}];return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,marginBottom:1,children:"Main Menu"}),(0,j.jsx)(b.Ay,{items:t,onSelect:e})]})},E=({devices:e,loading:l,onSelect:r,countdown:t,lastRefreshTime:n})=>{if(l)return(0,j.jsx)(_,{text:"Loading devices..."});if(!e?.length)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{color:"yellow",children:"No devices found"}),(0,j.jsx)(f,{countdown:t,lastRefreshTime:n})]});var o=[...e.map(e=>({label:`${(e=>{if(!e)return"○ Unknown";var l=Date.now()-new Date(e).getTime();if(l<=g)return"● Online";var r=Math.floor(l/6e4);if(r<60)return`○ ${r}m ago`;var t=Math.floor(r/60);return t<24?`○ ${t}h ago`:`○ ${Math.floor(t/24)}d ago`})(e.entry_detail?.watch_dog_timer?.last_alive_time)} - ${e.name||e.device_name}`,value:e._id,device:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Box,{marginBottom:1,children:[(0,j.jsxs)(i.Text,{bold:!0,children:["Devices (",e.length,")"]}),(0,j.jsx)(i.Text,{color:"gray",children:" - "}),(0,j.jsx)(f,{countdown:t,lastRefreshTime:n})]}),(0,j.jsx)(b.Ay,{items:o,onSelect:r})]})},S=({device:e,loading:l,error:r,onSelect:t,mediaEnabled:n,countdown:o,lastRefreshTime:a})=>{if(l)return(0,j.jsx)(_,{text:"Loading device..."});if(r)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",r]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:t})]});if(!e)return(0,j.jsx)(i.Text,{color:"red",children:"Device not found"});var s=[{label:"Control Device",value:"control"},...n?[{label:"View Screenshot",value:"screenshot"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],c=e.entry_detail,d=c?.screen,x=c?.update,u=c?.local_sync;return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:e.name||e.device_name}),(0,j.jsx)(i.Text,{color:"gray",children:" - "}),(0,j.jsx)(f,{countdown:o,lastRefreshTime:a})]}),e.description&&(0,j.jsx)(i.Text,{color:"gray",children:e.description}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{color:"gray",children:"Status: "}),(0,j.jsx)(y,{lastAliveTime:c?.watch_dog_timer?.last_alive_time})]}),(0,j.jsxs)(i.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,j.jsxs)(i.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),c?.application&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Application"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" Name: ",c.application.name]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" Mode: ",c.operation_mode||"N/A"]})]}),d&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Screen"}),d.resolution&&(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Resolution: ",d.resolution.width,"x",d.resolution.height,d.resolution.scale&&` @${d.resolution.scale}x`]}),d.orientation&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Orientation: ",d.orientation]}),d.touch&&(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Touch:"," ",d.touch.available?`Yes (${d.touch.touch_point} points)`:"No"]})]}),(c?.memory_usage||c?.disk_usage)&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"System"}),c.memory_usage&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Memory: ",Math.round(100*c.memory_usage),"%"]}),c.disk_usage&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Disk: ",Math.round(100*c.disk_usage),"%"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Capabilities"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Sound: ",c?.sound?.available?"✓":"✗"," | ","Camera: ",c?.camera?.available?"✓":"✗"," | ","Audio In: ",c?.audio_in?.available?"✓":"✗"]})]}),u&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Local Sync"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Role: ",u.is_main?"Main":"Peer",u.peer_count>0&&` | Peers: ${u.peer_count}`,u.mean_latency&&` | Latency: ${u.mean_latency}ms`]})]}),x&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Update"}),(0,j.jsxs)(i.Text,{color:x.need_update?"yellow":"gray",children:[" ","Status: ",x.need_update?"⚠ Update available":"✓ Up to date"]}),x.current_version&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Version: ",x.current_version]})]})]}),(0,j.jsx)(b.Ay,{items:s,onSelect:t})]})},I=({device:e,onSelect:l,controlling:r,controlResult:t})=>(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,color:"cyan",children:["Control: ",e?.name||e?.device_name]}),r&&(0,j.jsx)(_,{text:"Sending command..."}),t&&(0,j.jsx)(i.Text,{color:t.success?"green":"red",children:t.message}),(0,j.jsx)(i.Box,{marginTop:1,children:(0,j.jsx)(b.Ay,{items:h,onSelect:l})})]}),A=({device:e,screenshot:l,loading:r,error:t,onSelect:n})=>{var a=l?.file?.meta,s=null!=a?.originalWidth&&null!=a?.originalHeight,c=null!=a?.originalFileSize;return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,color:"cyan",children:["Screenshot: ",e?.name||e?.device_name||"Unknown"]}),r&&(0,j.jsx)(_,{text:"Loading screenshot..."}),t&&(0,j.jsx)(i.Box,{marginY:1,children:(0,j.jsx)(i.Text,{color:"red",children:String(t)})}),!r&&!t&&l&&(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Box,{height:30,children:(0,j.jsx)(o.default,{src:l.path,width:80,alt:"Device screenshot"})}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Screenshot Details"}),(0,j.jsxs)(i.Box,{marginY:1,children:[(0,j.jsx)(i.Text,{color:"green",children:"Screenshot saved to: "}),(0,j.jsx)(i.Text,{color:"cyan",children:String(l.path||"")})]}),s&&(0,j.jsxs)(i.Text,{color:"gray",children:["Size: ",String(a.originalWidth),"x",String(a.originalHeight)]}),c&&(0,j.jsxs)(i.Text,{color:"gray",children:["File: ",(Number(a.originalFileSize)/1024).toFixed(1)," KB"]}),l.file?.updatedAt&&(0,j.jsxs)(i.Text,{color:"gray",children:["Updated: ",new Date(l.file.updatedAt).toLocaleString()]})]})]}),!r&&!t&&!l&&(0,j.jsx)(i.Box,{marginY:1,children:(0,j.jsx)(i.Text,{color:"yellow",children:"No screenshot available. Try taking a new one."})}),(0,j.jsx)(i.Box,{marginTop:1,children:(0,j.jsx)(b.Ay,{items:[{label:"Take New Screenshot",value:"take"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})})]})},B=({apps:e,loading:l,onSelect:r})=>{if(l)return(0,j.jsx)(_,{text:"Loading applications..."});if(!e?.length)return(0,j.jsx)(i.Text,{color:"yellow",children:"No applications found"});var t=[...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,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,marginBottom:1,children:["Applications (",e.length,")"]}),(0,j.jsx)(b.Ay,{items:t,onSelect:r})]})},C=({app:e,loading:l,error:r,onSelect:t})=>{if(l)return(0,j.jsx)(_,{text:"Loading application..."});if(r)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",r]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:t})]});if(!e)return(0,j.jsx)(i.Text,{color:"red",children:"Application not found"});var n=[{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"}],o=e.devices?.length||0,a=e.devices?.filter(e=>"online"===e.status)?.length||0;return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,j.jsx)(i.Text,{color:"gray",children:e.description}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,j.jsxs)(i.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Version"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,j.jsxs)(i.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]}),e.current_version_details&&(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Released: v",e.current_version_details.version||"N/A"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Devices"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Total: ",o,o>0&&` (${a} online)`]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Features"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Canvas Control: ",e.canvas_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Device Control: ",e.device_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,j.jsxs)(i.Text,{color:e.lock?.enabled?"yellow":"gray",children:[" ","Lock: ",e.lock?.enabled?"🔒 Locked":"🔓 Unlocked"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,j.jsx)(b.Ay,{items:n,onSelect:t})]})},k=({modules:e,loading:l,onSelect:r})=>{if(l)return(0,j.jsx)(_,{text:"Loading modules..."});var t=[...(e||[]).map(e=>({label:`${e.current_version?"●":"○"} ${e.name}`,value:e._id,module:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,marginBottom:1,children:["Modules (",e?.length||0,")"]}),!e?.length&&(0,j.jsx)(i.Text,{color:"yellow",children:"No modules found"}),(0,j.jsx)(b.Ay,{items:t,onSelect:r})]})},L=({module:e,loading:l,error:r,onSelect:t})=>{if(l)return(0,j.jsx)(_,{text:"Loading module..."});if(r)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",r]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:t})]});if(!e)return(0,j.jsx)(i.Text,{color:"red",children:"Module not found"});var n=[{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,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,j.jsx)(i.Text,{color:"gray",children:e.description}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,j.jsxs)(i.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Version"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,j.jsxs)(i.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Usage"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Used in: ",e.use_count?.total_count||0," application(s)"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Settings"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Public: ",e.is_public?"✓ Yes":"✗ No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Modifiable: ",e.is_allow_modify?"✓ Yes":"✗ No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]})]}),e.expose_properties?.length>0&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Exposed Properties"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ",e.expose_properties.length," properties exposed"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,j.jsx)(b.Ay,{items:n,onSelect:t})]})},w=({groups:e,loading:l,onSelect:r,countdown:t,lastRefreshTime:n})=>{if(l)return(0,j.jsx)(_,{text:"Loading device groups..."});var o=[...(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,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Box,{marginBottom:1,children:[(0,j.jsxs)(i.Text,{bold:!0,children:["Device Groups (",e?.length||0,")"]}),(0,j.jsx)(i.Text,{color:"gray",children:" - "}),(0,j.jsx)(f,{countdown:t,lastRefreshTime:n})]}),!e?.length&&(0,j.jsx)(i.Text,{color:"yellow",children:"No device groups found"}),(0,j.jsx)(b.Ay,{items:o,onSelect:r})]})},P=({loading:e,groupDevices:l})=>e?(0,j.jsx)(_,{text:"Loading devices..."}):l?.length?(0,j.jsxs)(j.Fragment,{children:[l.slice(0,10).map(e=>(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{color:"gray",children:" "}),(0,j.jsx)(y,{lastAliveTime:e.entry_detail?.watch_dog_timer?.last_alive_time}),(0,j.jsxs)(i.Text,{color:"gray",children:[" ",e.name||e.device_name]}),e.device_target_name&&(0,j.jsxs)(i.Text,{color:"gray",dimColor:!0,children:[" ","(",e.device_target_name,")"]})]},e._id)),l.length>10&&(0,j.jsxs)(i.Text,{color:"gray",dimColor:!0,children:[" ","... and ",l.length-10," more"]})]}):(0,j.jsx)(i.Text,{color:"gray",children:" No devices in this group"}),M=({group:e,groupDevices:l,loading:r,error:t,onSelect:n,countdown:o,lastRefreshTime:a})=>{if(r&&!e)return(0,j.jsx)(_,{text:"Loading device group..."});if(t)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",t]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]});if(!e)return(0,j.jsx)(i.Text,{color:"red",children:"Device group not found"});return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:e.name}),(0,j.jsx)(i.Text,{color:"gray",children:" - "}),(0,j.jsx)(f,{countdown:o,lastRefreshTime:a})]}),e.description&&(0,j.jsx)(i.Text,{color:"gray",children:e.description}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,j.jsxs)(i.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsxs)(i.Text,{bold:!0,color:"white",children:["Devices (",e.devices?.length||0,")"]}),(0,j.jsx)(P,{loading:r,groupDevices:l})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,j.jsxs)(i.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,j.jsx)(b.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})]})},O=({boxes:e,loading:l,onSelect:r})=>{if(l)return(0,j.jsx)(_,{text:"Loading media boxes..."});if(!e?.length)return(0,j.jsx)(i.Text,{color:"yellow",children:"No media boxes found"});var t=[...e.map(e=>({label:`📦 ${e.name||"Unnamed"}`,value:e.id,box:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,marginBottom:1,children:["Media Boxes (",e.length,")"]}),(0,j.jsx)(b.Ay,{items:t,onSelect:r})]})},R=({box:e,loading:l,error:r,onSelect:t})=>{if(l&&!e)return(0,j.jsx)(_,{text:"Loading media box..."});if(r)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",r]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:t})]});if(!e)return(0,j.jsx)(i.Text,{color:"red",children:"Media box not found"});return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,j.jsx)(i.Text,{color:"gray",children:e.description}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"gray",children:["ID: ",e.id]}),e.tags?.length>0&&(0,j.jsxs)(i.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),null!=e.size&&(0,j.jsxs)(i.Text,{color:"gray",children:["Size: ",e.size]}),e.passcodes?.length>0&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsxs)(i.Text,{bold:!0,color:"white",children:["Passcodes (",e.passcodes.length,")"]}),e.passcodes.slice(0,5).map(e=>(0,j.jsxs)(i.Text,{color:"gray",children:[" ",e.name||"Passcode",": ",e.code]},e.id)),e.passcodes.length>5&&(0,j.jsxs)(i.Text,{color:"gray",dimColor:!0,children:[" ","... and ",e.passcodes.length-5," more"]})]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,j.jsx)(b.Ay,{items:[{label:"List Files",value:"files"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:t})]})},N=({files:e,loading:l,onSelect:r,box:t})=>{if(l)return(0,j.jsx)(_,{text:"Loading media files..."});if(!e?.length)return(0,j.jsx)(i.Text,{color:"yellow",children:"No media files found"});var n=[...e.map(e=>{return{label:`${l=e.fileType,"Image"===l?"🖼":"Video"===l?"🎞":"Audio"===l?"🎵":"📄"} ${e.name||"Unnamed"}`,value:e.id,file:e};var l}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,marginBottom:1,children:["Media Files (",e.length,")",t?.name?` - ${t.name}`:""]}),(0,j.jsx)(b.Ay,{items:n,onSelect:r})]})},U=({file:e,loading:l,error:r,onSelect:t})=>{if(l&&!e)return(0,j.jsx)(_,{text:"Loading media file..."});if(r)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",r]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:t})]});if(!e)return(0,j.jsx)(i.Text,{color:"red",children:"Media file not found"});var n=e.meta,o=(0,x.Gu)(e),a=(0,x.Gu)(e,{preferThumbnail:!0}),s=Boolean(a&&a!==o);return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,j.jsx)(i.Text,{color:"gray",children:e.description}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"gray",children:["ID: ",e.id]}),(0,j.jsxs)(i.Text,{color:"gray",children:["Box ID: ",e.boxId]}),(0,j.jsxs)(i.Text,{color:"gray",children:["Type: ",e.fileType]}),e.userTags?.length>0&&(0,j.jsxs)(i.Text,{color:"gray",children:["Tags: ",e.userTags.join(", ")]}),null!=n?.originalWidth&&null!=n?.originalHeight&&(0,j.jsxs)(i.Text,{color:"gray",children:["Size: ",n.originalWidth,"x",n.originalHeight]}),null!=n?.originalFileSize&&(0,j.jsxs)(i.Text,{color:"gray",children:["File: ",(Number(n.originalFileSize)/1024).toFixed(1)," KB"]}),o&&(0,j.jsxs)(i.Text,{color:"gray",children:["Original URL: ",o]}),s&&(0,j.jsxs)(i.Text,{color:"gray",children:["Thumbnail URL: ",a]}),(0,j.jsxs)(i.Box,{flexDirection:"column",marginTop:1,children:[(0,j.jsx)(i.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,j.jsxs)(i.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,j.jsx)(b.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:t})]})},G=r(77146),V=(e,l)=>{if(!e)return"";var r="string"==typeof e?e:JSON.stringify(e);return r.length>l?r.slice(0,l-1)+"…":r},F=({onBack:e})=>{var l=(0,n.useState)([]),r=s(l,2),t=r[0],o=r[1],c=(0,n.useState)(!0),x=s(c,2),u=x[0],h=x[1],g=(0,n.useState)(null),m=s(g,2),T=m[0],f=m[1];(0,n.useEffect)(()=>{var e=(0,d.getCurrentProfile)(),l=(0,d.getToken)(e),r=(0,d.getActivityLogBaseUrl)();if(!l)return f("Not logged in. Run `bricks auth login` first."),void h(!1);if(!r)return f("Activity log URL not configured."),void h(!1);var t,n=(0,G.W)(r,l),i=new Date(Date.now()-36e5).toISOString(),s=(new Date).toISOString(),c=new AbortController;return(t=a(function*(){try{var e=yield n.collectEvents({start_time:i,end_time:s},{limit:50,signal:c.signal});o(e)}catch(e){"AbortError"!==e.name&&f(e.message)}h(!1)}),function(){return t.apply(this,arguments)})(),()=>c.abort()},[]);return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,marginBottom:1,children:"Activity Log (last 1h)"}),u&&(0,j.jsx)(_,{text:"Fetching events..."}),T&&(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",T]}),!u&&!T&&0===t.length&&(0,j.jsx)(i.Text,{color:"yellow",children:"No events found in the last hour"}),!u&&t.length>0&&(0,j.jsxs)(i.Box,{flexDirection:"column",marginBottom:1,children:[(0,j.jsxs)(i.Text,{color:"gray",children:["Timestamp".padEnd(22)," ","Type".padEnd(12)," ","Device".padEnd(14)," ","Event Name".padEnd(24)," Sender"]}),t.map((e,l)=>{return(0,j.jsxs)(i.Text,{children:[(r=e.timestamp,new Date(r).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)]},l);var r}),t.length>=50&&(0,j.jsxs)(i.Text,{color:"yellow",children:["Showing first ",50," events"]})]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l=>"back"===l.value&&e()})]})},H=r(29253),$=r(35704),Y=["B","C","G","D"],z=({instanceType:e,instance:l,client:r,onDone:t,onCancel:o})=>{var c=(0,i.useApp)().exit,d=(0,n.useState)("select_ref"),x=s(d,2),u=x[0],h=x[1],g=(0,n.useState)(""),m=s(g,2),T=m[0],f=m[1],p=(0,n.useState)("search"),v=s(p,2),y=v[0],D=v[1],E=(0,n.useState)(null),S=s(E,2),I=S[0],A=S[1],B=(0,n.useState)(null),C=s(B,2),k=C[0],L=C[1],w=(0,n.useState)(""),P=s(w,2),M=P[0],O=P[1],R=(0,n.useState)(""),N=s(R,2),U=N[0],G=N[1],V=(0,n.useState)(null),F=s(V,2),z=F[0],X=F[1],J=l?.short_edit?.ref_map||{},W=Object.entries(J).filter(([,e])=>e&&!e.hide),q=(0,$.V)(J,{keyword:T,types:Y}),K=q.flatMap(e=>[{label:e.label,value:`__header_${e.prefix}__`,isHeader:!0},...e.refs.map(({shortId:e,ref:l})=>({label:`${l.title||e} (${e})`,value:e,ref:l}))]),Z=[...T?[{label:"↻ Clear Search",value:"__clear_search__"}]:[],{label:"← Back",value:"__back__"}],Q=K.length>0?[...K,...Z]:Z,ee=Q.findIndex(e=>!e.isHeader&&!e.value?.startsWith("__"));(0,i.useInput)((e,l)=>{l.tab&&"select_ref"===u?D(e=>"search"===e?"list":"search"):(l.escape&&("select_ref"===u&&o(),"input_path"===u&&h("select_ref"),"input_content"===u&&h("input_path"),"confirm"===u&&h("input_content"),"done"===u&&o()),"q"!==e||("input_path"===u||"input_content"===u)||"select_ref"===u&&"search"===y||c())},{isActive:!0});var le,re=e=>{var l=e.trim();if(""===l)return null;try{return JSON.parse(l)}catch{return l}},te=(le=a(function*(){if(r&&l?._id&&I){h("submitting"),X(null);try{var n={shortId:I,path:M.trim(),content:re(U),forwardDataLink:!0};k?.inner_ref?.pid&&(n.innerRefParentShortId=k.inner_ref.pid),"application"===e?yield r.shortEditApplication({id:l._id,list:[n]}):yield r.shortEditModule({id:l._id,list:[n]}),yield t(),h("done")}catch(e){X(e.message),h("confirm")}}}),function(){return le.apply(this,arguments)});return l?.short_edit?.enabled?0===W.length?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{color:"yellow",children:"No Short Edit references found."}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:o})]}):"select_ref"===u?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,children:"Short Edit References"}),(0,j.jsx)(i.Text,{color:"gray",dimColor:!0,children:"Showing: Brick, Canvas, Generator, Data"}),(0,j.jsxs)(i.Box,{marginTop:1,flexDirection:"column",children:[(0,j.jsx)(i.Text,{color:"gray",children:"Search (title or shortId)"}),(0,j.jsx)(H.A,{value:T,placeholder:"type to filter, Enter to focus list",onChange:e=>f(e),onSubmit:()=>D("list"),focus:"search"===y}),(0,j.jsx)(i.Text,{color:"gray",dimColor:!0,children:"Press Tab to switch focus"})]}),(0,j.jsxs)(i.Box,{marginTop:1,children:[0===q.length&&(0,j.jsx)(i.Text,{color:"yellow",children:"No references match your search."}),(0,j.jsx)(b.Ay,{items:Q,isFocused:"list"===y,initialIndex:ee>-1?ee:0,indicatorComponent:()=>null,itemComponent:({label:e,isSelected:l,isHeader:r})=>r?(0,j.jsx)(i.Box,{marginTop:1,children:(0,j.jsx)(i.Text,{bold:!0,color:"white",children:e})}):(0,j.jsxs)(i.Text,{color:l?"blue":void 0,children:[l?"❯":" "," ",e]}),onSelect:e=>{if("__back__"!==e.value)return"__clear_search__"===e.value?(f(""),void D("search")):void(e.isHeader||(A(e.value),L(e.ref),h("input_path")));o()}})]})]}):"input_path"===u?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{children:["Reference:"," ",(0,j.jsxs)(i.Text,{color:"cyan",children:[k?.title||I," (",I,")"]})]}),(0,j.jsx)(i.Text,{marginTop:1,children:"Enter property path (e.g. title, property.backgroundColor)"}),z&&(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",z]}),(0,j.jsx)(H.A,{value:M,placeholder:"path",onChange:e=>{O(e),z&&X(null)},onSubmit:e=>{var l=e.trim();l?(O(l),h("input_content")):X("Path is required")},focus:!0})]}):"input_content"===u?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{children:["Path: ",(0,j.jsx)(i.Text,{color:"cyan",children:M})]}),(0,j.jsx)(i.Text,{marginTop:1,children:"Enter new content (JSON or plain text). Empty to clear."}),z&&(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",z]}),(0,j.jsx)(H.A,{value:U,placeholder:"content",onChange:e=>{G(e),z&&X(null)},onSubmit:()=>h("confirm"),focus:!0})]}):"submitting"===u?(0,j.jsx)(_,{text:"Applying short edit..."}):"done"===u?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{color:"green",children:"Short edit applied successfully."}),(0,j.jsx)(b.Ay,{items:[{label:"Edit another property",value:"again"},{label:"← Back",value:"back"}],onSelect:e=>{"again"===e.value?(h("select_ref"),A(null),L(null),O(""),G(""),X(null)):o()}})]}):(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,marginBottom:1,children:"Confirm Short Edit"}),(0,j.jsxs)(i.Text,{children:["Reference:"," ",(0,j.jsxs)(i.Text,{color:"cyan",children:[k?.title||I," (",I,")"]})]}),(0,j.jsxs)(i.Text,{children:["Path: ",(0,j.jsx)(i.Text,{color:"cyan",children:M})]}),(0,j.jsxs)(i.Text,{children:["Content: ",(0,j.jsx)(i.Text,{color:"cyan",children:U||"<empty>"})]}),z&&(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",z]}),(0,j.jsx)(b.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&&te(),"edit_path"===e.value&&h("input_path"),"edit_content"===e.value&&h("input_content"),"back"===e.value&&o()}})]}):(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{color:"yellow",children:["Short Edit is not enabled for this ",e,"."]}),(0,j.jsx)(b.Ay,{items:[{label:"← Back",value:"back"}],onSelect:o})]})},X=r(16928),J=r(79896),W=r(35317),q=r(10750),K="options",Z="output_dir",Q="confirm",ee="generating",le="post_install",re="done",te=e=>{try{return(0,W.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},ne=(e,l,r)=>new Promise((t,n)=>{var i=[e,...l].join(" "),o=(0,W.spawn)(i,[],{cwd:r,stdio:"pipe",shell:!0});o.on("close",e=>{0===e?t():n(new Error(`Command failed with code ${e}`))}),o.on("error",n)}),ie=(t=a(function*(e,l){try{var t=(yield Promise.resolve().then(r.bind(r,79491))).format;return(yield t(l,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,l){return t.apply(this,arguments)}),oe=({type:e,instance:l,client:r,onDone:t,onCancel:o})=>{var c,d=(0,i.useApp)().exit,x=(0,n.useState)(K),u=s(x,2),h=u[0],g=u[1],T=(0,n.useState)({setupGitHubActions:!0,setupAgents:!0,setupClaudeCode:!0,setupGeminiCLI:!1,runBunInstall:!0,initGit:!0}),f=s(T,2),p=f[0],v=f[1],_=(0,n.useState)(process.cwd()),y=s(_,2),D=y[0],E=y[1],S=(0,n.useState)(""),I=s(S,2),A=I[0],B=I[1],C=(0,n.useState)(null),k=s(C,2),L=k[0],w=k[1],P=(0,n.useState)(null),M=s(P,2),O=M[0],R=M[1],N=q(l?.name||"bricks-ctor"),U=X.resolve(D,N),G=(0,n.useCallback)(e=>{"back"!==e.value?"continue"!==e.value?v(l=>({...l,[e.value]:!l[e.value]})):g(Z):o()},[o]),V=(0,n.useCallback)(()=>{J.existsSync(U)?w(`Directory already exists: ${U}`):(w(null),g(Q))},[U]),F=(0,n.useCallback)((c=a(function*(t){var n;if("back"!==t.value)if("cancel"!==t.value){if("confirm"===t.value){g(ee);try{B("Fetching project from BRICKS...");var i="application"===e,s=i?"UNSTABLE_applicationProject":"UNSTABLE_moduleProject",c=i?r.queries.applicationProject:r.queries.moduleProject,d=(yield r.query(c,{id:l._id,buildApplicationOnly:!1,setupGitHubActions:p.setupGitHubActions,setupAgents:p.setupAgents,setupClaudeCode:p.setupClaudeCode,setupGeminiCLI:p.setupGeminiCLI}))[s];if(!d?.files)throw new Error("Failed to fetch project files");B("Creating project directory..."),J.mkdirSync(U,{recursive:!0}),B(`Writing ${d.files.length} files...`);var x=yield Promise.all(d.files.map((n=a(function*(e){var l=X.join(U,e.name),r=e.input;return e.formatable&&(r=yield ie(r,l)),{...e,filePath:l,content:r}}),function(e){return n.apply(this,arguments)})));x.forEach(e=>{var l=X.dirname(e.filePath);J.existsSync(l)||J.mkdirSync(l,{recursive:!0}),J.writeFileSync(e.filePath,e.content)}),g(le);var u={path:U,files:d.files.length,bunInstalled:!1,gitInitialized:!1};if(p.runBunInstall&&te("bun")){B("Installing dependencies (bun install)...");try{yield ne("bun",["install"],U),u.bunInstalled=!0}catch{}}if(p.initGit&&te("git")){B("Initializing git repository...");try{yield ne("git",["init"],U),yield ne("git",["add","."],U),yield ne("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],U),u.gitInitialized=!0}catch{}}R(u),g(re)}catch(e){w(e.message),g(K)}}}else o();else g(Z)}),function(e){return c.apply(this,arguments)}),[r,l,e,p,U,o]),$=(0,n.useCallback)(e=>{"exit"===e.value?d():t()},[d,t]);if(h===K){var Y=[{label:(p.setupGitHubActions?"[x]":"[ ]")+" GitHub Actions workflow",value:"setupGitHubActions"},{label:(p.setupAgents?"[x]":"[ ]")+" AGENTS.md",value:"setupAgents"},{label:(p.setupClaudeCode?"[x]":"[ ]")+" CLAUDE.md",value:"setupClaudeCode"},{label:(p.setupGeminiCLI?"[x]":"[ ]")+" GEMINI.md",value:"setupGeminiCLI"},{label:(p.runBunInstall?"[x]":"[ ]")+" Run bun install after generation",value:"runBunInstall"},{label:(p.initGit?"[x]":"[ ]")+" Initialize git repository",value:"initGit"},{label:"→ Continue",value:"continue"},{label:"← Back",value:"back"}];return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsxs)(i.Text,{bold:!0,color:"cyan",children:["Initialize BRICKS Project: ",l?.name||"Untitled"]}),(0,j.jsx)(i.Text,{color:"gray",marginBottom:1,children:"Select options for project generation (press Enter to toggle)"}),L&&(0,j.jsxs)(i.Text,{color:"red",marginBottom:1,children:["Error: ",L]}),(0,j.jsx)(b.Ay,{items:Y,onSelect:G})]})}if(h===Z)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:"Output Directory"}),(0,j.jsx)(i.Text,{color:"gray",marginBottom:1,children:"Enter the parent directory for the project:"}),L&&(0,j.jsx)(i.Text,{color:"red",marginBottom:1,children:L}),(0,j.jsxs)(i.Box,{children:[(0,j.jsx)(i.Text,{children:"Directory: "}),(0,j.jsx)(H.A,{value:D,onChange:E,onSubmit:V})]}),(0,j.jsxs)(i.Text,{color:"gray",marginTop:1,children:["Project will be created at: ",U]})]});if(h===Q){return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:"Confirm Project Generation"}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{children:["Name: ",(0,j.jsx)(i.Text,{color:"green",children:l?.name||"Untitled"})]}),(0,j.jsxs)(i.Text,{children:["Type: ",(0,j.jsx)(i.Text,{color:"yellow",children:e})]}),(0,j.jsxs)(i.Text,{children:["Path: ",(0,j.jsx)(i.Text,{color:"cyan",children:U})]}),(0,j.jsx)(i.Text,{color:"gray",marginTop:1,children:"Options:"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" - GitHub Actions: ",p.setupGitHubActions?"Yes":"No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" - AGENTS.md: ",p.setupAgents?"Yes":"No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" - CLAUDE.md: ",p.setupClaudeCode?"Yes":"No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" - GEMINI.md: ",p.setupGeminiCLI?"Yes":"No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" - Run bun install: ",p.runBunInstall?"Yes":"No"]}),(0,j.jsxs)(i.Text,{color:"gray",children:[" - Initialize git: ",p.initGit?"Yes":"No"]})]}),(0,j.jsx)(b.Ay,{items:[{label:"Confirm & Generate",value:"confirm"},{label:"← Change Directory",value:"back"},{label:"Cancel",value:"cancel"}],onSelect:F})]})}if(h===ee||h===le)return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"cyan",children:"Generating Project..."}),(0,j.jsxs)(i.Box,{marginY:1,children:[(0,j.jsx)(i.Text,{color:"green",children:(0,j.jsx)(m.A,{type:"dots"})}),(0,j.jsxs)(i.Text,{children:[" ",A]})]})]});if(h===re&&O){return(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(i.Text,{bold:!0,color:"green",children:"Project initialized successfully!"}),(0,j.jsxs)(i.Box,{marginY:1,flexDirection:"column",children:[(0,j.jsxs)(i.Text,{children:["Path: ",(0,j.jsx)(i.Text,{color:"cyan",children:O.path})]}),(0,j.jsxs)(i.Text,{children:["Files: ",(0,j.jsx)(i.Text,{color:"green",children:O.files})]}),(0,j.jsxs)(i.Text,{children:["Dependencies:"," ",(0,j.jsx)(i.Text,{color:O.bunInstalled?"green":"yellow",children:O.bunInstalled?"Installed":"Not installed (run bun install manually)"})]}),(0,j.jsxs)(i.Text,{children:["Git:"," ",(0,j.jsx)(i.Text,{color:O.gitInitialized?"green":"yellow",children:O.gitInitialized?"Initialized":"Not initialized"})]})]}),(0,j.jsx)(i.Text,{bold:!0,marginY:1,children:"Next steps:"}),(0,j.jsxs)(i.Text,{color:"gray",children:[" cd ",N]}),!O.bunInstalled&&(0,j.jsx)(i.Text,{color:"gray",children:" bun install"}),(0,j.jsx)(i.Text,{color:"gray",children:" bun preview"}),(0,j.jsxs)(i.Text,{color:"gray",marginTop:1,children:["For more information, see ",N,"/README.md"]}),(0,j.jsx)(i.Box,{marginTop:1,children:(0,j.jsx)(b.Ay,{items:[{label:"← Back to Detail",value:"back"},{label:"Exit CLI",value:"exit"}],onSelect:$})})]})}return null};const ae=()=>{var e=(0,i.useApp)().exit,l=(0,n.useState)(u.MAIN),r=s(l,2),t=r[0],o=r[1],h=(0,n.useState)(null),g=s(h,2),m=g[0],f=g[1],y=(0,n.useState)(null),b=s(y,2),P=b[0],G=b[1],V=(0,n.useState)(!0),H=s(V,2),$=H[0],Y=H[1],X=(0,n.useState)(null),J=s(X,2),W=J[0],q=J[1],K=(0,n.useState)([]),Z=s(K,2),Q=Z[0],ee=Z[1],le=(0,n.useState)(null),re=s(le,2),te=re[0],ne=re[1],ie=(0,n.useState)([]),ae=s(ie,2),se=ae[0],ce=ae[1],de=(0,n.useState)(null),xe=s(de,2),ue=xe[0],he=xe[1],ge=(0,n.useState)([]),me=s(ge,2),je=me[0],Te=me[1],fe=(0,n.useState)(null),pe=s(fe,2),ve=pe[0],_e=pe[1],ye=(0,n.useState)([]),be=s(ye,2),De=be[0],Ee=be[1],Se=(0,n.useState)(null),Ie=s(Se,2),Ae=Ie[0],Be=Ie[1],Ce=(0,n.useState)([]),ke=s(Ce,2),Le=ke[0],we=ke[1],Pe=(0,n.useState)(!1),Me=s(Pe,2),Oe=Me[0],Re=Me[1],Ne=(0,n.useState)(null),Ue=s(Ne,2),Ge=Ue[0],Ve=Ue[1],Fe=(0,n.useState)(null),He=s(Fe,2),$e=He[0],Ye=He[1],ze=(0,n.useState)(null),Xe=s(ze,2),Je=Xe[0],We=Xe[1],qe=(0,n.useState)(null),Ke=s(qe,2),Ze=Ke[0],Qe=Ke[1],el=(0,n.useState)([]),ll=s(el,2),rl=ll[0],tl=ll[1],nl=(0,n.useState)(null),il=s(nl,2),ol=il[0],al=il[1],sl=(0,n.useState)([]),cl=s(sl,2),dl=cl[0],xl=cl[1],ul=(0,n.useState)(null),hl=s(ul,2),gl=hl[0],ml=hl[1],jl=t===u.DEVICES,Tl=t===u.DEVICE_DETAIL,fl=t===u.GROUPS,pl=t===u.GROUP_DETAIL;(0,n.useEffect)(()=>{var e=(0,d.getCurrentProfile)(),l=(0,d.getToken)(e);if(!l)return q("Not logged in. Run `bricks auth login` first."),void Y(!1);var r=(0,c.createClient)((0,d.getBaseUrl)(),l);f(r),r.workspace().then(e=>{G(e),Y(!1)}).catch(e=>{q(e.message),Y(!1)})},[]),(0,i.useInput)((l,r)=>{"q"===l&&e(),r.escape&&(t===u.DEVICE_CONTROL?(o(u.DEVICE_DETAIL),Ve(null)):t===u.DEVICE_SCREENSHOT?(o(u.DEVICE_DETAIL),We(null),Qe(null)):t===u.DEVICE_DETAIL?(o(u.DEVICES),ne(null)):t===u.APP_DETAIL?(o(u.APPS),he(null)):t===u.MODULE_DETAIL?(o(u.MODULES),_e(null)):t===u.GROUP_DETAIL?(o(u.GROUPS),Be(null),we([])):t===u.MEDIA_FILE_DETAIL?(o(u.MEDIA_FILES),ml(null)):t===u.MEDIA_FILES?(o(u.MEDIA_BOX_DETAIL),ml(null)):t===u.MEDIA_BOX_DETAIL?(o(u.MEDIA_BOXES),al(null),xl([])):(t===u.MEDIA_BOXES||t!==u.MAIN)&&o(u.MAIN))},{isActive:t!==u.APP_SHORT_EDIT&&t!==u.MODULE_SHORT_EDIT&&t!==u.APP_PROJECT_INIT&&t!==u.MODULE_PROJECT_INIT});var vl,_l,yl,bl,Dl,El,Sl,Il,Al=(0,n.useCallback)(a(function*(){if(m){Y(!0);try{var e=yield m.devices({});ee(e||[])}catch(e){q(e.message)}Y(!1)}}),[m]),Bl=(0,n.useCallback)((vl=a(function*(e){if(m){Y(!0),Ye(null);try{var l=yield m.device({id:e});ne(l)}catch(e){Ye(e.message)}Y(!1)}}),function(e){return vl.apply(this,arguments)}),[m]),Cl=(0,n.useCallback)(a(function*(){if(m){Y(!0);try{var e=yield m.applications({});ce(e||[])}catch(e){q(e.message)}Y(!1)}}),[m]),kl=(0,n.useCallback)((_l=a(function*(e){if(m){Y(!0),Ye(null);try{var l=yield m.application({id:e});he(l)}catch(e){Ye(e.message)}Y(!1)}}),function(e){return _l.apply(this,arguments)}),[m]),Ll=(0,n.useCallback)(a(function*(){if(m){Y(!0);try{var e=yield m.modules({});Te(e||[])}catch(e){q(e.message)}Y(!1)}}),[m]),wl=(0,n.useCallback)((yl=a(function*(e){if(m){Y(!0),Ye(null);try{var l=yield m.module({id:e});_e(l)}catch(e){Ye(e.message)}Y(!1)}}),function(e){return yl.apply(this,arguments)}),[m]),Pl=(0,n.useCallback)(a(function*(){if(m){Y(!0);try{var e=yield m.deviceGroups({});Ee(e||[])}catch(e){q(e.message)}Y(!1)}}),[m]),Ml=(0,n.useCallback)((bl=a(function*(e){if(m){Y(!0),Ye(null);try{var l=yield Promise.all([m.deviceGroup({id:e}),m.devicesByGroup({id:e})]),r=s(l,2),t=r[0],n=r[1];Be(t),we(n||[])}catch(e){Ye(e.message)}Y(!1)}}),function(e){return bl.apply(this,arguments)}),[m]),Ol=(0,n.useCallback)(a(function*(){if(m){Y(!0);try{var e=yield m.mediaBoxes();tl(e||[])}catch(e){q(e.message)}Y(!1)}}),[m]),Rl=(0,n.useCallback)((Dl=a(function*(e){if(m){Y(!0),Ye(null);try{var l=yield m.mediaBox({id:e});al(l)}catch(e){Ye(e.message)}Y(!1)}}),function(e){return Dl.apply(this,arguments)}),[m]),Nl=(0,n.useCallback)((El=a(function*(e){if(m){Y(!0);try{var l=yield m.mediaFiles({boxId:e});xl(l||[])}catch(e){q(e.message)}Y(!1)}}),function(e){return El.apply(this,arguments)}),[m]),Ul=(0,n.useCallback)((Sl=a(function*(e){if(m){Y(!0),Ye(null);try{var l=yield m.mediaFile({id:e});ml(l)}catch(e){Ye(e.message)}Y(!1)}}),function(e){return Sl.apply(this,arguments)}),[m]),Gl=(0,n.useCallback)((Il=a(function*(e){if(m&&te){Re(!0),Ve(null);try{yield m.controlDevice({id:te._id,type:e}),Ve({success:!0,message:`Command sent: ${e}`})}catch(e){Ve({success:!1,message:e.message})}Re(!1)}}),function(e){return Il.apply(this,arguments)}),[m,te]),Vl=(0,n.useCallback)(a(function*(e=!1){if(m&&te&&P){Y(!0),Qe(null),We(null);try{e&&(yield m.controlDevice({id:te._id,type:"take-screenshot"}),yield new Promise(e=>setTimeout(e,3e3)));var l=yield(0,x.he)(m,P,te._id,null,{preferThumbnail:!0});l.error?Qe(l.error):We(l)}catch(e){Qe(e.message)}Y(!1)}}),[m,te,P]),Fl=T((0,n.useCallback)(()=>{m&&Al()},[m,Al]),jl),Hl=T((0,n.useCallback)(()=>{m&&te&&Bl(te._id)},[m,te,Bl]),Tl),$l=T((0,n.useCallback)(()=>{m&&Pl()},[m,Pl]),fl),Yl=T((0,n.useCallback)(()=>{m&&Ae&&Ml(Ae._id)},[m,Ae,Ml]),pl);return $&&!P?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(p,{workspace:P,view:t}),(0,j.jsx)(_,{text:"Connecting to workspace..."})]}):W&&!P?(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(p,{workspace:P,view:t}),(0,j.jsxs)(i.Text,{color:"red",children:["Error: ",W]}),(0,j.jsx)(v,{})]}):(0,j.jsxs)(i.Box,{flexDirection:"column",children:[(0,j.jsx)(p,{workspace:P,view:t}),t===u.MAIN&&(0,j.jsx)(D,{onSelect:l=>{"exit"!==l.value?(o(l.value),l.value===u.DEVICES?Al():l.value===u.APPS?Cl():l.value===u.MODULES?Ll():l.value===u.GROUPS?Pl():l.value===u.MEDIA_BOXES&&Ol()):e()},mediaEnabled:(0,x.wR)(P),activityLogEnabled:!!(0,d.getActivityLogBaseUrl)()}),t===u.DEVICES&&(0,j.jsx)(E,{devices:Q,loading:$,onSelect:e=>{if("back"!==e.value){if("refresh"===e.value)return Al(),void Fl.resetCountdown();ne(null),Y(!0),o(u.DEVICE_DETAIL),Bl(e.value)}else o(u.MAIN)},countdown:Fl.countdown,lastRefreshTime:Fl.lastRefreshTime}),t===u.DEVICE_DETAIL&&(0,j.jsx)(S,{device:te,loading:$,error:$e,onSelect:e=>"back"===e.value?(o(u.DEVICES),void ne(null)):"refresh"===e.value?(Bl(te._id),void Hl.resetCountdown()):("control"===e.value&&(o(u.DEVICE_CONTROL),Ve(null)),void("screenshot"===e.value&&(o(u.DEVICE_SCREENSHOT),We(null),Qe(null),Vl(!1)))),mediaEnabled:(0,x.wR)(P),countdown:Hl.countdown,lastRefreshTime:Hl.lastRefreshTime}),t===u.DEVICE_CONTROL&&(0,j.jsx)(I,{device:te,onSelect:e=>{if("back"===e.value)return o(u.DEVICE_DETAIL),void Ve(null);Gl(e.value)},controlling:Oe,controlResult:Ge}),t===u.DEVICE_SCREENSHOT&&(0,j.jsx)(A,{device:te,screenshot:Je,loading:$,error:Ze,onSelect:e=>{if("back"===e.value)return o(u.DEVICE_DETAIL),We(null),void Qe(null);"refresh"!==e.value?"take"===e.value&&Vl(!0):Vl(!1)}}),t===u.APPS&&(0,j.jsx)(B,{apps:se,loading:$,onSelect:e=>{"back"!==e.value?"refresh"!==e.value?(he(null),Y(!0),o(u.APP_DETAIL),kl(e.value)):Cl():o(u.MAIN)}}),t===u.APP_DETAIL&&(0,j.jsx)(C,{app:ue,loading:$,error:$e,onSelect:e=>{if("back"===e.value)return o(u.APPS),void he(null);"refresh"!==e.value?("short_edit"===e.value&&(o(u.APP_SHORT_EDIT),Ye(null)),"project_init"===e.value&&(o(u.APP_PROJECT_INIT),Ye(null))):kl(ue._id)}}),t===u.APP_SHORT_EDIT&&(0,j.jsx)(z,{instanceType:"application",instance:ue,client:m,onDone:a(function*(){return kl(ue._id)}),onCancel:()=>o(u.APP_DETAIL)}),t===u.APP_PROJECT_INIT&&(0,j.jsx)(oe,{type:"application",instance:ue,client:m,onDone:()=>o(u.APP_DETAIL),onCancel:()=>o(u.APP_DETAIL)}),t===u.MODULES&&(0,j.jsx)(k,{modules:je,loading:$,onSelect:e=>{"back"!==e.value?"refresh"!==e.value?(_e(null),Y(!0),o(u.MODULE_DETAIL),wl(e.value)):Ll():o(u.MAIN)}}),t===u.MODULE_DETAIL&&(0,j.jsx)(L,{module:ve,loading:$,error:$e,onSelect:e=>{if("back"===e.value)return o(u.MODULES),void _e(null);"refresh"!==e.value?("short_edit"===e.value&&(o(u.MODULE_SHORT_EDIT),Ye(null)),"project_init"===e.value&&(o(u.MODULE_PROJECT_INIT),Ye(null))):wl(ve._id)}}),t===u.MODULE_SHORT_EDIT&&(0,j.jsx)(z,{instanceType:"module",instance:ve,client:m,onDone:a(function*(){return wl(ve._id)}),onCancel:()=>o(u.MODULE_DETAIL)}),t===u.MODULE_PROJECT_INIT&&(0,j.jsx)(oe,{type:"module",instance:ve,client:m,onDone:()=>o(u.MODULE_DETAIL),onCancel:()=>o(u.MODULE_DETAIL)}),t===u.GROUPS&&(0,j.jsx)(w,{groups:De,loading:$,onSelect:e=>{if("back"!==e.value){if("refresh"===e.value)return Pl(),void $l.resetCountdown();Be(null),we([]),Y(!0),o(u.GROUP_DETAIL),Ml(e.value)}else o(u.MAIN)},countdown:$l.countdown,lastRefreshTime:$l.lastRefreshTime}),t===u.GROUP_DETAIL&&(0,j.jsx)(M,{group:Ae,groupDevices:Le,loading:$,error:$e,onSelect:e=>{if("back"===e.value)return o(u.GROUPS),Be(null),void we([]);"refresh"===e.value&&(Ml(Ae._id),Yl.resetCountdown())},countdown:Yl.countdown,lastRefreshTime:Yl.lastRefreshTime}),t===u.ACTIVITY_LOG&&(0,j.jsx)(F,{onBack:()=>o(u.MAIN)}),t===u.MEDIA_BOXES&&(0,j.jsx)(O,{boxes:rl,loading:$,onSelect:e=>{"back"!==e.value?"refresh"!==e.value?(al(null),xl([]),Y(!0),o(u.MEDIA_BOX_DETAIL),Rl(e.value)):Ol():o(u.MAIN)}}),t===u.MEDIA_BOX_DETAIL&&(0,j.jsx)(R,{box:ol,loading:$,error:$e,onSelect:e=>{if("back"===e.value)return o(u.MEDIA_BOXES),al(null),void xl([]);"refresh"!==e.value?"files"===e.value&&(xl([]),ml(null),o(u.MEDIA_FILES),Nl(ol.id)):Rl(ol.id)}}),t===u.MEDIA_FILES&&(0,j.jsx)(N,{files:dl,box:ol,loading:$,onSelect:e=>{if("back"===e.value)return o(u.MEDIA_BOX_DETAIL),void ml(null);"refresh"!==e.value?(ml(null),Y(!0),o(u.MEDIA_FILE_DETAIL),Ul(e.value)):Nl(ol.id)}}),t===u.MEDIA_FILE_DETAIL&&(0,j.jsx)(U,{file:gl,loading:$,error:$e,onSelect:e=>{if("back"===e.value)return o(u.MEDIA_FILES),void ml(null);"refresh"===e.value&&Ul(gl.id)}}),(0,j.jsx)(v,{})]})};var se=()=>{(0,i.render)((0,j.jsx)(o.TerminalInfoProvider,{children:(0,j.jsx)(ae,{})}))}}};
package/lib/890.js ADDED
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__=890;export const __webpack_esm_ids__=[890];export const __webpack_esm_modules__={38890:(e,r,a)=>{const{getDocByTemplateKey:t}=a(63981),i=a(80211),n=a(45907),{getBrickName:o}=a(86343);r.checkConfigDeprecatedFeatures=e=>{const r=[];return Object.entries(e.subspace_map||{}).forEach(([e,a])=>{Object.entries(a.brick_map||{}).forEach(([i,n])=>{void 0===n.property?.borderLeftWidth&&void 0===n.property?.borderRightWidth&&void 0===n.property?.borderTopWidth&&void 0===n.property?.borderBottomWidth||r.push({id:i,name:"Used Deprecated Feature",data:`In v2.16, we have been changed \`Border Width\` to \`Border Size\` (Unit \`px\` to \`grid\`). The \`${o("brick",n,i)}\` brick still used the border width. Please re-edit it to transfer to the new unit.`});const s=t(n.template_key);s?.brickMeta?.deprecated&&r.push({id:i,name:"Used Deprecated Feature",data:`The \`${o("brick",n,i)}\` brick in \`${o("subspace",a,e)}\` have been deprecated, it may not work in the future, please consider to remove it. If you can't see the item, please enable \`Show Deprecated Features\` in setting.`})}),Object.entries(a.generator_map||{}).forEach(([i,n])=>{const s=t(n.template_key);s?.brickMeta?.deprecated&&r.push({id:i,name:"Used Deprecated Feature",data:`The \`${o("brick",n,i)}\` brick in \`${o("subspace",a,e)}\` have been deprecated, it may not work in the future, please consider to remove it. If you can't see the item, please enable \`Show Deprecated Features\` in setting.`})})}),r},r.checkConfig=e=>{const r={schema:i(e),ref:n(e)};return r.valid=0===r.schema.length&&0===r.ref.length,r.message=r.schema.concat(r.ref).map(({dataPath:e,field:r,message:a})=>`${e||r}: ${a}`).join("\n"),r}},86343:(e,r,a)=>{const{v4:t}=a(79194),i=a(95479),{nameMap:n,brickMapping:o,generatorMapping:s}=a(63981);r.idByItem=(e={})=>e.canvas_id||e.subspace_id||e.brick_id||e.generator_id||e.property_bank_id||e.property_bank_calc_id||e.bank_id||e.scene_id,r.getAnimationType=e=>e.type||e.compose_type||e.composeType,r.cleanUpAnimationMap=e=>Object.entries(e).reduce((e,[r,a])=>((a.type||a.compose_type)&&(e[r]=a),e),{}),r.matchItemByItem=(e,r)=>{if(!e)return!1;let a;switch("string"==typeof r&&(a=r),e.type){case"brick":return e.brick_id===(a||r.brick_id);case"subspace":return e.subspace_id===(a||r.subspace_id);case"canvas":return e.canvas_id===(a||r.canvas_id);case"generator":return e.generator_id===(a||r.generator_id);case"property_bank":return e.property_bank_id===(a||r.property_bank_id);default:return!1}},r.makePasscode=()=>t(),r.kindOneOfTypes={string:["color","datetime","id","graphql","rich-text-content","sandbox-script","llm-prompt","media-resource-image","media-resource-video","media-resource-audio","media-resource-file","lottie-file-uri","rive-file-uri","ggml-model-asset","gguf-model-asset","binary-asset"],number:["unit"],object:["tts-speaker-config"],"array-object":["llm-tools","llm-messages","mcp-server-resources","mcp-server-tools","mcp-server-prompts"]},r.getKindOneOfTypes=(e,a)=>"array"===e?"object"===a?r.kindOneOfTypes[`${e}-${a}`]:void 0:r.kindOneOfTypes[e],r.unitOneOfTypes=["grid","px","ms"],r.idOneOfTypes=["canvas","brick","generator","animation","property_bank"],r.typeToName={brick:"Brick",generator:"Generator",subspace:"Subspace",canvas:"Canvas",animation:"Animation",property_bank:"Data",property_bank_calc:"Calculation"},r.getBrickName=(e,a,t)=>{if(!a)return e.toUpperCase();if(a.title)return a.title;let o;switch(e){case"bank":o="BANK";break;case"subspace":o="SUBSPACE";break;case"canvas":o="CANVAS";break;case"animation":o=`<${i(r.getAnimationType(a))}>`;break;case"property_bank":o="<Data>";break;case"property_bank_calc":o="<Map>";break;case"state_group":o="<Switch Case>";break;default:o=`<${n[a.template_key||a.templateKey]||"Unknown"}>`}return t&&t.length>10?o+=` (${t.replace(/[A-Z_]+/g,"").substr(0,6)}...)`:t&&(o+=` (${t})`),o},r.getCallInternalActions=e=>{const r=o[e]||s[e];if(r)return r.callInternalActions},r.mapToList=(e,a)=>Object.entries(a).reduce((a,[t,i])=>(a.push({id:t,...i,title:r.getBrickName(e,i,t)}),a),[]);const p={subspaceMap:"subspace",brickMap:"brick",generatorMap:"generator",propertyBankMap:"property_bank",propertyAvailableToAdd:"property_bank",canvasMap:"canvas",animationMap:"animation"},c={};r.mapToListForDerivedState=(e,a,t,i)=>{const n=t[e]||c;return n!==i[e]?{[e]:n,[a]:r.mapToList(p[e],n)}:{}},r.arrayTypePrefix="array of ",r.propertyBankTypes=["string","number","bool","object","any",`${r.arrayTypePrefix}string`,`${r.arrayTypePrefix}number`,`${r.arrayTypePrefix}bool`,`${r.arrayTypePrefix}object`],r.animationRunTypes=["once","loop"],r.stopPropagationOnKeyBackspace=e=>{8===e.keyCode&&e.stopPropagation()},r.nestedTypes=["object","array","any"],r.isPropertyBankTypeNested=e=>r.nestedTypes.includes(e),r.propertyTypeToSchema=e=>{const a=e.indexOf(r.arrayTypePrefix)>-1,t=e.replace(r.arrayTypePrefix,"");return{type:t,properties:"object"===t?{}:void 0,allowNewItem:a,allowCustomProperty:"object"===t}}}};
package/lib/999.js ADDED
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__=999;export const __webpack_esm_ids__=[999];export const __webpack_esm_modules__={12999:(e,r,t)=>{t.a(e,async(e,o)=>{try{t.r(r),t.d(r,{createCdpClient:()=>l});var n=t(99436),a=t(84361),s=e([a]),i=s.then?(await s)():s;a=i[0];var c=(m=n(function*(e,r,t){if(!t)try{var o=new AbortController,n=setTimeout(()=>o.abort(),3e3),a=yield fetch(`http://${e}:${r}/json/list`,{signal:o.signal});if(clearTimeout(n),a.ok){var s=yield a.json(),i=s?.[0]?.webSocketDebuggerUrl;if(i){var c=i.match(/\/ws(?:\/.*)?$/);if(c)return`ws://${e}:${r}${c[0]}`}}}catch{}return t?`ws://${e}:${r}/ws/${encodeURIComponent(t)}`:`ws://${e}:${r}/ws`}),function(e,r,t){return m.apply(this,arguments)}),l=(e,r,t)=>{var o,s,i=0,l=new Map,m=new Map;return{connect:(s=n(function*(){var n=yield c(e,r,t);return new Promise((t,s)=>{(o=new a.WebSocket(n)).once("open",()=>t()),o.once("error",t=>{s(new Error(t.message||`Cannot connect to ${e}:${r}`))}),o.on("message",e=>{try{var r=JSON.parse(e.toString());if(null!=r.id&&l.has(r.id)){var t=l.get(r.id),o=t.resolve,n=t.reject,a=t.timer;return clearTimeout(a),l.delete(r.id),void(r.error?n(new Error(r.error.message)):o(r.result))}if(r.method){var s=m.get(r.method);if(s)for(var i of s)i(r.params)}}catch{}}),o.on("close",()=>{for(var e of l.values()){var r=e.reject,t=e.timer;clearTimeout(t),r(new Error("Connection closed"))}l.clear()})})}),function(){return s.apply(this,arguments)}),send:(e,r={},t=15e3)=>new Promise((n,a)=>{if(o&&o.readyState===o.OPEN){var s=++i,c=setTimeout(()=>{l.delete(s),a(new Error(`Timeout: ${e}`))},t);l.set(s,{resolve:n,reject:a,timer:c}),o.send(JSON.stringify({id:s,method:e,params:r}))}else a(new Error("Not connected"))}),on:(e,r)=>{m.has(e)||m.set(e,[]),m.get(e).push(r)},off:(e,r)=>{var t=m.get(e);if(t){var o=t.indexOf(r);o>=0&&t.splice(o,1)}},close:()=>{for(var e of l.values()){var r=e.timer;clearTimeout(r)}l.clear(),o&&(o.terminate(),o=null)}}};o()}catch(e){o(e)}var m})}};