@fugood/bricks-cli 2.25.0-beta.12 → 2.25.0-beta.14
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/117.js +1 -1
- package/lib/index.js +7 -9
- package/package.json +2 -2
package/lib/117.js
CHANGED
|
@@ -2469,7 +2469,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
|
|
|
2469
2469
|
timestamp
|
|
2470
2470
|
}
|
|
2471
2471
|
}
|
|
2472
|
-
`,tz=H(function e(i,t){J(this,e),this.baseUrl=i,this.token=t,this.graphqlUrl=`${i}/api/graphql`},[{key:"graphql",value:(o=v(function*(e,i){var t=yield(0,B.Ay)(this.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`,Accept:"application/json"},body:JSON.stringify({query:e,variables:i})});if(!t.ok){var n=yield t.text().catch(()=>"");throw Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return o.apply(this,arguments)})},{key:"events",value:(r=v(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql(tG,{filter:n})).events}),function(e){return r.apply(this,arguments)})},{key:"screenshots",value:(s=v(function*(e){return(yield this.graphql(tL,{filter:e})).screenshots}),function(e){return s.apply(this,arguments)})},{key:"downloadScreenshot",value:(d=v(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,B.Ay)(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!a.ok){var o=yield a.text().catch(()=>"");throw Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from((yield a.arrayBuffer()))}),function(e,i,t){return d.apply(this,arguments)})}]);process.env.STAGE,process.env.URL_BASE;var tH="bricks-mcp",tJ={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools",activityLog:process.env.ACTIVITY_LOG_API_SERVER||"https://activity-log-beta.bricks.tools"};process.env.AUTH0_DOMAIN,process.env.CACHE_URL;var tX=t(1639);let tQ=({type:e,title:i,template_key:t})=>{var n,a,o=(0,tX.M4)(e);switch(e){case"subspace":n={title:i,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},a={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var r=V(j.Ji);n={title:i,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(r.propTypes).map(([e,i])=>[e,{...i,description:r.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(r.eventTypes).map(([e])=>[e,{description:r.brickEventDescriptions[e]}]))}},a={property_bank_map:{[(0,tX.M4)("property_bank")]:{title:`Canvas ID: ${i}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=V(j.dK.Basic),d=V(j.brickMapping[t]);if(!d)throw Error(`Brick ${t} not found`);var c={...d,propTypes:{...s.propTypes,...d.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...d.brickPropDescriptions},eventTypes:{...s.eventTypes,...d.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...d.brickEventDescriptions}};n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(c.propTypes).map(([e,i])=>[e,{...i,description:c.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(c.eventTypes).map(([e])=>[e,{description:c.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(c.outletTypes).map(([e])=>[e,{description:c.brickOutletDescriptions[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},a={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:o,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:i,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};case"generator":var l=V(j.generatorMapping[t]);if(!l)throw Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,i])=>[e,{...i,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:i,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:i,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(j.qJ.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var p=(0,tX.M4)("property_bank_command"),u=(0,tX.M4)("property_bank_command"),m=(0,tX.M4)("property_bank_command"),_="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:i,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},[p]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:_,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:u,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:u,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:u,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:i,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:_,$note:"Required, info for GUI editor"}}}return T({id:o,example:n,extraInfo:a})};var tZ="2.25.0-beta.12";function t0(){return t1.apply(this,arguments)}function t1(){return(t1=v(function*(e={}){var i,t=e.token||process.env.BRICKS_API_TOKEN;if(!t)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),Error("API token is required");var n=function(e){try{var i=e.queryStringParameters?.token;if(!i){var t=new Headers(e.headers);i=t.get("authorization")?.replace("Bearer ","")}if(!i)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var i=e.split(".");if(i.length<3)return null;var t=JSON.parse(Buffer.from(i[0],"base64url").toString());if(!D.includes(t?.alg))return null;return JSON.parse(Buffer.from(i[1],"base64url").toString())}catch{return null}}(i);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var a=A.includes(n.iss)?"user":"workspace";if("workspace"===a){var o=Array.isArray(n.t)?n.t:[];n.permissions=o.reduce((e,i)=>{var t=k[i];return t&&e.push(t),e},[])}else n.permissions=Object.keys(I);return{success:!0,token:i,tokenInfo:n,tokenType:a}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}({queryStringParameters:{token:t}});if(!n.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(n.message),Error("Invalid BRICKS_API_TOKEN");var a=new h._({name:tH,version:tZ}),o={...n,client:function(e,i,t){switch(t){case"user":return new iR(e,i);case"workspace":return new ti(e,i);default:throw Error(`Invalid token type: ${t}.`)}}(tJ.bricks,n.token,n.tokenType)};a.prompt("getting-started","Getting started with BRICKS",{},v(function*(){return{messages:[{role:"user",content:{type:"text",text:`Welcome to BRICKS — start here.
|
|
2472
|
+
`,tz=H(function e(i,t){J(this,e),this.baseUrl=i,this.token=t,this.graphqlUrl=`${i}/api/graphql`},[{key:"graphql",value:(o=v(function*(e,i){var t=yield(0,B.Ay)(this.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`,Accept:"application/json"},body:JSON.stringify({query:e,variables:i})});if(!t.ok){var n=yield t.text().catch(()=>"");throw Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return o.apply(this,arguments)})},{key:"events",value:(r=v(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql(tG,{filter:n})).events}),function(e){return r.apply(this,arguments)})},{key:"screenshots",value:(s=v(function*(e){return(yield this.graphql(tL,{filter:e})).screenshots}),function(e){return s.apply(this,arguments)})},{key:"downloadScreenshot",value:(d=v(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,B.Ay)(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!a.ok){var o=yield a.text().catch(()=>"");throw Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from((yield a.arrayBuffer()))}),function(e,i,t){return d.apply(this,arguments)})}]);process.env.STAGE,process.env.URL_BASE;var tH="bricks-mcp",tJ={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools",activityLog:process.env.ACTIVITY_LOG_API_SERVER||"https://activity-log-beta.bricks.tools"};process.env.AUTH0_DOMAIN,process.env.CACHE_URL;var tX=t(1639);let tQ=({type:e,title:i,template_key:t})=>{var n,a,o=(0,tX.M4)(e);switch(e){case"subspace":n={title:i,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},a={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var r=V(j.Ji);n={title:i,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(r.propTypes).map(([e,i])=>[e,{...i,description:r.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(r.eventTypes).map(([e])=>[e,{description:r.brickEventDescriptions[e]}]))}},a={property_bank_map:{[(0,tX.M4)("property_bank")]:{title:`Canvas ID: ${i}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=V(j.dK.Basic),d=V(j.brickMapping[t]);if(!d)throw Error(`Brick ${t} not found`);var c={...d,propTypes:{...s.propTypes,...d.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...d.brickPropDescriptions},eventTypes:{...s.eventTypes,...d.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...d.brickEventDescriptions}};n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(c.propTypes).map(([e,i])=>[e,{...i,description:c.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(c.eventTypes).map(([e])=>[e,{description:c.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(c.outletTypes).map(([e])=>[e,{description:c.brickOutletDescriptions[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},a={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:o,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:i,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};case"generator":var l=V(j.generatorMapping[t]);if(!l)throw Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,i])=>[e,{...i,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:i,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:i,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(j.qJ.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var p=(0,tX.M4)("property_bank_command"),u=(0,tX.M4)("property_bank_command"),m=(0,tX.M4)("property_bank_command"),_="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:i,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},[p]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:_,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:u,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:u,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:u,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:i,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:_,$note:"Required, info for GUI editor"}}}return T({id:o,example:n,extraInfo:a})};var tZ="2.25.0-beta.14";function t0(){return t1.apply(this,arguments)}function t1(){return(t1=v(function*(e={}){var i,t=e.token||process.env.BRICKS_API_TOKEN;if(!t)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),Error("API token is required");var n=function(e){try{var i=e.queryStringParameters?.token;if(!i){var t=new Headers(e.headers);i=t.get("authorization")?.replace("Bearer ","")}if(!i)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var i=e.split(".");if(i.length<3)return null;var t=JSON.parse(Buffer.from(i[0],"base64url").toString());if(!D.includes(t?.alg))return null;return JSON.parse(Buffer.from(i[1],"base64url").toString())}catch{return null}}(i);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var a=A.includes(n.iss)?"user":"workspace";if("workspace"===a){var o=Array.isArray(n.t)?n.t:[];n.permissions=o.reduce((e,i)=>{var t=k[i];return t&&e.push(t),e},[])}else n.permissions=Object.keys(I);return{success:!0,token:i,tokenInfo:n,tokenType:a}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}({queryStringParameters:{token:t}});if(!n.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(n.message),Error("Invalid BRICKS_API_TOKEN");var a=new h._({name:tH,version:tZ}),o={...n,client:function(e,i,t){switch(t){case"user":return new iR(e,i);case"workspace":return new ti(e,i);default:throw Error(`Invalid token type: ${t}.`)}}(tJ.bricks,n.token,n.tokenType)};a.prompt("getting-started","Getting started with BRICKS",{},v(function*(){return{messages:[{role:"user",content:{type:"text",text:`Welcome to BRICKS — start here.
|
|
2473
2473
|
|
|
2474
2474
|
Before doing any complex work (application design, deployments, etc.),
|
|
2475
2475
|
always consult the official docs rather than guessing.
|
package/lib/index.js
CHANGED
|
@@ -26,9 +26,7 @@ ${y.Ay.bold("Bound Devices")} (${n.devices.length})`),n.devices.forEach(e=>{var
|
|
|
26
26
|
${y.Ay.bold("Bound Devices")}: ${y.Ay.gray("None")}`),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get application: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),A.command("resolve <query>").description("Resolve an application name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((o=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Resolving application...").start();try{var n=yield(0,E.Y)(()=>a.application({id:e})),r=n?[n]:yield a.applications({keyword:e,paginate:{limit:t.limit}}),o=(0,E.K)({resource:"application",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,_.GF)(o);if(o.resolved){var s=o.resolved;console.log(y.Ay.bold("\nResolved Application")),console.log("─".repeat(60)),console.log(`Name: ${y.Ay.cyan(s.name||"Unnamed")}`),console.log(`ID: ${y.Ay.gray(s._id)}`),console.log(`Selected By: ${o.selectedBy}`),console.log("─".repeat(60));return}if(0===o.matches.length)return void console.log(y.Ay.yellow(`No applications matched "${e}"`));console.log(y.Ay.bold(`
|
|
27
27
|
Matching Applications (${o.matches.length})`)),console.log("─".repeat(80)),o.matches.forEach(e=>{console.log(`${y.Ay.cyan(e.name||"Unnamed")} ${y.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve application: ${t.message}`):(0,_.OW)(t.message,{resource:"application",query:e}),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),A.command("update <id>").description("Update application name, description, and/or configuration").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("-c, --config <json>","Application config as JSON string").option("-f, --file <path>","Application config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((s=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Updating application...").start();try{var n={id:e};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.config?n.config=t.config:t.file&&(n.config=b.readFileSync(t.file,"utf-8")),void 0!==n.config&&(n.validateConfig=!1!==t.validate),t.lastCommitId&&(n.lastCommitId=t.lastCommitId);var r=yield a.updateApplication(n);t.json?(0,C.yd)({action:"application.update",target:T(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Application updated: ${y.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(y.Ay.yellow("Note: Application has unreleased changes")))}catch(a){t.json?(0,_.OW)(a.message,{action:"application.update",target:{id:e}}):i.fail(`Failed to update application: ${a.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),A.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((p=v(function*(e,t){var a=(0,w.o)(),i=(0,D.default)("Applying short edit...").start();try{var n=JSON.parse(t.list);Array.isArray(n)||(i.fail("List must be a JSON array"),process.exit(1));var r=yield a.shortEditApplication({id:e,list:n});i.succeed(`Short edit applied to: ${y.Ay.green(r.name)}`)}catch(e){i.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),A.command("short-refs <id>").description("List short edit references for an application").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((l=v(function*(e,t){var a=(0,w.o)(),i=(0,D.default)("Fetching short edit references...").start();try{var n=yield a.application({id:e});if(i.stop(),!n?.short_edit?.enabled)return void console.log(y.Ay.yellow("Short Edit is not enabled for this application"));var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,x.V)(n.short_edit.ref_map,{keyword:t.keyword,types:r});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(y.Ay.yellow("No short edit references found"));console.log(y.Ay.bold(`
|
|
28
28
|
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(y.Ay.cyan(`
|
|
29
|
-
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?y.Ay.gray(`- ${t.title}`):"";console.log(` ${y.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),A.command("bind <id>").description("Bind devices to application").option("-b, --bind <devices>","Device IDs to bind (comma-separated)").option("-u, --unbind <devices>","Device IDs to unbind (comma-separated)").option("--dry-run","Validate inputs and show the binding plan without applying it").option("-j, --json","Output as JSON").action((d=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Updating device bindings...").start();try{var n=yield a.application({id:e});if(!n)throw Error("Application not found");var r=t.bind?t.bind.split(",").map(e=>e.trim()):[],o=t.unbind?t.unbind.split(",").map(e=>e.trim()):[],s={id:e};if(r.length>0&&(s.bindDevices=r),o.length>0&&(s.unbindDevices=o),t.dryRun){i&&i.stop(),(0,C.S5)({action:"application.bind",target:T(n,e),request:{bindDevices:r,unbindDevices:o},checks:[(0,C.Iy)("application exists",!0,`${n.name} (${n._id})`),(0,C.Iy)("device changes provided",r.length+o.length>0,`bind=${r.length}, unbind=${o.length}`)],json:t.json});return}yield a.bindApplication(s),t.json?(0,C.yd)({action:"application.bind",target:T(n,e),result:{bindDevices:r,unbindDevices:o},json:!0}):i.succeed("Device bindings updated")}catch(a){t.json?(0,_.OW)(a.message,{action:"application.bind",target:{id:e}}):i.fail(`Failed to update bindings: ${a.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("trigger <id> <testId>").description("Trigger automation test on application").option("--play","Play the test",!0).option("--stop","Stop the test").option("--setup-at-launch","Setup to run at app launch").option("-g, --match-group <group>","Match group").action((u=v(function*(e,t,a){var i=(0,w.o)(),n=(0,D.default)("Triggering automation...").start();try{yield i.triggerApplicationCanvasControl({id:e,testId:t,play:!a.stop&&a.play,setupAtLaunch:a.setupAtLaunch,matchGroup:a.matchGroup}),n.succeed(`Automation triggered: ${y.Ay.green(t)}`)}catch(e){n.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,a){return u.apply(this,arguments)})),A.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((c=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Releasing application...").start();try{var n=(0,F.
|
|
30
|
-
|
|
31
|
-
Release by BRICKS CLI`:"Release by BRICKS CLI";if(t.dryRun){i&&i.stop(),(0,C.S5)({action:"application.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,C.Iy)("application exists",!0,`${p.name} (${p._id})`),(0,C.Iy)("application is unlocked",!p.lock?.enabled),(0,C.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseApplication({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,C.yd)({action:"application.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Application released: ${y.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,_.OW)(a.message,{action:"application.release",target:{id:e}}):i.fail(`Failed to release application: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Pulling application project...").start();try{var n=yield a.applicationProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Application project fetched: ${y.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),A.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").action((f=v(function*(e,t){b.existsSync(e)||(console.error(y.Ay.red(`Config file not found: ${e}`)),process.exit(1));var i=(0,D.default)("Validating config...").start();try{var n=b.readFileSync(e,"utf-8"),r=JSON.parse(n),o=yield Promise.all([a.e(587),a.e(10),a.e(511)]).then(a.t.bind(a,38890,19)),s=o.checkConfig,p=o.checkConfigDeprecatedFeatures,l=s(r),d=p(r);if(i.stop(),t.json){console.log(JSON.stringify({...l,deprecations:d},null,2)),l.valid||process.exit(1);return}if(l.valid&&0===d.length)return void console.log(y.Ay.green("✓ Config is valid"));console.log(y.Ay.bold("\nConfig Validation Report")),console.log("─".repeat(60)),l.schema.length>0&&(console.log(y.Ay.red(`
|
|
29
|
+
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?y.Ay.gray(`- ${t.title}`):"";console.log(` ${y.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),A.command("bind <id>").description("Bind devices to application").option("-b, --bind <devices>","Device IDs to bind (comma-separated)").option("-u, --unbind <devices>","Device IDs to unbind (comma-separated)").option("--dry-run","Validate inputs and show the binding plan without applying it").option("-j, --json","Output as JSON").action((d=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Updating device bindings...").start();try{var n=yield a.application({id:e});if(!n)throw Error("Application not found");var r=t.bind?t.bind.split(",").map(e=>e.trim()):[],o=t.unbind?t.unbind.split(",").map(e=>e.trim()):[],s={id:e};if(r.length>0&&(s.bindDevices=r),o.length>0&&(s.unbindDevices=o),t.dryRun){i&&i.stop(),(0,C.S5)({action:"application.bind",target:T(n,e),request:{bindDevices:r,unbindDevices:o},checks:[(0,C.Iy)("application exists",!0,`${n.name} (${n._id})`),(0,C.Iy)("device changes provided",r.length+o.length>0,`bind=${r.length}, unbind=${o.length}`)],json:t.json});return}yield a.bindApplication(s),t.json?(0,C.yd)({action:"application.bind",target:T(n,e),result:{bindDevices:r,unbindDevices:o},json:!0}):i.succeed("Device bindings updated")}catch(a){t.json?(0,_.OW)(a.message,{action:"application.bind",target:{id:e}}):i.fail(`Failed to update bindings: ${a.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("trigger <id> <testId>").description("Trigger automation test on application").option("--play","Play the test",!0).option("--stop","Stop the test").option("--setup-at-launch","Setup to run at app launch").option("-g, --match-group <group>","Match group").action((u=v(function*(e,t,a){var i=(0,w.o)(),n=(0,D.default)("Triggering automation...").start();try{yield i.triggerApplicationCanvasControl({id:e,testId:t,play:!a.stop&&a.play,setupAtLaunch:a.setupAtLaunch,matchGroup:a.matchGroup}),n.succeed(`Automation triggered: ${y.Ay.green(t)}`)}catch(e){n.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,a){return u.apply(this,arguments)})),A.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((c=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Releasing application...").start();try{var n=(0,F.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.application({id:e});if(!p)throw Error("Application not found");if(p.lock?.enabled)throw Error("Application is locked");var l=t.version||t.name||p.name||"Untitled",d=(0,F.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,C.S5)({action:"application.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,C.Iy)("application exists",!0,`${p.name} (${p._id})`),(0,C.Iy)("application is unlocked",!p.lock?.enabled),(0,C.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseApplication({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,C.yd)({action:"application.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Application released: ${y.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,_.OW)(a.message,{action:"application.release",target:{id:e}}):i.fail(`Failed to release application: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,D.default)("Pulling application project...").start();try{var n=yield a.applicationProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Application project fetched: ${y.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),A.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").action((f=v(function*(e,t){b.existsSync(e)||(console.error(y.Ay.red(`Config file not found: ${e}`)),process.exit(1));var i=(0,D.default)("Validating config...").start();try{var n=b.readFileSync(e,"utf-8"),r=JSON.parse(n),o=yield Promise.all([a.e(587),a.e(10),a.e(511)]).then(a.t.bind(a,38890,19)),s=o.checkConfig,p=o.checkConfigDeprecatedFeatures,l=s(r),d=p(r);if(i.stop(),t.json){console.log(JSON.stringify({...l,deprecations:d},null,2)),l.valid||process.exit(1);return}if(l.valid&&0===d.length)return void console.log(y.Ay.green("✓ Config is valid"));console.log(y.Ay.bold("\nConfig Validation Report")),console.log("─".repeat(60)),l.schema.length>0&&(console.log(y.Ay.red(`
|
|
32
30
|
Schema Errors (${l.schema.length})
|
|
33
31
|
`)),l.schema.forEach((e,t)=>{var a=e.instancePath||e.dataPath||"/";console.log(` ${y.Ay.red(`${t+1}.`)} ${y.Ay.bold(a)}`),console.log(` ${e.message}`),e.params?.pattern&&console.log(` ${y.Ay.gray(`pattern: ${e.params.pattern}`)}`)})),l.ref.length>0&&(console.log(y.Ay.red(`
|
|
34
32
|
Reference Errors (${l.ref.length})
|
|
@@ -62,7 +60,7 @@ ${y.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(y.Ay.red(`Error: $
|
|
|
62
60
|
Found ${p.length} DevTools server(s)`)),console.log("─".repeat(80));var c=function*(e){var t=!1===e.verified?k.Ay.red("unverified"):k.Ay.green("online"),a=e.hasPasscode?k.Ay.yellow("passcode"):k.Ay.gray("open"),i=(e.protocols||[]).map(e=>k.Ay.cyan(e)).join(", "),n=e.workspaceId&&u&&e.workspaceId===u,r=e.addresses||[e.address],o=r.filter(t=>t!==e.address),s=o.length>0?`${e.address}:${e.port} +${o.length} more`:`${e.address}:${e.port}`;if(console.log(` ${k.Ay.bold(e.name||"Unknown")} ${k.Ay.gray(`(${s})`)} [${t}]`),o.length>0&&console.log(` Addresses: ${r.map(e=>k.Ay.gray(e)).join(", ")}`),e.version&&console.log(` Version: ${k.Ay.green(e.version)}`),e.chromeInspect){var p=e.passcode?k.Ay.cyan(e.passcode):k.Ay.gray("no passcode");console.log(` Chrome Inspect: ${k.Ay.green("supported")} (passcode: ${p})`)}var l=` Protocols: ${i||k.Ay.gray("none")} Auth: ${a}`;if(e.deviceId&&(l+=` Device: ${k.Ay.gray(e.deviceId)}`),console.log(l),e.workspaceId){var d=n?k.Ay.green(`${e.workspaceId} (current profile)`):k.Ay.gray(e.workspaceId);console.log(` Workspace: ${d}`)}};for(var m of p)yield*c(m);console.log("─".repeat(80));var f=p[0],h=`${f.address}:${f.port||19851}`,v=f.passcode?`/ws/${encodeURIComponent(f.passcode)}`:"/ws/<passcode>";console.log(k.Ay.gray(`
|
|
63
61
|
Connect via: http://${h}/devtools-frontend/inspector.html?ws=${h}${v}`)),console.log(k.Ay.gray(`Legacy: devtools://devtools/bundled/inspector.html?ws=${h}${v}`)),process.exit(0)}catch(e){s.fail(`Scan failed: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),q.command("open <address>").description("Show DevTools server information").option("-p, --port <port>","Server port","19851").option("--info","Show connection URLs").action((p=O(function*(e,t){var i=(yield Promise.resolve().then(a.bind(a,30155))).default,n=(yield Promise.resolve().then(a.bind(a,75646))).verifyDevToolsServer,r=parseInt(t.port,10),o=`${e}:${r}`,s=i(`Fetching server info from ${o}...`).start(),p=yield n(e,r);p||(s.fail(`Could not reach DevTools server at ${o}`),process.exit(1)),s.stop();var l=yield B(e,r),d=l?R(l?.[0]?.webSocketDebuggerUrl):null,u=d?`/ws/${encodeURIComponent(d)}`:"/ws/<passcode>";if(t.info){console.log(k.Ay.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${k.Ay.cyan(`http://${o}`)}`),console.log(` CDP: ${k.Ay.cyan(`http://${o}/devtools-frontend/inspector.html?ws=${o}${u}`)}`),console.log(` CDP legacy: ${k.Ay.cyan(`devtools://devtools/bundled/inspector.html?ws=${o}${u}`)}`),console.log(` MCP: ${k.Ay.cyan(`http://${o}/mcp`)}`),console.log(` MCP SSE: ${k.Ay.cyan(`http://${o}/sse`)}`),console.log(` Info: ${k.Ay.cyan(`http://${o}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(k.Ay.bold("Authorization")),d&&console.log(` Passcode: ${k.Ay.cyan(d)}`),console.log(" MCP and MCP SSE require a Bearer token header with the device passcode:"),console.log(` ${k.Ay.gray(`Authorization: Bearer ${d||"<passcode>"}`)}`);return}if(console.log(k.Ay.bold("DevTools Server")),console.log("─".repeat(60)),console.log(` Name: ${k.Ay.cyan(p.name||"Unknown")}`),console.log(` Version: ${p.version?k.Ay.green(p.version):k.Ay.gray("N/A")}`),console.log(` Device ID: ${k.Ay.gray(p.deviceId||"N/A")}`),console.log(` Workspace: ${k.Ay.gray(p.workspaceId||"N/A")}`),console.log(` Protocols: ${(p.protocols||[]).map(e=>k.Ay.cyan(e)).join(", ")||k.Ay.gray("none")}`),console.log(` Auth: ${p.hasPasscode?k.Ay.yellow("passcode required"):k.Ay.gray("open")}`),console.log(` Port: ${p.port}`),l){var c=d?k.Ay.cyan(d):k.Ay.gray("no passcode");console.log(` Inspect: ${k.Ay.green("chrome://inspect supported")} (passcode: ${c})`)}else console.log(` Inspect: ${k.Ay.gray("chrome://inspect not available")}`);console.log("─".repeat(60)),p.version&&!U(p.version)&&console.log(k.Ay.yellow(`
|
|
64
62
|
CDP commands require version >= ${L}`)),console.log(k.Ay.gray(`
|
|
65
|
-
Use --info to see connection URLs`))}),function(e,t){return p.apply(this,arguments)})),G(q.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((l=O(function*(e){var t;yield z(e,(t=O(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(k.Ay.red("No screenshot data received")),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`screenshot-${Date.now()}.png`,s=r.resolve(o);n.writeFileSync(s,Buffer.from(i.data,"base64")),console.log(k.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return l.apply(this,arguments)}));var J=q.command("brick").description("Brick component inspection");G(J.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((d=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e.depth,10),i=(yield t.send("DOM.getDocument",{depth:a})).root;e.json?console.log(JSON.stringify(i,null,2)):console.log(Q(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return d.apply(this,arguments)})),G(J.command("query <selector>").description("Find brick by CSS selector")).action((u=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelector",{nodeId:i.nodeId,selector:e})).nodeId;if(0===n)return void console.log(k.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=Y((yield a.send("DOM.getAttributes",{nodeId:n})).attributes);if(t.json)return void console.log(JSON.stringify({nodeId:n,...r.node,attributes:o},null,2));if(console.log(k.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(k.Ay.bold("Attributes:")),Object.entries(o))){var p=S(s,2),l=p[0],d=p[1];console.log(` ${k.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return u.apply(this,arguments)})),G(J.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((c=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelectorAll",{nodeId:i.nodeId,selector:e})).nodeIds;if(t.json)return void console.log(JSON.stringify({nodeIds:n,count:n.length},null,2));for(var r of(console.log(k.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=Y((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?k.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return c.apply(this,arguments)})),G(J.command("attributes <nodeId>").description("Get brick attributes")).action((m=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=Y((yield a.send("DOM.getAttributes",{nodeId:i})).attributes);if(t.json)return void console.log(JSON.stringify(n,null,2));if(0===Object.keys(n).length)return void console.log(k.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=S(r,2),s=o[0],p=o[1];console.log(` ${k.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),G(J.command("box-model <nodeId>").description("Get brick dimensions and position")).action((f=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.getBoxModel",{nodeId:i})).model;t.json?console.log(JSON.stringify(n,null,2)):(console.log(k.Ay.bold(`Box Model for node ${i}`)),console.log(` Width: ${n.width}`),console.log(` Height: ${n.height}`),n.content&&console.log(` Content: [${n.content.join(", ")}]`),n.padding&&console.log(` Padding: [${n.padding.join(", ")}]`),n.border&&console.log(` Border: [${n.border.join(", ")}]`),n.margin&&console.log(` Margin: [${n.margin.join(", ")}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),G(J.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((h=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.resolveNode",{nodeId:i})).object;if(t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Resolved node ${i}`)),console.log(` Type: ${n.type}`),n.className&&console.log(` Class: ${n.className}`),n.description&&console.log(` Description: ${n.description}`),n.objectId&&console.log(` Object ID: ${k.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(k.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${k.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),G(J.command("focus <nodeId>").description("Focus a brick element")).action((v=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(k.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return v.apply(this,arguments)}));var H=q.command("input").description("Input emulation");G(H.command("tap <x> <y>").description("Tap/click at coordinates")).action((g=O(function*(e,t,a){var i;yield z(a,(i=O(function*(a){var i=parseFloat(e),n=parseFloat(t);yield a.send("Input.dispatchMouseEvent",{type:"mousePressed",x:i,y:n,button:"left",clickCount:1}),yield a.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:i,y:n,button:"left",clickCount:1}),console.log(k.Ay.green(`Tapped at (${i}, ${n})`))}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return g.apply(this,arguments)})),G(H.command("type <text>").description("Insert text into focused element")).action((y=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.insertText",{text:e}),console.log(k.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)})),G(H.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((D=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(k.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)}));var W=q.command("network").description("Network inspection");G(W.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((b=O(function*(e){var t;yield z(e,(t=O(function*(t){var a=new Map,i=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{a.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=a.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=a.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,i)),yield t.send("Network.disable");var n=[...a.values()];if(e.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(k.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?k.Ay.red("ERR"):r.status?r.status<300?k.Ay.green(r.status):r.status<400?k.Ay.yellow(r.status):k.Ay.red(r.status):k.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${k.Ay.bold(r.method.padEnd(6))} ${s} ${k.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return b.apply(this,arguments)})),G(W.command("get <requestId>").description("Get response body for a network request")).action((x=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Network.enable");var i=yield a.send("Network.getResponseBody",{requestId:e}),n=i.body,r=i.base64Encoded;t.json?console.log(JSON.stringify({body:n,base64Encoded:r},null,2)):r?console.log(k.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var K=q.command("storage").description("Storage inspection"),X=K.command("system").description("System key-value storage");G(X.command("persist").description("Show persistent system storage entries")).action((_=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!0}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Persistent Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return _.apply(this,arguments)})),G(X.command("memory").description("Show in-memory system storage entries")).action((w=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!1}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Memory Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)}));var Z=K.command("data-bank").description("Property Bank data stores");G(Z.command("list").description("List Property Banks")).action((E=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:"bricks://app"})).databaseNames.filter(e=>e.startsWith("DATA-"));if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Property Banks (${a.length})`)),a))console.log(` ${k.Ay.cyan(i)}`)}),function(e){return t.apply(this,arguments)}))}),function(e){return E.apply(this,arguments)})),G(Z.command("get <name> <store>").description("Query Property Bank data").option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0")).action((F=O(function*(e,t,a){var i;yield z(a,(i=O(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:e,objectStoreName:t,indexName:"",skipCount:parseInt(a.skip,10),pageSize:parseInt(a.limit,10)})).objectStoreDataEntries;if(a.json)return void console.log(JSON.stringify(n,null,2));for(var r of(console.log(k.Ay.bold(`${e} / ${t} (${n.length} entries)`)),console.log("─".repeat(60)),n)){var o=JSON.stringify(r.key?.value??r.key),s=JSON.stringify(r.value?.value??r.value),p=s.length>100?s.substring(0,100)+"...":s;console.log(` ${k.Ay.cyan(o)}: ${p}`)}}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return F.apply(this,arguments)})),G(K.command("generator-cache").description("Show generator cache entries")).action((C=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:"GENERATOR_CACHE",objectStoreName:"entries",indexName:"",skipCount:0,pageSize:100})).objectStoreDataEntries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Generator Cache (${a.length} entries)`)),console.log("─".repeat(60)),a)){var n=JSON.stringify(i.key?.value??i.key),r=JSON.stringify(i.value?.value??i.value),o=r.length>100?r.substring(0,100)+"...":r;console.log(` ${k.Ay.cyan(n)}: ${o}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return C.apply(this,arguments)}));var ee=q.command("runtime").description("Runtime and evaluation");G(ee.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((T=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Runtime.enable");var i=yield a.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)return void console.log(JSON.stringify(i,null,2));i.exceptionDetails&&(console.error(k.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(k.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(k.Ay.gray("undefined")):void 0!==n.value?console.log("object"==typeof n.value?JSON.stringify(n.value,null,2):String(n.value)):n.description?console.log(n.description):console.log(k.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return T.apply(this,arguments)})),G(ee.command("properties <objectId>").description("Get properties of a remote object")).action((A=O(function*(e,t){var a;yield z(t,(a=O(function*(a){var i=(yield a.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)return void console.log(JSON.stringify(i,null,2));for(var n of(console.log(k.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||k.Ay.gray(`[${r?.type}]`);console.log(` ${k.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return A.apply(this,arguments)}))},11405(e,t,a){a.d(t,{l:()=>v});var i,n,r,o=a(99436),s=a(35679),p=a(7586),l=a(85382),d=a(8479),u=a(23258),c=(i=o(function*(){try{return yield Promise.all([a.e(587),a.e(647),a.e(10),a.e(117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),m=(e,t,a)=>({severity:e,code:t,message:a}),f=(n=o(function*({version:e="2.25.0-beta.12",mcpCheck:t=c}={}){var a=(0,u.getCurrentProfile)(),i=(0,u.getCurrentProfileSource)(),n=(0,u.getTokenInfo)(a),r=(0,u.getBaseUrl)(),o=(0,u.getActivityLogBaseUrl)(),s=[],f={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:u.CONFIG_PATH,baseUrl:r,activityLogBaseUrl:o},auth:{available:!!n?.token,source:n?.token?"config":"missing",workspaceId:n?.workspaceId||null,workspaceName:n?.workspaceName||null,createdAt:n?.createdAt||null,tokenPreview:(0,p.$l)(n?.token)},connectivity:{workspace:{ok:!1,skipped:!n?.token,error:null}},capabilities:{zeroArgMode:(0,d.z)()?"interactive":"help",mcp:{available:!1,error:null}},issues:s};if(n?.token)try{var h=yield(0,l.createClient)(r,n.token).workspace();f.connectivity.workspace={ok:!0,skipped:!1,error:null,id:h?._id||n.workspaceId||null,name:h?.name||n.workspaceName||null},f.auth.workspaceId=h?._id||f.auth.workspaceId,f.auth.workspaceName=h?.name||f.auth.workspaceName}catch(e){f.connectivity.workspace={ok:!1,skipped:!1,error:e.message},s.push(m("error","workspace_unreachable",`Workspace query failed for ${r}: ${e.message}`))}else s.push(m("warning","auth_missing","No saved token for the current profile."));var v=yield t();return f.capabilities.mcp={available:v.available,error:v.error||null},v.available||s.push(m("warning","mcp_unavailable",`MCP stdio server is unavailable: ${v.error||"Unknown error"}`)),f.ok=0===s.length,f}),function(){return n.apply(this,arguments)}),h=(e,t,a)=>`${e.padEnd(14)} ${t}${a?` ${a}`:""}`,v=new s.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((r=o(function*(e){try{var t=yield f();if(e.json)return void(0,p.GF)(t);console.log((e=>{var t=[];if(t.push("BRICKS CLI Doctor"),t.push("─".repeat(60)),t.push(h("CLI","OK",`bricks v${e.cli.version}`)),t.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),t.push(h("BRICKS API","OK",e.config.baseUrl)),t.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";t.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else t.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)t.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var i=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";t.push(h("Workspace","OK",i))}else t.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?t.push(h("MCP","OK","STDIO server import is available")):t.push(h("MCP","WARN",e.capabilities.mcp.error)),t.push(h("Zero-arg mode",((e,t=!1)=>e?"OK":t?"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&&(t.push("─".repeat(60)),t.push("Issues"),e.issues.forEach(e=>{t.push(`- [${e.severity}] ${e.message}`)})),t.join("\n")})(t))}catch(t){e.json?(0,p.OW)(t.message):console.error(`Doctor failed: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},28634(e,t,a){a.d(t,{p:()=>_});var i,n,r,o,s,p,l,d=a(68832),u=a(99436),c=a(35679),m=a(73284),f=a(30155),h=a(7586),v=a(56493),g=a(68168),y=a(98593),D=e=>{if(!e)return m.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=3e5?m.Ay.green("●"):60>Math.floor(t/6e4)?m.Ay.yellow("○"):m.Ay.red("○")},b=(e,t)=>({id:e?._id||t,name:e?.name||"Unnamed",deviceCount:e?.devices?.length||0}),x=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"],_=new c.uB("group").description("Device Group management");_.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((i=u(function*(e){var t=(0,v.o)(),a=(0,f.default)("Fetching device groups...").start();try{var i=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(m.Ay.yellow("No device groups found"));console.log(m.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),i.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${m.Ay.cyan(e.name)} ${m.Ay.gray(`(${t} devices)`)}`),console.log(` ID: ${m.Ay.gray(e._id)}`),e.description&&console.log(` ${m.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list groups: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),_.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((n=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching device group...").start();try{var n=yield a.deviceGroup({id:e});if(i.stop(),n||(console.log(m.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));console.log(m.Ay.bold(`
|
|
63
|
+
Use --info to see connection URLs`))}),function(e,t){return p.apply(this,arguments)})),G(q.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((l=O(function*(e){var t;yield z(e,(t=O(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(k.Ay.red("No screenshot data received")),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`screenshot-${Date.now()}.png`,s=r.resolve(o);n.writeFileSync(s,Buffer.from(i.data,"base64")),console.log(k.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return l.apply(this,arguments)}));var J=q.command("brick").description("Brick component inspection");G(J.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((d=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e.depth,10),i=(yield t.send("DOM.getDocument",{depth:a})).root;e.json?console.log(JSON.stringify(i,null,2)):console.log(Q(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return d.apply(this,arguments)})),G(J.command("query <selector>").description("Find brick by CSS selector")).action((u=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelector",{nodeId:i.nodeId,selector:e})).nodeId;if(0===n)return void console.log(k.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=Y((yield a.send("DOM.getAttributes",{nodeId:n})).attributes);if(t.json)return void console.log(JSON.stringify({nodeId:n,...r.node,attributes:o},null,2));if(console.log(k.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(k.Ay.bold("Attributes:")),Object.entries(o))){var p=S(s,2),l=p[0],d=p[1];console.log(` ${k.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return u.apply(this,arguments)})),G(J.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((c=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelectorAll",{nodeId:i.nodeId,selector:e})).nodeIds;if(t.json)return void console.log(JSON.stringify({nodeIds:n,count:n.length},null,2));for(var r of(console.log(k.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=Y((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?k.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return c.apply(this,arguments)})),G(J.command("attributes <nodeId>").description("Get brick attributes")).action((m=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=Y((yield a.send("DOM.getAttributes",{nodeId:i})).attributes);if(t.json)return void console.log(JSON.stringify(n,null,2));if(0===Object.keys(n).length)return void console.log(k.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=S(r,2),s=o[0],p=o[1];console.log(` ${k.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),G(J.command("box-model <nodeId>").description("Get brick dimensions and position")).action((f=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.getBoxModel",{nodeId:i})).model;t.json?console.log(JSON.stringify(n,null,2)):(console.log(k.Ay.bold(`Box Model for node ${i}`)),console.log(` Width: ${n.width}`),console.log(` Height: ${n.height}`),n.content&&console.log(` Content: [${n.content.join(", ")}]`),n.padding&&console.log(` Padding: [${n.padding.join(", ")}]`),n.border&&console.log(` Border: [${n.border.join(", ")}]`),n.margin&&console.log(` Margin: [${n.margin.join(", ")}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),G(J.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((h=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.resolveNode",{nodeId:i})).object;if(t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Resolved node ${i}`)),console.log(` Type: ${n.type}`),n.className&&console.log(` Class: ${n.className}`),n.description&&console.log(` Description: ${n.description}`),n.objectId&&console.log(` Object ID: ${k.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(k.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${k.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),G(J.command("focus <nodeId>").description("Focus a brick element")).action((v=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(k.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return v.apply(this,arguments)}));var H=q.command("input").description("Input emulation");G(H.command("tap <x> <y>").description("Tap/click at coordinates")).action((g=O(function*(e,t,a){var i;yield z(a,(i=O(function*(a){var i=parseFloat(e),n=parseFloat(t);yield a.send("Input.dispatchMouseEvent",{type:"mousePressed",x:i,y:n,button:"left",clickCount:1}),yield a.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:i,y:n,button:"left",clickCount:1}),console.log(k.Ay.green(`Tapped at (${i}, ${n})`))}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return g.apply(this,arguments)})),G(H.command("type <text>").description("Insert text into focused element")).action((y=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.insertText",{text:e}),console.log(k.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)})),G(H.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((D=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(k.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)}));var W=q.command("network").description("Network inspection");G(W.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((b=O(function*(e){var t;yield z(e,(t=O(function*(t){var a=new Map,i=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{a.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=a.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=a.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,i)),yield t.send("Network.disable");var n=[...a.values()];if(e.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(k.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?k.Ay.red("ERR"):r.status?r.status<300?k.Ay.green(r.status):r.status<400?k.Ay.yellow(r.status):k.Ay.red(r.status):k.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${k.Ay.bold(r.method.padEnd(6))} ${s} ${k.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return b.apply(this,arguments)})),G(W.command("get <requestId>").description("Get response body for a network request")).action((x=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Network.enable");var i=yield a.send("Network.getResponseBody",{requestId:e}),n=i.body,r=i.base64Encoded;t.json?console.log(JSON.stringify({body:n,base64Encoded:r},null,2)):r?console.log(k.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var K=q.command("storage").description("Storage inspection"),X=K.command("system").description("System key-value storage");G(X.command("persist").description("Show persistent system storage entries")).action((_=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!0}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Persistent Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return _.apply(this,arguments)})),G(X.command("memory").description("Show in-memory system storage entries")).action((w=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!1}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Memory Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)}));var Z=K.command("data-bank").description("Property Bank data stores");G(Z.command("list").description("List Property Banks")).action((E=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:"bricks://app"})).databaseNames.filter(e=>e.startsWith("DATA-"));if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Property Banks (${a.length})`)),a))console.log(` ${k.Ay.cyan(i)}`)}),function(e){return t.apply(this,arguments)}))}),function(e){return E.apply(this,arguments)})),G(Z.command("get <name> <store>").description("Query Property Bank data").option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0")).action((F=O(function*(e,t,a){var i;yield z(a,(i=O(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:e,objectStoreName:t,indexName:"",skipCount:parseInt(a.skip,10),pageSize:parseInt(a.limit,10)})).objectStoreDataEntries;if(a.json)return void console.log(JSON.stringify(n,null,2));for(var r of(console.log(k.Ay.bold(`${e} / ${t} (${n.length} entries)`)),console.log("─".repeat(60)),n)){var o=JSON.stringify(r.key?.value??r.key),s=JSON.stringify(r.value?.value??r.value),p=s.length>100?s.substring(0,100)+"...":s;console.log(` ${k.Ay.cyan(o)}: ${p}`)}}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return F.apply(this,arguments)})),G(K.command("generator-cache").description("Show generator cache entries")).action((C=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:"GENERATOR_CACHE",objectStoreName:"entries",indexName:"",skipCount:0,pageSize:100})).objectStoreDataEntries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Generator Cache (${a.length} entries)`)),console.log("─".repeat(60)),a)){var n=JSON.stringify(i.key?.value??i.key),r=JSON.stringify(i.value?.value??i.value),o=r.length>100?r.substring(0,100)+"...":r;console.log(` ${k.Ay.cyan(n)}: ${o}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return C.apply(this,arguments)}));var ee=q.command("runtime").description("Runtime and evaluation");G(ee.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((T=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Runtime.enable");var i=yield a.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)return void console.log(JSON.stringify(i,null,2));i.exceptionDetails&&(console.error(k.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(k.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(k.Ay.gray("undefined")):void 0!==n.value?console.log("object"==typeof n.value?JSON.stringify(n.value,null,2):String(n.value)):n.description?console.log(n.description):console.log(k.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return T.apply(this,arguments)})),G(ee.command("properties <objectId>").description("Get properties of a remote object")).action((A=O(function*(e,t){var a;yield z(t,(a=O(function*(a){var i=(yield a.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)return void console.log(JSON.stringify(i,null,2));for(var n of(console.log(k.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||k.Ay.gray(`[${r?.type}]`);console.log(` ${k.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return A.apply(this,arguments)}))},11405(e,t,a){a.d(t,{l:()=>v});var i,n,r,o=a(99436),s=a(35679),p=a(7586),l=a(85382),d=a(8479),u=a(23258),c=(i=o(function*(){try{return yield Promise.all([a.e(587),a.e(647),a.e(10),a.e(117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),m=(e,t,a)=>({severity:e,code:t,message:a}),f=(n=o(function*({version:e="2.25.0-beta.14",mcpCheck:t=c}={}){var a=(0,u.getCurrentProfile)(),i=(0,u.getCurrentProfileSource)(),n=(0,u.getTokenInfo)(a),r=(0,u.getBaseUrl)(),o=(0,u.getActivityLogBaseUrl)(),s=[],f={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:u.CONFIG_PATH,baseUrl:r,activityLogBaseUrl:o},auth:{available:!!n?.token,source:n?.token?"config":"missing",workspaceId:n?.workspaceId||null,workspaceName:n?.workspaceName||null,createdAt:n?.createdAt||null,tokenPreview:(0,p.$l)(n?.token)},connectivity:{workspace:{ok:!1,skipped:!n?.token,error:null}},capabilities:{zeroArgMode:(0,d.z)()?"interactive":"help",mcp:{available:!1,error:null}},issues:s};if(n?.token)try{var h=yield(0,l.createClient)(r,n.token).workspace();f.connectivity.workspace={ok:!0,skipped:!1,error:null,id:h?._id||n.workspaceId||null,name:h?.name||n.workspaceName||null},f.auth.workspaceId=h?._id||f.auth.workspaceId,f.auth.workspaceName=h?.name||f.auth.workspaceName}catch(e){f.connectivity.workspace={ok:!1,skipped:!1,error:e.message},s.push(m("error","workspace_unreachable",`Workspace query failed for ${r}: ${e.message}`))}else s.push(m("warning","auth_missing","No saved token for the current profile."));var v=yield t();return f.capabilities.mcp={available:v.available,error:v.error||null},v.available||s.push(m("warning","mcp_unavailable",`MCP stdio server is unavailable: ${v.error||"Unknown error"}`)),f.ok=0===s.length,f}),function(){return n.apply(this,arguments)}),h=(e,t,a)=>`${e.padEnd(14)} ${t}${a?` ${a}`:""}`,v=new s.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((r=o(function*(e){try{var t=yield f();if(e.json)return void(0,p.GF)(t);console.log((e=>{var t=[];if(t.push("BRICKS CLI Doctor"),t.push("─".repeat(60)),t.push(h("CLI","OK",`bricks v${e.cli.version}`)),t.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),t.push(h("BRICKS API","OK",e.config.baseUrl)),t.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";t.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else t.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)t.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var i=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";t.push(h("Workspace","OK",i))}else t.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?t.push(h("MCP","OK","STDIO server import is available")):t.push(h("MCP","WARN",e.capabilities.mcp.error)),t.push(h("Zero-arg mode",((e,t=!1)=>e?"OK":t?"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&&(t.push("─".repeat(60)),t.push("Issues"),e.issues.forEach(e=>{t.push(`- [${e.severity}] ${e.message}`)})),t.join("\n")})(t))}catch(t){e.json?(0,p.OW)(t.message):console.error(`Doctor failed: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},28634(e,t,a){a.d(t,{p:()=>_});var i,n,r,o,s,p,l,d=a(68832),u=a(99436),c=a(35679),m=a(73284),f=a(30155),h=a(7586),v=a(56493),g=a(68168),y=a(98593),D=e=>{if(!e)return m.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=3e5?m.Ay.green("●"):60>Math.floor(t/6e4)?m.Ay.yellow("○"):m.Ay.red("○")},b=(e,t)=>({id:e?._id||t,name:e?.name||"Unnamed",deviceCount:e?.devices?.length||0}),x=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"],_=new c.uB("group").description("Device Group management");_.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((i=u(function*(e){var t=(0,v.o)(),a=(0,f.default)("Fetching device groups...").start();try{var i=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(m.Ay.yellow("No device groups found"));console.log(m.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),i.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${m.Ay.cyan(e.name)} ${m.Ay.gray(`(${t} devices)`)}`),console.log(` ID: ${m.Ay.gray(e._id)}`),e.description&&console.log(` ${m.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list groups: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),_.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((n=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching device group...").start();try{var n=yield a.deviceGroup({id:e});if(i.stop(),n||(console.log(m.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));console.log(m.Ay.bold(`
|
|
66
64
|
Device Group: ${n.name}`)),console.log("─".repeat(60)),console.log(`ID: ${m.Ay.gray(n._id)}`),console.log(`Description: ${n.description||m.Ay.gray("N/A")}`),console.log(`Tags: ${n.tags?.join(", ")||m.Ay.gray("None")}`),console.log(`Created: ${m.Ay.gray(n.create_datetime)}`),console.log(`Modified: ${m.Ay.gray(n.last_modify_datetime)}`),n.devices?.length>0&&(console.log(`
|
|
67
65
|
${m.Ay.bold("Devices")} (${n.devices.length})`),n.devices.forEach(e=>{var t=e.device_target_name||e.device_id;console.log(` - ${t} ${m.Ay.gray(`(${e.device_id})`)}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get group: ${e.message}`),process.exit(1)}}),function(e,t){return n.apply(this,arguments)})),_.command("resolve <query>").description("Resolve a device group name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((r=u(function*(e,t){var a=(0,v.o)(),i=t.json?null:(0,f.default)("Resolving device group...").start();try{var n=yield(0,g.Y)(()=>a.deviceGroup({id:e})),r=n?[n]:yield a.deviceGroups({paginate:{limit:t.limit}}),o=n?r:(r||[]).filter(t=>t.name?.toLowerCase().includes(e.trim().toLowerCase())),s=(0,g.K)({resource:"group",query:e,items:o||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,h.GF)(s);if(s.resolved){var p=s.resolved;console.log(m.Ay.bold("\nResolved Device Group")),console.log("─".repeat(60)),console.log(`Name: ${m.Ay.cyan(p.name||"Unnamed")}`),console.log(`ID: ${m.Ay.gray(p._id)}`),console.log(`Selected By: ${s.selectedBy}`),console.log("─".repeat(60));return}if(0===s.matches.length)return void console.log(m.Ay.yellow(`No device groups matched "${e}"`));console.log(m.Ay.bold(`
|
|
68
66
|
Matching Device Groups (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${m.Ay.cyan(e.name||"Unnamed")} ${m.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve device group: ${t.message}`):(0,h.OW)(t.message,{resource:"group",query:e}),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),_.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action((o=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching devices...").start();try{var n=yield a.devicesByGroup({id:e});if(i.stop(),t.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(m.Ay.yellow("No devices in this group"));console.log(m.Ay.bold("\nDevices in Group")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=D(t),i=e.name||e.device_name||e.device_target_name,n=e.entry_detail?.application?.name||m.Ay.gray("No app");console.log(`${a} ${m.Ay.cyan(i.padEnd(30))} ${n}`)}),console.log("─".repeat(80))}catch(e){i.fail(`Failed to get devices: ${e.message}`),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),_.command("dispatch <id> <action>").description("Dispatch action to all devices in group").option("--dry-run","Validate inputs and show the dispatch plan without sending it").option("-j, --json","Output as JSON").action((s=u(function*(e,t,a){var i=(0,v.o)(),n=a.json?null:(0,f.default)(`Dispatching ${t}...`).start();x.includes(t)||(a.json?(0,h.OW)(`Invalid action. Valid actions: ${x.join(", ")}`,{action:"group.dispatch",target:{id:e}}):n.fail(`Invalid action. Valid actions: ${x.join(", ")}`),process.exit(1));try{var r=yield i.deviceGroup({id:e});if(!r)throw Error("Device group not found");if(a.dryRun){n&&n.stop(),(0,y.S5)({action:"group.dispatch",target:b(r,e),request:{action:t},checks:[(0,y.Iy)("group exists",!0,`${r.name} (${r._id})`),(0,y.Iy)("action is valid",!0)],json:a.json});return}var o=yield i.dispatchDeviceGroupAction({id:e,action:t});a.json?(0,y.yd)({action:"group.dispatch",target:b(r,e),result:{action:t,success:o?.success||0,failed:o?.failed||0},json:!0}):(n.succeed(`Action dispatched: ${m.Ay.green(t)}`),o&&(console.log(`Success: ${m.Ay.green(o.success||0)}`),console.log(`Failed: ${m.Ay.red(o.failed||0)}`)))}catch(t){a.json?(0,h.OW)(t.message,{action:"group.dispatch",target:{id:e}}):n.fail(`Failed to dispatch action: ${t.message}`),process.exit(1)}}),function(e,t,a){return s.apply(this,arguments)})),_.command("refresh <id>").description("Refresh all devices in group").option("--dry-run","Validate inputs and show the refresh plan without sending it").option("-j, --json","Output as JSON").action((p=u(function*(e,t){var a=(0,v.o)(),i=t.json?null:(0,f.default)("Refreshing devices...").start();try{var n=yield a.deviceGroup({id:e});if(!n)throw Error("Device group not found");if(t.dryRun){i&&i.stop(),(0,y.S5)({action:"group.refresh",target:b(n,e),request:{action:"refresh"},checks:[(0,y.Iy)("group exists",!0,`${n.name} (${n._id})`)],json:t.json});return}var r=yield a.dispatchDeviceGroupAction({id:e,action:"refresh"});t.json?(0,y.yd)({action:"group.refresh",target:b(n,e),result:{success:r?.success||0,failed:r?.failed||0},json:!0}):(i.succeed("Devices refreshed"),r&&(console.log(`Success: ${m.Ay.green(r.success||0)}`),console.log(`Failed: ${m.Ay.red(r.failed||0)}`)))}catch(a){t.json?(0,h.OW)(a.message,{action:"group.refresh",target:{id:e}}):i.fail(`Failed to refresh: ${a.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),_.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action((l=u(function*(e,t){var a,i=(0,v.o)(),n=1e3*parseInt(t.interval,10);console.log(m.Ay.bold("\nDevice Group Monitor")),console.log(m.Ay.gray(`Polling every ${t.interval}s. Press Ctrl+C to stop.
|
|
@@ -81,9 +79,7 @@ ${v.Ay.bold("Usage")}`),console.log(`Used In: ${n.use_count.total_count} ap
|
|
|
81
79
|
${v.Ay.bold("Exposed Properties")} (${n.expose_properties.length})`),n.expose_properties.forEach(e=>{console.log(` - ${v.Ay.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get module: ${e.message}`),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),A.command("resolve <query>").description("Resolve a module name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((s=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Resolving module...").start();try{var n=yield(0,E.Y)(()=>a.module({id:e})),r=n?[n]:yield a.modules({keyword:e,paginate:{limit:t.limit}}),o=(0,E.K)({resource:"module",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,_.GF)(o);if(o.resolved){var s=o.resolved;console.log(v.Ay.bold("\nResolved Module")),console.log("─".repeat(60)),console.log(`Name: ${v.Ay.cyan(s.name||"Unnamed")}`),console.log(`ID: ${v.Ay.gray(s._id)}`),console.log(`Selected By: ${o.selectedBy}`),console.log("─".repeat(60));return}if(0===o.matches.length)return void console.log(v.Ay.yellow(`No modules matched "${e}"`));console.log(v.Ay.bold(`
|
|
82
80
|
Matching Modules (${o.matches.length})`)),console.log("─".repeat(80)),o.matches.forEach(e=>{console.log(`${v.Ay.cyan(e.name||"Unnamed")} ${v.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve module: ${t.message}`):(0,_.OW)(t.message,{resource:"module",query:e}),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),A.command("update <id>").description("Update module name, description, and/or configuration").option("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("-c, --config <json>","Module config as JSON string").option("-f, --file <path>","Module config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((p=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Updating module...").start();try{var n={id:e};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.config?n.config=t.config:t.file&&(n.config=y.readFileSync(t.file,"utf-8")),void 0!==n.config&&(n.validateConfig=!1!==t.validate),t.lastCommitId&&(n.lastCommitId=t.lastCommitId);var r=yield a.updateModule(n);t.json?(0,C.yd)({action:"module.update",target:T(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Module updated: ${v.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(v.Ay.yellow("Note: Module has unreleased changes")))}catch(a){t.json?(0,_.OW)(a.message,{action:"module.update",target:{id:e}}):i.fail(`Failed to update module: ${a.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),A.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((l=f(function*(e,t){var a=(0,w.o)(),i=(0,g.default)("Applying short edit...").start();try{var n=JSON.parse(t.list);Array.isArray(n)||(i.fail("List must be a JSON array"),process.exit(1));var r=yield a.shortEditModule({id:e,list:n});i.succeed(`Short edit applied to: ${v.Ay.green(r.name)}`)}catch(e){i.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),A.command("short-refs <id>").description("List short edit references for a module").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((d=f(function*(e,t){var a=(0,w.o)(),i=(0,g.default)("Fetching short edit references...").start();try{var n=yield a.module({id:e});if(i.stop(),!n?.short_edit?.enabled)return void console.log(v.Ay.yellow("Short Edit is not enabled for this module"));var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,x.V)(n.short_edit.ref_map,{keyword:t.keyword,types:r});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(v.Ay.yellow("No short edit references found"));console.log(v.Ay.bold(`
|
|
83
81
|
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(v.Ay.cyan(`
|
|
84
|
-
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?v.Ay.gray(`- ${t.title}`):"";console.log(` ${v.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((u=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Releasing module...").start();try{var n=(0,F.
|
|
85
|
-
|
|
86
|
-
Release by BRICKS CLI`:"Release by BRICKS CLI";if(t.dryRun){i&&i.stop(),(0,C.S5)({action:"module.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,C.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,C.Iy)("module is private",!p.is_public),(0,C.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseModule({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,C.yd)({action:"module.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Module released: ${v.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,_.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),A.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((c=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Pulling module project...").start();try{var n=yield a.moduleProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Module project fetched: ${v.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((m=f(function*(e,t){var i=(yield a.e(602).then(a.bind(a,6553))).initProject;yield i("module",e,t)}),function(e,t){return m.apply(this,arguments)}))},86141(e,t,a){a.d(t,{D:()=>V});var i,n,r,o,s,p,l,d,u,c=a(99436),m=a(35679),f=a(73284),h=a(30155),v=a(88958),g=a(73024),y=a(76760),D=a(48161),b=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),_=a(31421),w=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,C=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,T=e=>"beta"===e?"beta":"latest",A=(i=c(function*(e){var t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: HTTP ${t.status}`);return t}),function(e){return i.apply(this,arguments)}),S=(n=c(function*(e){return(yield A(C(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),O=(r=c(function*(e){var t=T(e),a=yield A(`https://registry.npmjs.org/-/package/${E}/dist-tags`),i=(yield a.json())[t];if(!i)throw Error(`No '${t}' dist-tag for ${E}`);return{version:i}}),function(e){return r.apply(this,arguments)}),N=(o=c(function*(e,t){return"npm"===t||"bun"===t?O(e):S(e)}),function(e,t){return o.apply(this,arguments)}),k=(e,t,a={})=>{var i=(0,_.spawnSync)(e,t,{stdio:"inherit",...a});if(i.error){if("ENOENT"===i.error.code)throw Error(`Command not found: ${e}`);throw i.error}if(0!==i.status){var n=Error(`${e} exited with code ${i.status}`);throw n.code=i.status,n}},I=(s=c(function*(e,t){var a=yield A(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(D.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield w.writeFile(n,i),F||(yield w.chmod(n,493)),n}),function(e,t){return s.apply(this,arguments)}),$=(p=c(function*(e,{installDir:t}={}){var a=F?"install.ps1":"install.sh",i=yield I(C(e,a),a);try{var n=F?["powershell",["-NoProfile","-ExecutionPolicy","Bypass","-File",i,..."beta"===e?["-Beta"]:[],...t?["-InstallDir",t]:[]]]:["sh",[i,..."beta"===e?["--beta"]:[],...t?[`--dir=${t}`]:[]]],r=x(n,2),o=r[0],s=r[1];k(o,s)}finally{yield w.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void k("npm",["install","-g",`${E}@${T(t)}`]);if("bun"===e)return void k("bun",["install","-g",`${E}@${T(t)}`]);if("binary"===e)return $(t,{installDir:a.installDir});throw Error(`Unsupported update method: ${e}`)}),function(e,t){return l.apply(this,arguments)}),B=a(8479),R=(d=c(function*({message:e,defaultValue:t,autoYes:a}){if(a)return!0;(0,B.z)()||(console.error(f.Ay.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{return yield(0,v.lJ)({message:e,default:t})}catch{return!1}}),function(e){return d.apply(this,arguments)}),V=new m.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((u=c(function*(e){var t,a="2.25.0-beta.12",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=D.homedir(),realpath:i=b}={})=>{let n;var r=(n=e)?y.basename(n).replace(/\.exe$/i,""):"";if("bricks"===r||"bricks-beta"===r)return{method:"binary",execPath:e,installDir:y.dirname(e)};var o=i(t),s=((e,t)=>{if(!e)return null;var a=y.sep,i=`${a}node_modules${a}${t.replace(/\//g,a)}${a}`,n=e.indexOf(i);return -1===n?null:e.slice(0,n)})(o,"@fugood/bricks-cli");if(s){var p=y.sep,l=y.join(a,".bun","install","global");return s===l||s.startsWith(l+p)?{method:"bun",installRoot:s}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(s)?{method:"pnpm",installRoot:s}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(s)?{method:"yarn",installRoot:s}:{method:"npm",installRoot:s.endsWith(`${p}lib`)?s.slice(0,-`${p}lib`.length):s}}return{method:"unknown",execPath:e,scriptPath:o}})(),n=e.channel||(({version:e,execPath:t}={})=>{var a=t||process.execPath;return a&&/[\\/]bricks-beta(?:\.exe)?$/i.test(a)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.12")?"beta":"release"})({version:a,execPath:i.execPath});console.log(f.Ay.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${f.Ay.cyan(a)}`),console.log(`Channel : ${f.Ay.cyan(n)}`),console.log(`Detected method : ${f.Ay.cyan(i.method)}`),i.execPath&&"binary"===i.method&&console.log(`Binary path : ${f.Ay.gray(i.execPath)}`),i.installRoot&&console.log(`Install root : ${f.Ay.gray(i.installRoot)}`);var r="npm"===i.method||"bun"===i.method?"npm":"cdn",o=(0,h.default)(`Fetching latest version info (${r})...`).start(),s=null,p=null;try{s=(yield N(n,i.method)).version,o.succeed(`Latest ${n} (${r}): ${f.Ay.green(s)}`)}catch(e){p=e,o.warn(`Could not fetch version info: ${e.message}`)}var l=s&&s===a;if(e.checkUpdate){if(p&&process.exit(2),l)return void console.log(f.Ay.green("\nUp to date."));s&&(console.log(f.Ay.yellow(`
|
|
82
|
+
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?v.Ay.gray(`- ${t.title}`):"";console.log(` ${v.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((u=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Releasing module...").start();try{var n=(0,F.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.module({id:e});if(!p)throw Error("Module not found");if(p.is_public)throw Error("Public module deployment is temporarily not recommended");var l=t.version||t.name||p.name||"Untitled",d=(0,F.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,C.S5)({action:"module.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,C.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,C.Iy)("module is private",!p.is_public),(0,C.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseModule({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,C.yd)({action:"module.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Module released: ${v.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,_.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),A.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((c=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Pulling module project...").start();try{var n=yield a.moduleProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Module project fetched: ${v.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((m=f(function*(e,t){var i=(yield a.e(602).then(a.bind(a,6553))).initProject;yield i("module",e,t)}),function(e,t){return m.apply(this,arguments)}))},86141(e,t,a){a.d(t,{D:()=>V});var i,n,r,o,s,p,l,d,u,c=a(99436),m=a(35679),f=a(73284),h=a(30155),v=a(88958),g=a(73024),y=a(76760),D=a(48161),b=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),_=a(31421),w=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,C=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,T=e=>"beta"===e?"beta":"latest",A=(i=c(function*(e){var t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: HTTP ${t.status}`);return t}),function(e){return i.apply(this,arguments)}),S=(n=c(function*(e){return(yield A(C(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),O=(r=c(function*(e){var t=T(e),a=yield A(`https://registry.npmjs.org/-/package/${E}/dist-tags`),i=(yield a.json())[t];if(!i)throw Error(`No '${t}' dist-tag for ${E}`);return{version:i}}),function(e){return r.apply(this,arguments)}),N=(o=c(function*(e,t){return"npm"===t||"bun"===t?O(e):S(e)}),function(e,t){return o.apply(this,arguments)}),k=(e,t,a={})=>{var i=(0,_.spawnSync)(e,t,{stdio:"inherit",...a});if(i.error){if("ENOENT"===i.error.code)throw Error(`Command not found: ${e}`);throw i.error}if(0!==i.status){var n=Error(`${e} exited with code ${i.status}`);throw n.code=i.status,n}},I=(s=c(function*(e,t){var a=yield A(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(D.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield w.writeFile(n,i),F||(yield w.chmod(n,493)),n}),function(e,t){return s.apply(this,arguments)}),$=(p=c(function*(e,{installDir:t}={}){var a=F?"install.ps1":"install.sh",i=yield I(C(e,a),a);try{var n=F?["powershell",["-NoProfile","-ExecutionPolicy","Bypass","-File",i,..."beta"===e?["-Beta"]:[],...t?["-InstallDir",t]:[]]]:["sh",[i,..."beta"===e?["--beta"]:[],...t?[`--dir=${t}`]:[]]],r=x(n,2),o=r[0],s=r[1];k(o,s)}finally{yield w.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void k("npm",["install","-g",`${E}@${T(t)}`]);if("bun"===e)return void k("bun",["install","-g",`${E}@${T(t)}`]);if("binary"===e)return $(t,{installDir:a.installDir});throw Error(`Unsupported update method: ${e}`)}),function(e,t){return l.apply(this,arguments)}),B=a(8479),R=(d=c(function*({message:e,defaultValue:t,autoYes:a}){if(a)return!0;(0,B.z)()||(console.error(f.Ay.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{return yield(0,v.lJ)({message:e,default:t})}catch{return!1}}),function(e){return d.apply(this,arguments)}),V=new m.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((u=c(function*(e){var t,a="2.25.0-beta.14",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=D.homedir(),realpath:i=b}={})=>{let n;var r=(n=e)?y.basename(n).replace(/\.exe$/i,""):"";if("bricks"===r||"bricks-beta"===r)return{method:"binary",execPath:e,installDir:y.dirname(e)};var o=i(t),s=((e,t)=>{if(!e)return null;var a=y.sep,i=`${a}node_modules${a}${t.replace(/\//g,a)}${a}`,n=e.indexOf(i);return -1===n?null:e.slice(0,n)})(o,"@fugood/bricks-cli");if(s){var p=y.sep,l=y.join(a,".bun","install","global");return s===l||s.startsWith(l+p)?{method:"bun",installRoot:s}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(s)?{method:"pnpm",installRoot:s}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(s)?{method:"yarn",installRoot:s}:{method:"npm",installRoot:s.endsWith(`${p}lib`)?s.slice(0,-`${p}lib`.length):s}}return{method:"unknown",execPath:e,scriptPath:o}})(),n=e.channel||(({version:e,execPath:t}={})=>{var a=t||process.execPath;return a&&/[\\/]bricks-beta(?:\.exe)?$/i.test(a)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.14")?"beta":"release"})({version:a,execPath:i.execPath});console.log(f.Ay.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${f.Ay.cyan(a)}`),console.log(`Channel : ${f.Ay.cyan(n)}`),console.log(`Detected method : ${f.Ay.cyan(i.method)}`),i.execPath&&"binary"===i.method&&console.log(`Binary path : ${f.Ay.gray(i.execPath)}`),i.installRoot&&console.log(`Install root : ${f.Ay.gray(i.installRoot)}`);var r="npm"===i.method||"bun"===i.method?"npm":"cdn",o=(0,h.default)(`Fetching latest version info (${r})...`).start(),s=null,p=null;try{s=(yield N(n,i.method)).version,o.succeed(`Latest ${n} (${r}): ${f.Ay.green(s)}`)}catch(e){p=e,o.warn(`Could not fetch version info: ${e.message}`)}var l=s&&s===a;if(e.checkUpdate){if(p&&process.exit(2),l)return void console.log(f.Ay.green("\nUp to date."));s&&(console.log(f.Ay.yellow(`
|
|
87
83
|
Update available: ${a} → ${s}. Run 'bricks update-cli' to install.`)),process.exit(1)),console.log(f.Ay.yellow("\nCould not determine current version.")),process.exit(2)}if(l&&(console.log(f.Ay.green("\nAlready running the latest version.")),!(yield R({message:"Reinstall anyway?",defaultValue:!1,autoYes:e.yes}))))return void console.log(f.Ay.gray("Skipped."));var d=["npm","bun","binary"].includes(i.method);d||console.log(f.Ay.yellow(`Cannot auto-detect installer (method: ${i.method}); falling back to binary install.`));var u=d?i.method:"binary";if(!(yield R({message:`Update CLI using "${u}" method?`,defaultValue:!0,autoYes:e.yes})))return void console.log(f.Ay.yellow("Cancelled."));var m=(t=c(function*(e){console.log(f.Ay.cyan(`
|
|
88
84
|
→ Running ${e} update...`));try{return yield j(e,n,i),!0}catch(t){return console.error(f.Ay.yellow(`
|
|
89
85
|
${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,arguments)}),v=yield m(u);!v&&"binary"!==u&&(console.log(f.Ay.cyan("\nFalling back to binary install (same method used by the desktop app).")),(yield R({message:"Try the binary installer as a fallback?",defaultValue:!0,autoYes:e.yes}))&&(v=yield m("binary"))),v||(console.error(f.Ay.red("\nUpdate failed. See messages above.")),process.exit(1)),console.log(f.Ay.green("\nUpdate complete."))}),function(e){return u.apply(this,arguments)}))},92642(e,t,a){a.d(t,{W:()=>_});var i,n,r,o=a(99436),s=a(5018),p=a(44668),l=a(4275),d=a(32235),u=a(62192),c=a(79657),m=a(64007);function f(e){var t,a,i,n=2;for("u">typeof Symbol&&(a=Symbol.asyncIterator,i=Symbol.iterator);n--;){if(a&&null!=(t=e[a]))return t.call(e);if(i&&null!=(t=e[i]))return new h(t.call(e));a="@@asyncIterator",i="@@iterator"}throw TypeError("Object is not async iterable")}function h(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(h=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var a=this.s.return;return void 0===a?Promise.resolve({value:e,done:!0}):t(a.apply(this.s,arguments))},throw:function(e){var a=this.s.return;return void 0===a?Promise.reject(e):t(a.apply(this.s,arguments))}},new h(e)}function v(){return(v=l(function*(e){var t=e.headers.get("content-type")||"";if(t.includes("application/json")){var a=yield d(e.json());if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));var i=Object.keys(a.data||{})[0];if(i&&Array.isArray(a.data[i]))for(var n of a.data[i])yield n;return}var r=t.match(/boundary="?([^";]+)"?/),o=r?r[1]:"-",s=`--${o}`,p="",l=!1,c=new TextDecoder,m=function*(){for(var e;-1!==(e=p.indexOf(s));){var t=p.slice(0,e);(p=p.slice(e+s.length)).startsWith("\r\n")?p=p.slice(2):p.startsWith("\n")&&(p=p.slice(1));var a=t.indexOf("\r\n\r\n"),i=-1!==a?t.slice(a+4).trim():t.trim();if(i){var n=void 0;try{n=JSON.parse(i)}catch{continue}if(n.errors?.length)throw Error(n.errors.map(e=>e.message).join("\n"));if(n.data){for(var r of Object.values(n.data))if(Array.isArray(r))for(var o of r)yield o}if(Array.isArray(n.incremental)){for(var d of n.incremental)if(Array.isArray(d.items))for(var u of d.items)yield u}if(!1===n.hasNext){l=!0;return}}}};try{var h=!1,v=!1;try{for(var g,y,D=f(e.body);h=!(y=yield d(D.next())).done;h=!1){var b=y.value;if(p+=c.decode(b,{stream:!0}),yield*u(f(m()),d),l)break}}catch(e){v=!0,g=e}finally{try{h&&null!=D.return&&(yield d(D.return()))}finally{if(v)throw g}}}catch(e){if(!e.message?.includes("Premature close")||!l)throw e}if(!l&&p.trim()){var x,_=p.indexOf("\r\n\r\n"),w=-1!==_?p.slice(_+4).trim():p.trim();if(w&&!w.startsWith("--")){try{x=JSON.parse(w)}catch{}if(x){if(x.errors?.length)throw Error(x.errors.map(e=>e.message).join("\n"));if(x.data){for(var E of Object.values(x.data))if(Array.isArray(E))for(var F of E)yield F}if(Array.isArray(x.incremental)){for(var C of x.incremental)if(Array.isArray(C.items))for(var T of C.items)yield T}!1===x.hasNext&&(l=!0)}}}e.body?.destroy()})).apply(this,arguments)}var g=`
|
|
@@ -901,8 +897,10 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
901
897
|
lastSeenAt
|
|
902
898
|
}
|
|
903
899
|
}
|
|
904
|
-
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>F});var n,r=a(99436),o=a(35679),s=a(73284),p=a(23258),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(71335),g=a(429),y=a(80274),D=a(42400),b=a(98247),x=a(11405),_=a(86141),w=a(59845),E=e([D]);D=(E.then?(await E)():E)[0];var F=(n=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,p.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),o.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.25.0-beta.
|
|
905
|
-
${s.Ay.bold("Data")}`),console.log(`Remote Update: ${m.bank?.enable_remote_update?s.Ay.green("Enabled"):s.Ay.gray("Disabled")}`),console.log(`Spacename: ${m.bank?.spacename||s.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){u.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}}),function(t){return e.apply(this,arguments)})),o.DM.on("--help",()=>{console.log(""),console.log(s.Ay.bold("Examples:")),console.log(""),console.log(s.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(s.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(s.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(s.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(s.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(s.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(s.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(s.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(s.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(s.Ay.cyan(" https://control.bricks.tools")),console.log(s.Ay.gray(" Go to Workspace Settings > API Token"))});var i=process.argv.slice(2);if(0===i.length){if((0,l.b)(i))try{var n=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield n();return}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}console.error(s.Ay.gray("No command provided. Interactive mode requires a TTY, so showing help instead.\n")),o.DM.outputHelp();return}yield o.DM.parseAsync(process.argv)}),function(){return n.apply(this,arguments)});let C=F;i()}catch(e){i(e)}})},56493(e,t,a){a.d(t,{o:()=>o});var i=a(73284),n=a(23258),r=a(85382),o=()=>{var e=(0,n.getCurrentProfile)(),t=(0,n.getToken)(e);return t||(console.error(i.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,r.createClient)((0,n.getBaseUrl)(),t)}},7586(e,t,a){a.d(t,{$l:()=>r,GF:()=>i,OW:()=>n});var i=e=>{console.log(JSON.stringify(e,null,2))},n=(e,t={})=>{console.error(JSON.stringify({ok:!1,error:{message:e,...t}},null,2))},r=(e,t=4)=>e?e.length<=2*t?"*".repeat(e.length):`${e.slice(0,t)}…${e.slice(-t)}`:null},8479(e,t,a){a.d(t,{b:()=>n,z:()=>i});var i=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&"function"==typeof process.stdin.setRawMode),n=(e=[])=>0===e.length&&i()},23258(e,t,i){i.r(t),i.d(t,{setActivityLogBaseUrl:()=>w,listProfiles:()=>x,removeToken:()=>h,setBaseUrl:()=>d,setProfileOverride:()=>g,getBaseUrl:()=>l,CONFIG_PATH:()=>s,CONFIG_DIR:()=>o,getCurrentProfileSource:()=>D,default:()=>F,getToken:()=>c,clearConfig:()=>E,getTokens:()=>u,getActivityLogBaseUrl:()=>_,getTokenInfo:()=>m,setCurrentProfile:()=>b,getCurrentProfile:()=>y,setToken:()=>f});var n=i(16928),r=i(70857),o=n.join(r.homedir(),".bricks-cli"),s=n.join(o,"config.json"),p=new a({projectName:"bricks-cli",cwd:o,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},createdAt:{type:"string"},baseUrl:{type:"string"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"}}}),l=()=>{var e=y(),t=p.get("tokens");return t[e]?.baseUrl||p.get("baseUrl")},d=(e,t)=>{if(!t)return void p.set("baseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].baseUrl=e,p.set("tokens",a)},u=()=>p.get("tokens"),c=(e="default")=>{var t=p.get("tokens");return t[e]?.token},m=(e="default")=>p.get("tokens")[e],f=(e,t)=>{var a=p.get("tokens"),i=a[e];a[e]={...i?.baseUrl?{baseUrl:i.baseUrl}:{},...i?.activityLogBaseUrl?{activityLogBaseUrl:i.activityLogBaseUrl}:{},...t,createdAt:new Date().toISOString()},p.set("tokens",a)},h=e=>{var t=p.get("tokens");delete t[e],p.set("tokens",t)},v=null,g=e=>{v=e},y=()=>v||process.env.BRICKS_PROFILE||p.get("currentProfile"),D=()=>v?"override":process.env.BRICKS_PROFILE?"env":"config",b=e=>p.set("currentProfile",e),x=()=>{var e=p.get("tokens"),t=p.get("currentProfile");return Object.keys(e).map(a=>({...e[a],name:a,current:a===t}))},_=()=>{var e=y(),t=p.get("tokens");return t[e]?.activityLogBaseUrl||p.get("activityLogBaseUrl")},w=(e,t)=>{if(!t)return void p.set("activityLogBaseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].activityLogBaseUrl=e,p.set("tokens",a)},E=()=>{p.clear()};let F=p},75646(e,t,a){a.r(t),a.d(t,{discoverDevToolsServers:()=>d,httpProbeSubnet:()=>u,verifyDevToolsServer:()=>c});var i,n,r=a(99436),o=a(41314),s=a(48161),p="bricks-devtools",l=()=>{var e=[];for(var t of Object.values(s.networkInterfaces()))for(var a of t)if(function(){if("IPv4"!==a.family||a.internal)return 1;var t=a.address.split(".").map(Number),i=a.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~i[t]).toString()).join(".");e.push({address:a.address,broadcast:n})}())continue;return e},d=({timeout:e=3e3,idleTimeout:t=0}={})=>new Promise((a,i)=>{var n=new Map,r=o.createSocket("udp4"),s=null,d=null,u=!1,c=()=>{if(!u){u=!0,clearTimeout(s),clearTimeout(d);try{r.close()}catch{}a([...n.values()])}};r.on("error",e=>{if(!u){u=!0,clearTimeout(s),clearTimeout(d);try{r.close()}catch{}i(e)}}),r.on("message",(e,a)=>{try{var i=JSON.parse(e.toString());if(i.s!==p||"ANNOUNCE"!==i.t&&"RESPONSE"!==i.t)return;var r=i.d?.info;if(!r)return;var o=a.address,s=`${o}:${r.port}`;n.has(s)||(n.set(s,{...r,address:o}),t&&!u&&(clearTimeout(d),d=setTimeout(c,t)))}catch{}}),r.bind(()=>{r.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:p,d:{id:`cli-${Math.random().toString(36).substring(2,9)}`}})),a=new Set(["255.255.255.255","127.0.0.1"]);for(var i of l())a.add(i.broadcast);for(var n of a)r.send(t,0,t.length,19900,n);s=setTimeout(c,e)})}),u=(i=r(function*({port:e=19851,connectTimeout:t=500,concurrency:a=50,timeout:i=0}={}){var n=l();if(0===n.length)return[];var o=[],s=i>0?Date.now()+i:0,p=[],d=new Set;for(var u of n){var m=u.address.split(".").slice(0,3).join(".");if(!d.has(m)){d.add(m);for(var f=1;f<255;f++)p.push(`${m}.${f}`)}}for(var h=0;h<p.length&&!(s&&Date.now()>=s);h+=a){var v=p.slice(h,h+a);yield Promise.allSettled(v.map(function(){var a=r(function*(a){var i=yield c(a,e,t);i&&o.push({...i,address:a,port:e})});return function(e){return a.apply(this,arguments)}}()))}return o}),function(){return i.apply(this,arguments)}),c=(n=r(function*(e,t,a=3e3){try{var i=new AbortController,n=setTimeout(()=>i.abort(),a),r=yield fetch(`http://${e}:${t}/devtools/info`,{signal:i.signal});if(clearTimeout(n),!r.ok)return null;return yield r.json()}catch{return null}}),function(e,t){return n.apply(this,arguments)})},74049(e,t,a){a.d(t,{K:()=>r});var i=a(79896),n=a(16928),r=e=>{if(e.endsWith(".json")||e.includes("/")){if(!i.existsSync(e))throw Error(`Config file not found: ${e}`);var t=i.readFileSync(e,"utf-8");return{config:t,source:{type:"file",path:n.resolve(e)},sizeBytes:Buffer.byteLength(t)}}return{config:e,source:{type:"inline"},sizeBytes:Buffer.byteLength(e)}}},68168(e,t,a){a.d(t,{K:()=>o,Y:()=>s});var i,n=a(99436),r=e=>String(e||"").trim().toLowerCase(),o=({resource:e,query:t,items:a,fields:i,selectedBy:n=null})=>{var o=r(t),s=a.filter(e=>i.some(t=>r(t.split(".").reduce((e,t)=>e?.[t],e)??null)===o)),p=null,l=n;return"id"===n?p=a[0]||null:1===s.length?(p=s[0],l="exact"):1===a.length&&(p=a[0],l="single"),{resource:e,query:t,exactMatchCount:s.length,matchCount:a.length,selectedBy:l,ambiguous:a.length>1&&!p,resolved:p,matches:a}},s=(i=n(function*(e){try{return yield e()}catch(e){if(/not found/i.test(e.message))return null;throw e}}),function(e){return i.apply(this,arguments)})},60450(e,t,a){a.d(t,{Gu:()=>m,he:()=>h,wR:()=>u});var i,n,r,o=a(99436),s=a(79657),p=a(73024),l=a(76760),d=a(48161),u=e=>e?.media_resource?.enable_media_workspace===!0,c=(i=o(function*(e,t,a){var i=yield e.mediaFiles({boxId:t,userTags:[`bricks_screenshot_${a}`],limit:1});return i?.[0]||null}),function(e,t,a){return i.apply(this,arguments)}),m=(e,{preferThumbnail:t=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var a=e.meta,i=a.storageEndpoint,n=a.originalFileKey,r=(t?(e=>{var t=e?.meta;if(!t)return null;if("Video"===e.fileType&&t.videoThumbOriginalFileKey)return t.videoThumbOriginalFileKey;var a=t.imageVersions||[];if(!Array.isArray(a)||0===a.length)return null;var i=a.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,t)=>e.width-t.width);return(i[0]||a[0])?.key||null})(e):null)||n;return r?`${i}/${r}`:null},f=(n=o(function*(e,t=null){var a=yield(0,s.Ay)(e);if(!a.ok)throw Error(`Failed to download screenshot: ${a.statusText}`);var i=yield a.buffer(),n=t||l.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),r=l.dirname(n);return p.existsSync(r)||p.mkdirSync(r,{recursive:!0}),p.writeFileSync(n,i),n}),function(e){return n.apply(this,arguments)}),h=(r=o(function*(e,t,a,i=null,n={}){var r=u(t)&&t.media_resource?.system_media_box_id||null;if(!r)return{error:"Media workspace not enabled for this workspace"};var o=yield c(e,r,a);if(!o)return{error:"No screenshot available for this device"};var s=m(o,n);return s?{path:yield f(s,i),file:o,url:s}:{error:"Could not build screenshot URL"}}),function(e,t,a){return r.apply(this,arguments)})},44618(e,t,a){a.d(t,{V:()=>r});var i={S:"Subspace",B:"Brick",C:"Canvas",A:"Animation",G:"Generator",D:"Data",F:"Data Calc",N:"Calc Node",T:"Test",TC:"Test Case",AT:"Automation Map"},n=e=>e?.split("_")?.[0]||"",r=(e,{keyword:t,types:a}={})=>{var r=t?.trim().toLowerCase()||"",o=a?.length>0?new Set(a.flatMap(e=>{var t=String(e).trim().toUpperCase();return t?[t]:[]})):null;return Object.entries(Object.entries(e||{}).filter(([,e])=>e&&!e.hide).filter(([e,t])=>{var a=n(e);if(o&&!o.has(a))return!1;if(!r)return!0;var i=t?.title?String(t.title).toLowerCase():"";return e.toLowerCase().includes(r)||i.includes(r)}).reduce((e,[t,a])=>{var i=n(t);return e[i]||(e[i]=[]),e[i].push({shortId:t,ref:a}),e},{})).map(([e,t])=>({prefix:e,label:i[e]||e,refs:t.sort((e,t)=>{var a=e.ref?.title||e.shortId,i=t.ref?.title||t.shortId;return String(a).localeCompare(String(i))})})).sort((e,t)=>e.label.localeCompare(t.label))}},94979(e,t,a){a.d(t,{p:()=>r});var i=/^(\d+)(s|m|h|d|w)$/,n={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function r(e){var t=e.match(i);if(t){var a=parseInt(t[1],10),r=n[t[2]];return new Date(Date.now()-a*r).toISOString()}var o=new Date(e);if(isNaN(o.getTime()))throw Error(`Invalid time format: "${e}". Use ISO 8601 or relative (e.g. 1h, 30m, 2d)`);return o.toISOString()}},98593(e,t,a){a.d(t,{Iy:()=>r,S5:()=>s,yd:()=>p});var i=a(73284),n=a(7586),r=(e,t,a)=>({label:e,ok:t,detail:a}),o=e=>null==e?i.Ay.gray("N/A"):"object"==typeof e?i.Ay.gray(JSON.stringify(e,null,2)):String(e),s=({action:e,target:t,request:a,checks:r=[],json:s=!1})=>{s?(0,n.GF)({ok:!0,dryRun:!0,action:e,target:t||null,request:a||null,checks:r}):(console.log(i.Ay.bold(`
|
|
900
|
+
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>F});var n,r=a(99436),o=a(35679),s=a(73284),p=a(23258),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(71335),g=a(429),y=a(80274),D=a(42400),b=a(98247),x=a(11405),_=a(86141),w=a(59845),E=e([D]);D=(E.then?(await E)():E)[0];var F=(n=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,p.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),o.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.25.0-beta.14","-v, --version","output the version number").enablePositionalOptions(),o.DM.addCommand(d.s),o.DM.addCommand(u._),o.DM.addCommand(c.B),o.DM.addCommand(m.A),o.DM.addCommand(f.p),o.DM.addCommand(h.u),o.DM.addCommand(v.oT),o.DM.addCommand(g.K),o.DM.addCommand(y.g),o.DM.addCommand(D.D),o.DM.addCommand(b.v),o.DM.addCommand(x.l),o.DM.addCommand(_.D),o.DM.addCommand(w.Q),o.DM.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(r(function*(){try{var e=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield e()}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),o.DM.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action((e=r(function*(e){var t=yield Promise.resolve().then(a.bind(a,23258)),i=t.getToken,n=t.getBaseUrl,r=t.getCurrentProfile,o=(yield Promise.resolve().then(a.bind(a,85382))).createClient,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=r(),d=i(l);d||(console.error(s.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var u=p("Fetching workspace info...").start();try{var c=o(n(),d),m=yield c.workspace();if(u.stop(),e.json)return void console.log(JSON.stringify(m,null,2));console.log(s.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${s.Ay.green(m.name)}`),console.log(`ID: ${s.Ay.gray(m._id)}`),console.log(`Description: ${m.description||s.Ay.gray("N/A")}`),console.log(`
|
|
901
|
+
${s.Ay.bold("Data")}`),console.log(`Remote Update: ${m.bank?.enable_remote_update?s.Ay.green("Enabled"):s.Ay.gray("Disabled")}`),console.log(`Spacename: ${m.bank?.spacename||s.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){u.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}}),function(t){return e.apply(this,arguments)})),o.DM.on("--help",()=>{console.log(""),console.log(s.Ay.bold("Examples:")),console.log(""),console.log(s.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(s.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(s.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(s.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(s.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(s.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(s.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(s.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(s.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(s.Ay.cyan(" https://control.bricks.tools")),console.log(s.Ay.gray(" Go to Workspace Settings > API Token"))});var i=process.argv.slice(2);if(0===i.length){if((0,l.b)(i))try{var n=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield n();return}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}console.error(s.Ay.gray("No command provided. Interactive mode requires a TTY, so showing help instead.\n")),o.DM.outputHelp();return}yield o.DM.parseAsync(process.argv)}),function(){return n.apply(this,arguments)});let C=F;i()}catch(e){i(e)}})},56493(e,t,a){a.d(t,{o:()=>o});var i=a(73284),n=a(23258),r=a(85382),o=()=>{var e=(0,n.getCurrentProfile)(),t=(0,n.getToken)(e);return t||(console.error(i.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,r.createClient)((0,n.getBaseUrl)(),t)}},7586(e,t,a){a.d(t,{$l:()=>r,GF:()=>i,OW:()=>n});var i=e=>{console.log(JSON.stringify(e,null,2))},n=(e,t={})=>{console.error(JSON.stringify({ok:!1,error:{message:e,...t}},null,2))},r=(e,t=4)=>e?e.length<=2*t?"*".repeat(e.length):`${e.slice(0,t)}…${e.slice(-t)}`:null},8479(e,t,a){a.d(t,{b:()=>n,z:()=>i});var i=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&"function"==typeof process.stdin.setRawMode),n=(e=[])=>0===e.length&&i()},23258(e,t,i){i.r(t),i.d(t,{setActivityLogBaseUrl:()=>w,listProfiles:()=>x,removeToken:()=>h,setBaseUrl:()=>d,setProfileOverride:()=>g,getBaseUrl:()=>l,CONFIG_PATH:()=>s,CONFIG_DIR:()=>o,getCurrentProfileSource:()=>D,default:()=>F,getToken:()=>c,clearConfig:()=>E,getTokens:()=>u,getActivityLogBaseUrl:()=>_,getTokenInfo:()=>m,setCurrentProfile:()=>b,getCurrentProfile:()=>y,setToken:()=>f});var n=i(16928),r=i(70857),o=n.join(r.homedir(),".bricks-cli"),s=n.join(o,"config.json"),p=new a({projectName:"bricks-cli",cwd:o,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},createdAt:{type:"string"},baseUrl:{type:"string"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"}}}),l=()=>{var e=y(),t=p.get("tokens");return t[e]?.baseUrl||p.get("baseUrl")},d=(e,t)=>{if(!t)return void p.set("baseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].baseUrl=e,p.set("tokens",a)},u=()=>p.get("tokens"),c=(e="default")=>{var t=p.get("tokens");return t[e]?.token},m=(e="default")=>p.get("tokens")[e],f=(e,t)=>{var a=p.get("tokens"),i=a[e];a[e]={...i?.baseUrl?{baseUrl:i.baseUrl}:{},...i?.activityLogBaseUrl?{activityLogBaseUrl:i.activityLogBaseUrl}:{},...t,createdAt:new Date().toISOString()},p.set("tokens",a)},h=e=>{var t=p.get("tokens");delete t[e],p.set("tokens",t)},v=null,g=e=>{v=e},y=()=>v||process.env.BRICKS_PROFILE||p.get("currentProfile"),D=()=>v?"override":process.env.BRICKS_PROFILE?"env":"config",b=e=>p.set("currentProfile",e),x=()=>{var e=p.get("tokens"),t=p.get("currentProfile");return Object.keys(e).map(a=>({...e[a],name:a,current:a===t}))},_=()=>{var e=y(),t=p.get("tokens");return t[e]?.activityLogBaseUrl||p.get("activityLogBaseUrl")},w=(e,t)=>{if(!t)return void p.set("activityLogBaseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].activityLogBaseUrl=e,p.set("tokens",a)},E=()=>{p.clear()};let F=p},75646(e,t,a){a.r(t),a.d(t,{discoverDevToolsServers:()=>d,httpProbeSubnet:()=>u,verifyDevToolsServer:()=>c});var i,n,r=a(99436),o=a(41314),s=a(48161),p="bricks-devtools",l=()=>{var e=[];for(var t of Object.values(s.networkInterfaces()))for(var a of t)if(function(){if("IPv4"!==a.family||a.internal)return 1;var t=a.address.split(".").map(Number),i=a.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~i[t]).toString()).join(".");e.push({address:a.address,broadcast:n})}())continue;return e},d=({timeout:e=3e3,idleTimeout:t=0}={})=>new Promise((a,i)=>{var n=new Map,r=o.createSocket("udp4"),s=null,d=null,u=!1,c=()=>{if(!u){u=!0,clearTimeout(s),clearTimeout(d);try{r.close()}catch{}a([...n.values()])}};r.on("error",e=>{if(!u){u=!0,clearTimeout(s),clearTimeout(d);try{r.close()}catch{}i(e)}}),r.on("message",(e,a)=>{try{var i=JSON.parse(e.toString());if(i.s!==p||"ANNOUNCE"!==i.t&&"RESPONSE"!==i.t)return;var r=i.d?.info;if(!r)return;var o=a.address,s=`${o}:${r.port}`;n.has(s)||(n.set(s,{...r,address:o}),t&&!u&&(clearTimeout(d),d=setTimeout(c,t)))}catch{}}),r.bind(()=>{r.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:p,d:{id:`cli-${Math.random().toString(36).substring(2,9)}`}})),a=new Set(["255.255.255.255","127.0.0.1"]);for(var i of l())a.add(i.broadcast);for(var n of a)r.send(t,0,t.length,19900,n);s=setTimeout(c,e)})}),u=(i=r(function*({port:e=19851,connectTimeout:t=500,concurrency:a=50,timeout:i=0}={}){var n=l();if(0===n.length)return[];var o=[],s=i>0?Date.now()+i:0,p=[],d=new Set;for(var u of n){var m=u.address.split(".").slice(0,3).join(".");if(!d.has(m)){d.add(m);for(var f=1;f<255;f++)p.push(`${m}.${f}`)}}for(var h=0;h<p.length&&!(s&&Date.now()>=s);h+=a){var v=p.slice(h,h+a);yield Promise.allSettled(v.map(function(){var a=r(function*(a){var i=yield c(a,e,t);i&&o.push({...i,address:a,port:e})});return function(e){return a.apply(this,arguments)}}()))}return o}),function(){return i.apply(this,arguments)}),c=(n=r(function*(e,t,a=3e3){try{var i=new AbortController,n=setTimeout(()=>i.abort(),a),r=yield fetch(`http://${e}:${t}/devtools/info`,{signal:i.signal});if(clearTimeout(n),!r.ok)return null;return yield r.json()}catch{return null}}),function(e,t){return n.apply(this,arguments)})},74049(e,t,a){a.d(t,{Ku:()=>s,w9:()=>o});var i=a(79896),n=a(16928),r=new Set(["CTOR","CTOR Desktop"]),o=e=>{var t,a=`Release by ${(t=process.env.BRICKS_RELEASE_SIGN)&&r.has(t)?t:"BRICKS CLI"}`;return e?`${e}
|
|
902
|
+
|
|
903
|
+
${a}`:a},s=e=>{if(e.endsWith(".json")||e.includes("/")){if(!i.existsSync(e))throw Error(`Config file not found: ${e}`);var t=i.readFileSync(e,"utf-8");return{config:t,source:{type:"file",path:n.resolve(e)},sizeBytes:Buffer.byteLength(t)}}return{config:e,source:{type:"inline"},sizeBytes:Buffer.byteLength(e)}}},68168(e,t,a){a.d(t,{K:()=>o,Y:()=>s});var i,n=a(99436),r=e=>String(e||"").trim().toLowerCase(),o=({resource:e,query:t,items:a,fields:i,selectedBy:n=null})=>{var o=r(t),s=a.filter(e=>i.some(t=>r(t.split(".").reduce((e,t)=>e?.[t],e)??null)===o)),p=null,l=n;return"id"===n?p=a[0]||null:1===s.length?(p=s[0],l="exact"):1===a.length&&(p=a[0],l="single"),{resource:e,query:t,exactMatchCount:s.length,matchCount:a.length,selectedBy:l,ambiguous:a.length>1&&!p,resolved:p,matches:a}},s=(i=n(function*(e){try{return yield e()}catch(e){if(/not found/i.test(e.message))return null;throw e}}),function(e){return i.apply(this,arguments)})},60450(e,t,a){a.d(t,{Gu:()=>m,he:()=>h,wR:()=>u});var i,n,r,o=a(99436),s=a(79657),p=a(73024),l=a(76760),d=a(48161),u=e=>e?.media_resource?.enable_media_workspace===!0,c=(i=o(function*(e,t,a){var i=yield e.mediaFiles({boxId:t,userTags:[`bricks_screenshot_${a}`],limit:1});return i?.[0]||null}),function(e,t,a){return i.apply(this,arguments)}),m=(e,{preferThumbnail:t=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var a=e.meta,i=a.storageEndpoint,n=a.originalFileKey,r=(t?(e=>{var t=e?.meta;if(!t)return null;if("Video"===e.fileType&&t.videoThumbOriginalFileKey)return t.videoThumbOriginalFileKey;var a=t.imageVersions||[];if(!Array.isArray(a)||0===a.length)return null;var i=a.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,t)=>e.width-t.width);return(i[0]||a[0])?.key||null})(e):null)||n;return r?`${i}/${r}`:null},f=(n=o(function*(e,t=null){var a=yield(0,s.Ay)(e);if(!a.ok)throw Error(`Failed to download screenshot: ${a.statusText}`);var i=yield a.buffer(),n=t||l.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),r=l.dirname(n);return p.existsSync(r)||p.mkdirSync(r,{recursive:!0}),p.writeFileSync(n,i),n}),function(e){return n.apply(this,arguments)}),h=(r=o(function*(e,t,a,i=null,n={}){var r=u(t)&&t.media_resource?.system_media_box_id||null;if(!r)return{error:"Media workspace not enabled for this workspace"};var o=yield c(e,r,a);if(!o)return{error:"No screenshot available for this device"};var s=m(o,n);return s?{path:yield f(s,i),file:o,url:s}:{error:"Could not build screenshot URL"}}),function(e,t,a){return r.apply(this,arguments)})},44618(e,t,a){a.d(t,{V:()=>r});var i={S:"Subspace",B:"Brick",C:"Canvas",A:"Animation",G:"Generator",D:"Data",F:"Data Calc",N:"Calc Node",T:"Test",TC:"Test Case",AT:"Automation Map"},n=e=>e?.split("_")?.[0]||"",r=(e,{keyword:t,types:a}={})=>{var r=t?.trim().toLowerCase()||"",o=a?.length>0?new Set(a.flatMap(e=>{var t=String(e).trim().toUpperCase();return t?[t]:[]})):null;return Object.entries(Object.entries(e||{}).filter(([,e])=>e&&!e.hide).filter(([e,t])=>{var a=n(e);if(o&&!o.has(a))return!1;if(!r)return!0;var i=t?.title?String(t.title).toLowerCase():"";return e.toLowerCase().includes(r)||i.includes(r)}).reduce((e,[t,a])=>{var i=n(t);return e[i]||(e[i]=[]),e[i].push({shortId:t,ref:a}),e},{})).map(([e,t])=>({prefix:e,label:i[e]||e,refs:t.sort((e,t)=>{var a=e.ref?.title||e.shortId,i=t.ref?.title||t.shortId;return String(a).localeCompare(String(i))})})).sort((e,t)=>e.label.localeCompare(t.label))}},94979(e,t,a){a.d(t,{p:()=>r});var i=/^(\d+)(s|m|h|d|w)$/,n={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function r(e){var t=e.match(i);if(t){var a=parseInt(t[1],10),r=n[t[2]];return new Date(Date.now()-a*r).toISOString()}var o=new Date(e);if(isNaN(o.getTime()))throw Error(`Invalid time format: "${e}". Use ISO 8601 or relative (e.g. 1h, 30m, 2d)`);return o.toISOString()}},98593(e,t,a){a.d(t,{Iy:()=>r,S5:()=>s,yd:()=>p});var i=a(73284),n=a(7586),r=(e,t,a)=>({label:e,ok:t,detail:a}),o=e=>null==e?i.Ay.gray("N/A"):"object"==typeof e?i.Ay.gray(JSON.stringify(e,null,2)):String(e),s=({action:e,target:t,request:a,checks:r=[],json:s=!1})=>{s?(0,n.GF)({ok:!0,dryRun:!0,action:e,target:t||null,request:a||null,checks:r}):(console.log(i.Ay.bold(`
|
|
906
904
|
Dry Run: ${e}`)),console.log("─".repeat(60)),t&&(console.log(i.Ay.bold("Target")),Object.entries(t).forEach(([e,t])=>{console.log(`${e}: ${o(t)}`)})),a&&(console.log(`
|
|
907
905
|
${i.Ay.bold("Request")}`),Object.entries(a).forEach(([e,t])=>{console.log(`${e}: ${o(t)}`)})),r.length>0&&(console.log(`
|
|
908
906
|
${i.Ay.bold("Checks")}`),r.forEach(e=>{var t=e.ok?i.Ay.green("OK"):i.Ay.red("FAIL"),a=e.detail?` ${e.detail}`:"";console.log(`${t} ${e.label}${a}`)})),console.log("─".repeat(60)))},p=({action:e,target:t,result:a=null,json:i=!1,message:r})=>{i?(0,n.GF)({ok:!0,dryRun:!1,action:e,target:t||null,result:a}):r&&console.log(r)}},73284(e,t,a){let i;a.d(t,{Ay:()=>S});let n=(e=0)=>t=>`\u001B[${t+e}m`,r=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,o=(e=0)=>(t,a,i)=>`\u001B[${38+e};2;${t};${a};${i}m`,s={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(s.modifier),[...Object.keys(s.color),...Object.keys(s.bgColor)];let p=function(){let e=new Map;for(let[t,a]of Object.entries(s)){for(let[t,i]of Object.entries(a))s[t]={open:`\u001B[${i[0]}m`,close:`\u001B[${i[1]}m`},a[t]=s[t],e.set(i[0],i[1]);Object.defineProperty(s,t,{value:a,enumerable:!1})}return Object.defineProperty(s,"codes",{value:e,enumerable:!1}),s.color.close="\x1b[39m",s.bgColor.close="\x1b[49m",s.color.ansi=n(),s.color.ansi256=r(),s.color.ansi16m=o(),s.bgColor.ansi=n(10),s.bgColor.ansi256=r(10),s.bgColor.ansi16m=o(10),Object.defineProperties(s,{rgbToAnsi256:{value:(e,t,a)=>e===t&&t===a?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(a/255*5),enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[a]=t;3===a.length&&(a=[...a].map(e=>e+e).join(""));let i=Number.parseInt(a,16);return[i>>16&255,i>>8&255,255&i]},enumerable:!1},hexToAnsi256:{value:e=>s.rgbToAnsi256(...s.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){let t,a,i;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)a=t=((e-232)*10+8)/255,i=t;else{let n=(e-=16)%36;t=Math.floor(e/36)/5,a=Math.floor(n/6)/5,i=n%6/5}let n=2*Math.max(t,a,i);if(0===n)return 30;let r=30+(Math.round(i)<<2|Math.round(a)<<1|Math.round(t));return 2===n&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(e,t,a)=>s.ansi256ToAnsi(s.rgbToAnsi256(e,t,a)),enumerable:!1},hexToAnsi:{value:e=>s.ansi256ToAnsi(s.hexToAnsi256(e)),enumerable:!1}}),s}();var l=a(1708),d=a(48161),u=a(7066);function c(e,t=globalThis.Deno?globalThis.Deno.args:l.argv){let a=e.startsWith("-")?"":1===e.length?"-":"--",i=t.indexOf(a+e),n=t.indexOf("--");return -1!==i&&(-1===n||i<n)}let{env:m}=l;function f(e,t={}){var a;return 0!==(a=function(e,{streamIsTTY:t,sniffFlags:a=!0}={}){let n=function(){if("FORCE_COLOR"in m)return"true"===m.FORCE_COLOR?1:"false"===m.FORCE_COLOR?0:0===m.FORCE_COLOR.length?1:Math.min(Number.parseInt(m.FORCE_COLOR,10),3)}();void 0!==n&&(i=n);let r=a?i:n;if(0===r)return 0;if(a){if(c("color=16m")||c("color=full")||c("color=truecolor"))return 3;if(c("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(e&&!t&&void 0===r)return 0;let o=r||0;if("dumb"===m.TERM)return o;if("win32"===l.platform){let e=d.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in m)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in m)||"codeship"===m.CI_NAME?1:o;if("TEAMCITY_VERSION"in m)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION);if("truecolor"===m.COLORTERM||"xterm-kitty"===m.TERM||"xterm-ghostty"===m.TERM||"wezterm"===m.TERM)return 3;if("TERM_PROGRAM"in m){let e=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:o}(e,{streamIsTTY:e&&e.isTTY,...t}))&&{level:a,hasBasic:!0,has256:a>=2,has16m:a>=3}}c("no-color")||c("no-colors")||c("color=false")||c("color=never")?i=0:(c("color")||c("colors")||c("color=true")||c("color=always"))&&(i=1);let{stdout:h,stderr:v}={stdout:f({isTTY:u.isatty(1)}),stderr:f({isTTY:u.isatty(2)})},g=Symbol("GENERATOR"),y=Symbol("STYLER"),D=Symbol("IS_EMPTY"),b=["ansi","ansi","ansi256","ansi16m"],x=Object.create(null);function _(e){let t;return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let a=h?h.level:0;e.level=void 0===t.level?a:t.level})(t=(...e)=>e.join(" "),e),Object.setPrototypeOf(t,_.prototype),t}for(let[e,t]of(Object.setPrototypeOf(_.prototype,Function.prototype),Object.entries(p)))x[e]={get(){let a=C(this,F(t.open,t.close,this[y]),this[D]);return Object.defineProperty(this,e,{value:a}),a}};x.visible={get(){let e=C(this,this[y],!0);return Object.defineProperty(this,"visible",{value:e}),e}};let w=(e,t,a,...i)=>"rgb"===e?"ansi16m"===t?p[a].ansi16m(...i):"ansi256"===t?p[a].ansi256(p.rgbToAnsi256(...i)):p[a].ansi(p.rgbToAnsi(...i)):"hex"===e?w("rgb",t,a,...p.hexToRgb(...i)):p[a][e](...i);for(let e of["rgb","hex","ansi256"])x[e]={get(){let{level:t}=this;return function(...a){return C(this,F(w(e,b[t],"color",...a),p.color.close,this[y]),this[D])}}},x["bg"+e[0].toUpperCase()+e.slice(1)]={get(){let{level:t}=this;return function(...a){return C(this,F(w(e,b[t],"bgColor",...a),p.bgColor.close,this[y]),this[D])}}};let E=Object.defineProperties(()=>{},{...x,level:{enumerable:!0,get(){return this[g].level},set(e){this[g].level=e}}}),F=(e,t,a)=>{let i,n;return void 0===a?(i=e,n=t):(i=a.openAll+e,n=t+a.closeAll),{open:e,close:t,openAll:i,closeAll:n,parent:a}},C=(e,t,a)=>{let i=(...e)=>T(i,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(i,E),i[g]=e,i[y]=t,i[D]=a,i},T=(e,t)=>{if(e.level<=0||!t)return e[D]?"":t;let a=e[y];if(void 0===a)return t;let{openAll:i,closeAll:n}=a;if(t.includes("\x1b"))for(;void 0!==a;)t=function(e,t,a){let i=e.indexOf(t);if(-1===i)return e;let n=t.length,r=0,o="";do o+=e.slice(r,i)+t+a,r=i+n,i=e.indexOf(t,r);while(-1!==i);return o+e.slice(r)}(t,a.close,a.open),a=a.parent;let r=t.indexOf("\n");return -1!==r&&(t=function(e,t,a,i){let n=0,r="";do{let o="\r"===e[i-1];r+=e.slice(n,o?i-1:i)+t+(o?"\r\n":"\n")+a,n=i+1,i=e.indexOf("\n",n)}while(-1!==i);return r+e.slice(n)}(t,n,i,r)),i+t+n};Object.defineProperties(_.prototype,x);let A=_();_({level:v?v.level:0});let S=A},35679(e,t,a){a.d(t,{DM:()=>i,uB:()=>d});let{DM:i,gu:n,er:r,Ww:o,b7:s,Di:p,a2:l,uB:d,ef:u,c$:c,_V:m}=a(65181)},48255(e,t,a){a.d(t,{Wk:()=>l,eO:()=>o,yJ:()=>p});var i=a(91070),n=a(73971),r=a(8238);class o extends Error{constructor(e,...t){var a,r,p;let l,{nodes:d,source:u,positions:c,path:m,originalError:f,extensions:h}=null==(l=t[0])||"kind"in l||"length"in l?{nodes:l,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:l;super(e),this.name="GraphQLError",this.path=null!=m?m:void 0,this.originalError=null!=f?f:void 0,this.nodes=s(Array.isArray(d)?d:d?[d]:void 0);let v=s(null==(a=this.nodes)?void 0:a.map(e=>e.loc).filter(e=>null!=e));this.source=null!=u?u:null==v||null==(r=v[0])?void 0:r.source,this.positions=null!=c?c:null==v?void 0:v.map(e=>e.start),this.locations=c&&u?c.map(e=>(0,n.g)(u,e)):null==v?void 0:v.map(e=>(0,n.g)(e.source,e.start));let g=(0,i.Z)(null==f?void 0:f.extensions)?null==f?void 0:f.extensions:void 0;this.extensions=null!=(p=null!=h?h:g)?p:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=f&&f.stack?Object.defineProperty(this,"stack",{value:f.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,o):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(let t of this.nodes)t.loc&&(e+="\n\n"+(0,r.V)(t.loc));else if(this.source&&this.locations)for(let t of this.locations)e+="\n\n"+(0,r.C)(this.source,t);return e}toJSON(){let e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function s(e){return void 0===e||0===e.length?void 0:e}function p(e){return e.toString()}function l(e){return e.toJSON()}},59841(e,t,a){a.d(t,{I:()=>n});var i=a(48255);function n(e,t,a){return new i.eO(`Syntax Error: ${a}`,{source:e,positions:[t]})}},36869(e,t,a){let i;a.r(t),a.d(t,{VariablesAreInputTypesRule:()=>aP,SingleFieldSubscriptionsRule:()=>aw,UniqueVariableNamesRule:()=>aB,GraphQLDeprecatedDirective:()=>e7,GraphQLNonNull:()=>ef,__InputValue:()=>tm,createSourceEventStream:()=>ig,execute:()=>aZ,isDefinitionNode:()=>tV.MD,isInterfaceType:()=>z,isRequiredArgument:()=>eI,isValidNameError:()=>i0,parseValue:()=>h.$x,valueFromAST:()=>am,NoUnusedVariablesRule:()=>t1,__DirectiveLocation:()=>td,findDangerousChanges:()=>i4,__TypeKind:()=>th,isSchema:()=>tx,UniqueTypeNamesRule:()=>aj,NoSchemaIntrospectionCustomRule:()=>ib,defaultTypeResolver:()=>ia,isType:()=>P,syntaxError:()=>ix.I,version:()=>n,UniqueFragmentNamesRule:()=>aN,assertWrappingType:()=>ev,getNullableType:()=>eD,isObjectType:()=>q,visitWithTypeInfo:()=>tR,assertEnumValueName:()=>V,printSchema:()=>iP,validate:()=>aQ,BREAK:()=>tI.sP,assertNonNullType:()=>ea,assertNullableType:()=>ey,executeSync:()=>a1,isLeafType:()=>es,resolveSchemaCoordinate:()=>ne,assertOutputType:()=>eo,buildASTSchema:()=>ik,astFromValue:()=>to,Kind:()=>I.b,ProvidedRequiredArgumentsRule:()=>an,UniqueDirectiveNamesRule:()=>aT,KnownDirectivesRule:()=>tG,DEFAULT_DEPRECATION_REASON:()=>e9,TypeKind:()=>d,assertInterfaceType:()=>Y,isValueNode:()=>tV.aR,GraphQLSpecifiedByDirective:()=>te,GraphQLFloat:()=>eW,UniqueFieldDefinitionNamesRule:()=>aO,LoneAnonymousOperationRule:()=>tJ,VariablesInAllowedPositionRule:()=>aL,assertInputType:()=>en,formatError:()=>g.Wk,assertInputObjectType:()=>X,isOutputType:()=>er,isWrappingType:()=>eh,assertLeafType:()=>ep,assertValidSchema:()=>tC,FragmentsOnCompositeTypesRule:()=>tM,graphql:()=>io,UniqueOperationTypesRule:()=>a$,parseSchemaCoordinate:()=>h.Ng,UniqueEnumValueNamesRule:()=>aS,isNonNullType:()=>et,isSelectionNode:()=>tV.VK,printError:()=>g.yJ,specifiedDirectives:()=>ta,visit:()=>tI.YR,GraphQLScalarType:()=>eF,assertEnumType:()=>W,UniqueDirectivesPerLocationRule:()=>aA,assertName:()=>R,getDirectiveValues:()=>ag,isConstValueNode:()=>tV.TZ,isEqualType:()=>eq,isNamedType:()=>eb,isTypeDefinitionNode:()=>tV.a6,validateSchema:()=>tF,parse:()=>h.qg,__Schema:()=>tp,isTypeSystemDefinitionNode:()=>tV.xu,valueFromASTUntyped:()=>j,LoneSchemaDefinitionRule:()=>tH,isTypeSubTypeOf:()=>eG,UniqueArgumentNamesRule:()=>aC,UniqueInputFieldNamesRule:()=>ak,locatedError:()=>aK,typeFromAST:()=>t$,printLocation:()=>iu.V,assertUnionType:()=>J,separateOperations:()=>iX,getVariableValues:()=>ah,Location:()=>y.aZ,GraphQLObjectType:()=>eC,UniqueArgumentDefinitionNamesRule:()=>aF,stripIgnoredCharacters:()=>i1,GRAPHQL_MAX_INT:()=>eQ,visitInParallel:()=>tI.oP,parseType:()=>h.Mb,isTypeNode:()=>tV.dI,PossibleTypeExtensionsRule:()=>aa,graphqlSync:()=>is,isSchemaCoordinateNode:()=>tV.gj,DirectiveLocation:()=>eY.H,TypeNameMetaFieldDef:()=>ty,coerceInputValue:()=>au,GraphQLInt:()=>eH,resolveObjMapThunk:()=>eE,GraphQLInterfaceType:()=>e$,UniqueOperationNamesRule:()=>aI,GraphQLSkipDirective:()=>e5,isEnumType:()=>H,assertValidName:()=>i2,buildClientSchema:()=>iC,KnownArgumentNamesRule:()=>tU,ValuesOfCorrectTypeRule:()=>aR,isInputObjectType:()=>K,GraphQLID:()=>eZ,NoUnusedFragmentsRule:()=>tZ,isUnionType:()=>Q,isSpecifiedScalarType:()=>e2,getArgumentValues:()=>av,printSourceLocation:()=>iu.C,__EnumValue:()=>tf,getOperationAST:()=>iw,isExecutableDefinitionNode:()=>tV._m,isAbstractType:()=>eu,assertAbstractType:()=>ec,isTypeExtensionNode:()=>tV.i7,GraphQLInputObjectType:()=>eL,getNamedType:()=>e_,parseConstValue:()=>h.u8,KnownFragmentNamesRule:()=>tz,isListType:()=>Z,Lexer:()=>ic.JG,isSpecifiedDirective:()=>ti,responsePathAsArray:()=>ad,isDirective:()=>e6,TypeInfo:()=>tj,assertScalarType:()=>U,extendSchema:()=>iT,isIntrospectionType:()=>tb,print:()=>$.y,getIntrospectionQuery:()=>i_,GraphQLBoolean:()=>eX,KnownTypeNamesRule:()=>tY,assertListType:()=>ee,concatAST:()=>iK,NoDeprecatedCustomRule:()=>iD,defaultFieldResolver:()=>ii,GraphQLDirective:()=>e3,getLocation:()=>id.g,TypeMetaFieldDef:()=>tg,GRAPHQL_MIN_INT:()=>eJ,GraphQLIncludeDirective:()=>e8,ScalarLeafsRule:()=>as,assertSchema:()=>t_,lexicographicSortSchema:()=>i$,GraphQLList:()=>em,isTypeSystemExtensionNode:()=>tV.fT,specifiedScalarTypes:()=>e1,BreakingChangeType:()=>u,ExecutableDefinitionsRule:()=>tP,assertDirective:()=>e4,__Field:()=>tc,getVisitFn:()=>tI.UY,recommendedRules:()=>aM,SchemaMetaFieldDef:()=>tv,assertCompositeType:()=>ed,isRequiredInputField:()=>eU,Token:()=>y.ou,specifiedRules:()=>aU,DangerousChangeType:()=>c,GraphQLUnionType:()=>ej,isCompositeType:()=>el,versionInfo:()=>r,FieldsOnCorrectTypeRule:()=>tL,GraphQLString:()=>eK,assertType:()=>L,introspectionFromSchema:()=>iF,doTypesOverlap:()=>ez,GraphQLEnumType:()=>eR,resolveReadonlyArrayThunk:()=>ew,GraphQLOneOfDirective:()=>tt,NoFragmentCyclesRule:()=>tK,findBreakingChanges:()=>i6,ValidationContext:()=>aY,OverlappingFieldsCanBeMergedRule:()=>t0,isScalarType:()=>M,MaxIntrospectionDepthRule:()=>tW,NoUndefinedVariablesRule:()=>tX,assertObjectType:()=>G,getOperationRootType:()=>iE,printType:()=>iq,OperationTypeNode:()=>y.cE,isInputType:()=>ei,__Directive:()=>tl,GraphQLSchema:()=>tw,Source:()=>il.k,resolveASTSchemaCoordinate:()=>nt,GraphQLError:()=>g.eO,assertNamedType:()=>ex,buildSchema:()=>iI,introspectionTypes:()=>tD,PossibleFragmentSpreadsRule:()=>at,__Type:()=>tu,getEnterLeaveForKind:()=>tI.XO,TokenKind:()=>im.Y,printIntrospectionSchema:()=>iL,isNullableType:()=>eg,subscribe:()=>iv});let n="16.12.0",r=Object.freeze({major:16,minor:12,patch:0,preReleaseTag:null});var o,s,p,l,d,u,c,m=a(93217);function f(e){return"function"==typeof(null==e?void 0:e.then)}var h=a(20186),v=a(35198),g=a(48255),y=a(59762);function D(e,t){let[a,i]=t?[e,t]:[void 0,e],n=" Did you mean ";a&&(n+=a+" ");let r=i.map(e=>`"${e}"`);switch(r.length){case 0:return"";case 1:return n+r[0]+"?";case 2:return n+r[0]+" or "+r[1]+"?"}let o=r.slice(0,5),s=o.pop();return n+o.join(", ")+", or "+s+"?"}function b(e){return e}var x=a(50792),_=a(91070);function w(e,t){let a=Object.create(null);for(let i of e)a[t(i)]=i;return a}function E(e,t,a){let i=Object.create(null);for(let n of e)i[t(n)]=a(n);return i}function F(e,t){let a=Object.create(null);for(let i of Object.keys(e))a[i]=t(e[i],i);return a}function C(e,t){let a=0,i=0;for(;a<e.length&&i<t.length;){let n=e.charCodeAt(a),r=t.charCodeAt(i);if(A(n)&&A(r)){let o=0;do++a,o=10*o+n-T,n=e.charCodeAt(a);while(A(n)&&o>0);let s=0;do++i,s=10*s+r-T,r=t.charCodeAt(i);while(A(r)&&s>0);if(o<s)return -1;if(o>s)return 1}else{if(n<r)return -1;if(n>r)return 1;++a,++i}}return e.length-t.length}let T=48;function A(e){return!isNaN(e)&&T<=e&&e<=57}function S(e,t){let a=Object.create(null),i=new O(e),n=Math.floor(.4*e.length)+1;for(let e of t){let t=i.measure(e,n);void 0!==t&&(a[e]=t)}return Object.keys(a).sort((e,t)=>{let i=a[e]-a[t];return 0!==i?i:C(e,t)})}class O{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=N(this._inputLowerCase),this._rows=[Array(e.length+1).fill(0),Array(e.length+1).fill(0),Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;let a=e.toLowerCase();if(this._inputLowerCase===a)return 1;let i=N(a),n=this._inputArray;if(i.length<n.length){let e=i;i=n,n=e}let r=i.length,o=n.length;if(r-o>t)return;let s=this._rows;for(let e=0;e<=o;e++)s[0][e]=e;for(let e=1;e<=r;e++){let a=s[(e-1)%3],r=s[e%3],p=r[0]=e;for(let t=1;t<=o;t++){let o=+(i[e-1]!==n[t-1]),l=Math.min(a[t]+1,r[t-1]+1,a[t-1]+o);e>1&&t>1&&i[e-1]===n[t-2]&&i[e-2]===n[t-1]&&(l=Math.min(l,s[(e-2)%3][t-2]+1)),l<p&&(p=l),r[t]=l}if(p>t)return}let p=s[r%3][o];return p<=t?p:void 0}}function N(e){let t=e.length,a=Array(t);for(let i=0;i<t;++i)a[i]=e.charCodeAt(i);return a}function k(e){if(null==e)return Object.create(null);if(null===Object.getPrototypeOf(e))return e;let t=Object.create(null);for(let[a,i]of Object.entries(e))t[a]=i;return t}var I=a(42455),$=a(95818);function j(e,t){switch(e.kind){case I.b.NULL:return null;case I.b.INT:return parseInt(e.value,10);case I.b.FLOAT:return parseFloat(e.value);case I.b.STRING:case I.b.ENUM:case I.b.BOOLEAN:return e.value;case I.b.LIST:return e.values.map(e=>j(e,t));case I.b.OBJECT:return E(e.fields,e=>e.name.value,e=>j(e.value,t));case I.b.VARIABLE:return null==t?void 0:t[e.name.value]}}var B=a(25881);function R(e){if(null!=e||(0,m.U)(!1,"Must provide name."),"string"==typeof e||(0,m.U)(!1,"Expected name to be a string."),0===e.length)throw new g.eO("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!(0,B.xr)(e.charCodeAt(t)))throw new g.eO(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!(0,B.un)(e.charCodeAt(0)))throw new g.eO(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function V(e){if("true"===e||"false"===e||"null"===e)throw new g.eO(`Enum values cannot be named: ${e}`);return R(e)}function P(e){return M(e)||q(e)||z(e)||Q(e)||H(e)||K(e)||Z(e)||et(e)}function L(e){if(!P(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL type.`);return e}function M(e){return(0,x.h)(e,eF)}function U(e){if(!M(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Scalar type.`);return e}function q(e){return(0,x.h)(e,eC)}function G(e){if(!q(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Object type.`);return e}function z(e){return(0,x.h)(e,e$)}function Y(e){if(!z(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Interface type.`);return e}function Q(e){return(0,x.h)(e,ej)}function J(e){if(!Q(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Union type.`);return e}function H(e){return(0,x.h)(e,eR)}function W(e){if(!H(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Enum type.`);return e}function K(e){return(0,x.h)(e,eL)}function X(e){if(!K(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Input Object type.`);return e}function Z(e){return(0,x.h)(e,em)}function ee(e){if(!Z(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL List type.`);return e}function et(e){return(0,x.h)(e,ef)}function ea(e){if(!et(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL Non-Null type.`);return e}function ei(e){return M(e)||H(e)||K(e)||eh(e)&&ei(e.ofType)}function en(e){if(!ei(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL input type.`);return e}function er(e){return M(e)||q(e)||z(e)||Q(e)||H(e)||eh(e)&&er(e.ofType)}function eo(e){if(!er(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL output type.`);return e}function es(e){return M(e)||H(e)}function ep(e){if(!es(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL leaf type.`);return e}function el(e){return q(e)||z(e)||Q(e)}function ed(e){if(!el(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL composite type.`);return e}function eu(e){return z(e)||Q(e)}function ec(e){if(!eu(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL abstract type.`);return e}class em{constructor(e){P(e)||(0,m.U)(!1,`Expected ${(0,v.N)(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class ef{constructor(e){eg(e)||(0,m.U)(!1,`Expected ${(0,v.N)(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function eh(e){return Z(e)||et(e)}function ev(e){if(!eh(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL wrapping type.`);return e}function eg(e){return P(e)&&!et(e)}function ey(e){if(!eg(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL nullable type.`);return e}function eD(e){if(e)return et(e)?e.ofType:e}function eb(e){return M(e)||q(e)||z(e)||Q(e)||H(e)||K(e)}function ex(e){if(!eb(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL named type.`);return e}function e_(e){if(e){let t=e;for(;eh(t);)t=t.ofType;return t}}function ew(e){return"function"==typeof e?e():e}function eE(e){return"function"==typeof e?e():e}class eF{constructor(e){var t,a,i,n;let r=null!=(t=e.parseValue)?t:b;this.name=R(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=null!=(a=e.serialize)?a:b,this.parseValue=r,this.parseLiteral=null!=(i=e.parseLiteral)?i:(e,t)=>r(j(e,t)),this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(n=e.extensionASTNodes)?n:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||(0,m.U)(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${(0,v.N)(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||(0,m.U)(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||(0,m.U)(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class eC{constructor(e){var t;this.name=R(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(t=e.extensionASTNodes)?t:[],this._fields=()=>eA(e),this._interfaces=()=>eT(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||(0,m.U)(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${(0,v.N)(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:eN(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function eT(e){var t;let a=ew(null!=(t=e.interfaces)?t:[]);return Array.isArray(a)||(0,m.U)(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),a}function eA(e){let t=eE(e.fields);return eO(t)||(0,m.U)(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),F(t,(t,a)=>{var i;eO(t)||(0,m.U)(!1,`${e.name}.${a} field config must be an object.`),null==t.resolve||"function"==typeof t.resolve||(0,m.U)(!1,`${e.name}.${a} field resolver must be a function if provided, but got: ${(0,v.N)(t.resolve)}.`);let n=null!=(i=t.args)?i:{};return eO(n)||(0,m.U)(!1,`${e.name}.${a} args must be an object with argument names as keys.`),{name:R(a),description:t.description,type:t.type,args:eS(n),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:k(t.extensions),astNode:t.astNode}})}function eS(e){return Object.entries(e).map(([e,t])=>({name:R(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:k(t.extensions),astNode:t.astNode}))}function eO(e){return(0,_.Z)(e)&&!Array.isArray(e)}function eN(e){return F(e,e=>({description:e.description,type:e.type,args:ek(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function ek(e){return E(e,e=>e.name,e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}))}function eI(e){return et(e.type)&&void 0===e.defaultValue}class e${constructor(e){var t;this.name=R(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(t=e.extensionASTNodes)?t:[],this._fields=eA.bind(void 0,e),this._interfaces=eT.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||(0,m.U)(!1,`${this.name} must provide "resolveType" as a function, but got: ${(0,v.N)(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:eN(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class ej{constructor(e){var t;this.name=R(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(t=e.extensionASTNodes)?t:[],this._types=eB.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||(0,m.U)(!1,`${this.name} must provide "resolveType" as a function, but got: ${(0,v.N)(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function eB(e){let t=ew(e.types);return Array.isArray(t)||(0,m.U)(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),t}class eR{constructor(e){var t;this.name=R(e.name),this.description=e.description,this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(t=e.extensionASTNodes)?t:[],this._values="function"==typeof e.values?e.values:eP(this.name,e.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return"function"==typeof this._values&&(this._values=eP(this.name,this._values())),this._values}getValue(e){return null===this._nameLookup&&(this._nameLookup=w(this.getValues(),e=>e.name)),this._nameLookup[e]}serialize(e){null===this._valueLookup&&(this._valueLookup=new Map(this.getValues().map(e=>[e.value,e])));let t=this._valueLookup.get(e);if(void 0===t)throw new g.eO(`Enum "${this.name}" cannot represent value: ${(0,v.N)(e)}`);return t.name}parseValue(e){if("string"!=typeof e){let t=(0,v.N)(e);throw new g.eO(`Enum "${this.name}" cannot represent non-string value: ${t}.`+eV(this,t))}let t=this.getValue(e);if(null==t)throw new g.eO(`Value "${e}" does not exist in "${this.name}" enum.`+eV(this,e));return t.value}parseLiteral(e,t){if(e.kind!==I.b.ENUM){let t=(0,$.y)(e);throw new g.eO(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+eV(this,t),{nodes:e})}let a=this.getValue(e.value);if(null==a){let t=(0,$.y)(e);throw new g.eO(`Value "${t}" does not exist in "${this.name}" enum.`+eV(this,t),{nodes:e})}return a.value}toConfig(){let e=E(this.getValues(),e=>e.name,e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function eV(e,t){return D("the enum value",S(t,e.getValues().map(e=>e.name)))}function eP(e,t){return eO(t)||(0,m.U)(!1,`${e} values must be an object with value names as keys.`),Object.entries(t).map(([t,a])=>(eO(a)||(0,m.U)(!1,`${e}.${t} must refer to an object with a "value" key representing an internal value but got: ${(0,v.N)(a)}.`),{name:V(t),description:a.description,value:void 0!==a.value?a.value:t,deprecationReason:a.deprecationReason,extensions:k(a.extensions),astNode:a.astNode}))}class eL{constructor(e){var t,a;this.name=R(e.name),this.description=e.description,this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(t=e.extensionASTNodes)?t:[],this.isOneOf=null!=(a=e.isOneOf)&&a,this._fields=eM.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){let e=F(this.getFields(),e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode}));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function eM(e){let t=eE(e.fields);return eO(t)||(0,m.U)(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),F(t,(t,a)=>("resolve"in t&&(0,m.U)(!1,`${e.name}.${a} field has a resolve property, but Input Types cannot define resolvers.`),{name:R(a),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:k(t.extensions),astNode:t.astNode}))}function eU(e){return et(e.type)&&void 0===e.defaultValue}function eq(e,t){return e===t||!!(et(e)&&et(t)||Z(e)&&Z(t))&&eq(e.ofType,t.ofType)}function eG(e,t,a){return t===a||(et(a)?!!et(t)&&eG(e,t.ofType,a.ofType):et(t)?eG(e,t.ofType,a):Z(a)?!!Z(t)&&eG(e,t.ofType,a.ofType):!Z(t)&&eu(a)&&(z(t)||q(t))&&e.isSubType(a,t))}function ez(e,t,a){return t===a||(eu(t)?eu(a)?e.getPossibleTypes(t).some(t=>e.isSubType(a,t)):e.isSubType(t,a):!!eu(a)&&e.isSubType(a,t))}var eY=a(42868);let eQ=0x7fffffff,eJ=-0x80000000,eH=new eF({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){let t=e0(e);if("boolean"==typeof t)return+!!t;let a=t;if("string"==typeof t&&""!==t&&(a=Number(t)),"number"!=typeof a||!Number.isInteger(a))throw new g.eO(`Int cannot represent non-integer value: ${(0,v.N)(t)}`);if(a>eQ||a<eJ)throw new g.eO("Int cannot represent non 32-bit signed integer value: "+(0,v.N)(t));return a},parseValue(e){if("number"!=typeof e||!Number.isInteger(e))throw new g.eO(`Int cannot represent non-integer value: ${(0,v.N)(e)}`);if(e>eQ||e<eJ)throw new g.eO(`Int cannot represent non 32-bit signed integer value: ${e}`);return e},parseLiteral(e){if(e.kind!==I.b.INT)throw new g.eO(`Int cannot represent non-integer value: ${(0,$.y)(e)}`,{nodes:e});let t=parseInt(e.value,10);if(t>eQ||t<eJ)throw new g.eO(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t}}),eW=new eF({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(e){let t=e0(e);if("boolean"==typeof t)return+!!t;let a=t;if("string"==typeof t&&""!==t&&(a=Number(t)),"number"!=typeof a||!Number.isFinite(a))throw new g.eO(`Float cannot represent non numeric value: ${(0,v.N)(t)}`);return a},parseValue(e){if("number"!=typeof e||!Number.isFinite(e))throw new g.eO(`Float cannot represent non numeric value: ${(0,v.N)(e)}`);return e},parseLiteral(e){if(e.kind!==I.b.FLOAT&&e.kind!==I.b.INT)throw new g.eO(`Float cannot represent non numeric value: ${(0,$.y)(e)}`,e);return parseFloat(e.value)}}),eK=new eF({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(e){let t=e0(e);if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t&&Number.isFinite(t))return t.toString();throw new g.eO(`String cannot represent value: ${(0,v.N)(e)}`)},parseValue(e){if("string"!=typeof e)throw new g.eO(`String cannot represent a non string value: ${(0,v.N)(e)}`);return e},parseLiteral(e){if(e.kind!==I.b.STRING)throw new g.eO(`String cannot represent a non string value: ${(0,$.y)(e)}`,{nodes:e});return e.value}}),eX=new eF({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(e){let t=e0(e);if("boolean"==typeof t)return t;if(Number.isFinite(t))return 0!==t;throw new g.eO(`Boolean cannot represent a non boolean value: ${(0,v.N)(t)}`)},parseValue(e){if("boolean"!=typeof e)throw new g.eO(`Boolean cannot represent a non boolean value: ${(0,v.N)(e)}`);return e},parseLiteral(e){if(e.kind!==I.b.BOOLEAN)throw new g.eO(`Boolean cannot represent a non boolean value: ${(0,$.y)(e)}`,{nodes:e});return e.value}}),eZ=new eF({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(e){let t=e0(e);if("string"==typeof t)return t;if(Number.isInteger(t))return String(t);throw new g.eO(`ID cannot represent value: ${(0,v.N)(e)}`)},parseValue(e){if("string"==typeof e)return e;if("number"==typeof e&&Number.isInteger(e))return e.toString();throw new g.eO(`ID cannot represent value: ${(0,v.N)(e)}`)},parseLiteral(e){if(e.kind!==I.b.STRING&&e.kind!==I.b.INT)throw new g.eO("ID cannot represent a non-string and non-integer value: "+(0,$.y)(e),{nodes:e});return e.value}}),e1=Object.freeze([eK,eH,eW,eX,eZ]);function e2(e){return e1.some(({name:t})=>e.name===t)}function e0(e){if((0,_.Z)(e)){if("function"==typeof e.valueOf){let t=e.valueOf();if(!(0,_.Z)(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function e6(e){return(0,x.h)(e,e3)}function e4(e){if(!e6(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL directive.`);return e}class e3{constructor(e){var t,a;this.name=R(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!=(t=e.isRepeatable)&&t,this.extensions=k(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||(0,m.U)(!1,`@${e.name} locations must be an Array.`);let i=null!=(a=e.args)?a:{};(0,_.Z)(i)&&!Array.isArray(i)||(0,m.U)(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=eS(i)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:ek(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}let e8=new e3({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[eY.H.FIELD,eY.H.FRAGMENT_SPREAD,eY.H.INLINE_FRAGMENT],args:{if:{type:new ef(eX),description:"Included when true."}}}),e5=new e3({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[eY.H.FIELD,eY.H.FRAGMENT_SPREAD,eY.H.INLINE_FRAGMENT],args:{if:{type:new ef(eX),description:"Skipped when true."}}}),e9="No longer supported",e7=new e3({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[eY.H.FIELD_DEFINITION,eY.H.ARGUMENT_DEFINITION,eY.H.INPUT_FIELD_DEFINITION,eY.H.ENUM_VALUE],args:{reason:{type:eK,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:e9}}}),te=new e3({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[eY.H.SCALAR],args:{url:{type:new ef(eK),description:"The URL that specifies the behavior of this scalar."}}}),tt=new e3({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[eY.H.INPUT_OBJECT],args:{}}),ta=Object.freeze([e8,e5,e7,te,tt]);function ti(e){return ta.some(({name:t})=>t===e.name)}var tn=a(71306);function tr(e){return"object"==typeof e&&"function"==typeof(null==e?void 0:e[Symbol.iterator])}function to(e,t){if(et(t)){let a=to(e,t.ofType);return(null==a?void 0:a.kind)===I.b.NULL?null:a}if(null===e)return{kind:I.b.NULL};if(void 0===e)return null;if(Z(t)){let a=t.ofType;if(tr(e)){let t=[];for(let i of e){let e=to(i,a);null!=e&&t.push(e)}return{kind:I.b.LIST,values:t}}return to(e,a)}if(K(t)){if(!(0,_.Z)(e))return null;let a=[];for(let i of Object.values(t.getFields())){let t=to(e[i.name],i.type);t&&a.push({kind:I.b.OBJECT_FIELD,name:{kind:I.b.NAME,value:i.name},value:t})}return{kind:I.b.OBJECT,fields:a}}if(es(t)){let a=t.serialize(e);if(null==a)return null;if("boolean"==typeof a)return{kind:I.b.BOOLEAN,value:a};if("number"==typeof a&&Number.isFinite(a)){let e=String(a);return ts.test(e)?{kind:I.b.INT,value:e}:{kind:I.b.FLOAT,value:e}}if("string"==typeof a)return H(t)?{kind:I.b.ENUM,value:a}:t===eZ&&ts.test(a)?{kind:I.b.INT,value:a}:{kind:I.b.STRING,value:a};throw TypeError(`Cannot convert value to AST: ${(0,v.N)(a)}.`)}(0,tn.V)(!1,"Unexpected input type: "+(0,v.N)(t))}let ts=/^-?(?:0|[1-9][0-9]*)$/,tp=new eC({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:eK,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new ef(new em(new ef(tu))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new ef(tu),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:tu,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:tu,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new ef(new em(new ef(tl))),resolve:e=>e.getDirectives()}})}),tl=new eC({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new ef(eK),resolve:e=>e.name},description:{type:eK,resolve:e=>e.description},isRepeatable:{type:new ef(eX),resolve:e=>e.isRepeatable},locations:{type:new ef(new em(new ef(td))),resolve:e=>e.locations},args:{type:new ef(new em(new ef(tm))),args:{includeDeprecated:{type:eX,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter(e=>null==e.deprecationReason)}})}),td=new eR({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:eY.H.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:eY.H.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:eY.H.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:eY.H.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:eY.H.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:eY.H.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:eY.H.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:eY.H.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:eY.H.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:eY.H.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:eY.H.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:eY.H.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:eY.H.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:eY.H.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:eY.H.UNION,description:"Location adjacent to a union definition."},ENUM:{value:eY.H.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:eY.H.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:eY.H.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:eY.H.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),tu=new eC({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new ef(th),resolve:e=>M(e)?d.SCALAR:q(e)?d.OBJECT:z(e)?d.INTERFACE:Q(e)?d.UNION:H(e)?d.ENUM:K(e)?d.INPUT_OBJECT:Z(e)?d.LIST:et(e)?d.NON_NULL:void(0,tn.V)(!1,`Unexpected type: "${(0,v.N)(e)}".`)},name:{type:eK,resolve:e=>"name"in e?e.name:void 0},description:{type:eK,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:eK,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new em(new ef(tc)),args:{includeDeprecated:{type:eX,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(q(e)||z(e)){let a=Object.values(e.getFields());return t?a:a.filter(e=>null==e.deprecationReason)}}},interfaces:{type:new em(new ef(tu)),resolve(e){if(q(e)||z(e))return e.getInterfaces()}},possibleTypes:{type:new em(new ef(tu)),resolve(e,t,a,{schema:i}){if(eu(e))return i.getPossibleTypes(e)}},enumValues:{type:new em(new ef(tf)),args:{includeDeprecated:{type:eX,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(H(e)){let a=e.getValues();return t?a:a.filter(e=>null==e.deprecationReason)}}},inputFields:{type:new em(new ef(tm)),args:{includeDeprecated:{type:eX,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(K(e)){let a=Object.values(e.getFields());return t?a:a.filter(e=>null==e.deprecationReason)}}},ofType:{type:tu,resolve:e=>"ofType"in e?e.ofType:void 0},isOneOf:{type:eX,resolve:e=>{if(K(e))return e.isOneOf}}})}),tc=new eC({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new ef(eK),resolve:e=>e.name},description:{type:eK,resolve:e=>e.description},args:{type:new ef(new em(new ef(tm))),args:{includeDeprecated:{type:eX,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter(e=>null==e.deprecationReason)},type:{type:new ef(tu),resolve:e=>e.type},isDeprecated:{type:new ef(eX),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:eK,resolve:e=>e.deprecationReason}})}),tm=new eC({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new ef(eK),resolve:e=>e.name},description:{type:eK,resolve:e=>e.description},type:{type:new ef(tu),resolve:e=>e.type},defaultValue:{type:eK,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){let{type:t,defaultValue:a}=e,i=to(a,t);return i?(0,$.y)(i):null}},isDeprecated:{type:new ef(eX),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:eK,resolve:e=>e.deprecationReason}})}),tf=new eC({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new ef(eK),resolve:e=>e.name},description:{type:eK,resolve:e=>e.description},isDeprecated:{type:new ef(eX),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:eK,resolve:e=>e.deprecationReason}})});(o=d||(d={})).SCALAR="SCALAR",o.OBJECT="OBJECT",o.INTERFACE="INTERFACE",o.UNION="UNION",o.ENUM="ENUM",o.INPUT_OBJECT="INPUT_OBJECT",o.LIST="LIST",o.NON_NULL="NON_NULL";let th=new eR({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:d.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:d.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:d.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:d.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:d.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:d.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:d.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:d.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),tv={name:"__schema",type:new ef(tp),description:"Access the current type schema of this server.",args:[],resolve:(e,t,a,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},tg={name:"__type",type:tu,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new ef(eK),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},a,{schema:i})=>i.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},ty={name:"__typename",type:new ef(eK),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,a,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},tD=Object.freeze([tp,tl,td,tu,tc,tm,tf,th]);function tb(e){return tD.some(({name:t})=>e.name===t)}function tx(e){return(0,x.h)(e,tw)}function t_(e){if(!tx(e))throw Error(`Expected ${(0,v.N)(e)} to be a GraphQL schema.`);return e}class tw{constructor(e){var t,a;this.__validationErrors=!0===e.assumeValid?[]:void 0,(0,_.Z)(e)||(0,m.U)(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||(0,m.U)(!1,`"types" must be Array if provided but got: ${(0,v.N)(e.types)}.`),!e.directives||Array.isArray(e.directives)||(0,m.U)(!1,`"directives" must be Array if provided but got: ${(0,v.N)(e.directives)}.`),this.description=e.description,this.extensions=k(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!=(t=e.extensionASTNodes)?t:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!=(a=e.directives)?a:ta;let i=new Set(e.types);if(null!=e.types)for(let t of e.types)i.delete(t),tE(t,i);for(let e of(null!=this._queryType&&tE(this._queryType,i),null!=this._mutationType&&tE(this._mutationType,i),null!=this._subscriptionType&&tE(this._subscriptionType,i),this._directives))if(e6(e))for(let t of e.args)tE(t.type,i);for(let e of(tE(tp,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null),i)){if(null==e)continue;let t=e.name;if(t||(0,m.U)(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[t])throw Error(`Schema must contain uniquely named types but contains multiple types named "${t}".`);if(this._typeMap[t]=e,z(e)){for(let t of e.getInterfaces())if(z(t)){let a=this._implementationsMap[t.name];void 0===a&&(a=this._implementationsMap[t.name]={objects:[],interfaces:[]}),a.interfaces.push(e)}}else if(q(e)){for(let t of e.getInterfaces())if(z(t)){let a=this._implementationsMap[t.name];void 0===a&&(a=this._implementationsMap[t.name]={objects:[],interfaces:[]}),a.objects.push(e)}}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case y.cE.QUERY:return this.getQueryType();case y.cE.MUTATION:return this.getMutationType();case y.cE.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return Q(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){let t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let a=this._subTypeMap[e.name];if(void 0===a){if(a=Object.create(null),Q(e))for(let t of e.getTypes())a[t.name]=!0;else{let t=this.getImplementations(e);for(let e of t.objects)a[e.name]=!0;for(let e of t.interfaces)a[e.name]=!0}this._subTypeMap[e.name]=a}return void 0!==a[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find(t=>t.name===e)}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function tE(e,t){let a=e_(e);if(!t.has(a)){if(t.add(a),Q(a))for(let e of a.getTypes())tE(e,t);else if(q(a)||z(a)){for(let e of a.getInterfaces())tE(e,t);for(let e of Object.values(a.getFields()))for(let a of(tE(e.type,t),e.args))tE(a.type,t)}else if(K(a))for(let e of Object.values(a.getFields()))tE(e.type,t)}return t}function tF(e){var t,a,i,n;let r,o,s,p;if(t_(e),e.__validationErrors)return e.__validationErrors;let l=new tT(e);(o=(r=(t=l).schema).getQueryType())?q(o)||t.reportError(`Query root type must be Object type, it cannot be ${(0,v.N)(o)}.`,null!=(a=tA(r,y.cE.QUERY))?a:o.astNode):t.reportError("Query root type must be provided.",r.astNode),(s=r.getMutationType())&&!q(s)&&t.reportError(`Mutation root type must be Object type if provided, it cannot be ${(0,v.N)(s)}.`,null!=(i=tA(r,y.cE.MUTATION))?i:s.astNode),(p=r.getSubscriptionType())&&!q(p)&&t.reportError(`Subscription root type must be Object type if provided, it cannot be ${(0,v.N)(p)}.`,null!=(n=tA(r,y.cE.SUBSCRIPTION))?n:p.astNode),function(e){for(let a of e.schema.getDirectives()){if(!e6(a)){e.reportError(`Expected directive but got: ${(0,v.N)(a)}.`,null==a?void 0:a.astNode);continue}for(let i of(tS(e,a),0===a.locations.length&&e.reportError(`Directive @${a.name} must include 1 or more locations.`,a.astNode),a.args))if(tS(e,i),ei(i.type)||e.reportError(`The type of @${a.name}(${i.name}:) must be Input Type but got: ${(0,v.N)(i.type)}.`,i.astNode),eI(i)&&null!=i.deprecationReason){var t;e.reportError(`Required argument @${a.name}(${i.name}:) cannot be deprecated.`,[tk(i.astNode),null==(t=i.astNode)?void 0:t.type])}}}(l),function(e){var t;let a,i,n,r=(t=e,a=Object.create(null),i=[],n=Object.create(null),function e(r){if(!a[r.name]){for(let o of(a[r.name]=!0,n[r.name]=i.length,Object.values(r.getFields())))if(et(o.type)&&K(o.type.ofType)){let a=o.type.ofType,r=n[a.name];if(i.push(o),void 0===r)e(a);else{let e=i.slice(r),n=e.map(e=>e.name).join(".");t.reportError(`Cannot reference Input Object "${a.name}" within itself through a series of non-null fields: "${n}".`,e.map(e=>e.astNode))}i.pop()}n[r.name]=void 0}});for(let t of Object.values(e.schema.getTypeMap())){if(!eb(t)){e.reportError(`Expected GraphQL named type but got: ${(0,v.N)(t)}.`,t.astNode);continue}tb(t)||tS(e,t),q(t)||z(t)?(function(e,t){let a=Object.values(t.getFields());for(let o of(0===a.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]),a)){var i,n,r;for(let a of(tS(e,o),er(o.type)||e.reportError(`The type of ${t.name}.${o.name} must be Output Type but got: ${(0,v.N)(o.type)}.`,null==(i=o.astNode)?void 0:i.type),o.args)){let i=a.name;tS(e,a),ei(a.type)||e.reportError(`The type of ${t.name}.${o.name}(${i}:) must be Input Type but got: ${(0,v.N)(a.type)}.`,null==(n=a.astNode)?void 0:n.type),eI(a)&&null!=a.deprecationReason&&e.reportError(`Required argument ${t.name}.${o.name}(${i}:) cannot be deprecated.`,[tk(a.astNode),null==(r=a.astNode)?void 0:r.type])}}}(e,t),function(e,t){let a=Object.create(null);for(let i of t.getInterfaces()){if(!z(i)){e.reportError(`Type ${(0,v.N)(t)} must only implement Interface types, it cannot implement ${(0,v.N)(i)}.`,tO(t,i));continue}if(t===i){e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,tO(t,i));continue}if(a[i.name]){e.reportError(`Type ${t.name} can only implement ${i.name} once.`,tO(t,i));continue}a[i.name]=!0,function(e,t,a){let i=t.getInterfaces();for(let n of a.getInterfaces())i.includes(n)||e.reportError(n===t?`Type ${t.name} cannot implement ${a.name} because it would create a circular reference.`:`Type ${t.name} must implement ${n.name} because it is implemented by ${a.name}.`,[...tO(a,n),...tO(t,a)])}(e,t,i),function(e,t,a){let i=t.getFields();for(let p of Object.values(a.getFields())){var n,r,o,s;let l=p.name,d=i[l];if(!d){e.reportError(`Interface field ${a.name}.${l} expected but ${t.name} does not provide it.`,[p.astNode,t.astNode,...t.extensionASTNodes]);continue}for(let i of(eG(e.schema,d.type,p.type)||e.reportError(`Interface field ${a.name}.${l} expects type ${(0,v.N)(p.type)} but ${t.name}.${l} is type ${(0,v.N)(d.type)}.`,[null==(n=p.astNode)?void 0:n.type,null==(r=d.astNode)?void 0:r.type]),p.args)){let n=i.name,r=d.args.find(e=>e.name===n);if(!r){e.reportError(`Interface field argument ${a.name}.${l}(${n}:) expected but ${t.name}.${l} does not provide it.`,[i.astNode,d.astNode]);continue}eq(i.type,r.type)||e.reportError(`Interface field argument ${a.name}.${l}(${n}:) expects type ${(0,v.N)(i.type)} but ${t.name}.${l}(${n}:) is type ${(0,v.N)(r.type)}.`,[null==(o=i.astNode)?void 0:o.type,null==(s=r.astNode)?void 0:s.type])}for(let i of d.args){let n=i.name;!p.args.find(e=>e.name===n)&&eI(i)&&e.reportError(`Object field ${t.name}.${l} includes required argument ${n} that is missing from the Interface field ${a.name}.${l}.`,[i.astNode,p.astNode])}}}(e,t,i)}}(e,t)):Q(t)?function(e,t){let a=t.getTypes();0===a.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);let i=Object.create(null);for(let n of a){if(i[n.name]){e.reportError(`Union type ${t.name} can only include type ${n.name} once.`,tN(t,n.name));continue}i[n.name]=!0,q(n)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${(0,v.N)(n)}.`,tN(t,String(n)))}}(e,t):H(t)?function(e,t){let a=t.getValues();for(let i of(0===a.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]),a))tS(e,i)}(e,t):K(t)&&(function(e,t){let a=Object.values(t.getFields());for(let r of(0===a.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]),a)){var i,n;tS(e,r),ei(r.type)||e.reportError(`The type of ${t.name}.${r.name} must be Input Type but got: ${(0,v.N)(r.type)}.`,null==(i=r.astNode)?void 0:i.type),eU(r)&&null!=r.deprecationReason&&e.reportError(`Required input field ${t.name}.${r.name} cannot be deprecated.`,[tk(r.astNode),null==(n=r.astNode)?void 0:n.type]),t.isOneOf&&function(e,t,a){if(et(t.type)){var i;a.reportError(`OneOf input field ${e.name}.${t.name} must be nullable.`,null==(i=t.astNode)?void 0:i.type)}void 0!==t.defaultValue&&a.reportError(`OneOf input field ${e.name}.${t.name} cannot have a default value.`,t.astNode)}(t,r,e)}}(e,t),r(t))}}(l);let d=l.getErrors();return e.__validationErrors=d,d}function tC(e){let t=tF(e);if(0!==t.length)throw Error(t.map(e=>e.message).join("\n\n"))}class tT{constructor(e){this._errors=[],this.schema=e}reportError(e,t){let a=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new g.eO(e,{nodes:a}))}getErrors(){return this._errors}}function tA(e,t){var a;return null==(a=[e.astNode,...e.extensionASTNodes].flatMap(e=>{var t;return null!=(t=null==e?void 0:e.operationTypes)?t:[]}).find(e=>e.operation===t))?void 0:a.type}function tS(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function tO(e,t){let{astNode:a,extensionASTNodes:i}=e;return(null!=a?[a,...i]:i).flatMap(e=>{var t;return null!=(t=e.interfaces)?t:[]}).filter(e=>e.name.value===t.name)}function tN(e,t){let{astNode:a,extensionASTNodes:i}=e;return(null!=a?[a,...i]:i).flatMap(e=>{var t;return null!=(t=e.types)?t:[]}).filter(e=>e.name.value===t)}function tk(e){var t;return null==e||null==(t=e.directives)?void 0:t.find(e=>e.name.value===e7.name)}var tI=a(90424);function t$(e,t){switch(t.kind){case I.b.LIST_TYPE:{let a=t$(e,t.type);return a&&new em(a)}case I.b.NON_NULL_TYPE:{let a=t$(e,t.type);return a&&new ef(a)}case I.b.NAMED_TYPE:return e.getType(t.name.value)}}class tj{constructor(e,t,a){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=a?a:tB,t&&(ei(t)&&this._inputTypeStack.push(t),el(t)&&this._parentTypeStack.push(t),er(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){let t=this._schema;switch(e.kind){case I.b.SELECTION_SET:{let e=e_(this.getType());this._parentTypeStack.push(el(e)?e:void 0);break}case I.b.FIELD:{let a,i,n=this.getParentType();n&&(a=this._getFieldDef(t,n,e))&&(i=a.type),this._fieldDefStack.push(a),this._typeStack.push(er(i)?i:void 0);break}case I.b.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case I.b.OPERATION_DEFINITION:{let a=t.getRootType(e.operation);this._typeStack.push(q(a)?a:void 0);break}case I.b.INLINE_FRAGMENT:case I.b.FRAGMENT_DEFINITION:{let a=e.typeCondition,i=a?t$(t,a):e_(this.getType());this._typeStack.push(er(i)?i:void 0);break}case I.b.VARIABLE_DEFINITION:{let a=t$(t,e.type);this._inputTypeStack.push(ei(a)?a:void 0);break}case I.b.ARGUMENT:{var a;let t,i,n=null!=(a=this.getDirective())?a:this.getFieldDef();n&&(t=n.args.find(t=>t.name===e.name.value))&&(i=t.type),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push(ei(i)?i:void 0);break}case I.b.LIST:{let e=eD(this.getInputType()),t=Z(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push(ei(t)?t:void 0);break}case I.b.OBJECT_FIELD:{let t,a,i=e_(this.getInputType());K(i)&&(a=i.getFields()[e.name.value])&&(t=a.type),this._defaultValueStack.push(a?a.defaultValue:void 0),this._inputTypeStack.push(ei(t)?t:void 0);break}case I.b.ENUM:{let t,a=e_(this.getInputType());H(a)&&(t=a.getValue(e.value)),this._enumValue=t}}}leave(e){switch(e.kind){case I.b.SELECTION_SET:this._parentTypeStack.pop();break;case I.b.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case I.b.DIRECTIVE:this._directive=null;break;case I.b.OPERATION_DEFINITION:case I.b.INLINE_FRAGMENT:case I.b.FRAGMENT_DEFINITION:this._typeStack.pop();break;case I.b.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case I.b.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case I.b.LIST:case I.b.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case I.b.ENUM:this._enumValue=null}}}function tB(e,t,a){let i=a.name.value;return i===tv.name&&e.getQueryType()===t?tv:i===tg.name&&e.getQueryType()===t?tg:i===ty.name&&el(t)?ty:q(t)||z(t)?t.getFields()[i]:void 0}function tR(e,t){return{enter(...a){let i=a[0];e.enter(i);let n=(0,tI.XO)(t,i.kind).enter;if(n){let r=n.apply(t,a);return void 0!==r&&(e.leave(i),(0,y.Ll)(r)&&e.enter(r)),r}},leave(...a){let i,n=a[0],r=(0,tI.XO)(t,n.kind).leave;return r&&(i=r.apply(t,a)),e.leave(n),i}}}var tV=a(3420);function tP(e){return{Document(t){for(let a of t.definitions)if(!(0,tV._m)(a)){let t=a.kind===I.b.SCHEMA_DEFINITION||a.kind===I.b.SCHEMA_EXTENSION?"schema":'"'+a.name.value+'"';e.reportError(new g.eO(`The ${t} definition is not executable.`,{nodes:a}))}return!1}}}function tL(e){return{Field(t){let a=e.getParentType();if(a&&!e.getFieldDef()){var i,n;let r=e.getSchema(),o=t.name.value,s=D("to use an inline fragment on",function(e,t,a){if(!eu(t))return[];let i=new Set,n=Object.create(null);for(let o of e.getPossibleTypes(t))if(o.getFields()[a])for(let e of(i.add(o),n[o.name]=1,o.getInterfaces())){var r;e.getFields()[a]&&(i.add(e),n[e.name]=(null!=(r=n[e.name])?r:0)+1)}return[...i].sort((t,a)=>{let i=n[a.name]-n[t.name];return 0!==i?i:z(t)&&e.isSubType(t,a)?-1:z(a)&&e.isSubType(a,t)?1:C(t.name,a.name)}).map(e=>e.name)}(r,a,o));""===s&&(s=D((i=a,n=o,q(i)||z(i)?S(n,Object.keys(i.getFields())):[]))),e.reportError(new g.eO(`Cannot query field "${o}" on type "${a.name}".`+s,{nodes:t}))}}}}function tM(e){return{InlineFragment(t){let a=t.typeCondition;if(a){let t=t$(e.getSchema(),a);if(t&&!el(t)){let t=(0,$.y)(a);e.reportError(new g.eO(`Fragment cannot condition on non composite type "${t}".`,{nodes:a}))}}},FragmentDefinition(t){let a=t$(e.getSchema(),t.typeCondition);if(a&&!el(a)){let a=(0,$.y)(t.typeCondition);e.reportError(new g.eO(`Fragment "${t.name.value}" cannot condition on non composite type "${a}".`,{nodes:t.typeCondition}))}}}}function tU(e){return{...tq(e),Argument(t){let a=e.getArgument(),i=e.getFieldDef(),n=e.getParentType();if(!a&&i&&n){let a=t.name.value,r=S(a,i.args.map(e=>e.name));e.reportError(new g.eO(`Unknown argument "${a}" on field "${n.name}.${i.name}".`+D(r),{nodes:t}))}}}}function tq(e){let t=Object.create(null),a=e.getSchema();for(let e of a?a.getDirectives():ta)t[e.name]=e.args.map(e=>e.name);for(let a of e.getDocument().definitions)if(a.kind===I.b.DIRECTIVE_DEFINITION){var i;let e=null!=(i=a.arguments)?i:[];t[a.name.value]=e.map(e=>e.name.value)}return{Directive(a){let i=a.name.value,n=t[i];if(a.arguments&&n)for(let t of a.arguments){let a=t.name.value;if(!n.includes(a)){let r=S(a,n);e.reportError(new g.eO(`Unknown argument "${a}" on directive "@${i}".`+D(r),{nodes:t}))}}return!1}}}function tG(e){let t=Object.create(null),a=e.getSchema();for(let e of a?a.getDirectives():ta)t[e.name]=e.locations;for(let a of e.getDocument().definitions)a.kind===I.b.DIRECTIVE_DEFINITION&&(t[a.name.value]=a.locations.map(e=>e.value));return{Directive(a,i,n,r,o){let s=a.name.value,p=t[s];if(!p)return void e.reportError(new g.eO(`Unknown directive "@${s}".`,{nodes:a}));let l=function(e){let t=e[e.length-1];switch("kind"in t||(0,tn.V)(!1),t.kind){case I.b.OPERATION_DEFINITION:var a=t.operation;switch(a){case y.cE.QUERY:return eY.H.QUERY;case y.cE.MUTATION:return eY.H.MUTATION;case y.cE.SUBSCRIPTION:return eY.H.SUBSCRIPTION}return;case I.b.FIELD:return eY.H.FIELD;case I.b.FRAGMENT_SPREAD:return eY.H.FRAGMENT_SPREAD;case I.b.INLINE_FRAGMENT:return eY.H.INLINE_FRAGMENT;case I.b.FRAGMENT_DEFINITION:return eY.H.FRAGMENT_DEFINITION;case I.b.VARIABLE_DEFINITION:return eY.H.VARIABLE_DEFINITION;case I.b.SCHEMA_DEFINITION:case I.b.SCHEMA_EXTENSION:return eY.H.SCHEMA;case I.b.SCALAR_TYPE_DEFINITION:case I.b.SCALAR_TYPE_EXTENSION:return eY.H.SCALAR;case I.b.OBJECT_TYPE_DEFINITION:case I.b.OBJECT_TYPE_EXTENSION:return eY.H.OBJECT;case I.b.FIELD_DEFINITION:return eY.H.FIELD_DEFINITION;case I.b.INTERFACE_TYPE_DEFINITION:case I.b.INTERFACE_TYPE_EXTENSION:return eY.H.INTERFACE;case I.b.UNION_TYPE_DEFINITION:case I.b.UNION_TYPE_EXTENSION:return eY.H.UNION;case I.b.ENUM_TYPE_DEFINITION:case I.b.ENUM_TYPE_EXTENSION:return eY.H.ENUM;case I.b.ENUM_VALUE_DEFINITION:return eY.H.ENUM_VALUE;case I.b.INPUT_OBJECT_TYPE_DEFINITION:case I.b.INPUT_OBJECT_TYPE_EXTENSION:return eY.H.INPUT_OBJECT;case I.b.INPUT_VALUE_DEFINITION:{let t=e[e.length-3];return"kind"in t||(0,tn.V)(!1),t.kind===I.b.INPUT_OBJECT_TYPE_DEFINITION?eY.H.INPUT_FIELD_DEFINITION:eY.H.ARGUMENT_DEFINITION}default:(0,tn.V)(!1,"Unexpected kind: "+(0,v.N)(t.kind))}}(o);l&&!p.includes(l)&&e.reportError(new g.eO(`Directive "@${s}" may not be used on ${l}.`,{nodes:a}))}}}function tz(e){return{FragmentSpread(t){let a=t.name.value;e.getFragment(a)||e.reportError(new g.eO(`Unknown fragment "${a}".`,{nodes:t.name}))}}}function tY(e){let t=e.getSchema(),a=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(let t of e.getDocument().definitions)(0,tV.a6)(t)&&(i[t.name.value]=!0);let n=[...Object.keys(a),...Object.keys(i)];return{NamedType(t,r,o,s,p){let l=t.name.value;if(!a[l]&&!i[l]){var d,u;let a=null!=(d=p[2])?d:o,i=null!=a&&"kind"in(u=a)&&((0,tV.xu)(u)||(0,tV.fT)(u));if(i&&tQ.includes(l))return;let r=S(l,i?tQ.concat(n):n);e.reportError(new g.eO(`Unknown type "${l}".`+D(r),{nodes:t}))}}}}let tQ=[...e1,...tD].map(e=>e.name);function tJ(e){let t=0;return{Document(e){t=e.definitions.filter(e=>e.kind===I.b.OPERATION_DEFINITION).length},OperationDefinition(a){!a.name&&t>1&&e.reportError(new g.eO("This anonymous operation must be the only defined operation.",{nodes:a}))}}}function tH(e){var t,a,i;let n=e.getSchema(),r=null!=(t=null!=(a=null!=(i=null==n?void 0:n.astNode)?i:null==n?void 0:n.getQueryType())?a:null==n?void 0:n.getMutationType())?t:null==n?void 0:n.getSubscriptionType(),o=0;return{SchemaDefinition(t){r?e.reportError(new g.eO("Cannot define a new schema within a schema extension.",{nodes:t})):(o>0&&e.reportError(new g.eO("Must provide only one schema definition.",{nodes:t})),++o)}}}function tW(e){return{Field(t){if(("__schema"===t.name.value||"__type"===t.name.value)&&function t(a,i=Object.create(null),n=0){if(a.kind===I.b.FRAGMENT_SPREAD){let r=a.name.value;if(!0===i[r])return!1;let o=e.getFragment(r);if(!o)return!1;try{return i[r]=!0,t(o,i,n)}finally{i[r]=void 0}}if(a.kind===I.b.FIELD&&("fields"===a.name.value||"interfaces"===a.name.value||"possibleTypes"===a.name.value||"inputFields"===a.name.value)&&++n>=3)return!0;if("selectionSet"in a&&a.selectionSet){for(let e of a.selectionSet.selections)if(t(e,i,n))return!0}return!1}(t))return e.reportError(new g.eO("Maximum introspection depth exceeded",{nodes:[t]})),!1}}}function tK(e){let t=Object.create(null),a=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:n=>((function n(r){if(t[r.name.value])return;let o=r.name.value;t[o]=!0;let s=e.getFragmentSpreads(r.selectionSet);if(0!==s.length){for(let t of(i[o]=a.length,s)){let r=t.name.value,o=i[r];if(a.push(t),void 0===o){let t=e.getFragment(r);t&&n(t)}else{let t=a.slice(o),i=t.slice(0,-1).map(e=>'"'+e.name.value+'"').join(", ");e.reportError(new g.eO(`Cannot spread fragment "${r}" within itself`+(""!==i?` via ${i}.`:"."),{nodes:t}))}a.pop()}i[o]=void 0}})(n),!1)}}function tX(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(a){for(let{node:i}of e.getRecursiveVariableUsages(a)){let n=i.name.value;!0!==t[n]&&e.reportError(new g.eO(a.name?`Variable "$${n}" is not defined by operation "${a.name.value}".`:`Variable "$${n}" is not defined.`,{nodes:[i,a]}))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}}function tZ(e){let t=[],a=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(a.push(e),!1),Document:{leave(){let i=Object.create(null);for(let a of t)for(let t of e.getRecursivelyReferencedFragments(a))i[t.name.value]=!0;for(let t of a){let a=t.name.value;!0!==i[a]&&e.reportError(new g.eO(`Fragment "${a}" is never used.`,{nodes:t}))}}}}}function t1(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(a){let i=Object.create(null);for(let{node:t}of e.getRecursiveVariableUsages(a))i[t.name.value]=!0;for(let n of t){let t=n.variable.name.value;!0!==i[t]&&e.reportError(new g.eO(a.name?`Variable "$${t}" is never used in operation "${a.name.value}".`:`Variable "$${t}" is never used.`,{nodes:n}))}}},VariableDefinition(e){t.push(e)}}}function t2(e){switch(e.kind){case I.b.OBJECT:return{...e,fields:e.fields.map(e=>({...e,value:t2(e.value)})).sort((e,t)=>C(e.name.value,t.name.value))};case I.b.LIST:return{...e,values:e.values.map(t2)};case I.b.INT:case I.b.FLOAT:case I.b.STRING:case I.b.BOOLEAN:case I.b.NULL:case I.b.ENUM:case I.b.VARIABLE:return e}}function t0(e){let t=new t7,a=new ae,i=new Map;return{SelectionSet(n){for(let[[r,o],s,p]of function(e,t,a,i,n,r){let o=[],[s,p]=t5(e,t,n,r);if(function(e,t,a,i,n,r){for(let[o,s]of Object.entries(r))if(s.length>1)for(let r=0;r<s.length;r++)for(let p=r+1;p<s.length;p++){let l=t8(e,a,i,n,!1,o,s[r],s[p]);l&&t.push(l)}}(e,o,t,a,i,s),0!==p.length)for(let n=0;n<p.length;n++){t6(e,o,t,a,i,!1,s,p[n]);for(let r=n+1;r<p.length;r++)t4(e,o,t,a,i,!1,p[n],p[r])}return o}(e,i,t,a,e.getParentType(),n)){let t=function e(t){return Array.isArray(t)?t.map(([t,a])=>`subfields "${t}" conflict because `+e(a)).join(" and "):t}(o);e.reportError(new g.eO(`Fields "${r}" conflict because ${t}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:s.concat(p)}))}}}}function t6(e,t,a,i,n,r,o,s){if(i.has(o,s,r))return;i.add(o,s,r);let p=e.getFragment(s);if(!p)return;let[l,d]=t9(e,a,p);if(o!==l)for(let s of(t3(e,t,a,i,n,r,o,l),d))t6(e,t,a,i,n,r,o,s)}function t4(e,t,a,i,n,r,o,s){if(o===s||n.has(o,s,r))return;n.add(o,s,r);let p=e.getFragment(o),l=e.getFragment(s);if(!p||!l)return;let[d,u]=t9(e,a,p),[c,m]=t9(e,a,l);for(let s of(t3(e,t,a,i,n,r,d,c),m))t4(e,t,a,i,n,r,o,s);for(let o of u)t4(e,t,a,i,n,r,o,s)}function t3(e,t,a,i,n,r,o,s){for(let[p,l]of Object.entries(o)){let o=s[p];if(o)for(let s of l)for(let l of o){let o=t8(e,a,i,n,r,p,s,l);o&&t.push(o)}}}function t8(e,t,a,i,n,r,o,s){let[p,l,d]=o,[u,c,m]=s,f=n||p!==u&&q(p)&&q(u);if(!f){let e=l.name.value,t=c.name.value;if(e!==t)return[[r,`"${e}" and "${t}" are different fields`],[l],[c]];if(!function(e,t){let a=e.arguments,i=t.arguments;if(void 0===a||0===a.length)return void 0===i||0===i.length;if(void 0===i||0===i.length||a.length!==i.length)return!1;let n=new Map(i.map(({name:e,value:t})=>[e.value,t]));return a.every(e=>{let t=e.value,a=n.get(e.name.value);return void 0!==a&&function(e){return(0,$.y)(t2(e))}(t)===function(e){return(0,$.y)(t2(e))}(a)})}(l,c))return[[r,"they have differing arguments"],[l],[c]]}let h=null==d?void 0:d.type,g=null==m?void 0:m.type;if(h&&g&&function e(t,a){return Z(t)?!Z(a)||e(t.ofType,a.ofType):!!Z(a)||(et(t)?!et(a)||e(t.ofType,a.ofType):!!et(a)||!!(es(t)||es(a))&&t!==a)}(h,g))return[[r,`they return conflicting types "${(0,v.N)(h)}" and "${(0,v.N)(g)}"`],[l],[c]];let y=l.selectionSet,D=c.selectionSet;if(y&&D){var b=function(e,t,a,i,n,r,o,s,p){let l=[],[d,u]=t5(e,t,r,o),[c,m]=t5(e,t,s,p);for(let r of(t3(e,l,t,a,i,n,d,c),m))t6(e,l,t,a,i,n,d,r);for(let r of u)t6(e,l,t,a,i,n,c,r);for(let r of u)for(let o of m)t4(e,l,t,a,i,n,r,o);return l}(e,t,a,i,f,e_(h),y,e_(g),D),x=r,_=l,w=c;return b.length>0?[[x,b.map(([e])=>e)],[_,...b.map(([,e])=>e).flat()],[w,...b.map(([,,e])=>e).flat()]]:void 0}}function t5(e,t,a,i){let n=t.get(i);if(n)return n;let r=Object.create(null),o=Object.create(null);!function e(t,a,i,n,r){for(let o of i.selections)switch(o.kind){case I.b.FIELD:{let e,t=o.name.value;(q(a)||z(a))&&(e=a.getFields()[t]);let i=o.alias?o.alias.value:t;n[i]||(n[i]=[]),n[i].push([a,o,e]);break}case I.b.FRAGMENT_SPREAD:r[o.name.value]=!0;break;case I.b.INLINE_FRAGMENT:{let i=o.typeCondition,s=i?t$(t.getSchema(),i):a;e(t,s,o.selectionSet,n,r)}}}(e,a,i,r,o);let s=[r,Object.keys(o)];return t.set(i,s),s}function t9(e,t,a){let i=t.get(a.selectionSet);if(i)return i;let n=t$(e.getSchema(),a.typeCondition);return t5(e,t,n,a.selectionSet)}class t7{constructor(){this._data=new Map}has(e,t,a){var i;let n=null==(i=this._data.get(e))?void 0:i.get(t);return void 0!==n&&(!!a||a===n)}add(e,t,a){let i=this._data.get(e);void 0===i?this._data.set(e,new Map([[t,a]])):i.set(t,a)}}class ae{constructor(){this._orderedPairSet=new t7}has(e,t,a){return e<t?this._orderedPairSet.has(e,t,a):this._orderedPairSet.has(t,e,a)}add(e,t,a){e<t?this._orderedPairSet.add(e,t,a):this._orderedPairSet.add(t,e,a)}}function at(e){return{InlineFragment(t){let a=e.getType(),i=e.getParentType();if(el(a)&&el(i)&&!ez(e.getSchema(),a,i)){let n=(0,v.N)(i),r=(0,v.N)(a);e.reportError(new g.eO(`Fragment cannot be spread here as objects of type "${n}" can never be of type "${r}".`,{nodes:t}))}},FragmentSpread(t){let a=t.name.value,i=function(e,t){let a=e.getFragment(t);if(a){let t=t$(e.getSchema(),a.typeCondition);if(el(t))return t}}(e,a),n=e.getParentType();if(i&&n&&!ez(e.getSchema(),i,n)){let r=(0,v.N)(n),o=(0,v.N)(i);e.reportError(new g.eO(`Fragment "${a}" cannot be spread here as objects of type "${r}" can never be of type "${o}".`,{nodes:t}))}}}}function aa(e){let t=e.getSchema(),a=Object.create(null);for(let t of e.getDocument().definitions)(0,tV.a6)(t)&&(a[t.name.value]=t);return{ScalarTypeExtension:i,ObjectTypeExtension:i,InterfaceTypeExtension:i,UnionTypeExtension:i,EnumTypeExtension:i,InputObjectTypeExtension:i};function i(i){var n;let r,o=i.name.value,s=a[o],p=null==t?void 0:t.getType(o);if(s?r=ai[s.kind]:p&&(r=M(n=p)?I.b.SCALAR_TYPE_EXTENSION:q(n)?I.b.OBJECT_TYPE_EXTENSION:z(n)?I.b.INTERFACE_TYPE_EXTENSION:Q(n)?I.b.UNION_TYPE_EXTENSION:H(n)?I.b.ENUM_TYPE_EXTENSION:K(n)?I.b.INPUT_OBJECT_TYPE_EXTENSION:void(0,tn.V)(!1,"Unexpected type: "+(0,v.N)(n))),r){if(r!==i.kind){let t=function(e){switch(e){case I.b.SCALAR_TYPE_EXTENSION:return"scalar";case I.b.OBJECT_TYPE_EXTENSION:return"object";case I.b.INTERFACE_TYPE_EXTENSION:return"interface";case I.b.UNION_TYPE_EXTENSION:return"union";case I.b.ENUM_TYPE_EXTENSION:return"enum";case I.b.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:(0,tn.V)(!1,"Unexpected kind: "+(0,v.N)(e))}}(i.kind);e.reportError(new g.eO(`Cannot extend non-${t} type "${o}".`,{nodes:s?[s,i]:i}))}}else{let n=S(o,Object.keys({...a,...null==t?void 0:t.getTypeMap()}));e.reportError(new g.eO(`Cannot extend type "${o}" because it is not defined.`+D(n),{nodes:i.name}))}}}let ai={[I.b.SCALAR_TYPE_DEFINITION]:I.b.SCALAR_TYPE_EXTENSION,[I.b.OBJECT_TYPE_DEFINITION]:I.b.OBJECT_TYPE_EXTENSION,[I.b.INTERFACE_TYPE_DEFINITION]:I.b.INTERFACE_TYPE_EXTENSION,[I.b.UNION_TYPE_DEFINITION]:I.b.UNION_TYPE_EXTENSION,[I.b.ENUM_TYPE_DEFINITION]:I.b.ENUM_TYPE_EXTENSION,[I.b.INPUT_OBJECT_TYPE_DEFINITION]:I.b.INPUT_OBJECT_TYPE_EXTENSION};function an(e){return{...ar(e),Field:{leave(t){var a;let i=e.getFieldDef();if(!i)return!1;let n=new Set(null==(a=t.arguments)?void 0:a.map(e=>e.name.value));for(let a of i.args)if(!n.has(a.name)&&eI(a)){let n=(0,v.N)(a.type);e.reportError(new g.eO(`Field "${i.name}" argument "${a.name}" of type "${n}" is required, but it was not provided.`,{nodes:t}))}}}}}function ar(e){var t,a;let i=Object.create(null),n=e.getSchema();for(let e of null!=(t=null==n?void 0:n.getDirectives())?t:ta)i[e.name]=w(e.args.filter(eI),e=>e.name);for(let t of e.getDocument().definitions)if(t.kind===I.b.DIRECTIVE_DEFINITION){let e=null!=(a=t.arguments)?a:[];i[t.name.value]=w(e.filter(ao),e=>e.name.value)}return{Directive:{leave(t){let a=t.name.value,n=i[a];if(n){var r;let i=new Set((null!=(r=t.arguments)?r:[]).map(e=>e.name.value));for(let[r,o]of Object.entries(n))if(!i.has(r)){let i=P(o.type)?(0,v.N)(o.type):(0,$.y)(o.type);e.reportError(new g.eO(`Directive "@${a}" argument "${r}" of type "${i}" is required, but it was not provided.`,{nodes:t}))}}}}}}function ao(e){return e.type.kind===I.b.NON_NULL_TYPE&&null==e.defaultValue}function as(e){return{Field(t){let a=e.getType(),i=t.selectionSet;if(a)if(es(e_(a))){if(i){let n=t.name.value,r=(0,v.N)(a);e.reportError(new g.eO(`Field "${n}" must not have a selection since type "${r}" has no subfields.`,{nodes:i}))}}else if(i){if(0===i.selections.length){let i=t.name.value,n=(0,v.N)(a);e.reportError(new g.eO(`Field "${i}" of type "${n}" must have at least one field selected.`,{nodes:t}))}}else{let i=t.name.value,n=(0,v.N)(a);e.reportError(new g.eO(`Field "${i}" of type "${n}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:t}))}}}}function ap(e){return e.map(e=>"number"==typeof e?"["+e.toString()+"]":"."+e).join("")}function al(e,t,a){return{prev:e,key:t,typename:a}}function ad(e){let t=[],a=e;for(;a;)t.push(a.key),a=a.prev;return t.reverse()}function au(e,t,a=ac){return function e(t,a,i,n){if(et(a))return null!=t?e(t,a.ofType,i,n):void i(ad(n),t,new g.eO(`Expected non-nullable type "${(0,v.N)(a)}" not to be null.`));if(null==t)return null;if(Z(a)){let r=a.ofType;return tr(t)?Array.from(t,(t,a)=>e(t,r,i,al(n,a,void 0))):[e(t,r,i,n)]}if(K(a)){if(!(0,_.Z)(t)||Array.isArray(t))return void i(ad(n),t,new g.eO(`Expected type "${a.name}" to be an object.`));let r={},o=a.getFields();for(let s of Object.values(o)){let o=t[s.name];if(void 0===o){if(void 0!==s.defaultValue)r[s.name]=s.defaultValue;else if(et(s.type)){let e=(0,v.N)(s.type);i(ad(n),t,new g.eO(`Field "${s.name}" of required type "${e}" was not provided.`))}continue}r[s.name]=e(o,s.type,i,al(n,s.name,a.name))}for(let e of Object.keys(t))if(!o[e]){let r=S(e,Object.keys(a.getFields()));i(ad(n),t,new g.eO(`Field "${e}" is not defined by type "${a.name}".`+D(r)))}if(a.isOneOf){let e=Object.keys(r);1!==e.length&&i(ad(n),t,new g.eO(`Exactly one key must be specified for OneOf type "${a.name}".`));let o=e[0],s=r[o];null===s&&i(ad(n).concat(o),s,new g.eO(`Field "${o}" must be non-null.`))}return r}if(es(a)){let e;try{e=a.parseValue(t)}catch(e){e instanceof g.eO?i(ad(n),t,e):i(ad(n),t,new g.eO(`Expected type "${a.name}". `+e.message,{originalError:e}));return}return void 0===e&&i(ad(n),t,new g.eO(`Expected type "${a.name}".`)),e}(0,tn.V)(!1,"Unexpected input type: "+(0,v.N)(a))}(e,t,a,void 0)}function ac(e,t,a){let i="Invalid value "+(0,v.N)(t);throw e.length>0&&(i+=` at "value${ap(e)}"`),a.message=i+": "+a.message,a}function am(e,t,a){if(e){if(e.kind===I.b.VARIABLE){let i=e.name.value;if(null==a||void 0===a[i])return;let n=a[i];if(null===n&&et(t))return;return n}if(et(t)){if(e.kind===I.b.NULL)return;return am(e,t.ofType,a)}if(e.kind===I.b.NULL)return null;if(Z(t)){let i=t.ofType;if(e.kind===I.b.LIST){let t=[];for(let n of e.values)if(af(n,a)){if(et(i))return;t.push(null)}else{let e=am(n,i,a);if(void 0===e)return;t.push(e)}return t}let n=am(e,i,a);if(void 0===n)return;return[n]}if(K(t)){if(e.kind!==I.b.OBJECT)return;let i=Object.create(null),n=w(e.fields,e=>e.name.value);for(let e of Object.values(t.getFields())){let t=n[e.name];if(!t||af(t.value,a)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(et(e.type))return;continue}let r=am(t.value,e.type,a);if(void 0===r)return;i[e.name]=r}if(t.isOneOf){let e=Object.keys(i);if(1!==e.length||null===i[e[0]])return}return i}if(es(t)){let i;try{i=t.parseLiteral(e,a)}catch(e){return}if(void 0===i)return;return i}(0,tn.V)(!1,"Unexpected input type: "+(0,v.N)(t))}}function af(e,t){return e.kind===I.b.VARIABLE&&(null==t||void 0===t[e.name.value])}function ah(e,t,a,i){let n=[],r=null==i?void 0:i.maxErrors;try{let i=function(e,t,a,i){let n={};for(let r of t){let t=r.variable.name.value,o=t$(e,r.type);if(!ei(o)){let e=(0,$.y)(r.type);i(new g.eO(`Variable "$${t}" expected value of type "${e}" which cannot be used as an input type.`,{nodes:r.type}));continue}if(!ay(a,t)){if(r.defaultValue)n[t]=am(r.defaultValue,o);else if(et(o)){let e=(0,v.N)(o);i(new g.eO(`Variable "$${t}" of required type "${e}" was not provided.`,{nodes:r}))}continue}let s=a[t];if(null===s&&et(o)){let e=(0,v.N)(o);i(new g.eO(`Variable "$${t}" of non-null type "${e}" must not be null.`,{nodes:r}));continue}n[t]=au(s,o,(e,a,n)=>{let o=`Variable "$${t}" got invalid value `+(0,v.N)(a);e.length>0&&(o+=` at "${t}${ap(e)}"`),i(new g.eO(o+"; "+n.message,{nodes:r,originalError:n}))})}return n}(e,t,a,e=>{if(null!=r&&n.length>=r)throw new g.eO("Too many errors processing variables, error limit reached. Execution aborted.");n.push(e)});if(0===n.length)return{coerced:i}}catch(e){n.push(e)}return{errors:n}}function av(e,t,a){var i;let n={},r=w(null!=(i=t.arguments)?i:[],e=>e.name.value);for(let i of e.args){let e=i.name,o=i.type,s=r[e];if(!s){if(void 0!==i.defaultValue)n[e]=i.defaultValue;else if(et(o))throw new g.eO(`Argument "${e}" of required type "${(0,v.N)(o)}" was not provided.`,{nodes:t});continue}let p=s.value,l=p.kind===I.b.NULL;if(p.kind===I.b.VARIABLE){let t=p.name.value;if(null==a||!ay(a,t)){if(void 0!==i.defaultValue)n[e]=i.defaultValue;else if(et(o))throw new g.eO(`Argument "${e}" of required type "${(0,v.N)(o)}" was provided the variable "$${t}" which was not provided a runtime value.`,{nodes:p});continue}l=null==a[t]}if(l&&et(o))throw new g.eO(`Argument "${e}" of non-null type "${(0,v.N)(o)}" must not be null.`,{nodes:p});let d=am(p,o,a);if(void 0===d)throw new g.eO(`Argument "${e}" has invalid value ${(0,$.y)(p)}.`,{nodes:p});n[e]=d}return n}function ag(e,t,a){var i;let n=null==(i=t.directives)?void 0:i.find(t=>t.name.value===e.name);if(n)return av(e,n,a)}function ay(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function aD(e,t,a,i,n){let r=new Map;return ab(e,t,a,i,n,r,new Set),r}function ab(e,t,a,i,n,r,o){for(let p of n.selections)switch(p.kind){case I.b.FIELD:{var s;if(!ax(a,p))continue;let e=(s=p).alias?s.alias.value:s.name.value,t=r.get(e);void 0!==t?t.push(p):r.set(e,[p]);break}case I.b.INLINE_FRAGMENT:if(!ax(a,p)||!a_(e,p,i))continue;ab(e,t,a,i,p.selectionSet,r,o);break;case I.b.FRAGMENT_SPREAD:{let n=p.name.value;if(o.has(n)||!ax(a,p))continue;o.add(n);let s=t[n];if(!s||!a_(e,s,i))continue;ab(e,t,a,i,s.selectionSet,r,o)}}}function ax(e,t){let a=ag(e5,t,e);if((null==a?void 0:a.if)===!0)return!1;let i=ag(e8,t,e);return(null==i?void 0:i.if)!==!1}function a_(e,t,a){let i=t.typeCondition;if(!i)return!0;let n=t$(e,i);return n===a||!!eu(n)&&e.isSubType(n,a)}function aw(e){return{OperationDefinition(t){if("subscription"===t.operation){let a=e.getSchema(),i=a.getSubscriptionType();if(i){let n=t.name?t.name.value:null,r=Object.create(null),o=e.getDocument(),s=Object.create(null);for(let e of o.definitions)e.kind===I.b.FRAGMENT_DEFINITION&&(s[e.name.value]=e);let p=aD(a,s,r,i,t.selectionSet);if(p.size>1){let t=[...p.values()].slice(1).flat();e.reportError(new g.eO(null!=n?`Subscription "${n}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:t}))}for(let t of p.values())t[0].name.value.startsWith("__")&&e.reportError(new g.eO(null!=n?`Subscription "${n}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:t}))}}}}}function aE(e,t){let a=new Map;for(let i of e){let e=t(i),n=a.get(e);void 0===n?a.set(e,[i]):n.push(i)}return a}function aF(e){return{DirectiveDefinition(e){var t;let i=null!=(t=e.arguments)?t:[];return a(`@${e.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(e){var t,i;let n=e.name.value;for(let r of null!=(t=e.fields)?t:[]){let e=r.name.value;a(`${n}.${e}`,null!=(i=r.arguments)?i:[])}return!1}function a(t,a){for(let[i,n]of aE(a,e=>e.name.value))n.length>1&&e.reportError(new g.eO(`Argument "${t}(${i}:)" can only be defined once.`,{nodes:n.map(e=>e.name)}));return!1}}function aC(e){return{Field:t,Directive:t};function t(t){var a;for(let[i,n]of aE(null!=(a=t.arguments)?a:[],e=>e.name.value))n.length>1&&e.reportError(new g.eO(`There can be only one argument named "${i}".`,{nodes:n.map(e=>e.name)}))}}function aT(e){let t=Object.create(null),a=e.getSchema();return{DirectiveDefinition(i){let n=i.name.value;return null!=a&&a.getDirective(n)?void e.reportError(new g.eO(`Directive "@${n}" already exists in the schema. It cannot be redefined.`,{nodes:i.name})):(t[n]?e.reportError(new g.eO(`There can be only one directive named "@${n}".`,{nodes:[t[n],i.name]})):t[n]=i.name,!1)}}}function aA(e){let t=Object.create(null),a=e.getSchema();for(let e of a?a.getDirectives():ta)t[e.name]=!e.isRepeatable;for(let a of e.getDocument().definitions)a.kind===I.b.DIRECTIVE_DEFINITION&&(t[a.name.value]=!a.repeatable);let i=Object.create(null),n=Object.create(null);return{enter(a){let r;if("directives"in a&&a.directives){if(a.kind===I.b.SCHEMA_DEFINITION||a.kind===I.b.SCHEMA_EXTENSION)r=i;else if((0,tV.a6)(a)||(0,tV.i7)(a)){let e=a.name.value;void 0===(r=n[e])&&(n[e]=r=Object.create(null))}else r=Object.create(null);for(let i of a.directives){let a=i.name.value;t[a]&&(r[a]?e.reportError(new g.eO(`The directive "@${a}" can only be used once at this location.`,{nodes:[r[a],i]})):r[a]=i)}}}}}function aS(e){let t=e.getSchema(),a=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:n,EnumTypeExtension:n};function n(t){var n;let r=t.name.value;i[r]||(i[r]=Object.create(null));let o=null!=(n=t.values)?n:[],s=i[r];for(let t of o){let i=t.name.value,n=a[r];H(n)&&n.getValue(i)?e.reportError(new g.eO(`Enum value "${r}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:t.name})):s[i]?e.reportError(new g.eO(`Enum value "${r}.${i}" can only be defined once.`,{nodes:[s[i],t.name]})):s[i]=t.name}return!1}}function aO(e){let t=e.getSchema(),a=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:n,InputObjectTypeExtension:n,InterfaceTypeDefinition:n,InterfaceTypeExtension:n,ObjectTypeDefinition:n,ObjectTypeExtension:n};function n(t){var n,r,o;let s=t.name.value;i[s]||(i[s]=Object.create(null));let p=null!=(n=t.fields)?n:[],l=i[s];for(let t of p){let i=t.name.value;(r=a[s],o=i,(q(r)||z(r)||K(r))&&null!=r.getFields()[o])?e.reportError(new g.eO(`Field "${s}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:t.name})):l[i]?e.reportError(new g.eO(`Field "${s}.${i}" can only be defined once.`,{nodes:[l[i],t.name]})):l[i]=t.name}return!1}}function aN(e){let t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(a){let i=a.name.value;return t[i]?e.reportError(new g.eO(`There can be only one fragment named "${i}".`,{nodes:[t[i],a.name]})):t[i]=a.name,!1}}}function ak(e){let t=[],a=Object.create(null);return{ObjectValue:{enter(){t.push(a),a=Object.create(null)},leave(){let e=t.pop();e||(0,tn.V)(!1),a=e}},ObjectField(t){let i=t.name.value;a[i]?e.reportError(new g.eO(`There can be only one input field named "${i}".`,{nodes:[a[i],t.name]})):a[i]=t.name}}}function aI(e){let t=Object.create(null);return{OperationDefinition(a){let i=a.name;return i&&(t[i.value]?e.reportError(new g.eO(`There can be only one operation named "${i.value}".`,{nodes:[t[i.value],i]})):t[i.value]=i),!1},FragmentDefinition:()=>!1}}function a$(e){let t=e.getSchema(),a=Object.create(null),i=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:n,SchemaExtension:n};function n(t){var n;for(let r of null!=(n=t.operationTypes)?n:[]){let t=r.operation,n=a[t];i[t]?e.reportError(new g.eO(`Type for ${t} already defined in the schema. It cannot be redefined.`,{nodes:r})):n?e.reportError(new g.eO(`There can be only one ${t} type in schema.`,{nodes:[n,r]})):a[t]=r}return!1}}function aj(e){let t=Object.create(null),a=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(i){let n=i.name.value;return null!=a&&a.getType(n)?void e.reportError(new g.eO(`Type "${n}" already exists in the schema. It cannot also be defined in this type definition.`,{nodes:i.name})):(t[n]?e.reportError(new g.eO(`There can be only one type named "${n}".`,{nodes:[t[n],i.name]})):t[n]=i.name,!1)}}function aB(e){return{OperationDefinition(t){var a;for(let[i,n]of aE(null!=(a=t.variableDefinitions)?a:[],e=>e.variable.name.value))n.length>1&&e.reportError(new g.eO(`There can be only one variable named "$${i}".`,{nodes:n.map(e=>e.variable.name)}))}}}function aR(e){let t={};return{OperationDefinition:{enter(){t={}}},VariableDefinition(e){t[e.variable.name.value]=e},ListValue(t){if(!Z(eD(e.getParentInputType())))return aV(e,t),!1},ObjectValue(t){let a=e_(e.getInputType());if(!K(a))return aV(e,t),!1;let i=w(t.fields,e=>e.name.value);for(let n of Object.values(a.getFields()))if(!i[n.name]&&eU(n)){let i=(0,v.N)(n.type);e.reportError(new g.eO(`Field "${a.name}.${n.name}" of required type "${i}" was not provided.`,{nodes:t}))}a.isOneOf&&function(e,t,a,i){var n;let r=Object.keys(i);if(1!==r.length)return e.reportError(new g.eO(`OneOf Input Object "${a.name}" must specify exactly one key.`,{nodes:[t]}));let o=null==(n=i[r[0]])?void 0:n.value;o&&o.kind!==I.b.NULL||e.reportError(new g.eO(`Field "${a.name}.${r[0]}" must be non-null.`,{nodes:[t]}))}(e,t,a,i)},ObjectField(t){let a=e_(e.getParentInputType());if(!e.getInputType()&&K(a)){let i=S(t.name.value,Object.keys(a.getFields()));e.reportError(new g.eO(`Field "${t.name.value}" is not defined by type "${a.name}".`+D(i),{nodes:t}))}},NullValue(t){let a=e.getInputType();et(a)&&e.reportError(new g.eO(`Expected value of type "${(0,v.N)(a)}", found ${(0,$.y)(t)}.`,{nodes:t}))},EnumValue:t=>aV(e,t),IntValue:t=>aV(e,t),FloatValue:t=>aV(e,t),StringValue:t=>aV(e,t),BooleanValue:t=>aV(e,t)}}function aV(e,t){let a=e.getInputType();if(!a)return;let i=e_(a);if(!es(i)){let i=(0,v.N)(a);e.reportError(new g.eO(`Expected value of type "${i}", found ${(0,$.y)(t)}.`,{nodes:t}));return}try{let n=i.parseLiteral(t,void 0);if(void 0===n){let i=(0,v.N)(a);e.reportError(new g.eO(`Expected value of type "${i}", found ${(0,$.y)(t)}.`,{nodes:t}))}}catch(n){let i=(0,v.N)(a);n instanceof g.eO?e.reportError(n):e.reportError(new g.eO(`Expected value of type "${i}", found ${(0,$.y)(t)}; `+n.message,{nodes:t,originalError:n}))}}function aP(e){return{VariableDefinition(t){let a=t$(e.getSchema(),t.type);if(void 0!==a&&!ei(a)){let a=t.variable.name.value,i=(0,$.y)(t.type);e.reportError(new g.eO(`Variable "$${a}" cannot be non-input type "${i}".`,{nodes:t.type}))}}}}function aL(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(a){for(let{node:p,type:l,defaultValue:d,parentType:u}of e.getRecursiveVariableUsages(a)){let a=p.name.value,c=t[a];if(c&&l){var i,n,r,o,s;let t=e.getSchema(),m=t$(t,c.type);if(m&&(i=t,n=m,r=c.defaultValue,o=l,s=d,et(o)&&!et(n)?!((null!=r&&r.kind!==I.b.NULL||void 0!==s)&&eG(i,n,o.ofType)):!eG(i,n,o))){let t=(0,v.N)(m),i=(0,v.N)(l);e.reportError(new g.eO(`Variable "$${a}" of type "${t}" used in position expecting type "${i}".`,{nodes:[c,p]}))}K(u)&&u.isOneOf&&eg(m)&&e.reportError(new g.eO(`Variable "$${a}" is of type "${m}" but must be non-nullable to be used for OneOf Input Object "${u}".`,{nodes:[c,p]}))}}}},VariableDefinition(e){t[e.variable.name.value]=e}}}let aM=Object.freeze([tW]),aU=Object.freeze([tP,aI,tJ,aw,tY,tM,aP,as,tL,aN,tz,tZ,at,tK,aB,tX,t1,tG,aA,tU,aC,aR,an,aL,t0,ak,...aM]),aq=Object.freeze([tH,a$,aj,aS,aO,aF,aT,tY,tG,aA,aa,tq,aC,ak,ar]);class aG{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{for(let e of(t=Object.create(null),this.getDocument().definitions))e.kind===I.b.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){let a;t=[];let i=[e];for(;a=i.pop();)for(let e of a.selections)e.kind===I.b.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&i.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){let a;t=[];let i=Object.create(null),n=[e.selectionSet];for(;a=n.pop();)for(let e of this.getFragmentSpreads(a)){let a=e.name.value;if(!0!==i[a]){i[a]=!0;let e=this.getFragment(a);e&&(t.push(e),n.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class az extends aG{constructor(e,t,a){super(e,a),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class aY extends aG{constructor(e,t,a,i){super(t,i),this._schema=e,this._typeInfo=a,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){let a=[],i=new tj(this._schema);(0,tI.YR)(e,tR(i,{VariableDefinition:()=>!1,Variable(e){a.push({node:e,type:i.getInputType(),defaultValue:i.getDefaultValue(),parentType:i.getParentInputType()})}})),t=a,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){for(let a of(t=this.getVariableUsages(e),this.getRecursivelyReferencedFragments(e)))t=t.concat(this.getVariableUsages(a));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function aQ(e,t,a=aU,i,n=new tj(e)){var r;let o=null!=(r=null==i?void 0:i.maxErrors)?r:100;t||(0,m.U)(!1,"Must provide document."),tC(e);let s=Object.freeze({}),p=[],l=new aY(e,t,n,e=>{if(p.length>=o)throw p.push(new g.eO("Too many validation errors, error limit reached. Validation aborted.")),s;p.push(e)}),d=(0,tI.oP)(a.map(e=>e(l)));try{(0,tI.YR)(t,tR(n,d))}catch(e){if(e!==s)throw e}return p}function aJ(e,t,a=aq){let i=[],n=new az(e,t,e=>{i.push(e)}),r=a.map(e=>e(n));return(0,tI.YR)(e,(0,tI.oP)(r)),i}function aH(e){return Promise.all(Object.values(e)).then(t=>{let a=Object.create(null);for(let[i,n]of Object.keys(e).entries())a[n]=t[i];return a})}class aW extends Error{constructor(e){super("Unexpected error value: "+(0,v.N)(e)),this.name="NonErrorThrown",this.thrownValue=e}}function aK(e,t,a){var i;let n=e instanceof Error?e:new aW(e);return Array.isArray(n.path)?n:new g.eO(n.message,{nodes:null!=(i=n.nodes)?i:t,source:n.source,positions:n.positions,path:a,originalError:n})}let aX=(s=(e,t,a)=>(function(e,t,a,i,n){let r=new Map,o=new Set;for(let s of n)s.selectionSet&&ab(e,t,a,i,s.selectionSet,r,o);return r})(e.schema,e.fragments,e.variableValues,t,a),function(e,t,a){void 0===i&&(i=new WeakMap);let n=i.get(e);void 0===n&&(n=new WeakMap,i.set(e,n));let r=n.get(t);void 0===r&&(r=new WeakMap,n.set(t,r));let o=r.get(a);return void 0===o&&(o=s(e,t,a),r.set(a,o)),o});function aZ(e){arguments.length<2||(0,m.U)(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");let{schema:t,document:a,variableValues:i,rootValue:n}=e;a0(t,a,i);let r=a6(e);if(!("schema"in r))return{errors:r};try{let{operation:e}=r,t=function(e,t,a){let i=e.schema.getRootType(t.operation);if(null==i)throw new g.eO(`Schema is not configured to execute ${t.operation} operation.`,{nodes:t});let n=aD(e.schema,e.fragments,e.variableValues,i,t.selectionSet),r;switch(t.operation){case y.cE.QUERY:return a4(e,i,a,r,n);case y.cE.MUTATION:var o,s,p,l,d;return o=e,s=i,p=a,l=r,d=n,function(e,t,a){let i=a;for(let a of e)i=f(i)?i.then(e=>t(e,a)):t(i,a);return i}(d.entries(),(e,[t,a])=>{let i=al(l,t,s.name),n=a3(o,s,p,a,i);return void 0===n?e:f(n)?n.then(a=>(e[t]=a,e)):(e[t]=n,e)},Object.create(null));case y.cE.SUBSCRIPTION:return a4(e,i,a,r,n)}}(r,e,n);if(f(t))return t.then(e=>a2(e,r.errors),e=>(r.errors.push(e),a2(null,r.errors)));return a2(t,r.errors)}catch(e){return r.errors.push(e),a2(null,r.errors)}}function a1(e){let t=aZ(e);if(f(t))throw Error("GraphQL execution failed to complete synchronously.");return t}function a2(e,t){return 0===t.length?{data:e}:{errors:t,data:e}}function a0(e,t,a){t||(0,m.U)(!1,"Must provide document."),tC(e),null==a||(0,_.Z)(a)||(0,m.U)(!1,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}function a6(e){var t,a,i;let n,{schema:r,document:o,rootValue:s,contextValue:p,variableValues:l,operationName:d,fieldResolver:u,typeResolver:c,subscribeFieldResolver:m,options:f}=e,h=Object.create(null);for(let e of o.definitions)switch(e.kind){case I.b.OPERATION_DEFINITION:if(null==d){if(void 0!==n)return[new g.eO("Must provide operation name if query contains multiple operations.")];n=e}else(null==(t=e.name)?void 0:t.value)===d&&(n=e);break;case I.b.FRAGMENT_DEFINITION:h[e.name.value]=e}if(!n)return null!=d?[new g.eO(`Unknown operation named "${d}".`)]:[new g.eO("Must provide an operation.")];let v=ah(r,null!=(a=n.variableDefinitions)?a:[],null!=l?l:{},{maxErrors:null!=(i=null==f?void 0:f.maxCoercionErrors)?i:50});return v.errors?v.errors:{schema:r,fragments:h,rootValue:s,contextValue:p,operation:n,variableValues:v.coerced,fieldResolver:null!=u?u:ii,typeResolver:null!=c?c:ia,subscribeFieldResolver:null!=m?m:ii,errors:[]}}function a4(e,t,a,i,n){let r=Object.create(null),o=!1;try{for(let[s,p]of n.entries()){let n=al(i,s,t.name),l=a3(e,t,a,p,n);void 0!==l&&(r[s]=l,f(l)&&(o=!0))}}catch(e){if(o)return aH(r).finally(()=>{throw e});throw e}return o?aH(r):r}function a3(e,t,a,i,n){var r;let o=ir(e.schema,t,i[0]);if(!o)return;let s=o.type,p=null!=(r=o.resolve)?r:e.fieldResolver,l=a8(e,o,i,t,n);try{let t,r=av(o,i[0],e.variableValues),d=e.contextValue,u=p(a,r,d,l);if(t=f(u)?u.then(t=>a9(e,s,i,l,n,t)):a9(e,s,i,l,n,u),f(t))return t.then(void 0,t=>{let a=aK(t,i,ad(n));return a5(a,s,e)});return t}catch(t){return a5(aK(t,i,ad(n)),s,e)}}function a8(e,t,a,i,n){return{fieldName:t.name,fieldNodes:a,returnType:t.type,parentType:i,path:n,schema:e.schema,fragments:e.fragments,rootValue:e.rootValue,operation:e.operation,variableValues:e.variableValues}}function a5(e,t,a){if(et(t))throw e;return a.errors.push(e),null}function a9(e,t,a,i,n,r){var o,s,p,l,d,u,c;let m;if(r instanceof Error)throw r;if(et(t)){let o=a9(e,t.ofType,a,i,n,r);if(null===o)throw Error(`Cannot return null for non-nullable field ${i.parentType.name}.${i.fieldName}.`);return o}return null==r?null:Z(t)?function(e,t,a,i,n,r){if(!tr(r))throw new g.eO(`Expected Iterable, but did not find one for field "${i.parentType.name}.${i.fieldName}".`);let o=t.ofType,s=!1,p=Array.from(r,(t,r)=>{let p=al(n,r,void 0);try{let n;if(n=f(t)?t.then(t=>a9(e,o,a,i,p,t)):a9(e,o,a,i,p,t),f(n))return s=!0,n.then(void 0,t=>{let i=aK(t,a,ad(p));return a5(i,o,e)});return n}catch(t){return a5(aK(t,a,ad(p)),o,e)}});return s?Promise.all(p):p}(e,t,a,i,n,r):es(t)?function(e,t){let a=e.serialize(t);if(null==a)throw Error(`Expected \`${(0,v.N)(e)}.serialize(${(0,v.N)(t)})\` to return non-nullable value, returned: ${(0,v.N)(a)}`);return a}(t,r):eu(t)?(o=e,s=t,p=a,l=i,d=n,u=r,f(m=(null!=(c=s.resolveType)?c:o.typeResolver)(u,o.contextValue,l,s))?m.then(e=>ie(o,a7(e,o,s,p,l,u),p,l,d,u)):ie(o,a7(m,o,s,p,l,u),p,l,d,u)):q(t)?ie(e,t,a,i,n,r):void(0,tn.V)(!1,"Cannot complete value of unexpected output type: "+(0,v.N)(t))}function a7(e,t,a,i,n,r){if(null==e)throw new g.eO(`Abstract type "${a.name}" must resolve to an Object type at runtime for field "${n.parentType.name}.${n.fieldName}". Either the "${a.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,i);if(q(e))throw new g.eO("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");if("string"!=typeof e)throw new g.eO(`Abstract type "${a.name}" must resolve to an Object type at runtime for field "${n.parentType.name}.${n.fieldName}" with value ${(0,v.N)(r)}, received "${(0,v.N)(e)}".`);let o=t.schema.getType(e);if(null==o)throw new g.eO(`Abstract type "${a.name}" was resolved to a type "${e}" that does not exist inside the schema.`,{nodes:i});if(!q(o))throw new g.eO(`Abstract type "${a.name}" was resolved to a non-object type "${e}".`,{nodes:i});if(!t.schema.isSubType(a,o))throw new g.eO(`Runtime Object type "${o.name}" is not a possible type for "${a.name}".`,{nodes:i});return o}function ie(e,t,a,i,n,r){let o=aX(e,t,a);if(t.isTypeOf){let s=t.isTypeOf(r,e.contextValue,i);if(f(s))return s.then(i=>{if(!i)throw it(t,r,a);return a4(e,t,r,n,o)});if(!s)throw it(t,r,a)}return a4(e,t,r,n,o)}function it(e,t,a){return new g.eO(`Expected value of type "${e.name}" but got: ${(0,v.N)(t)}.`,{nodes:a})}let ia=function(e,t,a,i){if((0,_.Z)(e)&&"string"==typeof e.__typename)return e.__typename;let n=a.schema.getPossibleTypes(i),r=[];for(let i=0;i<n.length;i++){let o=n[i];if(o.isTypeOf){let n=o.isTypeOf(e,t,a);if(f(n))r[i]=n;else if(n)return r.length&&Promise.allSettled(r).catch(()=>{}),o.name}}if(r.length)return Promise.all(r).then(e=>{for(let t=0;t<e.length;t++)if(e[t])return n[t].name})},ii=function(e,t,a,i){if((0,_.Z)(e)||"function"==typeof e){let n=e[i.fieldName];return"function"==typeof n?e[i.fieldName](t,a,i):n}};function ir(e,t,a){let i=a.name.value;return i===tv.name&&e.getQueryType()===t?tv:i===tg.name&&e.getQueryType()===t?tg:i===ty.name?ty:t.getFields()[i]}function io(e){return new Promise(t=>t(ip(e)))}function is(e){let t=ip(e);if(f(t))throw Error("GraphQL execution failed to complete synchronously.");return t}function ip(e){let t;arguments.length<2||(0,m.U)(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");let{schema:a,source:i,rootValue:n,contextValue:r,variableValues:o,operationName:s,fieldResolver:p,typeResolver:l}=e,d=tF(a);if(d.length>0)return{errors:d};try{t=(0,h.qg)(i)}catch(e){return{errors:[e]}}let u=aQ(a,t);return u.length>0?{errors:u}:aZ({schema:a,document:t,rootValue:n,contextValue:r,variableValues:o,operationName:s,fieldResolver:p,typeResolver:l})}var il=a(39537),id=a(73971),iu=a(8238),ic=a(98472),im=a(12039);function ih(e){return"function"==typeof(null==e?void 0:e[Symbol.asyncIterator])}async function iv(e){arguments.length<2||(0,m.U)(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");let t=await ig(e);if(!ih(t))return t;let a=t[Symbol.asyncIterator]();async function i(t){if(t.done)return t;try{let a;return{value:await (a=t.value,aZ({...e,rootValue:a})),done:!1}}catch(e){if("function"==typeof a.return)try{await a.return()}catch(e){}throw e}}return{next:async()=>i(await a.next()),return:async()=>"function"==typeof a.return?i(await a.return()):{value:void 0,done:!0},async throw(e){if("function"==typeof a.throw)return i(await a.throw(e));throw e},[Symbol.asyncIterator](){return this}}}async function ig(...e){let t,a=(t=e[0])&&"document"in t?t:{schema:t,document:e[1],rootValue:e[2],contextValue:e[3],variableValues:e[4],operationName:e[5],subscribeFieldResolver:e[6]},{schema:i,document:n,variableValues:r}=a;a0(i,n,r);let o=a6(a);if(!("schema"in o))return{errors:o};try{let e=await iy(o);if(!ih(e))throw Error(`Subscription field must return Async Iterable. Received: ${(0,v.N)(e)}.`);return e}catch(e){if(e instanceof g.eO)return{errors:[e]};throw e}}async function iy(e){let{schema:t,fragments:a,operation:i,variableValues:n,rootValue:r}=e,o=t.getSubscriptionType();if(null==o)throw new g.eO("Schema is not configured to execute subscription operation.",{nodes:i});let[s,p]=[...aD(t,a,n,o,i.selectionSet).entries()][0],l=ir(t,o,p[0]);if(!l){let e=p[0].name.value;throw new g.eO(`The subscription field "${e}" is not defined.`,{nodes:p})}let d=al(void 0,s,o.name),u=a8(e,l,p,o,d);try{var c;let t=av(l,p[0],n),a=e.contextValue,i=null!=(c=l.subscribe)?c:e.subscribeFieldResolver,o=await i(r,t,a,u);if(o instanceof Error)throw o;return o}catch(e){throw aK(e,p,ad(d))}}function iD(e){return{Field(t){let a=e.getFieldDef(),i=null==a?void 0:a.deprecationReason;if(a&&null!=i){let n=e.getParentType();null!=n||(0,tn.V)(!1),e.reportError(new g.eO(`The field ${n.name}.${a.name} is deprecated. ${i}`,{nodes:t}))}},Argument(t){let a=e.getArgument(),i=null==a?void 0:a.deprecationReason;if(a&&null!=i){let n=e.getDirective();if(null!=n)e.reportError(new g.eO(`Directive "@${n.name}" argument "${a.name}" is deprecated. ${i}`,{nodes:t}));else{let n=e.getParentType(),r=e.getFieldDef();null!=n&&null!=r||(0,tn.V)(!1),e.reportError(new g.eO(`Field "${n.name}.${r.name}" argument "${a.name}" is deprecated. ${i}`,{nodes:t}))}}},ObjectField(t){let a=e_(e.getParentInputType());if(K(a)){let i=a.getFields()[t.name.value],n=null==i?void 0:i.deprecationReason;null!=n&&e.reportError(new g.eO(`The input field ${a.name}.${i.name} is deprecated. ${n}`,{nodes:t}))}},EnumValue(t){let a=e.getEnumValue(),i=null==a?void 0:a.deprecationReason;if(a&&null!=i){let n=e_(e.getInputType());null!=n||(0,tn.V)(!1),e.reportError(new g.eO(`The enum value "${n.name}.${a.name}" is deprecated. ${i}`,{nodes:t}))}}}}function ib(e){return{Field(t){let a=e_(e.getType());a&&tb(a)&&e.reportError(new g.eO(`GraphQL introspection has been disabled, but the requested query contained the field "${t.name.value}".`,{nodes:t}))}}}var ix=a(59841);function i_(e){let t={descriptions:!0,specifiedByUrl:!1,directiveIsRepeatable:!1,schemaDescription:!1,inputValueDeprecation:!1,oneOf:!1,...e},a=t.descriptions?"description":"",i=t.specifiedByUrl?"specifiedByURL":"",n=t.directiveIsRepeatable?"isRepeatable":"",r=t.schemaDescription?a:"";function o(e){return t.inputValueDeprecation?e:""}let s=t.oneOf?"isOneOf":"";return`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-cli",
|
|
3
|
-
"version": "2.25.0-beta.
|
|
3
|
+
"version": "2.25.0-beta.14",
|
|
4
4
|
"description": "BRICKS CLI - Command-line interface for BRICKS Workspace API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bricks",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=18.0.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "835a9ce79804c708292664a75bb2435fc9e0b9e3"
|
|
74
74
|
}
|