@fugood/bricks-cli 2.25.0-beta.53 → 2.25.0-beta.58
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/10.js +1 -1
- package/lib/117.js +230 -230
- package/lib/249.js +1 -0
- package/lib/511.js +1 -1
- package/lib/index.js +6 -6
- package/package.json +2 -2
- package/lib/341.js +0 -1
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ Expecting one of '${a.join("', '")}'`);let i=`${e}Help`;return this.on(i,e=>{let
|
|
|
18
18
|
(Did you mean ${i[0]}?)`:""}},57504(e,t,a){let i=a(7066),n=i?.WriteStream?.prototype?.hasColors?.()??!1,r=(e,t)=>{if(!n)return e=>e;let a=`\u001B[${e}m`,i=`\u001B[${t}m`;return e=>{let n=e+"",r=n.indexOf(i);if(-1===r)return a+n+i;let o=a,s=0,p=(22===t?i:"")+a;for(;-1!==r;)o+=n.slice(s,r)+p,s=r+i.length,r=n.indexOf(i,s);return o+(n.slice(s)+i)}},o={};o.reset=r(0,0),o.bold=r(1,22),o.dim=r(2,22),o.italic=r(3,23),o.underline=r(4,24),o.overline=r(53,55),o.inverse=r(7,27),o.hidden=r(8,28),o.strikethrough=r(9,29),o.black=r(30,39),o.red=r(31,39),o.green=r(32,39),o.yellow=r(33,39),o.blue=r(34,39),o.magenta=r(35,39),o.cyan=r(36,39),o.white=r(37,39),o.gray=r(90,39),o.bgBlack=r(40,49),o.bgRed=r(41,49),o.bgGreen=r(42,49),o.bgYellow=r(43,49),o.bgBlue=r(44,49),o.bgMagenta=r(45,49),o.bgCyan=r(46,49),o.bgWhite=r(47,49),o.bgGray=r(100,49),o.redBright=r(91,39),o.greenBright=r(92,39),o.yellowBright=r(93,39),o.blueBright=r(94,39),o.magentaBright=r(95,39),o.cyanBright=r(96,39),o.whiteBright=r(97,39),o.bgRedBright=r(101,49),o.bgGreenBright=r(102,49),o.bgYellowBright=r(103,49),o.bgBlueBright=r(104,49),o.bgMagentaBright=r(105,49),o.bgCyanBright=r(106,49),o.bgWhiteBright=r(107,49),e.exports=o},42495(e,t,a){a.d(t,{k:()=>h});var i=a(85608),n=a(60837),r=a(2904),o=a(555),s=a(3777),p=a(36054),l=a(30671),d=a(54019),u=a(44114),c=a(55427),m=a(70916),f=a(62959),h=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=(0,n.wrap)(r.ct,{max:o.v["cache.fragmentQueryDocuments"]||1e3,cache:d.l})}return e.prototype.lookupFragment=function(e){return null},e.prototype.batch=function(e){var t,a=this,i="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction(function(){return t=e.update(a)},i),t},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read((0,i.__assign)((0,i.__assign)({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.watchFragment=function(e){var t,a=this,n=e.fragment,r=e.fragmentName,o=e.from,d=e.optimistic,u=(0,i.__rest)(e,["fragment","fragmentName","from","optimistic"]),h=this.getFragmentDoc(n,r),v=void 0===o||"string"==typeof o?o:this.identify(o),g=!!e[Symbol.for("apollo.dataMasking")];if(!1!==globalThis.__DEV__){var y=r||(0,s.E4)(n).name.value;v||!1===globalThis.__DEV__||m.invariant.warn(1,y)}var b=(0,i.__assign)((0,i.__assign)({},u),{returnPartialData:!0,id:v,query:h,optimistic:void 0===d||d});return new p.c(function(o){return a.watch((0,i.__assign)((0,i.__assign)({},b),{immediate:!0,callback:function(s){var p=g?(0,f.z)(s.result,n,a,r):s.result;if(!(t&&(0,c.a)(h,{data:t.result},{data:p},e.variables))){var d={data:p,complete:!!s.complete};s.missing&&(d.missing=(0,l.IM)(s.missing.map(function(e){return e.missing}))),t=(0,i.__assign)((0,i.__assign)({},s),{result:p}),o.next(d)}}}))})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read((0,i.__assign)((0,i.__assign)({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,a=e.data,n=(0,i.__rest)(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:a}))},e.prototype.writeFragment=function(e){var t=e.id,a=e.data,n=e.fragment,r=e.fragmentName,o=(0,i.__rest)(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,r),dataId:t,result:a}))},e.prototype.updateQuery=function(e,t){return this.batch({update:function(a){var n=a.readQuery(e),r=t(n);return null==r?n:(a.writeQuery((0,i.__assign)((0,i.__assign)({},e),{data:r})),r)}})},e.prototype.updateFragment=function(e,t){return this.batch({update:function(a){var n=a.readFragment(e),r=t(n);return null==r?n:(a.writeFragment((0,i.__assign)((0,i.__assign)({},e),{data:r})),r)}})},e}();!1!==globalThis.__DEV__&&(h.prototype.getMemoryInternals=u.tQ)},84673(e,t,a){var i;a.d(t,{l:()=>i}),i||(i={})},65702(e,t,a){a.d(t,{Z:()=>n});var i=a(85608),n=function(e){function t(a,i,n,r){var o,s=e.call(this,a)||this;if(s.message=a,s.path=i,s.query=n,s.variables=r,Array.isArray(s.path)){s.missing=s.message;for(var p=s.path.length-1;p>=0;--p)(o={})[s.path[p]]=s.missing,s.missing=o}else s.missing=s.path;return s.__proto__=t.prototype,s}return(0,i.__extends)(t,e),t}(Error)},94037(e,t,a){a.r(t),a.d(t,{fieldNameFromStoreName:()=>l.iJ,makeVar:()=>u.UT,canonicalStringify:()=>s.M,cacheSlot:()=>u.bl,isReference:()=>o.A_,MissingFieldError:()=>r.Z,EntityStore:()=>p.D_,Cache:()=>n.l,Policies:()=>c.l,InMemoryCache:()=>d.D,ApolloCache:()=>i.k,defaultDataIdFromObject:()=>l.or,makeReference:()=>o.WU,createFragmentRegistry:()=>b}),a(70916);var i=a(42495),n=a(84673),r=a(65702),o=a(28907),s=a(44214),p=a(83906),l=a(35207),d=a(7068),u=a(777),c=a(92610),m=a(85608),f=a(90424),h=a(60837),v=a(3777),g=a(555),y=a(54019);function b(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new(D.bind.apply(D,(0,m.__spreadArray)([void 0],e,!1)))}var D=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.registry=Object.create(null),this.resetCaches(),e.length&&this.register.apply(this,e)}return e.prototype.register=function(){for(var e=this,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];var i=new Map;return t.forEach(function(e){(0,v.zK)(e).forEach(function(e){i.set(e.name.value,e)})}),i.forEach(function(t,a){t!==e.registry[a]&&(e.registry[a]=t,e.invalidate(a))}),this},e.prototype.invalidate=function(e){},e.prototype.resetCaches=function(){var t=e.prototype;this.invalidate=(this.lookup=(0,h.wrap)(t.lookup.bind(this),{makeCacheKey:function(e){return e},max:g.v["fragmentRegistry.lookup"]||1e3})).dirty,this.transform=(0,h.wrap)(t.transform.bind(this),{cache:y.l,max:g.v["fragmentRegistry.transform"]||2e3}),this.findFragmentSpreads=(0,h.wrap)(t.findFragmentSpreads.bind(this),{cache:y.l,max:g.v["fragmentRegistry.findFragmentSpreads"]||4e3})},e.prototype.lookup=function(e){return this.registry[e]||null},e.prototype.transform=function(e){var t=this,a=new Map;(0,v.zK)(e).forEach(function(e){a.set(e.name.value,e)});var i=new Set,n=function(e){a.has(e)||i.add(e)},r=function(e){return Object.keys(t.findFragmentSpreads(e)).forEach(n)};r(e);var o=[],s=Object.create(null);if(i.forEach(function(e){var i=a.get(e);if(i)r(s[e]=i);else{o.push(e);var n=t.lookup(e);n&&r(s[e]=n)}}),o.length){var p=[];o.forEach(function(e){var t=s[e];t&&p.push(t)}),p.length&&(e=(0,m.__assign)((0,m.__assign)({},e),{definitions:e.definitions.concat(p)}))}return e},e.prototype.findFragmentSpreads=function(e){var t=Object.create(null);return(0,f.YR)(e,{FragmentSpread:function(e){t[e.name.value]=e}}),t},e}()},83906(e,t,a){a.d(t,{$7:()=>F,D_:()=>b,M2:()=>x});var i,n,r=a(85608),o=a(70916),s=a(60837),p=a(55888),l=a(44592),d=a(57236),u=a(28907),c=a(30671),m=a(21777),f=a(51360),h=a(35207),v=Object.create(null),g=function(){return v},y=Object.create(null),b=function(){function e(e,t){var a=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return(0,d.G)((0,u.A_)(e)?a.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return(0,u.A_)(e)?a.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return(0,u.WU)(e);if((0,u.A_)(e))return e;var i=a.policies.identify(e)[0];if(i){var n=(0,u.WU)(i);return t&&a.merge(i,e),n}}}return e.prototype.toObject=function(){return(0,r.__assign)({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),h.$3.call(this.data,e)){var a=this.data[e];if(a&&h.$3.call(a,t))return a[t]}return"__typename"===t&&h.$3.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof w?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return(t&&this.group.depend(e,"__exists"),h.$3.call(this.data,e))?this.data[e]:this instanceof w?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var a,i=this;(0,u.A_)(e)&&(e=e.__ref),(0,u.A_)(t)&&(t=t.__ref);var n="string"==typeof e?this.lookup(a=e):e,r="string"==typeof t?this.lookup(a=t):t;if(r){(0,o.invariant)("string"==typeof a,2);var s=new c.ZI(E).merge(n,r);if(this.data[a]=s,s!==n&&(delete this.refs[a],this.group.caching)){var p=Object.create(null);n||(p.__exists=1),Object.keys(r).forEach(function(e){if(!n||n[e]!==s[e]){p[e]=1;var t=(0,h.iJ)(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(p[t]=1),void 0!==s[e]||i instanceof w||delete s[e]}}),p.__typename&&!(n&&n.__typename)&&this.policies.rootTypenamesById[a]===s.__typename&&delete p.__typename,Object.keys(p).forEach(function(e){return i.group.dirty(a,e)})}}},e.prototype.modify=function(e,t){var a=this,i=this.lookup(e);if(i){var n=Object.create(null),s=!1,p=!0,l={DELETE:v,INVALIDATE:y,isReference:u.A_,toReference:this.toReference,canRead:this.canRead,readField:function(t,i){return a.policies.readField("string"==typeof t?{fieldName:t,from:i||(0,u.WU)(e)}:t,{store:a})}};if(Object.keys(i).forEach(function(c){var m=(0,h.iJ)(c),f=i[c];if(void 0!==f){var b="function"==typeof t?t:t[c]||t[m];if(b){var D=b===g?v:b((0,d.G)(f),(0,r.__assign)((0,r.__assign)({},l),{fieldName:m,storeFieldName:c,storage:a.getStorage(e,c)}));if(D===y)a.group.dirty(e,c);else if(D===v&&(D=void 0),D!==f&&(n[c]=D,s=!0,f=D,!1!==globalThis.__DEV__)){var x=function(e){if(void 0===a.lookup(e.__ref))return!1!==globalThis.__DEV__&&o.invariant.warn(3,e),!0};if((0,u.A_)(D))x(D);else if(Array.isArray(D))for(var w=!1,_=void 0,E=0,F=D;E<F.length;E++){var A=F[E];if((0,u.A_)(A)){if(w=!0,x(A))break}else"object"==typeof A&&A&&a.policies.identify(A)[0]&&(_=A);if(w&&void 0!==_){!1!==globalThis.__DEV__&&o.invariant.warn(4,_);break}}}}void 0!==f&&(p=!1)}}),s)return this.merge(e,n),p&&(this instanceof w?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,a){var i,n=this.lookup(e);if(n){var r=this.getFieldValue(n,"__typename"),o=t&&a?this.policies.getStoreFieldName({typename:r,fieldName:t,args:a}):t;return this.modify(e,o?((i={})[o]=g,i):g)}return!1},e.prototype.evict=function(e,t){var a=!1;return e.id&&(h.$3.call(this.data,e.id)&&(a=this.delete(e.id,e.fieldName,e.args)),this instanceof w&&this!==t&&(a=this.parent.evict(e,t)||a),(e.fieldName||a)&&this.group.dirty(e.id,e.fieldName||"__exists")),a},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),a=[];return this.getRootIdSet().forEach(function(t){h.$3.call(e.policies.rootTypenamesById,t)||a.push(t)}),a.length&&(t.__META={extraRootIds:a.sort()}),t},e.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&h.$3.call(e,a)||t.delete(a)}),e){var a=e.__META,i=(0,r.__rest)(e,["__META"]);Object.keys(i).forEach(function(e){t.merge(e,i[e])}),a&&a.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof w?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),a=this.toObject();t.forEach(function(i){h.$3.call(a,i)&&(Object.keys(e.findChildRefIds(i)).forEach(t.add,t),delete a[i])});var i=Object.keys(a);if(i.length){for(var n=this;n instanceof w;)n=n.parent;i.forEach(function(e){return n.delete(e)})}return i},e.prototype.findChildRefIds=function(e){if(!h.$3.call(this.refs,e)){var t=this.refs[e]=Object.create(null),a=this.data[e];if(!a)return t;var i=new Set([a]);i.forEach(function(e){(0,u.A_)(e)&&(t[e.__ref]=!0),(0,m.U)(e)&&Object.keys(e).forEach(function(t){var a=e[t];(0,m.U)(a)&&i.add(a)})})}return this.refs[e]},e.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},e}(),D=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?(0,s.dep)():null,this.keyMaker=new l.Trie(f.et)},e.prototype.depend=function(e,t){if(this.d){this.d(t+"#"+e);var a=(0,h.iJ)(t);a!==t&&this.d(a+"#"+e),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(t+"#"+e,"__exists"===t?"forget":"setDirty")},e}();function x(e,t){F(e)&&e.group.depend(t,"__exists")}n=function(e){function t(t){var a=t.policies,i=t.resultCaching,n=t.seed,r=e.call(this,a,new D(void 0===i||i))||this;return r.stump=new _(r),r.storageTrie=new l.Trie(f.et),n&&r.replace(n),r}return(0,r.__extends)(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(i=b||(b={})),i.Root=n;var w=function(e){function t(t,a,i,n){var r=e.call(this,a.policies,n)||this;return r.id=t,r.parent=a,r.replay=i,r.group=n,i(r),r}return(0,r.__extends)(t,e),t.prototype.addLayer=function(e,a){return new t(e,this,a,this.group)},t.prototype.removeLayer=function(e){var t=this,a=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(e){var i=t.data[e],n=a.lookup(e);n?i?i!==n&&Object.keys(i).forEach(function(a){(0,p.equal)(i[a],n[a])||t.group.dirty(e,a)}):(t.group.dirty(e,"__exists"),Object.keys(n).forEach(function(a){t.group.dirty(e,a)})):t.delete(e)}),a):a===this.parent?this:a.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return(0,r.__assign)((0,r.__assign)({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var a=this.parent.findChildRefIds(t);return h.$3.call(this.data,t)?(0,r.__assign)((0,r.__assign)({},a),e.prototype.findChildRefIds.call(this,t)):a},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}(b),_=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,function(){},new D(t.group.caching,t.group))||this}return(0,r.__extends)(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(w);function E(e,t,a){var i=e[a],n=t[a];return(0,p.equal)(i,n)?i:n}function F(e){return!!(e instanceof b&&e.group.caching)}},35207(e,t,a){a.d(t,{$3:()=>u,I6:()=>h,T9:()=>function e(t,a,i){return!!(0,r.U)(a)&&((0,o.c)(a)?a.every(function(a){return e(t,a,i)}):t.selections.every(function(t){if((0,n.dt)(t)&&(0,s.MS)(t,i)){var r=(0,n.ue)(t);return u.call(a,r)&&(!t.selectionSet||e(t.selectionSet,a[r],i))}return!0}))},Ui:()=>g,Xx:()=>v,d1:()=>D,gk:()=>y,iJ:()=>b,lq:()=>w,mv:()=>x,or:()=>m});var i=a(50492),n=a(28907),r=a(21777),o=a(73767),s=a(82307),p=a(30671),l=a(2904),d=a(3777),u=Object.prototype.hasOwnProperty;function c(e){return null==e}function m(e,t){var a=e.__typename,i=e.id,n=e._id;if("string"==typeof a&&(t&&(t.keyObject=c(i)?c(n)?void 0:{_id:n}:{id:i}),c(i)&&!c(n)&&(i=n),!c(i)))return"".concat(a,":").concat("number"==typeof i||"string"==typeof i?i:JSON.stringify(i))}var f={dataIdFromObject:m,addTypename:!0,resultCaching:!0,canonizeResults:!1};function h(e){return(0,i.o)(f,e)}function v(e){var t=e.canonizeResults;return void 0===t?f.canonizeResults:t}function g(e,t){return(0,n.A_)(t)?e.get(t.__ref,"__typename"):t&&t.__typename}var y=/^[_a-z][_0-9a-z]*/i;function b(e){var t=e.match(y);return t?t[0]:e}function D(e){return(0,r.U)(e)&&!(0,n.A_)(e)&&!(0,o.c)(e)}function x(){return new p.ZI}function w(e,t){var a=(0,l.JG)((0,d.zK)(e));return{fragmentMap:a,lookupFragment:function(e){var i=a[e];return!i&&t&&(i=t.lookup(e)),i||null}}}},7068(e,t,a){a.d(t,{D:()=>U});var i=a(85608),n=a(70916),r=a(60837),o=a(55888),s=a(42495),p=a(65702),l=a(9354),d=a(53925),u=a(555),c=a(44214),m=a(38678),f=a(28907),h=a(42455),v=a(51360),g=a(50492),y=a(3777),b=a(30671),D=a(82307),x=a(2904),w=a(57236),_=a(21777),E=a(83906),F=a(35207),A=a(73767),C=a(44592),S=function(){function e(){this.known=new(v.En?WeakSet:Set),this.pool=new C.Trie(v.et),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return(0,_.U)(e)&&this.known.has(e)},e.prototype.pass=function(e){if((0,_.U)(e)){var t=(0,_.U)(e)?(0,A.c)(e)?e.slice(0):(0,i.__assign)({__proto__:Object.getPrototypeOf(e)},e):e;return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if((0,_.U)(e)){var a=this.passes.get(e);if(a)return a;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))break;var i=e.map(this.admit,this),n=this.pool.lookupArray(i);return n.array||(this.known.add(n.array=i),!1!==globalThis.__DEV__&&Object.freeze(i)),n.array;case null:case Object.prototype:if(this.known.has(e))break;var r=Object.getPrototypeOf(e),o=[r],s=this.sortedKeys(e);o.push(s.json);var p=o.length;s.sorted.forEach(function(a){o.push(t.admit(e[a]))});var n=this.pool.lookupArray(o);if(!n.object){var l=n.object=Object.create(r);this.known.add(l),s.sorted.forEach(function(e,t){l[e]=o[p+t]}),!1!==globalThis.__DEV__&&Object.freeze(l)}return n.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),a=this.pool.lookupArray(t);if(!a.keys){t.sort();var i=JSON.stringify(t);(a.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,a.keys={sorted:t,json:i})}return a.keys},e}();function T(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var k=function(){function e(e){var t=this;this.knownResults=new(v.et?WeakMap:Map),this.config=(0,g.o)(e,{addTypename:!1!==e.addTypename,canonizeResults:(0,F.Xx)(e)}),this.canon=e.canon||new S,this.executeSelectionSet=(0,r.wrap)(function(e){var a,n=e.context.canonizeResults,r=T(e);r[3]=!n;var o=(a=t.executeSelectionSet).peek.apply(a,r);return o?n?(0,i.__assign)((0,i.__assign)({},o),{result:t.canon.admit(o.result)}):o:((0,E.M2)(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:T,makeCacheKey:function(e,t,a,i){if((0,E.$7)(a.store))return a.store.makeCacheKey(e,(0,f.A_)(t)?t.__ref:t,a.varString,i)}}),this.executeSubSelectedArray=(0,r.wrap)(function(e){return(0,E.M2)(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(e){var t=e.field,a=e.array,i=e.context;if((0,E.$7)(i.store))return i.store.makeCacheKey(t,a,i.varString)}})}return e.prototype.resetCanon=function(){this.canon=new S},e.prototype.diffQueryAgainstStore=function(e){var t,a=e.store,n=e.query,r=e.rootId,o=e.variables,s=e.returnPartialData,l=e.canonizeResults,d=void 0===l?this.config.canonizeResults:l,u=this.config.cache.policies;o=(0,i.__assign)((0,i.__assign)({},(0,y.wY)((0,y.AT)(n))),o);var m=(0,f.WU)(void 0===r?"ROOT_QUERY":r),h=this.executeSelectionSet({selectionSet:(0,y.Vn)(n).selectionSet,objectOrReference:m,enclosingRef:m,context:(0,i.__assign)({store:a,query:n,policies:u,variables:o,varString:(0,c.M)(o),canonizeResults:d},(0,F.lq)(n,this.config.fragments))});if(h.missing&&(t=[new p.Z(function(e){try{JSON.stringify(e,function(e,t){if("string"==typeof t)throw t;return t})}catch(e){return e}}(h.missing),h.missing,n,o)],!(void 0===s||s)))throw t[0];return{result:h.result,complete:!t,missing:t}},e.prototype.isFresh=function(e,t,a,i){if((0,E.$7)(i.store)&&this.knownResults.get(e)===a){var n=this.executeSelectionSet.peek(a,t,i,this.canon.isKnown(e));if(n&&e===n.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t,a=this,i=e.selectionSet,r=e.objectOrReference,o=e.enclosingRef,s=e.context;if((0,f.A_)(r)&&!s.policies.rootTypenamesById[r.__ref]&&!s.store.has(r.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(r.__ref," object")};var p=s.variables,l=s.policies,u=s.store.getFieldValue(r,"__typename"),c=[],m=new b.ZI;function v(e,a){var i;return e.missing&&(t=m.merge(t,((i={})[a]=e.missing,i))),e.result}this.config.addTypename&&"string"==typeof u&&!l.rootIdsByTypename[u]&&c.push({__typename:u});var g=new Set(i.selections);g.forEach(function(e){var i,y;if((0,D.MS)(e,p))if((0,f.dt)(e)){var b=l.readField({fieldName:e.name.value,field:e,variables:s.variables,from:r},s),w=(0,f.ue)(e);void 0===b?d.XY.added(e)||(t=m.merge(t,((i={})[w]="Can't find field '".concat(e.name.value,"' on ").concat((0,f.A_)(r)?r.__ref+" object":"object "+JSON.stringify(r,null,2)),i))):(0,A.c)(b)?b.length>0&&(b=v(a.executeSubSelectedArray({field:e,array:b,enclosingRef:o,context:s}),w)):e.selectionSet?null!=b&&(b=v(a.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:b,enclosingRef:(0,f.A_)(b)?b:o,context:s}),w)):s.canonizeResults&&(b=a.canon.pass(b)),void 0!==b&&c.push(((y={})[w]=b,y))}else{var _=(0,x.HQ)(e,s.lookupFragment);if(!_&&e.kind===h.b.FRAGMENT_SPREAD)throw(0,n.newInvariantError)(10,e.name.value);_&&l.fragmentMatches(_,u)&&_.selectionSet.selections.forEach(g.add,g)}});var y={result:(0,b.IM)(c),missing:t},_=s.canonizeResults?this.canon.admit(y):(0,w.G)(y);return _.result&&this.knownResults.set(_.result,i),_},e.prototype.execSubSelectedArrayImpl=function(e){var t,a=this,i=e.field,r=e.array,o=e.enclosingRef,s=e.context,p=new b.ZI;function l(e,a){var i;return e.missing&&(t=p.merge(t,((i={})[a]=e.missing,i))),e.result}return i.selectionSet&&(r=r.filter(s.store.canRead)),r=r.map(function(e,t){return null===e?null:(0,A.c)(e)?l(a.executeSubSelectedArray({field:i,array:e,enclosingRef:o,context:s}),t):i.selectionSet?l(a.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:e,enclosingRef:(0,f.A_)(e)?e:o,context:s}),t):(!1!==globalThis.__DEV__&&function(e,t,a){if(!t.selectionSet){var i=new Set([a]);i.forEach(function(a){(0,_.U)(a)&&((0,n.invariant)(!(0,f.A_)(a),11,(0,F.Ui)(e,a),t.name.value),Object.values(a).forEach(i.add,i))})}}(s.store,i,e),e)}),{result:s.canonizeResults?this.canon.admit(r):r,missing:t}},e}(),N=a(20906),O=a(92610);function I(e,t,a){var n="".concat(t).concat(a),r=e.flavors.get(n);return r||e.flavors.set(n,r=e.clientOnly===t&&e.deferred===a?e:(0,i.__assign)((0,i.__assign)({},e),{clientOnly:t,deferred:a})),r}var $=function(){function e(e,t,a){this.cache=e,this.reader=t,this.fragments=a}return e.prototype.writeToStore=function(e,t){var a=this,r=t.query,s=t.result,p=t.dataId,l=t.variables,d=t.overwrite,u=(0,y.Vu)(r),m=(0,F.mv)();l=(0,i.__assign)((0,i.__assign)({},(0,y.wY)(u)),l);var h=(0,i.__assign)((0,i.__assign)({store:e,written:Object.create(null),merge:function(e,t){return m.merge(e,t)},variables:l,varString:(0,c.M)(l)},(0,F.lq)(r,this.fragments)),{overwrite:!!d,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),v=this.processSelectionSet({result:s||Object.create(null),dataId:p,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:h});if(!(0,f.A_)(v))throw(0,n.newInvariantError)(12,s);return h.incomingById.forEach(function(t,r){var s=t.storeObject,p=t.mergeTree,l=t.fieldNodeSet,d=(0,f.WU)(r);if(p&&p.map.size){var u=a.applyMerges(p,d,s,h);if((0,f.A_)(u))return;s=u}if(!1!==globalThis.__DEV__&&!h.overwrite){var c=Object.create(null);l.forEach(function(e){e.selectionSet&&(c[e.name.value]=!0)});var m=function(e){var t=p&&p.map.get(e);return!!(t&&t.info&&t.info.merge)};Object.keys(s).forEach(function(e){!0!==c[(0,F.iJ)(e)]||m(e)||function(e,t,a,r){var s=function(e){var t=r.getFieldValue(e,a);return"object"==typeof t&&t},p=s(e);if(p){var l=s(t);if(!(!l||(0,f.A_)(p)||(0,o.equal)(p,l)||Object.keys(p).every(function(e){return void 0!==r.getFieldValue(l,e)}))){var d=r.getFieldValue(e,"__typename")||r.getFieldValue(t,"__typename"),u=(0,F.iJ)(a),c="".concat(d,".").concat(u);if(!P.has(c)){P.add(c);var m=[];(0,A.c)(p)||(0,A.c)(l)||[p,l].forEach(function(e){var t=r.getFieldValue(e,"__typename");"string"!=typeof t||m.includes(t)||m.push(t)}),!1!==globalThis.__DEV__&&n.invariant.warn(15,u,d,m.length?"either ensure all objects of type "+m.join(" and ")+" have an ID or a custom merge function, or ":"",c,(0,i.__assign)({},p),(0,i.__assign)({},l))}}}}(d,s,e,h.store)})}e.merge(r,s)}),e.retain(v.__ref),v},e.prototype.processSelectionSet=function(e){var t=this,a=e.dataId,r=e.result,o=e.selectionSet,s=e.context,p=e.mergeTree,l=this.cache.policies,u=Object.create(null),c=a&&l.rootTypenamesById[a]||(0,f.D$)(r,o,s.fragmentMap)||a&&s.store.get(a,"__typename");"string"==typeof c&&(u.__typename=c);var m=function(){var e=(0,O.m)(arguments,u,s.variables);if((0,f.A_)(e.from)){var t=s.incomingById.get(e.from.__ref);if(t){var a=l.readField((0,i.__assign)((0,i.__assign)({},e),{from:t.storeObject}),s);if(void 0!==a)return a}}return l.readField(e,s)},h=new Set;this.flattenFields(o,r,s,c).forEach(function(e,a){var i,o=r[(0,f.ue)(a)];if(h.add(a),void 0!==o){var s=l.getStoreFieldName({typename:c,fieldName:a.name.value,field:a,variables:e.variables}),v=B(p,s),g=t.processFieldValue(o,a,a.selectionSet?I(e,!1,!1):e,v),y=void 0;a.selectionSet&&((0,f.A_)(g)||(0,F.d1)(g))&&(y=m("__typename",g));var b=l.getMergeFunction(c,a.name.value,y);b?v.info={field:a,typename:c,merge:b}:V(p,s),u=e.merge(u,((i={})[s]=g,i))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||d.XY.added(a)||l.getReadFunction(c,a.name.value)||!1===globalThis.__DEV__||n.invariant.error(13,(0,f.ue)(a),r)});try{var v=l.identify(r,{typename:c,selectionSet:o,fragmentMap:s.fragmentMap,storeObject:u,readField:m}),g=v[0],y=v[1];a=a||g,y&&(u=s.merge(u,y))}catch(e){if(!a)throw e}if("string"==typeof a){var b=(0,f.WU)(a),D=s.written[a]||(s.written[a]=[]);if(D.indexOf(o)>=0||(D.push(o),this.reader&&this.reader.isFresh(r,b,o,s)))return b;var x=s.incomingById.get(a);return x?(x.storeObject=s.merge(x.storeObject,u),x.mergeTree=function e(t,a){if(t===a||!a||R(a))return t;if(!t||R(t))return a;var n=t.info&&a.info?(0,i.__assign)((0,i.__assign)({},t.info),a.info):t.info||a.info,r=t.map.size&&a.map.size,o={info:n,map:r?new Map:t.map.size?t.map:a.map};if(r){var s=new Set(a.map.keys());t.map.forEach(function(t,i){o.map.set(i,e(t,a.map.get(i))),s.delete(i)}),s.forEach(function(i){o.map.set(i,e(a.map.get(i),t.map.get(i)))})}return o}(x.mergeTree,p),h.forEach(function(e){return x.fieldNodeSet.add(e)})):s.incomingById.set(a,{storeObject:u,mergeTree:R(p)?void 0:p,fieldNodeSet:h}),b}return u},e.prototype.processFieldValue=function(e,t,a,i){var n=this;return t.selectionSet&&null!==e?(0,A.c)(e)?e.map(function(e,r){var o=n.processFieldValue(e,t,a,B(i,r));return V(i,r),o}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:a,mergeTree:i}):!1!==globalThis.__DEV__?(0,N.m)(e):e},e.prototype.flattenFields=function(e,t,a,i){void 0===i&&(i=(0,f.D$)(t,e,a.fragmentMap));var r=new Map,o=this.cache.policies,s=new C.Trie(!1);return!function e(p,l){var d=s.lookup(p,l.clientOnly,l.deferred);d.visited||(d.visited=!0,p.selections.forEach(function(s){if((0,D.MS)(s,a.variables)){var p=l.clientOnly,d=l.deferred;if(!(p&&d)&&(0,A.E)(s.directives)&&s.directives.forEach(function(e){var t=e.name.value;if("client"===t&&(p=!0),"defer"===t){var i=(0,f.MB)(e,a.variables);i&&!1===i.if||(d=!0)}}),(0,f.dt)(s)){var u=r.get(s);u&&(p=p&&u.clientOnly,d=d&&u.deferred),r.set(s,I(a,p,d))}else{var c=(0,x.HQ)(s,a.lookupFragment);if(!c&&s.kind===h.b.FRAGMENT_SPREAD)throw(0,n.newInvariantError)(14,s.name.value);c&&o.fragmentMatches(c,i,t,a.variables)&&e(c.selectionSet,I(a,p,d))}}}))}(e,a),r},e.prototype.applyMerges=function(e,t,a,r,o){var s=this;if(e.map.size&&!(0,f.A_)(a)){var p,l,d=!(0,A.c)(a)&&((0,f.A_)(t)||(0,F.d1)(t))?t:void 0,u=a;d&&!o&&(o=[(0,f.A_)(d)?d.__ref:d]);var c=function(e,t){return(0,A.c)(e)?"number"==typeof t?e[t]:void 0:r.store.getFieldValue(e,String(t))};e.map.forEach(function(e,t){var a=c(d,t),i=c(u,t);if(void 0!==i){o&&o.push(t);var p=s.applyMerges(e,a,i,r,o);p!==i&&(l=l||new Map).set(t,p),o&&(0,n.invariant)(o.pop()===t)}}),l&&(a=(0,A.c)(u)?u.slice(0):(0,i.__assign)({},u),l.forEach(function(e,t){a[t]=e}))}return e.info?this.cache.policies.runMergeFunction(t,a,e.info,r,o&&(p=r.store).getStorage.apply(p,o)):a},e}(),j=[];function B(e,t){var a=e.map;return a.has(t)||a.set(t,j.pop()||{map:new Map}),a.get(t)}function R(e){return!e||!(e.info||e.map.size)}function V(e,t){var a=e.map,i=a.get(t);i&&R(i)&&(j.push(i),a.delete(t))}var P=new Set,L=a(777),M=a(44114),U=function(e){function t(t){void 0===t&&(t={});var a=e.call(this)||this;return a.watches=new Set,a.addTypenameTransform=new l.c(d.XY),a.assumeImmutableResults=!0,a.makeVar=L.UT,a.txCount=0,a.config=(0,F.I6)(t),a.addTypename=!!a.config.addTypename,a.policies=new O.l({cache:a,dataIdFromObject:a.config.dataIdFromObject,possibleTypes:a.config.possibleTypes,typePolicies:a.config.typePolicies}),a.init(),a}return(0,i.__extends)(t,e),t.prototype.init=function(){var e=this.data=new E.D_.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,a=this.storeReader,i=this.config.fragments;this.storeWriter=new $(this,this.storeReader=new k({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:(0,F.Xx)(this.config),canon:e?void 0:a&&a.canon,fragments:i}),i),this.maybeBroadcastWatch=(0,r.wrap)(function(e,a){return t.broadcastWatch(e,a)},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(e){var a=e.optimistic?t.optimisticData:t.data;if((0,E.$7)(a)){var i=e.optimistic,n=e.id,r=e.variables;return a.makeCacheKey(e.query,e.callback,(0,c.M)({optimistic:i,id:n,variables:r}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(e){return e.resetCaching()})},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData;try{return this.storeReader.diffQueryAgainstStore((0,i.__assign)((0,i.__assign)({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:void 0!==t&&t})).result||null}catch(e){if(e instanceof p.Z)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(F.$3.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore((0,i.__assign)((0,i.__assign)({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t=this;return this.watches.size||(0,L.MS)(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&(0,L.WR)(t),t.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){c.M.reset(),m.y.reset(),this.addTypenameTransform.resetCache(),null==(t=this.config.fragments)||t.resetCaches();var t,a=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),a},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){if((0,f.A_)(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&n.invariant.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(F.$3.call(e,"id"))return!1;e=(0,i.__assign)((0,i.__assign)({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e,this.data)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(e){var t=this;return this.init(),c.M.reset(),e&&e.discardWatches?(this.watches.forEach(function(e){return t.maybeBroadcastWatch.forget(e)}),this.watches.clear(),(0,L.WR)(this)):this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t,a=this,n=e.update,r=e.optimistic,o=void 0===r||r,s=e.removeOptimistic,p=e.onWatchUpdated,l=function(e){var i=a.data,r=a.optimisticData;++a.txCount,e&&(a.data=a.optimisticData=e);try{return t=n(a)}finally{--a.txCount,a.data=i,a.optimisticData=r}},d=new Set;return p&&!this.txCount&&this.broadcastWatches((0,i.__assign)((0,i.__assign)({},e),{onWatchUpdated:function(e){return d.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,l):!1===o?l(this.data):l(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),p&&d.size?(this.broadcastWatches((0,i.__assign)((0,i.__assign)({},e),{onWatchUpdated:function(e,t){var a=p.call(this,e,t);return!1!==a&&d.delete(e),a}})),d.size&&d.forEach(function(e){return a.maybeBroadcastWatch.dirty(e)})):this.broadcastWatches(e),t},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){return this.addTypenameToDocument(this.addFragmentsToDocument(e))},t.prototype.fragmentMatches=function(e,t){return this.policies.fragmentMatches(e,t)},t.prototype.lookupFragment=function(e){var t;return(null==(t=this.config.fragments)?void 0:t.lookup(e))||null},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach(function(a){return t.maybeBroadcastWatch(a,e)})},t.prototype.addFragmentsToDocument=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.addTypenameToDocument=function(e){return this.addTypename?this.addTypenameTransform.transformDocument(e):e},t.prototype.broadcastWatch=function(e,t){var a=e.lastDiff,i=this.diff(e);(!t||(e.optimistic&&"string"==typeof t.optimistic&&(i.fromOptimisticTransaction=!0),!t.onWatchUpdated||!1!==t.onWatchUpdated.call(this,e,i,a)))&&(a&&(0,o.equal)(a.result,i.result)||e.callback(e.lastDiff=i,a))},t}(s.k);!1!==globalThis.__DEV__&&(U.prototype.getMemoryInternals=M.cM)},92610(e,t,a){a.d(t,{l:()=>F,m:()=>C});var i=a(85608),n=a(70916),r=a(28907),o=a(86563),s=a(21777),p=a(35207),l=a(73767),d=a(777),u=a(30671),c=Object.create(null);function m(e){var t=JSON.stringify(e);return c[t]||(c[t]=Object.create(null))}function f(e){var t=m(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,a){var i=function(e,t){return a.readField(t,e)},r=a.keyObject=v(e,function(e){var r=y(a.storeObject,e,i);return void 0===r&&t!==a.storeObject&&p.$3.call(t,e[0])&&(r=y(t,e,g)),(0,n.invariant)(void 0!==r,5,e.join("."),t),r});return"".concat(a.typename,":").concat(JSON.stringify(r))})}function h(e){var t=m(e);return t.keyArgsFn||(t.keyArgsFn=function(t,a){var i=a.field,n=a.variables,o=a.fieldName,s=JSON.stringify(v(e,function(e){var a=e[0],o=a.charAt(0);if("@"===o){if(i&&(0,l.E)(i.directives)){var s=a.slice(1),d=i.directives.find(function(e){return e.name.value===s}),u=d&&(0,r.MB)(d,n);return u&&y(u,e.slice(1))}return}if("$"===o){var c=a.slice(1);if(n&&p.$3.call(n,c)){var m=e.slice(0);return m[0]=c,y(n,m)}return}if(t)return y(t,e)}));return(t||"{}"!==s)&&(o+=":"+s),o})}function v(e,t){var a=new u.ZI;return(function e(t){var a=m(t);if(!a.paths){var i=a.paths=[],n=[];t.forEach(function(a,r){(0,l.c)(a)?(e(a).forEach(function(e){return i.push(n.concat(e))}),n.length=0):(n.push(a),(0,l.c)(t[r+1])||(i.push(n.slice(0)),n.length=0))})}return a.paths})(e).reduce(function(e,i){var n,r=t(i);if(void 0!==r){for(var o=i.length-1;o>=0;--o)(n={})[i[o]]=r,r=n;e=a.merge(e,r)}return e},Object.create(null))}function g(e,t){return e[t]}function y(e,t,a){return a=a||g,function e(t){return(0,s.U)(t)?(0,l.c)(t)?t.map(e):v(Object.keys(t).sort(),function(e){return y(t,e)}):t}(t.reduce(function e(t,i){return(0,l.c)(t)?t.map(function(t){return e(t,i)}):t&&a(t,i)},e))}var b=a(47150);function D(e){return void 0!==e.args?e.args:e.field?(0,r.MB)(e.field,e.variables):null}var x=function(){},w=function(e,t){return t.fieldName},_=function(e,t,a){return(0,a.mergeObjects)(e,t)},E=function(e,t){return t},F=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=(0,i.__assign)({dataIdFromObject:p.or},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t){var a,n,r=this,o=t&&(t.typename||(null==(a=t.storeObject)?void 0:a.__typename))||e.__typename;if(o===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var s=t&&t.storeObject||e,p=(0,i.__assign)((0,i.__assign)({},t),{typename:o,storeObject:s,readField:t&&t.readField||function(){var e=C(arguments,s);return r.readField(e,{store:r.cache.data,variables:e.variables})}}),d=o&&this.getTypePolicy(o),u=d&&d.keyFn||this.config.dataIdFromObject;return b.yV.withValue(!0,function(){for(;u;){var t=u((0,i.__assign)((0,i.__assign)({},e),s),p);if((0,l.c)(t))u=f(t);else{n=t;break}}}),n=n?String(n):void 0,p.keyObject?[n,p.keyObject]:[n]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(a){var n=e[a],r=n.queryType,o=n.mutationType,s=n.subscriptionType,l=(0,i.__rest)(n,["queryType","mutationType","subscriptionType"]);r&&t.setRootTypename("Query",a),o&&t.setRootTypename("Mutation",a),s&&t.setRootTypename("Subscription",a),p.$3.call(t.toBeAdded,a)?t.toBeAdded[a].push(l):t.toBeAdded[a]=[l]})},e.prototype.updateTypePolicy=function(e,t){var a=this,i=this.getTypePolicy(e),n=t.keyFields,r=t.fields;function o(e,t){e.merge="function"==typeof t?t:!0===t?_:!1===t?E:e.merge}o(i,t.merge),i.keyFn=!1===n?x:(0,l.c)(n)?f(n):"function"==typeof n?n:i.keyFn,r&&Object.keys(r).forEach(function(t){var i=a.getFieldPolicy(e,t,!0),n=r[t];if("function"==typeof n)i.read=n;else{var s=n.keyArgs,p=n.read,d=n.merge;i.keyFn=!1===s?w:(0,l.c)(s)?h(s):"function"==typeof s?s:i.keyFn,"function"==typeof p&&(i.read=p),o(i,d)}i.read&&i.merge&&(i.keyFn=i.keyFn||w)})},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var a="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[a];t!==i&&((0,n.invariant)(!i||i===e,6,e),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=a,this.rootTypenamesById[a]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(a){t.getSupertypeSet(a,!0),e[a].forEach(function(e){t.getSupertypeSet(e,!0).add(a);var i=e.match(p.gk);i&&i[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))})})},e.prototype.getTypePolicy=function(e){var t=this;if(!p.$3.call(this.typePolicies,e)){var a=this.typePolicies[e]=Object.create(null);a.fields=Object.create(null);var n=this.supertypeMap.get(e);!n&&this.fuzzySubtypes.size&&(n=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(a,i){if(a.test(e)){var r=t.supertypeMap.get(i);r&&r.forEach(function(e){return n.add(e)})}})),n&&n.size&&n.forEach(function(e){var n=t.getTypePolicy(e),r=n.fields;Object.assign(a,(0,i.__rest)(n,["fields"])),Object.assign(a.fields,r)})}var r=this.toBeAdded[e];return r&&r.length&&r.splice(0).forEach(function(a){t.updateTypePolicy(e,a)}),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,a){if(e){var i=this.getTypePolicy(e).fields;return i[t]||a&&(i[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var a=this.supertypeMap.get(e);return!a&&t&&this.supertypeMap.set(e,a=new Set),a},e.prototype.fragmentMatches=function(e,t,a,i){var r=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),l=[s],d=function(e){var t=r.getSupertypeSet(e,!1);t&&t.size&&0>l.indexOf(t)&&l.push(t)},u=!!(a&&this.fuzzySubtypes.size),c=!1,m=0;m<l.length;++m){var f=l[m];if(f.has(o))return s.has(o)||(c&&!1!==globalThis.__DEV__&&n.invariant.warn(7,t,o),s.add(o)),!0;f.forEach(d),u&&m===l.length-1&&(0,p.T9)(e.selectionSet,a,i)&&(u=!1,c=!0,this.fuzzySubtypes.forEach(function(e,a){var i=t.match(e);i&&i[0]===t&&d(a)}))}return!1},e.prototype.hasKeyArgs=function(e,t){var a=this.getFieldPolicy(e,t,!1);return!!(a&&a.keyFn)},e.prototype.getStoreFieldName=function(e){var t,a=e.typename,i=e.fieldName,n=this.getFieldPolicy(a,i,!1),o=n&&n.keyFn;if(o&&a)for(var s={typename:a,fieldName:i,field:e.field||null,variables:e.variables},d=D(e);o;){var u=o(d,s);if((0,l.c)(u))o=h(u);else{t=u||i;break}}return(void 0===t&&(t=e.field?(0,r.Ii)(e.field,e.variables):(0,r.o5)(i,D(e))),!1===t)?i:i===(0,p.iJ)(t)?t:i+":"+t},e.prototype.readField=function(e,t){var a=e.from;if(a&&(e.field||e.fieldName)){if(void 0===e.typename){var i=t.store.getFieldValue(a,"__typename");i&&(e.typename=i)}var n=this.getStoreFieldName(e),o=(0,p.iJ)(n),s=t.store.getFieldValue(a,n),l=this.getFieldPolicy(e.typename,o,!1),u=l&&l.read;if(u){var c=A(this,a,e,t,t.store.getStorage((0,r.A_)(a)?a.__ref:a,n));return d.bl.withValue(this.cache,u,[s,c])}return s}},e.prototype.getReadFunction=function(e,t){var a=this.getFieldPolicy(e,t,!1);return a&&a.read},e.prototype.getMergeFunction=function(e,t,a){var i=this.getFieldPolicy(e,t,!1),n=i&&i.merge;return!n&&a&&(n=(i=this.getTypePolicy(a))&&i.merge),n},e.prototype.runMergeFunction=function(e,t,a,i,n){var r=a.field,o=a.typename,s=a.merge;return s===_?S(i.store)(e,t):s===E?t:(i.overwrite&&(e=void 0),s(e,t,A(this,void 0,{typename:o,fieldName:r.name.value,field:r,variables:i.variables},i,n||Object.create(null))))},e}();function A(e,t,a,i,n){var o=e.getStoreFieldName(a),s=(0,p.iJ)(o),l=a.variables||i.variables,d=i.store,u=d.toReference,c=d.canRead;return{args:D(a),field:a.field||null,fieldName:s,storeFieldName:o,variables:l,isReference:r.A_,toReference:u,storage:n,cache:e.cache,canRead:c,readField:function(){return e.readField(C(arguments,t,l),i)},mergeObjects:S(i.store)}}function C(e,t,a){var r,s=e[0],l=e[1],d=e.length;return"string"==typeof s?r={fieldName:s,from:d>1?l:t}:(r=(0,i.__assign)({},s),p.$3.call(r,"from")||(r.from=t)),!1!==globalThis.__DEV__&&void 0===r.from&&!1!==globalThis.__DEV__&&n.invariant.warn(8,(0,o.p)(Array.from(e))),void 0===r.variables&&(r.variables=a),r}function S(e){return function(t,a){if((0,l.c)(t)||(0,l.c)(a))throw(0,n.newInvariantError)(9);if((0,s.U)(t)&&(0,s.U)(a)){var o=e.getFieldValue(t,"__typename"),d=e.getFieldValue(a,"__typename");if(o&&d&&o!==d)return a;if((0,r.A_)(t)&&(0,p.d1)(a))return e.merge(t.__ref,a),t;if((0,p.d1)(t)&&(0,r.A_)(a))return e.merge(t,a.__ref),a;if((0,p.d1)(t)&&(0,p.d1)(a))return(0,i.__assign)((0,i.__assign)({},t),a)}return a}}},777(e,t,a){a.d(t,{MS:()=>p,UT:()=>l,WR:()=>s,bl:()=>n});var i=a(60837),n=new i.Slot,r=new WeakMap;function o(e){var t=r.get(e);return t||r.set(e,t={vars:new Set,dep:(0,i.dep)()}),t}function s(e){o(e).vars.forEach(function(t){return t.forgetCache(e)})}function p(e){o(e).vars.forEach(function(t){return t.attachCache(e)})}function l(e){var t=new Set,a=new Set,i=function(s){if(arguments.length>0){if(e!==s){e=s,t.forEach(function(e){var t;o(e).dep.dirty(i),(t=e).broadcastWatches&&t.broadcastWatches()});var p=Array.from(a);a.clear(),p.forEach(function(t){return t(e)})}}else{var l=n.getValue();l&&(r(l),o(l).dep(i))}return e};i.onNextChange=function(e){return a.add(e),function(){a.delete(e)}};var r=i.attachCache=function(e){return t.add(e),o(e).vars.add(i),i};return i.forgetCache=function(e){return t.delete(e)},i}},55427(e,t,a){a.d(t,{a:()=>l});var i=a(85608),n=a(55888),r=a(3777),o=a(2904),s=a(82307),p=a(28907);function l(e,t,a,l){var u=t.data,c=(0,i.__rest)(t,["data"]),m=a.data,f=(0,i.__rest)(a,["data"]);return(0,n.default)(c,f)&&function e(t,a,i,r){if(a===i)return!0;var l=new Set;return t.selections.every(function(t){if(l.has(t)||(l.add(t),!(0,s.MS)(t,r.variables)||d(t)))return!0;if((0,p.dt)(t)){var u=(0,p.ue)(t),c=a&&a[u],m=i&&i[u],f=t.selectionSet;if(!f)return(0,n.default)(c,m);var h=Array.isArray(c),v=Array.isArray(m);if(h!==v)return!1;if(h&&v){var g=c.length;if(m.length!==g)return!1;for(var y=0;y<g;++y)if(!e(f,c[y],m[y],r))return!1;return!0}return e(f,c,m,r)}var b=(0,o.HQ)(t,r.fragmentMap);if(b)return!!d(b)||e(b.selectionSet,a,i,r)})}((0,r.Vn)(e).selectionSet,u,m,{fragmentMap:(0,o.JG)((0,r.zK)(e)),variables:l})}function d(e){return!!e.directives&&e.directives.some(u)}function u(e){return"nonreactive"===e.name.value}},53570(e,t,a){a.r(t),a.d(t,{ApolloError:()=>l,PROTOCOL_ERRORS_SYMBOL:()=>r,graphQLResultHasProtocolErrors:()=>o,isApolloError:()=>s});var i=a(85608);a(70916);var n=a(21777),r=Symbol();function o(e){return!!e.extensions&&Array.isArray(e.extensions[r])}function s(e){return e.hasOwnProperty("graphQLErrors")}var p=function(e){var t=(0,i.__spreadArray)((0,i.__spreadArray)((0,i.__spreadArray)([],e.graphQLErrors,!0),e.clientErrors,!0),e.protocolErrors,!0);return e.networkError&&t.push(e.networkError),t.map(function(e){return(0,n.U)(e)&&e.message||"Error message not found."}).join("\n")},l=function(e){function t(a){var n=a.graphQLErrors,r=a.protocolErrors,o=a.clientErrors,s=a.networkError,l=a.errorMessage,d=a.extraInfo,u=e.call(this,l)||this;return u.name="ApolloError",u.graphQLErrors=n||[],u.protocolErrors=r||[],u.clientErrors=o||[],u.networkError=s||null,u.message=l||p(u),u.extraInfo=d,u.cause=(0,i.__spreadArray)((0,i.__spreadArray)((0,i.__spreadArray)([s],n||[],!0),r||[],!0),o||[],!0).find(function(e){return!!e})||null,u.__proto__=t.prototype,u}return(0,i.__extends)(t,e),t}(Error)},19074(e,t,a){a.d(t,{C:()=>u});var i=a(70916),n=a(36054),r=a(16878),o=a(38414),s=a(46192);function p(e,t){return t?t(e):n.c.of()}function l(e){return"function"==typeof e?new u(e):e}function d(e){return e.request.length<=1}var u=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e(function(){return n.c.of()})},e.from=function(t){return 0===t.length?e.empty():t.map(l).reduce(function(e,t){return e.concat(t)})},e.split=function(t,a,i){var r=l(a),o=l(i||new e(p));return Object.assign(new e(d(r)&&d(o)?function(e){return t(e)?r.request(e)||n.c.of():o.request(e)||n.c.of()}:function(e,a){return t(e)?r.request(e,a)||n.c.of():o.request(e,a)||n.c.of()}),{left:r,right:o})},e.execute=function(e,t){return e.request((0,r.k)(t.context,(0,o.A)((0,s.K)(t))))||n.c.of()},e.concat=function(t,a){var r=l(t);if(d(r))return!1!==globalThis.__DEV__&&i.invariant.warn(38,r),r;var o=l(a);return Object.assign(new e(d(o)?function(e){return r.request(e,function(e){return o.request(e)||n.c.of()})||n.c.of()}:function(e,t){return r.request(e,function(e){return o.request(e,t)||n.c.of()})||n.c.of()}),{left:r,right:o})},e.prototype.split=function(t,a,i){return this.concat(e.split(t,a,i||new e(p)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw(0,i.newInvariantError)(39)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}()},25174(e,t,a){a.d(t,{g:()=>i});var i=a(19074).C.execute},4232(e,t,a){a.r(t),a.d(t,{ApolloLink:()=>i.C,concat:()=>s,empty:()=>n,execute:()=>p.g,from:()=>r,split:()=>o}),a(70916);var i=a(19074),n=i.C.empty,r=i.C.from,o=i.C.split,s=i.C.concat,p=a(25174)},49952(e,t,a){a.d(t,{P:()=>o});var i=a(85608),n=a(19074),r=a(79760),o=function(e){function t(t){void 0===t&&(t={});var a=e.call(this,(0,r.$)(t).request)||this;return a.options=t,a}return(0,i.__extends)(t,e),t}(n.C)},67195(e,t,a){a.d(t,{S:()=>n});var i=a(70916),n=function(e){if(!e&&"u"<typeof fetch)throw(0,i.newInvariantError)(40)}},79760(e,t,a){a.d(t,{$:()=>b});var i=a(85608),n=a(70916),r=a(19074),o=a(82307),s=a(36054),p=a(63647),l=a(33068),d=a(90117),u=a(67195),c=a(74559),m=a(11151),f=a(93161),h=a(70783),v=a(53925),g=a(3777),y=(0,n.maybe)(function(){return fetch}),b=function(e){void 0===e&&(e={});var t=e.uri,a=void 0===t?"/graphql":t,b=e.fetch,D=e.print,x=void 0===D?c.i1:D,w=e.includeExtensions,_=e.preserveHeaderCase,E=e.useGETForQueries,F=e.includeUnusedVariables,A=void 0!==F&&F,C=(0,i.__rest)(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&(0,u.S)(b||y);var S={http:{includeExtensions:w,preserveHeaderCase:_},options:C.fetchOptions,credentials:C.credentials,headers:C.headers};return new r.C(function(e){var t,r,u=(0,l.z)(e,a),D=e.getContext(),w={};if(D.clientAwareness){var _=D.clientAwareness,F=_.name,C=_.version;F&&(w["apollographql-client-name"]=F),C&&(w["apollographql-client-version"]=C)}var T=(0,i.__assign)((0,i.__assign)({},w),D.headers),k={http:D.http,options:D.fetchOptions,credentials:D.credentials,headers:T};if((0,o.d8)(["client"],e.query)){var N=(0,v.er)(e.query);if(!N)return(0,f.N)(Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));e.query=N}var O=(0,c.HY)(e,x,c.R4,S,k),I=O.options,$=O.body;$.variables&&!A&&($.variables=(0,h.X)($.variables,e.query)),!I.signal&&"u">typeof AbortController&&(I.signal=(r=new AbortController).signal);var j="OperationDefinition"===(t=(0,g.Vn)(e.query)).kind&&"subscription"===t.operation,B=(0,o.d8)(["defer"],e.query);if(E&&!e.query.definitions.some(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})&&(I.method="GET"),B||j){I.headers=I.headers||{};var R="multipart/mixed;";j&&B&&!1!==globalThis.__DEV__&&n.invariant.warn(41),j?R+="boundary=graphql;subscriptionSpec=1.0,application/json":B&&(R+="deferSpec=20220824,application/json"),I.headers.accept=R}if("GET"===I.method){var V=(0,m.E)(u,$),P=V.newURI,L=V.parseError;if(L)return(0,f.N)(L);u=P}else try{I.body=(0,p.Y)($,"Payload")}catch(e){return(0,f.N)(e)}return new s.c(function(t){var a=b||(0,n.maybe)(function(){return fetch})||y,i=t.next.bind(t);return a(u,I).then(function(t){e.setContext({response:t});var a,n=null==(a=t.headers)?void 0:a.get("content-type");return null!==n&&/^multipart\/mixed/i.test(n)?(0,d.tD)(t,i):(0,d.OQ)(e)(t).then(i)}).then(function(){r=void 0,t.complete()}).catch(function(e){r=void 0,(0,d.H4)(e,t)}),function(){r&&r.abort()}})})}},28876(e,t,a){a.r(t),a.d(t,{HttpLink:()=>d.P,parseAndCheckHttpResponse:()=>i.OQ,checkFetcher:()=>o.S,rewriteURIForGET:()=>u.E,serializeFetchParameter:()=>n.Y,createSignalIfSupported:()=>s,selectHttpOptionsAndBodyInternal:()=>r.HY,selectHttpOptionsAndBody:()=>r.Wz,selectURI:()=>p.z,fallbackHttpConfig:()=>r.R4,createHttpLink:()=>l.$,defaultPrinter:()=>r.i1}),a(70916);var i=a(90117),n=a(63647),r=a(74559),o=a(67195),s=function(){if("u"<typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController,t=e.signal;return{controller:e,signal:t}},p=a(33068),l=a(79760),d=a(49952),u=a(11151)},90117(e,t,a){a.d(t,{H4:()=>c,OQ:()=>m,tD:()=>d});var i=a(85608),n=a(51360);function r(e){var t={next:function(){return e.read()}};return n.uJ&&(t[Symbol.asyncIterator]=function(){return this}),t}var o=a(3848),s=a(53570),p=a(37396),l=Object.prototype.hasOwnProperty;function d(e,t){return(0,i.__awaiter)(this,void 0,void 0,function(){var a,o,l,d,c,m,f,h,v,g,y,b,D,x,w,_,E,F,A,C,S,T,k;return(0,i.__generator)(this,function(N){switch(N.label){case 0:if(void 0===TextDecoder)throw Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=null==(k=e.headers)?void 0:k.get("content-type"),l="boundary=",d=(null==o?void 0:o.includes(l))?null==o?void 0:o.substring((null==o?void 0:o.indexOf(l))+l.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",c="\r\n--".concat(d),m="",f=function(e){var t,a,i,o,s,p,l=e;if(e.body&&(l=e.body),t=l,n.uJ&&t[Symbol.asyncIterator])return i=l[Symbol.asyncIterator](),(a={next:function(){return i.next()}})[Symbol.asyncIterator]=function(){return this},a;if(l.getReader)return r(l.getReader());if(l.stream)return r(l.stream().getReader());if(l.arrayBuffer)return o=l.arrayBuffer(),s=!1,p={next:function(){return s?Promise.resolve({value:void 0,done:!0}):(s=!0,new Promise(function(e,t){o.then(function(t){e({value:t,done:!1})}).catch(t)}))}},n.uJ&&(p[Symbol.asyncIterator]=function(){return this}),p;if(l.pipe)return function(e){var t=null,a=null,i=!1,r=[],o=[];function s(e){if(!a){if(o.length){var t=o.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}r.push(e)}}function p(e){a=e,o.slice().forEach(function(t){t[1](e)}),t&&t()}function l(){i=!0,o.slice().forEach(function(e){e[0]({value:void 0,done:!0})}),t&&t()}t=function(){t=null,e.removeListener("data",s),e.removeListener("error",p),e.removeListener("end",l),e.removeListener("finish",l),e.removeListener("close",l)},e.on("data",s),e.on("error",p),e.on("end",l),e.on("finish",l),e.on("close",l);var d={next:function(){return new Promise(function(e,t){return a?t(a):r.length?e({value:r.shift(),done:!1}):i?e({value:void 0,done:!0}):void o.push([e,t])})}};return n.uJ&&(d[Symbol.asyncIterator]=function(){return this}),d}(l);throw Error("Unknown body type for responseIterator. Please pass a streamable response.")}(e),h=!0,N.label=1;case 1:if(!h)return[3,3];return[4,f.next()];case 2:for(g=(v=N.sent()).value,y=v.done,b="string"==typeof g?g:a.decode(g),D=m.length-c.length+1,h=!y,m+=b,x=m.indexOf(c,D);x>-1;){if(w=void 0,w=(S=[m.slice(0,x),m.slice(x+c.length)])[0],m=S[1],_=w.indexOf("\r\n\r\n"),(E=function(e){var t={};return e.split("\n").forEach(function(e){var a=e.indexOf(":");if(a>-1){var i=e.slice(0,a).trim().toLowerCase(),n=e.slice(a+1).trim();t[i]=n}}),t}(w.slice(0,_))["content-type"])&&-1===E.toLowerCase().indexOf("application/json"))throw Error("Unsupported patch content type: application/json is required.");if(F=w.slice(_)){if(Object.keys(A=u(e,F)).length>1||"data"in A||"incremental"in A||"errors"in A||"payload"in A)if((0,p.Nw)(A)){if(C={},"payload"in A){if(1===Object.keys(A).length&&null===A.payload)return[2];C=(0,i.__assign)({},A.payload)}"errors"in A&&(C=(0,i.__assign)((0,i.__assign)({},C),{extensions:(0,i.__assign)((0,i.__assign)({},"extensions"in C?C.extensions:null),((T={})[s.PROTOCOL_ERRORS_SYMBOL]=A.errors,T))})),t(C)}else t(A);else if(1===Object.keys(A).length&&"hasNext"in A&&!A.hasNext)return[2]}x=m.indexOf(c)}return[3,1];case 3:return[2]}})})}function u(e,t){e.status>=300&&(0,o.A)(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status));try{return JSON.parse(t)}catch(a){throw a.name="ServerParseError",a.response=e,a.statusCode=e.status,a.bodyText=t,a}}function c(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}function m(e){return function(t){return t.text().then(function(e){return u(t,e)}).then(function(a){return Array.isArray(a)||l.call(a,"data")||l.call(a,"errors")||(0,o.A)(t,a,"Server response was missing for query '".concat(Array.isArray(e)?e.map(function(e){return e.operationName}):e.operationName,"'.")),a})}}},11151(e,t,a){a.d(t,{E:()=>n});var i=a(63647);function n(e,t){var a=[],n=function(e,t){a.push("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var r=void 0;try{r=(0,i.Y)(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",r)}if(t.extensions){var o=void 0;try{o=(0,i.Y)(t.extensions,"Extensions map")}catch(e){return{parseError:e}}n("extensions",o)}var s="",p=e,l=e.indexOf("#");-1!==l&&(s=e.substr(l),p=e.substr(0,l));var d=-1===p.indexOf("?")?"?":"&";return{newURI:p+d+a.join("&")+s}}},74559(e,t,a){a.d(t,{HY:()=>p,R4:()=>r,Wz:()=>s,i1:()=>o});var i=a(85608),n=a(38678),r={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},o=function(e,t){return t(e)};function s(e,t){for(var a=[],n=2;n<arguments.length;n++)a[n-2]=arguments[n];return a.unshift(t),p.apply(void 0,(0,i.__spreadArray)([e,o],a,!1))}function p(e,t){for(var a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];var o={},s={};a.forEach(function(e){o=(0,i.__assign)((0,i.__assign)((0,i.__assign)({},o),e.options),{headers:(0,i.__assign)((0,i.__assign)({},o.headers),e.headers)}),e.credentials&&(o.credentials=e.credentials),s=(0,i.__assign)((0,i.__assign)({},s),e.http)}),o.headers&&(o.headers=function(e,t){if(!t){var a={};return Object.keys(Object(e)).forEach(function(t){a[t.toLowerCase()]=e[t]}),a}var i={};Object.keys(Object(e)).forEach(function(t){i[t.toLowerCase()]={originalName:t,value:e[t]}});var n={};return Object.keys(i).forEach(function(e){n[i[e].originalName]=i[e].value}),n}(o.headers,s.preserveHeaderCase));var p=e.operationName,l=e.extensions,d=e.variables,u=e.query,c={operationName:p,variables:d};return s.includeExtensions&&(c.extensions=l),s.includeQuery&&(c.query=t(u,n.y)),{options:o,body:c}}},33068(e,t,a){a.d(t,{z:()=>i});var i=function(e,t){var a=e.getContext().uri;return a||("function"==typeof t?t(e):t||"/graphql")}},63647(e,t,a){a.d(t,{Y:()=>n});var i=a(70916),n=function(e,t){var a;try{a=JSON.stringify(e)}catch(e){var n=(0,i.newInvariantError)(42,t,e.message);throw n.parseError=e,n}return a}},16878(e,t,a){a.d(t,{k:()=>n});var i=a(85608);function n(e,t){var a=(0,i.__assign)({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){a="function"==typeof e?(0,i.__assign)((0,i.__assign)({},a),e(a)):(0,i.__assign)((0,i.__assign)({},a),e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return(0,i.__assign)({},a)}}),t}},70783(e,t,a){a.d(t,{X:()=>r});var i=a(85608),n=a(90424);function r(e,t){var a=(0,i.__assign)({},e),r=new Set(Object.keys(e));return(0,n.YR)(t,{Variable:function(e,t,a){a&&"VariableDefinition"!==a.kind&&r.delete(e.name.value)}}),r.forEach(function(e){delete a[e]}),a}},93161(e,t,a){a.d(t,{N:()=>n});var i=a(36054);function n(e){return new i.c(function(t){t.error(e)})}},22594(e,t,a){a.d(t,{S:()=>n});var i=a(36054);function n(e){return new i.c(function(t){e.then(function(e){t.next(e),t.complete()}).catch(t.error.bind(t))})}},25979(e,t,a){a.r(t),a.d(t,{createOperation:()=>p.k,filterOperationVariables:()=>d.X,fromError:()=>i.N,fromPromise:()=>r.S,throwServerError:()=>o.A,toPromise:()=>n.h,transformOperation:()=>l.A,validateOperation:()=>s.K}),a(70916);var i=a(93161),n=a(60441),r=a(22594),o=a(3848),s=a(46192),p=a(16878),l=a(38414),d=a(70783)},3848(e,t,a){a.d(t,{A:()=>i});var i=function(e,t,a){var i=Error(a);throw i.name="ServerError",i.response=e,i.statusCode=e.status,i.result=t,i}},60441(e,t,a){a.d(t,{h:()=>n});var i=a(70916);function n(e){var t=!1;return new Promise(function(a,n){e.subscribe({next:function(e){t?!1!==globalThis.__DEV__&&i.invariant.warn(45):(t=!0,a(e))},error:n})})}},38414(e,t,a){a.d(t,{A:()=>n});var i=a(3777);function n(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?(0,i.n4)(t.query)||void 0:""),t}},46192(e,t,a){a.d(t,{K:()=>n});var i=a(70916);function n(e){for(var t=["query","operationName","variables","extensions","context"],a=0,n=Object.keys(e);a<n.length;a++){var r=n[a];if(0>t.indexOf(r))throw(0,i.newInvariantError)(46,r)}return e}},39283(e,t,a){a.r(t),a.d(t,{disableWarningsSlot:()=>i.yV,maskFragment:()=>n.z,maskOperation:()=>r.m});var i=a(47150),n=a(62959),r=a(28354)},25186(e,t,a){a.d(t,{S:()=>l});var i=a(42455),n=a(57236),r=a(28907),o=a(82307),s=a(47150),p=a(70916);function l(e,t,a){return s.yV.withValue(!0,function(){var l=function e(t,a,n,l,d){var u,c=n.knownChanged,m=function(e,t){if(t.has(e))return t.get(e);var a=Array.isArray(e)?[]:Object.create(null);return t.set(e,a),a}(t,n.mutableTargets);if(Array.isArray(t)){for(var f=0,h=Array.from(t.entries());f<h.length;f++){var v=h[f],g=v[0],y=v[1];if(null===y){m[g]=null;continue}var b=e(y,a,n,l,!1!==globalThis.__DEV__?"".concat(d||"","[").concat(g,"]"):void 0);c.has(b)&&c.add(m),m[g]=b}return c.has(m)?m:t}for(var D=0,x=a.selections;D<x.length;D++){var w=x[D],_=void 0;if(l&&c.add(m),w.kind===i.b.FIELD){var E=(0,r.ue)(w),F=w.selectionSet;if(void 0===(_=m[E]||t[E]))continue;if(F&&null!==_){var b=e(t[E],F,n,l,!1!==globalThis.__DEV__?"".concat(d||"",".").concat(E):void 0);c.has(b)&&(_=b)}!1===globalThis.__DEV__&&(m[E]=_),!1!==globalThis.__DEV__&&(!l||"__typename"===E||(null==(u=Object.getOwnPropertyDescriptor(m,E))?void 0:u.value)?(delete m[E],m[E]=_):Object.defineProperty(m,E,function(e,t,a,i,n){var r=function(){return s.yV.getValue()||(!1!==globalThis.__DEV__&&p.invariant.warn(48,i?"".concat(n," '").concat(i,"'"):"anonymous ".concat(n),"".concat(a,".").concat(e).replace(/^\./,"")),r=function(){return t}),t};return{get:function(){return r()},set:function(e){r=function(){return e}},enumerable:!0,configurable:!0}}(E,_,d||"",n.operationName,n.operationType)))}if(w.kind===i.b.INLINE_FRAGMENT&&(!w.typeCondition||n.cache.fragmentMatches(w,t.__typename))&&(_=e(t,w.selectionSet,n,l,d)),w.kind===i.b.FRAGMENT_SPREAD){var A=w.name.value,C=n.fragmentMap[A]||(n.fragmentMap[A]=n.cache.lookupFragment(A));(0,p.invariant)(C,47,A);var S=(0,o.s7)(w);"mask"!==S&&(_=e(t,C.selectionSet,n,"migrate"===S,d))}c.has(_)&&c.add(m)}return"__typename"in t&&!("__typename"in m)&&(m.__typename=t.__typename),Object.keys(m).length!==Object.keys(t).length&&c.add(m),c.has(m)?m:t}(e,t,a,!1);return Object.isFrozen(e)&&(0,n.G)(l),l})}},62959(e,t,a){a.d(t,{z:()=>d});var i=a(42455),n=a(47150),r=a(70916),o=a(55888),s=a(25186),p=a(2904),l=a(3777);function d(e,t,a,d){if(!a.fragmentMatches)return!1!==globalThis.__DEV__&&(0,n.Ki)(),e;var u=t.definitions.filter(function(e){return e.kind===i.b.FRAGMENT_DEFINITION});void 0===d&&((0,r.invariant)(1===u.length,49,u.length),d=u[0].name.value);var c=u.find(function(e){return e.name.value===d});return((0,r.invariant)(!!c,50,d),null==e||(0,o.default)(e,{}))?e:(0,s.S)(e,c.selectionSet,{operationType:"fragment",operationName:c.name.value,fragmentMap:(0,p.JG)((0,l.zK)(t)),cache:a,mutableTargets:new n.jq,knownChanged:new n.xm})}},28354(e,t,a){a.d(t,{m:()=>p});var i=a(70916),n=a(3777),r=a(2904),o=a(25186),s=a(47150);function p(e,t,a){if(!a.fragmentMatches)return!1!==globalThis.__DEV__&&(0,s.Ki)(),e;var p,l=(0,n.Vu)(t);return((0,i.invariant)(l,51),null==e)?e:(0,o.S)(e,l.selectionSet,{operationType:l.operation,operationName:null==(p=l.name)?void 0:p.value,fragmentMap:(0,r.JG)((0,n.zK)(t)),cache:a,mutableTargets:new s.jq,knownChanged:new s.xm})}},47150(e,t,a){a.d(t,{Ki:()=>d,jq:()=>o,xm:()=>s,yV:()=>p});var i=a(60837),n=a(70916),r=a(51360),o=r.et?WeakMap:Map,s=r.En?WeakSet:Set,p=new i.Slot,l=!1;function d(){l||(l=!0,!1!==globalThis.__DEV__&&n.invariant.warn(52))}},45078(e,t,a){a.d(t,{A:()=>s,V:()=>p});var i=a(54019),n=a(31088),r=new WeakSet;function o(e){!(e.size<=(e.max||-1))&&(r.has(e)||(r.add(e),setTimeout(function(){e.clean(),r.delete(e)},100)))}var s=function(e,t){var a=new i.l(e,t);return a.set=function(e,t){var a=i.l.prototype.set.call(this,e,t);return o(this),a},a},p=function(e,t){var a=new n.C(e,t);return a.set=function(e,t){var a=n.C.prototype.set.call(this,e,t);return o(this),a},a}},44114(e,t,a){a.d(t,{D_:()=>o,cM:()=>p,ep:()=>s,tQ:()=>l});var i=a(85608),n=a(555),r={};function o(e,t){r[e]=t}var s=!1!==globalThis.__DEV__?function(){var e,t,a,o,s;if(!1===globalThis.__DEV__)throw Error("only supported in development mode");return{limits:Object.fromEntries(Object.entries({parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4}).map(function(e){var t=e[0],a=e[1];return[t,n.v[t]||a]})),sizes:(0,i.__assign)({print:null==(e=r.print)?void 0:e.call(r),parser:null==(t=r.parser)?void 0:t.call(r),canonicalStringify:null==(a=r.canonicalStringify)?void 0:a.call(r),links:function e(t){var a;return t?(0,i.__spreadArray)((0,i.__spreadArray)([null==(a=null==t?void 0:t.getMemoryInternals)?void 0:a.call(t)],e(null==t?void 0:t.left),!0),e(null==t?void 0:t.right),!0).filter(c):[]}(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:m(this.queryManager.documentTransform)}},null==(s=(o=this.cache).getMemoryInternals)?void 0:s.call(o))}}:void 0,p=!1!==globalThis.__DEV__?function(){var e=this.config.fragments;return(0,i.__assign)((0,i.__assign)({},d.apply(this)),{addTypenameDocumentTransform:m(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:u(this.storeReader.executeSelectionSet),executeSubSelectedArray:u(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:u(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:u(null==e?void 0:e.findFragmentSpreads),lookup:u(null==e?void 0:e.lookup),transform:u(null==e?void 0:e.transform)}})}:void 0,l=!1!==globalThis.__DEV__?d:void 0;function d(){return{cache:{fragmentQueryDocuments:u(this.getFragmentDoc)}}}function u(e){return e&&"dirtyKey"in e?e.size:void 0}function c(e){return null!=e}function m(e){return(function e(t){return t?(0,i.__spreadArray)((0,i.__spreadArray)([u(null==t?void 0:t.performWork)],e(null==t?void 0:t.left),!0),e(null==t?void 0:t.right),!0).filter(c):[]})(e).map(function(e){return{cache:e}})}},555(e,t,a){a.d(t,{v:()=>o});var i=a(85608),n=a(70916),r=Symbol.for("apollo.cacheSize"),o=(0,i.__assign)({},n.global[r])},73767(e,t,a){a.d(t,{E:()=>n,c:()=>i});var i=Array.isArray;function n(e){return Array.isArray(e)&&e.length>0}},51360(e,t,a){a.d(t,{En:()=>o,JR:()=>u,Sw:()=>l,et:()=>r,ol:()=>s,uJ:()=>p});var i=a(70916),n="ReactNative"==(0,i.maybe)(function(){return navigator.product}),r="function"==typeof WeakMap&&!(n&&!global.HermesInternal),o="function"==typeof WeakSet,s="function"==typeof Symbol&&"function"==typeof Symbol.for,p=s&&Symbol.asyncIterator,l="function"==typeof(0,i.maybe)(function(){return window.document.createElement}),d=(0,i.maybe)(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,u=(l||n)&&!d},44214(e,t,a){a.d(t,{M:()=>s});var i,n=a(45078),r=a(555),o=a(44114),s=Object.assign(function(e){return JSON.stringify(e,p)},{reset:function(){i=new n.V(r.v.canonicalStringify||1e3)}});function p(e,t){if(t&&"object"==typeof t){var a=Object.getPrototypeOf(t);if(a===Object.prototype||null===a){var n=Object.keys(t);if(n.every(l))return t;var r=JSON.stringify(n),o=i.get(r);if(!o){n.sort();var s=JSON.stringify(n);o=i.get(s)||n,i.set(r,o),i.set(s,o)}var p=Object.create(a);return o.forEach(function(e){p[e]=t[e]}),p}}return t}function l(e,t,a){return 0===t||a[t-1]<=e}!1!==globalThis.__DEV__&&(0,o.D_)("canonicalStringify",function(){return i.size}),s.reset()},20906(e,t,a){a.d(t,{m:()=>n});var i=Object.prototype.toString;function n(e){return function e(t,a){switch(i.call(t)){case"[object Array]":if((a=a||new Map).has(t))return a.get(t);var n=t.slice(0);return a.set(t,n),n.forEach(function(t,i){n[i]=e(t,a)}),n;case"[object Object]":if((a=a||new Map).has(t))return a.get(t);var r=Object.create(Object.getPrototypeOf(t));return a.set(t,r),Object.keys(t).forEach(function(i){r[i]=e(t[i],a)}),r;default:return t}}(e)}},50492(e,t,a){a.d(t,{o:()=>i});function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var a=Object.create(null);return e.forEach(function(e){e&&Object.keys(e).forEach(function(t){var i=e[t];void 0!==i&&(a[t]=i)})}),a}},32710(e,t,a){a.d(t,{M:()=>o,t:()=>r});var i=a(73767),n=a(37396);function r(e){var t=o(e);return(0,i.E)(t)}function o(e){var t=(0,i.E)(e.errors)?e.errors.slice(0):[];return(0,n.ST)(e)&&(0,i.E)(e.incremental)&&e.incremental.forEach(function(e){e.errors&&t.push.apply(t,e.errors)}),t}},37396(e,t,a){a.d(t,{EQ:()=>s,Nw:()=>l,ST:()=>o,YX:()=>p,bd:()=>d});var i=a(21777),n=a(73767),r=a(30671);function o(e){return"incremental"in e}function s(e){return"hasNext"in e&&"data"in e}function p(e){return o(e)||s(e)}function l(e){return(0,i.U)(e)&&"payload"in e}function d(e,t){var a=e,i=new r.ZI;return o(t)&&(0,n.E)(t.incremental)&&t.incremental.forEach(function(e){for(var t=e.data,n=e.path,r=n.length-1;r>=0;--r){var o=n[r],s=isNaN(+o)?{}:[];s[o]=t,t=s}a=i.merge(a,t)}),a}},21461(e,t,a){a.d(t,{v:()=>n});var i=new Map;function n(e){var t=i.get(e)||1;return i.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}},57236(e,t,a){a.d(t,{G:()=>n});var i=a(21777);function n(e){var t;return!1!==globalThis.__DEV__&&(t=new Set([e])).forEach(function(e){(0,i.U)(e)&&function(e){if(!1!==globalThis.__DEV__&&!Object.isFrozen(e))try{Object.freeze(e)}catch(e){if(e instanceof TypeError)return null;throw e}return e}(e)===e&&Object.getOwnPropertyNames(e).forEach(function(a){(0,i.U)(e[a])&&t.add(e[a])})}),e}},30671(e,t,a){a.d(t,{D9:()=>o,IM:()=>s,ZI:()=>l});var i=a(85608),n=a(21777),r=Object.prototype.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s(e)}function s(e){var t=e[0]||{},a=e.length;if(a>1)for(var i=new l,n=1;n<a;++n)t=i.merge(t,e[n]);return t}var p=function(e,t,a){return this.merge(e[a],t[a])},l=function(){function e(e){void 0===e&&(e=p),this.reconciler=e,this.isObject=n.U,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var a=this,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];return(0,n.U)(t)&&(0,n.U)(e)?(Object.keys(t).forEach(function(n){if(r.call(e,n)){var s=e[n];if(t[n]!==s){var p=a.reconciler.apply(a,(0,i.__spreadArray)([e,t,n],o,!1));p!==s&&((e=a.shallowCopyForMerge(e))[n]=p)}}else(e=a.shallowCopyForMerge(e))[n]=t[n]}),e):t},e.prototype.shallowCopyForMerge=function(e){return(0,n.U)(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):(0,i.__assign)({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}()},31507(e,t,a){a.d(t,{l:()=>r});var i=a(85608),n=a(50492);function r(e,t){return(0,n.o)(e,t,t.variables&&{variables:(0,n.o)((0,i.__assign)((0,i.__assign)({},e&&e.variables),t.variables))})}},21777(e,t,a){function i(e){return null!==e&&"object"==typeof e}function n(e){return null!==e&&"object"==typeof e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}a.d(t,{Q:()=>n,U:()=>i})},86563(e,t,a){a.d(t,{p:()=>n});var i=a(21461);function n(e,t){void 0===t&&(t=0);var a=(0,i.v)("stringifyForDisplay");return JSON.stringify(e,function(e,t){return void 0===t?a:t},t).split(JSON.stringify(a)).join("<undefined>")}},70916(e,t,a){a.r(t),a.d(t,{invariant:()=>l,__DEV__:()=>h,DEV:()=>h,global:()=>o,InvariantError:()=>i.InvariantError,newInvariantError:()=>d,maybe:()=>r});var i=a(19371),n=a(73972);function r(e){try{return e()}catch(e){}}let o=r(function(){return globalThis})||r(function(){return window})||r(function(){return self})||r(function(){return global})||r(function(){return r.constructor("return this")()});var s=a(86563);function p(e){return function(t){for(var a=[],i=1;i<arguments.length;i++)a[i-1]=arguments[i];if("number"==typeof t){var n=t;(t=m(n))||(t=f(n,a),a=[])}e.apply(void 0,[t].concat(a))}}var l=Object.assign(function(e,t){for(var a=[],n=2;n<arguments.length;n++)a[n-2]=arguments[n];e||(0,i.invariant)(e,m(t,a)||f(t,a))},{debug:p(i.invariant.debug),log:p(i.invariant.log),warn:p(i.invariant.warn),error:p(i.invariant.error)});function d(e){for(var t=[],a=1;a<arguments.length;a++)t[a-1]=arguments[a];return new i.InvariantError(m(e,t)||f(e,t))}var u=Symbol.for("ApolloErrorMessageHandler_"+n.r);function c(e){if("string"==typeof e)return e;try{return(0,s.p)(e,2).slice(0,1e3)}catch(e){return"<non-serializable>"}}function m(e,t){if(void 0===t&&(t=[]),e)return o[u]&&o[u](e,t.map(c))}function f(e,t){if(void 0===t&&(t=[]),e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:n.r,message:e,args:t.map(c)})))}var h=!1!==globalThis.__DEV__},9354(e,t,a){a.d(t,{c:()=>u});var i=a(44592),n=a(51360),r=a(3777),o=a(70916),s=a(54019),p=a(60837),l=a(555);function d(e){return e}var u=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=n.En?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=!1!==t.cache,this.resetCache()}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(d,{cache:!1})},e.split=function(t,a,i){return void 0===i&&(i=e.identity()),Object.assign(new e(function(e){return(t(e)?a:i).transformDocument(e)},{cache:!1}),{left:a,right:i})},e.prototype.resetCache=function(){var t=this;if(this.cached){var a=new i.Trie(n.et);this.performWork=(0,p.wrap)(e.prototype.performWork.bind(this),{makeCacheKey:function(e){var i=t.getCacheKey(e);if(i)return(0,o.invariant)(Array.isArray(i),77),a.lookupArray(i)},max:l.v["documentTransform.cache"],cache:s.l})}},e.prototype.performWork=function(e){return(0,r.sw)(e),this.transform(e)},e.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},e.prototype.concat=function(t){var a=this;return Object.assign(new e(function(e){return t.transformDocument(a.transformDocument(e))},{cache:!1}),{left:this,right:t})},e}()},82307(e,t,a){a.d(t,{I5:()=>l,MS:()=>o,d8:()=>d,f2:()=>u,hE:()=>p,s7:()=>m,sx:()=>s,tY:()=>c});var i=a(70916),n=a(90424),r=a(42455);function o(e,t){var a=e.directives;return!a||!a.length||c(a).every(function(e){var a=e.directive,n=e.ifArgument,r=!1;return"Variable"===n.value.kind?(r=t&&t[n.value.name.value],(0,i.invariant)(void 0!==r,78,a.name.value)):r=n.value.value,"skip"===a.name.value?!r:r})}function s(e){var t=[];return(0,n.YR)(e,{Directive:function(e){t.push(e.name.value)}}),t}var p=function(e,t){return d(e,t,!1)},l=function(e,t){return d(e,t,!0)};function d(e,t,a){var i=new Set(e),r=i.size;return(0,n.YR)(t,{Directive:function(e){if(i.delete(e.name.value)&&(!a||!i.size))return n.sP}}),a?!i.size:i.size<r}function u(e){return e&&d(["client","export"],e,!0)}function c(e){var t=[];return e&&e.length&&e.forEach(function(e){if("skip"===(a=e.name.value)||"include"===a){var a,n=e.arguments,r=e.name.value;(0,i.invariant)(n&&1===n.length,79,r);var o=n[0];(0,i.invariant)(o.name&&"if"===o.name.value,80,r);var s=o.value;(0,i.invariant)(s&&("Variable"===s.kind||"BooleanValue"===s.kind),81,r),t.push({directive:e,ifArgument:o})}}),t}function m(e){var t,a,n=null==(t=e.directives)?void 0:t.find(function(e){return"unmask"===e.name.value});if(!n)return"mask";var o=null==(a=n.arguments)?void 0:a.find(function(e){return"mode"===e.name.value});return(!1!==globalThis.__DEV__&&o&&(o.value.kind===r.b.VARIABLE?!1!==globalThis.__DEV__&&i.invariant.warn(82):o.value.kind!==r.b.STRING?!1!==globalThis.__DEV__&&i.invariant.warn(83):"migrate"!==o.value.value&&!1!==globalThis.__DEV__&&i.invariant.warn(84,o.value.value)),o&&"value"in o.value&&"migrate"===o.value.value)?"migrate":"unmask"}},2904(e,t,a){a.d(t,{HQ:()=>p,JG:()=>s,ct:()=>o,s6:()=>l});var i=a(85608),n=a(70916),r=a(90424);function o(e,t){var a=t,r=[];return e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw(0,n.newInvariantError)(85,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&r.push(e)}),void 0===a&&((0,n.invariant)(1===r.length,86,r.length),a=r[0].name.value),(0,i.__assign)((0,i.__assign)({},e),{definitions:(0,i.__spreadArray)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:a}}]}}],e.definitions,!0)})}function s(e){void 0===e&&(e=[]);var t={};return e.forEach(function(e){t[e.name.value]=e}),t}function p(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var a=e.name.value;if("function"==typeof t)return t(a);var i=t&&t[a];return(0,n.invariant)(i,87,a),i||null;default:return null}}function l(e){var t=!0;return(0,r.YR)(e,{FragmentSpread:function(e){if(!(t=!!e.directives&&e.directives.some(function(e){return"unmask"===e.name.value})))return r.sP}}),t}},3777(e,t,a){a.d(t,{AT:()=>l,E4:()=>d,Vn:()=>u,Vu:()=>o,n4:()=>s,sw:()=>r,wY:()=>c,zK:()=>p});var i=a(70916),n=a(28907);function r(e){(0,i.invariant)(e&&"Document"===e.kind,88);var t=e.definitions.filter(function(e){return"FragmentDefinition"!==e.kind}).map(function(e){if("OperationDefinition"!==e.kind)throw(0,i.newInvariantError)(89,e.kind);return e});return(0,i.invariant)(t.length<=1,90,t.length),e}function o(e){return r(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function s(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&!!e.name}).map(function(e){return e.name.value})[0]||null}function p(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function l(e){var t=o(e);return(0,i.invariant)(t&&"query"===t.operation,91),t}function d(e){(0,i.invariant)("Document"===e.kind,92),(0,i.invariant)(e.definitions.length<=1,93);var t=e.definitions[0];return(0,i.invariant)("FragmentDefinition"===t.kind,94),t}function u(e){r(e);for(var t,a=0,n=e.definitions;a<n.length;a++){var o=n[a];if("OperationDefinition"===o.kind){var s=o.operation;if("query"===s||"mutation"===s||"subscription"===s)return o}"FragmentDefinition"!==o.kind||t||(t=o)}if(t)return t;throw(0,i.newInvariantError)(95)}function c(e){var t=Object.create(null),a=e&&e.variableDefinitions;return a&&a.length&&a.forEach(function(e){e.defaultValue&&(0,n.J)(t,e.variable.name,e.defaultValue)}),t}},38678(e,t,a){a.d(t,{y:()=>p});var i,n=a(95818),r=a(45078),o=a(555),s=a(44114),p=Object.assign(function(e){var t=i.get(e);return t||(t=(0,n.y)(e),i.set(e,t)),t},{reset:function(){i=new r.A(o.v.print||2e3)}});p.reset(),!1!==globalThis.__DEV__&&(0,s.D_)("print",function(){return i?i.size:0})},28907(e,t,a){a.d(t,{A_:()=>p,D$:()=>function e(t,a,i){for(var n,o=0,s=a.selections;o<s.length;o++){var p=s[o];if(g(p)){if("__typename"===p.name.value)return t[v(p)]}else n?n.push(p):n=[p]}if("string"==typeof t.__typename)return t.__typename;if(n)for(var l=0,d=n;l<d.length;l++){var p=d[l],u=e(t,(0,r.HQ)(p,i).selectionSet,i);if("string"==typeof u)return u}},Ii:()=>u,J:()=>d,Kc:()=>l,MB:()=>h,WU:()=>s,dt:()=>g,kd:()=>y,o5:()=>f,ue:()=>v});var i=a(70916),n=a(21777),r=a(2904),o=a(44214);function s(e){return{__ref:String(e)}}function p(e){return!!(e&&"object"==typeof e&&"string"==typeof e.__ref)}function l(e){return(0,n.U)(e)&&"Document"===e.kind&&Array.isArray(e.definitions)}function d(e,t,a,n){if("IntValue"===a.kind||"FloatValue"===a.kind)e[t.value]=Number(a.value);else if("BooleanValue"===a.kind||"StringValue"===a.kind)e[t.value]=a.value;else if("ObjectValue"===a.kind){var r={};a.fields.map(function(e){return d(r,e.name,e.value,n)}),e[t.value]=r}else if("Variable"===a.kind){var o=(n||{})[a.name.value];e[t.value]=o}else if("ListValue"===a.kind)e[t.value]=a.values.map(function(e){var a={};return d(a,t,e,n),a[t.value]});else if("EnumValue"===a.kind)e[t.value]=a.value;else if("NullValue"===a.kind)e[t.value]=null;else throw(0,i.newInvariantError)(96,t.value,a.kind)}function u(e,t){var a=null;e.directives&&(a={},e.directives.forEach(function(e){a[e.name.value]={},e.arguments&&e.arguments.forEach(function(i){var n=i.name,r=i.value;return d(a[e.name.value],n,r,t)})}));var i=null;return e.arguments&&e.arguments.length&&(i={},e.arguments.forEach(function(e){var a=e.name,n=e.value;return d(i,a,n,t)})),f(e.name.value,i,a)}var c=["connection","include","skip","client","rest","export","nonreactive"],m=o.M,f=Object.assign(function(e,t,a){if(t&&a&&a.connection&&a.connection.key)if(!a.connection.filter||!(a.connection.filter.length>0))return a.connection.key;else{var i=a.connection.filter?a.connection.filter:[];i.sort();var n={};return i.forEach(function(e){n[e]=t[e]}),"".concat(a.connection.key,"(").concat(m(n),")")}var r=e;if(t){var o=m(t);r+="(".concat(o,")")}return a&&Object.keys(a).forEach(function(e){-1===c.indexOf(e)&&(a[e]&&Object.keys(a[e]).length?r+="@".concat(e,"(").concat(m(a[e]),")"):r+="@".concat(e))}),r},{setStringify:function(e){var t=m;return m=e,t}});function h(e,t){if(e.arguments&&e.arguments.length){var a={};return e.arguments.forEach(function(e){return d(a,e.name,e.value,t)}),a}return null}function v(e){return e.alias?e.alias.value:e.name.value}function g(e){return"Field"===e.kind}function y(e){return"InlineFragment"===e.kind}},53925(e,t,a){a.d(t,{TC:()=>b,XY:()=>h,er:()=>x,hX:()=>g,it:()=>y,iz:()=>f,x3:()=>w,zc:()=>D});var i=a(85608),n=a(70916),r=a(42455),o=a(90424),s=a(3777),p=a(28907),l=a(2904),d=a(73767),u={kind:r.b.FIELD,name:{kind:r.b.NAME,value:"__typename"}};function c(e){return!function e(t,a){return!t||t.selectionSet.selections.every(function(t){return t.kind===r.b.FRAGMENT_SPREAD&&e(a[t.name.value],a)})}((0,s.Vu)(e)||(0,s.E4)(e),(0,l.JG)((0,s.zK)(e)))?e:null}function m(e){var t=new Map;return function(a){void 0===a&&(a=e);var i=t.get(a);return i||t.set(a,i={variables:new Set,fragmentSpreads:new Set}),i}}function f(e,t){(0,s.sw)(t);for(var a,p,l=m(""),u=m(""),f=function(e){for(var t=0,a=void 0;t<e.length&&(a=e[t]);++t)if(!(0,d.c)(a)){if(a.kind===r.b.OPERATION_DEFINITION)return l(a.name&&a.name.value);if(a.kind===r.b.FRAGMENT_DEFINITION)return u(a.name.value)}return!1!==globalThis.__DEV__&&n.invariant.error(97),null},h=0,v=t.definitions.length-1;v>=0;--v)t.definitions[v].kind===r.b.OPERATION_DEFINITION&&++h;var g=(a=new Map,p=new Map,e.forEach(function(e){e&&(e.name?a.set(e.name,e):e.test&&p.set(e.test,e))}),function(e){var t=a.get(e.name.value);return!t&&p.size&&p.forEach(function(a,i){i(e)&&(t=a)}),t}),y=function(e){return(0,d.E)(e)&&e.map(g).some(function(e){return e&&e.remove})},b=new Map,D=!1,x={enter:function(e){if(y(e.directives))return D=!0,null}},w=(0,o.YR)(t,{Field:x,InlineFragment:x,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(e,t,a,i,n){var r=f(n);r&&r.variables.add(e.name.value)}},FragmentSpread:{enter:function(e,t,a,i,n){if(y(e.directives))return D=!0,null;var r=f(n);r&&r.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,a,i){b.set(JSON.stringify(i),e)},leave:function(e,t,a,i){return e===b.get(JSON.stringify(i))?e:h>0&&e.selectionSet.selections.every(function(e){return e.kind===r.b.FIELD&&"__typename"===e.name.value})?(u(e.name.value).removed=!0,D=!0,null):void 0}},Directive:{leave:function(e){if(g(e))return D=!0,null}}});if(!D)return t;var _=function(e){return!e.transitiveVars&&(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach(function(t){_(u(t)).transitiveVars.forEach(function(t){e.transitiveVars.add(t)})})),e},E=new Set;w.definitions.forEach(function(e){e.kind===r.b.OPERATION_DEFINITION?_(l(e.name&&e.name.value)).fragmentSpreads.forEach(function(e){E.add(e)}):e.kind!==r.b.FRAGMENT_DEFINITION||0!==h||u(e.name.value).removed||E.add(e.name.value)}),E.forEach(function(e){_(u(e)).fragmentSpreads.forEach(function(e){E.add(e)})});var F={enter:function(e){var t;if(t=e.name.value,!E.has(t)||u(t).removed)return null}};return c((0,o.YR)(w,{FragmentSpread:F,FragmentDefinition:F,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=_(l(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return(0,i.__assign)((0,i.__assign)({},e),{variableDefinitions:e.variableDefinitions.filter(function(e){return t.has(e.variable.name.value)})})}}}}))}var h=Object.assign(function(e){return(0,o.YR)(e,{SelectionSet:{enter:function(e,t,a){if(!a||a.kind!==r.b.OPERATION_DEFINITION){var n=e.selections;if(!(!n||n.some(function(e){return(0,p.dt)(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))&&!((0,p.dt)(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,i.__assign)((0,i.__assign)({},e),{selections:(0,i.__spreadArray)((0,i.__spreadArray)([],n,!0),[u],!1)})}}}})},{added:function(e){return e===u}}),v={test:function(e){var t="connection"===e.name.value;return!t||e.arguments&&e.arguments.some(function(e){return"key"===e.name.value})||!1===globalThis.__DEV__||n.invariant.warn(98),t}};function g(e){return f([v],(0,s.sw)(e))}function y(e,t){var a=function(t){return e.some(function(e){return t.value&&t.value.kind===r.b.VARIABLE&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))})};return c((0,o.YR)(t,{OperationDefinition:{enter:function(t){return(0,i.__assign)((0,i.__assign)({},t),{variableDefinitions:t.variableDefinitions?t.variableDefinitions.filter(function(t){return!e.some(function(e){return e.name===t.variable.name.value})}):[]})}},Field:{enter:function(t){if(e.some(function(e){return e.remove})){var i=0;if(t.arguments&&t.arguments.forEach(function(e){a(e)&&(i+=1)}),1===i)return null}}},Argument:{enter:function(e){if(a(e))return null}}}))}function b(e,t){function a(t){if(e.some(function(e){return e.name===t.name.value}))return null}return c((0,o.YR)(t,{FragmentSpread:{enter:a},FragmentDefinition:{enter:a}}))}function D(e){return"query"===(0,s.Vn)(e).operation?e:(0,o.YR)(e,{OperationDefinition:{enter:function(e){return(0,i.__assign)((0,i.__assign)({},e),{operation:"query"})}}})}function x(e){return(0,s.sw)(e),f([{test:function(e){return"client"===e.name.value},remove:!0}],e)}function w(e){return(0,s.sw)(e),(0,o.YR)(e,{FragmentSpread:function(e){var t;if(null==(t=e.directives)||!t.some(function(e){return"unmask"===e.name.value}))return(0,i.__assign)((0,i.__assign)({},e),{directives:(0,i.__spreadArray)((0,i.__spreadArray)([],e.directives||[],!0),[{kind:r.b.DIRECTIVE,name:{kind:r.b.NAME,value:"nonreactive"}}],!1)})}})}},5437(e,t,a){a.r(t),a.d(t,{DEV:()=>i.DEV,concatPagination:()=>g,getInclusionDirectives:()=>n.tY,makeReference:()=>l.WU,shouldInclude:()=>n.MS,createFragmentMap:()=>o.JG,AutoCleanedStrongCache:()=>J.V,hasAllDirectives:()=>n.I5,AutoCleanedWeakCache:()=>J.A,canUseWeakMap:()=>R.et,getFragmentFromSelection:()=>o.HQ,storeKeyNameFromField:()=>l.Ii,getOperationDefinition:()=>s.Vu,isArray:()=>$.c,checkDocument:()=>s.sw,getFragmentMaskMode:()=>n.s7,maybe:()=>i.maybe,valueToObjectRepresentation:()=>l.J,mergeDeepArray:()=>v.IM,getDirectiveNames:()=>n.sx,isExecutionPatchInitialResult:()=>U.EQ,graphQLResultHasError:()=>B.t,resultKeyNameFromField:()=>l.ue,hasDirectives:()=>n.d8,isPlainObject:()=>j.Q,isNonNullObject:()=>j.U,mergeOptions:()=>M.l,canUseAsyncIteratorSymbol:()=>R.uJ,isReference:()=>l.A_,DeepMerger:()=>v.ZI,maybeDeepFreeze:()=>T.G,getFragmentDefinition:()=>s.E4,getTypenameFromResult:()=>l.D$,iterateObserversSafely:()=>k.w,getOperationName:()=>s.n4,removeDirectivesFromDocument:()=>d.iz,isStatefulPromise:()=>F,isInlineFragment:()=>l.kd,canUseWeakSet:()=>R.En,mergeDeep:()=>v.D9,omitDeep:()=>G,isQueryOperation:()=>m,print:()=>p.y,createRejectedPromise:()=>E,getStoreKeyName:()=>l.o5,removeFragmentSpreadFromDocument:()=>d.TC,removeArgumentsFromDocument:()=>d.it,fixObservableSubclass:()=>I.r,createFulfilledPromise:()=>_,canUseSymbol:()=>R.ol,getFragmentQueryDocument:()=>o.ct,removeConnectionDirectiveFromDocument:()=>d.hX,stringifyForDisplay:()=>L.p,wrapPromiseWithState:()=>A,relayStylePagination:()=>b,isNonEmptyArray:()=>$.E,getFragmentDefinitions:()=>s.zK,isExecutionPatchIncrementalResult:()=>U.ST,buildQueryFromSelectionSet:()=>d.zc,preventUnhandledRejection:()=>C.X,stripTypename:()=>Y,canUseDOM:()=>R.Sw,canUseLayoutEffect:()=>R.JR,isApolloPayloadResult:()=>U.Nw,DocumentTransform:()=>r.c,addTypenameToDocument:()=>d.XY,canonicalStringify:()=>q.M,Concast:()=>O.E,Observable:()=>w.c,argumentsObjectFromField:()=>l.MB,getDefaultValues:()=>s.wY,isField:()=>l.dt,hasClientExports:()=>n.f2,offsetLimitPagination:()=>y,removeClientSetsFromDocument:()=>d.er,isDocumentNode:()=>l.Kc,compact:()=>V.o,getGraphQLErrorsFromResult:()=>B.M,addNonReactiveToNamedFragments:()=>d.x3,getQueryDefinition:()=>s.AT,isExecutionPatchResult:()=>U.YX,asyncMap:()=>N.x,isFullyUnmaskedOperation:()=>o.s6,hasAnyDirectives:()=>n.hE,getMainDefinition:()=>s.Vn,isMutationOperation:()=>c,cloneDeep:()=>S.m,isSubscriptionOperation:()=>f,cacheSizes:()=>Q.v,makeUniqueId:()=>P.v,mergeIncrementalData:()=>U.bd});var i=a(70916),n=a(82307),r=a(9354),o=a(2904),s=a(3777),p=a(38678),l=a(28907),d=a(53925);function u(e,t){var a;return(null==(a=(0,s.Vu)(e))?void 0:a.operation)===t}function c(e){return u(e,"mutation")}function m(e){return u(e,"query")}function f(e){return u(e,"subscription")}var h=a(85608),v=a(30671);function g(e){return void 0===e&&(e=!1),{keyArgs:e,merge:function(e,t){return e?(0,h.__spreadArray)((0,h.__spreadArray)([],e,!0),t,!0):t}}}function y(e){return void 0===e&&(e=!1),{keyArgs:e,merge:function(e,t,a){var i=a.args,n=e?e.slice(0):[];if(t)if(i)for(var r=i.offset,o=void 0===r?0:r,s=0;s<t.length;++s)n[o+s]=t[s];else n.push.apply(n,t);return n}}}function b(e){return void 0===e&&(e=!1),{keyArgs:e,read:function(e,t){var a=t.canRead,i=t.readField;if(!e)return e;var n=[],r="",o="";e.edges.forEach(function(e){a(i("node",e))&&(n.push(e),e.cursor&&(r=r||e.cursor||"",o=e.cursor||o))}),n.length>1&&r===o&&(r="");var s=e.pageInfo||{},p=s.startCursor,l=s.endCursor;return(0,h.__assign)((0,h.__assign)({},D(e)),{edges:n,pageInfo:(0,h.__assign)((0,h.__assign)({},e.pageInfo),{startCursor:p||r,endCursor:l||o})})},merge:function(e,t,a){var i=a.args,n=a.isReference,r=a.readField;if(e||(e={edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}),!t)return e;var o=t.edges?t.edges.map(function(e){return n(e=(0,h.__assign)({},e))&&(e.cursor=r("cursor",e)),e}):[];if(t.pageInfo){var s=t.pageInfo,p=s.startCursor,l=s.endCursor,d=o[0],u=o[o.length-1];d&&p&&(d.cursor=p),u&&l&&(u.cursor=l);var c=d&&d.cursor;c&&!p&&(t=(0,v.D9)(t,{pageInfo:{startCursor:c}}));var m=u&&u.cursor;m&&!l&&(t=(0,v.D9)(t,{pageInfo:{endCursor:m}}))}var f=e.edges,g=[];if(i&&i.after){var y=f.findIndex(function(e){return e.cursor===i.after});y>=0&&(f=f.slice(0,y+1))}else if(i&&i.before){var y=f.findIndex(function(e){return e.cursor===i.before});g=y<0?f:f.slice(y),f=[]}else t.edges&&(f=[]);var b=(0,h.__spreadArray)((0,h.__spreadArray)((0,h.__spreadArray)([],f,!0),o,!0),g,!0),x=(0,h.__assign)((0,h.__assign)({},t.pageInfo),e.pageInfo);if(t.pageInfo){var w=t.pageInfo,_=w.hasPreviousPage,E=w.hasNextPage,p=w.startCursor,l=w.endCursor;Object.assign(x,(0,h.__rest)(w,["hasPreviousPage","hasNextPage","startCursor","endCursor"])),f.length||(void 0!==_&&(x.hasPreviousPage=_),void 0!==p&&(x.startCursor=p)),g.length||(void 0!==E&&(x.hasNextPage=E),void 0!==l&&(x.endCursor=l))}return(0,h.__assign)((0,h.__assign)((0,h.__assign)({},D(e)),D(t)),{edges:b,pageInfo:x})}}}var D=function(e){return(0,h.__rest)(e,x)},x=["edges","pageInfo"],w=a(36054);function _(e){var t=Promise.resolve(e);return t.status="fulfilled",t.value=e,t}function E(e){var t=Promise.reject(e);return t.catch(function(){}),t.status="rejected",t.reason=e,t}function F(e){return"status"in e}function A(e){return F(e)||(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e}var C=a(30234),S=a(20906),T=a(57236),k=a(87613),N=a(5762),O=a(45637),I=a(35892),$=a(73767),j=a(21777),B=a(32710),R=a(51360),V=a(50492),P=a(21461),L=a(86563),M=a(31507),U=a(37396),q=a(44214);function G(e,t){return z(e,t)}function z(e,t,a){if(void 0===a&&(a=new Map),a.has(e))return a.get(e);var i=!1;if(Array.isArray(e)){var n=[];if(a.set(e,n),e.forEach(function(e,r){var o=z(e,t,a);i||(i=o!==e),n[r]=o}),i)return n}else if((0,j.Q)(e)){var r=Object.create(Object.getPrototypeOf(e));if(a.set(e,r),Object.keys(e).forEach(function(n){if(n===t){i=!0;return}var o=z(e[n],t,a);i||(i=o!==e[n]),r[n]=o}),i)return r}return e}function Y(e){return z(e,"__typename")}var J=a(45078),Q=a(555)},45637(e,t,a){a.d(t,{E:()=>p});var i=a(85608),n=a(36054),r=a(87613),o=a(35892);function s(e){return e&&"function"==typeof e.then}var p=function(e){function t(t){var a=e.call(this,function(e){return a.addObserver(e),function(){return a.removeObserver(e)}})||this;return a.observers=new Set,a.promise=new Promise(function(e,t){a.resolve=e,a.reject=t}),a.handlers={next:function(e){null!==a.sub&&(a.latest=["next",e],a.notify("next",e),(0,r.w)(a.observers,"next",e))},error:function(e){var t=a.sub;null!==t&&(t&&setTimeout(function(){return t.unsubscribe()}),a.sub=null,a.latest=["error",e],a.reject(e),a.notify("error",e),(0,r.w)(a.observers,"error",e))},complete:function(){var e=a.sub,t=a.sources;if(null!==e){var i=(void 0===t?[]:t).shift();i?s(i)?i.then(function(e){return a.sub=e.subscribe(a.handlers)},a.handlers.error):a.sub=i.subscribe(a.handlers):(e&&setTimeout(function(){return e.unsubscribe()}),a.sub=null,a.latest&&"next"===a.latest[0]?a.resolve(a.latest[1]):a.resolve(),a.notify("complete"),(0,r.w)(a.observers,"complete"))}}},a.nextResultListeners=new Set,a.cancel=function(e){a.reject(e),a.sources=[],a.handlers.error(e)},a.promise.catch(function(e){}),"function"==typeof t&&(t=[new n.c(t)]),s(t)?t.then(function(e){return a.start(e)},a.handlers.error):a.start(t),a}return(0,i.__extends)(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],a=e[t];a&&a.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e))},t.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},t.prototype.notify=function(e,t){var a=this.nextResultListeners;a.size&&(this.nextResultListeners=new Set,a.forEach(function(a){return a(e,t)}))},t.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add(function(a,i){t||(t=!0,e(a,i))})},t}(n.c);(0,o.r)(p)},5762(e,t,a){a.d(t,{x:()=>n});var i=a(36054);function n(e,t,a){return new i.c(function(i){var n={then:function(e){return new Promise(function(t){return t(e())})}};function r(e,t){return function(a){if(e){var r=function(){return i.closed?0:e(a)};n=n.then(r,r).then(function(e){return i.next(e)},function(e){return i.error(e)})}else i[t](a)}}var o={next:r(t,"next"),error:r(a,"error"),complete:function(){n.then(function(){return i.complete()})}},s=e.subscribe(o);return function(){return s.unsubscribe()}})}},87613(e,t,a){a.d(t,{w:()=>i});function i(e,t,a){var i=[];e.forEach(function(e){return e[t]&&i.push(e)}),i.forEach(function(e){return e[t](a)})}},35892(e,t,a){a.d(t,{r:()=>r});var i=a(36054),n=a(51360);function r(e){function t(t){Object.defineProperty(e,t,{value:i.c})}return n.ol&&Symbol.species&&t(Symbol.species),t("@@species"),e}},30234(e,t,a){a.d(t,{X:()=>i});function i(e){return e.catch(function(){}),e}},73972(e,t,a){a.d(t,{r:()=>i});var i="3.13.8"},88958(e,t,i){let n;i.d(t,{kv:()=>ef,lJ:()=>eN,hF:()=>eI});let r=(e,t=[])=>"up"===e.name||t.includes("vim")&&"k"===e.name||t.includes("emacs")&&e.ctrl&&"p"===e.name,o=(e,t=[])=>"down"===e.name||t.includes("vim")&&"j"===e.name||t.includes("emacs")&&e.ctrl&&"n"===e.name,s=e=>"enter"===e.name||"return"===e.name;class p extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(e){super(),this.cause=e?.cause}}class l extends Error{name="CancelPromptError";message="Prompt was canceled"}class d extends Error{name="ExitPromptError"}class u extends Error{name="HookError"}class c extends Error{name="ValidationError"}let m=a("node:async_hooks"),f=new m.AsyncLocalStorage;function h(){let e=f.getStore();if(!e)throw new u("[Inquirer] Hook functions can only be called from within a prompt");return e}function v(e){return m.AsyncResource.bind((...t)=>{let a=h(),i=!1,n=a.handleChange;a.handleChange=()=>{i=!0};let r=e(...t);return i&&n(),a.handleChange=n,r})}function g(e){let t=h(),{index:a}=t,i=e({get:()=>t.hooks[a],set(e){t.hooks[a]=e},initialized:a in t.hooks});return t.index++,i}let y={queue(e){let t=h(),{index:a}=t;t.hooksEffect.push(()=>{t.hooksCleanup[a]?.();let i=e(h().rl);if(null!=i&&"function"!=typeof i)throw new c("useEffect return value must be a cleanup function or nothing.");t.hooksCleanup[a]=i})},run(){let e=h();v(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=h();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function b(e){return g(t=>{let a=m.AsyncResource.bind(function(e){t.get()!==e&&(t.set(e),h().handleChange())});if(t.initialized)return[t.get(),a];let i="function"==typeof e?e():e;return t.set(i),[i,a]})}function D(e,t){g(a=>{let i=a.get();(!Array.isArray(i)||t.some((e,t)=>!Object.is(e,i[t])))&&y.queue(e),a.set(t)})}var x=i(57504),w=i(1708);let _={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"\xbd",oneThird:"⅓",oneQuarter:"\xbc",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"\xbe",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},E={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},F={..._,...E},A={..._,tick:"√",info:"i",warning:"‼",cross:"\xd7",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(\xd7)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xd7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xd7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},C=("win32"!==w.platform?"linux"===w.env.TERM:!w.env.WT_SESSION&&!w.env.TERMINUS_SUBLIME&&"{cmd::Cmder}"!==w.env.ConEmuTask&&"Terminus-Sublime"!==w.env.TERM_PROGRAM&&"vscode"!==w.env.TERM_PROGRAM&&"xterm-256color"!==w.env.TERM&&"alacritty"!==w.env.TERM&&"JetBrains-JediTerm"!==w.env.TERMINAL_EMULATOR)?A:F;Object.entries(E);let S={prefix:{idle:x.blue("?"),done:x.green(C.tick)},spinner:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"].map(e=>x.yellow(e))},style:{answer:x.cyan,message:x.bold,error:e=>x.red(`> ${e}`),defaultAnswer:e=>x.dim(`(${e})`),help:x.dim,highlight:x.cyan,key:e=>x.cyan(x.bold(`<${e}>`))}};function T(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function k(...e){return function e(...t){let a={};for(let i of t)for(let[t,n]of Object.entries(i)){let i=a[t];a[t]=T(i)&&T(n)?e(i,n):n}return a}(S,...e.filter(e=>null!=e))}function N({status:e="idle",theme:t}){let[a,i]=b(!1),[n,r]=b(0),{prefix:o,spinner:s}=k(t);if(D(()=>{if("loading"===e){let e,t=-1,a=setTimeout(()=>{i(!0),e=setInterval(()=>{r((t+=1)%s.frames.length)},s.interval)},300);return()=>{clearTimeout(a),clearInterval(e)}}i(!1)},[e]),a)return s.frames[n];let p="loading"===e?"idle":e;return"string"==typeof o?o:o[p]??o.idle}function O(e,t){return g(a=>{let i=a.get();if(!i||i.dependencies.length!==t.length||i.dependencies.some((e,a)=>e!==t[a])){let i=e();return a.set({value:i,dependencies:t}),i}return i.value})}function I(e){return b({current:e})[0]}function $(e){let t=I(e);t.current=e,D(e=>{let a=!1,i=v((i,n)=>{a||t.current(n,e)});return e.input.on("keypress",i),()=>{a=!0,e.input.removeListener("keypress",i)}},[])}var j=i(74),B=i(61893);function R(e,t){return e.split("\n").flatMap(e=>B(e,t,{trim:!1,hard:!0}).split("\n").map(e=>e.trimEnd())).join("\n")}function V(){return j({defaultWidth:80,output:h().rl.output})}function P({items:e,active:t,renderItem:a,pageSize:i,loop:n=!0}){let r=V(),o=t=>(t%e.length+e.length)%e.length,s=e.map((e,i)=>null==e?[]:R(a({item:e,index:i,isActive:i===t}),r).split("\n")),p=s.reduce((e,t)=>e+t.length,0),l=e=>s[e]??[],d=function({active:e,renderedItems:t,pageSize:a,loop:i}){let n=I({lastPointer:e,lastActive:void 0}),{lastPointer:r,lastActive:o}=n.current,s=Math.floor(a/2),p=t.reduce((e,t)=>e+t.length,0),l=t.slice(0,e).reduce((e,t)=>e+t.length,0),d=l;if(p>a)if(i)d=r,null!=o&&o<e&&e-o<a&&(d=Math.min(s,1===Math.abs(e-o)?Math.min(r+(t[o]?.length??0),Math.max(l,r)):r+e-o));else{let i=t.slice(e).reduce((e,t)=>e+t.length,0);d=i<a-s?a-i:Math.min(l,s)}return n.current.lastPointer=d,n.current.lastActive=e,d}({active:t,renderedItems:s,pageSize:i,loop:n}),u=l(t).slice(0,i),c=d+u.length<=i?d:i-u.length,m=Array.from({length:i});m.splice(c,u.length,...u);let f=new Set([t]),h=c+u.length,v=o(t+1);for(;h<i&&!f.has(v)&&(n&&p>i?v!==t:v>t);){let e=l(v).slice(0,i-h);m.splice(h,e.length,...e),f.add(v),h+=e.length,v=o(v+1)}for(h=c-1,v=o(t-1);h>=0&&!f.has(v)&&(n&&p>i?v!==t:v<t);){let e=l(v),t=e.slice(Math.max(0,e.length-h-1));m.splice(h-t.length+1,t.length,...t),f.add(v),h-=t.length,v=o(v-1)}return m.filter(e=>"string"==typeof e).join("\n")}let L=a("node:readline");var M=i(83329);let U=[];U.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&U.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&U.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");let q=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,G=Symbol.for("signal-exit emitter"),z=globalThis,Y=Object.defineProperty.bind(Object);class J{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(z[G])return z[G];Y(z,G,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let a=this.listeners[e],i=a.indexOf(t);-1!==i&&(0===i&&1===a.length?a.length=0:a.splice(i,1))}emit(e,t,a){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let n of this.listeners[e])i=!0===n(t,a)||i;return"exit"===e&&(i=this.emit("afterExit",t,a)||i),i}}class Q{}class W extends Q{#i="win32"===H.platform?"SIGINT":"SIGHUP";#n=new J;#r;#o;#s;#p={};#l=!1;constructor(e){for(let t of(super(),this.#r=e,this.#p={},U))this.#p[t]=()=>{let a=this.#r.listeners(t),{count:i}=this.#n;if("object"==typeof e.__signal_exit_emitter__&&"number"==typeof e.__signal_exit_emitter__.count&&(i+=e.__signal_exit_emitter__.count),a.length===i){this.unload();let a=this.#n.emit("exit",null,t),i="SIGHUP"===t?this.#i:t;a||e.kill(e.pid,i)}};this.#s=e.reallyExit,this.#o=e.emit}onExit(e,t){if(!q(this.#r))return()=>{};!1===this.#l&&this.load();let a=t?.alwaysLast?"afterExit":"exit";return this.#n.on(a,e),()=>{this.#n.removeListener(a,e),0===this.#n.listeners.exit.length&&0===this.#n.listeners.afterExit.length&&this.unload()}}load(){if(!this.#l){for(let e of(this.#l=!0,this.#n.count+=1,U))try{let t=this.#p[e];t&&this.#r.on(e,t)}catch(e){}this.#r.emit=(e,...t)=>this.#d(e,...t),this.#r.reallyExit=e=>this.#u(e)}}unload(){this.#l&&(this.#l=!1,U.forEach(e=>{let t=this.#p[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#r.removeListener(e,t)}catch(e){}}),this.#r.emit=this.#o,this.#r.reallyExit=this.#s,this.#n.count-=1)}#u(e){return q(this.#r)?(this.#r.exitCode=e||0,this.#n.emit("exit",this.#r.exitCode,null),this.#s.call(this.#r,this.#r.exitCode)):0}#d(e,...t){let a=this.#o;if(!("exit"===e&&q(this.#r)))return a.call(this.#r,e,...t);{"number"==typeof t[0]&&(this.#r.exitCode=t[0]);let i=a.call(this.#r,e,...t);return this.#n.emit("exit",this.#r.exitCode,null),i}}}let H=globalThis.process,{onExit:K,load:X,unload:Z}=(n=q(H)?new W(H):new class extends Q{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>n.onExit(e,t),load:()=>n.load(),unload:()=>n.unload()});var ee=i(57975);let et=(e=1)=>e>0?`\u001B[${e}A`:"",ea=(e=1)=>e>0?`\u001B[${e}B`:"",ei=(e,t)=>"number"!=typeof t||Number.isNaN(t)?`\u001B[${e+1}G`:`\u001B[${t+1};${e+1}H`,en="\x1b[2K",er=e=>e>0?(en+et(1)).repeat(e-1)+en+"\x1b[G":"";class eo{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(e){this.rl=e,this.cursorPos=e.getCursorPos()}write(e){this.rl.output.unmute(),this.rl.output.write(e),this.rl.output.mute()}render(e,t=""){let a=e.split("\n").pop()??"",i=(0,ee.stripVTControlCharacters)(a),n=i;this.rl.line.length>0&&(n=n.slice(0,-this.rl.line.length)),this.rl.setPrompt(n),this.cursorPos=this.rl.getCursorPos();let r=V();e=R(e,r),t=R(t,r),i.length%r==0&&(e+="\n");let o=e+(t?"\n"+t:""),s=Math.floor(i.length/r)-this.cursorPos.rows+(t?t.split("\n").length:0);s>0&&(o+=et(s)),o+=ei(this.cursorPos.cols),this.write(ea(this.extraLinesUnderPrompt)+er(this.height)+o),this.extraLinesUnderPrompt=s,this.height=o.split("\n").length}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(ei(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt("");let t=ea(this.extraLinesUnderPrompt);t+=e?er(this.height):"\n",t+="\x1b[?25h",this.write(t),this.rl.close()}}class es extends Promise{static withResolver(){let e,t;return{promise:new Promise((a,i)=>{e=a,t=i}),resolve:e,reject:t}}}function ep(e){let t=function(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,a)=>{let i=a.slice(1);return t=i,i},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}();return(a,i={})=>{let{input:n=process.stdin,signal:r}=i,o=new Set,s=new M;s.pipe(i.output??process.stdout);let u=L.createInterface({terminal:!0,input:n,output:s}),c=new eo(u),{promise:h,resolve:v,reject:g}=es.withResolver(),b=()=>g(new l);if(r){let e=()=>g(new p({cause:r.reason}));if(r.aborted)return e(),Object.assign(h,{cancel:b});r.addEventListener("abort",e),o.add(()=>r.removeEventListener("abort",e))}o.add(K((e,t)=>{g(new d(`User force closed the prompt with ${e} ${t}`))}));let D=()=>g(new d("User force closed the prompt with SIGINT"));u.on("SIGINT",D),o.add(()=>u.removeListener("SIGINT",D));let x=()=>c.checkCursorPos();u.input.on("keypress",x),o.add(()=>u.input.removeListener("keypress",x));let w={rl:u,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}};return f.run(w,()=>{var n;let r;return n=function(e){w.handleChange=()=>{w.index=0,e()},w.handleChange()},r=m.AsyncResource.bind(()=>y.clearAll()),u.on("close",r),o.add(()=>u.removeListener("close",r)),n(()=>{try{let i=e(a,e=>{setImmediate(()=>v(e))});if(void 0===i){let e=t[1]?.getFileName();throw Error(`Prompt functions must return a string.
|
|
19
19
|
at ${e}`)}let[n,r]="string"==typeof i?[i]:i;c.render(n,r),y.run()}catch(e){g(e)}}),Object.assign(h.then(e=>(y.clearAll(),e),e=>{throw y.clearAll(),e}).finally(()=>{o.forEach(e=>e()),c.done({clearContent:!!i.clearPromptOnDone}),s.end()}).then(()=>h),{cancel:b})})}}class el{separator=x.dim(Array.from({length:15}).join(C.line));type="separator";constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&"object"==typeof e&&"type"in e&&"separator"===e.type)}}let ed={icon:{checked:x.green(C.circleFilled),unchecked:C.circle,cursor:C.pointer},style:{disabledChoice:e=>x.dim(`- ${e}`),renderSelectedChoices:e=>e.map(e=>e.short).join(", "),description:e=>x.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${x.bold(e)} ${x.dim(t)}`).join(x.dim(" • "))},helpMode:"always",keybindings:[]};function eu(e){return!el.isSeparator(e)&&!e.disabled}function ec(e){return eu(e)&&e.checked}function em(e){return eu(e)?{...e,checked:!e.checked}:e}let ef=ep((e,t)=>{let a,i,{instructions:n,pageSize:p=7,loop:l=!0,required:d,validate:u=()=>!0}=e,m={all:"a",invert:"i",...e.shortcuts},f=k(ed,e.theme),{keybindings:h}=f,[v,g]=b("idle"),y=N({status:v,theme:f}),[D,x]=b(e.choices.map(e=>{if(el.isSeparator(e))return e;if("string"==typeof e)return{value:e,name:e,short:e,checkedName:e,disabled:!1,checked:!1};let t=e.name??String(e.value),a={value:e.value,name:t,short:e.short??t,checkedName:e.checkedName??t,disabled:e.disabled??!1,checked:e.checked??!1};return e.description&&(a.description=e.description),a})),w=O(()=>{let e=D.findIndex(eu),t=D.findLastIndex(eu);if(-1===e)throw new c("[checkbox prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[D]),[_,E]=b(w.first),[F,A]=b();$(async e=>{if(s(e)){let e=D.filter(ec),a=await u([...e]);d&&!D.some(ec)?A("At least one choice must be selected"):!0===a?(g("done"),t(e.map(e=>e.value))):A(a||"You must select a valid value")}else if(r(e,h)||o(e,h)){if(l||r(e,h)&&_!==w.first||o(e,h)&&_!==w.last){let t=r(e,h)?-1:1,a=_;do a=(a+t+D.length)%D.length;while(!eu(D[a]));E(a)}}else if("space"===e.name)A(void 0),x(D.map((e,t)=>t===_?em(e):e));else if(e.name===m.all){let e=D.some(e=>eu(e)&&!e.checked);x(D.map(function(t){return eu(t)?{...t,checked:e}:t}))}else if(e.name===m.invert)x(D.map(em));else if("1234567890".includes(e.name)){let t=Number(e.name)-1,a=-1,i=D.findIndex(e=>!el.isSeparator(e)&&++a===t),n=D[i];n&&eu(n)&&(E(i),x(D.map((e,t)=>t===i?em(e):e)))}});let C=f.style.message(e.message,v),S=P({items:D,active:_,renderItem({item:e,isActive:t}){if(el.isSeparator(e))return` ${e.separator}`;if(e.disabled){let t="string"==typeof e.disabled?e.disabled:"(disabled)";return f.style.disabledChoice(`${e.name} ${t}`)}t&&(a=e.description);let i=e.checked?f.icon.checked:f.icon.unchecked,n=e.checked?e.checkedName:e.name,r=t?f.style.highlight:e=>e,o=t?f.icon.cursor:" ";return r(`${o}${i} ${n}`)},pageSize:p,loop:l});if("done"===v){let e=D.filter(ec);return[y,C,f.style.answer(f.style.renderSelectedChoices(e,D))].filter(Boolean).join(" ")}if("never"!==f.helpMode&&!1!==n)if("string"==typeof n)i=n;else{let e=[["↑↓","navigate"],["space","select"]];m.all&&e.push([m.all,"all"]),m.invert&&e.push([m.invert,"invert"]),e.push(["⏎","submit"]),i=f.style.keysHelpTip(e)}let T=[[y,C].filter(Boolean).join(" "),S," ",a?f.style.description(a):"",F?f.style.error(F):"",i].filter(Boolean).join("\n").trimEnd();return`${T}\u001b[?25l`});var eh=i(68023),ev=i(35317),eg=i(79896),ey=i(76760),eb=i(48161),eD=i(77598),ex=i(65679);class ew extends Error{originalError;constructor(e){super(`Failed to create temporary file. ${e.message}`),this.originalError=e}}class e_ extends Error{originalError;constructor(e){super(`Failed to launch editor. ${e.message}`),this.originalError=e}}class eE extends Error{originalError;constructor(e){super(`Failed to read temporary file. ${e.message}`),this.originalError=e}}class eF extends Error{originalError;constructor(e){super(`Failed to remove temporary file. ${e.message}`),this.originalError=e}}function eA(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}class eC{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(e="",t){this.text=e,t&&(this.fileOptions=t),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(e){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(e,void 0,this.text)}catch(t){setImmediate(e,t,void 0)}})}catch(t){setImmediate(e,t,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let e=(function(e){let t=[],a="";for(let i=0;i<e.length;i++){let n=e.charAt(i);i>0&&" "===n&&"\\"!==e[i-1]&&a.length>0?(t.push(a),a=""):a=`${a}${n}`}return a.length>0&&t.push(a),t})(process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim").map(e=>e.replace("\\ "," ")),t=e.shift();this.editor={args:e,bin:t}}createTemporaryFile(){try{let e=this.fileOptions.dir??eb.tmpdir(),t=(0,eD.randomUUID)(),a=eA(this.fileOptions.prefix),i=eA(this.fileOptions.postfix),n=`${a}${t}${i}`,r=ey.resolve(e,n),o=ey.resolve(e)+ey.sep;if(!r.startsWith(o))throw Error("Resolved temporary file escaped the base directory");this.tempFile=r;let s={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(s.mode=this.fileOptions.mode),(0,eg.writeFileSync)(this.tempFile,this.text,s)}catch(e){throw new ew(e)}}readTemporaryFile(){try{let e=(0,eg.readFileSync)(this.tempFile);if(0===e.length)this.text="";else{let t=(0,eh.detect)(e)??"utf8";ex.encodingExists(t)||(t="utf8"),this.text=ex.decode(e,t)}}catch(e){throw new eE(e)}}removeTemporaryFile(){try{(0,eg.unlinkSync)(this.tempFile)}catch(e){throw new eF(e)}}launchEditor(){try{let e=(0,ev.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=e.status??0}catch(e){throw new e_(e)}}launchEditorAsync(e){try{(0,ev.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",t=>{this.lastExitStatus=t,setImmediate(e)})}catch(e){throw new e_(e)}}}let eS={validationFailureMode:"keep"};function eT(e,t){let a=!1!==t;return/^(y|yes)/i.test(e)?a=!0:/^(n|no)/i.test(e)&&(a=!1),a}function ek(e){return e?"Yes":"No"}ep((e,t)=>{let{waitForUserInput:a=!0,file:{postfix:i=e.postfix??".txt",...n}={},validate:r=()=>!0}=e,o=k(eS,e.theme),[p,l]=b("idle"),[d="",u]=b(e.default),[c,m]=b(),f=N({status:p,theme:o});function h(a){a.pause();let s=async(i,n)=>{if(a.resume(),i)m(i.toString());else{l("loading");let a=n??"",i=await r(a);!0===i?(m(void 0),l("done"),t(a)):("clear"===o.validationFailureMode?u(e.default):u(a),m(i||"You must provide a valid value"),l("idle"))}};!function(e="",t,a){let i=new eC(e,a);i.runAsync((e,a)=>{if(e)setImmediate(t,e,void 0);else try{i.cleanup(),setImmediate(t,void 0,a)}catch(e){setImmediate(t,e,void 0)}})}(d,(e,t)=>void s(e,t),{postfix:i,...n})}D(e=>{a||h(e)},[]),$((e,t)=>{"idle"===p&&s(e)&&h(t)});let v=o.style.message(e.message,p),g="";if("loading"===p)g=o.style.help("Received");else if("idle"===p){let e=o.style.key("enter");g=o.style.help(`Press ${e} to launch your preferred editor.`)}let y="";return c&&(y=o.style.error(c)),[[f,v,g].filter(Boolean).join(" "),y]});let eN=ep((e,t)=>{let{transformer:a=ek}=e,[i,n]=b("idle"),[r,o]=b(""),p=k(e.theme),l=N({status:i,theme:p});$((p,l)=>{if("idle"===i)if(s(p)){let i=eT(r,e.default);o(a(i)),n("done"),t(i)}else if("tab"===p.name){let t=ek(!eT(r,e.default));l.clearLine(0),l.write(t),o(t)}else o(l.line)});let d=r,u="";"done"===i?d=p.style.answer(r):u=` ${p.style.defaultAnswer(!1===e.default?"y/N":"Y/n")}`;let c=p.style.message(e.message,i);return`${l} ${c}${u} ${d}`}),eO={validationFailureMode:"keep"},eI=ep((e,t)=>{let a,{prefill:i="tab"}=e,n=k(eO,e.theme),[r,o]=b("idle"),[p="",l]=b(e.default),[d,u]=b(),[c,m]=b(""),f=N({status:r,theme:n});async function h(t){let{required:a,pattern:i,patternError:n="Invalid input"}=e;return a&&!t?"You must provide a value":i&&!i.test(t)?n:"function"!=typeof e.validate||await e.validate(t)||"You must provide a valid value"}$(async(e,a)=>{if("idle"===r)if(s(e)){let e=c||p;o("loading");let i=await h(e);!0===i?(m(e),o("done"),t(e)):("clear"===n.validationFailureMode?m(""):a.write(c),u(i),o("idle"))}else"backspace"!==e.name||c?"tab"!==e.name||c?(m(a.line),u(void 0)):(l(void 0),a.clearLine(0),a.write(p),m(p)):l(void 0)}),D(e=>{"editable"===i&&p&&(e.write(p),m(p))},[]);let v=n.style.message(e.message,r),g=c;"function"==typeof e.transformer?g=e.transformer(c,{isFinal:"done"===r}):"done"===r&&(g=n.style.answer(c)),p&&"done"!==r&&!c&&(a=n.style.defaultAnswer(p));let y="";return d&&(y=n.style.error(d)),[[f,v,a,g].filter(e=>void 0!==e).join(" "),y]});function e$(e,{min:t,max:a,step:i}){return!(null==e||Number.isNaN(e))&&(e<t||e>a?`Value must be between ${t} and ${a}`:"any"===i||(1e6*e-(Number.isFinite(t)?1e6*t:0))%(1e6*i)==0||`Value must be a multiple of ${i}${Number.isFinite(t)?` starting from ${t}`:""}`)}ep((e,t)=>{let a,{validate:i=()=>!0,min:n=-1/0,max:r=1/0,step:o=1,required:p=!1}=e,l=k(e.theme),[d,u]=b("idle"),[c,m]=b(""),[f="",h]=b(!0===e$(e.default,{min:n,max:r,step:o})?e.default?.toString():void 0),[v,g]=b(),y=N({status:d,theme:l});$(async(e,a)=>{if("idle"===d)if(s(e)){let e=c||f,s=""===e?void 0:Number(e);u("loading");let l=!0;(p||null!=s)&&(l=e$(s,{min:n,max:r,step:o})),!0===l&&(l=await i(s)),!0===l?(m(String(s??"")),u("done"),t(s)):(a.write(c),g(l||"You must provide a valid numeric value"),u("idle"))}else"backspace"!==e.name||c?"tab"!==e.name||c?(m(a.line),g(void 0)):(h(void 0),a.clearLine(0),a.write(f),m(f)):h(void 0)});let D=l.style.message(e.message,d),x=c;"done"===d&&(x=l.style.answer(c)),f&&"done"!==d&&!c&&(a=l.style.defaultAnswer(f));let w="";return v&&(w=l.style.error(v)),[[y,D,a,x].filter(e=>void 0!==e).join(" "),w]});let ej={key:"h",name:"Help, list all options",value:void 0};ep((e,t)=>{let{default:a="h"}=e,i=O(()=>e.choices.map(e=>{if(el.isSeparator(e))return e;let t="name"in e?e.name:String(e.value);return{value:"value"in e?e.value:t,name:t,key:e.key.toLowerCase()}}),[e.choices]),[n,r]=b("idle"),[o,p]=b(""),[l,d]=b(e.expanded??!1),[u,c]=b(),m=k(e.theme),f=N({theme:m,status:n});$((e,n)=>{if(s(e)){let e=(o||a).toLowerCase();if("h"!==e||l){let a=i.find(t=>!el.isSeparator(t)&&t.key===e);a?(r("done"),p(e),t(a.value)):""===o?c("Please input a value"):c(`"${x.red(o)}" isn't an available option`)}else d(!0)}else p(n.line),c(void 0)});let h=m.style.message(e.message,n);if("done"===n){let e=i.find(e=>!el.isSeparator(e)&&e.key===o.toLowerCase());return`${f} ${h} ${m.style.answer(e.name)}`}let v=l?i:[...i,ej],g="",y=v.map(e=>el.isSeparator(e)?"":e.key===a?e.key.toUpperCase():e.key).join("");y=` ${m.style.defaultAnswer(y)}`,l&&(y="",g=v.map(e=>{if(el.isSeparator(e))return` ${e.separator}`;let t=` ${e.key}) ${e.name}`;return e.key===o.toLowerCase()?m.style.highlight(t):t}).join("\n"));let D="",w=i.find(e=>!el.isSeparator(e)&&e.key===o.toLowerCase());w&&(D=`${x.cyan(">>")} ${w.name}`);let _="";return u&&(_=m.style.error(u)),[`${f} ${h}${y} ${o}`,[g,D,_].filter(Boolean).join("\n")]});let eB=/\d+/;function eR(e){return null!=e&&!el.isSeparator(e)}function eV(e,t){let a,i=t.filter(eR);return!(a=i.find(t=>t.key===e))&&eB.test(e)&&(a=i[Number.parseInt(e,10)-1]),a?[a,t.indexOf(a)]:[void 0,void 0]}ep((e,t)=>{let{loop:a=!0}=e,i=O(()=>{var t;let a;return t=e.choices,a=0,t.map(e=>{if(el.isSeparator(e))return e;if(a+=1,"string"==typeof e)return{value:e,name:e,short:e,key:String(a)};let t=e.name??String(e.value);return{value:e.value,name:t,short:e.short??t,key:e.key??String(a)}})},[e.choices]),[n,p]=b("idle"),[l,d]=b(""),[u,m]=b(),f=k(e.theme),h=N({status:n,theme:f}),v=O(()=>{let e=i.findIndex(eR),t=i.findLastIndex(eR);if(-1===e)throw new c("[select prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[i]);$((e,n)=>{if(s(e)){let[e]=eV(l,i);eR(e)?(d(e.short),p("done"),t(e.value)):""===l?m("Please input a value"):m(`"${x.red(l)}" isn't an available option`)}else if(r(e)||o(e)){n.clearLine(0);let[t,s]=eV(l,i);if(t){if(a||r(e)&&s!==v.first||o(e)&&s!==v.last){let t=r(e)?-1:1,a=s;do a=(a+t+i.length)%i.length;while(!eR(i[a]));d(i[a].key)}}else d((o(e)?i.find(eR):i.findLast(eR)).key)}else d(n.line),m(void 0)});let g=f.style.message(e.message,n);if("done"===n)return`${h} ${g} ${f.style.answer(l)}`;let y=i.map(e=>{if(el.isSeparator(e))return` ${e.separator}`;let t=` ${e.key}) ${e.name}`;return e.key===l.toLowerCase()?f.style.highlight(t):t}).join("\n"),D="";return u&&(D=f.style.error(u)),[`${h} ${g} ${l}`,[y,D].filter(Boolean).join("\n")]}),ep((e,t)=>{let a,{validate:i=()=>!0}=e,n=k(e.theme),[r,o]=b("idle"),[p,l]=b(),[d,u]=b(""),c=N({status:r,theme:n});$(async(e,a)=>{if("idle"===r)if(s(e)){o("loading");let e=await i(d);!0===e?(u(d),o("done"),t(d)):(a.write(d),l(e||"You must provide a valid value"),o("idle"))}else u(a.line),l(void 0)});let m=n.style.message(e.message,r),f="";e.mask?f=("string"==typeof e.mask?e.mask:"*").repeat(d.length):"done"!==r&&(a=`${n.style.help("[input is masked]")}\u001b[?25l`),"done"===r&&(f=n.style.answer(f));let h="";return p&&(h=n.style.error(p)),[[c,m,e.mask?f:a].join(" "),h]});let eP={icon:{cursor:C.pointer},style:{disabled:e=>x.dim(`- ${e}`),searchTerm:e=>x.cyan(e),description:e=>x.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${x.bold(e)} ${x.dim(t)}`).join(x.dim(" • "))},helpMode:"always"};function eL(e){return!el.isSeparator(e)&&!e.disabled}ep((e,t)=>{let a,i,n,{pageSize:p=7,validate:l=()=>!0}=e,d=k(eP,e.theme),[u,c]=b("loading"),[m,f]=b(""),[h,v]=b([]),[g,y]=b(),x=N({status:u,theme:d}),w=O(()=>({first:h.findIndex(eL),last:h.findLastIndex(eL)}),[h]),[_=w.first,E]=b();D(()=>{let t=new AbortController;return c("loading"),y(void 0),(async()=>{try{let a=await e.source(m||void 0,{signal:t.signal});t.signal.aborted||(E(void 0),y(void 0),v(a.map(e=>{if(el.isSeparator(e))return e;if("string"==typeof e)return{value:e,name:e,short:e,disabled:!1};let t=e.name??String(e.value),a={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(a.description=e.description),a})),c("idle"))}catch(e){!t.signal.aborted&&e instanceof Error&&y(e.message)}})(),()=>{t.abort()}},[m]);let F=h[_];$(async(e,a)=>{if(s(e))if(F){c("loading");let e=await l(F.value);c("idle"),!0===e?(c("done"),t(F.value)):F.name===m?y(e||"You must provide a valid value"):(a.write(F.name),f(F.name))}else a.write(m);else if("tab"===e.name&&F)a.clearLine(0),a.write(F.name),f(F.name);else if("loading"!==u&&(r(e)||o(e))){if(a.clearLine(0),r(e)&&_!==w.first||o(e)&&_!==w.last){let t=r(e)?-1:1,a=_;do a=(a+t+h.length)%h.length;while(!eL(h[a]));E(a)}}else f(a.line)});let A=d.style.message(e.message,u);if("never"!==d.helpMode)if(e.instructions){let{pager:t,navigation:i}=e.instructions;a=d.style.help(h.length>p?t:i)}else a=d.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]);let C=P({items:h,active:_,renderItem({item:e,isActive:t}){if(el.isSeparator(e))return` ${e.separator}`;if(e.disabled){let t="string"==typeof e.disabled?e.disabled:"(disabled)";return d.style.disabled(`${e.name} ${t}`)}let a=t?d.style.highlight:e=>e,i=t?d.icon.cursor:" ";return a(`${i} ${e.name}`)},pageSize:p,loop:!1});if(g?i=d.style.error(g):0===h.length&&""!==m&&"idle"===u&&(i=d.style.error("No results found")),"done"===u&&F)return[x,A,d.style.answer(F.short)].filter(Boolean).join(" ").trimEnd();n=d.style.searchTerm(m);let S=F?.description;return[[x,A,n].filter(Boolean).join(" ").trimEnd(),[i??C," ",S?d.style.description(S):"",a].filter(Boolean).join("\n").trimEnd()]});let eM={icon:{cursor:C.pointer},style:{disabled:e=>x.dim(`- ${e}`),description:e=>x.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${x.bold(e)} ${x.dim(t)}`).join(x.dim(" • "))},helpMode:"always",indexMode:"hidden",keybindings:[]};function eU(e){return!el.isSeparator(e)&&!e.disabled}ep((e,t)=>{let a,{loop:i=!0,pageSize:n=7}=e,p=k(eM,e.theme),{keybindings:l}=p,[d,u]=b("idle"),m=N({status:d,theme:p}),f=I(),h=!l.includes("vim"),v=O(()=>e.choices.map(e=>{if(el.isSeparator(e))return e;if("string"==typeof e)return{value:e,name:e,short:e,disabled:!1};let t=e.name??String(e.value),a={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(a.description=e.description),a}),[e.choices]),g=O(()=>{let e=v.findIndex(eU),t=v.findLastIndex(eU);if(-1===e)throw new c("[select prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[v]),y=O(()=>"default"in e?v.findIndex(t=>eU(t)&&t.value===e.default):-1,[e.default,v]),[x,w]=b(-1===y?g.first:y),_=v[x];$((e,a)=>{if(clearTimeout(f.current),s(e))u("done"),t(_.value);else if(r(e,l)||o(e,l)){if(a.clearLine(0),i||r(e,l)&&x!==g.first||o(e,l)&&x!==g.last){let t=r(e,l)?-1:1,a=x;do a=(a+t+v.length)%v.length;while(!eU(v[a]));w(a)}}else if("1234567890".includes(e.name)&&!Number.isNaN(Number(a.line))){let e=Number(a.line)-1,t=-1,i=v.findIndex(a=>!el.isSeparator(a)&&++t===e),n=v[i];null!=n&&eU(n)&&w(i),f.current=setTimeout(()=>{a.clearLine(0)},700)}else if("backspace"===e.name)a.clearLine(0);else if(h){let e=a.line.toLowerCase(),t=v.findIndex(t=>!el.isSeparator(t)&&!!eU(t)&&t.name.toLowerCase().startsWith(e));-1!==t&&w(t),f.current=setTimeout(()=>{a.clearLine(0)},700)}}),D(()=>()=>{clearTimeout(f.current)},[]);let E=p.style.message(e.message,d);if("never"!==p.helpMode)if(e.instructions){let{pager:t,navigation:i}=e.instructions;a=p.style.help(v.length>n?t:i)}else a=p.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]);let F=0,A=P({items:v,active:x,renderItem({item:e,isActive:t,index:a}){if(el.isSeparator(e))return F++,` ${e.separator}`;let i="number"===p.indexMode?`${a+1-F}. `:"";if(e.disabled){let t="string"==typeof e.disabled?e.disabled:"(disabled)";return p.style.disabled(`${i}${e.name} ${t}`)}let n=t?p.style.highlight:e=>e,r=t?p.icon.cursor:" ";return n(`${r} ${i}${e.name}`)},pageSize:n,loop:i});if("done"===d)return[m,E,p.style.answer(_.short)].filter(Boolean).join(" ");let{description:C}=_,S=[[m,E].filter(Boolean).join(" "),A," ",C?p.style.description(C):"",a].filter(Boolean).join("\n").trimEnd();return`${S}\u001b[?25l`})},31088(e,t,a){function i(){}a.d(t,{C:()=>n});class n{constructor(e=1/0,t=i){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){let t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){let t=this.map.get(e);if(t&&t!==this.newest){let{older:e,newer:a}=t;a&&(a.older=e),e&&(e.newer=a),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=a)}return t}set(e,t){let a=this.getNode(e);return a?a.value=t:(a={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=a),this.newest=a,this.oldest=this.oldest||a,this.map.set(e,a),a.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){let t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}}},54019(e,t,a){function i(){}a.d(t,{l:()=>s});let n="u">typeof WeakRef?WeakRef:function(e){return{deref:()=>e}},r="u">typeof WeakMap?WeakMap:Map,o="u">typeof FinalizationRegistry?FinalizationRegistry:function(){return{register:i,unregister:i}};class s{constructor(e=1/0,t=i){this.max=e,this.dispose=t,this.map=new r,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{let e=this.unfinalizedNodes.values();for(let t=0;t<10024;t++){let t=e.next().value;if(!t)break;this.unfinalizedNodes.delete(t);let a=t.key;delete t.key,t.keyRef=new n(a),this.registry.register(a,t,t)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new o(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){let t=this.getNode(e);return t&&t.value}getNode(e){let t=this.map.get(e);if(t&&t!==this.newest){let{older:e,newer:a}=t;a&&(a.older=e),e&&(e.newer=a),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=a)}return t}set(e,t){let a=this.getNode(e);return a?a.value=t:(a={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=a),this.newest=a,this.oldest=this.oldest||a,this.scheduleFinalization(a),this.map.set(e,a),this.size++,a.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;let t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){let t=this.map.get(e);return!!t&&(this.deleteNode(t),!0)}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}},55888(e,t,a){a.r(t),a.d(t,{default:()=>p,equal:()=>s});let{toString:i,hasOwnProperty:n}=Object.prototype,r=Function.prototype.toString,o=new Map;function s(e,t){try{return function e(t,a){if(t===a)return!0;let o=i.call(t);if(o!==i.call(a))return!1;switch(o){case"[object Array]":if(t.length!==a.length)break;case"[object Object]":{if(c(t,a))return!0;let i=l(t),r=l(a),o=i.length;if(o!==r.length)return!1;for(let e=0;e<o;++e)if(!n.call(a,i[e]))return!1;for(let n=0;n<o;++n){let r=i[n];if(!e(t[r],a[r]))return!1}return!0}case"[object Error]":return t.name===a.name&&t.message===a.message;case"[object Number]":if(t!=t)return a!=a;case"[object Boolean]":case"[object Date]":return+t==+a;case"[object RegExp]":case"[object String]":return t==`${a}`;case"[object Map]":case"[object Set]":{if(t.size!==a.size)return!1;if(c(t,a))return!0;let i=t.entries(),n="[object Map]"===o;for(;;){let t=i.next();if(t.done)break;let[r,o]=t.value;if(!a.has(r)||n&&!e(o,a.get(r)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),a=new Uint8Array(a);case"[object DataView]":{let e=t.byteLength;if(e===a.byteLength)for(;e--&&t[e]===a[e];);return -1===e}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{var s,p;let e,i=r.call(t);if(i!==r.call(a))return!1;return s=i,p=u,!((e=s.length-p.length)>=0)||s.indexOf(p,e)!==e}}return!1}(e,t)}finally{o.clear()}}let p=s;function l(e){return Object.keys(e).filter(d,e)}function d(e){return void 0!==this[e]}let u="{ [native code] }";function c(e,t){let a=o.get(e);if(a){if(a.has(t))return!0}else o.set(e,a=new Set);return a.add(t),!1}},44592(e,t,a){a.r(t),a.d(t,{Trie:()=>s});let i=()=>Object.create(null),{forEach:n,slice:r}=Array.prototype,{hasOwnProperty:o}=Object.prototype;class s{constructor(e=!0,t=i){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return n.call(e,e=>t=t.getChildTrie(e)),o.call(t,"data")?t.data:t.data=this.makeData(r.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let a=0,i=e.length;t&&a<i;++a){let i=t.mapFor(e[a],!1);t=i&&i.get(e[a])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){let a=e[0],i=this.mapFor(a,!1),n=i&&i.get(a);n&&(t=n.removeArray(r.call(e,1)),n.data||n.weak||n.strong&&n.strong.size||i.delete(a))}else t=this.data,delete this.data;return t}getChildTrie(e){let t=this.mapFor(e,!0),a=t.get(e);return a||t.set(e,a=new s(this.weakness,this.makeData)),a}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}},98247(e,t,a){a.d(t,{v:()=>b});var i,n,r,o=a(99436),s=a(35679),p=a(73284),l=a(30155),d=a(47988),u=a(92642),c=a(94979),m=a(16928),f=a(79896);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)}var v=()=>{var e=(0,d.getCurrentProfile)(),t=(0,d.getToken)(e);return t||(console.error(p.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,u.W)((0,d.getActivityLogBaseUrl)(),t)},g=e=>new Date(e).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z"),y=(e,t)=>{if(!e)return"";var a="string"==typeof e?e:JSON.stringify(e);return a.length>t?a.slice(0,t-1)+"…":a},b=new s.uB("activity-log").alias("al").description("Activity log queries (read-only)");b.command("events").description("Query activity log events (all types)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("--device <id>","Filter by device ID").option("--type <type>","Filter by event type: general, data, local_sync").option("--event-name <name>","Filter by event name").option("--subspace <id>","Filter by subspace ID").option("--sender <id>","Filter by sender").option("--limit <n>","Max events to display",parseInt).option("-j, --json","Output as JSON array").option("--jsonl","Output as JSONL (one JSON per line)").action((i=o(function*(e){var t=v(),a=(o=(0,c.p)(e.startTime),new Date(s=e.endTime?(0,c.p)(e.endTime):new Date().toISOString())-new Date(o)>2592e6&&(console.error(p.Ay.red("Time range must be 30 days or less")),process.exit(1)),d={start_time:o,end_time:s},e.device&&(d.device_id=e.device),e.type&&(d.event_type=e.type),e.eventName&&(d.event_name=e.eventName),e.subspace&&(d.subspace_id=e.subspace),e.sender&&(d.sender=e.sender),d);if(e.jsonl){var i=0;try{var n=!1,r=!1;try{for(var o,s,d,u,m,f=function(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")}(t.events(a));n=!(m=yield f.next()).done;n=!1){var b=m.value;if(console.log(JSON.stringify(b)),i++,e.limit&&i>=e.limit)break}}catch(e){r=!0,u=e}finally{try{n&&null!=f.return&&(yield f.return())}finally{if(r)throw u}}}catch(e){console.error(p.Ay.red(`Failed to query events: ${e.message}`)),process.exit(1)}return}var D=(0,l.default)("Querying events...").start();try{var x=yield t.collectEvents(a,{limit:e.limit});if(D.stop(),e.json)return void console.log(JSON.stringify(x,null,2));if(0===x.length)return void console.log(p.Ay.yellow("No events found"));for(var w of(console.log(p.Ay.bold(`
|
|
20
20
|
Activity Log Events (${x.length})`)),console.log("─".repeat(100)),console.log(p.Ay.gray(`${"Timestamp".padEnd(24)} ${"Type".padEnd(12)} ${"Device".padEnd(14)} ${"Event Name".padEnd(28)} ${"Sender".padEnd(16)} Payload`)),console.log("─".repeat(100)),x)){var _=g(w.timestamp),E=(w.event_type||"").padEnd(12),F=y(w.device_id,14).padEnd(14),A=y(w.event_name,28).padEnd(28),C=y(w.sender,16).padEnd(16),S=y(w.payload,40);console.log(`${_} ${E} ${F} ${A} ${C} ${p.Ay.gray(S)}`)}console.log("─".repeat(100))}catch(e){D.fail(`Failed to query events: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),b.command("screenshots").description("List screenshot timestamps for a device").requiredOption("--device <id>","Device ID (required)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("-j, --json","Output as JSON").action((n=o(function*(e){var t=v(),a=(0,c.p)(e.startTime),i=e.endTime?(0,c.p)(e.endTime):new Date().toISOString();new Date(i)-new Date(a)>2592e6&&(console.error(p.Ay.red("Time range must be 30 days or less")),process.exit(1));var n={device_id:e.device,start_time:a,end_time:i},r=(0,l.default)("Querying screenshots...").start();try{var o=yield t.collectScreenshots(n);if(r.stop(),e.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(p.Ay.yellow("No screenshots found"));console.log(p.Ay.bold(`
|
|
21
|
-
Screenshots (${o.length})`)),console.log("─".repeat(
|
|
21
|
+
Screenshots (${o.length})`)),console.log("─".repeat(56)),console.log(p.Ay.gray(`${"#".padStart(4)} ${"Timestamp".padEnd(24)} --ts value`)),console.log("─".repeat(56)),o.forEach((e,t)=>{var a=new Date(e.timestamp).getTime();console.log(`${String(t+1).padStart(4)} ${g(e.timestamp).padEnd(24)} ${a}`)}),console.log("─".repeat(56))}catch(e){r.fail(`Failed to query screenshots: ${e.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),b.command("screenshot").description("Download a screenshot image").requiredOption("--device <id>","Device ID").requiredOption("--ts <timestamp>","Screenshot timestamp (ISO 8601 or epoch ms)").option("--space <id>","Workspace/space ID (auto-detected from profile)").option("-o, --output <path>","Output file path").option("--open","Open with OS default viewer after download").action((r=o(function*(e){var t,i,n=v(),r=e.space||(t=(0,d.getCurrentProfile)(),i=(0,d.getTokenInfo)(t),i?.workspaceId);r||(console.error(p.Ay.red("Could not determine workspace ID. Use --space <id> or log in first.")),process.exit(1));var o=/^\d+$/.test(e.ts)?e.ts:new Date(e.ts).getTime(),s=(0,l.default)("Downloading screenshot...").start();try{var u=yield n.downloadScreenshot(r,e.device,o);s.stop();var c=e.output||`screenshot-${e.device}-${o}.jpg`,h=m.resolve(c);f.writeFileSync(h,u);var g=(u.length/1024).toFixed(1);if(console.log(p.Ay.green(`✓ Screenshot saved: ${h} (${g} KB)`)),e.open){var y=(yield Promise.resolve().then(a.t.bind(a,35317,19))).exec,b="darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open";y(`${b} "${h}"`)}}catch(e){s.fail(`Failed to download screenshot: ${e.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},17422(e,t,a){a.d(t,{B:()=>O});var i,n,r,o,s,p,l,d,u,c,m,f,h,v,g,y,b,D=a(99436),x=a(35679),w=a(73284),_=a(30155),E=a(79896),F=a(44618),A=a(7586),C=a(56493),S=a(68168),T=a(74049),k=a(98593),N=(e,t)=>(0,k.H_)(e,t,{currentVersion:e?.current_version||null,unreleasedChanges:!!e?.has_unreleased_changes}),O=new x.uB("app").description("Application management");O.command("new").description("Create a new application").requiredOption("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--layout-width <width>","Layout width",parseInt).option("--layout-height <height>","Layout height",parseInt).option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((i=D(function*(e){var t=(0,C.o)(),i=e.json?null:(0,_.default)("Creating application...").start();try{var n={name:e.name};e.description&&(n.description=e.description),e.layoutWidth&&(n.layoutWidth=e.layoutWidth),e.layoutHeight&&(n.layoutHeight=e.layoutHeight);var r=yield t.createApplication(n);if(e.json&&!e.init?console.log(JSON.stringify(r,null,2)):!e.json&&(i.succeed(`Application created: ${w.Ay.green(r.name)}`),console.log(` ID: ${w.Ay.gray(r._id)}`),r.description&&console.log(` ${w.Ay.gray(r.description)}`)),e.init){i&&i.stop();var o=(yield a.e(456).then(a.bind(a,58891))).initProject;yield o("application",r._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):i.fail(`Failed to create application: ${t.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),O.command("share-info <applicationId>").description("Show public share info (releases available for share-new) for an application").option("-j, --json","Output as JSON").action((n=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.default)("Fetching share info...").start();try{var n=yield a.publicApplicationShareInfo({id:e});if(i&&i.stop(),!n)return void(t.json?console.log(JSON.stringify(null)):console.log(w.Ay.yellow("No share info found for this application")));if(t.json)return void console.log(JSON.stringify(n,null,2));var r=[...n.share?.selected_releases||[]].sort((e,t)=>new Date(t.date||0)-new Date(e.date||0));console.log(w.Ay.bold(`
|
|
22
22
|
Share Info: ${n.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`App ID: ${w.Ay.gray(n._id)}`),n.description&&console.log(`Description: ${n.description}`),n.owner?.id_from_user&&console.log(`Owner: ${w.Ay.gray(n.owner.id_from_user)}`),n.share?.tags?.length&&console.log(`Tags: ${n.share.tags.join(", ")}`),n.share?.type&&console.log(`Type: ${n.share.type}`),console.log(`
|
|
23
23
|
${w.Ay.bold("Selected Releases")} (${r.length})`),0===r.length?console.log(w.Ay.gray(" None")):r.forEach(e=>{console.log(`
|
|
24
24
|
${w.Ay.cyan(e.name||"(unnamed)")} ${w.Ay.gray(e.date||"")}`),console.log(` Version ID: ${w.Ay.green(e.version)}`),console.log(` Release ID: ${w.Ay.gray(e._id)}`),e.note&&console.log(` Note: ${w.Ay.gray(e.note)}`)}),console.log("\n"+"─".repeat(60)),console.log(w.Ay.gray("Use:"),`bricks app share-new --app-id ${n._id} --version <name>`),console.log(w.Ay.gray("Or: "),"bricks app share-new --version-id <Version ID>")}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to fetch share info: ${e.message}`),process.exit(1)}}),function(e,t){return n.apply(this,arguments)})),O.command("share-new").description("Create a new application from a shared release version").option("--app-id <id>","Source shared application ID (requires --version)").option("--version <name>","Release name to use from the source app (requires --app-id)").option("--version-id <id>","Share version ID (from `app share-info`); skips lookup").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--skip-if-exists","Return existing application if one already exists with this share version").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((r=D(function*(e){var t=(0,C.o)(),i=e.json?null:(0,_.default)("Creating application from shared version...").start();try{if(!e.versionId&&!(e.appId&&e.version))throw Error("Provide --version-id, or both --app-id and --version. Run `bricks app share-info <appId>` to discover values.");var n=e.versionId;if(!n){i&&(i.text="Resolving share version...");var r=yield t.publicApplicationShareInfo({id:e.appId}),o=r?.share?.selected_releases||[],s=o.find(t=>t.name===e.version);if(!s){var p=o.map(e=>e.name).filter(Boolean).join(", ")||"none";throw Error(`Release "${e.version}" not found on app ${e.appId}. Available: ${p}`)}n=s.version,i&&(i.text="Creating application from shared version...")}var l={shareVersionId:n};e.name&&(l.name=e.name),e.description&&(l.description=e.description),e.skipIfExists&&(l.skipIfExists=!0);var d=yield t.createApplicationWithShareVersion(l);if(e.json&&!e.init?console.log(JSON.stringify(d,null,2)):!e.json&&(i.succeed(`Application created: ${w.Ay.green(d.name)}`),console.log(` ID: ${w.Ay.gray(d._id)}`),d.description&&console.log(` ${w.Ay.gray(d.description)}`)),e.init){i&&i.stop();var u=(yield a.e(456).then(a.bind(a,58891))).initProject;yield u("application",d._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):i.fail(`Failed to create application from shared version: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)})),O.command("list").description("List all applications").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((o=D(function*(e){var t=(0,C.o)(),a=(0,_.default)("Fetching applications...").start();try{var i=yield t.applications({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(w.Ay.yellow("No applications found"));console.log(w.Ay.bold("\nApplications")),console.log("─".repeat(80)),i.forEach(e=>{var t=e.has_unreleased_changes?w.Ay.yellow("●"):w.Ay.green("●"),a=e.current_version?`v${e.current_version}`:w.Ay.gray("no version");console.log(`${t} ${w.Ay.cyan(e.name)} ${w.Ay.gray(a)}`),console.log(` ID: ${w.Ay.gray(e._id)}`),e.description&&console.log(` ${w.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list applications: ${e.message}`),process.exit(1)}}),function(e){return o.apply(this,arguments)})),O.command("get <id>").description("Get application details").option("-c, --composed","Get composed configuration").option("-j, --json","Output as JSON").action((s=D(function*(e,t){var a=(0,C.o)(),i=(0,_.default)("Fetching application...").start();try{var n=yield a.application({id:e,composed:t.composed});if(i.stop(),n||(console.log(w.Ay.red("Application not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(w.Ay.bold(`
|
|
@@ -29,7 +29,7 @@ ${w.Ay.bold("Bound Devices")} (${n.devices.length})`),n.devices.forEach(e=>{var
|
|
|
29
29
|
${w.Ay.bold("Bound Devices")}: ${w.Ay.gray("None")}`),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get application: ${e.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),O.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((p=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.default)("Resolving application...").start();try{var n=yield(0,S.Y)(()=>a.application({id:e})),r=n?[n]:yield a.applications({keyword:e,paginate:{limit:t.limit}}),o=(0,S.K)({resource:"application",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,A.GF)(o);if(o.resolved){var s=o.resolved;console.log(w.Ay.bold("\nResolved Application")),console.log("─".repeat(60)),console.log(`Name: ${w.Ay.cyan(s.name||"Unnamed")}`),console.log(`ID: ${w.Ay.gray(s._id)}`),console.log(`Selected By: ${o.selectedBy}`),console.log("─".repeat(60));return}if(0===o.matches.length)return void console.log(w.Ay.yellow(`No applications matched "${e}"`));console.log(w.Ay.bold(`
|
|
30
30
|
Matching Applications (${o.matches.length})`)),console.log("─".repeat(80)),o.matches.forEach(e=>{console.log(`${w.Ay.cyan(e.name||"Unnamed")} ${w.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve application: ${t.message}`):(0,A.OW)(t.message,{resource:"application",query:e}),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),O.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((l=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.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=E.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,k.yd)({action:"application.update",target:N(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Application updated: ${w.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(w.Ay.yellow("Note: Application has unreleased changes")))}catch(a){t.json?(0,A.OW)(a.message,{action:"application.update",target:{id:e}}):i.fail(`Failed to update application: ${a.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),O.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((d=D(function*(e,t){var a=(0,C.o)(),i=(0,_.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: ${w.Ay.green(r.name)}`)}catch(e){i.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),O.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((u=D(function*(e,t){var a=(0,C.o)(),i=(0,_.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(w.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,F.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(w.Ay.yellow("No short edit references found"));console.log(w.Ay.bold(`
|
|
31
31
|
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(w.Ay.cyan(`
|
|
32
|
-
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?w.Ay.gray(`- ${t.title}`):"";console.log(` ${w.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 u.apply(this,arguments)})),O.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((c=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.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,k.S5)({action:"application.bind",target:N(n,e),request:{bindDevices:r,unbindDevices:o},checks:[(0,k.Iy)("application exists",!0,`${n.name} (${n._id})`),(0,k.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,k.yd)({action:"application.bind",target:N(n,e),result:{bindDevices:r,unbindDevices:o},json:!0}):i.succeed("Device bindings updated")}catch(a){t.json?(0,A.OW)(a.message,{action:"application.bind",target:{id:e}}):i.fail(`Failed to update bindings: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),O.command("remove <id>").description("Remove an application").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((m=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.default)("Removing application...").start();try{var n=yield a.application({id:e});if(!n)throw Error("Application not found");var r=N(n,e);if(t.dryRun){i&&i.stop(),(0,k.S5)({action:"application.remove",target:r,request:{id:e},checks:[(0,k.Iy)("application exists",!0,`${r.name} (${r.id})`)],json:t.json});return}var o=yield a.removeApplication({id:e});t.json?(0,k.yd)({action:"application.remove",target:r,result:{removed:!!o},json:!0}):i.succeed(`Application removed: ${w.Ay.green(r.name)}`)}catch(a){t.json?(0,A.OW)(a.message,{action:"application.remove",target:{id:e}}):i.fail(`Failed to remove application: ${a.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),O.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((f=D(function*(e,t,a){var i=(0,C.o)(),n=(0,_.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: ${w.Ay.green(t)}`)}catch(e){n.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,a){return f.apply(this,arguments)})),O.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((h=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.default)("Releasing application...").start();try{var n=(0,T.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,T.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,k.S5)({action:"application.release",target:N(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,k.Iy)("application exists",!0,`${p.name} (${p._id})`),(0,k.Iy)("application is unlocked",!p.lock?.enabled),(0,k.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,k.yd)({action:"application.release",target:N(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Application released: ${w.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,A.OW)(a.message,{action:"application.release",target:{id:e}}):i.fail(`Failed to release application: ${a.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),O.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((v=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.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: ${w.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 v.apply(this,arguments)})),O.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").option("--validate-automation","Also validate automation_map and test_map references (skips commented/unfinished steps)").option("--no-validate-expressions","Skip validating PROPERTY_BANK_EXPRESSION strings against the runtime expression rules").action((g=D(function*(e,t){E.existsSync(e)||(console.error(w.Ay.red(`Config file not found: ${e}`)),process.exit(1));var i=(0,_.default)("Validating config...").start();try{var n=E.readFileSync(e,"utf-8"),r=JSON.parse(n),o=yield Promise.all([a.e(587),a.e(
|
|
32
|
+
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?w.Ay.gray(`- ${t.title}`):"";console.log(` ${w.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 u.apply(this,arguments)})),O.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((c=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.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,k.S5)({action:"application.bind",target:N(n,e),request:{bindDevices:r,unbindDevices:o},checks:[(0,k.Iy)("application exists",!0,`${n.name} (${n._id})`),(0,k.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,k.yd)({action:"application.bind",target:N(n,e),result:{bindDevices:r,unbindDevices:o},json:!0}):i.succeed("Device bindings updated")}catch(a){t.json?(0,A.OW)(a.message,{action:"application.bind",target:{id:e}}):i.fail(`Failed to update bindings: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),O.command("remove <id>").description("Remove an application").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((m=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.default)("Removing application...").start();try{var n=yield a.application({id:e});if(!n)throw Error("Application not found");var r=N(n,e);if(t.dryRun){i&&i.stop(),(0,k.S5)({action:"application.remove",target:r,request:{id:e},checks:[(0,k.Iy)("application exists",!0,`${r.name} (${r.id})`)],json:t.json});return}var o=yield a.removeApplication({id:e});t.json?(0,k.yd)({action:"application.remove",target:r,result:{removed:!!o},json:!0}):i.succeed(`Application removed: ${w.Ay.green(r.name)}`)}catch(a){t.json?(0,A.OW)(a.message,{action:"application.remove",target:{id:e}}):i.fail(`Failed to remove application: ${a.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),O.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((f=D(function*(e,t,a){var i=(0,C.o)(),n=(0,_.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: ${w.Ay.green(t)}`)}catch(e){n.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,a){return f.apply(this,arguments)})),O.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((h=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.default)("Releasing application...").start();try{var n=(0,T.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,T.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,k.S5)({action:"application.release",target:N(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,k.Iy)("application exists",!0,`${p.name} (${p._id})`),(0,k.Iy)("application is unlocked",!p.lock?.enabled),(0,k.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,k.yd)({action:"application.release",target:N(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Application released: ${w.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,A.OW)(a.message,{action:"application.release",target:{id:e}}):i.fail(`Failed to release application: ${a.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),O.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((v=D(function*(e,t){var a=(0,C.o)(),i=t.json?null:(0,_.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: ${w.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 v.apply(this,arguments)})),O.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").option("--validate-automation","Also validate automation_map and test_map references (skips commented/unfinished steps)").option("--no-validate-expressions","Skip validating PROPERTY_BANK_EXPRESSION strings against the runtime expression rules").action((g=D(function*(e,t){E.existsSync(e)||(console.error(w.Ay.red(`Config file not found: ${e}`)),process.exit(1));var i=(0,_.default)("Validating config...").start();try{var n=E.readFileSync(e,"utf-8"),r=JSON.parse(n),o=yield Promise.all([a.e(587),a.e(249),a.e(10),a.e(511)]).then(a.t.bind(a,38890,19)),s=o.checkConfig,p=o.checkConfigDeprecatedFeatures,l=s(r,{checkAutomation:!!t.validateAutomation,checkCalc:!0,checkExpressions:!1!==t.validateExpressions}),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(w.Ay.green("✓ Config is valid"));console.log(w.Ay.bold("\nConfig Validation Report")),console.log("─".repeat(60)),l.schema.length>0&&(console.log(w.Ay.red(`
|
|
33
33
|
Schema Errors (${l.schema.length})
|
|
34
34
|
`)),l.schema.forEach((e,t)=>{var a=e.instancePath||e.dataPath||"/";console.log(` ${w.Ay.red(`${t+1}.`)} ${w.Ay.bold(a)}`),console.log(` ${e.message}`),e.params?.pattern&&console.log(` ${w.Ay.gray(`pattern: ${e.params.pattern}`)}`)})),l.ref.length>0&&(console.log(w.Ay.red(`
|
|
35
35
|
Reference Errors (${l.ref.length})
|
|
@@ -39,7 +39,7 @@ ${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title
|
|
|
39
39
|
Expression Errors (${l.expression.length})
|
|
40
40
|
`)),l.expression.forEach((e,t)=>{console.log(` ${w.Ay.red(`${t+1}.`)} ${w.Ay.bold(e.field)}`),console.log(` ${e.message}`)})),d.length>0&&(console.log(w.Ay.yellow(`
|
|
41
41
|
Deprecation Warnings (${d.length})
|
|
42
|
-
`)),d.forEach((e,t)=>{console.log(` ${w.Ay.yellow(`${t+1}.`)} ${w.Ay.bold(e.id)}`),console.log(` ${e.data}`)})),console.log("\n"+"─".repeat(60));var u=l.schema.length+l.ref.length+l.calc.length+(l.expression?.length||0);l.valid?console.log(w.Ay.yellow(`⚠ ${d.length} warning(s)`)):console.log(w.Ay.red(`✗ ${u} error(s)`)+(d.length>0?w.Ay.yellow(`, ${d.length} warning(s)`):"")),l.valid||process.exit(1)}catch(e){i.fail(`Failed to validate config: ${e.message}`),process.exit(1)}}),function(e,t){return g.apply(this,arguments)})),O.command("doctor <idOrPath>").description("Diagnose an application config: schema validation plus semantic lint rules (data races, layout mistakes, dead config)").option("-j, --json","Output as JSON").option("-c, --composed","Fetch the composed configuration (remote id only)").option("--strict","Exit with code 1 when warnings are found").option("--only <codes>","Run only these rule codes (comma-separated)").option("--ignore <codes>","Skip these rule codes (comma-separated)").option("--validate-automation","Also validate automation_map and test_map references").action((y=D(function*(e,t){var i=t.json?null:(0,_.default)("Running config doctor...").start();try{var n=yield Promise.all([a.e(587),a.e(341),a.e(10),a.e(511),a.e(223)]).then(a.bind(a,63322)),r=n.runConfigDoctor,o=n.renderConfigDoctorReport,s=yield r("app",e,t),p=s.report,l=s.exitCode;i?.stop(),t.json?(0,A.GF)({...p,exitCode:l}):console.log(o(p)),0!==l&&process.exit(l)}catch(e){i?i.fail(`Config doctor failed: ${e.message}`):(0,A.OW)(e.message),process.exit(1)}}),function(e,t){return y.apply(this,arguments)})),O.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from an application").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((b=D(function*(e,t){var i=(yield a.e(456).then(a.bind(a,58891))).initProject;yield i("application",e,t)}),function(e,t){return b.apply(this,arguments)}))},55614(e,t,i){i.d(t,{s:()=>D});var n,r,o,s,p,l=i(99436),d=i(35679),u=i(73284),c=i(30155);let m=a("readline");var f=i(47988),h=i(85382),v=i(7586),g=e=>!!e&&"object"==typeof e&&!Array.isArray(e),y=(e={})=>{var t=g(e)?e:{},a=t.plan,i=g(a)?a:{},n=g(t.lock)?t.lock:{},r="string"==typeof a?a:i.type;return{...t,plan:{...i,type:r||"free"},lock:{...n,features:!!n.features}}},b=(n=l(function*(){var e=(0,f.getCurrentProfile)(),t=(0,f.getCurrentProfileSource)(),a=(0,f.getTokenInfo)(e),i=(0,f.getBaseUrl)();if(!a?.token)return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!1,source:"missing",workspaceId:null,workspaceName:null,createdAt:null,tokenPreview:null},workspace:null,error:null};try{var n=(0,h.createClient)(i,a.token),r=yield n.workspace();return{ok:!0,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:r?._id||a.workspaceId||null,workspaceName:r?.name||a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:r?{_id:r._id,name:r.name,description:r.description||null}:null,error:null}}catch(n){return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:a.workspaceId||null,workspaceName:a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:null,error:{message:n.message}}}}),function(){return n.apply(this,arguments)}),D=new d.uB("auth").description("Authentication and token management");D.command("login").description("Login with a one-time passcode from BRICKS Controller (recommended)").argument("[passcode]","One-time passcode from BRICKS Controller").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((r=l(function*(e,t){var a,i=t.profile||(0,f.getCurrentProfile)(),n=t.name,r=e;!r&&(console.log(u.Ay.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(u.Ay.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(r=yield(a=m.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{a.question("Enter passcode: ",t=>{a.close(),e(t.trim())})})))||(console.log(u.Ay.red("Passcode is required")),process.exit(1)));var o=(0,c.default)("Validating passcode...").start();try{var s=(0,h.createPublicClient)((0,f.getBaseUrl)()),p=yield s.checkWorkspaceOTP(r);p.valid||(o.fail(`Invalid passcode: ${p.error||"Unknown error"}`),process.exit(1)),o.text=`Exchanging passcode for token (workspace: ${p.workspaceName})...`;var l=yield s.exchangeWorkspaceOTP(r);l.token||(o.fail("Failed to obtain token"),process.exit(1));var d=(0,h.createClient)((0,f.getBaseUrl)(),l.token),v=yield d.workspace();v||(o.fail("Token validation failed"),process.exit(1)),(0,f.setToken)(i,{token:l.token,name:n||v.name,workspaceId:v._id,workspaceName:v.name,workspaceBilling:y(v.billing)}),(0,f.setCurrentProfile)(i),o.succeed(`Logged in to workspace: ${u.Ay.green(v.name)} (profile: ${u.Ay.cyan(i)})`)}catch(e){o.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),D.command("login-token").description("Login with a workspace token directly").option("-t, --token <token>","Workspace token").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((o=l(function*(e){var t=e.profile||(0,f.getCurrentProfile)(),a=e.token,i=e.name;a||(console.error(u.Ay.red("Error: Token is required. Use -t or --token to provide it.")),console.log(u.Ay.gray("\nYou can get a workspace token from BRICKS Controller:")+u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray("Select your workspace and create a new token.\n")),console.log(u.Ay.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var n=(0,c.default)("Validating token...").start();try{var r=(0,h.createClient)((0,f.getBaseUrl)(),a),o=yield r.workspace();o||(n.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,f.setToken)(t,{token:a,name:i||o.name,workspaceId:o._id,workspaceName:o.name,workspaceBilling:y(o.billing)}),(0,f.setCurrentProfile)(t),n.succeed(`Logged in to workspace: ${u.Ay.green(o.name)} (profile: ${u.Ay.cyan(t)})`)}catch(e){n.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return o.apply(this,arguments)})),D.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((s=l(function*(e){var t=e.profile;if(e.all){(0,f.listProfiles)().forEach(e=>(0,f.removeToken)(e.name)),console.log(u.Ay.green("All profiles removed"));return}var a=t||(0,f.getCurrentProfile)();(0,f.getTokenInfo)(a)?((0,f.removeToken)(a),console.log(u.Ay.green(`Logged out from profile: ${a}`))):console.log(u.Ay.yellow(`No token found for profile: ${a}`))}),function(e){return s.apply(this,arguments)})),D.command("status").description("Show current authentication status").option("-j, --json","Output as JSON").action((p=l(function*(e){var t=(0,f.getCurrentProfile)(),a=(0,f.getTokenInfo)(t);if(!a)return e.json?void(0,v.GF)((yield b())):(console.log(u.Ay.yellow("Not logged in")),void console.log(u.Ay.gray("Use `bricks auth login` to login")));if(e.json)return void(0,v.GF)((yield b()));var i=(0,c.default)("Checking connection...").start();try{var n=(0,h.createClient)((0,f.getBaseUrl)(),a.token),r=yield n.workspace();i.stop(),console.log(u.Ay.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${u.Ay.cyan(t)}`),console.log(`Workspace: ${u.Ay.green(r.name)}`),console.log(`Workspace ID: ${u.Ay.gray(r._id)}`);var o=(0,f.getBaseUrl)(),s=a.baseUrl;console.log(`Base URL: ${u.Ay.gray(o)}${s?"":u.Ay.gray(" (global)")}`),console.log(`Logged in: ${u.Ay.gray(a.createdAt)}`),console.log("─".repeat(40))}catch(e){i.fail(`Connection failed: ${e.message}`)}}),function(e){return p.apply(this,arguments)})),D.command("list").description("List all saved profiles").action(()=>{var e=(0,f.listProfiles)();if(0===e.length){console.log(u.Ay.yellow("No saved profiles")),console.log(u.Ay.gray("Use `bricks auth login` to login"));return}console.log(u.Ay.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?u.Ay.green("● "):" ",a=e.current?u.Ay.green(e.name):e.name,i=e.baseUrl?u.Ay.gray(` [${e.baseUrl}]`):"";console.log(`${t}${a.padEnd(15)} ${u.Ay.gray(e.workspaceName||"Unknown")}${i}`)}),console.log("─".repeat(60))}),D.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,f.getTokenInfo)(e);if(!t){console.log(u.Ay.red(`Profile not found: ${e}`)),console.log(u.Ay.gray("Use `bricks auth list` to see available profiles"));return}(0,f.setCurrentProfile)(e),console.log(u.Ay.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(u.Ay.gray(`Workspace: ${t.workspaceName}`))}),D.command("set-url <url>").description("Set the base URL for the current profile").option("-g, --global","Set the global base URL instead of per-profile").action((e,t)=>{if(t.global)(0,f.setBaseUrl)(e),console.log(u.Ay.green(`Global base URL set to: ${e}`));else{var a=(0,f.getCurrentProfile)();(0,f.setBaseUrl)(e,a),console.log(u.Ay.green(`Base URL for profile ${u.Ay.cyan(a)} set to: ${e}`))}})},59845(e,t,a){a.d(t,{Q:()=>I});var i,n,r,o,s,p,l,d,u,c,m,f=a(99436),h=a(35679),v=a(73284),g=a(77598),y=a(48161),b=a(76760),D=a(51455),x=a(27549),w=a(19557),_=8089,E=(i=f(function*(e,t,a=3e3){return(0,w.uE)(`http://${e}:${t}/buttress/info`,a)}),function(e,t){return i.apply(this,arguments)}),F=b.join(y.homedir(),".bricks-cli","buttress"),A=e=>b.join(e||F,"state.json"),C=()=>{try{return`buttress-${x.machineIdSync()}`}catch{return null}},S=(n=f(function*(e){var t=A(e);try{var a=yield D.readFile(t,"utf8");return JSON.parse(a)}catch(e){if("ENOENT"===e.code)return null;throw e}}),function(e){return n.apply(this,arguments)}),T=(r=f(function*(e,t){var a=t||F,i=A(t);yield D.mkdir(a,{recursive:!0});var n=`${i}.tmp-${process.pid}`;return yield D.writeFile(n,JSON.stringify(e,null,2),"utf8"),yield D.rename(n,i),i}),function(e,t){return r.apply(this,arguments)}),k=(o=f(function*(e){var t=A(e);try{return yield D.unlink(t),!0}catch(e){if("ENOENT"===e.code)return!1;throw e}}),function(e){return o.apply(this,arguments)}),N=(s=f(function*({timeout:e=3e3,verify:t=!0,port:a=_,onStatus:i}={}){i?.(`Scanning UDP ${a} for ${e}ms...`);var n,r=yield(({timeout:e=3e3,idleTimeout:t=0,port:a=_}={})=>(0,w.YH)({port:a,timeout:e,idleTimeout:t,buildQuery:()=>Buffer.from(JSON.stringify({t:"QUERY",v:"2.0",d:{id:`cli-${(0,w.BW)()}`}})),parseMessage:(e,t)=>{var a=JSON.parse(e.toString());if("2.0"!==a.v||"ANNOUNCE"!==a.t&&"RESPONSE"!==a.t)return null;var i=a.d?.info;if(!i)return null;var n={...i,address:t.address};return{key:n.id||`${t.address}:${n.port}`,value:n}}}))({timeout:e,port:a});return 0===r.length?[]:t?(i?.(`Verifying ${r.length} server(s)...`),yield Promise.all(r.map((n=f(function*(e){var t=yield E(e.address,e.port,2e3);return t?{...e,...t,address:e.address,verified:!0}:{...e,verified:!1}}),function(e){return n.apply(this,arguments)})))):r}),function(){return s.apply(this,arguments)}),O=(p=f(function*(){var e=yield Promise.resolve().then(a.bind(a,47988)),t=e.getToken,i=e.getBaseUrl,n=e.getCurrentProfile,r=(yield Promise.resolve().then(a.bind(a,85382))).createClient,o=t(n());return o||(console.error(v.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),r(i(),o)}),function(){return p.apply(this,arguments)}),I=new h.uB("buttress").description("Pair and inspect buttress-server bindings for the current workspace").alias("butr");I.command("bind").description("Pair a local buttress-server with the current workspace").option("-s, --server-id <id>","Buttress server id (auto-detected from machine id by default)").option("-n, --name <name>","Friendly name for this buttress server").option("--state-dir <dir>","Override the buttress state directory (defaults to ~/.bricks-cli/buttress)").option("--print","Print state.json to stdout instead of writing to disk (useful for remote setups)").action((l=f(function*(e){var t,i,n,r,o,s,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=e.serverId||C();l||(console.error(v.Ay.red("Could not detect a local server id. Pass --server-id <id> explicitly.")),process.exit(1));var d=(i=(t=g.generateKeyPairSync("ed25519")).publicKey,n=t.privateKey,r=i.export({type:"spki",format:"der"}),o=n.export({type:"pkcs8",format:"der"}),s=g.createHash("sha256").update(r).digest("hex").slice(0,16),{publicKeySpki:r.toString("base64"),privateKeyPkcs8:o.toString("base64"),kid:s}),u=yield O(),c=p(`Binding buttress server ${v.Ay.cyan(l)}...`).start();try{var m=yield u.bindButtressServer({serverId:l,name:e.name,serverPublicKey:{spkiBase64:d.publicKeySpki,kid:d.kid}});c.stop();var f={workspace:{id:m.workspaceId,name:m.workspaceName,serverId:m.serverId,issuerPublicKey:m.issuerPublicKey.pem,kid:m.issuerPublicKey.kid,boundAt:new Date().toISOString()},serverKeyPair:d};if(e.print){console.warn(v.Ay.yellow("⚠ Output contains the server announce private key. Treat as a secret.")),process.stdout.write(`${JSON.stringify(f,null,2)}
|
|
42
|
+
`)),d.forEach((e,t)=>{console.log(` ${w.Ay.yellow(`${t+1}.`)} ${w.Ay.bold(e.id)}`),console.log(` ${e.data}`)})),console.log("\n"+"─".repeat(60));var u=l.schema.length+l.ref.length+l.calc.length+(l.expression?.length||0);l.valid?console.log(w.Ay.yellow(`⚠ ${d.length} warning(s)`)):console.log(w.Ay.red(`✗ ${u} error(s)`)+(d.length>0?w.Ay.yellow(`, ${d.length} warning(s)`):"")),l.valid||process.exit(1)}catch(e){i.fail(`Failed to validate config: ${e.message}`),process.exit(1)}}),function(e,t){return g.apply(this,arguments)})),O.command("doctor <idOrPath>").description("Diagnose an application config: schema validation plus semantic lint rules (data races, layout mistakes, dead config)").option("-j, --json","Output as JSON").option("-c, --composed","Fetch the composed configuration (remote id only)").option("--strict","Exit with code 1 when warnings are found").option("--only <codes>","Run only these rule codes (comma-separated)").option("--ignore <codes>","Skip these rule codes (comma-separated)").option("--validate-automation","Also validate automation_map and test_map references").action((y=D(function*(e,t){var i=t.json?null:(0,_.default)("Running config doctor...").start();try{var n=yield Promise.all([a.e(587),a.e(249),a.e(10),a.e(511),a.e(223)]).then(a.bind(a,63322)),r=n.runConfigDoctor,o=n.renderConfigDoctorReport,s=yield r("app",e,t),p=s.report,l=s.exitCode;i?.stop(),t.json?(0,A.GF)({...p,exitCode:l}):console.log(o(p)),0!==l&&process.exit(l)}catch(e){i?i.fail(`Config doctor failed: ${e.message}`):(0,A.OW)(e.message),process.exit(1)}}),function(e,t){return y.apply(this,arguments)})),O.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from an application").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((b=D(function*(e,t){var i=(yield a.e(456).then(a.bind(a,58891))).initProject;yield i("application",e,t)}),function(e,t){return b.apply(this,arguments)}))},55614(e,t,i){i.d(t,{s:()=>D});var n,r,o,s,p,l=i(99436),d=i(35679),u=i(73284),c=i(30155);let m=a("readline");var f=i(47988),h=i(85382),v=i(7586),g=e=>!!e&&"object"==typeof e&&!Array.isArray(e),y=(e={})=>{var t=g(e)?e:{},a=t.plan,i=g(a)?a:{},n=g(t.lock)?t.lock:{},r="string"==typeof a?a:i.type;return{...t,plan:{...i,type:r||"free"},lock:{...n,features:!!n.features}}},b=(n=l(function*(){var e=(0,f.getCurrentProfile)(),t=(0,f.getCurrentProfileSource)(),a=(0,f.getTokenInfo)(e),i=(0,f.getBaseUrl)();if(!a?.token)return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!1,source:"missing",workspaceId:null,workspaceName:null,createdAt:null,tokenPreview:null},workspace:null,error:null};try{var n=(0,h.createClient)(i,a.token),r=yield n.workspace();return{ok:!0,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:r?._id||a.workspaceId||null,workspaceName:r?.name||a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:r?{_id:r._id,name:r.name,description:r.description||null}:null,error:null}}catch(n){return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:a.workspaceId||null,workspaceName:a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:null,error:{message:n.message}}}}),function(){return n.apply(this,arguments)}),D=new d.uB("auth").description("Authentication and token management");D.command("login").description("Login with a one-time passcode from BRICKS Controller (recommended)").argument("[passcode]","One-time passcode from BRICKS Controller").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((r=l(function*(e,t){var a,i=t.profile||(0,f.getCurrentProfile)(),n=t.name,r=e;!r&&(console.log(u.Ay.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(u.Ay.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(r=yield(a=m.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{a.question("Enter passcode: ",t=>{a.close(),e(t.trim())})})))||(console.log(u.Ay.red("Passcode is required")),process.exit(1)));var o=(0,c.default)("Validating passcode...").start();try{var s=(0,h.createPublicClient)((0,f.getBaseUrl)()),p=yield s.checkWorkspaceOTP(r);p.valid||(o.fail(`Invalid passcode: ${p.error||"Unknown error"}`),process.exit(1)),o.text=`Exchanging passcode for token (workspace: ${p.workspaceName})...`;var l=yield s.exchangeWorkspaceOTP(r);l.token||(o.fail("Failed to obtain token"),process.exit(1));var d=(0,h.createClient)((0,f.getBaseUrl)(),l.token),v=yield d.workspace();v||(o.fail("Token validation failed"),process.exit(1)),(0,f.setToken)(i,{token:l.token,name:n||v.name,workspaceId:v._id,workspaceName:v.name,workspaceBilling:y(v.billing)}),(0,f.setCurrentProfile)(i),o.succeed(`Logged in to workspace: ${u.Ay.green(v.name)} (profile: ${u.Ay.cyan(i)})`)}catch(e){o.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),D.command("login-token").description("Login with a workspace token directly").option("-t, --token <token>","Workspace token").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((o=l(function*(e){var t=e.profile||(0,f.getCurrentProfile)(),a=e.token,i=e.name;a||(console.error(u.Ay.red("Error: Token is required. Use -t or --token to provide it.")),console.log(u.Ay.gray("\nYou can get a workspace token from BRICKS Controller:")+u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray("Select your workspace and create a new token.\n")),console.log(u.Ay.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var n=(0,c.default)("Validating token...").start();try{var r=(0,h.createClient)((0,f.getBaseUrl)(),a),o=yield r.workspace();o||(n.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,f.setToken)(t,{token:a,name:i||o.name,workspaceId:o._id,workspaceName:o.name,workspaceBilling:y(o.billing)}),(0,f.setCurrentProfile)(t),n.succeed(`Logged in to workspace: ${u.Ay.green(o.name)} (profile: ${u.Ay.cyan(t)})`)}catch(e){n.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return o.apply(this,arguments)})),D.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((s=l(function*(e){var t=e.profile;if(e.all){(0,f.listProfiles)().forEach(e=>(0,f.removeToken)(e.name)),console.log(u.Ay.green("All profiles removed"));return}var a=t||(0,f.getCurrentProfile)();(0,f.getTokenInfo)(a)?((0,f.removeToken)(a),console.log(u.Ay.green(`Logged out from profile: ${a}`))):console.log(u.Ay.yellow(`No token found for profile: ${a}`))}),function(e){return s.apply(this,arguments)})),D.command("status").description("Show current authentication status").option("-j, --json","Output as JSON").action((p=l(function*(e){var t=(0,f.getCurrentProfile)(),a=(0,f.getTokenInfo)(t);if(!a)return e.json?void(0,v.GF)((yield b())):(console.log(u.Ay.yellow("Not logged in")),void console.log(u.Ay.gray("Use `bricks auth login` to login")));if(e.json)return void(0,v.GF)((yield b()));var i=(0,c.default)("Checking connection...").start();try{var n=(0,h.createClient)((0,f.getBaseUrl)(),a.token),r=yield n.workspace();i.stop(),console.log(u.Ay.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${u.Ay.cyan(t)}`),console.log(`Workspace: ${u.Ay.green(r.name)}`),console.log(`Workspace ID: ${u.Ay.gray(r._id)}`);var o=(0,f.getBaseUrl)(),s=a.baseUrl;console.log(`Base URL: ${u.Ay.gray(o)}${s?"":u.Ay.gray(" (global)")}`),console.log(`Logged in: ${u.Ay.gray(a.createdAt)}`),console.log("─".repeat(40))}catch(e){i.fail(`Connection failed: ${e.message}`)}}),function(e){return p.apply(this,arguments)})),D.command("list").description("List all saved profiles").action(()=>{var e=(0,f.listProfiles)();if(0===e.length){console.log(u.Ay.yellow("No saved profiles")),console.log(u.Ay.gray("Use `bricks auth login` to login"));return}console.log(u.Ay.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?u.Ay.green("● "):" ",a=e.current?u.Ay.green(e.name):e.name,i=e.baseUrl?u.Ay.gray(` [${e.baseUrl}]`):"";console.log(`${t}${a.padEnd(15)} ${u.Ay.gray(e.workspaceName||"Unknown")}${i}`)}),console.log("─".repeat(60))}),D.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,f.getTokenInfo)(e);if(!t){console.log(u.Ay.red(`Profile not found: ${e}`)),console.log(u.Ay.gray("Use `bricks auth list` to see available profiles"));return}(0,f.setCurrentProfile)(e),console.log(u.Ay.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(u.Ay.gray(`Workspace: ${t.workspaceName}`))}),D.command("set-url <url>").description("Set the base URL for the current profile").option("-g, --global","Set the global base URL instead of per-profile").action((e,t)=>{if(t.global)(0,f.setBaseUrl)(e),console.log(u.Ay.green(`Global base URL set to: ${e}`));else{var a=(0,f.getCurrentProfile)();(0,f.setBaseUrl)(e,a),console.log(u.Ay.green(`Base URL for profile ${u.Ay.cyan(a)} set to: ${e}`))}})},59845(e,t,a){a.d(t,{Q:()=>I});var i,n,r,o,s,p,l,d,u,c,m,f=a(99436),h=a(35679),v=a(73284),g=a(77598),y=a(48161),b=a(76760),D=a(51455),x=a(27549),w=a(19557),_=8089,E=(i=f(function*(e,t,a=3e3){return(0,w.uE)(`http://${e}:${t}/buttress/info`,a)}),function(e,t){return i.apply(this,arguments)}),F=b.join(y.homedir(),".bricks-cli","buttress"),A=e=>b.join(e||F,"state.json"),C=()=>{try{return`buttress-${x.machineIdSync()}`}catch{return null}},S=(n=f(function*(e){var t=A(e);try{var a=yield D.readFile(t,"utf8");return JSON.parse(a)}catch(e){if("ENOENT"===e.code)return null;throw e}}),function(e){return n.apply(this,arguments)}),T=(r=f(function*(e,t){var a=t||F,i=A(t);yield D.mkdir(a,{recursive:!0});var n=`${i}.tmp-${process.pid}`;return yield D.writeFile(n,JSON.stringify(e,null,2),"utf8"),yield D.rename(n,i),i}),function(e,t){return r.apply(this,arguments)}),k=(o=f(function*(e){var t=A(e);try{return yield D.unlink(t),!0}catch(e){if("ENOENT"===e.code)return!1;throw e}}),function(e){return o.apply(this,arguments)}),N=(s=f(function*({timeout:e=3e3,verify:t=!0,port:a=_,onStatus:i}={}){i?.(`Scanning UDP ${a} for ${e}ms...`);var n,r=yield(({timeout:e=3e3,idleTimeout:t=0,port:a=_}={})=>(0,w.YH)({port:a,timeout:e,idleTimeout:t,buildQuery:()=>Buffer.from(JSON.stringify({t:"QUERY",v:"2.0",d:{id:`cli-${(0,w.BW)()}`}})),parseMessage:(e,t)=>{var a=JSON.parse(e.toString());if("2.0"!==a.v||"ANNOUNCE"!==a.t&&"RESPONSE"!==a.t)return null;var i=a.d?.info;if(!i)return null;var n={...i,address:t.address};return{key:n.id||`${t.address}:${n.port}`,value:n}}}))({timeout:e,port:a});return 0===r.length?[]:t?(i?.(`Verifying ${r.length} server(s)...`),yield Promise.all(r.map((n=f(function*(e){var t=yield E(e.address,e.port,2e3);return t?{...e,...t,address:e.address,verified:!0}:{...e,verified:!1}}),function(e){return n.apply(this,arguments)})))):r}),function(){return s.apply(this,arguments)}),O=(p=f(function*(){var e=yield Promise.resolve().then(a.bind(a,47988)),t=e.getToken,i=e.getBaseUrl,n=e.getCurrentProfile,r=(yield Promise.resolve().then(a.bind(a,85382))).createClient,o=t(n());return o||(console.error(v.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),r(i(),o)}),function(){return p.apply(this,arguments)}),I=new h.uB("buttress").description("Pair and inspect buttress-server bindings for the current workspace").alias("butr");I.command("bind").description("Pair a local buttress-server with the current workspace").option("-s, --server-id <id>","Buttress server id (auto-detected from machine id by default)").option("-n, --name <name>","Friendly name for this buttress server").option("--state-dir <dir>","Override the buttress state directory (defaults to ~/.bricks-cli/buttress)").option("--print","Print state.json to stdout instead of writing to disk (useful for remote setups)").action((l=f(function*(e){var t,i,n,r,o,s,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=e.serverId||C();l||(console.error(v.Ay.red("Could not detect a local server id. Pass --server-id <id> explicitly.")),process.exit(1));var d=(i=(t=g.generateKeyPairSync("ed25519")).publicKey,n=t.privateKey,r=i.export({type:"spki",format:"der"}),o=n.export({type:"pkcs8",format:"der"}),s=g.createHash("sha256").update(r).digest("hex").slice(0,16),{publicKeySpki:r.toString("base64"),privateKeyPkcs8:o.toString("base64"),kid:s}),u=yield O(),c=p(`Binding buttress server ${v.Ay.cyan(l)}...`).start();try{var m=yield u.bindButtressServer({serverId:l,name:e.name,serverPublicKey:{spkiBase64:d.publicKeySpki,kid:d.kid}});c.stop();var f={workspace:{id:m.workspaceId,name:m.workspaceName,serverId:m.serverId,issuerPublicKey:m.issuerPublicKey.pem,kid:m.issuerPublicKey.kid,boundAt:new Date().toISOString()},serverKeyPair:d};if(e.print){console.warn(v.Ay.yellow("⚠ Output contains the server announce private key. Treat as a secret.")),process.stdout.write(`${JSON.stringify(f,null,2)}
|
|
43
43
|
`);return}var h=yield T(f,e.stateDir);console.log(v.Ay.green("✓"),"Buttress server bound to workspace."),console.log(` Workspace: ${v.Ay.bold(m.workspaceName)} (${m.workspaceId})`),console.log(` Server id: ${v.Ay.cyan(m.serverId)}`),console.log(` Issuer kid: ${v.Ay.gray(m.issuerPublicKey.kid)}`),console.log(` Announce kid: ${v.Ay.gray(d.kid)}`),console.log(` State file: ${v.Ay.gray(h)}`),console.log(),console.log(v.Ay.yellow("Restart buttress-server for the binding to take effect."))}catch(e){c.fail(`Bind failed: ${e.message}`),process.exit(1)}}),function(e){return l.apply(this,arguments)})),I.command("unbind").description("Unbind a buttress server from this workspace").option("-s, --server-id <id>","Buttress server id (auto-detected by default)").option("--state-dir <dir>","Override the buttress state directory").option("--keep-local","Do not remove the local state.json file").action((d=f(function*(e){var t=e.serverId||C();t||(console.error(v.Ay.red("Could not detect a local server id. Pass --server-id explicitly.")),process.exit(1));var a=yield O();try{if((yield a.unbindButtressServer({serverId:t}))?console.log(v.Ay.green("✓"),`Unbound ${v.Ay.cyan(t)} from workspace.`):console.log(v.Ay.yellow("!"),`${v.Ay.cyan(t)} was not bound to this workspace.`),!e.keepLocal){var i=A(e.stateDir),n=yield S(e.stateDir);n?.workspace?.serverId===t&&(yield k(e.stateDir),console.log(v.Ay.gray(`Removed local state file: ${i}`)))}}catch(e){console.error(v.Ay.red(`Unbind failed: ${e.message}`)),process.exit(1)}}),function(e){return d.apply(this,arguments)})),I.command("status").description("Show local buttress binding state and the workspace-side bound list").option("--state-dir <dir>","Override the buttress state directory").option("-j, --json","Output as JSON").action((u=f(function*(e){var t=yield S(e.stateDir),a=null;try{var i=yield O();a=yield i.buttressServers()}catch(e){a={error:e.message}}e.json?console.log(JSON.stringify({local:t,remote:a},null,2)):(console.log(v.Ay.bold("\nLocal buttress state")),console.log("─".repeat(60)),t?.workspace?(console.log(` Workspace: ${v.Ay.bold(t.workspace.name)} (${t.workspace.id})`),console.log(` Server id: ${v.Ay.cyan(t.workspace.serverId)}`),console.log(` Issuer kid: ${v.Ay.gray(t.workspace.kid)}`),console.log(` Bound at: ${v.Ay.gray(t.workspace.boundAt)}`),console.log(` File: ${v.Ay.gray(A(e.stateDir))}`)):console.log(v.Ay.gray(" not bound (no state.json found)")),console.log(v.Ay.bold("\nWorkspace-side bound servers")),console.log("─".repeat(60)),Array.isArray(a)?0===a.length?console.log(v.Ay.gray(" none")):a.forEach(e=>{console.log(` ${v.Ay.cyan(e.serverId)} ${v.Ay.gray(e.name||"")} ${v.Ay.gray(e.boundAt||"")}`)}):a?.error&&console.log(v.Ay.red(` failed to fetch: ${a.error}`)))}),function(e){return u.apply(this,arguments)})),I.command("issue-token").description("Issue a long-lived workspace-scoped buttress access token (CLI/CTOR usage)").option("--ttl <seconds>","Time-to-live in seconds (default 30 days)",e=>parseInt(e,10)).option("-j, --json","Output as JSON").action((c=f(function*(e){var t=yield O();try{var a=yield t.issueButtressAccessToken({ttlSeconds:e.ttl});if(e.json)return void console.log(JSON.stringify(a,null,2));console.log(v.Ay.green("✓"),"Buttress access token issued."),console.log(` Workspace: ${a.workspaceId}`),console.log(` Expires: ${a.expiresAt}`),console.log(` jti: ${v.Ay.gray(a.jti)}`),console.log(),console.log(v.Ay.cyan(a.token))}catch(e){console.error(v.Ay.red(`Issue token failed: ${e.message}`)),process.exit(1)}}),function(e){return c.apply(this,arguments)})),I.command("scan").description("Scan LAN for buttress-servers via UDP and verify each via /buttress/info").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-p, --port <port>","UDP discovery port",String(_)).option("--udp-only","Skip HTTP /buttress/info verification").option("-j, --json","Output as JSON").action((m=f(function*(e){var t=(yield Promise.resolve().then(a.bind(a,30155))).default,i=yield Promise.resolve().then(a.bind(a,47988)),n=i.getCurrentProfile,r=i.getTokenInfo,o=parseInt(e.timeout,10),s=parseInt(e.port,10),p=[],l=t(`Scanning for buttress-servers (${o}ms)...`).start();try{p=yield N({timeout:o,port:s,verify:!e.udpOnly,onStatus:e=>{l.text=e}}),l.stop()}catch(e){l.fail(`Scan failed: ${e.message}`),process.exit(1)}var d=n(),u=r(d)?.workspaceId||null;if(e.json)return void console.log(JSON.stringify({servers:p,workspaceId:u},null,2));if(0===p.length)return void console.log(v.Ay.yellow("No buttress-servers found on the LAN."));for(var c of(console.log(v.Ay.bold(`
|
|
44
44
|
Found ${p.length} buttress-server(s)`)),console.log("─".repeat(70)),p)){var m=!1===c.verified?v.Ay.red("unverified"):v.Ay.green("online"),f=c.workspace?.id,h=f&&u&&f===u,g=c.authentication?.bound?v.Ay.yellow("JWT required"):v.Ay.gray("open");console.log(` ${v.Ay.bold(c.name||"Unknown")} ${v.Ay.gray(`(${c.address}:${c.port})`)} [${m}]`),c.id&&console.log(` Server id: ${v.Ay.cyan(c.id)}`),c.version&&console.log(` Version: ${v.Ay.green(c.version)}`);var y=c.authentication?.kid?v.Ay.gray(` (kid: ${c.authentication.kid})`):"";if(console.log(` Auth: ${g}${y}`),f){var b=h?v.Ay.green(`${f} ${v.Ay.bold("(current profile)")}`):v.Ay.gray(f);console.log(` Workspace: ${b}`)}if(Array.isArray(c.generators)&&c.generators.length>0)for(var D of(console.log(" Generators:"),c.generators)){var x=[];"number"==typeof D.score&&x.push(`score ${D.score.toFixed(1)}`),!0===D.hasGpu?x.push("GPU ✓"):!1===D.hasGpu&&x.push("GPU ✗"),"number"==typeof D.usableBytes&&x.push(`${(D.usableBytes/0x40000000).toFixed(1)} GB usable`);var w=x.length>0?` ${v.Ay.gray(x.join(" "))}`:"";console.log(` - ${v.Ay.cyan(D.type)}${w}`)}}console.log("─".repeat(70)),p.some(e=>e.authentication?.bound)&&(console.log(),console.log(v.Ay.gray("To connect to a bound server, run `bricks buttress issue-token` for a workspace access token.")))}),function(e){return m.apply(this,arguments)}))},71335(e,t,a){a.d(t,{oT:()=>d});var i=a(35679),n=a(73284),r=a(47988),o={prod:"https://display.bricks.tools",beta:"https://display-beta.bricks.tools",dev:"http://localhost:3001"},s=e=>{var t=Object.entries(o).find(([,t])=>e===t);return t?t[0]:null},p={prod:"https://activity-log.bricks.tools",beta:"https://activity-log-beta.bricks.tools",dev:"http://localhost:8088"},l=e=>{var t=Object.entries(p).find(([,t])=>e===t);return t?t[0]:null},d=new i.uB("config").description("CLI configuration management");d.command("endpoint").argument("[environment]","Environment to use (prod, beta, dev)").description("Show or set endpoint environment").option("-p, --profile","Set for current profile instead of global").action((e,t)=>{if(!e){var a=(0,r.getBaseUrl)(),i=s(a),d=(0,r.getActivityLogBaseUrl)(),u=l(d);console.log(n.Ay.bold("\nEndpoint Configuration")),console.log("─".repeat(50)),console.log(n.Ay.bold("BRICKS")),console.log(` URL: ${n.Ay.cyan(a)}`),console.log(` Environment: ${i?n.Ay.green(i):n.Ay.yellow("custom")}`),console.log(n.Ay.bold("Activity Log")),console.log(` URL: ${n.Ay.cyan(d)}`),console.log(` Environment: ${u?n.Ay.green(u):n.Ay.yellow("custom")}`),console.log("─".repeat(50)),console.log(n.Ay.gray("\nUsage: bricks config endpoint <prod|beta|dev>"));return}var c=Object.keys(o);c.includes(e)||(console.error(n.Ay.red(`Invalid environment: ${e}`)),console.log(n.Ay.gray(`Valid options: ${c.join(", ")}`)),process.exit(1));var m=o[e],f=p[e],h=t.profile?(0,r.getCurrentProfile)():null;(0,r.setBaseUrl)(m,h),(0,r.setActivityLogBaseUrl)(f,h);var v=t.profile?` (profile: ${(0,r.getCurrentProfile)()})`:"";console.log(n.Ay.green(`✓ Endpoint changed to ${e}${v}`)),console.log(n.Ay.gray(` BRICKS: ${m}`)),console.log(n.Ay.gray(` Activity Log: ${f}`)),console.log(n.Ay.yellow("\nNote: You may need to re-authenticate if your token is for a different environment.")),console.log(n.Ay.gray("Use `bricks auth status` to check your connection."))}),d.command("show").description("Show current configuration").option("-j, --json","Output as JSON").action(e=>{var t=(0,r.getBaseUrl)(),a=s(t);if(e.json)return void console.log(JSON.stringify({endpoint:t,environment:a||"custom"},null,2));console.log(n.Ay.bold("\nBRICKS CLI Configuration")),console.log("─".repeat(50)),console.log(`BRICKS: ${n.Ay.cyan(t)}`),a?console.log(`Environment: ${n.Ay.green(a)}`):console.log(`Environment: ${n.Ay.yellow("custom")}`);var i=(0,r.getActivityLogBaseUrl)(),o=l(i);console.log(`Activity Log: ${n.Ay.cyan(i)} ${o?n.Ay.green(`(${o})`):n.Ay.yellow("(custom)")}`),console.log("─".repeat(50))})},23699(e,t,a){a.d(t,{E:()=>W});var i,n,r,o,s,p,l,d,u,c,m,f,h,v,g,y,b,D=a(68832),x=a(99436),w=a(79896),_=a(35679),E=a(73284),F=a(30155),A=a(88958),C=a(7586),S=a(56493),T=a(8479),k=a(47988),N=a(85382),O=["InSubspace","Global"],I={"https://display.bricks.tools":"https://bank.bricks.tools","https://display-beta.bricks.tools":"https://bank-beta.bricks.tools"},$=e=>{if(e&&!O.includes(e))throw Error(`Invalid meta "${e}" (expected ${O.join(" | ")})`)},j=`
|
|
45
45
|
propertyId
|
|
@@ -103,7 +103,7 @@ ${b.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(b.Ay.red(`Error: $
|
|
|
103
103
|
Found ${p.length} DevTools server(s)`)),console.log("─".repeat(80));var c=function*(e){var t=!1===e.verified?R.Ay.red("unverified"):R.Ay.green("online"),a=H(e),i=K(a),n=(e.protocols||[]).map(e=>R.Ay.cyan(e)).join(", "),r=e.workspaceId&&u&&e.workspaceId===u,o=e.addresses||[e.address],s=o.filter(t=>t!==e.address),p=s.length>0?`${e.address}:${e.port} +${s.length} more`:`${e.address}:${e.port}`;if(console.log(` ${R.Ay.bold(e.name||"Unknown")} ${R.Ay.gray(`(${p})`)} [${t}]`),s.length>0&&console.log(` Addresses: ${o.map(e=>R.Ay.gray(e)).join(", ")}`),e.version&&console.log(` Version: ${R.Ay.green(e.version)}`),e.chromeInspect){var l=e.passcode?R.Ay.cyan(e.passcode):R.Ay.gray("no passcode");console.log(` Chrome Inspect: ${R.Ay.green("supported")} (passcode: ${l})`)}var d=` Protocols: ${n||R.Ay.gray("none")} Auth: ${i}`;if(e.deviceId&&(d+=` Device: ${R.Ay.gray(e.deviceId)}`),console.log(d),e.workspaceId){var c=r?R.Ay.green(`${e.workspaceId} (current profile)`):R.Ay.gray(e.workspaceId);console.log(` Workspace: ${c}`)}};for(var m of p)yield*c(m);console.log("─".repeat(80));var f=p[0],h=`${f.address}:${f.port||19851}`,v=H(f),g=f.passcode?`/ws/${encodeURIComponent(f.passcode)}`:"workspace-jwt"===v?"/ws/<workspace-token>":"/ws/<passcode>";console.log(R.Ay.gray(`
|
|
104
104
|
Connect via: http://${h}/devtools-frontend/inspector.html?ws=${h}${g}`)),console.log(R.Ay.gray(`Legacy: devtools://devtools/bundled/inspector.html?ws=${h}${g}`)),process.exit(0)}catch(e){s.fail(`Scan failed: ${e.message}`),process.exit(1)}}),function(e){return l.apply(this,arguments)})),Z.command("open <address>").description("Show DevTools server information").option("-p, --port <port>",`Server port (default: ${Y})`).option("--info","Show connection URLs").action((d=j(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=Q(e),o=r.host??J,s=parseInt(t.port??r.port??Y,10),p=`${o}:${s}`,l=i(`Fetching server info from ${p}...`).start(),d=yield n(o,s);d||(l.fail(`Could not reach DevTools server at ${p}`),process.exit(1)),l.stop();var u=yield M(o,s),c=u?U(u?.[0]?.webSocketDebuggerUrl):null,m=H(d),f=c?`/ws/${encodeURIComponent(c)}`:"workspace-jwt"===m?"/ws/<workspace-token>":"/ws/<passcode>";if(t.info){console.log(R.Ay.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${R.Ay.cyan(`http://${p}`)}`),console.log(` CDP: ${R.Ay.cyan(`http://${p}/devtools-frontend/inspector.html?ws=${p}${f}`)}`),console.log(` CDP legacy: ${R.Ay.cyan(`devtools://devtools/bundled/inspector.html?ws=${p}${f}`)}`),console.log(` MCP: ${R.Ay.cyan(`http://${p}/mcp`)}`),console.log(` MCP SSE: ${R.Ay.cyan(`http://${p}/sse`)}`),console.log(` Info: ${R.Ay.cyan(`http://${p}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(R.Ay.bold("Authorization")),d.auth?.workspaceJwt?.enabled&&console.log(` Workspace JWT: ${R.Ay.green("enabled")} (kid: ${d.auth.workspaceJwt.kid})`),c&&console.log(` Passcode: ${R.Ay.cyan(c)}`),console.log(" MCP and MCP SSE require a Bearer token header:"),console.log(` ${R.Ay.gray(`Authorization: Bearer ${d.auth?.workspaceJwt?.enabled?"<workspace-token>":c||"<passcode>"}`)}`);return}if(console.log(R.Ay.bold("DevTools Server")),console.log("─".repeat(60)),console.log(` Name: ${R.Ay.cyan(d.name||"Unknown")}`),console.log(` Version: ${d.version?R.Ay.green(d.version):R.Ay.gray("N/A")}`),console.log(` Device ID: ${R.Ay.gray(d.deviceId||"N/A")}`),console.log(` Workspace: ${R.Ay.gray(d.workspaceId||"N/A")}`),console.log(` Protocols: ${(d.protocols||[]).map(e=>R.Ay.cyan(e)).join(", ")||R.Ay.gray("none")}`),console.log(` Auth: ${K(m)}`),console.log(` Port: ${d.port}`),u){var h=c?R.Ay.cyan(c):R.Ay.gray("no passcode");console.log(` Inspect: ${R.Ay.green("chrome://inspect supported")} (passcode: ${h})`)}else console.log(` Inspect: ${R.Ay.gray("chrome://inspect not available")}`);console.log("─".repeat(60)),d.version&&!W(d.version)&&console.log(R.Ay.yellow(`
|
|
105
105
|
CDP commands require version >= ${z}`)),console.log(R.Ay.gray(`
|
|
106
|
-
Use --info to see connection URLs`))}),function(e,t){return d.apply(this,arguments)})),ee(Z.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((u=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(R.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(R.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return u.apply(this,arguments)}));var er=Z.command("brick").description("Brick component inspection");ee(er.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((c=j(function*(e){var t;yield et(e,(t=j(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(en(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return c.apply(this,arguments)})),ee(er.command("query <selector>").description("Find brick by CSS selector")).action((m=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=ea((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(R.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(R.Ay.bold("Attributes:")),Object.entries(o))){var p=$(s,2),l=p[0],d=p[1];console.log(` ${R.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),ee(er.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((f=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=ea((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?R.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),ee(er.command("attributes <nodeId>").description("Get brick attributes")).action((h=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=ea((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(R.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=$(r,2),s=o[0],p=o[1];console.log(` ${R.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),ee(er.command("box-model <nodeId>").description("Get brick dimensions and position")).action((v=j(function*(e,t){var a;yield et(t,(a=j(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(R.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 v.apply(this,arguments)})),ee(er.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((g=j(function*(e,t){var a;yield et(t,(a=j(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(R.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: ${R.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(R.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${R.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return g.apply(this,arguments)})),ee(er.command("focus <nodeId>").description("Focus a brick element")).action((y=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(R.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)}));var eo=Z.command("input").description("Input emulation");ee(eo.command("tap <x> <y>").description("Tap/click at coordinates")).action((b=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){var n=parseFloat(e),r=parseFloat(t),o=yield i.send("Input.dispatchMouseEvent",{type:"mousePressed",x:n,y:r,button:"left",clickCount:1});yield i.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:n,y:r,button:"left",clickCount:1}),(({x:e,y:t,tapResult:a,json:i})=>{if(i)return console.log(JSON.stringify({x:e,y:t,...a||{}},null,2));console.log(R.Ay.green(`Tapped at (${e}, ${t})`));var n=ei(a?.element||a?.tappedElement||a?.hitElement);if(!n)return console.log(R.Ay.yellow(" Element: none"));console.log(` Element: ${n}`);var r=a?.hitElement,o=a?.tappedElement;if(r&&o&&r.nodeId!==o.nodeId){var s=ei(r);s&&console.log(` Hit: ${s}`)}a&&!1===a.dispatched&&console.log(R.Ay.yellow(" Action: no pressable handler"))})({x:n,y:r,tapResult:o,json:a.json})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return b.apply(this,arguments)})),ee(eo.command("type <text>").description("Insert text into focused element")).action((D=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.insertText",{text:e}),console.log(R.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)})),ee(eo.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((x=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(R.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var es=Z.command("network").description("Network inspection");ee(es.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((w=j(function*(e){var t;yield et(e,(t=j(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(R.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(R.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?R.Ay.red("ERR"):r.status?r.status<300?R.Ay.green(r.status):r.status<400?R.Ay.yellow(r.status):R.Ay.red(r.status):R.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${R.Ay.bold(r.method.padEnd(6))} ${s} ${R.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)})),ee(es.command("get <requestId>").description("Get response body for a network request")).action((_=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return _.apply(this,arguments)}));var ep="bricks://app",el="DATA-",ed="properties",eu="entries",ec=e=>{if(null==e||"object"!=typeof e)return{value:e};if("value"in e)return{value:e.value};if("unserializableValue"in e)return{value:e.unserializableValue};if(e.objectId){var t=e.preview?.properties;return Array.isArray(t)&&t.length>0?{value:t.reduce((e,t)=>(e[t.name]=t.value,e),{}),byRef:!0}:{value:e.description||`[${e.type}]`,byRef:!0}}return{value:"undefined"===e.type?void 0:e.description}},em=e=>{var t=e.startsWith(el)?e.slice(el.length):e,a=t.indexOf(":");return a<0?{shortId:t,title:null}:{shortId:t.slice(0,a),title:t.slice(a+1)}},ef=e=>{if(e.startsWith("global:"))return{scope:"global",name:e.slice(7)};if(e.startsWith("subspace:")){var t=e.slice(9),a=t.indexOf(":");return a>0?{scope:"subspace",subspaceUuid:t.slice(0,a),name:t.slice(a+1)}:{scope:"subspace",subspaceUuid:t,name:""}}return{scope:null,name:e}},eh=(e=[])=>{var t=new Map,a=new Map,i=new Set;for(var n of e||[])if(n&&"object"==typeof n){var r=n.shortId,o=n.uuid;r&&i.add(r),o&&(i.add(o),t.set(o,n),a.set(o,o),r&&a.set(r,o))}return{byUuid:t,uuidByScope:a,knownScopes:i}},ev=(e=[])=>e?.byUuid&&e?.uuidByScope&&e?.knownScopes?e:eh(e),eg=(E=j(function*(e){try{var t=yield e.send("Runtime.evaluate",{expression:"JSON.stringify(Object.values(system.subspaces()).map((s) => ({ shortId: s.shortId, uuid: s.uuid, title: s.title })))",objectGroup:"console",returnByValue:!0}),a=t.result;if(t.exceptionDetails||"string"!=typeof a?.value)return[];return JSON.parse(a.value)}catch{return[]}}),function(e){return E.apply(this,arguments)}),ey=(e,{full:t=!1,width:a=100}={})=>{var i="string"==typeof e?e:JSON.stringify(e);return void 0===i?R.Ay.gray("undefined"):t||i.length<=a?i:`${i.substring(0,a)}…`},eb=(e,t)=>{var a=ev(t),i=e.subspaceUuid?a.byUuid.get(e.subspaceUuid):null;return{key:e.rawKey,scope:e.scope,...e.subspaceUuid?{subspaceUuid:e.subspaceUuid}:{},...i?.shortId?{subspaceShortId:i.shortId}:{},name:e.name,value:e.value}},eD=(F=j(function*(e,{databaseName:t,objectStoreName:a,options:i}){var n=parseInt(i.skip??"0",10)||0,r=parseInt(i.limit??"25",10)||25,o=null;try{o=(yield e.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:t,objectStoreName:a})).entriesCount}catch{}var s=yield e.send("IndexedDB.requestData",{securityOrigin:ep,databaseName:t,objectStoreName:a,indexName:"",skipCount:n,pageSize:r,returnByValue:!0}),p=s.objectStoreDataEntries,l=s.hasMore,d=!1,u=p.map(e=>{var t=ec(e.key).value,a=ec(e.value),i=a.value;return a.byRef&&(d=!0),{key:t,value:i}});if(i.json)return void console.log(JSON.stringify({database:t,objectStore:a,skip:n,limit:r,total:o,hasMore:!!l,entries:u},null,2));var c=null==o?"":` of ${o}`,m=n>0?`, skipped ${n}`:"";for(var f of(console.log(R.Ay.bold(`${t} / ${a} (${u.length}${c} entries${m})`)),console.log("─".repeat(60)),0===u.length&&console.log(R.Ay.gray(" No entries")),u)){var h=f.key,v=f.value,g="string"==typeof h?h:JSON.stringify(h);console.log(` ${R.Ay.cyan(g)}: ${ey(v,{full:!!i.full})}`)}l&&console.log(R.Ay.gray(" …more entries available — use -l/--limit and -s/--skip")),d&&console.log(R.Ay.yellow("\n Some values came back as object handles (device app without by-value reads).\n Update the device app to see full values."))}),function(e,t){return F.apply(this,arguments)}),ex=e=>e.option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0").option("--full","Do not truncate values"),ew=Z.command("storage").description("Storage inspection (read-only — CDP cannot mutate device storage)");ee(ew.command("list").description("Overview of all storage stores with entry counts")).action((A=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("DOMStorage.enable"),yield t.send("IndexedDB.enable");var a,i=(a=j(function*(e){return(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries.length}),function(e){return a.apply(this,arguments)}),n=yield i(!0),r=yield i(!1),o=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,s=[];for(var p of o){var l=p.startsWith(el)?ed:eu,d=null;try{d=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:p,objectStoreName:l})).entriesCount}catch{}s.push({name:p,objectStoreName:l,entriesCount:d})}var u=s.filter(e=>e.name.startsWith(el)).map(e=>({...e,...em(e.name)})),c=s.filter(e=>!e.name.startsWith(el));if(e.json)return void console.log(JSON.stringify({system:{persist:n,memory:r},dataBanks:u,caches:c},null,2));var m=e=>null==e?R.Ay.gray("? entries"):`${e} entries`;for(var f of(console.log(R.Ay.bold("Storage Overview")+R.Ay.gray(" (read-only)")),console.log("─".repeat(60)),console.log(` ${R.Ay.bold("System storage")}${R.Ay.gray(" → storage system persist|memory")}`),console.log(` persist ${m(n)}`),console.log(` memory ${m(r)}`),console.log(` ${R.Ay.bold("Data banks")}${R.Ay.gray(" → storage data-bank get <S_xxxx|title>")}`),0===u.length&&console.log(R.Ay.gray(" none")),u)){var h=f.title?` "${f.title}"`:"";console.log(` ${R.Ay.cyan(f.shortId)}${h} ${m(f.entriesCount)}`)}for(var v of(console.log(` ${R.Ay.bold("Caches")}${R.Ay.gray(" → storage cache generator|generative-media")}`),0===c.length&&console.log(R.Ay.gray(" none")),c))console.log(` ${R.Ay.cyan(v.name)} ${m(v.entriesCount)}`);console.log("─".repeat(60))}),function(e){return t.apply(this,arguments)}))}),function(e){return A.apply(this,arguments)}));var e_=ew.command("system").description("System key-value storage"),eE=e=>e.option("--scope <scope>","Filter by scope: global or a subspace S_xxxx/UUID").option("--prefix <prefix>","Filter by key-name prefix (within the scope)").option("--full","Do not truncate values"),eF=(e,t)=>{var a;return a=j(function*(a){var i;yield et(a,(i=j(function*(i){yield i.send("DOMStorage.enable");var n=(yield i.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries,r=yield eg(i),o=eh(r),s=((e,{scope:t,prefix:a,subspaceIndex:i=[]}={})=>{var n=ev(i),r=t&&"global"!==t?n.uuidByScope.get(t)||t:null;return e.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).filter(e=>("global"!==t||"global"===e.scope)&&(!r||"subspace"===e.scope&&e.subspaceUuid===r)&&(!a||!!e.name.startsWith(a)))})(n,{scope:a.scope,prefix:a.prefix,subspaceIndex:o});if(a.json)return void console.log(JSON.stringify(s.map(e=>eb(e,o)),null,2));if(((e,{label:t,subspaceIndex:a,full:i})=>{var n=ev(a);if(console.log(R.Ay.bold(`${t} (${e.length} items)`)),console.log("─".repeat(60)),0===e.length)return console.log(R.Ay.gray(" No entries"));var r=null;for(var o of e){var s="subspace"===o.scope?`subspace:${o.subspaceUuid}`:o.scope;if(s!==r)if(r=s,"subspace"===o.scope){var p=n.byUuid.get(o.subspaceUuid),l=p?`${p.shortId}${p.title?` "${p.title}"`:""} `:"";console.log(` ${R.Ay.bold(`subspace ${l}`)}${R.Ay.gray(`(${o.subspaceUuid})`)}`)}else console.log(` ${R.Ay.bold(o.scope||"other")}`);var d=o.name||o.rawKey;console.log(` ${R.Ay.cyan(d)}: ${ey(o.value,{full:i,width:80})}`)}})(s,{label:t,subspaceIndex:o,full:!!a.full}),0===s.length&&a.scope&&"global"!==a.scope&&!o.knownScopes.has(a.scope)){var p=r.map(e=>e.shortId).join(", ");console.log(R.Ay.yellow(` Scope "${a.scope}" did not match a known subspace${p?` (known: ${p})`:""}`))}}),function(e){return i.apply(this,arguments)}))}),function(e){return a.apply(this,arguments)}};eE(ee(e_.command("persist").description("Show persistent system storage entries"))).action(eF(!0,"Persistent Storage")),eE(ee(e_.command("memory").description("Show in-memory system storage entries"))).action(eF(!1,"Memory Storage")),ee(e_.command("get <key>").description("Show a single system storage value (full, untruncated)").option("--scope <scope>","Key scope: global (default) or a subspace S_xxxx/UUID","global").option("--memory","Read from in-memory storage instead of persistent")).action((C=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOMStorage.enable");var i=(yield a.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:!t.memory}})).entries,n=eh((yield eg(a))),r=[e];if("global"===t.scope)r.push(`global:${e}`);else{var o=n.uuidByScope.get(t.scope)||t.scope;r.push(`subspace:${o}:${e}`)}var s=i.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).find(e=>r.includes(e.rawKey));if(!s){var p=i.map(([e])=>e).filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,5);if(p.length>0)for(var l of(console.error(R.Ay.yellow("Similar keys:")),p))console.error(` ${l}`);throw Error(`Key not found: ${r[r.length-1]}`)}if(t.json)return void console.log(JSON.stringify(eb(s,n),null,2));if("string"==typeof s.value)try{console.log(JSON.stringify(JSON.parse(s.value),null,2));return}catch{}console.log("string"==typeof s.value?s.value:JSON.stringify(s.value,null,2))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return C.apply(this,arguments)}));var eA=ew.command("data-bank").description("Data bank (Property Bank) stores");ee(eA.command("list").description("List data banks")).action((S=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,i=[];for(var n of a.filter(e=>e.startsWith(el))){var r=null;try{r=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:n,objectStoreName:ed})).entriesCount}catch{}i.push({name:n,...em(n),entriesCount:r})}if(e.json)return void console.log(JSON.stringify(i,null,2));for(var o of(console.log(R.Ay.bold(`Data Banks (${i.length})`)),console.log("─".repeat(60)),0===i.length&&console.log(R.Ay.gray(" No data banks")),i)){var s=o.title?` ${R.Ay.green(`"${o.title}"`)}`:"",p=null===o.entriesCount||void 0===o.entriesCount?"":R.Ay.gray(` ${o.entriesCount} entries`);console.log(` ${R.Ay.cyan(o.shortId)}${s}${p}`)}console.log(R.Ay.gray("\nInspect: bricks devtools storage data-bank get <S_xxxx|title>"))}),function(e){return t.apply(this,arguments)}))}),function(e){return S.apply(this,arguments)})),ex(ee(eA.command("get <bank> [store]").description(`Show data bank entries — <bank> accepts a subspace S_xxxx, a title keyword, or the full DATA-* database name; [store] defaults to "${ed}"`))).action((T=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,r=((e,t)=>{var a=e.filter(e=>e.startsWith(el)),i=a.find(e=>e===t||e===`${el}${t}`);if(i)return{match:i};if(t.startsWith("S_")){var n=a.filter(e=>em(e).shortId===t);if(1===n.length)return{match:n[0]};if(n.length>1)return{candidates:n}}var r=t.toLowerCase(),o=a.filter(e=>e.slice(el.length).toLowerCase().includes(r));return 1===o.length?{match:o[0]}:{candidates:o}})(n,e);if(!r.match){var o=n.filter(e=>e.startsWith(el)),s=(r.candidates?.length||0)>1,p=s?r.candidates:o;for(var l of(console.error(R.Ay.yellow(s?`Data bank "${e}" is ambiguous. Candidates:`:`Data bank "${e}" not found. Available:`)),p)){var d=em(l),u=d.shortId,c=d.title;console.error(` ${u}${c?` "${c}"`:""}`)}process.exit(1)}yield eD(i,{databaseName:r.match,objectStoreName:t||ed,options:a})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return T.apply(this,arguments)}));var eC=ew.command("cache").description("Cache stores (generator, generative-media)"),eS=e=>{var t;return t=j(function*(t){var a;yield et(t,(a=j(function*(a){yield a.send("IndexedDB.enable"),yield eD(a,{databaseName:e,objectStoreName:eu,options:t})}),function(e){return a.apply(this,arguments)}))}),function(e){return t.apply(this,arguments)}};ex(ee(eC.command("generator").description("Show generator cache entries"))).action(eS("GENERATOR_CACHE")),ex(ee(eC.command("generative-media").description("Show generative media cache entries"))).action(eS("GENERATIVE_MEDIA_CACHE")),ex(ee(ew.command("generator-cache",{hidden:!0}).description("Alias of `storage cache generator`"))).action(eS("GENERATOR_CACHE"));var eT=Z.command("runtime").description("Runtime and evaluation");ee(eT.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((k=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(R.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(R.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(R.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return k.apply(this,arguments)})),ee(eT.command("properties <objectId>").description("Get properties of a remote object")).action((N=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||R.Ay.gray(`[${r?.type}]`);console.log(` ${R.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return N.apply(this,arguments)}));var ek=Z.command("simulator").description("Inspect simulated peripherals (Application Simulator / web preview servers only)").command("thermal-printer").description("Simulated thermal printers and their print results"),eN="This DevTools server does not expose simulator inspection. Connect to an Application Simulator preview (e.g. the CTOR project simulator) running a preview build with the Simulator CDP domain.",eO=e=>{if(!e)return"unknown time";var t=new Date(e);return Number.isNaN(t.getTime())?"unknown time":t.toLocaleString()},eI=e=>{if(e.raw)return"raw data";var t=(e=>{if(!e?.length)return"";var t=[];for(var a of e){var i=t[t.length-1];i&&i.type===a?i.count+=1:t.push({type:a,count:1})}return t.map(({type:e,count:t})=>t>1?`${e}\xd7${t}`:e).join(", ")})(e.commandTypes);return`${e.commandCount} command(s)${t?`: ${t}`:""}`};ee(ek.command("list").description("List simulated thermal printers and their print history").option("--commands","Include full print command payloads (use with -j)")).action((O=j(function*(e){var t;yield et(e,(t=j(function*(t){var a=yield t.send("Simulator.listThermalPrinters",{includeCommands:!!e.commands}),i=a?.printers;if(Array.isArray(i)||(console.error(R.Ay.red(eN)),process.exit(1)),e.json)return void console.log(JSON.stringify(i,null,2));if(0===i.length){console.log(R.Ay.yellow("No simulated thermal printers registered.")),console.log(R.Ay.gray("A printer appears once the application configures GENERATOR_THERMAL_PRINTER."));return}for(var n of(console.log(R.Ay.bold(`Simulated Thermal Printers (${i.length})`)),console.log("─".repeat(60)),i)){var r=n.errored?R.Ay.red("fault"):n.connected?R.Ay.green("connected"):R.Ay.gray("idle");console.log(` ${R.Ay.bold(n.label||n.driver)} ${R.Ay.gray(`(${n.driver})`)} [${r}]`),console.log(` Printer ID: ${R.Ay.cyan(n.id)}`),n.connectString&&console.log(` Connect: ${R.Ay.gray(n.connectString)}`);var o=n.printHistory||[];if(0===o.length){console.log(R.Ay.gray(" No print results yet."));continue}var s="memory"===n.printHistorySource?R.Ay.gray(" (restored from memory)"):"";for(var p of(console.log(` Print results, newest first${s}:`),o))console.log(` --index ${p.index} ${eO(p.printedAt)} ${R.Ay.gray(eI(p))}`)}console.log("─".repeat(60)),console.log(R.Ay.gray("Save one as PNG: bricks devtools simulator thermal-printer print-result"))}),function(e){return t.apply(this,arguments)}))}),function(e){return O.apply(this,arguments)})),ee(ek.command("print-result").description("Render a simulated print result to a PNG image").option("--printer <id>","Printer ID (see `list`; defaults to the only registered printer)").option("-i, --index <n>","Print history index, 0 = latest","0").option("--scale <factor>","Image scale factor (1-4)","2").option("-o, --output <path>","Output file path")).action((I=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Simulator.captureThermalPrinterPrintResult",{id:e.printer,index:parseInt(e.index,10)||0,scale:parseFloat(e.scale)||2},3e4);i?.data||(console.error(R.Ay.red(eN)),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||`print-result-${Date.now()}.png`,s=r.resolve(o);(n.writeFileSync(s,Buffer.from(i.data,"base64")),e.json)?console.log(JSON.stringify({path:s,id:i.id,driver:i.driver,label:i.label,index:i.index,printedAt:i.printedAt,width:i.width,height:i.height},null,2)):(console.log(R.Ay.green(`Print result saved to ${s}`)),console.log(` Printer: ${i.label} ${R.Ay.gray(`(${i.driver}, ${i.id})`)}`),console.log(` Printed: ${eO(i.printedAt)} (--index ${i.index})`),i.width&&i.height&&console.log(` Size: ${i.width}\xd7${i.height}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return I.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(47988),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.53",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:()=>w});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),b=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("○")},D=(e,t)=>(0,y.H_)(e,t,{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"],w=new c.uB("group").description("Device Group management");w.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)})),w.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(`
|
|
106
|
+
Use --info to see connection URLs`))}),function(e,t){return d.apply(this,arguments)})),ee(Z.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((u=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(R.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(R.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return u.apply(this,arguments)}));var er=Z.command("brick").description("Brick component inspection");ee(er.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((c=j(function*(e){var t;yield et(e,(t=j(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(en(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return c.apply(this,arguments)})),ee(er.command("query <selector>").description("Find brick by CSS selector")).action((m=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=ea((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(R.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(R.Ay.bold("Attributes:")),Object.entries(o))){var p=$(s,2),l=p[0],d=p[1];console.log(` ${R.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),ee(er.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((f=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=ea((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?R.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),ee(er.command("attributes <nodeId>").description("Get brick attributes")).action((h=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=ea((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(R.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=$(r,2),s=o[0],p=o[1];console.log(` ${R.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),ee(er.command("box-model <nodeId>").description("Get brick dimensions and position")).action((v=j(function*(e,t){var a;yield et(t,(a=j(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(R.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 v.apply(this,arguments)})),ee(er.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((g=j(function*(e,t){var a;yield et(t,(a=j(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(R.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: ${R.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(R.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${R.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return g.apply(this,arguments)})),ee(er.command("focus <nodeId>").description("Focus a brick element")).action((y=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(R.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)}));var eo=Z.command("input").description("Input emulation");ee(eo.command("tap <x> <y>").description("Tap/click at coordinates")).action((b=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){var n=parseFloat(e),r=parseFloat(t),o=yield i.send("Input.dispatchMouseEvent",{type:"mousePressed",x:n,y:r,button:"left",clickCount:1});yield i.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:n,y:r,button:"left",clickCount:1}),(({x:e,y:t,tapResult:a,json:i})=>{if(i)return console.log(JSON.stringify({x:e,y:t,...a||{}},null,2));console.log(R.Ay.green(`Tapped at (${e}, ${t})`));var n=ei(a?.element||a?.tappedElement||a?.hitElement);if(!n)return console.log(R.Ay.yellow(" Element: none"));console.log(` Element: ${n}`);var r=a?.hitElement,o=a?.tappedElement;if(r&&o&&r.nodeId!==o.nodeId){var s=ei(r);s&&console.log(` Hit: ${s}`)}a&&!1===a.dispatched&&console.log(R.Ay.yellow(" Action: no pressable handler"))})({x:n,y:r,tapResult:o,json:a.json})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return b.apply(this,arguments)})),ee(eo.command("type <text>").description("Insert text into focused element")).action((D=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.insertText",{text:e}),console.log(R.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)})),ee(eo.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((x=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(R.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var es=Z.command("network").description("Network inspection");ee(es.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((w=j(function*(e){var t;yield et(e,(t=j(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(R.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(R.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?R.Ay.red("ERR"):r.status?r.status<300?R.Ay.green(r.status):r.status<400?R.Ay.yellow(r.status):R.Ay.red(r.status):R.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${R.Ay.bold(r.method.padEnd(6))} ${s} ${R.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)})),ee(es.command("get <requestId>").description("Get response body for a network request")).action((_=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return _.apply(this,arguments)}));var ep="bricks://app",el="DATA-",ed="properties",eu="entries",ec=e=>{if(null==e||"object"!=typeof e)return{value:e};if("value"in e)return{value:e.value};if("unserializableValue"in e)return{value:e.unserializableValue};if(e.objectId){var t=e.preview?.properties;return Array.isArray(t)&&t.length>0?{value:t.reduce((e,t)=>(e[t.name]=t.value,e),{}),byRef:!0}:{value:e.description||`[${e.type}]`,byRef:!0}}return{value:"undefined"===e.type?void 0:e.description}},em=e=>{var t=e.startsWith(el)?e.slice(el.length):e,a=t.indexOf(":");return a<0?{shortId:t,title:null}:{shortId:t.slice(0,a),title:t.slice(a+1)}},ef=e=>{if(e.startsWith("global:"))return{scope:"global",name:e.slice(7)};if(e.startsWith("subspace:")){var t=e.slice(9),a=t.indexOf(":");return a>0?{scope:"subspace",subspaceUuid:t.slice(0,a),name:t.slice(a+1)}:{scope:"subspace",subspaceUuid:t,name:""}}return{scope:null,name:e}},eh=(e=[])=>{var t=new Map,a=new Map,i=new Set;for(var n of e||[])if(n&&"object"==typeof n){var r=n.shortId,o=n.uuid;r&&i.add(r),o&&(i.add(o),t.set(o,n),a.set(o,o),r&&a.set(r,o))}return{byUuid:t,uuidByScope:a,knownScopes:i}},ev=(e=[])=>e?.byUuid&&e?.uuidByScope&&e?.knownScopes?e:eh(e),eg=(E=j(function*(e){try{var t=yield e.send("Runtime.evaluate",{expression:"JSON.stringify(Object.values(system.subspaces()).map((s) => ({ shortId: s.shortId, uuid: s.uuid, title: s.title })))",objectGroup:"console",returnByValue:!0}),a=t.result;if(t.exceptionDetails||"string"!=typeof a?.value)return[];return JSON.parse(a.value)}catch{return[]}}),function(e){return E.apply(this,arguments)}),ey=(e,{full:t=!1,width:a=100}={})=>{var i="string"==typeof e?e:JSON.stringify(e);return void 0===i?R.Ay.gray("undefined"):t||i.length<=a?i:`${i.substring(0,a)}…`},eb=(e,t)=>{var a=ev(t),i=e.subspaceUuid?a.byUuid.get(e.subspaceUuid):null;return{key:e.rawKey,scope:e.scope,...e.subspaceUuid?{subspaceUuid:e.subspaceUuid}:{},...i?.shortId?{subspaceShortId:i.shortId}:{},name:e.name,value:e.value}},eD=(F=j(function*(e,{databaseName:t,objectStoreName:a,options:i}){var n=parseInt(i.skip??"0",10)||0,r=parseInt(i.limit??"25",10)||25,o=null;try{o=(yield e.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:t,objectStoreName:a})).entriesCount}catch{}var s=yield e.send("IndexedDB.requestData",{securityOrigin:ep,databaseName:t,objectStoreName:a,indexName:"",skipCount:n,pageSize:r,returnByValue:!0}),p=s.objectStoreDataEntries,l=s.hasMore,d=!1,u=p.map(e=>{var t=ec(e.key).value,a=ec(e.value),i=a.value;return a.byRef&&(d=!0),{key:t,value:i}});if(i.json)return void console.log(JSON.stringify({database:t,objectStore:a,skip:n,limit:r,total:o,hasMore:!!l,entries:u},null,2));var c=null==o?"":` of ${o}`,m=n>0?`, skipped ${n}`:"";for(var f of(console.log(R.Ay.bold(`${t} / ${a} (${u.length}${c} entries${m})`)),console.log("─".repeat(60)),0===u.length&&console.log(R.Ay.gray(" No entries")),u)){var h=f.key,v=f.value,g="string"==typeof h?h:JSON.stringify(h);console.log(` ${R.Ay.cyan(g)}: ${ey(v,{full:!!i.full})}`)}l&&console.log(R.Ay.gray(" …more entries available — use -l/--limit and -s/--skip")),d&&console.log(R.Ay.yellow("\n Some values came back as object handles (device app without by-value reads).\n Update the device app to see full values."))}),function(e,t){return F.apply(this,arguments)}),ex=e=>e.option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0").option("--full","Do not truncate values"),ew=Z.command("storage").description("Storage inspection (read-only — CDP cannot mutate device storage)");ee(ew.command("list").description("Overview of all storage stores with entry counts")).action((A=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("DOMStorage.enable"),yield t.send("IndexedDB.enable");var a,i=(a=j(function*(e){return(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries.length}),function(e){return a.apply(this,arguments)}),n=yield i(!0),r=yield i(!1),o=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,s=[];for(var p of o){var l=p.startsWith(el)?ed:eu,d=null;try{d=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:p,objectStoreName:l})).entriesCount}catch{}s.push({name:p,objectStoreName:l,entriesCount:d})}var u=s.filter(e=>e.name.startsWith(el)).map(e=>({...e,...em(e.name)})),c=s.filter(e=>!e.name.startsWith(el));if(e.json)return void console.log(JSON.stringify({system:{persist:n,memory:r},dataBanks:u,caches:c},null,2));var m=e=>null==e?R.Ay.gray("? entries"):`${e} entries`;for(var f of(console.log(R.Ay.bold("Storage Overview")+R.Ay.gray(" (read-only)")),console.log("─".repeat(60)),console.log(` ${R.Ay.bold("System storage")}${R.Ay.gray(" → storage system persist|memory")}`),console.log(` persist ${m(n)}`),console.log(` memory ${m(r)}`),console.log(` ${R.Ay.bold("Data banks")}${R.Ay.gray(" → storage data-bank get <S_xxxx|title>")}`),0===u.length&&console.log(R.Ay.gray(" none")),u)){var h=f.title?` "${f.title}"`:"";console.log(` ${R.Ay.cyan(f.shortId)}${h} ${m(f.entriesCount)}`)}for(var v of(console.log(` ${R.Ay.bold("Caches")}${R.Ay.gray(" → storage cache generator|generative-media")}`),0===c.length&&console.log(R.Ay.gray(" none")),c))console.log(` ${R.Ay.cyan(v.name)} ${m(v.entriesCount)}`);console.log("─".repeat(60))}),function(e){return t.apply(this,arguments)}))}),function(e){return A.apply(this,arguments)}));var e_=ew.command("system").description("System key-value storage"),eE=e=>e.option("--scope <scope>","Filter by scope: global or a subspace S_xxxx/UUID").option("--prefix <prefix>","Filter by key-name prefix (within the scope)").option("--full","Do not truncate values"),eF=(e,t)=>{var a;return a=j(function*(a){var i;yield et(a,(i=j(function*(i){yield i.send("DOMStorage.enable");var n=(yield i.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries,r=yield eg(i),o=eh(r),s=((e,{scope:t,prefix:a,subspaceIndex:i=[]}={})=>{var n=ev(i),r=t&&"global"!==t?n.uuidByScope.get(t)||t:null;return e.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).filter(e=>("global"!==t||"global"===e.scope)&&(!r||"subspace"===e.scope&&e.subspaceUuid===r)&&(!a||!!e.name.startsWith(a)))})(n,{scope:a.scope,prefix:a.prefix,subspaceIndex:o});if(a.json)return void console.log(JSON.stringify(s.map(e=>eb(e,o)),null,2));if(((e,{label:t,subspaceIndex:a,full:i})=>{var n=ev(a);if(console.log(R.Ay.bold(`${t} (${e.length} items)`)),console.log("─".repeat(60)),0===e.length)return console.log(R.Ay.gray(" No entries"));var r=null;for(var o of e){var s="subspace"===o.scope?`subspace:${o.subspaceUuid}`:o.scope;if(s!==r)if(r=s,"subspace"===o.scope){var p=n.byUuid.get(o.subspaceUuid),l=p?`${p.shortId}${p.title?` "${p.title}"`:""} `:"";console.log(` ${R.Ay.bold(`subspace ${l}`)}${R.Ay.gray(`(${o.subspaceUuid})`)}`)}else console.log(` ${R.Ay.bold(o.scope||"other")}`);var d=o.name||o.rawKey;console.log(` ${R.Ay.cyan(d)}: ${ey(o.value,{full:i,width:80})}`)}})(s,{label:t,subspaceIndex:o,full:!!a.full}),0===s.length&&a.scope&&"global"!==a.scope&&!o.knownScopes.has(a.scope)){var p=r.map(e=>e.shortId).join(", ");console.log(R.Ay.yellow(` Scope "${a.scope}" did not match a known subspace${p?` (known: ${p})`:""}`))}}),function(e){return i.apply(this,arguments)}))}),function(e){return a.apply(this,arguments)}};eE(ee(e_.command("persist").description("Show persistent system storage entries"))).action(eF(!0,"Persistent Storage")),eE(ee(e_.command("memory").description("Show in-memory system storage entries"))).action(eF(!1,"Memory Storage")),ee(e_.command("get <key>").description("Show a single system storage value (full, untruncated)").option("--scope <scope>","Key scope: global (default) or a subspace S_xxxx/UUID","global").option("--memory","Read from in-memory storage instead of persistent")).action((C=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOMStorage.enable");var i=(yield a.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:!t.memory}})).entries,n=eh((yield eg(a))),r=[e];if("global"===t.scope)r.push(`global:${e}`);else{var o=n.uuidByScope.get(t.scope)||t.scope;r.push(`subspace:${o}:${e}`)}var s=i.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).find(e=>r.includes(e.rawKey));if(!s){var p=i.map(([e])=>e).filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,5);if(p.length>0)for(var l of(console.error(R.Ay.yellow("Similar keys:")),p))console.error(` ${l}`);throw Error(`Key not found: ${r[r.length-1]}`)}if(t.json)return void console.log(JSON.stringify(eb(s,n),null,2));if("string"==typeof s.value)try{console.log(JSON.stringify(JSON.parse(s.value),null,2));return}catch{}console.log("string"==typeof s.value?s.value:JSON.stringify(s.value,null,2))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return C.apply(this,arguments)}));var eA=ew.command("data-bank").description("Data bank (Property Bank) stores");ee(eA.command("list").description("List data banks")).action((S=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,i=[];for(var n of a.filter(e=>e.startsWith(el))){var r=null;try{r=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:n,objectStoreName:ed})).entriesCount}catch{}i.push({name:n,...em(n),entriesCount:r})}if(e.json)return void console.log(JSON.stringify(i,null,2));for(var o of(console.log(R.Ay.bold(`Data Banks (${i.length})`)),console.log("─".repeat(60)),0===i.length&&console.log(R.Ay.gray(" No data banks")),i)){var s=o.title?` ${R.Ay.green(`"${o.title}"`)}`:"",p=null===o.entriesCount||void 0===o.entriesCount?"":R.Ay.gray(` ${o.entriesCount} entries`);console.log(` ${R.Ay.cyan(o.shortId)}${s}${p}`)}console.log(R.Ay.gray("\nInspect: bricks devtools storage data-bank get <S_xxxx|title>"))}),function(e){return t.apply(this,arguments)}))}),function(e){return S.apply(this,arguments)})),ex(ee(eA.command("get <bank> [store]").description(`Show data bank entries — <bank> accepts a subspace S_xxxx, a title keyword, or the full DATA-* database name; [store] defaults to "${ed}"`))).action((T=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,r=((e,t)=>{var a=e.filter(e=>e.startsWith(el)),i=a.find(e=>e===t||e===`${el}${t}`);if(i)return{match:i};if(t.startsWith("S_")){var n=a.filter(e=>em(e).shortId===t);if(1===n.length)return{match:n[0]};if(n.length>1)return{candidates:n}}var r=t.toLowerCase(),o=a.filter(e=>e.slice(el.length).toLowerCase().includes(r));return 1===o.length?{match:o[0]}:{candidates:o}})(n,e);if(!r.match){var o=n.filter(e=>e.startsWith(el)),s=(r.candidates?.length||0)>1,p=s?r.candidates:o;for(var l of(console.error(R.Ay.yellow(s?`Data bank "${e}" is ambiguous. Candidates:`:`Data bank "${e}" not found. Available:`)),p)){var d=em(l),u=d.shortId,c=d.title;console.error(` ${u}${c?` "${c}"`:""}`)}process.exit(1)}yield eD(i,{databaseName:r.match,objectStoreName:t||ed,options:a})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return T.apply(this,arguments)}));var eC=ew.command("cache").description("Cache stores (generator, generative-media)"),eS=e=>{var t;return t=j(function*(t){var a;yield et(t,(a=j(function*(a){yield a.send("IndexedDB.enable"),yield eD(a,{databaseName:e,objectStoreName:eu,options:t})}),function(e){return a.apply(this,arguments)}))}),function(e){return t.apply(this,arguments)}};ex(ee(eC.command("generator").description("Show generator cache entries"))).action(eS("GENERATOR_CACHE")),ex(ee(eC.command("generative-media").description("Show generative media cache entries"))).action(eS("GENERATIVE_MEDIA_CACHE")),ex(ee(ew.command("generator-cache",{hidden:!0}).description("Alias of `storage cache generator`"))).action(eS("GENERATOR_CACHE"));var eT=Z.command("runtime").description("Runtime and evaluation");ee(eT.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((k=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(R.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(R.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(R.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return k.apply(this,arguments)})),ee(eT.command("properties <objectId>").description("Get properties of a remote object")).action((N=j(function*(e,t){var a;yield et(t,(a=j(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(R.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||R.Ay.gray(`[${r?.type}]`);console.log(` ${R.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return N.apply(this,arguments)}));var ek=Z.command("simulator").description("Inspect simulated peripherals (Application Simulator / web preview servers only)").command("thermal-printer").description("Simulated thermal printers and their print results"),eN="This DevTools server does not expose simulator inspection. Connect to an Application Simulator preview (e.g. the CTOR project simulator) running a preview build with the Simulator CDP domain.",eO=e=>{if(!e)return"unknown time";var t=new Date(e);return Number.isNaN(t.getTime())?"unknown time":t.toLocaleString()},eI=e=>{if(e.raw)return"raw data";var t=(e=>{if(!e?.length)return"";var t=[];for(var a of e){var i=t[t.length-1];i&&i.type===a?i.count+=1:t.push({type:a,count:1})}return t.map(({type:e,count:t})=>t>1?`${e}\xd7${t}`:e).join(", ")})(e.commandTypes);return`${e.commandCount} command(s)${t?`: ${t}`:""}`};ee(ek.command("list").description("List simulated thermal printers and their print history").option("--commands","Include full print command payloads (use with -j)")).action((O=j(function*(e){var t;yield et(e,(t=j(function*(t){var a=yield t.send("Simulator.listThermalPrinters",{includeCommands:!!e.commands}),i=a?.printers;if(Array.isArray(i)||(console.error(R.Ay.red(eN)),process.exit(1)),e.json)return void console.log(JSON.stringify(i,null,2));if(0===i.length){console.log(R.Ay.yellow("No simulated thermal printers registered.")),console.log(R.Ay.gray("A printer appears once the application configures GENERATOR_THERMAL_PRINTER."));return}for(var n of(console.log(R.Ay.bold(`Simulated Thermal Printers (${i.length})`)),console.log("─".repeat(60)),i)){var r=n.errored?R.Ay.red("fault"):n.connected?R.Ay.green("connected"):R.Ay.gray("idle");console.log(` ${R.Ay.bold(n.label||n.driver)} ${R.Ay.gray(`(${n.driver})`)} [${r}]`),console.log(` Printer ID: ${R.Ay.cyan(n.id)}`),n.connectString&&console.log(` Connect: ${R.Ay.gray(n.connectString)}`);var o=n.printHistory||[];if(0===o.length){console.log(R.Ay.gray(" No print results yet."));continue}var s="memory"===n.printHistorySource?R.Ay.gray(" (restored from memory)"):"";for(var p of(console.log(` Print results, newest first${s}:`),o))console.log(` --index ${p.index} ${eO(p.printedAt)} ${R.Ay.gray(eI(p))}`)}console.log("─".repeat(60)),console.log(R.Ay.gray("Save one as PNG: bricks devtools simulator thermal-printer print-result"))}),function(e){return t.apply(this,arguments)}))}),function(e){return O.apply(this,arguments)})),ee(ek.command("print-result").description("Render a simulated print result to a PNG image").option("--printer <id>","Printer ID (see `list`; defaults to the only registered printer)").option("-i, --index <n>","Print history index, 0 = latest","0").option("--scale <factor>","Image scale factor (1-4)","2").option("-o, --output <path>","Output file path")).action((I=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Simulator.captureThermalPrinterPrintResult",{id:e.printer,index:parseInt(e.index,10)||0,scale:parseFloat(e.scale)||2},3e4);i?.data||(console.error(R.Ay.red(eN)),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||`print-result-${Date.now()}.png`,s=r.resolve(o);(n.writeFileSync(s,Buffer.from(i.data,"base64")),e.json)?console.log(JSON.stringify({path:s,id:i.id,driver:i.driver,label:i.label,index:i.index,printedAt:i.printedAt,width:i.width,height:i.height},null,2)):(console.log(R.Ay.green(`Print result saved to ${s}`)),console.log(` Printer: ${i.label} ${R.Ay.gray(`(${i.driver}, ${i.id})`)}`),console.log(` Printed: ${eO(i.printedAt)} (--index ${i.index})`),i.width&&i.height&&console.log(` Size: ${i.width}\xd7${i.height}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return I.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(47988),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.58",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:()=>w});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),b=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("○")},D=(e,t)=>(0,y.H_)(e,t,{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"],w=new c.uB("group").description("Device Group management");w.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)})),w.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(`
|
|
107
107
|
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(`
|
|
108
108
|
${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)})),w.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(`
|
|
109
109
|
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)})),w.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.device||{},a=t.entry_detail?.watch_dog_timer?.last_alive_time,i=b(a),n=t.name||t.device_name||e.target_name||t._id||"Unknown",r=t.entry_detail?.application?.name||m.Ay.gray("No app");console.log(`${i} ${m.Ay.cyan(n.padEnd(30))} ${r}`)}),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)})),w.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:D(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:D(r,e),result:{action:t,dispatched:o?.dispatched||0,devices:o?.devices||0},json:!0}):(n.succeed(`Action dispatched: ${m.Ay.green(t)}`),o&&(console.log(`Dispatched: ${m.Ay.green(o.dispatched||0)}`),console.log(`Devices: ${m.Ay.gray(o.devices||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)})),w.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:D(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:D(n,e),result:{dispatched:r?.dispatched||0,devices:r?.devices||0},json:!0}):(i.succeed("Devices refreshed"),r&&(console.log(`Dispatched: ${m.Ay.green(r.dispatched||0)}`),console.log(`Devices: ${m.Ay.gray(r.devices||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)})),w.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.
|
|
@@ -122,7 +122,7 @@ ${y.Ay.bold("Usage")}`),console.log(`Used In: ${n.use_count.total_count} ap
|
|
|
122
122
|
${y.Ay.bold("Exposed Properties")} (${n.expose_properties.length})`),n.expose_properties.forEach(e=>{console.log(` - ${y.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)})),k.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=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Resolving module...").start();try{var n=yield(0,A.Y)(()=>a.module({id:e})),r=n?[n]:yield a.modules({keyword:e,paginate:{limit:t.limit}}),o=(0,A.K)({resource:"module",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,E.GF)(o);if(o.resolved){var s=o.resolved;console.log(y.Ay.bold("\nResolved Module")),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 modules matched "${e}"`));console.log(y.Ay.bold(`
|
|
123
123
|
Matching Modules (${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 module: ${t.message}`):(0,E.OW)(t.message,{resource:"module",query:e}),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),k.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=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.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=D.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,S.yd)({action:"module.update",target:T(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Module updated: ${y.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(y.Ay.yellow("Note: Module has unreleased changes")))}catch(a){t.json?(0,E.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)})),k.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((l=v(function*(e,t){var a=(0,F.o)(),i=(0,b.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: ${y.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)})),k.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=v(function*(e,t){var a=(0,F.o)(),i=(0,b.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(y.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,_.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(`
|
|
124
124
|
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(y.Ay.cyan(`
|
|
125
|
-
${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 d.apply(this,arguments)})),k.command("remove <id>").description("Remove a module").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((u=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Removing module...").start();try{var n=yield a.module({id:e});if(!n)throw Error("Module not found");var r=T(n,e);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"module.remove",target:r,request:{id:e},checks:[(0,S.Iy)("module exists",!0,`${r.name} (${r.id})`)],json:t.json});return}var o=yield a.removeModule({id:e});t.json?(0,S.yd)({action:"module.remove",target:r,result:{removed:!!o},json:!0}):i.succeed(`Module removed: ${y.Ay.green(r.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.remove",target:{id:e}}):i.fail(`Failed to remove module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),k.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((c=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Releasing module...").start();try{var n=(0,C.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,C.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,S.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,S.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,S.Iy)("module is private",!p.is_public),(0,S.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,S.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: ${y.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),k.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.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: ${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 module project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),k.command("doctor <idOrPath>").description("Diagnose a module config: schema validation plus semantic lint rules (data races, layout mistakes, dead config)").option("-j, --json","Output as JSON").option("--strict","Exit with code 1 when warnings are found").option("--only <codes>","Run only these rule codes (comma-separated)").option("--ignore <codes>","Skip these rule codes (comma-separated)").option("--validate-automation","Also validate automation_map and test_map references").action((f=v(function*(e,t){var i=t.json?null:(0,b.default)("Running config doctor...").start();try{var n=yield Promise.all([a.e(587),a.e(341),a.e(10),a.e(511),a.e(223)]).then(a.bind(a,63322)),r=n.runConfigDoctor,o=n.renderConfigDoctorReport,s=yield r("module",e,t),p=s.report,l=s.exitCode;i?.stop(),t.json?(0,E.GF)({...p,exitCode:l}):console.log(o(p)),0!==l&&process.exit(l)}catch(e){i?i.fail(`Config doctor failed: ${e.message}`):(0,E.OW)(e.message),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),k.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((h=v(function*(e,t){var i=(yield a.e(456).then(a.bind(a,58891))).initProject;yield i("module",e,t)}),function(e,t){return h.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),b=a(48161),D=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),w=a(31421),_=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,A=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,C=e=>"beta"===e?"beta":"latest",S=(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)}),T=(n=c(function*(e){return(yield S(A(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),k=(r=c(function*(e){var t=C(e),a=yield S(`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?k(e):T(e)}),function(e,t){return o.apply(this,arguments)}),O=(e,t,a={})=>{var i=(0,w.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 S(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(b.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield _.writeFile(n,i),F||(yield _.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(A(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];O(o,s)}finally{yield _.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void O("npm",["install","-g",`${E}@${C(t)}`]);if("bun"===e)return void O("bun",["install","-g",`${E}@${C(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.53",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=b.homedir(),realpath:i=D}={})=>{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.53")?"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(`
|
|
125
|
+
${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 d.apply(this,arguments)})),k.command("remove <id>").description("Remove a module").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((u=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Removing module...").start();try{var n=yield a.module({id:e});if(!n)throw Error("Module not found");var r=T(n,e);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"module.remove",target:r,request:{id:e},checks:[(0,S.Iy)("module exists",!0,`${r.name} (${r.id})`)],json:t.json});return}var o=yield a.removeModule({id:e});t.json?(0,S.yd)({action:"module.remove",target:r,result:{removed:!!o},json:!0}):i.succeed(`Module removed: ${y.Ay.green(r.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.remove",target:{id:e}}):i.fail(`Failed to remove module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),k.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((c=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Releasing module...").start();try{var n=(0,C.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,C.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,S.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,S.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,S.Iy)("module is private",!p.is_public),(0,S.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,S.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: ${y.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),k.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.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: ${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 module project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),k.command("doctor <idOrPath>").description("Diagnose a module config: schema validation plus semantic lint rules (data races, layout mistakes, dead config)").option("-j, --json","Output as JSON").option("--strict","Exit with code 1 when warnings are found").option("--only <codes>","Run only these rule codes (comma-separated)").option("--ignore <codes>","Skip these rule codes (comma-separated)").option("--validate-automation","Also validate automation_map and test_map references").action((f=v(function*(e,t){var i=t.json?null:(0,b.default)("Running config doctor...").start();try{var n=yield Promise.all([a.e(587),a.e(249),a.e(10),a.e(511),a.e(223)]).then(a.bind(a,63322)),r=n.runConfigDoctor,o=n.renderConfigDoctorReport,s=yield r("module",e,t),p=s.report,l=s.exitCode;i?.stop(),t.json?(0,E.GF)({...p,exitCode:l}):console.log(o(p)),0!==l&&process.exit(l)}catch(e){i?i.fail(`Config doctor failed: ${e.message}`):(0,E.OW)(e.message),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),k.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((h=v(function*(e,t){var i=(yield a.e(456).then(a.bind(a,58891))).initProject;yield i("module",e,t)}),function(e,t){return h.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),b=a(48161),D=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),w=a(31421),_=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,A=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,C=e=>"beta"===e?"beta":"latest",S=(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)}),T=(n=c(function*(e){return(yield S(A(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),k=(r=c(function*(e){var t=C(e),a=yield S(`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?k(e):T(e)}),function(e,t){return o.apply(this,arguments)}),O=(e,t,a={})=>{var i=(0,w.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 S(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(b.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield _.writeFile(n,i),F||(yield _.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(A(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];O(o,s)}finally{yield _.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void O("npm",["install","-g",`${E}@${C(t)}`]);if("bun"===e)return void O("bun",["install","-g",`${E}@${C(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.58",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=b.homedir(),realpath:i=D}={})=>{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.58")?"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(`
|
|
126
126
|
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(`
|
|
127
127
|
→ Running ${e} update...`));try{return yield j(e,n,i),!0}catch(t){return console.error(f.Ay.yellow(`
|
|
128
128
|
${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(e){if(e.errors?.length)throw Error(e.errors.map(e=>e.message).join("\n"));if(e.data){for(var t of Object.values(e.data))if(Array.isArray(t))for(var a of t)yield a}if(Array.isArray(e.incremental)){for(var i of e.incremental)if(Array.isArray(i.items))for(var n of i.items)yield n}}function g(){return(g=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=e=>{for(var t=0;-1!==(t=e.indexOf(s,t));){if(0===t||"\n"===e[t-1])return t;t+=s.length}return -1},h=function*(){for(var e;-1!==(e=m(p));){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(yield*v(n),!1===n.hasNext){l=!0;return}}}};try{var g=!1,y=!1;try{for(var b,D,x=f(e.body);g=!(D=yield d(x.next())).done;g=!1){var w=D.value;if(p+=c.decode(w,{stream:!0}),yield*u(f(h()),d),l)break}}catch(e){y=!0,b=e}finally{try{g&&null!=x.return&&(yield d(x.return()))}finally{if(y)throw b}}}catch(e){if(!e.message?.includes("Premature close")||!l)throw e}if(!l&&p.trim()){var _,E=p.indexOf("\r\n\r\n"),F=-1!==E?p.slice(E+4).trim():p.trim();if(F&&!F.startsWith("--")){try{_=JSON.parse(F)}catch{}_&&(yield*u(f(v(_)),d),!1===_.hasNext&&(l=!0))}}e.body?.destroy()})).apply(this,arguments)}var y=`
|
|
@@ -1014,7 +1014,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
1014
1014
|
lastSeenAt
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>A});var n,r=a(99436),o=a(35679),s=a(73284),p=a(47988),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(23699),g=a(71335),y=a(429),b=a(80274),D=a(42400),x=a(98247),w=a(11405),_=a(86141),E=a(59845),F=e([D]);D=(F.then?(await F)():F)[0];var A=(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.
|
|
1017
|
+
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>A});var n,r=a(99436),o=a(35679),s=a(73284),p=a(47988),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(23699),g=a(71335),y=a(429),b=a(80274),D=a(42400),x=a(98247),w=a(11405),_=a(86141),E=a(59845),F=e([D]);D=(F.then?(await F)():F)[0];var A=(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.58","-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.E),o.DM.addCommand(g.oT),o.DM.addCommand(y.K),o.DM.addCommand(b.gf),o.DM.addCommand(D.D),o.DM.addCommand(x.v),o.DM.addCommand(w.l),o.DM.addCommand(_.D),o.DM.addCommand(E.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,47988)),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(`
|
|
1018
1018
|
${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=A;i()}catch(e){i(e)}})},56493(e,t,a){a.d(t,{o:()=>o});var i=a(73284),n=a(47988),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()},47988(e,t,a){a.r(t),a.d(t,{CONFIG_DIR:()=>o,CONFIG_PATH:()=>s,clearBankCredentials:()=>E,clearConfig:()=>C,default:()=>S,getActivityLogBaseUrl:()=>F,getBankCredentials:()=>w,getBaseUrl:()=>l,getCurrentProfile:()=>y,getCurrentProfileSource:()=>b,getToken:()=>c,getTokenInfo:()=>m,getTokens:()=>u,listProfiles:()=>x,removeToken:()=>h,setActivityLogBaseUrl:()=>A,setBankCredentials:()=>_,setBaseUrl:()=>d,setCurrentProfile:()=>D,setProfileOverride:()=>g,setToken:()=>f});var i=a(83440),n=a(16928),r=a(70857),o=n.join(r.homedir(),".bricks-cli"),s=n.join(o,"config.json"),p=new i.default({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"},workspaceBilling:{type:"object"},createdAt:{type:"string"},baseUrl:{type:"string"},bank:{type:"object"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"},devtoolsTokens:{type:"object",default:{},additionalProperties:{type:"object",additionalProperties:{type:"object",properties:{token:{type:"string"},expiresAt:{type:"string"},jti:{type:"string"},workspaceId:{type:"string"}}}}}}}),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"),b=()=>v?"override":process.env.BRICKS_PROFILE?"env":"config",D=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}))},w=(e="default")=>{var t=p.get("tokens");return t[e]?.bank||null},_=(e,t)=>{var a=p.get("tokens");a[e]||(a[e]={}),a[e].bank=t,p.set("tokens",a)},E=e=>{var t=p.get("tokens");return!!t[e]?.bank&&(delete t[e].bank,p.set("tokens",t),!0)},F=()=>{var e=y(),t=p.get("tokens");return t[e]?.activityLogBaseUrl||p.get("activityLogBaseUrl")},A=(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)},C=()=>{p.clear()};let S=p},75646(e,t,a){a.r(t),a.d(t,{discoverDevToolsServers:()=>p,httpProbeSubnet:()=>l,verifyDevToolsServer:()=>d});var i,n,r=a(99436),o=a(19557),s="bricks-devtools",p=({timeout:e=3e3,idleTimeout:t=0}={})=>(0,o.YH)({port:19900,timeout:e,idleTimeout:t,buildQuery:()=>Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:s,d:{id:`cli-${(0,o.BW)()}`}})),parseMessage:(e,t)=>{var a=JSON.parse(e.toString());if(a.s!==s||"ANNOUNCE"!==a.t&&"RESPONSE"!==a.t)return null;var i=a.d?.info;if(!i)return null;var n=t.address;return{key:`${n}:${i.port}`,value:{...i,address:n}}}}),l=(i=r(function*({port:e=19851,connectTimeout:t=500,concurrency:a=50,timeout:i=0}={}){var n=(0,o.r9)();if(0===n.length)return[];var s=[],p=i>0?Date.now()+i:0,l=[],u=new Set;for(var c of n){var m=c.address.split(".").slice(0,3).join(".");if(!u.has(m)){u.add(m);for(var f=1;f<255;f++)l.push(`${m}.${f}`)}}for(var h=0;h<l.length&&!(p&&Date.now()>=p);h+=a){var v=l.slice(h,h+a);yield Promise.allSettled(v.map(function(){var a=r(function*(a){var i=yield d(a,e,t);i&&s.push({...i,address:a,port:e})});return function(e){return a.apply(this,arguments)}}()))}return s}),function(){return i.apply(this,arguments)}),d=(n=r(function*(e,t,a=3e3){return(0,o.uE)(`http://${e}:${t}/devtools/info`,a)}),function(e,t){return n.apply(this,arguments)})},19557(e,t,a){a.d(t,{BW:()=>s,YH:()=>l,r9:()=>p,uE:()=>d});var i,n=a(99436),r=a(41314),o=a(48161),s=()=>Math.random().toString(36).slice(2,9),p=()=>{var e=[];for(var t of Object.values(o.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},l=({port:e,timeout:t=3e3,idleTimeout:a=0,buildQuery:i,parseMessage:n})=>new Promise((o,s)=>{var l=new Map,d=r.createSocket("udp4"),u=null,c=null,m=!1,f=()=>{if(!m){m=!0,clearTimeout(u),clearTimeout(c);try{d.close()}catch{}o([...l.values()])}};d.on("error",e=>{if(!m){m=!0,clearTimeout(u),clearTimeout(c);try{d.close()}catch{}s(e)}}),d.on("message",(e,t)=>{try{var i=n(e,t);if(!i||l.has(i.key))return;l.set(i.key,i.value),a&&!m&&(clearTimeout(c),c=setTimeout(f,a))}catch{}}),d.bind(()=>{d.setBroadcast(!0);var a=i();for(var n of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]);for(var t of p())e.add(t.broadcast);return[...e]})())d.send(a,0,a.length,e,n);u=setTimeout(f,t)})}),d=(i=n(function*(e,t=3e3){var a;try{var i=new AbortController;a=setTimeout(()=>i.abort(),t);var n=yield fetch(e,{signal:i.signal});if(!n.ok)return null;return yield n.json()}catch{return null}finally{void 0!==a&&clearTimeout(a)}}),function(e){return i.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}
|
|
1019
1019
|
|
|
1020
1020
|
${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,{H_:()=>o,Iy:()=>r,S5:()=>p,yd:()=>l});var i=a(73284),n=a(7586),r=(e,t,a)=>({label:e,ok:t,detail:a}),o=(e,t,{id:a,name:i,...n}={})=>({id:e?._id||t,name:i||e?.name||"Unnamed",...n}),s=e=>null==e?i.Ay.gray("N/A"):"object"==typeof e?i.Ay.gray(JSON.stringify(e,null,2)):String(e),p=({action:e,target:t,request:a,checks:r=[],json:o=!1})=>{o?(0,n.GF)({ok:!0,dryRun:!0,action:e,target:t||null,request:a||null,checks:r}):(console.log(i.Ay.bold(`
|