@sourcegraph/amp 0.0.1768176116-ged0d88 → 0.0.1768191623-gd520c9
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/dist/main.js +12 -12
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -44,7 +44,7 @@ ${G}
|
|
|
44
44
|
${V}`.trim()}_serializeSingularDataPoint(J,Q,Y){let Z="";J=$Z1(J,Q);let{value:X,attributes:G}=Y,V=(0,KK0.hrTimeToMilliseconds)(Y.endTime);return Z+=qd(J,G,X,this._appendTimestamp?V:void 0,this._additionalAttributes),Z}_serializeHistogramDataPoint(J,Q,Y){let Z="";J=$Z1(J,Q);let{attributes:X,value:G}=Y,V=(0,KK0.hrTimeToMilliseconds)(Y.endTime);for(let H of["count","sum"]){let z=G[H];if(z!=null)Z+=qd(J+"_"+H,X,z,this._appendTimestamp?V:void 0,this._additionalAttributes)}let K=0,q=G.buckets.counts.entries(),W=!1;for(let[H,z]of q){K+=z;let F=G.buckets.boundaries[H];if(F===void 0&&W)break;if(F===1/0)W=!0;Z+=qd(J+"_bucket",X,K,this._appendTimestamp?V:void 0,Object.assign({},this._additionalAttributes??{},{le:F===void 0||F===1/0?"+Inf":String(F)}))}return Z}_serializeResource(J){if(this._withoutTargetInfo===!0)return"";let Q="target_info",Y=`# HELP ${Q} Target metadata`,Z=`# TYPE ${Q} gauge`,X=qd(Q,J.attributes,1).trim();return`${Y}
|
|
45
45
|
${Z}
|
|
46
46
|
${X}
|
|
47
|
-
`}}HK0.PrometheusSerializer=WK0});var DK0=_((FK0)=>{Object.defineProperty(FK0,"__esModule",{value:!0});FK0.PrometheusExporter=void 0;var UC=d0(),gt6=a6(),KZ1=GD(),mt6=w1("http"),ut6=VZ1(),pt6=w1("url");class wK extends KZ1.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0,withoutTargetInfo:!1};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(J={},Q=()=>{}){super({aggregationSelector:(X)=>{return{type:KZ1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(X)=>KZ1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||wK.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||wK.DEFAULT_OPTIONS.port,this._prefix=J.prefix||wK.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:wK.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||wK.DEFAULT_OPTIONS.withResourceConstantLabels,Z=J.withoutTargetInfo||wK.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,mt6.createServer)(this._requestHandler).unref(),this._serializer=new ut6.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,Z),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||wK.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(X)=>{UC.diag.error(X),Q(X)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return UC.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)UC.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,gt6.globalErrorHandler)(Q);J()})})}startServer(){return this._startServerPromise??=new Promise((J,Q)=>{this._server.once("error",Q),this._server.listen({port:this._port,host:this._host},()=>{UC.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),J()})}),this._startServerPromise}getMetricsRequestHandler(J,Q){this._exportMetrics(Q)}_requestHandler=(J,Q)=>{if(J.url!=null&&new pt6.URL(J.url,this._baseUrl).pathname===this._endpoint)this._exportMetrics(Q);else this._notFound(Q)};_exportMetrics=(J)=>{J.statusCode=200,J.setHeader("content-type","text/plain"),this.collect().then((Q)=>{let{resourceMetrics:Y,errors:Z}=Q;if(Z.length)UC.diag.error("PrometheusExporter: metrics collection errors",...Z);J.end(this._serializer.serialize(Y))},(Q)=>{J.end(`# failed to export metrics: ${Q}`)})};_notFound=(J)=>{J.statusCode=404,J.end()}}FK0.PrometheusExporter=wK});var BK0=_((Hd)=>{Object.defineProperty(Hd,"__esModule",{value:!0});Hd.PrometheusSerializer=Hd.PrometheusExporter=void 0;var dt6=DK0();Object.defineProperty(Hd,"PrometheusExporter",{enumerable:!0,get:function(){return dt6.PrometheusExporter}});var ct6=VZ1();Object.defineProperty(Hd,"PrometheusSerializer",{enumerable:!0,get:function(){return ct6.PrometheusSerializer}})});var OK0=_((MK0)=>{Object.defineProperty(MK0,"__esModule",{value:!0});MK0.OTLPTraceExporter=void 0;var it6=p$(),nt6=HX(),NK0=KK();class wK0 extends it6.OTLPExporterBase{constructor(J={}){super((0,NK0.createOtlpHttpExportDelegate)((0,NK0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),nt6.ProtobufTraceSerializer))}}MK0.OTLPTraceExporter=wK0});var AK0=_((qZ1)=>{Object.defineProperty(qZ1,"__esModule",{value:!0});qZ1.OTLPTraceExporter=void 0;var at6=OK0();Object.defineProperty(qZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return at6.OTLPTraceExporter}})});var IK0=_((WZ1)=>{Object.defineProperty(WZ1,"__esModule",{value:!0});WZ1.OTLPTraceExporter=void 0;var rt6=AK0();Object.defineProperty(WZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return rt6.OTLPTraceExporter}})});var EK0=_((HZ1)=>{Object.defineProperty(HZ1,"__esModule",{value:!0});HZ1.OTLPTraceExporter=void 0;var tt6=IK0();Object.defineProperty(HZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return tt6.OTLPTraceExporter}})});var CK0=_((PK0)=>{Object.defineProperty(PK0,"__esModule",{value:!0});PK0.OTLPTraceExporter=void 0;var Je6=p$(),Qe6=HX(),RK0=KK();class jK0 extends Je6.OTLPExporterBase{constructor(J={}){super((0,RK0.createOtlpHttpExportDelegate)((0,RK0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),Qe6.JsonTraceSerializer))}}PK0.OTLPTraceExporter=jK0});var _K0=_((zZ1)=>{Object.defineProperty(zZ1,"__esModule",{value:!0});zZ1.OTLPTraceExporter=void 0;var Ye6=CK0();Object.defineProperty(zZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return Ye6.OTLPTraceExporter}})});var SK0=_((FZ1)=>{Object.defineProperty(FZ1,"__esModule",{value:!0});FZ1.OTLPTraceExporter=void 0;var Xe6=_K0();Object.defineProperty(FZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return Xe6.OTLPTraceExporter}})});var kK0=_((UZ1)=>{Object.defineProperty(UZ1,"__esModule",{value:!0});UZ1.OTLPTraceExporter=void 0;var Ge6=SK0();Object.defineProperty(UZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return Ge6.OTLPTraceExporter}})});var fK0=_((vK0)=>{Object.defineProperty(vK0,"__esModule",{value:!0});vK0.OTLPTraceExporter=void 0;var yK0=$d(),Ke6=HX(),qe6=p$();class xK0 extends qe6.OTLPExporterBase{constructor(J={}){super((0,yK0.createOtlpGrpcExportDelegate)((0,yK0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),Ke6.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}vK0.OTLPTraceExporter=xK0});var hK0=_((DZ1)=>{Object.defineProperty(DZ1,"__esModule",{value:!0});DZ1.OTLPTraceExporter=void 0;var We6=fK0();Object.defineProperty(DZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return We6.OTLPTraceExporter}})});var uK0=_((gK0)=>{Object.defineProperty(gK0,"__esModule",{value:!0});gK0.prepareSend=void 0;var BZ1=d0(),zd=a6(),ze6=w1("http"),Fe6=w1("https");function Ue6(J,Q){let Y=new URL(J),Z=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...Q}});return function(G,V){if(G.length===0)return BZ1.diag.debug("Zipkin send with empty spans"),V({code:zd.ExportResultCode.SUCCESS});let{request:K}=Y.protocol==="http:"?ze6:Fe6,q=K(Y,Z,(H)=>{let z="";H.on("data",(F)=>{z+=F}),H.on("end",()=>{let F=H.statusCode||0;if(BZ1.diag.debug(`Zipkin response status code: ${F}, body: ${z}`),F<400)return V({code:zd.ExportResultCode.SUCCESS});else return V({code:zd.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${F}`)})})});q.on("error",(H)=>{return V({code:zd.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(G);BZ1.diag.debug(`Zipkin request payload: ${W}`),q.write(W,"utf8"),q.end()}}gK0.prepareSend=Ue6});var pK0=_((NZ1)=>{Object.defineProperty(NZ1,"__esModule",{value:!0});NZ1.prepareSend=void 0;var De6=uK0();Object.defineProperty(NZ1,"prepareSend",{enumerable:!0,get:function(){return De6.prepareSend}})});var MZ1=_((wZ1)=>{Object.defineProperty(wZ1,"__esModule",{value:!0});wZ1.prepareSend=void 0;var Ne6=pK0();Object.defineProperty(wZ1,"prepareSend",{enumerable:!0,get:function(){return Ne6.prepareSend}})});var cK0=_((dK0)=>{Object.defineProperty(dK0,"__esModule",{value:!0});dK0.SpanKind=void 0;var Me6;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(Me6=dK0.SpanKind||(dK0.SpanKind={}))});var oK0=_((nK0)=>{Object.defineProperty(nK0,"__esModule",{value:!0});nK0._toZipkinAnnotations=nK0._toZipkinTags=nK0.toZipkinSpan=nK0.defaultStatusErrorTagName=nK0.defaultStatusCodeTagName=void 0;var nW=d0(),OZ1=a6(),Fd=cK0(),Le6={[nW.SpanKind.CLIENT]:Fd.SpanKind.CLIENT,[nW.SpanKind.SERVER]:Fd.SpanKind.SERVER,[nW.SpanKind.CONSUMER]:Fd.SpanKind.CONSUMER,[nW.SpanKind.PRODUCER]:Fd.SpanKind.PRODUCER,[nW.SpanKind.INTERNAL]:void 0};nK0.defaultStatusCodeTagName="otel.status_code";nK0.defaultStatusErrorTagName="error";function Oe6(J,Q,Y,Z){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:Le6[J.kind],timestamp:(0,OZ1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,OZ1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:lK0(J,Y,Z),annotations:J.events.length?iK0(J.events):void 0}}nK0.toZipkinSpan=Oe6;function lK0({attributes:J,resource:Q,status:Y,droppedAttributesCount:Z,droppedEventsCount:X,droppedLinksCount:G},V,K){let q={};for(let W of Object.keys(J))q[W]=String(J[W]);if(Y.code!==nW.SpanStatusCode.UNSET)q[V]=String(nW.SpanStatusCode[Y.code]);if(Y.code===nW.SpanStatusCode.ERROR&&Y.message)q[K]=Y.message;if(Z)q["otel.dropped_attributes_count"]=String(Z);if(X)q["otel.dropped_events_count"]=String(X);if(G)q["otel.dropped_links_count"]=String(G);return Object.keys(Q.attributes).forEach((W)=>q[W]=String(Q.attributes[W])),q}nK0._toZipkinTags=lK0;function iK0(J){return J.map((Q)=>({timestamp:Math.round((0,OZ1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}nK0._toZipkinAnnotations=iK0});var tK0=_((rK0)=>{Object.defineProperty(rK0,"__esModule",{value:!0});rK0.prepareGetHeaders=void 0;function je6(J){return function(){return J()}}rK0.prepareGetHeaders=je6});var $q0=_((Zq0)=>{Object.defineProperty(Zq0,"__esModule",{value:!0});Zq0.ZipkinExporter=void 0;var eK0=d0(),Jq0=a6(),Qq0=MZ1(),AZ1=oK0(),IZ1=jW(),Pe6=tK0();class Yq0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,Jq0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,Qq0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||AZ1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||AZ1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,Pe6.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[IZ1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(eK0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:Jq0.ExportResultCode.FAILED,error:Error("Exporter has been shutdown")}));return}let Z=new Promise((G)=>{this._sendSpans(J,Y,(V)=>{G(),Q(V)})});this._sendingPromises.push(Z);let X=()=>{let G=this._sendingPromises.indexOf(Z);this._sendingPromises.splice(G,1)};Z.then(X,X)}shutdown(){return eK0.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((J,Q)=>{Promise.all(this._sendingPromises).then(()=>{J()},Q)})}_beforeSend(){if(this._getHeaders)this._send=(0,Qq0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let Z=J.map((X)=>(0,AZ1.toZipkinSpan)(X,String(X.attributes[IZ1.ATTR_SERVICE_NAME]||X.resource.attributes[IZ1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(Z,(X)=>{if(Y)return Y(X)})}}Zq0.ZipkinExporter=Yq0});var Gq0=_((Ud)=>{Object.defineProperty(Ud,"__esModule",{value:!0});Ud.ZipkinExporter=Ud.prepareSend=void 0;var Te6=MZ1();Object.defineProperty(Ud,"prepareSend",{enumerable:!0,get:function(){return Te6.prepareSend}});var Ce6=$q0();Object.defineProperty(Ud,"ZipkinExporter",{enumerable:!0,get:function(){return Ce6.ZipkinExporter}})});var EZ1=_((Vq0)=>{Object.defineProperty(Vq0,"__esModule",{value:!0});Vq0.B3_DEBUG_FLAG_KEY=void 0;var Se6=d0();Vq0.B3_DEBUG_FLAG_KEY=(0,Se6.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var DC=_((qq0)=>{Object.defineProperty(qq0,"__esModule",{value:!0});qq0.X_B3_FLAGS=qq0.X_B3_PARENT_SPAN_ID=qq0.X_B3_SAMPLED=qq0.X_B3_SPAN_ID=qq0.X_B3_TRACE_ID=qq0.B3_CONTEXT_HEADER=void 0;qq0.B3_CONTEXT_HEADER="b3";qq0.X_B3_TRACE_ID="x-b3-traceid";qq0.X_B3_SPAN_ID="x-b3-spanid";qq0.X_B3_SAMPLED="x-b3-sampled";qq0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";qq0.X_B3_FLAGS="x-b3-flags"});var Bq0=_((Uq0)=>{Object.defineProperty(Uq0,"__esModule",{value:!0});Uq0.B3MultiPropagator=void 0;var wX=d0(),fe6=a6(),Hq0=EZ1(),qQ=DC(),he6=new Set([!0,"true","True","1",1]),ge6=new Set([!1,"false","False","0",0]);function me6(J){return J===wX.TraceFlags.SAMPLED||J===wX.TraceFlags.NONE}function ue6(J){return Array.isArray(J)?J[0]:J}function Dd(J,Q,Y){let Z=Q.get(J,Y);return ue6(Z)}function pe6(J,Q){let Y=Dd(J,Q,qQ.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function de6(J,Q){let Y=Dd(J,Q,qQ.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function zq0(J,Q){return Dd(J,Q,qQ.X_B3_FLAGS)==="1"?"1":void 0}function ce6(J,Q){let Y=Dd(J,Q,qQ.X_B3_SAMPLED);if(zq0(J,Q)==="1"||he6.has(Y))return wX.TraceFlags.SAMPLED;if(Y===void 0||ge6.has(Y))return wX.TraceFlags.NONE;return}class Fq0{inject(J,Q,Y){let Z=wX.trace.getSpanContext(J);if(!Z||!(0,wX.isSpanContextValid)(Z)||(0,fe6.isTracingSuppressed)(J))return;let X=J.getValue(Hq0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,qQ.X_B3_TRACE_ID,Z.traceId),Y.set(Q,qQ.X_B3_SPAN_ID,Z.spanId),X==="1")Y.set(Q,qQ.X_B3_FLAGS,X);else if(Z.traceFlags!==void 0)Y.set(Q,qQ.X_B3_SAMPLED,(wX.TraceFlags.SAMPLED&Z.traceFlags)===wX.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let Z=pe6(Q,Y),X=de6(Q,Y),G=ce6(Q,Y),V=zq0(Q,Y);if((0,wX.isValidTraceId)(Z)&&(0,wX.isValidSpanId)(X)&&me6(G))return J=J.setValue(Hq0.B3_DEBUG_FLAG_KEY,V),wX.trace.setSpanContext(J,{traceId:Z,spanId:X,isRemote:!0,traceFlags:G});return J}fields(){return[qQ.X_B3_TRACE_ID,qQ.X_B3_SPAN_ID,qQ.X_B3_FLAGS,qQ.X_B3_SAMPLED,qQ.X_B3_PARENT_SPAN_ID]}}Uq0.B3MultiPropagator=Fq0});var Oq0=_((Mq0)=>{Object.defineProperty(Mq0,"__esModule",{value:!0});Mq0.B3SinglePropagator=void 0;var TD=d0(),le6=a6(),Nq0=EZ1(),RZ1=DC(),ie6=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,ne6="0".repeat(16),ae6=new Set(["d","1"]),oe6="d";function re6(J){return J.length===32?J:`${ne6}${J}`}function se6(J){if(J&&ae6.has(J))return TD.TraceFlags.SAMPLED;return TD.TraceFlags.NONE}class wq0{inject(J,Q,Y){let Z=TD.trace.getSpanContext(J);if(!Z||!(0,TD.isSpanContextValid)(Z)||(0,le6.isTracingSuppressed)(J))return;let X=J.getValue(Nq0.B3_DEBUG_FLAG_KEY)||Z.traceFlags&1,G=`${Z.traceId}-${Z.spanId}-${X}`;Y.set(Q,RZ1.B3_CONTEXT_HEADER,G)}extract(J,Q,Y){let Z=Y.get(Q,RZ1.B3_CONTEXT_HEADER),X=Array.isArray(Z)?Z[0]:Z;if(typeof X!=="string")return J;let G=X.match(ie6);if(!G)return J;let[,V,K,q]=G,W=re6(V);if(!(0,TD.isValidTraceId)(W)||!(0,TD.isValidSpanId)(K))return J;let H=se6(q);if(q===oe6)J=J.setValue(Nq0.B3_DEBUG_FLAG_KEY,q);return TD.trace.setSpanContext(J,{traceId:W,spanId:K,isRemote:!0,traceFlags:H})}fields(){return[RZ1.B3_CONTEXT_HEADER]}}Mq0.B3SinglePropagator=wq0});var PZ1=_((Aq0)=>{Object.defineProperty(Aq0,"__esModule",{value:!0});Aq0.B3InjectEncoding=void 0;var te6;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(te6=Aq0.B3InjectEncoding||(Aq0.B3InjectEncoding={}))});var jq0=_((Eq0)=>{Object.defineProperty(Eq0,"__esModule",{value:!0});Eq0.B3Propagator=void 0;var ee6=a6(),J14=Bq0(),Q14=Oq0(),Y14=DC(),Z14=PZ1();class Iq0{_b3MultiPropagator=new J14.B3MultiPropagator;_b3SinglePropagator=new Q14.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===Z14.B3InjectEncoding.MULTI_HEADER)this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields();else this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields()}inject(J,Q,Y){if((0,ee6.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let Z=Y.get(Q,Y14.B3_CONTEXT_HEADER);if(Array.isArray(Z)?Z[0]:Z)return this._b3SinglePropagator.extract(J,Q,Y);else return this._b3MultiPropagator.extract(J,Q,Y)}fields(){return this._fields}}Eq0.B3Propagator=Iq0});var Pq0=_((ZG)=>{Object.defineProperty(ZG,"__esModule",{value:!0});ZG.B3InjectEncoding=ZG.X_B3_TRACE_ID=ZG.X_B3_SPAN_ID=ZG.X_B3_SAMPLED=ZG.X_B3_PARENT_SPAN_ID=ZG.X_B3_FLAGS=ZG.B3_CONTEXT_HEADER=ZG.B3Propagator=void 0;var X14=jq0();Object.defineProperty(ZG,"B3Propagator",{enumerable:!0,get:function(){return X14.B3Propagator}});var eL=DC();Object.defineProperty(ZG,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return eL.B3_CONTEXT_HEADER}});Object.defineProperty(ZG,"X_B3_FLAGS",{enumerable:!0,get:function(){return eL.X_B3_FLAGS}});Object.defineProperty(ZG,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return eL.X_B3_PARENT_SPAN_ID}});Object.defineProperty(ZG,"X_B3_SAMPLED",{enumerable:!0,get:function(){return eL.X_B3_SAMPLED}});Object.defineProperty(ZG,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return eL.X_B3_SPAN_ID}});Object.defineProperty(ZG,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return eL.X_B3_TRACE_ID}});var $14=PZ1();Object.defineProperty(ZG,"B3InjectEncoding",{enumerable:!0,get:function(){return $14.B3InjectEncoding}})});var kq0=_((Cq0)=>{Object.defineProperty(Cq0,"__esModule",{value:!0});Cq0.JaegerPropagator=Cq0.UBER_BAGGAGE_HEADER_PREFIX=Cq0.UBER_TRACE_ID_HEADER=void 0;var CD=d0(),V14=a6();Cq0.UBER_TRACE_ID_HEADER="uber-trace-id";Cq0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class Tq0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=Cq0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||Cq0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||Cq0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let Z=CD.trace.getSpanContext(J),X=CD.propagation.getBaggage(J);if(Z&&(0,V14.isTracingSuppressed)(J)===!1){let G=`0${(Z.traceFlags||CD.TraceFlags.NONE).toString(16)}`;Y.set(Q,this._jaegerTraceHeader,`${Z.traceId}:${Z.spanId}:0:${G}`)}if(X)for(let[G,V]of X.getAllEntries())Y.set(Q,`${this._jaegerBaggageHeaderPrefix}-${G}`,encodeURIComponent(V.value))}extract(J,Q,Y){let Z=Y.get(Q,this._jaegerTraceHeader),X=Array.isArray(Z)?Z[0]:Z,G=Y.keys(Q).filter((q)=>q.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map((q)=>{let W=Y.get(Q,q);return{key:q.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(W)?W[0]:W}}),V=J;if(typeof X==="string"){let q=q14(X);if(q)V=CD.trace.setSpanContext(V,q)}if(G.length===0)return V;let K=CD.propagation.getBaggage(J)??CD.propagation.createBaggage();for(let q of G){if(q.value===void 0)continue;K=K.setEntry(q.key,{value:decodeURIComponent(q.value)})}return V=CD.propagation.setBaggage(V,K),V}fields(){return[this._jaegerTraceHeader]}}Cq0.JaegerPropagator=Tq0;var K14=/^[0-9a-f]{1,2}$/i;function q14(J){let Q=decodeURIComponent(J).split(":");if(Q.length!==4)return null;let[Y,Z,,X]=Q,G=Y.padStart(32,"0"),V=Z.padStart(16,"0"),K=K14.test(X)?parseInt(X,16)&1:1;return{traceId:G,spanId:V,isRemote:!0,traceFlags:K}}});var yq0=_((BC)=>{Object.defineProperty(BC,"__esModule",{value:!0});BC.UBER_TRACE_ID_HEADER=BC.UBER_BAGGAGE_HEADER_PREFIX=BC.JaegerPropagator=void 0;var CZ1=kq0();Object.defineProperty(BC,"JaegerPropagator",{enumerable:!0,get:function(){return CZ1.JaegerPropagator}});Object.defineProperty(BC,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return CZ1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(BC,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return CZ1.UBER_TRACE_ID_HEADER}})});var gq0=_((fq0)=>{Object.defineProperty(fq0,"__esModule",{value:!0});fq0.setupPropagator=fq0.setupContextManager=fq0.getPropagatorFromEnv=fq0.getSpanProcessorsFromEnv=fq0.getOtlpProtocolFromEnv=fq0.filterBlanksAndNulls=fq0.getResourceDetectorsFromEnv=void 0;var fY=d0(),MX=a6(),xq0=EK0(),H14=kK0(),z14=hK0(),F14=Gq0(),NC=YD(),Bd=WD(),_Z1=Pq0(),U14=yq0(),D14=Tm(),B14="env",N14="host",w14="os",M14="process",L14="serviceinstance";function O14(){let J=new Map([[B14,NC.envDetector],[N14,NC.hostDetector],[w14,NC.osDetector],[L14,NC.serviceInstanceIdDetector],[M14,NC.processDetector]]),Q=(0,MX.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];if(Q.includes("all"))return[...J.values()].flat();if(Q.includes("none"))return[];return Q.flatMap((Y)=>{let Z=J.get(Y);if(!Z)fY.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return Z||[]})}fq0.getResourceDetectorsFromEnv=O14;function vq0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}fq0.filterBlanksAndNulls=vq0;function bq0(){return(0,MX.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,MX.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}fq0.getOtlpProtocolFromEnv=bq0;function A14(){let J=bq0();switch(J){case"grpc":return new z14.OTLPTraceExporter;case"http/json":return new H14.OTLPTraceExporter;case"http/protobuf":return new xq0.OTLPTraceExporter;default:return fY.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new xq0.OTLPTraceExporter}}function I14(){let J=new Map([["otlp",()=>A14()],["zipkin",()=>new F14.ZipkinExporter],["console",()=>new Bd.ConsoleSpanExporter]]),Q=[],Y=[],Z=vq0(Array.from(new Set((0,MX.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(Z[0]==="none")return fY.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(Z.length===0)fY.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),Z=["otlp"];else if(Z.length>1&&Z.includes("none"))fY.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),Z=["otlp"];for(let X of Z){let G=J.get(X)?.();if(G)Q.push(G);else fY.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${X}.`)}for(let X of Q)if(X instanceof Bd.ConsoleSpanExporter)Y.push(new Bd.SimpleSpanProcessor(X));else Y.push(new Bd.BatchSpanProcessor(X));if(Q.length===0)fY.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}fq0.getSpanProcessorsFromEnv=I14;function E14(){let J=(0,MX.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new MX.W3CTraceContextPropagator],["baggage",()=>new MX.W3CBaggagePropagator],["b3",()=>new _Z1.B3Propagator],["b3multi",()=>new _Z1.B3Propagator({injectEncoding:_Z1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new U14.JaegerPropagator]]),Y=Array.from(new Set(J)),X=Y.map((G)=>{let V=Q.get(G)?.();if(!V){fY.diag.warn(`Propagator "${G}" requested through environment variable is unavailable.`);return}return V}).reduce((G,V)=>{if(V)G.push(V);return G},[]);if(X.length===0)return null;else if(Y.length===1)return X[0];else return new MX.CompositePropagator({propagators:X})}fq0.getPropagatorFromEnv=E14;function R14(J){if(J===null)return;if(J===void 0){let Q=new D14.AsyncLocalStorageContextManager;Q.enable(),fY.context.setGlobalContextManager(Q);return}J.enable(),fY.context.setGlobalContextManager(J)}fq0.setupContextManager=R14;function j14(J){if(J===null)return;if(J===void 0){fY.propagation.setGlobalPropagator(new MX.CompositePropagator({propagators:[new MX.W3CTraceContextPropagator,new MX.W3CBaggagePropagator]}));return}fY.propagation.setGlobalPropagator(J)}fq0.setupPropagator=j14});var lq0=_((dq0)=>{Object.defineProperty(dq0,"__esModule",{value:!0});dq0.NodeSDK=void 0;var u3=d0(),y14=lP(),x14=C31(),JO=YD(),wC=c21(),v14=d20(),b14=PV0(),SZ1=vV0(),f14=eV0(),mq0=VK0(),h14=Kd(),g14=BK0(),_D=GD(),m14=WD(),u14=YJ1(),p14=jW(),aW=a6(),MC=gq0();function uq0(J,Q){return parseInt(process.env[J]||"")||Q}function d14(){let J=[],Q=(0,aW.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)u3.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return u3.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),J;return Q.forEach((Y)=>{if(Y==="otlp"){let Z=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),X=uq0("OTEL_METRIC_EXPORT_INTERVAL",60000),G=uq0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(Z){case"grpc":J.push(new _D.PeriodicExportingMetricReader({exporter:new f14.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/json":J.push(new _D.PeriodicExportingMetricReader({exporter:new h14.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/protobuf":J.push(new _D.PeriodicExportingMetricReader({exporter:new mq0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;default:u3.diag.warn(`Unsupported OTLP metrics protocol: "${Z}". Using http/protobuf.`),J.push(new _D.PeriodicExportingMetricReader({exporter:new mq0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}))}}else if(Y==="console")J.push(new _D.PeriodicExportingMetricReader({exporter:new _D.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new g14.PrometheusExporter);else u3.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class pq0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,aW.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,aW.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)u3.diag.setLogger(new u3.DiagConsoleLogger,{logLevel:(0,aW.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,JO.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,aW.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,MC.getResourceDetectorsFromEnv)();else this._resourceDetectors=[JO.envDetector,JO.processDetector,JO.hostDetector];if(this._serviceName=J.serviceName,J.traceExporter||J.spanProcessor||J.spanProcessors){let Y={};if(J.sampler)Y.sampler=J.sampler;if(J.spanLimits)Y.spanLimits=J.spanLimits;if(J.idGenerator)Y.idGenerator=J.idGenerator;if(J.spanProcessor)u3.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let Z=J.spanProcessor??new m14.BatchSpanProcessor(J.traceExporter),X=J.spanProcessors??[Z];this._tracerProviderConfig={tracerConfig:Y,spanProcessors:X}}if(J.logRecordProcessors)this._loggerProviderConfig={logRecordProcessors:J.logRecordProcessors};else if(J.logRecordProcessor)this._loggerProviderConfig={logRecordProcessors:[J.logRecordProcessor]},u3.diag.warn("The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.");else this.configureLoggerProviderFromEnv();if(J.metricReaders||J.metricReader||J.views){let Y={};if(J.metricReaders)Y.readers=J.metricReaders;else if(J.metricReader)Y.readers=[J.metricReader],u3.diag.warn("The 'metricReader' option is deprecated. Please use 'metricReaders' instead.");if(J.views)Y.views=J.views;this._meterProviderConfig=Y}this._instrumentations=J.instrumentations?.flat()??[]}start(){if(this._disabled)return;if((0,x14.registerInstrumentations)({instrumentations:this._instrumentations}),(0,MC.setupContextManager)(this._configuration?.contextManager),(0,MC.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,MC.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,JO.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,JO.resourceFromAttributes)({[p14.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,MC.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new u14.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),u3.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new wC.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,y14.logs.setGlobalLoggerProvider(Y)}let Q=d14();if(this._meterProviderConfig||Q.length>0){let Y=[];if(this._meterProviderConfig?.readers)Y.push(...this._meterProviderConfig.readers);if(Y.length===0)Q.forEach((X)=>Y.push(X));let Z=new _D.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=Z,u3.metrics.setGlobalMeterProvider(Z);for(let X of this._instrumentations)X.setMeterProvider(u3.metrics.getMeterProvider())}}shutdown(){let J=[];if(this._tracerProvider)J.push(this._tracerProvider.shutdown());if(this._loggerProvider)J.push(this._loggerProvider.shutdown());if(this._meterProvider)J.push(this._meterProvider.shutdown());return Promise.all(J).then(()=>{})}configureLoggerProviderFromEnv(){let J=(0,aW.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)u3.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){u3.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let Q=[];if(J.forEach((Y)=>{if(Y==="otlp"){let Z=((0,aW.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,aW.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(Z){case"grpc":Q.push(new b14.OTLPLogExporter);break;case"http/json":Q.push(new v14.OTLPLogExporter);break;case"http/protobuf":Q.push(new SZ1.OTLPLogExporter);break;case void 0:case"":Q.push(new SZ1.OTLPLogExporter);break;default:u3.diag.warn(`Unsupported OTLP logs protocol: "${Z}". Using http/protobuf.`),Q.push(new SZ1.OTLPLogExporter)}}else if(Y==="console")Q.push(new wC.ConsoleLogRecordExporter);else u3.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${Y}". Supported values are: otlp, console, none.`)}),Q.length>0)this._loggerProviderConfig={logRecordProcessors:Q.map((Y)=>{if(Y instanceof wC.ConsoleLogRecordExporter)return new wC.SimpleLogRecordProcessor(Y);else return new wC.BatchLogRecordProcessor(Y)})}}}dq0.NodeSDK=pq0});var iq0=_((kZ1)=>{Object.defineProperty(kZ1,"__esModule",{value:!0});kZ1.NodeSDK=kZ1.tracing=kZ1.resources=kZ1.node=kZ1.metrics=kZ1.logs=kZ1.core=kZ1.contextBase=kZ1.api=void 0;kZ1.api=d0();kZ1.contextBase=d0();kZ1.core=a6();kZ1.logs=c21();kZ1.metrics=GD();kZ1.node=YJ1();kZ1.resources=YD();kZ1.tracing=WD();var c14=lq0();Object.defineProperty(kZ1,"NodeSDK",{enumerable:!0,get:function(){return c14.NodeSDK}})});import J04 from"os";import Nd from"path";var oW,SD,rW,sW,nq0,nb8,ab8,Q04,Y04;var QO=i(()=>{oW=J04.homedir(),{env:SD}=process,rW=SD.XDG_DATA_HOME||(oW?Nd.join(oW,".local","share"):void 0),sW=SD.XDG_CONFIG_HOME||(oW?Nd.join(oW,".config"):void 0),nq0=SD.XDG_STATE_HOME||(oW?Nd.join(oW,".local","state"):void 0),nb8=SD.XDG_CACHE_HOME||(oW?Nd.join(oW,".cache"):void 0),ab8=SD.XDG_RUNTIME_DIR||void 0,Q04=(SD.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(rW)Q04.unshift(rW);Y04=(SD.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(sW)Y04.unshift(sW)});import{homedir as wd}from"node:os";import kD from"node:path";var aq0,Z04,oq0,X04,Md,$04,YO,XG,eb8;var MK=i(()=>{QO();aq0=kD.join(wd(),".local/share"),Z04=process.platform==="win32"||process.platform==="darwin"?aq0:rW??aq0,oq0=kD.join(wd(),".config"),X04=process.platform==="win32"||process.platform==="darwin"?oq0:sW??oq0,Md=kD.join(Z04,"amp"),$04=kD.join(X04,"amp"),YO=kD.join($04,"tools"),XG=kD.join(wd(),".cache","amp"),eb8=kD.join(wd(),".cache","amp","http-debug-logs")});function V04(){return G04}function rq0(J){let Q=yD;return yD=J,Q}class $G{baseLogger;scope;context={};constructor(J=sq0){this.baseLogger=J}with(J){let Q=new $G(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new $G(this.baseLogger);return Q.scope=this.scope?`${this.scope}.${J}`:J,Q.context={...this.context},Q}error(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.error(this.messageWithPrefix(J),...Y)}warn(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.warn(this.messageWithPrefix(J),...Y)}info(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.info(this.messageWithPrefix(J),...Y)}debug(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.debug(this.messageWithPrefix(J),...Y)}audit(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.audit(this.messageWithPrefix(J),...Y)}messageWithPrefix(J){return this.scope?`${this.scope}: ${J}`:J}mergeContextWithMeta(J){let Q={...this.context},Y=yZ1.trace.getActiveSpan();if(Y){let X=Y.spanContext();if(X.traceId)Q.traceId=X.traceId,Q.spanId=X.spanId}if(J.length===0)return[Q];let Z=J[0];if(typeof Z==="object"&&Z!==null)return[{...Z,...Q},...J.slice(1)];else return[Q,...J]}}var yZ1,G04=!1,K04,yD,sq0,R;var v1=i(()=>{yZ1=H0(d0(),1);K04={error:(J,...Q)=>console.error(J,...Q),warn:(J,...Q)=>console.warn(J,...Q),info:(J,...Q)=>console.info(J,...Q),debug:(J,...Q)=>{if(V04())console.debug(J,...Q)},audit:(J,...Q)=>{let Y=Q.length>0?Q[0]:{};if(typeof Y==="object"&&Y!==null&&!("audit"in Y))Y.audit=!0;let Z=yZ1.trace.getActiveSpan();if(Z){let X=Z.spanContext();if(X.traceId)Y.traceId=X.traceId,Y.spanId=X.spanId}console.info(J,Y)}},yD=K04;sq0={error:(J,...Q)=>yD.error(J,...Q),warn:(J,...Q)=>yD.warn(J,...Q),info:(J,...Q)=>yD.info(J,...Q),debug:(J,...Q)=>yD.debug(J,...Q),audit:(J,...Q)=>yD.audit(J,...Q)};R=sq0});function XW0(){if(typeof process==="object")return process.platform==="win32"?"windows":"posix";else if(typeof navigator==="object")return navigator.userAgent.indexOf("Windows")>=0?"windows":"posix";return"posix"}function $W0(J,Q){if(!J.scheme&&Q)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${J.authority}", path: "${J.path}", query: "${J.query}", fragment: "${J.fragment}"}`);if(J.scheme&&!B04.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!N04.test(J.path))throw Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(w04.test(J.path))throw Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function M04(J,Q){if(!J&&!Q)return"file";return J}function L04(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=LX;else if(Q[0]!==LX)Q=LX+Q;break}return Q}class Q0{static isUri(J){if(J instanceof Q0)return!0;if(!J)return!1;let Q=J;return typeof Q.authority==="string"&&typeof Q.fragment==="string"&&typeof Q.path==="string"&&typeof Q.query==="string"&&typeof Q.scheme==="string"&&typeof Q.fsPath==="string"&&typeof Q.with==="function"&&typeof Q.toString==="function"}scheme;authority;path;query;fragment;platform;constructor(J,Q,Y,Z,X,G=!1,V){if(typeof J==="object")this.scheme=J.scheme||Y9,this.authority=J.authority||Y9,this.path=J.path||Y9,this.query=J.query||Y9,this.fragment=J.fragment||Y9,this.platform=J.platform;else this.scheme=M04(J,G),this.authority=Q||Y9,this.path=L04(this.scheme,Y||Y9),this.query=Z||Y9,this.fragment=X||Y9,this.platform=V,$W0(this,G)}get fsPath(){return WW0(this,!1)}with(J){if(!J)return this;let{scheme:Q,authority:Y,path:Z,query:X,fragment:G,platform:V}=J;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=Y9;if(Y===void 0)Y=this.authority;else if(Y===null)Y=Y9;if(Z===void 0)Z=this.path;else if(Z===null)Z=Y9;if(X===void 0)X=this.query;else if(X===null)X=Y9;if(G===void 0)G=this.fragment;else if(G===null)G=Y9;if(V===void 0)V=this.platform;else if(V===null)V=void 0;if(Q===this.scheme&&Y===this.authority&&Z===this.path&&X===this.query&&G===this.fragment&&V===this.platform)return this;return new xD(Q,Y,Z,X,G,!1,V)}static parse(J,Q=!1){let Y=O04.exec(J);if(!Y)return new xD(Y9,Y9,Y9,Y9,Y9);return new xD(Y[2]||Y9,Od(Y[4]||Y9),Od(Y[5]||Y9),Od(Y[7]||Y9),Od(Y[9]||Y9),Q)}static file(J,Q=XW0()){let Y=Y9;if(Q==="windows")J=J.replace(/\\/g,LX);if(J[0]===LX&&J[1]===LX){let Z=J.indexOf(LX,2);if(Z===-1)Y=J.substring(2),J=LX;else Y=J.substring(2,Z),J=J.substring(Z)||LX}return new xD("file",Y,J,Y9,Y9,!1,Q)}static from(J){let Q=new xD(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return $W0(Q,!0),Q}toString(J=!1){return vZ1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof Q0)return J;let Q=new xD(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===KW0(Q.platform)?Y.fsPath:null,Q}}function KW0(J){return J==="windows"?1:void 0}function GW0(J,Q,Y){let Z;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);if(G>=97&&G<=122||G>=65&&G<=90||G>=48&&G<=57||G===45||G===46||G===95||G===126||Q&&G===47||Y&&G===91||Y&&G===93||Y&&G===58){if(Z!==void 0)Z+=J.charAt(X)}else{if(Z===void 0)Z=J.substring(0,X);let V=qW0[G];if(V!==void 0)Z+=V;else Z+=encodeURIComponent(J.charAt(X))}}return Z!==void 0?Z:J}function A04(J){let Q;for(let Y=0;Y<J.length;Y++){let Z=J.charCodeAt(Y);if(Z===35||Z===63){if(Q===void 0)Q=J.substring(0,Y);Q+=qW0[Z]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function WW0(J,Q){let Y;if(J.authority&&J.path.length>1&&J.scheme==="file")Y=`//${J.authority}${J.path}`;else if(J.path.charCodeAt(0)===47&&(J.path.charCodeAt(1)>=65&&J.path.charCodeAt(1)<=90||J.path.charCodeAt(1)>=97&&J.path.charCodeAt(1)<=122)&&J.path.charCodeAt(2)===58)if(!Q)Y=J.path[1].toLowerCase()+J.path.substring(2);else Y=J.path.substring(1);else Y=J.path;if(J.platform==="windows")Y=Y.replace(/\//g,"\\");return Y}function vZ1(J,Q){let Y=!Q?GW0:A04,Z="",{scheme:X,authority:G,path:V,query:K,fragment:q}=J;if(X)Z+=X,Z+=":";if(G||X==="file")Z+=LX,Z+=LX;if(G){let W=G.indexOf("@");if(W!==-1){let H=G.substring(0,W);if(G=G.substring(W+1),W=H.lastIndexOf(":"),W===-1)Z+=Y(H,!1,!1);else Z+=Y(H.substring(0,W),!1,!1),Z+=":",Z+=Y(H.substring(W+1),!1,!0);Z+="@"}if(G=G.toLowerCase(),W=G.lastIndexOf(":"),W===-1)Z+=Y(G,!1,!0);else Z+=Y(G.substring(0,W),!1,!0),Z+=G.substring(W)}if(V){if(V.length>=3&&V.charCodeAt(0)===47&&V.charCodeAt(2)===58){let W=V.charCodeAt(1);if(W>=65&&W<=90)V=`/${String.fromCharCode(W+32)}:${V.substring(3)}`}else if(V.length>=2&&V.charCodeAt(1)===58){let W=V.charCodeAt(0);if(W>=65&&W<=90)V=`${String.fromCharCode(W+32)}:${V.substring(2)}`}Z+=Y(V,!0,!1)}if(K)Z+="?",Z+=Y(K,!1,!1);if(q)Z+="#",Z+=!Q?GW0(q,!1,!1):q;return Z}function HW0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+HW0(J.substring(3));else return J}}function Od(J){if(!J.match(VW0))return J;return J.replace(VW0,(Q)=>HW0(Q))}function tW(J){return J.scheme==="file"}function G7(J){return Q0.parse(J)}function h0(J){return J.toString()}function b6(J){if(typeof J==="string"||J instanceof URL)return Q0.parse(J.toString());return J}var B04,N04,w04,Y9="",LX="/",O04,xD,qW0,VW0;var OC=i(()=>{B04=/^\w[\w\d+.-]*$/,N04=/^\//,w04=/^\/\//;O04=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;xD=class xD extends Q0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=WW0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=vZ1(this,!1);return this._formatted}return vZ1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=KW0(this.platform);if(this._formatted)J.external=this._formatted;if(J.scheme=this.scheme,J.authority=this.authority,J.path=this.path,J.query=this.query,J.fragment=this.fragment,this.platform)J.platform=this.platform;return J}};qW0={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};VW0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function bZ1(J){if(J==="/")return"/";if(J==="")return".";let Q=J.replace(/\/+$/,"");if(!Q)return".";let Y=Q.lastIndexOf("/");if(Y===-1)return".";if(Y===0)return"/";return Q.slice(0,Y)}function vD(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function XO(...J){if(J.length===0)return".";let Q="";for(let V of J)if(V)if(Q)Q+="/"+V;else Q=V;if(!Q)return".";let Y=Q.endsWith("/"),Z=Q.split("/").filter(Boolean),X=[];for(let V of Z)if(V===".."){if(X.length>0&&X[X.length-1]!=="..")X.pop();else if(!Q.startsWith("/"))X.push("..")}else if(V!==".")X.push(V);let G=Q.startsWith("/")?"/"+X.join("/"):X.join("/");if(!G)G=Q.startsWith("/")?"/":".";if(Y&&G!=="/"&&G!==".")G+="/";return G}function zW0(J,Q,Y="/",Z="/",X=!0){function G(z,F){return X?z===F:z.toLowerCase()===F.toLowerCase()}if(Y==="/")J=J.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else J=J.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(J!==Y&&J.endsWith(Y))J=J.slice(0,-1);if(Q!==Y&&Q.endsWith(Y))Q=Q.slice(0,-1);if(G(J,Q))return"";if(!J.startsWith(Y)&&Q.startsWith(Y))return Q;let V=J===Y?[""]:J.split(Y),K=Q===Y?[""]:Q.split(Y),q=0;while(q<V.length&&q<K.length&&G(V[q],K[q]))q++;let W=V.length-q,H=[];for(let z=0;z<W;z++)H.push("..");return H.push(...K.slice(q)),H.join(Z)}function Ad(J){let Q=vD(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function d5(J){try{if(J=b6(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var $O=i(()=>{OC()});function I04(J,...Q){return J=b6(J),J.with({path:XO(J.path,...Q)})}function E04(J,...Q){let Y=J.path,Z=!1;if(Y[0]!==Id)Y=Id+Y,Z=!0;let X=Y;for(let G of Q)if(G.startsWith("/"))X=XO(G);else X=XO(X,G);if(X!=="/"&&X.endsWith("/"))X=X.replace(/\/+$/,"");if(Z&&X[0]===Id&&!J.authority)X=X.substring(1);return J.with({path:X})}function R04(J){if(J=b6(J),J.path.length===0||J.path===Id)return J;let Q=bZ1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function j04(J,Q){if(Q.scheme!==J.scheme||(Q.authority??"")!==(J.authority??""))return!1;let Y=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),Z=Y?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,X=Y?J.path.slice(0,2).toUpperCase()+J.path.slice(2):J.path;return X===Z||X.startsWith(Z.endsWith("/")?Z:`${Z}/`)||Z.endsWith("/")&&X===Z.slice(0,-1)}function P04(J,Q){if(J.scheme!==Q.scheme||J.authority!==Q.authority||J.query!==Q.query||J.fragment!==Q.fragment)return null;let Y=J.platform==="windows"?"\\":"/";return zW0(J.path,Q.path,Y,Y)}function T04(J,Q){let Y=h0(J),Z=h0(Q);if(Y.startsWith("file:///")&&Z.startsWith("file:///"))return FW0(Y)===FW0(Z);return Y===Z}function FW0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Id="/",s1;var Ed=i(()=>{$O();OC();s1={joinPath:I04,resolvePath:E04,dirname:R04,basename:(J)=>vD(b6(J).path),extname:(J)=>Ad(b6(J).path),hasPrefix:j04,relativePath:P04,equalURIs:T04}});var C04=(J)=>{let Q=0,Y=[];while(Q<J.length){let Z=J[Q];if(Z==="\\"){Q++;continue}if(Z==="{"){Y.push({type:"brace",value:"{"}),Q++;continue}if(Z==="}"){Y.push({type:"brace",value:"}"}),Q++;continue}if(Z==="["){Y.push({type:"paren",value:"["}),Q++;continue}if(Z==="]"){Y.push({type:"paren",value:"]"}),Q++;continue}if(Z===":"){Y.push({type:"separator",value:":"}),Q++;continue}if(Z===","){Y.push({type:"delimiter",value:","}),Q++;continue}if(Z==='"'){let K="",q=!1;Z=J[++Q];while(Z!=='"'){if(Q===J.length){q=!0;break}if(Z==="\\"){if(Q++,Q===J.length){q=!0;break}K+=Z+J[Q],Z=J[++Q]}else K+=Z,Z=J[++Q]}if(Z=J[++Q],!q)Y.push({type:"string",value:K});continue}if(Z&&/\s/.test(Z)){Q++;continue}let G=/[0-9]/;if(Z&&G.test(Z)||Z==="-"||Z==="."){let K="";if(Z==="-")K+=Z,Z=J[++Q];while(Z&&G.test(Z)||Z===".")K+=Z,Z=J[++Q];Y.push({type:"number",value:K});continue}let V=/[a-z]/i;if(Z&&V.test(Z)){let K="";while(Z&&V.test(Z)){if(Q===J.length)break;K+=Z,Z=J[++Q]}if(K=="true"||K=="false"||K==="null")Y.push({type:"name",value:K});else{Q++;continue}continue}Q++}return Y},GO=(J)=>{if(J.length===0)return J;let Q=J[J.length-1];switch(Q.type){case"separator":return J=J.slice(0,J.length-1),GO(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),GO(J);case"string":let Z=J[J.length-2];if(Z?.type==="delimiter")return J=J.slice(0,J.length-1),GO(J);else if(Z?.type==="brace"&&Z.value==="{")return J=J.slice(0,J.length-1),GO(J);break;case"delimiter":return J=J.slice(0,J.length-1),GO(J);break}return J},_04=(J)=>{let Q=[];if(J.map((Y)=>{if(Y.type==="brace")if(Y.value==="{")Q.push("}");else Q.splice(Q.lastIndexOf("}"),1);if(Y.type==="paren")if(Y.value==="[")Q.push("]");else Q.splice(Q.lastIndexOf("]"),1)}),Q.length>0)Q.reverse().map((Y)=>{if(Y==="}")J.push({type:"brace",value:"}"});else if(Y==="]")J.push({type:"paren",value:"]"})});return J},S04=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},hY=(J)=>JSON.parse(S04(_04(GO(C04(J)))));var bD=()=>{};function Rd(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function UW0(J){let Q=J._cleanup;if(Q===void 0)return;if(J._cleanup=void 0,!Q)return;try{if(typeof Q==="function")Q();else if(Q&&typeof Q.unsubscribe==="function")Q.unsubscribe()}catch(Y){console.error("cleanupSubscription",Y)}}function hZ1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function k04(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(DW0(J,Y.type,Y.value),J._state==="closed")break}function DW0(J,Q,Y){J._state="running";let Z=J._observer;try{switch(Q){case"next":if(Z&&typeof Z.next==="function")Z.next(Y);break;case"error":if(hZ1(J),Z&&typeof Z.error==="function")Z.error(Y);else throw Y;break;case"complete":if(hZ1(J),Z&&typeof Z.complete==="function")Z.complete();break}}catch(X){console.error("notifySubscription",X)}if(J._state==="closed")UW0(J);else if(J._state==="running")J._state="ready"}function fZ1(J,Q,Y){if(J._state==="closed")return;if(J._state==="buffering"){J._queue=J._queue||[],J._queue.push({type:Q,value:Y});return}if(J._state!=="ready"){J._state="buffering",J._queue=[{type:Q,value:Y}],Rd(()=>k04(J));return}DW0(J,Q,Y)}class BW0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new NW0(this);try{this._cleanup=Q.call(void 0,Y)}catch(Z){Y.error(Z)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")hZ1(this),UW0(this)}}class NW0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){fZ1(this._subscription,"next",J)}error(J){fZ1(this._subscription,"error",J)}complete(){fZ1(this._subscription,"complete")}}function Z9(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class fD{_baseObserver;_pendingPromises;constructor(J){this._baseObserver=J,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch((J)=>this._baseObserver.error(J))}error(J){this._baseObserver.error(J)}schedule(J){let Q=Promise.all(this._pendingPromises),Y=[],Z=(G)=>Y.push(G),X=Promise.resolve().then(async()=>{await Q,await J(Z),this._pendingPromises.delete(X);for(let G of Y)this._baseObserver.next(G)}).catch((G)=>{this._pendingPromises.delete(X),this._baseObserver.error(G)});this._pendingPromises.add(X)}}function gZ1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function mZ1(J){if(gZ1(J))return J;return P1.of(J)}var P1;var hD=i(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");P1=class P1{_subscriber;constructor(J){if(!(this instanceof P1))throw TypeError("Observable cannot be called as a function");if(typeof J!=="function")throw TypeError("Observable initializer must be a function");this._subscriber=J}subscribe(J,Q,Y){if(typeof J!=="object"||J===null)J={next:J,error:Q,complete:Y};return new BW0(J,this._subscriber)}pipe(J,...Q){let Y=this;for(let Z of[J,...Q])Y=Z(Y);return Y}[Symbol.observable](){return this}static from(J){let Q=typeof P1==="function"?P1:P1;if(J==null)throw TypeError(J+" is not an object");let Y=J[Symbol.observable];if(typeof Y==="function"){let X=Y.call(J);if(Object(X)!==X)throw TypeError(X+" is not an object");if(X instanceof P1)return X;return new Q((G)=>X.subscribe(G))}let Z=J[Symbol.iterator];if(typeof Z==="function")return new Q((X)=>{Rd(()=>{if(X.closed)return;for(let G of Z.call(J))if(X.next(G),X.closed)return;X.complete()})});if(Array.isArray(J))return new Q((X)=>{Rd(()=>{if(X.closed)return;for(let G of J)if(X.next(G),X.closed)return;X.complete()})});throw TypeError(J+" is not observable")}static of(...J){return new(typeof P1==="function"?P1:P1)((Y)=>{Rd(()=>{if(Y.closed)return;for(let Z of J)if(Y.next(Z),Y.closed)return;Y.complete()})})}static get[Symbol.species](){return P1}}});var F6,m4;var jd=i(()=>{hD();F6=class F6 extends P1{_observers=new Set;constructor(){super((J)=>{return this._observers.add(J),()=>this._observers.delete(J)})}next(J){for(let Q of this._observers)Q.next(J)}error(J){for(let Q of this._observers)Q.error(J)}complete(){for(let J of this._observers)J.complete()}};m4=class m4 extends F6{currentValue;constructor(J){super();this.currentValue=J}next(J){this.currentValue=J,super.next(J)}subscribe(J,Q,Y){if(typeof J!=="object"||J===null){let Z={};if(J)Z.next=J;if(Q)Z.error=Q;if(Y)Z.complete=Y;J=Z}return J.next?.(this.currentValue),super.subscribe(J)}getValue(){return this.currentValue}}});var Pd,AC;var wW0=i(()=>{hD();jd();Pd=class Pd extends Set{subject=new m4(this);add(J){return super.add(J),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return P1.from(this.subject)}dispose(){this.subject.complete()}};AC=class AC extends Map{subject=new m4(this);set(J,Q){return super.set(J,Q),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return P1.from(this.subject)}dispose(){this.subject.complete()}}});function Td(J,Q){if(J===Q)return!0;if(J==null||Q==null||typeof J!=="object"||typeof Q!=="object")return!1;let Y=Array.isArray(J),Z=Array.isArray(Q);if(Y!==Z)return!1;if(Y&&Z)return J.length===Q.length&&J.every((G,V)=>Td(G,Q[V]));let X=new Set([...Object.keys(J),...Object.keys(Q)]);for(let G of X)if(!Td(J[G],Q[G]))return!1;return!0}var Cd;var uZ1=i(()=>{Cd={now:()=>Date.now(),schedule:(J,Q)=>{let Y=setTimeout(J,Q);return()=>clearTimeout(Y)}}});function _d(J){return{dispose:J.unsubscribe.bind(J)}}async function A0(J,Q){return new Promise((Y,Z)=>{let X,G=()=>{X?.unsubscribe(),Z(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",G,{once:!0}),X=J.subscribe({next:(V)=>{X?.unsubscribe(),Q?.removeEventListener("abort",G),Y(V)},error:(V)=>{Q?.removeEventListener("abort",G),Z(V)},complete:()=>{Q?.removeEventListener("abort",G),Z("Observable completed without emitting a value")}})})}async function eW(J,Q){return new Promise((Y,Z)=>{let X,G=!1,V,K=()=>{V?.unsubscribe(),Z(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",K,{once:!0}),V=J.subscribe({next:(q)=>{X=q,G=!0},error:(q)=>{Q?.removeEventListener("abort",K),Z(q)},complete:()=>{if(Q?.removeEventListener("abort",K),G)Y(X);else Z("Observable completed without emitting a value")}})})}async function LW0(J,Q){return new Promise((Y,Z)=>{let X=J.subscribe({error:Z,complete:()=>Y()});Q?.addEventListener("abort",()=>{X.unsubscribe(),Z(new DOMException("Aborted","AbortError"))},{once:!0})})}function Y5(J){return new P1((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function n0(J){return new P1((Q)=>{let Y=!1,Z=new AbortController,X=Z.signal;return(async()=>{try{X?.throwIfAborted();let V=await J(X);if(X?.throwIfAborted(),!Y)Q.next(V),Q.complete()}catch(V){if(!Y)if(X.aborted)Q.complete();else Q.error(V)}})(),()=>{Y=!0,Z.abort()}})}function q0(J){return(Q)=>{return new P1((Y)=>{let Z=new fD(Y),X=0,G=Q.subscribe({complete(){Z.complete()},error(V){Z.error(V)},next(V){Z.schedule(async(K)=>{let q=await J(V,X);X++,K(q)})}});return()=>Z9(G)})}}function VO(J,Q=Cd){return new P1((Y)=>{let Z=0,X=null,G=()=>{Y.next(Z++),X=Q.schedule(G,J)};return X=Q.schedule(G,J),()=>{if(X)X()}})}function LK(...J){return new P1((Q)=>{let Y=0,Z=J.map((X)=>X.subscribe({next:(G)=>Q.next(G),error:(G)=>Q.error(G),complete:()=>{if(Y++,Y===J.length)Q.complete()}}));return()=>{OW0(Z)}})}function v4(...J){if(J.length===0)return IC;return new P1((Q)=>{let Y=Array(J.length),Z=Array(J.length).fill(0),X=Array(J.length).fill(!1),G=0,V=[],K=new fD(Q);for(let q=0;q<J.length;q++){let W=J[q];V.push(W.subscribe({next(H){Y[q]=H,X[q]=!0;let z=++Z[q];if(X.every(Boolean))K.schedule(async(F)=>{if(Z[q]===z)F([...Y])})},error(H){K.error(H)},complete(){if(G++,G===J.length)K.complete()}}))}return()=>{OW0(V)}})}function $4(J){let Y=J?.shouldCountRefs??!0,Z=y04++,X=(G,...V)=>{};return(G)=>{let V=new F6,K=null,q=!1,W,H=0;return new P1((z)=>{if(H++,q)X("new subscriber, emitting buffered value",W),z.next(W);else X("new subscriber, no buffered value to emit");if(!K)K=G.subscribe({next:(U)=>{q=!0,W=U,V.next(U)},error:(U)=>V.error(U),complete:()=>V.complete()});let F=V.subscribe(z);return()=>{if(H--,F.unsubscribe(),Y&&H===0){if(K)Z9(K),K=null;q=!1}}})}}function OW0(J){for(let Q of J)if(Q)Z9(Q)}function OK(J){return(Q)=>{return new P1((Y)=>{let Z=Q.subscribe({next:(G)=>Y.next(G),error:(G)=>Y.error(G),complete:()=>Y.complete()}),X=J.subscribe({next:()=>{Y.complete(),Z.unsubscribe(),X.unsubscribe()},error:(G)=>{Y.error(G),Z.unsubscribe()}});return()=>{Z.unsubscribe(),X.unsubscribe()}})}}function OX(J){return(Q)=>{return new P1((Y)=>{let Z,X=Q.subscribe({next(G){Z=G,Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{Z9(X),J(Z)}})}}function q6(J=Td){return(Q)=>{return new P1((Y)=>{let Z=MW0,X=new fD(Y),G=Q.subscribe({complete(){X.complete()},error(V){X.error(V)},next(V){X.schedule(async(K)=>{if(Z===MW0||!J(Z,V))Z=V,K(V)})}});return()=>Z9(G)})}}function WQ(J){return x04(typeof J==="function"?{next:J}:J)}function x04(J){return(Q)=>new P1((Y)=>{let Z=typeof J==="function"?J():J,X=Q.subscribe({next(G){if(Z.next)try{Z.next(G)}catch(V){Y.error(V);return}Y.next(G)},error(G){if(Z.error)try{Z.error(G)}catch(V){Y.error(V);return}Y.error(G)},complete(){if(Z.complete)try{Z.complete()}catch(G){Y.error(G);return}Y.complete()}});return()=>Z9(X)})}function GG(J){return(Q)=>{return new P1((Y)=>{let Z=!1,X=Q.subscribe({next:(V)=>{Z=!0,clearTimeout(G),Y.next(V)},error:(V)=>{clearTimeout(G),Y.error(V)},complete:()=>{clearTimeout(G),Y.complete()}}),G=setTimeout(()=>{if(!Z)X.unsubscribe(),Y.error(new Sd(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(G),X.unsubscribe()}})}}function H4(J){return(Q)=>new P1((Y)=>{let Z;try{Y.next(J),Z=Q.subscribe({next(X){Y.next(X)},error(X){Y.error(X)},complete(){Y.complete()}})}catch(X){Y.error(X)}return()=>{if(Z)Z9(Z)}})}function VG(J){return(Q)=>new P1((Y)=>{let Z=0,X=Q.subscribe({next(G){if(Z<J){if(Y.next(G),Z++,Z===J)Y.complete(),Z9(X)}},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{Z9(X)}})}function AW0(J){return(Q)=>new P1((Y)=>{let Z=0,X=Q.subscribe({next(G){if(Z>=J)Y.next(G);else Z++},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{Z9(X)}})}function pZ1(J){return(Q)=>{return new P1((Y)=>{let Z=0,X=new Set,G=!1,V=()=>{if(G&&X.size===0)Y.complete()},K=Q.subscribe({next(q){let H=J(q,Z++).subscribe({next(z){Y.next(z)},error(z){Y.error(z)},complete(){X.delete(H),V()}});X.add(H)},error(q){Y.error(q)},complete(){G=!0,V()}});return()=>{Z9(K);for(let q of X)if(q)Z9(q)}})}}function V6(J){return(Q)=>{return new P1((Y)=>{let Z=0,X=null,G=!1,V=()=>{if(G&&!X)Y.complete()},K=Q.subscribe({next(q){if(X)Z9(X),X=null;let W;try{W=J(q,Z++)}catch(H){Y.error(H);return}X=W.subscribe({next(H){Y.next(H)},error(H){Y.error(H)},complete(){X=null,V()}})},error(q){Y.error(q)},complete(){G=!0,V()}});return()=>{if(Z9(K),X)Z9(X)}})}}function MJ(J,Q){let Y=Q?.scheduler??Cd;return(Z)=>new P1((X)=>{let G=null,V=null,K=!1,q=Z.subscribe({next:(W)=>{if(V=W,K=!0,G===null)G=Y.schedule(()=>{if(K)X.next(V),K=!1;G=null},J)},error:(W)=>X.error(W),complete:()=>{if(G!==null)G();if(K)X.next(V);X.complete()}});return()=>{if(Z9(q),G!==null)G()}})}function EC(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");let Y=Q.scheduler??Cd;return(Z)=>new P1((X)=>{let G=0,V=null,K=null,q=!1,W=Z.subscribe({next:(H)=>{let z=Y.now();if(K=H,q=!0,z-G>=J)X.next(H),G=z,q=!1;else if(V===null)V=Y.schedule(()=>{if(q)X.next(K),G=Y.now(),q=!1;V=null},J-(z-G));if(G===0)X.next(H),G=z,q=!1},error:(H)=>X.error(H),complete:()=>{if(V!==null)V();if(q)X.next(K);X.complete()}});return()=>{if(Z9(W),V!==null)V()}})}function gD(...J){return new P1((Q)=>{let Y=0,Z=null;function X(){if(Y>=J.length){Q.complete();return}Z=J[Y].subscribe({next:(V)=>Q.next(V),error:(V)=>Q.error(V),complete:()=>{Y++,X()}})}return X(),()=>{if(Z)Z9(Z)}})}function HQ(J){return(Q)=>new P1((Y)=>{let Z=0,X=!1,G=null,V=Q.subscribe({next(K){try{let q=J(K,Z++);if(G)Z9(G);G=q.subscribe({next(W){Y.next(W)},error(W){Y.error(W)},complete(){if(G=null,X&&!G)Y.complete()}})}catch(q){Y.error(q)}},error(K){Y.error(K)},complete(){if(X=!0,!G)Y.complete()}});return()=>{if(Z9(V),G)Z9(G)}})}function RC({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new P1((Z)=>{J?.();let X=Y.subscribe(Z);return()=>{Z9(X),Q?.()}})}function AK(J){return(Q)=>P1.from(Q).pipe(V6((Y)=>n0((Z)=>J(Y,Z))))}function y9(J){return(Q)=>new P1((Y)=>{let Z,X=Q.subscribe({next(G){Y.next(G)},error(G){try{Z=J(G).subscribe({next(K){Y.next(K)},error(K){Y.error(K)},complete(){Y.complete()}})}catch(V){Y.error(V)}},complete(){Y.complete()}});return()=>{if(Z9(X),Z)Z9(Z)}})}function u4(J){return(Q)=>{return new P1((Y)=>{let Z=Q.subscribe({next(X){if(J(X))Y.next(X)},error(X){Y.error(X)},complete(){Y.complete()}});return()=>Z9(Z)})}}function IW0(J,Q){return(Y)=>{return new P1((Z)=>{let X,G=0,V=new fD(Z),K=Y.subscribe({complete(){V.complete()},error(q){V.error(q)},next(q){V.schedule(async(W)=>{X=await J(G===0?typeof Q>"u"?q:Q:X,q,G++),W(X)})}});return()=>Z9(K)})}}var IC,gY,Tf8,y04=0,MW0,Sd;var dZ1=i(()=>{hD();uZ1();jd();IC=new P1((J)=>{J.complete()}),gY=new P1(()=>{});Tf8=Symbol("noInitialValue");MW0={};Sd=class Sd extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function KO(J,Q){return(Y)=>{return P1.from(Y).pipe(V6((Z)=>Z===KG?P1.of(KG):J(Z).pipe(y9((X)=>P1.of(X instanceof Error?X:Error(X))),H4(KG))),$4(Q))}}function cZ1(){return(J)=>P1.from(J).pipe(u4((Q)=>Q!==KG))}async function EW0(J,Q){let Y=await A0(P1.from(J).pipe(cZ1()),Q);if(Y instanceof Error)throw Y;return Y}var KG;var RW0=i(()=>{hD();dZ1();KG=Symbol.for("@@pendingOperation")});function jW0(...J){return new P1((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}var PW0=i(()=>{hD()});var G0=i(()=>{wW0();hD();RW0();dZ1();uZ1();jd();PW0()});function p3(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function pD(J){return!!J&&!!J[zQ]}function JH(J){if(!J)return!1;return kW0(J)||Array.isArray(J)||!!J[jC]||!!J.constructor?.[jC]||SC(J)||kC(J)}function kW0(J){if(!J||typeof J!=="object")return!1;let Q=uD(J);if(Q===null)return!0;let Y=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(Y===Object)return!0;return typeof Y=="function"&&Function.toString.call(Y)===v04}function PC(J,Q){if(dD(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,Z)=>Q(Z,Y,J))}function dD(J){let Q=J[zQ];return Q?Q.type_:Array.isArray(J)?1:SC(J)?2:kC(J)?3:0}function TC(J,Q){return dD(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function lZ1(J,Q){return dD(J)===2?J.get(Q):J[Q]}function yW0(J,Q,Y){let Z=dD(J);if(Z===2)J.set(Q,Y);else if(Z===3)J.add(Y);else J[Q]=Y}function b04(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function SC(J){return J instanceof Map}function kC(J){return J instanceof Set}function mD(J){return J.copy_||J.base_}function aZ1(J,Q){if(SC(J))return new Map(J);if(kC(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=kW0(J);if(Q===!0||Q==="class_only"&&!Y){let Z=Object.getOwnPropertyDescriptors(J);delete Z[zQ];let X=Reflect.ownKeys(Z);for(let G=0;G<X.length;G++){let V=X[G],K=Z[V];if(K.writable===!1)K.writable=!0,K.configurable=!0;if(K.get||K.set)Z[V]={configurable:!0,writable:!0,enumerable:K.enumerable,value:J[V]}}return Object.create(uD(J),Z)}else{let Z=uD(J);if(Z!==null&&Y)return{...J};let X=Object.create(Z);return Object.assign(X,J)}}function UQ(J,Q=!1){if(xd(J)||pD(J)||!JH(J))return J;if(dD(J)>1)J.set=J.add=J.clear=J.delete=f04;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,Z])=>UQ(Z,!0));return J}function f04(){p3(2)}function xd(J){return Object.isFrozen(J)}function cD(J){let Q=oZ1[J];if(!Q)p3(0,J);return Q}function h04(J,Q){if(!oZ1[J])oZ1[J]=Q}function xW0(){return CC}function g04(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function TW0(J,Q){if(Q)cD("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function rZ1(J){sZ1(J),J.drafts_.forEach(m04),J.drafts_=null}function sZ1(J){if(J===CC)CC=J.parent_}function CW0(J){return CC=g04(CC,J)}function m04(J){let Q=J[zQ];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function _W0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[zQ].modified_)rZ1(Q),p3(4);if(JH(J)){if(J=kd(Q,J),!Q.parent_)yd(Q,J)}if(Q.patches_)cD("Patches").generateReplacementPatches_(Y[zQ].base_,J,Q.patches_,Q.inversePatches_)}else J=kd(Q,Y,[]);if(rZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==JX1?J:void 0}function kd(J,Q,Y){if(xd(Q))return Q;let Z=Q[zQ];if(!Z)return PC(Q,(X,G)=>SW0(J,Z,Q,X,G,Y)),Q;if(Z.scope_!==J)return Q;if(!Z.modified_)return yd(J,Z.base_,!0),Z.base_;if(!Z.finalized_){Z.finalized_=!0,Z.scope_.unfinalizedDrafts_--;let X=Z.copy_,G=X,V=!1;if(Z.type_===3)G=new Set(X),X.clear(),V=!0;if(PC(G,(K,q)=>SW0(J,Z,X,K,q,Y,V)),yd(J,X,!1),Y&&J.patches_)cD("Patches").generatePatches_(Z,Y,J.patches_,J.inversePatches_)}return Z.copy_}function SW0(J,Q,Y,Z,X,G,V){if(pD(X)){let K=G&&Q&&Q.type_!==3&&!TC(Q.assigned_,Z)?G.concat(Z):void 0,q=kd(J,X,K);if(yW0(Y,Z,q),pD(q))J.canAutoFreeze_=!1;else return}else if(V)Y.add(X);if(JH(X)&&!xd(X)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(kd(J,X),(!Q||!Q.scope_.parent_)&&typeof Z!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,Z))yd(J,X)}}function yd(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)UQ(Q,Y)}function u04(J,Q){let Y=Array.isArray(J),Z={type_:Y?1:0,scope_:Q?Q.scope_:xW0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},X=Z,G=QX1;if(Y)X=[Z],G=_C;let{revoke:V,proxy:K}=Proxy.revocable(X,G);return Z.draft_=K,Z.revoke_=V,K}function iZ1(J,Q){let Y=J[zQ];return(Y?mD(Y):J)[Q]}function p04(J,Q,Y){let Z=vW0(Q,Y);return Z?"value"in Z?Z.value:Z.get?.call(J.draft_):void 0}function vW0(J,Q){if(!(Q in J))return;let Y=uD(J);while(Y){let Z=Object.getOwnPropertyDescriptor(Y,Q);if(Z)return Z;Y=uD(Y)}return}function tZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)tZ1(J.parent_)}}function nZ1(J){if(!J.copy_)J.copy_=aZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function eZ1(J,Q){let Y=SC(J)?cD("MapSet").proxyMap_(J,Q):kC(J)?cD("MapSet").proxySet_(J,Q):u04(J,Q);return(Q?Q.scope_:xW0()).drafts_.push(Y),Y}function c04(J){if(!pD(J))p3(10,J);return bW0(J)}function bW0(J){if(!JH(J)||xd(J))return J;let Q=J[zQ],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=aZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=aZ1(J,!0);if(PC(Y,(Z,X)=>{yW0(Y,Z,bW0(X))}),Q)Q.finalized_=!1;return Y}function vd(){let Q="replace",Y="add",Z="remove";function X(F,U,D,B){switch(F.type_){case 0:case 2:return V(F,U,D,B);case 1:return G(F,U,D,B);case 3:return K(F,U,D,B)}}function G(F,U,D,B){let{base_:N,assigned_:w}=F,M=F.copy_;if(M.length<N.length)[N,M]=[M,N],[D,B]=[B,D];for(let L=0;L<N.length;L++)if(w[L]&&M[L]!==N[L]){let O=U.concat([L]);D.push({op:Q,path:O,value:z(M[L])}),B.push({op:Q,path:O,value:z(N[L])})}for(let L=N.length;L<M.length;L++){let O=U.concat([L]);D.push({op:Y,path:O,value:z(M[L])})}for(let L=M.length-1;N.length<=L;--L){let O=U.concat([L]);B.push({op:Z,path:O})}}function V(F,U,D,B){let{base_:N,copy_:w}=F;PC(F.assigned_,(M,L)=>{let O=lZ1(N,M),A=lZ1(w,M),I=!L?Z:TC(N,M)?Q:Y;if(O===A&&I===Q)return;let P=U.concat(M);D.push(I===Z?{op:I,path:P}:{op:I,path:P,value:A}),B.push(I===Y?{op:Z,path:P}:I===Z?{op:Y,path:P,value:z(O)}:{op:Q,path:P,value:z(O)})})}function K(F,U,D,B){let{base_:N,copy_:w}=F,M=0;N.forEach((L)=>{if(!w.has(L)){let O=U.concat([M]);D.push({op:Z,path:O,value:L}),B.unshift({op:Y,path:O,value:L})}M++}),M=0,w.forEach((L)=>{if(!N.has(L)){let O=U.concat([M]);D.push({op:Y,path:O,value:L}),B.unshift({op:Z,path:O,value:L})}M++})}function q(F,U,D,B){D.push({op:Q,path:[],value:U===JX1?void 0:U}),B.push({op:Q,path:[],value:F})}function W(F,U){return U.forEach((D)=>{let{path:B,op:N}=D,w=F;for(let A=0;A<B.length-1;A++){let I=dD(w),P=B[A];if(typeof P!=="string"&&typeof P!=="number")P=""+P;if((I===0||I===1)&&(P==="__proto__"||P==="constructor"))p3(19);if(typeof w==="function"&&P==="prototype")p3(19);if(w=lZ1(w,P),typeof w!=="object")p3(18,B.join("/"))}let M=dD(w),L=H(D.value),O=B[B.length-1];switch(N){case Q:switch(M){case 2:return w.set(O,L);case 3:p3(16);default:return w[O]=L}case Y:switch(M){case 1:return O==="-"?w.push(L):w.splice(O,0,L);case 2:return w.set(O,L);case 3:return w.add(L);default:return w[O]=L}case Z:switch(M){case 1:return w.splice(O,1);case 2:return w.delete(O);case 3:return w.delete(D.value);default:return delete w[O]}default:p3(17,N)}}),F}function H(F){if(!JH(F))return F;if(Array.isArray(F))return F.map(H);if(SC(F))return new Map(Array.from(F.entries()).map(([D,B])=>[D,H(B)]));if(kC(F))return new Set(Array.from(F).map(H));let U=Object.create(uD(F));for(let D in F)U[D]=H(F[D]);if(TC(F,jC))U[jC]=F[jC];return U}function z(F){if(pD(F))return H(F);else return F}h04("Patches",{applyPatches_:W,generatePatches_:X,generateReplacementPatches_:q})}function S4(J){return J}var JX1,jC,zQ,uD,v04,oZ1,CC,QX1,_C,d04=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Y,Z)=>{if(typeof Q==="function"&&typeof Y!=="function"){let G=Y;Y=Q;let V=this;return function(q=G,...W){return V.produce(q,(H)=>Y.call(this,H,...W))}}if(typeof Y!=="function")p3(6);if(Z!==void 0&&typeof Z!=="function")p3(7);let X;if(JH(Q)){let G=CW0(this),V=eZ1(Q,void 0),K=!0;try{X=Y(V),K=!1}finally{if(K)rZ1(G);else sZ1(G)}return TW0(G,Z),_W0(X,G)}else if(!Q||typeof Q!=="object"){if(X=Y(Q),X===void 0)X=Q;if(X===JX1)X=void 0;if(this.autoFreeze_)UQ(X,!0);if(Z){let G=[],V=[];cD("Patches").generateReplacementPatches_(Q,X,G,V),Z(G,V)}return X}else p3(1,Q)},this.produceWithPatches=(Q,Y)=>{if(typeof Q==="function")return(V,...K)=>this.produceWithPatches(V,(q)=>Q(q,...K));let Z,X;return[this.produce(Q,Y,(V,K)=>{Z=V,X=K}),Z,X]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!JH(J))p3(8);if(pD(J))J=c04(J);let Q=CW0(this),Y=eZ1(J,void 0);return Y[zQ].isManual_=!0,sZ1(Q),Y}finishDraft(J,Q){let Y=J&&J[zQ];if(!Y||!Y.isManual_)p3(9);let{scope_:Z}=Y;return TW0(Z,Q),_W0(void 0,Z)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Y;for(Y=Q.length-1;Y>=0;Y--){let X=Q[Y];if(X.path.length===0&&X.op==="replace"){J=X.value;break}}if(Y>-1)Q=Q.slice(Y+1);let Z=cD("Patches").applyPatches_;if(pD(J))return Z(J,Q);return this.produce(J,(X)=>Z(X,Q))}},FQ,B2,lD,df8,cf8,fW0,lf8,if8;var N2=i(()=>{JX1=Symbol.for("immer-nothing"),jC=Symbol.for("immer-draftable"),zQ=Symbol.for("immer-state");uD=Object.getPrototypeOf;v04=Object.prototype.constructor.toString();oZ1={};QX1={get(J,Q){if(Q===zQ)return J;let Y=mD(J);if(!TC(Y,Q))return p04(J,Y,Q);let Z=Y[Q];if(J.finalized_||!JH(Z))return Z;if(Z===iZ1(J.base_,Q))return nZ1(J),J.copy_[Q]=eZ1(Z,J);return Z},has(J,Q){return Q in mD(J)},ownKeys(J){return Reflect.ownKeys(mD(J))},set(J,Q,Y){let Z=vW0(mD(J),Q);if(Z?.set)return Z.set.call(J.draft_,Y),!0;if(!J.modified_){let X=iZ1(mD(J),Q),G=X?.[zQ];if(G&&G.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(b04(Y,X)&&(Y!==void 0||TC(J.base_,Q)))return!0;nZ1(J),tZ1(J)}if(J.copy_[Q]===Y&&(Y!==void 0||(Q in J.copy_))||Number.isNaN(Y)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Y,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(iZ1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,nZ1(J),tZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=mD(J),Z=Reflect.getOwnPropertyDescriptor(Y,Q);if(!Z)return Z;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:Z.enumerable,value:Y[Q]}},defineProperty(){p3(11)},getPrototypeOf(J){return uD(J.base_)},setPrototypeOf(){p3(12)}},_C={};PC(QX1,(J,Q)=>{_C[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});_C.deleteProperty=function(J,Q){return _C.set.call(this,J,Q,void 0)};_C.set=function(J,Q,Y){return QX1.set.call(this,J[0],Q,Y,J[0])};FQ=new d04,B2=FQ.produce,lD=FQ.produceWithPatches.bind(FQ),df8=FQ.setAutoFreeze.bind(FQ),cf8=FQ.setUseStrictShallowCopy.bind(FQ),fW0=FQ.applyPatches.bind(FQ),lf8=FQ.createDraft.bind(FQ),if8=FQ.finishDraft.bind(FQ)});function hW0(J,Q=0){return(K3[J[Q+0]]+K3[J[Q+1]]+K3[J[Q+2]]+K3[J[Q+3]]+"-"+K3[J[Q+4]]+K3[J[Q+5]]+"-"+K3[J[Q+6]]+K3[J[Q+7]]+"-"+K3[J[Q+8]]+K3[J[Q+9]]+"-"+K3[J[Q+10]]+K3[J[Q+11]]+K3[J[Q+12]]+K3[J[Q+13]]+K3[J[Q+14]]+K3[J[Q+15]]).toLowerCase()}var K3;var gW0=i(()=>{K3=[];for(let J=0;J<256;++J)K3.push((J+256).toString(16).slice(1))});import{randomFillSync as l04}from"crypto";function hd(){if(bd>fd.length-16)l04(fd),bd=0;return fd.slice(bd,bd+=16)}var fd,bd;var mW0=i(()=>{fd=new Uint8Array(256),bd=fd.length});function i04(J,Q,Y){let Z;if(J)Z=uW0(J.random??J.rng?.()??hd(),J.msecs,J.seq,Q,Y);else{let X=Date.now(),G=hd();n04(YX1,X,G),Z=uW0(G,YX1.msecs,YX1.seq,Q,Y)}return Q??hW0(Z)}function n04(J,Q,Y){if(J.msecs??=-1/0,J.seq??=0,Q>J.msecs)J.seq=Y[6]<<23|Y[7]<<16|Y[8]<<8|Y[9],J.msecs=Q;else if(J.seq=J.seq+1|0,J.seq===0)J.msecs++;return J}function uW0(J,Q,Y,Z,X=0){if(J.length<16)throw Error("Random bytes length must be >= 16");if(!Z)Z=new Uint8Array(16),X=0;else if(X<0||X+16>Z.length)throw RangeError(`UUID byte range ${X}:${X+15} is out of buffer bounds`);return Q??=Date.now(),Y??=J[6]*127<<24|J[7]<<16|J[8]<<8|J[9],Z[X++]=Q/1099511627776&255,Z[X++]=Q/4294967296&255,Z[X++]=Q/16777216&255,Z[X++]=Q/65536&255,Z[X++]=Q/256&255,Z[X++]=Q&255,Z[X++]=112|Y>>>28&15,Z[X++]=Y>>>20&255,Z[X++]=128|Y>>>14&63,Z[X++]=Y>>>6&255,Z[X++]=Y<<2&255|J[10]&3,Z[X++]=J[11],Z[X++]=J[12],Z[X++]=J[13],Z[X++]=J[14],Z[X++]=J[15],Z}var YX1,yC;var pW0=i(()=>{mW0();gW0();YX1={};yC=i04});var ZX1=i(()=>{pW0()});function XX1({onlyFirst:J=!1}={}){let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Y,J?void 0:"g")}function qO(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(a04,"")}var a04;var gd=i(()=>{a04=XX1()});var cW0=_((Gh8,$X1)=>{var QH={};if(typeof $X1>"u")window.eastasianwidth=QH;else $X1.exports=QH;QH.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Y=J.length==2?J.charCodeAt(1):0,Z=Q;if(55296<=Q&&Q<=56319&&(56320<=Y&&Y<=57343))Q&=1023,Y&=1023,Z=Q<<10|Y,Z+=65536;if(Z==12288||65281<=Z&&Z<=65376||65504<=Z&&Z<=65510)return"F";if(Z==8361||65377<=Z&&Z<=65470||65474<=Z&&Z<=65479||65482<=Z&&Z<=65487||65490<=Z&&Z<=65495||65498<=Z&&Z<=65500||65512<=Z&&Z<=65518)return"H";if(4352<=Z&&Z<=4447||4515<=Z&&Z<=4519||4602<=Z&&Z<=4607||9001<=Z&&Z<=9002||11904<=Z&&Z<=11929||11931<=Z&&Z<=12019||12032<=Z&&Z<=12245||12272<=Z&&Z<=12283||12289<=Z&&Z<=12350||12353<=Z&&Z<=12438||12441<=Z&&Z<=12543||12549<=Z&&Z<=12589||12593<=Z&&Z<=12686||12688<=Z&&Z<=12730||12736<=Z&&Z<=12771||12784<=Z&&Z<=12830||12832<=Z&&Z<=12871||12880<=Z&&Z<=13054||13056<=Z&&Z<=19903||19968<=Z&&Z<=42124||42128<=Z&&Z<=42182||43360<=Z&&Z<=43388||44032<=Z&&Z<=55203||55216<=Z&&Z<=55238||55243<=Z&&Z<=55291||63744<=Z&&Z<=64255||65040<=Z&&Z<=65049||65072<=Z&&Z<=65106||65108<=Z&&Z<=65126||65128<=Z&&Z<=65131||110592<=Z&&Z<=110593||127488<=Z&&Z<=127490||127504<=Z&&Z<=127546||127552<=Z&&Z<=127560||127568<=Z&&Z<=127569||131072<=Z&&Z<=194367||177984<=Z&&Z<=196605||196608<=Z&&Z<=262141)return"W";if(32<=Z&&Z<=126||162<=Z&&Z<=163||165<=Z&&Z<=166||Z==172||Z==175||10214<=Z&&Z<=10221||10629<=Z&&Z<=10630)return"Na";if(Z==161||Z==164||167<=Z&&Z<=168||Z==170||173<=Z&&Z<=174||176<=Z&&Z<=180||182<=Z&&Z<=186||188<=Z&&Z<=191||Z==198||Z==208||215<=Z&&Z<=216||222<=Z&&Z<=225||Z==230||232<=Z&&Z<=234||236<=Z&&Z<=237||Z==240||242<=Z&&Z<=243||247<=Z&&Z<=250||Z==252||Z==254||Z==257||Z==273||Z==275||Z==283||294<=Z&&Z<=295||Z==299||305<=Z&&Z<=307||Z==312||319<=Z&&Z<=322||Z==324||328<=Z&&Z<=331||Z==333||338<=Z&&Z<=339||358<=Z&&Z<=359||Z==363||Z==462||Z==464||Z==466||Z==468||Z==470||Z==472||Z==474||Z==476||Z==593||Z==609||Z==708||Z==711||713<=Z&&Z<=715||Z==717||Z==720||728<=Z&&Z<=731||Z==733||Z==735||768<=Z&&Z<=879||913<=Z&&Z<=929||931<=Z&&Z<=937||945<=Z&&Z<=961||963<=Z&&Z<=969||Z==1025||1040<=Z&&Z<=1103||Z==1105||Z==8208||8211<=Z&&Z<=8214||8216<=Z&&Z<=8217||8220<=Z&&Z<=8221||8224<=Z&&Z<=8226||8228<=Z&&Z<=8231||Z==8240||8242<=Z&&Z<=8243||Z==8245||Z==8251||Z==8254||Z==8308||Z==8319||8321<=Z&&Z<=8324||Z==8364||Z==8451||Z==8453||Z==8457||Z==8467||Z==8470||8481<=Z&&Z<=8482||Z==8486||Z==8491||8531<=Z&&Z<=8532||8539<=Z&&Z<=8542||8544<=Z&&Z<=8555||8560<=Z&&Z<=8569||Z==8585||8592<=Z&&Z<=8601||8632<=Z&&Z<=8633||Z==8658||Z==8660||Z==8679||Z==8704||8706<=Z&&Z<=8707||8711<=Z&&Z<=8712||Z==8715||Z==8719||Z==8721||Z==8725||Z==8730||8733<=Z&&Z<=8736||Z==8739||Z==8741||8743<=Z&&Z<=8748||Z==8750||8756<=Z&&Z<=8759||8764<=Z&&Z<=8765||Z==8776||Z==8780||Z==8786||8800<=Z&&Z<=8801||8804<=Z&&Z<=8807||8810<=Z&&Z<=8811||8814<=Z&&Z<=8815||8834<=Z&&Z<=8835||8838<=Z&&Z<=8839||Z==8853||Z==8857||Z==8869||Z==8895||Z==8978||9312<=Z&&Z<=9449||9451<=Z&&Z<=9547||9552<=Z&&Z<=9587||9600<=Z&&Z<=9615||9618<=Z&&Z<=9621||9632<=Z&&Z<=9633||9635<=Z&&Z<=9641||9650<=Z&&Z<=9651||9654<=Z&&Z<=9655||9660<=Z&&Z<=9661||9664<=Z&&Z<=9665||9670<=Z&&Z<=9672||Z==9675||9678<=Z&&Z<=9681||9698<=Z&&Z<=9701||Z==9711||9733<=Z&&Z<=9734||Z==9737||9742<=Z&&Z<=9743||9748<=Z&&Z<=9749||Z==9756||Z==9758||Z==9792||Z==9794||9824<=Z&&Z<=9825||9827<=Z&&Z<=9829||9831<=Z&&Z<=9834||9836<=Z&&Z<=9837||Z==9839||9886<=Z&&Z<=9887||9918<=Z&&Z<=9919||9924<=Z&&Z<=9933||9935<=Z&&Z<=9953||Z==9955||9960<=Z&&Z<=9983||Z==10045||Z==10071||10102<=Z&&Z<=10111||11093<=Z&&Z<=11097||12872<=Z&&Z<=12879||57344<=Z&&Z<=63743||65024<=Z&&Z<=65039||Z==65533||127232<=Z&&Z<=127242||127248<=Z&&Z<=127277||127280<=Z&&Z<=127337||127344<=Z&&Z<=127386||917760<=Z&&Z<=917999||983040<=Z&&Z<=1048573||1048576<=Z&&Z<=1114109)return"A";return"N"};QH.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function dW0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}QH.length=function(J){var Q=dW0(J),Y=0;for(var Z=0;Z<Q.length;Z++)Y=Y+this.characterLength(Q[Z]);return Y};QH.slice=function(J,Q,Y){if(textLen=QH.length(J),Q=Q?Q:0,Y=Y?Y:1,Q<0)Q=textLen+Q;if(Y<0)Y=textLen+Y;var Z="",X=0,G=dW0(J);for(var V=0;V<G.length;V++){var K=G[V],q=QH.length(K);if(X>=Q-(q==2?1:0))if(X+q<=Y)Z+=K;else break;X+=q}return Z}});var GX1=_((Vh8,lW0)=>{lW0.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var o04,r04;var iW0=i(()=>{gd();o04=H0(cW0(),1),r04=H0(GX1(),1)});function WO(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var md=i(()=>{iW0()});var nW0="run_terminal_command",VX1="read_file",w2="Task",mY="task_list",T8="finder",AX="get_diagnostics",x9="Bash",v9="oracle",IK="mermaid",aW0="walkthrough",ud="walkthrough_diagram",qG="todo_read",A9="todo_write",LJ="read_web_page",HO="read_thread",pd="find_thread",Z5="create_file",uY="glob",dd="undo_edit",cd="read_mcp_resource",R6="Read",X5="edit_file",zO="format_file",pY="web_search",E8="Grep",iD="Check",oW0="code_review",WG="librarian",FO="kraken",ld="look_at",id="read_github",nd="search_github",ad="commit_search",od="list_directory_github",rd="list_repositories",sd="glob_github",td="diff",M2="skill",ed="repl",rW0="handoff",Jc="illustrator",sW0;var j6=i(()=>{sW0=["Task","task_list","finder","get_diagnostics","Bash","oracle","mermaid","walkthrough","walkthrough_diagram","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","look_at","librarian","read_thread","find_thread","skill","read_github","search_github","commit_search","list_directory_github","list_repositories","glob_github","diff","handoff","illustrator"]});var xC=_((Uh8,eW0)=>{var tW0={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},s04={...tW0,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},t04={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};eW0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:t04,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(J){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${J.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(J){return J===!0?s04:tW0}}});var vC=_((Z64)=>{var{REGEX_BACKSLASH:e04,REGEX_REMOVE_BACKSLASH:J64,REGEX_SPECIAL_CHARS:Q64,REGEX_SPECIAL_CHARS_GLOBAL:Y64}=xC();Z64.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);Z64.hasRegexChars=(J)=>Q64.test(J);Z64.isRegexChar=(J)=>J.length===1&&Z64.hasRegexChars(J);Z64.escapeRegex=(J)=>J.replace(Y64,"\\$1");Z64.toPosixSlashes=(J)=>J.replace(e04,"/");Z64.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};Z64.removeBackslashes=(J)=>{return J.replace(J64,(Q)=>{return Q==="\\"?"":Q})};Z64.escapeLast=(J,Q,Y)=>{let Z=J.lastIndexOf(Q,Y);if(Z===-1)return J;if(J[Z-1]==="\\")return Z64.escapeLast(J,Q,Z-1);return`${J.slice(0,Z)}\\${J.slice(Z)}`};Z64.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};Z64.wrapOutput=(J,Q={},Y={})=>{let Z=Y.contains?"":"^",X=Y.contains?"":"$",G=`${Z}(?:${J})${X}`;if(Q.negated===!0)G=`(?:^(?!${G}).*$)`;return G};Z64.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),Z=Y[Y.length-1];if(Z==="")return Y[Y.length-2];return Z}});var qH0=_((Bh8,KH0)=>{var YH0=vC(),{CHAR_ASTERISK:KX1,CHAR_AT:F64,CHAR_BACKWARD_SLASH:bC,CHAR_COMMA:U64,CHAR_DOT:qX1,CHAR_EXCLAMATION_MARK:WX1,CHAR_FORWARD_SLASH:VH0,CHAR_LEFT_CURLY_BRACE:HX1,CHAR_LEFT_PARENTHESES:zX1,CHAR_LEFT_SQUARE_BRACKET:D64,CHAR_PLUS:B64,CHAR_QUESTION_MARK:ZH0,CHAR_RIGHT_CURLY_BRACE:N64,CHAR_RIGHT_PARENTHESES:XH0,CHAR_RIGHT_SQUARE_BRACKET:w64}=xC(),$H0=(J)=>{return J===VH0||J===bC},GH0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},M64=(J,Q)=>{let Y=Q||{},Z=J.length-1,X=Y.parts===!0||Y.scanToEnd===!0,G=[],V=[],K=[],q=J,W=-1,H=0,z=0,F=!1,U=!1,D=!1,B=!1,N=!1,w=!1,M=!1,L=!1,O=!1,A=!1,I=0,P,C,y={value:"",depth:0,isGlob:!1},S=()=>W>=Z,x=()=>q.charCodeAt(W+1),c=()=>{return P=C,q.charCodeAt(++W)};while(W<Z){C=c();let d;if(C===bC){if(M=y.backslashes=!0,C=c(),C===HX1)w=!0;continue}if(w===!0||C===HX1){I++;while(S()!==!0&&(C=c())){if(C===bC){M=y.backslashes=!0,c();continue}if(C===HX1){I++;continue}if(w!==!0&&C===qX1&&(C=c())===qX1){if(F=y.isBrace=!0,D=y.isGlob=!0,A=!0,X===!0)continue;break}if(w!==!0&&C===U64){if(F=y.isBrace=!0,D=y.isGlob=!0,A=!0,X===!0)continue;break}if(C===N64){if(I--,I===0){w=!1,F=y.isBrace=!0,A=!0;break}}}if(X===!0)continue;break}if(C===VH0){if(G.push(W),V.push(y),y={value:"",depth:0,isGlob:!1},A===!0)continue;if(P===qX1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((C===B64||C===F64||C===KX1||C===ZH0||C===WX1)===!0&&x()===zX1){if(D=y.isGlob=!0,B=y.isExtglob=!0,A=!0,C===WX1&&W===H)O=!0;if(X===!0){while(S()!==!0&&(C=c())){if(C===bC){M=y.backslashes=!0,C=c();continue}if(C===XH0){D=y.isGlob=!0,A=!0;break}}continue}break}}if(C===KX1){if(P===KX1)N=y.isGlobstar=!0;if(D=y.isGlob=!0,A=!0,X===!0)continue;break}if(C===ZH0){if(D=y.isGlob=!0,A=!0,X===!0)continue;break}if(C===D64){while(S()!==!0&&(d=c())){if(d===bC){M=y.backslashes=!0,c();continue}if(d===w64){U=y.isBracket=!0,D=y.isGlob=!0,A=!0;break}}if(X===!0)continue;break}if(Y.nonegate!==!0&&C===WX1&&W===H){L=y.negated=!0,H++;continue}if(Y.noparen!==!0&&C===zX1){if(D=y.isGlob=!0,X===!0){while(S()!==!0&&(C=c())){if(C===zX1){M=y.backslashes=!0,C=c();continue}if(C===XH0){A=!0;break}}continue}break}if(D===!0){if(A=!0,X===!0)continue;break}}if(Y.noext===!0)B=!1,D=!1;let m=q,v="",b="";if(H>0)v=q.slice(0,H),q=q.slice(H),z-=H;if(m&&D===!0&&z>0)m=q.slice(0,z),b=q.slice(z);else if(D===!0)m="",b=q;else m=q;if(m&&m!==""&&m!=="/"&&m!==q){if($H0(m.charCodeAt(m.length-1)))m=m.slice(0,-1)}if(Y.unescape===!0){if(b)b=YH0.removeBackslashes(b);if(m&&M===!0)m=YH0.removeBackslashes(m)}let u={prefix:v,input:J,start:H,base:m,glob:b,isBrace:F,isBracket:U,isGlob:D,isExtglob:B,isGlobstar:N,negated:L,negatedExtglob:O};if(Y.tokens===!0){if(u.maxDepth=0,!$H0(C))V.push(y);u.tokens=V}if(Y.parts===!0||Y.tokens===!0){let d;for(let h=0;h<G.length;h++){let l=d?d+1:H,g=G[h],V1=J.slice(l,g);if(Y.tokens){if(h===0&&H!==0)V[h].isPrefix=!0,V[h].value=v;else V[h].value=V1;GH0(V[h]),u.maxDepth+=V[h].depth}if(h!==0||V1!=="")K.push(V1);d=g}if(d&&d+1<J.length){let h=J.slice(d+1);if(K.push(h),Y.tokens)V[V.length-1].value=h,GH0(V[V.length-1]),u.maxDepth+=V[V.length-1].depth}u.slashes=G,u.parts=K}return u};KH0.exports=M64});var zH0=_((Nh8,HH0)=>{var Qc=xC(),HG=vC(),{MAX_LENGTH:Yc,POSIX_REGEX_SOURCE:L64,REGEX_NON_SPECIAL_CHARS:O64,REGEX_SPECIAL_CHARS_BACKREF:A64,REPLACEMENTS:WH0}=Qc,I64=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Y=`[${J.join("-")}]`;try{new RegExp(Y)}catch(Z){return J.map((X)=>HG.escapeRegex(X)).join("..")}return Y},UO=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},FX1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=WH0[J]||J;let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Yc,Y.maxLength):Yc,X=J.length;if(X>Z)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Z}`);let G={type:"bos",value:"",output:Y.prepend||""},V=[G],K=Y.capture?"":"?:",q=Qc.globChars(Y.windows),W=Qc.extglobChars(q),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:F,ONE_CHAR:U,DOTS_SLASH:D,NO_DOT:B,NO_DOT_SLASH:N,NO_DOTS_SLASH:w,QMARK:M,QMARK_NO_DOT:L,STAR:O,START_ANCHOR:A}=q,I=(L1)=>{return`(${K}(?:(?!${A}${L1.dot?D:H}).)*?)`},P=Y.dot?"":B,C=Y.dot?M:L,y=Y.bash===!0?I(Y):O;if(Y.capture)y=`(${y})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let S={input:J,index:-1,start:0,dot:Y.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};J=HG.removePrefix(J,S),X=J.length;let x=[],c=[],m=[],v=G,b,u=()=>S.index===X-1,d=S.peek=(L1=1)=>J[S.index+L1],h=S.advance=()=>J[++S.index]||"",l=()=>J.slice(S.index+1),g=(L1="",r=0)=>{S.consumed+=L1,S.index+=r},V1=(L1)=>{S.output+=L1.output!=null?L1.output:L1.value,g(L1.value)},O1=()=>{let L1=1;while(d()==="!"&&(d(2)!=="("||d(3)==="?"))h(),S.start++,L1++;if(L1%2===0)return!1;return S.negated=!0,S.start++,!0},a=(L1)=>{S[L1]++,m.push(L1)},N1=(L1)=>{S[L1]--,m.pop()},M1=(L1)=>{if(v.type==="globstar"){let r=S.braces>0&&(L1.type==="comma"||L1.type==="brace"),Q1=L1.extglob===!0||x.length&&(L1.type==="pipe"||L1.type==="paren");if(L1.type!=="slash"&&L1.type!=="paren"&&!r&&!Q1)S.output=S.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=y,S.output+=v.output}if(x.length&&L1.type!=="paren")x[x.length-1].inner+=L1.value;if(L1.value||L1.output)V1(L1);if(v&&v.type==="text"&&L1.type==="text"){v.output=(v.output||v.value)+L1.value,v.value+=L1.value;return}L1.prev=v,V.push(L1),v=L1},S1=(L1,r)=>{let Q1={...W[r],conditions:1,inner:""};Q1.prev=v,Q1.parens=S.parens,Q1.output=S.output;let s=(Y.capture?"(":"")+Q1.open;a("parens"),M1({type:L1,value:r,output:S.output?"":U}),M1({type:"paren",extglob:!0,value:h(),output:s}),x.push(Q1)},B1=(L1)=>{let r=L1.close+(Y.capture?")":""),Q1;if(L1.type==="negate"){let s=y;if(L1.inner&&L1.inner.length>1&&L1.inner.includes("/"))s=I(Y);if(s!==y||u()||/^\)+$/.test(l()))r=L1.close=`)$))${s}`;if(L1.inner.includes("*")&&(Q1=l())&&/^\.[^\\/.]+$/.test(Q1)){let n=FX1(Q1,{...Q,fastpaths:!1}).output;r=L1.close=`)${n})${s})`}if(L1.prev.type==="bos")S.negatedExtglob=!0}M1({type:"paren",extglob:!0,value:b,output:r}),N1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let L1=!1,r=J.replace(A64,(Q1,s,n,Y1,J1,H1)=>{if(Y1==="\\")return L1=!0,Q1;if(Y1==="?"){if(s)return s+Y1+(J1?M.repeat(J1.length):"");if(H1===0)return C+(J1?M.repeat(J1.length):"");return M.repeat(n.length)}if(Y1===".")return H.repeat(n.length);if(Y1==="*"){if(s)return s+Y1+(J1?y:"");return y}return s?Q1:`\\${Q1}`});if(L1===!0)if(Y.unescape===!0)r=r.replace(/\\/g,"");else r=r.replace(/\\+/g,(Q1)=>{return Q1.length%2===0?"\\\\":Q1?"\\":""});if(r===J&&Y.contains===!0)return S.output=J,S;return S.output=HG.wrapOutput(r,S,Q),S}while(!u()){if(b=h(),b==="\x00")continue;if(b==="\\"){let Q1=d();if(Q1==="/"&&Y.bash!==!0)continue;if(Q1==="."||Q1===";")continue;if(!Q1){b+="\\",M1({type:"text",value:b});continue}let s=/^\\+/.exec(l()),n=0;if(s&&s[0].length>2){if(n=s[0].length,S.index+=n,n%2!==0)b+="\\"}if(Y.unescape===!0)b=h();else b+=h();if(S.brackets===0){M1({type:"text",value:b});continue}}if(S.brackets>0&&(b!=="]"||v.value==="["||v.value==="[^")){if(Y.posix!==!1&&b===":"){let Q1=v.value.slice(1);if(Q1.includes("[")){if(v.posix=!0,Q1.includes(":")){let s=v.value.lastIndexOf("["),n=v.value.slice(0,s),Y1=v.value.slice(s+2),J1=L64[Y1];if(J1){if(v.value=n+J1,S.backtrack=!0,h(),!G.output&&V.indexOf(v)===1)G.output=U;continue}}}}if(b==="["&&d()!==":"||b==="-"&&d()==="]")b=`\\${b}`;if(b==="]"&&(v.value==="["||v.value==="[^"))b=`\\${b}`;if(Y.posix===!0&&b==="!"&&v.value==="[")b="^";v.value+=b,V1({value:b});continue}if(S.quotes===1&&b!=='"'){b=HG.escapeRegex(b),v.value+=b,V1({value:b});continue}if(b==='"'){if(S.quotes=S.quotes===1?0:1,Y.keepQuotes===!0)M1({type:"text",value:b});continue}if(b==="("){a("parens"),M1({type:"paren",value:b});continue}if(b===")"){if(S.parens===0&&Y.strictBrackets===!0)throw SyntaxError(UO("opening","("));let Q1=x[x.length-1];if(Q1&&S.parens===Q1.parens+1){B1(x.pop());continue}M1({type:"paren",value:b,output:S.parens?")":"\\)"}),N1("parens");continue}if(b==="["){if(Y.nobracket===!0||!l().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(UO("closing","]"));b=`\\${b}`}else a("brackets");M1({type:"bracket",value:b});continue}if(b==="]"){if(Y.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){M1({type:"text",value:b,output:`\\${b}`});continue}if(S.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(UO("opening","["));M1({type:"text",value:b,output:`\\${b}`});continue}N1("brackets");let Q1=v.value.slice(1);if(v.posix!==!0&&Q1[0]==="^"&&!Q1.includes("/"))b=`/${b}`;if(v.value+=b,V1({value:b}),Y.literalBrackets===!1||HG.hasRegexChars(Q1))continue;let s=HG.escapeRegex(v.value);if(S.output=S.output.slice(0,-v.value.length),Y.literalBrackets===!0){S.output+=s,v.value=s;continue}v.value=`(${K}${s}|${v.value})`,S.output+=v.value;continue}if(b==="{"&&Y.nobrace!==!0){a("braces");let Q1={type:"brace",value:b,output:"(",outputIndex:S.output.length,tokensIndex:S.tokens.length};c.push(Q1),M1(Q1);continue}if(b==="}"){let Q1=c[c.length-1];if(Y.nobrace===!0||!Q1){M1({type:"text",value:b,output:b});continue}let s=")";if(Q1.dots===!0){let n=V.slice(),Y1=[];for(let J1=n.length-1;J1>=0;J1--){if(V.pop(),n[J1].type==="brace")break;if(n[J1].type!=="dots")Y1.unshift(n[J1].value)}s=I64(Y1,Y),S.backtrack=!0}if(Q1.comma!==!0&&Q1.dots!==!0){let n=S.output.slice(0,Q1.outputIndex),Y1=S.tokens.slice(Q1.tokensIndex);Q1.value=Q1.output="\\{",b=s="\\}",S.output=n;for(let J1 of Y1)S.output+=J1.output||J1.value}M1({type:"brace",value:b,output:s}),N1("braces"),c.pop();continue}if(b==="|"){if(x.length>0)x[x.length-1].conditions++;M1({type:"text",value:b});continue}if(b===","){let Q1=b,s=c[c.length-1];if(s&&m[m.length-1]==="braces")s.comma=!0,Q1="|";M1({type:"comma",value:b,output:Q1});continue}if(b==="/"){if(v.type==="dot"&&S.index===S.start+1){S.start=S.index+1,S.consumed="",S.output="",V.pop(),v=G;continue}M1({type:"slash",value:b,output:F});continue}if(b==="."){if(S.braces>0&&v.type==="dot"){if(v.value===".")v.output=H;let Q1=c[c.length-1];v.type="dots",v.output+=b,v.value+=b,Q1.dots=!0;continue}if(S.braces+S.parens===0&&v.type!=="bos"&&v.type!=="slash"){M1({type:"text",value:b,output:H});continue}M1({type:"dot",value:b,output:H});continue}if(b==="?"){if(!(v&&v.value==="(")&&Y.noextglob!==!0&&d()==="("&&d(2)!=="?"){S1("qmark",b);continue}if(v&&v.type==="paren"){let s=d(),n=b;if(v.value==="("&&!/[!=<:]/.test(s)||s==="<"&&!/<([!=]|\w+>)/.test(l()))n=`\\${b}`;M1({type:"text",value:b,output:n});continue}if(Y.dot!==!0&&(v.type==="slash"||v.type==="bos")){M1({type:"qmark",value:b,output:L});continue}M1({type:"qmark",value:b,output:M});continue}if(b==="!"){if(Y.noextglob!==!0&&d()==="("){if(d(2)!=="?"||!/[!=<:]/.test(d(3))){S1("negate",b);continue}}if(Y.nonegate!==!0&&S.index===0){O1();continue}}if(b==="+"){if(Y.noextglob!==!0&&d()==="("&&d(2)!=="?"){S1("plus",b);continue}if(v&&v.value==="("||Y.regex===!1){M1({type:"plus",value:b,output:z});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||S.parens>0){M1({type:"plus",value:b});continue}M1({type:"plus",value:z});continue}if(b==="@"){if(Y.noextglob!==!0&&d()==="("&&d(2)!=="?"){M1({type:"at",extglob:!0,value:b,output:""});continue}M1({type:"text",value:b});continue}if(b!=="*"){if(b==="$"||b==="^")b=`\\${b}`;let Q1=O64.exec(l());if(Q1)b+=Q1[0],S.index+=Q1[0].length;M1({type:"text",value:b});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=b,v.output=y,S.backtrack=!0,S.globstar=!0,g(b);continue}let L1=l();if(Y.noextglob!==!0&&/^\([^?]/.test(L1)){S1("star",b);continue}if(v.type==="star"){if(Y.noglobstar===!0){g(b);continue}let Q1=v.prev,s=Q1.prev,n=Q1.type==="slash"||Q1.type==="bos",Y1=s&&(s.type==="star"||s.type==="globstar");if(Y.bash===!0&&(!n||L1[0]&&L1[0]!=="/")){M1({type:"star",value:b,output:""});continue}let J1=S.braces>0&&(Q1.type==="comma"||Q1.type==="brace"),H1=x.length&&(Q1.type==="pipe"||Q1.type==="paren");if(!n&&Q1.type!=="paren"&&!J1&&!H1){M1({type:"star",value:b,output:""});continue}while(L1.slice(0,3)==="/**"){let D1=J[S.index+4];if(D1&&D1!=="/")break;L1=L1.slice(3),g("/**",3)}if(Q1.type==="bos"&&u()){v.type="globstar",v.value+=b,v.output=I(Y),S.output=v.output,S.globstar=!0,g(b);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&!Y1&&u()){S.output=S.output.slice(0,-(Q1.output+v.output).length),Q1.output=`(?:${Q1.output}`,v.type="globstar",v.output=I(Y)+(Y.strictSlashes?")":"|$)"),v.value+=b,S.globstar=!0,S.output+=Q1.output+v.output,g(b);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&L1[0]==="/"){let D1=L1[1]!==void 0?"|$":"";S.output=S.output.slice(0,-(Q1.output+v.output).length),Q1.output=`(?:${Q1.output}`,v.type="globstar",v.output=`${I(Y)}${F}|${F}${D1})`,v.value+=b,S.output+=Q1.output+v.output,S.globstar=!0,g(b+h()),M1({type:"slash",value:"/",output:""});continue}if(Q1.type==="bos"&&L1[0]==="/"){v.type="globstar",v.value+=b,v.output=`(?:^|${F}|${I(Y)}${F})`,S.output=v.output,S.globstar=!0,g(b+h()),M1({type:"slash",value:"/",output:""});continue}S.output=S.output.slice(0,-v.output.length),v.type="globstar",v.output=I(Y),v.value+=b,S.output+=v.output,S.globstar=!0,g(b);continue}let r={type:"star",value:b,output:y};if(Y.bash===!0){if(r.output=".*?",v.type==="bos"||v.type==="slash")r.output=P+r.output;M1(r);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&Y.regex===!0){r.output=b,M1(r);continue}if(S.index===S.start||v.type==="slash"||v.type==="dot"){if(v.type==="dot")S.output+=N,v.output+=N;else if(Y.dot===!0)S.output+=w,v.output+=w;else S.output+=P,v.output+=P;if(d()!=="*")S.output+=U,v.output+=U}M1(r)}while(S.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(UO("closing","]"));S.output=HG.escapeLast(S.output,"["),N1("brackets")}while(S.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(UO("closing",")"));S.output=HG.escapeLast(S.output,"("),N1("parens")}while(S.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(UO("closing","}"));S.output=HG.escapeLast(S.output,"{"),N1("braces")}if(Y.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket"))M1({type:"maybe_slash",value:"",output:`${F}?`});if(S.backtrack===!0){S.output="";for(let L1 of S.tokens)if(S.output+=L1.output!=null?L1.output:L1.value,L1.suffix)S.output+=L1.suffix}return S};FX1.fastpaths=(J,Q)=>{let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Yc,Y.maxLength):Yc,X=J.length;if(X>Z)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Z}`);J=WH0[J]||J;let{DOT_LITERAL:G,SLASH_LITERAL:V,ONE_CHAR:K,DOTS_SLASH:q,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:F,START_ANCHOR:U}=Qc.globChars(Y.windows),D=Y.dot?H:W,B=Y.dot?z:W,N=Y.capture?"":"?:",w={negated:!1,prefix:""},M=Y.bash===!0?".*?":F;if(Y.capture)M=`(${M})`;let L=(P)=>{if(P.noglobstar===!0)return M;return`(${N}(?:(?!${U}${P.dot?q:G}).)*?)`},O=(P)=>{switch(P){case"*":return`${D}${K}${M}`;case".*":return`${G}${K}${M}`;case"*.*":return`${D}${M}${G}${K}${M}`;case"*/*":return`${D}${M}${V}${K}${B}${M}`;case"**":return D+L(Y);case"**/*":return`(?:${D}${L(Y)}${V})?${B}${K}${M}`;case"**/*.*":return`(?:${D}${L(Y)}${V})?${B}${M}${G}${K}${M}`;case"**/.*":return`(?:${D}${L(Y)}${V})?${G}${K}${M}`;default:{let C=/^(.*?)\.(\w+)$/.exec(P);if(!C)return;let y=O(C[1]);if(!y)return;return y+G+C[2]}}},A=HG.removePrefix(J,w),I=O(A);if(I&&Y.strictSlashes!==!0)I+=`${V}?`;return I};HH0.exports=FX1});var fC=_((wh8,UH0)=>{var E64=qH0(),UX1=zH0(),FH0=vC(),R64=xC(),j64=(J)=>J&&typeof J==="object"&&!Array.isArray(J),T5=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((F)=>T5(F,Q,Y));return(F)=>{for(let U of H){let D=U(F);if(D)return D}return!1}}let Z=j64(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!Z)throw TypeError("Expected pattern to be a non-empty string");let X=Q||{},G=X.windows,V=Z?T5.compileRe(J,Q):T5.makeRe(J,Q,!1,!0),K=V.state;delete V.state;let q=()=>!1;if(X.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};q=T5(X.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:F,match:U,output:D}=T5.test(H,V,Q,{glob:J,posix:G}),B={glob:J,state:K,regex:V,posix:G,input:H,output:D,match:U,isMatch:F};if(typeof X.onResult==="function")X.onResult(B);if(F===!1)return B.isMatch=!1,z?B:!1;if(q(H)){if(typeof X.onIgnore==="function")X.onIgnore(B);return B.isMatch=!1,z?B:!1}if(typeof X.onMatch==="function")X.onMatch(B);return z?B:!0};if(Y)W.state=K;return W};T5.test=(J,Q,Y,{glob:Z,posix:X}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let G=Y||{},V=G.format||(X?FH0.toPosixSlashes:null),K=J===Z,q=K&&V?V(J):J;if(K===!1)q=V?V(J):J,K=q===Z;if(K===!1||G.capture===!0)if(G.matchBase===!0||G.basename===!0)K=T5.matchBase(J,Q,Y,X);else K=Q.exec(q);return{isMatch:Boolean(K),match:K,output:q}};T5.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:T5.makeRe(Q,Y)).test(FH0.basename(J))};T5.isMatch=(J,Q,Y)=>T5(Q,Y)(J);T5.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>T5.parse(Y,Q));return UX1(J,{...Q,fastpaths:!1})};T5.scan=(J,Q)=>E64(J,Q);T5.compileRe=(J,Q,Y=!1,Z=!1)=>{if(Y===!0)return J.output;let X=Q||{},G=X.contains?"":"^",V=X.contains?"":"$",K=`${G}(?:${J.output})${V}`;if(J&&J.negated===!0)K=`^(?!${K}).*$`;let q=T5.toRegex(K,Q);if(Z===!0)q.state=J;return q};T5.makeRe=(J,Q={},Y=!1,Z=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let X={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))X.output=UX1.fastpaths(J,Q);if(!X.output)X=UX1(J,Q);return T5.compileRe(X,Q,Y,Z)};T5.toRegex=(J,Q)=>{try{let Y=Q||{};return new RegExp(J,Y.flags||(Y.nocase?"i":""))}catch(Y){if(Q&&Q.debug===!0)throw Y;return/$^/}};T5.constants=R64;UH0.exports=T5});var EK=_((Mh8,NH0)=>{var DH0=fC(),P64=vC();function BH0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:P64.isWindows()};return DH0(J,Q,Y)}Object.assign(BH0,DH0);NH0.exports=BH0});var DO;var DX1=i(()=>{DO={name:"amp",description:"The frontier coding agent, with a highly capable `smart` mode and a fast `free` mode. ",private:!0,displayName:"Amp (Research Preview)",version:"0.0.0-dev",publisher:"sourcegraph",license:"Apache-2.0",categories:["AI","Chat","Programming Languages","Machine Learning"],keywords:["sourcegraph","amp","amp code","ampcode","ai","assistant","llm","Claude","Claude Sonnet 4.5","GPT-5","agent","free","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","dev:watch":"NODE_ENV=development bun run scripts/watch.ts","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","dev:desktop":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop","dev:desktop:insiders":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop:insiders","build:dev:desktop":"NODE_ENV=development bun run scripts/build.ts",build:"pnpm run -s _build:extension && pnpm run -s _build:web","build:production":"pnpm run -s _build:extension:production && pnpm run -s _build:web:production","_build:extension":"NODE_ENV=development bun run scripts/build.ts","_build:extension:production":"NODE_ENV=production bun run scripts/build.ts","_build:web":"pnpm -C ../web run build && cp -R ../web/build dist/web-build","_build:web:production":"pnpm -C ../web run build:production && cp -R ../web/build dist/web-build","build:icon-font":"npx -y svgtofont --sources ./icon-font/svg --output ./icon-font/build && cp ./icon-font/build/amp-icons.woff ./resources","dev:forks":"pnpm dev:vsix && cursor --install-extension dist/amp-dev.vsix --force && windsurf --install-extension dist/amp-dev.vsix --force","dev:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force","prod:vsix":"pnpm run -s build:production && vsce package --no-dependencies --pre-release --out dist/amp-prod.vsix && code --install-extension dist/amp-prod.vsix --force","prod:vsix:test-manual":"bun run scripts/vsix-test-manual.ts","prod:vsix:test-ci":"bun run scripts/vsix-test-ci.ts",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team",email:"amp-devs@ampcode.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.openAgents",title:"Open Agents",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.findInThread",title:"Find in Thread",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.collapseAllInThread",title:"Collapse All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandAllInThread",title:"Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandToggleInThread",title:"Toggle Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.toggleThreadSwitcher",title:"Switch to Thread...",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.toggleDetailedCostsDisplay",title:"Toggle Detailed Costs",category:"Amp",enablement:"amp.isSourcegraphTeammate"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode || amp.isSourcegraphTeammate"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active && amp.agent.activeViewType != 'amp.reviewPanel'"},{command:"amp.agent.toggleDetailedCostsDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"amp.agent.openAgents",key:"ctrl+alt+i",mac:"cmd+alt+i"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"(Deprecated) Use large mode instead. See https://ampcode.com/news/large-mode",scope:"window",default:!1,deprecationMessage:"This setting has been removed. Use large mode instead: set amp.experimental.agentMode to 'large'. See https://ampcode.com/news/large-mode"},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.fuzzy.alwaysIncludePaths":{type:"array",items:{type:"string"},default:[],markdownDescription:"Glob patterns for paths that should always be included in fuzzy file search, even if they are gitignored. Dotfiles and directories starting with `.` are supported.\n\nExamples:\n- `dist/**`\n- `node_modules/@myorg/**`\n- `.hidden/**`",scope:"window"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debug.logReview":{type:"boolean",default:!1,description:"Enable debug logging for review git operations",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent as a tool for use by the main agent in smart mode.",scope:"window"},"amp.experimental.finalToolCalls":{type:"boolean",default:!1,description:"Enable final tool calls - allows the agent to mark tool calls with __isFinal to prevent follow-up inference.",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"},"amp.showCosts":{type:"boolean",default:!0,description:"Show cost information for threads",scope:"application"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@google/genai":"catalog:","@opentelemetry/api":"catalog:","@opentelemetry/api-logs":"catalog:","@opentelemetry/core":"catalog:","@opentelemetry/exporter-logs-otlp-http":"catalog:","@opentelemetry/exporter-metrics-otlp-http":"catalog:","@opentelemetry/exporter-trace-otlp-http":"catalog:","@opentelemetry/resources":"catalog:","@opentelemetry/sdk-logs":"catalog:","@opentelemetry/sdk-metrics":"catalog:","@opentelemetry/sdk-node":"catalog:","@opentelemetry/sdk-trace-base":"catalog:","@opentelemetry/sdk-trace-node":"catalog:","@opentelemetry/semantic-conventions":"catalog:","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","eventsource-parser":"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"catalog:","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3",zod:"catalog:"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function C64(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function MH0(J){let Q=J.settings["tools.inactivityTimeout"],Y=J.settings["tools.stopTimeout"],Z=Q;if(Z===void 0&&Y!==void 0)Z=Y;if(Z===void 0)Z=DO.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!C64(Z))return null;return Z*1000}function LH0(J){let Q=J.settings["tools.stopTimeout"],Y=DO.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var wH0;var Zc=i(()=>{DX1();wH0=DO.contributes.configuration.properties});function $5(J){let Q=N4[J];return`${Q.provider}/${Q.name}`}function Xc(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);return{provider:J.slice(0,Q),model:J.slice(Q+1)}}function k7(J){let{provider:Q,model:Y}=Xc(J);for(let Z of Object.values(N4))if(Z.provider===Q&&Z.name===Y)return Z;switch(Q){case"anthropic":return N4.CLAUDE_SONNET_4_5;case"openai":return N4.GPT_5;case"xai":return N4.GROK_CODE_FAST_1;case"cerebras":return N4.Z_AI_GLM_4_7;case"fireworks":return N4.FIREWORKS_GLM_4P6;case"moonshotai":return N4.KIMI_K2_INSTRUCT;case"openrouter":return N4.SONOMA_SKY_ALPHA;case"groq":return N4.GPT_OSS_120B;case"vertexai":return N4.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Q}`)}}function b9(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function DQ(J){let Q=k7(J);return Q.contextWindow-Q.maxOutputTokens}var R4,N4,BX1;var y7=i(()=>{R4={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},N4={CLAUDE_SONNET_4:{provider:R4.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:R4.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:R4.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:R4.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:R4.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,pricing:{input:5,output:25,cached:0.5,cacheWrite:6.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:R4.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,pricing:{input:1,output:5,cached:0.1,cacheWrite:1.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5:{provider:R4.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:R4.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_2:{provider:R4.OPENAI,name:"gpt-5.2",displayName:"GPT-5.2",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.75,output:14,cached:0.175},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:R4.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:R4.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:R4.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:R4.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:R4.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:R4.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:R4.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:R4.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GEMINI_2_5_PRO:{provider:R4.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:R4.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_LITE:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_3_PRO_PREVIEW:{provider:R4.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI3_FLASH_PREVIEW:{provider:R4.VERTEXAI,name:"gemini-3-flash-preview",displayName:"Gemini 3 Flash Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_3_PRO_IMAGE:{provider:R4.VERTEXAI,name:"gemini-3-pro-image-preview",displayName:"Gemini 3 Pro Image",contextWindow:1048576,maxOutputTokens:65535,capabilities:{vision:!0,imageGeneration:!0}},GEMINI_2_5_FLASH_IMAGE:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-image",displayName:"Gemini 2.5 Flash Image",contextWindow:1048576,maxOutputTokens:65535,capabilities:{vision:!0,imageGeneration:!0}},Z_AI_GLM_4_7:{provider:R4.CEREBRAS,name:"zai-glm-4.7",displayName:"Z.ai GLM 4.7",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:R4.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:R4.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:R4.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:R4.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:R4.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:R4.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};BX1={FINDER:"finder"}});function NX1(J,Q){let Y=IX(Q);if(!Y)return!1;if(_64.has(J)){let Z=Y.finder??BX1.FINDER,X=S64[Z];if(J!==X)return!1}if(Y.includeTools){if(Y.deferredTools?.includes(J))return!0;return Y.includeTools.includes(J)}return!0}function wX1(J,Q){let Y=IX(Q);if(!Y)return!1;return Y.deferredTools?.includes(J)??!1}function dY(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(BO).filter((Z)=>{if(Y.includes(`!${Z.key}`))return!1;if(Q===!1&&I9(Z.key))return!1;let G="visible"in Z?Z.visible:!1,V=Y.includes(Z.key);return G||V}).map((Z)=>({mode:Z.key,description:"description"in Z?Z.description:void 0})).sort((Z,X)=>Z.mode.localeCompare(X.mode))}function IX(J){return Object.values(BO).find((Q)=>Q.key===J)}function YH(J){return IX(J)?.primaryModel??$5("CLAUDE_SONNET_4_5")}function hC(J){let Q=IX(J);if(!Q)return!1;return k7(Q.primaryModel).capabilities?.vision??!1}function I9(J){return J==="free"||J.startsWith("free-")}function MX1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function LX1(J,Q){let Z=(Q.findIndex((G)=>G.mode===J)+1)%Q.length;return Q[Z]?.mode??"smart"}var _64,S64,IH0,EH0,k64,y64,OH0,AH0,BO,x64;var EX=i(()=>{y7();_64=new Set(["finder"]),S64={finder:"finder"},IH0={r:0,g:55,b:0},EH0={r:0,g:255,b:136},k64=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","task_list","todo_read","todo_write","read_thread","find_thread","mermaid","skill"],y64=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","find_thread","skill","oracle","librarian","Task","task_list","kraken","look_at","Check","illustrator"],OH0=["Read","finder","Bash","repl","create_file","edit_file","undo_edit","web_search","read_web_page","task_list","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","kraken","Task","Grep","glob","read_mcp_resource","mermaid","look_at","format_file","get_diagnostics","handoff","Check","illustrator"],AH0=["code_review","walkthrough","walkthrough_diagram"],BO={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:$5("CLAUDE_OPUS_4_5"),includeTools:OH0,deferredTools:AH0,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:$5("CLAUDE_HAIKU_4_5"),includeTools:k64,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:$5("CLAUDE_HAIKU_4_5"),includeTools:y64,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},LARGE:{key:"large",displayName:"Large",description:"The biggest context window possible (Sonnet 4.5 1M tokens), for large tasks",primaryModel:$5("CLAUDE_SONNET_4_5"),includeTools:OH0,deferredTools:AH0,visible:!1,uiHints:{labelAnimation:"glow",primaryColor:{r:42,g:26,b:77},secondaryColor:{r:153,g:102,b:255}}}},x64=Object.values(BO).map((J)=>J.key)});function $c(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let Z="subagentType"in Q?Q.subagentType:void 0;if(Z&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(Z)}return!0}return Q.includeTools.includes(J)}var v64,b64,OX1,f64,h64,g64,m64,AX1,G5,Ph8;var RX=i(()=>{y7();v64=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],b64=["Grep","glob","Read"],OX1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],f64=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder","skill","task_list"],h64=["Read","glob","Grep","enqueue_file_edit","fastmod"],g64=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],m64=["Read","Grep","glob","web_search","read_web_page","Bash"],AX1=["Read","Grep","glob","finder"],G5={finder:{key:"finder",displayName:"Finder",model:$5("CLAUDE_HAIKU_4_5"),includeTools:b64,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:$5("GPT_5_2"),includeTools:OX1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:$5("CLAUDE_HAIKU_4_5"),includeTools:v64,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:f64,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:$5("CLAUDE_HAIKU_4_5"),includeTools:h64,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:$5("CLAUDE_HAIKU_4_5"),includeTools:g64,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},"code-review":{key:"code-review",displayName:"Code Review",model:$5("CLAUDE_SONNET_4_5"),includeTools:m64,allowMcp:!1,allowToolbox:!1}},Ph8=Object.keys(G5)});function RH0(J,Q){return new P1((Y)=>{let Z=setTimeout(X,Q);function X(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function G(){if(Z)clearTimeout(Z);Z=setTimeout(X,Q)}let V=J.subscribe({next:(K)=>{G(),Y.next(K)},error:(K)=>{if(Z)clearTimeout(Z),Z=null;Y.error(K)},complete:()=>{if(Z)clearTimeout(Z),Z=null;Y.complete()}});return()=>{if(Z)clearTimeout(Z),Z=null;V.unsubscribe()}})}var jH0=i(()=>{G0()});function PH0(J){return{tool:J,action:"allow"}}var NO;var Gc=i(()=>{j6();NO=[{tool:"Bash",action:"ask",matches:{cmd:"*git*push*"}},{tool:"mcp__*",action:"allow"},{tool:cd,action:"allow"},{tool:"tb__*",action:"allow"},{tool:"Bash",matches:{cmd:"/^(.*\\s+)?(bazel|ibazel)\\s+.*\\/\\/[^\\s]*.*$/"},action:"allow"},{tool:"Bash",matches:{cmd:["ls","ls *","dir","dir *","cat *","head *","tail *","less *","more *","grep *","egrep *","fgrep *","tree","tree *","file *","wc *","pwd","stat *","du *","df *","ps *","top","htop","echo *","printenv *","id","which *","whereis *","date","cal *","uptime","free *","ping *","dig *","nslookup *","host *","netstat *","ss *","lsof *","ifconfig *","ip *","man *","info *","mkdir *","touch *","uname *","whoami","go version","go env *","go help *","cargo version","cargo --version","cargo help *","rustc --version","rustc --help","rustc --explain *","javac --version","javac -version","javac -help","javac --help","dotnet --info","dotnet --version","dotnet --help","dotnet help *","gcc --version","gcc -v","gcc --help","gcc -dumpversion","g++ --version","g++ -v","g++ --help","g++ -dumpversion","clang --version","clang --help","clang++ --version","clang++ --help","python -V","python --version","python -h","python --help","python3 -V","python3 --version","python3 -h","python3 --help","ruby -v","ruby --version","ruby -h","ruby --help","node -v","node --version","node -h","node --help","npm --help","npm --version","npm -v","npm help *","yarn --help","yarn --version","yarn -v","yarn help *","pnpm --help","pnpm --version","pnpm -v","pnpm help *","pytest -h","pytest --help","pytest --version","jest --help","jest --version","mocha --help","mocha --version","make --version","make --help","docker --version","docker --help","docker version","docker help *","git --version","git --help","git help *","git version"]},action:"allow"},{tool:"Bash",matches:{cmd:["go test *","go run *","go build *","go vet *","go fmt *","go list *","cargo test *","cargo run *","cargo build *","cargo check *","cargo fmt *","cargo tree *","make -n *","make --dry-run *","mvn test *","mvn verify *","mvn dependency:tree *","gradle tasks *","gradle dependencies *","gradle properties *","dotnet test *","dotnet list *","python -c *","ruby -e *","node -e *","npm list *","npm ls *","npm outdated *","npm test*","npm run*","npm view *","npm info *","yarn list*","yarn ls *","yarn info *","yarn test*","yarn run *","yarn why *","pnpm list*","pnpm ls *","pnpm outdated *","pnpm test*","pnpm run *","pytest --collect-only *","jest --listTests *","jest --showConfig *","mocha --list *","git status*","git show *","git diff*","git grep *","git branch *","git tag *","git remote -v *","git rev-parse --is-inside-work-tree *","git rev-parse --show-toplevel *","git config --list *","git log *"]},action:"allow"},{tool:"Bash",matches:{cmd:["./gradlew *","./mvnw *","./build.sh *","./configure *","cmake *","./node_modules/.bin/tsc *","./node_modules/.bin/eslint *","./node_modules/.bin/prettier *","prettier *","./node_modules/.bin/tailwindcss *","./node_modules/.bin/tsx *","./node_modules/.bin/vite *","bun *","tsx *","vite *"]},action:"allow"},{tool:"Bash",matches:{cmd:[".venv/bin/activate *",".venv/Scripts/activate *","source .venv/bin/activate *","source venv/bin/activate *","pip list *","pip show *","pip check *","pip freeze *","uv *","poetry show *","poetry check *","pipenv check *"]},action:"allow"},{tool:"Bash",matches:{cmd:["asdf list *","asdf current *","asdf which *","mise list *","mise current *","mise which *","mise use *","rbenv version *","rbenv versions *","rbenv which *","nvm list *","nvm current *","nvm which *"]},action:"allow"},{tool:"Bash",matches:{cmd:["./test*","./run_tests.sh *","./run_*_tests.sh *","vitest *","bundle exec rspec *","bundle exec rubocop *","rspec *","rubocop *","swiftlint *","clippy *","ruff *","black *","isort *","mypy *","flake8 *","bandit *","safety *","biome check *","biome format *"]},action:"allow"},{tool:"Bash",matches:{cmd:["rails server *","rails s *","bin/rails server *","bin/rails s *","flask run *","django-admin runserver *","python manage.py runserver *","uvicorn *","streamlit run *"]},action:"allow"},{tool:"Bash",matches:{cmd:["bin/rails db:status","bin/rails db:version","rails db:rollback *","rails db:status *","rails db:version *","alembic current *","alembic history *","bundle exec rails db:status","bundle exec rails db:version"]},action:"allow"},{tool:"Bash",matches:{cmd:["docker ps *","docker images *","docker logs *","docker inspect *","docker info *","docker stats *","docker system df *","docker system info *","podman ps *","podman images *","podman logs *","podman inspect *","podman info *"]},action:"allow"},{tool:"Bash",matches:{cmd:["aws --version *","aws configure list *","aws sts get-caller-identity *","aws s3 ls *","gcloud config list *","gcloud auth list *","gcloud projects list *","az account list *","az account show *","kubectl get *","kubectl describe *","kubectl logs *","kubectl version *","helm list *","helm status *","helm version *"]},action:"allow"},{tool:"Bash",matches:{cmd:["swift build *","swift test *","zig build *","zig build test*","kotlinc *","scalac *","javac *","javap *","clang *","jar *","sbt *","gradle *","bazel build *","bazel test *","bazel run *","mix *","lua *","ruby *","php *"]},action:"allow"},{tool:"Bash",matches:{cmd:["mkdir -p *","chmod +x *","dos2unix *","unix2dos *","ln -s *"]},action:"allow"},{tool:"Bash",matches:{cmd:["for *","while *","do *","done *","if *","then *","else *","elif *","fi *","case *","esac *","in *","function *","select *","until *","{ *","} *","[[ *","]] *"]},action:"ask"},{tool:"Bash",matches:{cmd:"/^find(?!.*(-delete|-exec|-execdir)).*$/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^(echo|ls|pwd|date|whoami|id|uname)\\s.*[&|;].*\\s*(echo|ls|pwd|date|whoami|id|uname)($|\\s.*)/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^(cat|grep|head|tail|less|more|find)\\s.*\\|\\s*(grep|head|tail|less|more|wc|sort|uniq)($|\\s.*)/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^rm\\s+.*(-[rf].*-[rf]|-[rf]{2,}|--recursive.*--force|--force.*--recursive).*$/"},action:"ask"},{tool:"Bash",matches:{cmd:"/^find.*(-delete|-exec|-execdir).*$/"},action:"ask"},{tool:"Bash",matches:{cmd:"/^(ls|cat|grep|head|tail|file|stat)\\s+[^/]*$/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^(?!.*(rm|mv|cp|chmod|chown|sudo|su|dd)\\b).*/dev/(null|zero|stdout|stderr|stdin).*$/"},action:"allow"},{tool:"Bash",matches:{cmd:"/(^|\\s)(\\/(?!dev\\/(null|zero|stdout|stderr|stdin))[^\\s]*|\\.\\.\\/)(?![^\\s]*\\.(log|txt|md|json|yml|yaml)$)/"},action:"ask"},{tool:"Bash",action:"ask"},PH0("Glob"),...sW0.map(PH0)]});var r0=i(()=>{OC();Ed();$O()});function RX1(J){let Q=J;if(Q.startsWith("~/")){let Y=process.env.HOME||process.env.USERPROFILE||"";Q=Q.replace("~/",`${Y}/`)}else if(Q==="~")Q=process.env.HOME||process.env.USERPROFILE||"";if(Q=Q.replace(/%([^%]+)%/g,(Y,Z)=>{return process.env[Z]||`%${Z}%`}),Q.includes("%USERPROFILE%")&&process.env.USERPROFILE)Q=Q.replace(/%USERPROFILE%/g,process.env.USERPROFILE);return Q0.file(Q)}function IX1(J,Q){let Y=RX1(Q);if(Y.path.includes("*")){let Z=J.toString(),X=Y.path;if(!X.startsWith("file://")){if(!X.startsWith("/"))X=`/${X}`;X=`file://${X}`}let G=X.replace(/\./g,"\\.").replace(/\*\*/g,"§DOUBLESTAR§").replace(/\*/g,"[^/]*").replace(/§DOUBLESTAR§/g,".*");return new RegExp(`^${G}$`).test(Z)}else return Y.toString()===J.toString()}function TH0(J,Q){return Q.some((Y)=>IX1(J,Y))}async function u64(J,Q,Y){try{let Z=await Q.realpath(J).catch(()=>J),G=[...["~/.config/AGENT.md"],...Y];for(let V of G)if(IX1(Z,V)||IX1(J,V))return null;for(let{key:V,pattern:K}of EX1)if(TH0(Z,K.patterns)||TH0(J,K.patterns))return{key:V,pattern:K};return null}catch{return null}}async function Vc(J,Q,Y){if(Y?.dangerouslyAllowAll??!1)return{requiresConsent:!1};try{let X=await u64(J,Q,Y["guardedFiles.allowlist"]??[]);if(X)return{requiresConsent:!0,reason:`${X.pattern.description}`,toAllow:J.fsPath};return{requiresConsent:!1}}catch{return{requiresConsent:!0,reason:"Unable to resolve file path",toAllow:J.fsPath}}}var EX1;var gC=i(()=>{r0();EX1=[{key:"vscode-user-settings",pattern:{description:"VS Code User Settings",patterns:["~/Library/Application Support/Code/User/settings.json","~/.config/Code/User/settings.json","%APPDATA%/Code/User/settings.json"]}},{key:"vscode-workspace-settings",pattern:{description:"VS Code Workspace Settings",patterns:["**/.vscode/settings.json"]}},{key:"vscode-extensions",pattern:{description:"VS Code Extensions Configuration",patterns:["**/.vscode/extensions.json"]}},{key:"amp-settings",pattern:{description:"Amp Configuration Files",patterns:["**/amp.json","**/.amp/**"]}},{key:"shell-configs",pattern:{description:"Shell Configuration Files",patterns:["~/.bashrc","~/.zshrc","~/.fishrc","~/.cshrc","~/.tcshrc"]}},{key:"ssh-keys",pattern:{description:"SSH Keys and Configuration",patterns:["**/.ssh/**","~/.ssh/**"]}},{key:"gnupg-keys",pattern:{description:"GnuPG Keys and Configuration",patterns:["**/.gnupg/**","~/.gnupg/**"]}},{key:"environment-files",pattern:{description:"Environment Variable Files",patterns:["**/.env","**/.env.*"]}},{key:"claude-config",pattern:{description:"Claude AI Configuration",patterns:["**/.claude/**","~/.claude/**"]}},{key:"git-internals",pattern:{description:"Git Internal Files",patterns:["**/.git/**"]}},{key:"kubernetes-config",pattern:{description:"Kubernetes Configuration",patterns:["**/.kube/**","~/.kube/**"]}},{key:"cache-directories",pattern:{description:"Cache Directories",patterns:["**/.cache/**","~/.cache/**"]}},{key:"windows-appdata",pattern:{description:"Windows Application Data",patterns:["%APPDATA%/**"]}},{key:"sqlite3-files",pattern:{description:"SQLite Database Files",patterns:["**/*.db","**/*.sqlite","**/*.sqlite3"]}},{key:"common-configuration-patterns",pattern:{description:"Configuration Directories",patterns:["~/.*","~/.*/**","~/.config/**","~/Library/**","~/Libary/Preferences/**"]}}]});function p64(){if(nD.size===0)return;R.info("Killing all child processes");for(let J of nD)CH0(J);nD.clear(),R.info("All child processes killed")}function CH0(J){if(!J.pid){try{J.kill("SIGKILL")}catch(Q){R.error("Failed to kill process without PID",Q)}return}if(mC.has(J.pid)){R.debug(`Process ${J.pid} already being killed, skipping`);return}mC.add(J.pid);try{if(process.platform==="win32"){let{spawn:Q}=w1("node:child_process"),Y=Q("taskkill",["/F","/T","/PID",J.pid.toString()],{stdio:"ignore"});Y.on("error",(Z)=>{R.error(`Failed to kill Windows process tree ${J.pid}`,Z);try{J.kill("SIGKILL")}catch(X){R.error(`Fallback kill also failed for ${J.pid}`,X)}}),Y.on("exit",()=>{mC.delete(J.pid)})}else{try{process.kill(J.pid,0),process.kill(-J.pid,"SIGKILL")}catch(Q){R.debug(`Process ${J.pid} no longer exists, skipping kill`)}mC.delete(J.pid)}}catch(Q){R.error(`Failed to kill process ${J.pid}`,Q),mC.delete(J.pid)}}function zG(...J){return new P1((Q)=>{let Y=!1,Z,X=!1;return(async()=>{try{let{spawn:V}=await import("node:child_process");if(Y)return;let K={...J[2],detached:process.platform!=="win32",env:{...process.env,...J[2]?.env||{},NONINTERACTIVE:"1",DEBIAN_FRONTEND:"noninteractive"}};if(!K.stdio)K.stdio=["pipe","pipe","pipe"];Z=V(J[0],J[1],K),nD.add(Z);let q={stdout:"",stderr:"",combinedOutput:"",exitCode:null,exited:!1,pid:Z.pid};Z.on("spawn",()=>{Q.next({...q,process:Z})}),Z.stdout?.on("data",(W)=>{if(Y)return;let H=W.toString();q.stdout+=H,q.combinedOutput+=H,q.lastData=W,Q.next({...q,process:Z})}),Z.stderr?.on("data",(W)=>{if(Y)return;let H=W.toString();q.stderr+=H,q.combinedOutput+=H,q.lastData=W,Q.next({...q,process:Z})}),Z.on("exit",(W)=>{if(Y)return;if(X)return;if(X=!0,q.exitCode=W??-1,q.exited=!0,q.lastData=void 0,Q.next({...q,process:Z}),Q.complete(),Z)nD.delete(Z)}),Z.on("error",(W)=>{if(Y)return;if(Q.error(W),Z)nD.delete(Z)})}catch(V){if(Y)return;Q.error(V)}})(),()=>{if(Y=!0,Z&&!X)CH0(Z),nD.delete(Z)}})}function Kc(J){if(typeof J!=="string")throw Error("arg is not a string");if(J.startsWith("-"))throw Error("arg is not safe")}function wO(J){if(!J)throw Error("tool requires a working directory");if(J.scheme!=="file"&&J.scheme!=="vscode-vfs")throw Error(`tool requires a dir with a file: URI (got ${JSON.stringify(J.scheme)})`)}var nD,mC;var FG=i(()=>{G0();v1();nD=new Set,mC=new Set;if(typeof process<"u")process.on("exit",()=>{p64()})});function pC(J,Q){if(Q==="")return!1;let Y=J.toLowerCase(),Z=Q.toLowerCase();if(Z.length===1){if(Z==="*")return!0;return Z===Y}if(Y===Z)return!0;if(Z.includes("*")||Z.includes("?")||Z.includes("[")||Z.includes("{"))try{return _H0.default(Z,{dot:!0})(Y)}catch(X){return!1}return!1}function jX1(J,Q){let Y=Q.split("."),Z=J;for(let X of Y){if(Z===null||Z===void 0)return;if(Array.isArray(Z)){let G=parseInt(X,10);if(isNaN(G)||G<0||G>=Z.length)return;Z=Z[G]}else if(typeof Z==="object")Z=Z[X];else return}return Z}function d64(J,Q,Y,Z){if(!pC(Q,J.tool))return!1;if(J.context&&J.context!==Z)return!1;if(!J.matches||Object.keys(J.matches).length===0)return!0;return Object.entries(J.matches).every(([X,G])=>{if(G===void 0){if(X.includes("."))return jX1(Y,X)===void 0;return X in Y&&Y[X]===void 0}let V=X.includes(".")?jX1(Y,X):Y[X];return qc(V,G)})}async function c64(J,Q,Y,Z,X,G){if(J.action!=="delegate"){if(J.action==="reject"&&J.message)return{action:J.action,matchedEntry:J,error:J.message};return{action:J.action,matchedEntry:J}}if(!Y||!J.to)return{action:null,matchedEntry:J,error:"No spawn function provided"};try{let V=await l64(J.to,Q,Y,Z,X,G);return i64(V,J)}catch(V){return{action:"reject",error:V instanceof Error?V.message:"Unknown error",matchedEntry:J}}}async function l64(J,Q,Y,Z,X,G){let V={AGENT:"amp"};if(Z)V.AMP_THREAD_ID=Z;if(X)V.AGENT_TOOL_NAME=X;if(G)V.AGENT_TOOL_USE_ID=G;let q=J.includes("~")||J.includes("%")?RX1(J).path:J,H=Y(q,[],{env:V});return new Promise((z,F)=>{let U;H.subscribe({next:(D)=>{if(typeof D==="object"&&D!==null&&"status"in D&&D.status==="error"){F(Error("Delegate command timed out after 10 seconds"));return}if(D.process&&!D.exited)D.process.stdin?.write(JSON.stringify(Q)),D.process.stdin?.end();U=D},complete:()=>{if(U?.exited)z({exitCode:U.exitCode??-1,stdout:U.stdout,stderr:U.stderr});else F(Error("Process did not exit properly"))},error:(D)=>{F(D)}})})}function i64({exitCode:J,stderr:Q},Y){switch(J){case 0:return{action:"allow",matchedEntry:Y};case 1:return{action:"ask",matchedEntry:Y};default:return{action:"reject",matchedEntry:Y,error:Q}}}async function MO(J,Q,Y,Z,X,G,V,K){let q=0;for(let W of Y)try{if(!d64(W,J,Q,Z)){q=q+1;continue}let H=await c64(W,Q,X,G,J,K);if(H.matchIndex=q,V)H.source=V;return H}catch(H){return{action:null,error:H instanceof Error?H.message:"Unknown error"}}return{action:null}}function qc(J,Q){if(typeof Q==="string"){if(typeof J!=="string")return!1;return a64(J,Q)}if(Array.isArray(Q))return Q.some((Y)=>{if(typeof Y==="string")return typeof J==="string"&&PX1(J,Y);return J===Y});if(typeof Q==="object"&&Q!==null)return n64(J,Q);return J===Q}function n64(J,Q){if(Object.keys(Q).length===0)return typeof J==="object"&&J!==null;if(typeof J!=="object"||J===null)return!1;for(let[Y,Z]of Object.entries(Q)){let X=jX1(J,Y);if(!qc(X,Z))return!1}return!0}function a64(J,Q){if(typeof Q==="string")return PX1(J,Q);if(Array.isArray(Q))return Q.some((Y)=>typeof Y==="string"&&PX1(J,Y));return!1}function PX1(J,Q){if(Q.length>=3&&Q.startsWith("/")&&Q.endsWith("/"))try{let X=Q.slice(1,-1);return new RegExp(X,"m").test(J)}catch(X){throw Error(`Invalid regex pattern: ${Q}`)}if(Q==="*")return!0;if(!Q.includes("*"))return J===Q;let Y=Q.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${Y}$`,"m").test(J)}var _H0,uC;var LO=i(()=>{gC();FG();_H0=H0(EK(),1),uC=zG});class SH0{input;position=0;line=1;column=1;tokens=[];constructor(J){this.input=J}current(){return this.position<this.input.length?this.input[this.position]:""}peek(){return this.position+1<this.input.length?this.input[this.position+1]:""}advance(){let J=this.current();if(this.position++,J===`
|
|
47
|
+
`}}HK0.PrometheusSerializer=WK0});var DK0=_((FK0)=>{Object.defineProperty(FK0,"__esModule",{value:!0});FK0.PrometheusExporter=void 0;var UC=d0(),gt6=a6(),KZ1=GD(),mt6=w1("http"),ut6=VZ1(),pt6=w1("url");class wK extends KZ1.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0,withoutTargetInfo:!1};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(J={},Q=()=>{}){super({aggregationSelector:(X)=>{return{type:KZ1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(X)=>KZ1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||wK.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||wK.DEFAULT_OPTIONS.port,this._prefix=J.prefix||wK.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:wK.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||wK.DEFAULT_OPTIONS.withResourceConstantLabels,Z=J.withoutTargetInfo||wK.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,mt6.createServer)(this._requestHandler).unref(),this._serializer=new ut6.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,Z),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||wK.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(X)=>{UC.diag.error(X),Q(X)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return UC.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)UC.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,gt6.globalErrorHandler)(Q);J()})})}startServer(){return this._startServerPromise??=new Promise((J,Q)=>{this._server.once("error",Q),this._server.listen({port:this._port,host:this._host},()=>{UC.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),J()})}),this._startServerPromise}getMetricsRequestHandler(J,Q){this._exportMetrics(Q)}_requestHandler=(J,Q)=>{if(J.url!=null&&new pt6.URL(J.url,this._baseUrl).pathname===this._endpoint)this._exportMetrics(Q);else this._notFound(Q)};_exportMetrics=(J)=>{J.statusCode=200,J.setHeader("content-type","text/plain"),this.collect().then((Q)=>{let{resourceMetrics:Y,errors:Z}=Q;if(Z.length)UC.diag.error("PrometheusExporter: metrics collection errors",...Z);J.end(this._serializer.serialize(Y))},(Q)=>{J.end(`# failed to export metrics: ${Q}`)})};_notFound=(J)=>{J.statusCode=404,J.end()}}FK0.PrometheusExporter=wK});var BK0=_((Hd)=>{Object.defineProperty(Hd,"__esModule",{value:!0});Hd.PrometheusSerializer=Hd.PrometheusExporter=void 0;var dt6=DK0();Object.defineProperty(Hd,"PrometheusExporter",{enumerable:!0,get:function(){return dt6.PrometheusExporter}});var ct6=VZ1();Object.defineProperty(Hd,"PrometheusSerializer",{enumerable:!0,get:function(){return ct6.PrometheusSerializer}})});var OK0=_((MK0)=>{Object.defineProperty(MK0,"__esModule",{value:!0});MK0.OTLPTraceExporter=void 0;var it6=p$(),nt6=HX(),NK0=KK();class wK0 extends it6.OTLPExporterBase{constructor(J={}){super((0,NK0.createOtlpHttpExportDelegate)((0,NK0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),nt6.ProtobufTraceSerializer))}}MK0.OTLPTraceExporter=wK0});var AK0=_((qZ1)=>{Object.defineProperty(qZ1,"__esModule",{value:!0});qZ1.OTLPTraceExporter=void 0;var at6=OK0();Object.defineProperty(qZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return at6.OTLPTraceExporter}})});var IK0=_((WZ1)=>{Object.defineProperty(WZ1,"__esModule",{value:!0});WZ1.OTLPTraceExporter=void 0;var rt6=AK0();Object.defineProperty(WZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return rt6.OTLPTraceExporter}})});var EK0=_((HZ1)=>{Object.defineProperty(HZ1,"__esModule",{value:!0});HZ1.OTLPTraceExporter=void 0;var tt6=IK0();Object.defineProperty(HZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return tt6.OTLPTraceExporter}})});var CK0=_((PK0)=>{Object.defineProperty(PK0,"__esModule",{value:!0});PK0.OTLPTraceExporter=void 0;var Je6=p$(),Qe6=HX(),RK0=KK();class jK0 extends Je6.OTLPExporterBase{constructor(J={}){super((0,RK0.createOtlpHttpExportDelegate)((0,RK0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),Qe6.JsonTraceSerializer))}}PK0.OTLPTraceExporter=jK0});var _K0=_((zZ1)=>{Object.defineProperty(zZ1,"__esModule",{value:!0});zZ1.OTLPTraceExporter=void 0;var Ye6=CK0();Object.defineProperty(zZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return Ye6.OTLPTraceExporter}})});var SK0=_((FZ1)=>{Object.defineProperty(FZ1,"__esModule",{value:!0});FZ1.OTLPTraceExporter=void 0;var Xe6=_K0();Object.defineProperty(FZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return Xe6.OTLPTraceExporter}})});var kK0=_((UZ1)=>{Object.defineProperty(UZ1,"__esModule",{value:!0});UZ1.OTLPTraceExporter=void 0;var Ge6=SK0();Object.defineProperty(UZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return Ge6.OTLPTraceExporter}})});var fK0=_((vK0)=>{Object.defineProperty(vK0,"__esModule",{value:!0});vK0.OTLPTraceExporter=void 0;var yK0=$d(),Ke6=HX(),qe6=p$();class xK0 extends qe6.OTLPExporterBase{constructor(J={}){super((0,yK0.createOtlpGrpcExportDelegate)((0,yK0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),Ke6.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}vK0.OTLPTraceExporter=xK0});var hK0=_((DZ1)=>{Object.defineProperty(DZ1,"__esModule",{value:!0});DZ1.OTLPTraceExporter=void 0;var We6=fK0();Object.defineProperty(DZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return We6.OTLPTraceExporter}})});var uK0=_((gK0)=>{Object.defineProperty(gK0,"__esModule",{value:!0});gK0.prepareSend=void 0;var BZ1=d0(),zd=a6(),ze6=w1("http"),Fe6=w1("https");function Ue6(J,Q){let Y=new URL(J),Z=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...Q}});return function(G,V){if(G.length===0)return BZ1.diag.debug("Zipkin send with empty spans"),V({code:zd.ExportResultCode.SUCCESS});let{request:K}=Y.protocol==="http:"?ze6:Fe6,q=K(Y,Z,(H)=>{let z="";H.on("data",(F)=>{z+=F}),H.on("end",()=>{let F=H.statusCode||0;if(BZ1.diag.debug(`Zipkin response status code: ${F}, body: ${z}`),F<400)return V({code:zd.ExportResultCode.SUCCESS});else return V({code:zd.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${F}`)})})});q.on("error",(H)=>{return V({code:zd.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(G);BZ1.diag.debug(`Zipkin request payload: ${W}`),q.write(W,"utf8"),q.end()}}gK0.prepareSend=Ue6});var pK0=_((NZ1)=>{Object.defineProperty(NZ1,"__esModule",{value:!0});NZ1.prepareSend=void 0;var De6=uK0();Object.defineProperty(NZ1,"prepareSend",{enumerable:!0,get:function(){return De6.prepareSend}})});var MZ1=_((wZ1)=>{Object.defineProperty(wZ1,"__esModule",{value:!0});wZ1.prepareSend=void 0;var Ne6=pK0();Object.defineProperty(wZ1,"prepareSend",{enumerable:!0,get:function(){return Ne6.prepareSend}})});var cK0=_((dK0)=>{Object.defineProperty(dK0,"__esModule",{value:!0});dK0.SpanKind=void 0;var Me6;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(Me6=dK0.SpanKind||(dK0.SpanKind={}))});var oK0=_((nK0)=>{Object.defineProperty(nK0,"__esModule",{value:!0});nK0._toZipkinAnnotations=nK0._toZipkinTags=nK0.toZipkinSpan=nK0.defaultStatusErrorTagName=nK0.defaultStatusCodeTagName=void 0;var nW=d0(),OZ1=a6(),Fd=cK0(),Le6={[nW.SpanKind.CLIENT]:Fd.SpanKind.CLIENT,[nW.SpanKind.SERVER]:Fd.SpanKind.SERVER,[nW.SpanKind.CONSUMER]:Fd.SpanKind.CONSUMER,[nW.SpanKind.PRODUCER]:Fd.SpanKind.PRODUCER,[nW.SpanKind.INTERNAL]:void 0};nK0.defaultStatusCodeTagName="otel.status_code";nK0.defaultStatusErrorTagName="error";function Oe6(J,Q,Y,Z){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:Le6[J.kind],timestamp:(0,OZ1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,OZ1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:lK0(J,Y,Z),annotations:J.events.length?iK0(J.events):void 0}}nK0.toZipkinSpan=Oe6;function lK0({attributes:J,resource:Q,status:Y,droppedAttributesCount:Z,droppedEventsCount:X,droppedLinksCount:G},V,K){let q={};for(let W of Object.keys(J))q[W]=String(J[W]);if(Y.code!==nW.SpanStatusCode.UNSET)q[V]=String(nW.SpanStatusCode[Y.code]);if(Y.code===nW.SpanStatusCode.ERROR&&Y.message)q[K]=Y.message;if(Z)q["otel.dropped_attributes_count"]=String(Z);if(X)q["otel.dropped_events_count"]=String(X);if(G)q["otel.dropped_links_count"]=String(G);return Object.keys(Q.attributes).forEach((W)=>q[W]=String(Q.attributes[W])),q}nK0._toZipkinTags=lK0;function iK0(J){return J.map((Q)=>({timestamp:Math.round((0,OZ1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}nK0._toZipkinAnnotations=iK0});var tK0=_((rK0)=>{Object.defineProperty(rK0,"__esModule",{value:!0});rK0.prepareGetHeaders=void 0;function je6(J){return function(){return J()}}rK0.prepareGetHeaders=je6});var $q0=_((Zq0)=>{Object.defineProperty(Zq0,"__esModule",{value:!0});Zq0.ZipkinExporter=void 0;var eK0=d0(),Jq0=a6(),Qq0=MZ1(),AZ1=oK0(),IZ1=jW(),Pe6=tK0();class Yq0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,Jq0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,Qq0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||AZ1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||AZ1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,Pe6.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[IZ1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(eK0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:Jq0.ExportResultCode.FAILED,error:Error("Exporter has been shutdown")}));return}let Z=new Promise((G)=>{this._sendSpans(J,Y,(V)=>{G(),Q(V)})});this._sendingPromises.push(Z);let X=()=>{let G=this._sendingPromises.indexOf(Z);this._sendingPromises.splice(G,1)};Z.then(X,X)}shutdown(){return eK0.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((J,Q)=>{Promise.all(this._sendingPromises).then(()=>{J()},Q)})}_beforeSend(){if(this._getHeaders)this._send=(0,Qq0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let Z=J.map((X)=>(0,AZ1.toZipkinSpan)(X,String(X.attributes[IZ1.ATTR_SERVICE_NAME]||X.resource.attributes[IZ1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(Z,(X)=>{if(Y)return Y(X)})}}Zq0.ZipkinExporter=Yq0});var Gq0=_((Ud)=>{Object.defineProperty(Ud,"__esModule",{value:!0});Ud.ZipkinExporter=Ud.prepareSend=void 0;var Te6=MZ1();Object.defineProperty(Ud,"prepareSend",{enumerable:!0,get:function(){return Te6.prepareSend}});var Ce6=$q0();Object.defineProperty(Ud,"ZipkinExporter",{enumerable:!0,get:function(){return Ce6.ZipkinExporter}})});var EZ1=_((Vq0)=>{Object.defineProperty(Vq0,"__esModule",{value:!0});Vq0.B3_DEBUG_FLAG_KEY=void 0;var Se6=d0();Vq0.B3_DEBUG_FLAG_KEY=(0,Se6.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var DC=_((qq0)=>{Object.defineProperty(qq0,"__esModule",{value:!0});qq0.X_B3_FLAGS=qq0.X_B3_PARENT_SPAN_ID=qq0.X_B3_SAMPLED=qq0.X_B3_SPAN_ID=qq0.X_B3_TRACE_ID=qq0.B3_CONTEXT_HEADER=void 0;qq0.B3_CONTEXT_HEADER="b3";qq0.X_B3_TRACE_ID="x-b3-traceid";qq0.X_B3_SPAN_ID="x-b3-spanid";qq0.X_B3_SAMPLED="x-b3-sampled";qq0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";qq0.X_B3_FLAGS="x-b3-flags"});var Bq0=_((Uq0)=>{Object.defineProperty(Uq0,"__esModule",{value:!0});Uq0.B3MultiPropagator=void 0;var wX=d0(),fe6=a6(),Hq0=EZ1(),qQ=DC(),he6=new Set([!0,"true","True","1",1]),ge6=new Set([!1,"false","False","0",0]);function me6(J){return J===wX.TraceFlags.SAMPLED||J===wX.TraceFlags.NONE}function ue6(J){return Array.isArray(J)?J[0]:J}function Dd(J,Q,Y){let Z=Q.get(J,Y);return ue6(Z)}function pe6(J,Q){let Y=Dd(J,Q,qQ.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function de6(J,Q){let Y=Dd(J,Q,qQ.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function zq0(J,Q){return Dd(J,Q,qQ.X_B3_FLAGS)==="1"?"1":void 0}function ce6(J,Q){let Y=Dd(J,Q,qQ.X_B3_SAMPLED);if(zq0(J,Q)==="1"||he6.has(Y))return wX.TraceFlags.SAMPLED;if(Y===void 0||ge6.has(Y))return wX.TraceFlags.NONE;return}class Fq0{inject(J,Q,Y){let Z=wX.trace.getSpanContext(J);if(!Z||!(0,wX.isSpanContextValid)(Z)||(0,fe6.isTracingSuppressed)(J))return;let X=J.getValue(Hq0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,qQ.X_B3_TRACE_ID,Z.traceId),Y.set(Q,qQ.X_B3_SPAN_ID,Z.spanId),X==="1")Y.set(Q,qQ.X_B3_FLAGS,X);else if(Z.traceFlags!==void 0)Y.set(Q,qQ.X_B3_SAMPLED,(wX.TraceFlags.SAMPLED&Z.traceFlags)===wX.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let Z=pe6(Q,Y),X=de6(Q,Y),G=ce6(Q,Y),V=zq0(Q,Y);if((0,wX.isValidTraceId)(Z)&&(0,wX.isValidSpanId)(X)&&me6(G))return J=J.setValue(Hq0.B3_DEBUG_FLAG_KEY,V),wX.trace.setSpanContext(J,{traceId:Z,spanId:X,isRemote:!0,traceFlags:G});return J}fields(){return[qQ.X_B3_TRACE_ID,qQ.X_B3_SPAN_ID,qQ.X_B3_FLAGS,qQ.X_B3_SAMPLED,qQ.X_B3_PARENT_SPAN_ID]}}Uq0.B3MultiPropagator=Fq0});var Oq0=_((Mq0)=>{Object.defineProperty(Mq0,"__esModule",{value:!0});Mq0.B3SinglePropagator=void 0;var TD=d0(),le6=a6(),Nq0=EZ1(),RZ1=DC(),ie6=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,ne6="0".repeat(16),ae6=new Set(["d","1"]),oe6="d";function re6(J){return J.length===32?J:`${ne6}${J}`}function se6(J){if(J&&ae6.has(J))return TD.TraceFlags.SAMPLED;return TD.TraceFlags.NONE}class wq0{inject(J,Q,Y){let Z=TD.trace.getSpanContext(J);if(!Z||!(0,TD.isSpanContextValid)(Z)||(0,le6.isTracingSuppressed)(J))return;let X=J.getValue(Nq0.B3_DEBUG_FLAG_KEY)||Z.traceFlags&1,G=`${Z.traceId}-${Z.spanId}-${X}`;Y.set(Q,RZ1.B3_CONTEXT_HEADER,G)}extract(J,Q,Y){let Z=Y.get(Q,RZ1.B3_CONTEXT_HEADER),X=Array.isArray(Z)?Z[0]:Z;if(typeof X!=="string")return J;let G=X.match(ie6);if(!G)return J;let[,V,K,q]=G,W=re6(V);if(!(0,TD.isValidTraceId)(W)||!(0,TD.isValidSpanId)(K))return J;let H=se6(q);if(q===oe6)J=J.setValue(Nq0.B3_DEBUG_FLAG_KEY,q);return TD.trace.setSpanContext(J,{traceId:W,spanId:K,isRemote:!0,traceFlags:H})}fields(){return[RZ1.B3_CONTEXT_HEADER]}}Mq0.B3SinglePropagator=wq0});var PZ1=_((Aq0)=>{Object.defineProperty(Aq0,"__esModule",{value:!0});Aq0.B3InjectEncoding=void 0;var te6;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(te6=Aq0.B3InjectEncoding||(Aq0.B3InjectEncoding={}))});var jq0=_((Eq0)=>{Object.defineProperty(Eq0,"__esModule",{value:!0});Eq0.B3Propagator=void 0;var ee6=a6(),J14=Bq0(),Q14=Oq0(),Y14=DC(),Z14=PZ1();class Iq0{_b3MultiPropagator=new J14.B3MultiPropagator;_b3SinglePropagator=new Q14.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===Z14.B3InjectEncoding.MULTI_HEADER)this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields();else this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields()}inject(J,Q,Y){if((0,ee6.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let Z=Y.get(Q,Y14.B3_CONTEXT_HEADER);if(Array.isArray(Z)?Z[0]:Z)return this._b3SinglePropagator.extract(J,Q,Y);else return this._b3MultiPropagator.extract(J,Q,Y)}fields(){return this._fields}}Eq0.B3Propagator=Iq0});var Pq0=_((ZG)=>{Object.defineProperty(ZG,"__esModule",{value:!0});ZG.B3InjectEncoding=ZG.X_B3_TRACE_ID=ZG.X_B3_SPAN_ID=ZG.X_B3_SAMPLED=ZG.X_B3_PARENT_SPAN_ID=ZG.X_B3_FLAGS=ZG.B3_CONTEXT_HEADER=ZG.B3Propagator=void 0;var X14=jq0();Object.defineProperty(ZG,"B3Propagator",{enumerable:!0,get:function(){return X14.B3Propagator}});var eL=DC();Object.defineProperty(ZG,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return eL.B3_CONTEXT_HEADER}});Object.defineProperty(ZG,"X_B3_FLAGS",{enumerable:!0,get:function(){return eL.X_B3_FLAGS}});Object.defineProperty(ZG,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return eL.X_B3_PARENT_SPAN_ID}});Object.defineProperty(ZG,"X_B3_SAMPLED",{enumerable:!0,get:function(){return eL.X_B3_SAMPLED}});Object.defineProperty(ZG,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return eL.X_B3_SPAN_ID}});Object.defineProperty(ZG,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return eL.X_B3_TRACE_ID}});var $14=PZ1();Object.defineProperty(ZG,"B3InjectEncoding",{enumerable:!0,get:function(){return $14.B3InjectEncoding}})});var kq0=_((Cq0)=>{Object.defineProperty(Cq0,"__esModule",{value:!0});Cq0.JaegerPropagator=Cq0.UBER_BAGGAGE_HEADER_PREFIX=Cq0.UBER_TRACE_ID_HEADER=void 0;var CD=d0(),V14=a6();Cq0.UBER_TRACE_ID_HEADER="uber-trace-id";Cq0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class Tq0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=Cq0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||Cq0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||Cq0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let Z=CD.trace.getSpanContext(J),X=CD.propagation.getBaggage(J);if(Z&&(0,V14.isTracingSuppressed)(J)===!1){let G=`0${(Z.traceFlags||CD.TraceFlags.NONE).toString(16)}`;Y.set(Q,this._jaegerTraceHeader,`${Z.traceId}:${Z.spanId}:0:${G}`)}if(X)for(let[G,V]of X.getAllEntries())Y.set(Q,`${this._jaegerBaggageHeaderPrefix}-${G}`,encodeURIComponent(V.value))}extract(J,Q,Y){let Z=Y.get(Q,this._jaegerTraceHeader),X=Array.isArray(Z)?Z[0]:Z,G=Y.keys(Q).filter((q)=>q.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map((q)=>{let W=Y.get(Q,q);return{key:q.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(W)?W[0]:W}}),V=J;if(typeof X==="string"){let q=q14(X);if(q)V=CD.trace.setSpanContext(V,q)}if(G.length===0)return V;let K=CD.propagation.getBaggage(J)??CD.propagation.createBaggage();for(let q of G){if(q.value===void 0)continue;K=K.setEntry(q.key,{value:decodeURIComponent(q.value)})}return V=CD.propagation.setBaggage(V,K),V}fields(){return[this._jaegerTraceHeader]}}Cq0.JaegerPropagator=Tq0;var K14=/^[0-9a-f]{1,2}$/i;function q14(J){let Q=decodeURIComponent(J).split(":");if(Q.length!==4)return null;let[Y,Z,,X]=Q,G=Y.padStart(32,"0"),V=Z.padStart(16,"0"),K=K14.test(X)?parseInt(X,16)&1:1;return{traceId:G,spanId:V,isRemote:!0,traceFlags:K}}});var yq0=_((BC)=>{Object.defineProperty(BC,"__esModule",{value:!0});BC.UBER_TRACE_ID_HEADER=BC.UBER_BAGGAGE_HEADER_PREFIX=BC.JaegerPropagator=void 0;var CZ1=kq0();Object.defineProperty(BC,"JaegerPropagator",{enumerable:!0,get:function(){return CZ1.JaegerPropagator}});Object.defineProperty(BC,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return CZ1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(BC,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return CZ1.UBER_TRACE_ID_HEADER}})});var gq0=_((fq0)=>{Object.defineProperty(fq0,"__esModule",{value:!0});fq0.setupPropagator=fq0.setupContextManager=fq0.getPropagatorFromEnv=fq0.getSpanProcessorsFromEnv=fq0.getOtlpProtocolFromEnv=fq0.filterBlanksAndNulls=fq0.getResourceDetectorsFromEnv=void 0;var fY=d0(),MX=a6(),xq0=EK0(),H14=kK0(),z14=hK0(),F14=Gq0(),NC=YD(),Bd=WD(),_Z1=Pq0(),U14=yq0(),D14=Tm(),B14="env",N14="host",w14="os",M14="process",L14="serviceinstance";function O14(){let J=new Map([[B14,NC.envDetector],[N14,NC.hostDetector],[w14,NC.osDetector],[L14,NC.serviceInstanceIdDetector],[M14,NC.processDetector]]),Q=(0,MX.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];if(Q.includes("all"))return[...J.values()].flat();if(Q.includes("none"))return[];return Q.flatMap((Y)=>{let Z=J.get(Y);if(!Z)fY.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return Z||[]})}fq0.getResourceDetectorsFromEnv=O14;function vq0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}fq0.filterBlanksAndNulls=vq0;function bq0(){return(0,MX.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,MX.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}fq0.getOtlpProtocolFromEnv=bq0;function A14(){let J=bq0();switch(J){case"grpc":return new z14.OTLPTraceExporter;case"http/json":return new H14.OTLPTraceExporter;case"http/protobuf":return new xq0.OTLPTraceExporter;default:return fY.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new xq0.OTLPTraceExporter}}function I14(){let J=new Map([["otlp",()=>A14()],["zipkin",()=>new F14.ZipkinExporter],["console",()=>new Bd.ConsoleSpanExporter]]),Q=[],Y=[],Z=vq0(Array.from(new Set((0,MX.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(Z[0]==="none")return fY.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(Z.length===0)fY.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),Z=["otlp"];else if(Z.length>1&&Z.includes("none"))fY.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),Z=["otlp"];for(let X of Z){let G=J.get(X)?.();if(G)Q.push(G);else fY.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${X}.`)}for(let X of Q)if(X instanceof Bd.ConsoleSpanExporter)Y.push(new Bd.SimpleSpanProcessor(X));else Y.push(new Bd.BatchSpanProcessor(X));if(Q.length===0)fY.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}fq0.getSpanProcessorsFromEnv=I14;function E14(){let J=(0,MX.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new MX.W3CTraceContextPropagator],["baggage",()=>new MX.W3CBaggagePropagator],["b3",()=>new _Z1.B3Propagator],["b3multi",()=>new _Z1.B3Propagator({injectEncoding:_Z1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new U14.JaegerPropagator]]),Y=Array.from(new Set(J)),X=Y.map((G)=>{let V=Q.get(G)?.();if(!V){fY.diag.warn(`Propagator "${G}" requested through environment variable is unavailable.`);return}return V}).reduce((G,V)=>{if(V)G.push(V);return G},[]);if(X.length===0)return null;else if(Y.length===1)return X[0];else return new MX.CompositePropagator({propagators:X})}fq0.getPropagatorFromEnv=E14;function R14(J){if(J===null)return;if(J===void 0){let Q=new D14.AsyncLocalStorageContextManager;Q.enable(),fY.context.setGlobalContextManager(Q);return}J.enable(),fY.context.setGlobalContextManager(J)}fq0.setupContextManager=R14;function j14(J){if(J===null)return;if(J===void 0){fY.propagation.setGlobalPropagator(new MX.CompositePropagator({propagators:[new MX.W3CTraceContextPropagator,new MX.W3CBaggagePropagator]}));return}fY.propagation.setGlobalPropagator(J)}fq0.setupPropagator=j14});var lq0=_((dq0)=>{Object.defineProperty(dq0,"__esModule",{value:!0});dq0.NodeSDK=void 0;var u3=d0(),y14=lP(),x14=C31(),JO=YD(),wC=c21(),v14=d20(),b14=PV0(),SZ1=vV0(),f14=eV0(),mq0=VK0(),h14=Kd(),g14=BK0(),_D=GD(),m14=WD(),u14=YJ1(),p14=jW(),aW=a6(),MC=gq0();function uq0(J,Q){return parseInt(process.env[J]||"")||Q}function d14(){let J=[],Q=(0,aW.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)u3.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return u3.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),J;return Q.forEach((Y)=>{if(Y==="otlp"){let Z=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),X=uq0("OTEL_METRIC_EXPORT_INTERVAL",60000),G=uq0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(Z){case"grpc":J.push(new _D.PeriodicExportingMetricReader({exporter:new f14.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/json":J.push(new _D.PeriodicExportingMetricReader({exporter:new h14.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/protobuf":J.push(new _D.PeriodicExportingMetricReader({exporter:new mq0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;default:u3.diag.warn(`Unsupported OTLP metrics protocol: "${Z}". Using http/protobuf.`),J.push(new _D.PeriodicExportingMetricReader({exporter:new mq0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}))}}else if(Y==="console")J.push(new _D.PeriodicExportingMetricReader({exporter:new _D.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new g14.PrometheusExporter);else u3.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class pq0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,aW.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,aW.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)u3.diag.setLogger(new u3.DiagConsoleLogger,{logLevel:(0,aW.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,JO.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,aW.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,MC.getResourceDetectorsFromEnv)();else this._resourceDetectors=[JO.envDetector,JO.processDetector,JO.hostDetector];if(this._serviceName=J.serviceName,J.traceExporter||J.spanProcessor||J.spanProcessors){let Y={};if(J.sampler)Y.sampler=J.sampler;if(J.spanLimits)Y.spanLimits=J.spanLimits;if(J.idGenerator)Y.idGenerator=J.idGenerator;if(J.spanProcessor)u3.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let Z=J.spanProcessor??new m14.BatchSpanProcessor(J.traceExporter),X=J.spanProcessors??[Z];this._tracerProviderConfig={tracerConfig:Y,spanProcessors:X}}if(J.logRecordProcessors)this._loggerProviderConfig={logRecordProcessors:J.logRecordProcessors};else if(J.logRecordProcessor)this._loggerProviderConfig={logRecordProcessors:[J.logRecordProcessor]},u3.diag.warn("The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.");else this.configureLoggerProviderFromEnv();if(J.metricReaders||J.metricReader||J.views){let Y={};if(J.metricReaders)Y.readers=J.metricReaders;else if(J.metricReader)Y.readers=[J.metricReader],u3.diag.warn("The 'metricReader' option is deprecated. Please use 'metricReaders' instead.");if(J.views)Y.views=J.views;this._meterProviderConfig=Y}this._instrumentations=J.instrumentations?.flat()??[]}start(){if(this._disabled)return;if((0,x14.registerInstrumentations)({instrumentations:this._instrumentations}),(0,MC.setupContextManager)(this._configuration?.contextManager),(0,MC.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,MC.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,JO.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,JO.resourceFromAttributes)({[p14.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,MC.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new u14.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),u3.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new wC.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,y14.logs.setGlobalLoggerProvider(Y)}let Q=d14();if(this._meterProviderConfig||Q.length>0){let Y=[];if(this._meterProviderConfig?.readers)Y.push(...this._meterProviderConfig.readers);if(Y.length===0)Q.forEach((X)=>Y.push(X));let Z=new _D.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=Z,u3.metrics.setGlobalMeterProvider(Z);for(let X of this._instrumentations)X.setMeterProvider(u3.metrics.getMeterProvider())}}shutdown(){let J=[];if(this._tracerProvider)J.push(this._tracerProvider.shutdown());if(this._loggerProvider)J.push(this._loggerProvider.shutdown());if(this._meterProvider)J.push(this._meterProvider.shutdown());return Promise.all(J).then(()=>{})}configureLoggerProviderFromEnv(){let J=(0,aW.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)u3.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){u3.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let Q=[];if(J.forEach((Y)=>{if(Y==="otlp"){let Z=((0,aW.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,aW.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(Z){case"grpc":Q.push(new b14.OTLPLogExporter);break;case"http/json":Q.push(new v14.OTLPLogExporter);break;case"http/protobuf":Q.push(new SZ1.OTLPLogExporter);break;case void 0:case"":Q.push(new SZ1.OTLPLogExporter);break;default:u3.diag.warn(`Unsupported OTLP logs protocol: "${Z}". Using http/protobuf.`),Q.push(new SZ1.OTLPLogExporter)}}else if(Y==="console")Q.push(new wC.ConsoleLogRecordExporter);else u3.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${Y}". Supported values are: otlp, console, none.`)}),Q.length>0)this._loggerProviderConfig={logRecordProcessors:Q.map((Y)=>{if(Y instanceof wC.ConsoleLogRecordExporter)return new wC.SimpleLogRecordProcessor(Y);else return new wC.BatchLogRecordProcessor(Y)})}}}dq0.NodeSDK=pq0});var iq0=_((kZ1)=>{Object.defineProperty(kZ1,"__esModule",{value:!0});kZ1.NodeSDK=kZ1.tracing=kZ1.resources=kZ1.node=kZ1.metrics=kZ1.logs=kZ1.core=kZ1.contextBase=kZ1.api=void 0;kZ1.api=d0();kZ1.contextBase=d0();kZ1.core=a6();kZ1.logs=c21();kZ1.metrics=GD();kZ1.node=YJ1();kZ1.resources=YD();kZ1.tracing=WD();var c14=lq0();Object.defineProperty(kZ1,"NodeSDK",{enumerable:!0,get:function(){return c14.NodeSDK}})});import J04 from"os";import Nd from"path";var oW,SD,rW,sW,nq0,nb8,ab8,Q04,Y04;var QO=i(()=>{oW=J04.homedir(),{env:SD}=process,rW=SD.XDG_DATA_HOME||(oW?Nd.join(oW,".local","share"):void 0),sW=SD.XDG_CONFIG_HOME||(oW?Nd.join(oW,".config"):void 0),nq0=SD.XDG_STATE_HOME||(oW?Nd.join(oW,".local","state"):void 0),nb8=SD.XDG_CACHE_HOME||(oW?Nd.join(oW,".cache"):void 0),ab8=SD.XDG_RUNTIME_DIR||void 0,Q04=(SD.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(rW)Q04.unshift(rW);Y04=(SD.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(sW)Y04.unshift(sW)});import{homedir as wd}from"node:os";import kD from"node:path";var aq0,Z04,oq0,X04,Md,$04,YO,XG,eb8;var MK=i(()=>{QO();aq0=kD.join(wd(),".local/share"),Z04=process.platform==="win32"||process.platform==="darwin"?aq0:rW??aq0,oq0=kD.join(wd(),".config"),X04=process.platform==="win32"||process.platform==="darwin"?oq0:sW??oq0,Md=kD.join(Z04,"amp"),$04=kD.join(X04,"amp"),YO=kD.join($04,"tools"),XG=kD.join(wd(),".cache","amp"),eb8=kD.join(wd(),".cache","amp","http-debug-logs")});function V04(){return G04}function rq0(J){let Q=yD;return yD=J,Q}class $G{baseLogger;scope;context={};constructor(J=sq0){this.baseLogger=J}with(J){let Q=new $G(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new $G(this.baseLogger);return Q.scope=this.scope?`${this.scope}.${J}`:J,Q.context={...this.context},Q}error(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.error(this.messageWithPrefix(J),...Y)}warn(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.warn(this.messageWithPrefix(J),...Y)}info(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.info(this.messageWithPrefix(J),...Y)}debug(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.debug(this.messageWithPrefix(J),...Y)}audit(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.audit(this.messageWithPrefix(J),...Y)}messageWithPrefix(J){return this.scope?`${this.scope}: ${J}`:J}mergeContextWithMeta(J){let Q={...this.context},Y=yZ1.trace.getActiveSpan();if(Y){let X=Y.spanContext();if(X.traceId)Q.traceId=X.traceId,Q.spanId=X.spanId}if(J.length===0)return[Q];let Z=J[0];if(typeof Z==="object"&&Z!==null)return[{...Z,...Q},...J.slice(1)];else return[Q,...J]}}var yZ1,G04=!1,K04,yD,sq0,R;var v1=i(()=>{yZ1=H0(d0(),1);K04={error:(J,...Q)=>console.error(J,...Q),warn:(J,...Q)=>console.warn(J,...Q),info:(J,...Q)=>console.info(J,...Q),debug:(J,...Q)=>{if(V04())console.debug(J,...Q)},audit:(J,...Q)=>{let Y=Q.length>0?Q[0]:{};if(typeof Y==="object"&&Y!==null&&!("audit"in Y))Y.audit=!0;let Z=yZ1.trace.getActiveSpan();if(Z){let X=Z.spanContext();if(X.traceId)Y.traceId=X.traceId,Y.spanId=X.spanId}console.info(J,Y)}},yD=K04;sq0={error:(J,...Q)=>yD.error(J,...Q),warn:(J,...Q)=>yD.warn(J,...Q),info:(J,...Q)=>yD.info(J,...Q),debug:(J,...Q)=>yD.debug(J,...Q),audit:(J,...Q)=>yD.audit(J,...Q)};R=sq0});function XW0(){if(typeof process==="object")return process.platform==="win32"?"windows":"posix";else if(typeof navigator==="object")return navigator.userAgent.indexOf("Windows")>=0?"windows":"posix";return"posix"}function $W0(J,Q){if(!J.scheme&&Q)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${J.authority}", path: "${J.path}", query: "${J.query}", fragment: "${J.fragment}"}`);if(J.scheme&&!B04.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!N04.test(J.path))throw Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(w04.test(J.path))throw Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function M04(J,Q){if(!J&&!Q)return"file";return J}function L04(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=LX;else if(Q[0]!==LX)Q=LX+Q;break}return Q}class Q0{static isUri(J){if(J instanceof Q0)return!0;if(!J)return!1;let Q=J;return typeof Q.authority==="string"&&typeof Q.fragment==="string"&&typeof Q.path==="string"&&typeof Q.query==="string"&&typeof Q.scheme==="string"&&typeof Q.fsPath==="string"&&typeof Q.with==="function"&&typeof Q.toString==="function"}scheme;authority;path;query;fragment;platform;constructor(J,Q,Y,Z,X,G=!1,V){if(typeof J==="object")this.scheme=J.scheme||Y9,this.authority=J.authority||Y9,this.path=J.path||Y9,this.query=J.query||Y9,this.fragment=J.fragment||Y9,this.platform=J.platform;else this.scheme=M04(J,G),this.authority=Q||Y9,this.path=L04(this.scheme,Y||Y9),this.query=Z||Y9,this.fragment=X||Y9,this.platform=V,$W0(this,G)}get fsPath(){return WW0(this,!1)}with(J){if(!J)return this;let{scheme:Q,authority:Y,path:Z,query:X,fragment:G,platform:V}=J;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=Y9;if(Y===void 0)Y=this.authority;else if(Y===null)Y=Y9;if(Z===void 0)Z=this.path;else if(Z===null)Z=Y9;if(X===void 0)X=this.query;else if(X===null)X=Y9;if(G===void 0)G=this.fragment;else if(G===null)G=Y9;if(V===void 0)V=this.platform;else if(V===null)V=void 0;if(Q===this.scheme&&Y===this.authority&&Z===this.path&&X===this.query&&G===this.fragment&&V===this.platform)return this;return new xD(Q,Y,Z,X,G,!1,V)}static parse(J,Q=!1){let Y=O04.exec(J);if(!Y)return new xD(Y9,Y9,Y9,Y9,Y9);return new xD(Y[2]||Y9,Od(Y[4]||Y9),Od(Y[5]||Y9),Od(Y[7]||Y9),Od(Y[9]||Y9),Q)}static file(J,Q=XW0()){let Y=Y9;if(Q==="windows")J=J.replace(/\\/g,LX);if(J[0]===LX&&J[1]===LX){let Z=J.indexOf(LX,2);if(Z===-1)Y=J.substring(2),J=LX;else Y=J.substring(2,Z),J=J.substring(Z)||LX}return new xD("file",Y,J,Y9,Y9,!1,Q)}static from(J){let Q=new xD(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return $W0(Q,!0),Q}toString(J=!1){return vZ1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof Q0)return J;let Q=new xD(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===KW0(Q.platform)?Y.fsPath:null,Q}}function KW0(J){return J==="windows"?1:void 0}function GW0(J,Q,Y){let Z;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);if(G>=97&&G<=122||G>=65&&G<=90||G>=48&&G<=57||G===45||G===46||G===95||G===126||Q&&G===47||Y&&G===91||Y&&G===93||Y&&G===58){if(Z!==void 0)Z+=J.charAt(X)}else{if(Z===void 0)Z=J.substring(0,X);let V=qW0[G];if(V!==void 0)Z+=V;else Z+=encodeURIComponent(J.charAt(X))}}return Z!==void 0?Z:J}function A04(J){let Q;for(let Y=0;Y<J.length;Y++){let Z=J.charCodeAt(Y);if(Z===35||Z===63){if(Q===void 0)Q=J.substring(0,Y);Q+=qW0[Z]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function WW0(J,Q){let Y;if(J.authority&&J.path.length>1&&J.scheme==="file")Y=`//${J.authority}${J.path}`;else if(J.path.charCodeAt(0)===47&&(J.path.charCodeAt(1)>=65&&J.path.charCodeAt(1)<=90||J.path.charCodeAt(1)>=97&&J.path.charCodeAt(1)<=122)&&J.path.charCodeAt(2)===58)if(!Q)Y=J.path[1].toLowerCase()+J.path.substring(2);else Y=J.path.substring(1);else Y=J.path;if(J.platform==="windows")Y=Y.replace(/\//g,"\\");return Y}function vZ1(J,Q){let Y=!Q?GW0:A04,Z="",{scheme:X,authority:G,path:V,query:K,fragment:q}=J;if(X)Z+=X,Z+=":";if(G||X==="file")Z+=LX,Z+=LX;if(G){let W=G.indexOf("@");if(W!==-1){let H=G.substring(0,W);if(G=G.substring(W+1),W=H.lastIndexOf(":"),W===-1)Z+=Y(H,!1,!1);else Z+=Y(H.substring(0,W),!1,!1),Z+=":",Z+=Y(H.substring(W+1),!1,!0);Z+="@"}if(G=G.toLowerCase(),W=G.lastIndexOf(":"),W===-1)Z+=Y(G,!1,!0);else Z+=Y(G.substring(0,W),!1,!0),Z+=G.substring(W)}if(V){if(V.length>=3&&V.charCodeAt(0)===47&&V.charCodeAt(2)===58){let W=V.charCodeAt(1);if(W>=65&&W<=90)V=`/${String.fromCharCode(W+32)}:${V.substring(3)}`}else if(V.length>=2&&V.charCodeAt(1)===58){let W=V.charCodeAt(0);if(W>=65&&W<=90)V=`${String.fromCharCode(W+32)}:${V.substring(2)}`}Z+=Y(V,!0,!1)}if(K)Z+="?",Z+=Y(K,!1,!1);if(q)Z+="#",Z+=!Q?GW0(q,!1,!1):q;return Z}function HW0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+HW0(J.substring(3));else return J}}function Od(J){if(!J.match(VW0))return J;return J.replace(VW0,(Q)=>HW0(Q))}function tW(J){return J.scheme==="file"}function G7(J){return Q0.parse(J)}function h0(J){return J.toString()}function b6(J){if(typeof J==="string"||J instanceof URL)return Q0.parse(J.toString());return J}var B04,N04,w04,Y9="",LX="/",O04,xD,qW0,VW0;var OC=i(()=>{B04=/^\w[\w\d+.-]*$/,N04=/^\//,w04=/^\/\//;O04=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;xD=class xD extends Q0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=WW0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=vZ1(this,!1);return this._formatted}return vZ1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=KW0(this.platform);if(this._formatted)J.external=this._formatted;if(J.scheme=this.scheme,J.authority=this.authority,J.path=this.path,J.query=this.query,J.fragment=this.fragment,this.platform)J.platform=this.platform;return J}};qW0={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};VW0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function bZ1(J){if(J==="/")return"/";if(J==="")return".";let Q=J.replace(/\/+$/,"");if(!Q)return".";let Y=Q.lastIndexOf("/");if(Y===-1)return".";if(Y===0)return"/";return Q.slice(0,Y)}function vD(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function XO(...J){if(J.length===0)return".";let Q="";for(let V of J)if(V)if(Q)Q+="/"+V;else Q=V;if(!Q)return".";let Y=Q.endsWith("/"),Z=Q.split("/").filter(Boolean),X=[];for(let V of Z)if(V===".."){if(X.length>0&&X[X.length-1]!=="..")X.pop();else if(!Q.startsWith("/"))X.push("..")}else if(V!==".")X.push(V);let G=Q.startsWith("/")?"/"+X.join("/"):X.join("/");if(!G)G=Q.startsWith("/")?"/":".";if(Y&&G!=="/"&&G!==".")G+="/";return G}function zW0(J,Q,Y="/",Z="/",X=!0){function G(z,F){return X?z===F:z.toLowerCase()===F.toLowerCase()}if(Y==="/")J=J.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else J=J.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(J!==Y&&J.endsWith(Y))J=J.slice(0,-1);if(Q!==Y&&Q.endsWith(Y))Q=Q.slice(0,-1);if(G(J,Q))return"";if(!J.startsWith(Y)&&Q.startsWith(Y))return Q;let V=J===Y?[""]:J.split(Y),K=Q===Y?[""]:Q.split(Y),q=0;while(q<V.length&&q<K.length&&G(V[q],K[q]))q++;let W=V.length-q,H=[];for(let z=0;z<W;z++)H.push("..");return H.push(...K.slice(q)),H.join(Z)}function Ad(J){let Q=vD(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function d5(J){try{if(J=b6(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var $O=i(()=>{OC()});function I04(J,...Q){return J=b6(J),J.with({path:XO(J.path,...Q)})}function E04(J,...Q){let Y=J.path,Z=!1;if(Y[0]!==Id)Y=Id+Y,Z=!0;let X=Y;for(let G of Q)if(G.startsWith("/"))X=XO(G);else X=XO(X,G);if(X!=="/"&&X.endsWith("/"))X=X.replace(/\/+$/,"");if(Z&&X[0]===Id&&!J.authority)X=X.substring(1);return J.with({path:X})}function R04(J){if(J=b6(J),J.path.length===0||J.path===Id)return J;let Q=bZ1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function j04(J,Q){if(Q.scheme!==J.scheme||(Q.authority??"")!==(J.authority??""))return!1;let Y=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),Z=Y?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,X=Y?J.path.slice(0,2).toUpperCase()+J.path.slice(2):J.path;return X===Z||X.startsWith(Z.endsWith("/")?Z:`${Z}/`)||Z.endsWith("/")&&X===Z.slice(0,-1)}function P04(J,Q){if(J.scheme!==Q.scheme||J.authority!==Q.authority||J.query!==Q.query||J.fragment!==Q.fragment)return null;let Y=J.platform==="windows"?"\\":"/";return zW0(J.path,Q.path,Y,Y)}function T04(J,Q){let Y=h0(J),Z=h0(Q);if(Y.startsWith("file:///")&&Z.startsWith("file:///"))return FW0(Y)===FW0(Z);return Y===Z}function FW0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Id="/",s1;var Ed=i(()=>{$O();OC();s1={joinPath:I04,resolvePath:E04,dirname:R04,basename:(J)=>vD(b6(J).path),extname:(J)=>Ad(b6(J).path),hasPrefix:j04,relativePath:P04,equalURIs:T04}});var C04=(J)=>{let Q=0,Y=[];while(Q<J.length){let Z=J[Q];if(Z==="\\"){Q++;continue}if(Z==="{"){Y.push({type:"brace",value:"{"}),Q++;continue}if(Z==="}"){Y.push({type:"brace",value:"}"}),Q++;continue}if(Z==="["){Y.push({type:"paren",value:"["}),Q++;continue}if(Z==="]"){Y.push({type:"paren",value:"]"}),Q++;continue}if(Z===":"){Y.push({type:"separator",value:":"}),Q++;continue}if(Z===","){Y.push({type:"delimiter",value:","}),Q++;continue}if(Z==='"'){let K="",q=!1;Z=J[++Q];while(Z!=='"'){if(Q===J.length){q=!0;break}if(Z==="\\"){if(Q++,Q===J.length){q=!0;break}K+=Z+J[Q],Z=J[++Q]}else K+=Z,Z=J[++Q]}if(Z=J[++Q],!q)Y.push({type:"string",value:K});continue}if(Z&&/\s/.test(Z)){Q++;continue}let G=/[0-9]/;if(Z&&G.test(Z)||Z==="-"||Z==="."){let K="";if(Z==="-")K+=Z,Z=J[++Q];while(Z&&G.test(Z)||Z===".")K+=Z,Z=J[++Q];Y.push({type:"number",value:K});continue}let V=/[a-z]/i;if(Z&&V.test(Z)){let K="";while(Z&&V.test(Z)){if(Q===J.length)break;K+=Z,Z=J[++Q]}if(K=="true"||K=="false"||K==="null")Y.push({type:"name",value:K});else{Q++;continue}continue}Q++}return Y},GO=(J)=>{if(J.length===0)return J;let Q=J[J.length-1];switch(Q.type){case"separator":return J=J.slice(0,J.length-1),GO(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),GO(J);case"string":let Z=J[J.length-2];if(Z?.type==="delimiter")return J=J.slice(0,J.length-1),GO(J);else if(Z?.type==="brace"&&Z.value==="{")return J=J.slice(0,J.length-1),GO(J);break;case"delimiter":return J=J.slice(0,J.length-1),GO(J);break}return J},_04=(J)=>{let Q=[];if(J.map((Y)=>{if(Y.type==="brace")if(Y.value==="{")Q.push("}");else Q.splice(Q.lastIndexOf("}"),1);if(Y.type==="paren")if(Y.value==="[")Q.push("]");else Q.splice(Q.lastIndexOf("]"),1)}),Q.length>0)Q.reverse().map((Y)=>{if(Y==="}")J.push({type:"brace",value:"}"});else if(Y==="]")J.push({type:"paren",value:"]"})});return J},S04=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},hY=(J)=>JSON.parse(S04(_04(GO(C04(J)))));var bD=()=>{};function Rd(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function UW0(J){let Q=J._cleanup;if(Q===void 0)return;if(J._cleanup=void 0,!Q)return;try{if(typeof Q==="function")Q();else if(Q&&typeof Q.unsubscribe==="function")Q.unsubscribe()}catch(Y){console.error("cleanupSubscription",Y)}}function hZ1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function k04(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(DW0(J,Y.type,Y.value),J._state==="closed")break}function DW0(J,Q,Y){J._state="running";let Z=J._observer;try{switch(Q){case"next":if(Z&&typeof Z.next==="function")Z.next(Y);break;case"error":if(hZ1(J),Z&&typeof Z.error==="function")Z.error(Y);else throw Y;break;case"complete":if(hZ1(J),Z&&typeof Z.complete==="function")Z.complete();break}}catch(X){console.error("notifySubscription",X)}if(J._state==="closed")UW0(J);else if(J._state==="running")J._state="ready"}function fZ1(J,Q,Y){if(J._state==="closed")return;if(J._state==="buffering"){J._queue=J._queue||[],J._queue.push({type:Q,value:Y});return}if(J._state!=="ready"){J._state="buffering",J._queue=[{type:Q,value:Y}],Rd(()=>k04(J));return}DW0(J,Q,Y)}class BW0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new NW0(this);try{this._cleanup=Q.call(void 0,Y)}catch(Z){Y.error(Z)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")hZ1(this),UW0(this)}}class NW0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){fZ1(this._subscription,"next",J)}error(J){fZ1(this._subscription,"error",J)}complete(){fZ1(this._subscription,"complete")}}function Z9(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class fD{_baseObserver;_pendingPromises;constructor(J){this._baseObserver=J,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch((J)=>this._baseObserver.error(J))}error(J){this._baseObserver.error(J)}schedule(J){let Q=Promise.all(this._pendingPromises),Y=[],Z=(G)=>Y.push(G),X=Promise.resolve().then(async()=>{await Q,await J(Z),this._pendingPromises.delete(X);for(let G of Y)this._baseObserver.next(G)}).catch((G)=>{this._pendingPromises.delete(X),this._baseObserver.error(G)});this._pendingPromises.add(X)}}function gZ1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function mZ1(J){if(gZ1(J))return J;return P1.of(J)}var P1;var hD=i(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");P1=class P1{_subscriber;constructor(J){if(!(this instanceof P1))throw TypeError("Observable cannot be called as a function");if(typeof J!=="function")throw TypeError("Observable initializer must be a function");this._subscriber=J}subscribe(J,Q,Y){if(typeof J!=="object"||J===null)J={next:J,error:Q,complete:Y};return new BW0(J,this._subscriber)}pipe(J,...Q){let Y=this;for(let Z of[J,...Q])Y=Z(Y);return Y}[Symbol.observable](){return this}static from(J){let Q=typeof P1==="function"?P1:P1;if(J==null)throw TypeError(J+" is not an object");let Y=J[Symbol.observable];if(typeof Y==="function"){let X=Y.call(J);if(Object(X)!==X)throw TypeError(X+" is not an object");if(X instanceof P1)return X;return new Q((G)=>X.subscribe(G))}let Z=J[Symbol.iterator];if(typeof Z==="function")return new Q((X)=>{Rd(()=>{if(X.closed)return;for(let G of Z.call(J))if(X.next(G),X.closed)return;X.complete()})});if(Array.isArray(J))return new Q((X)=>{Rd(()=>{if(X.closed)return;for(let G of J)if(X.next(G),X.closed)return;X.complete()})});throw TypeError(J+" is not observable")}static of(...J){return new(typeof P1==="function"?P1:P1)((Y)=>{Rd(()=>{if(Y.closed)return;for(let Z of J)if(Y.next(Z),Y.closed)return;Y.complete()})})}static get[Symbol.species](){return P1}}});var F6,m4;var jd=i(()=>{hD();F6=class F6 extends P1{_observers=new Set;constructor(){super((J)=>{return this._observers.add(J),()=>this._observers.delete(J)})}next(J){for(let Q of this._observers)Q.next(J)}error(J){for(let Q of this._observers)Q.error(J)}complete(){for(let J of this._observers)J.complete()}};m4=class m4 extends F6{currentValue;constructor(J){super();this.currentValue=J}next(J){this.currentValue=J,super.next(J)}subscribe(J,Q,Y){if(typeof J!=="object"||J===null){let Z={};if(J)Z.next=J;if(Q)Z.error=Q;if(Y)Z.complete=Y;J=Z}return J.next?.(this.currentValue),super.subscribe(J)}getValue(){return this.currentValue}}});var Pd,AC;var wW0=i(()=>{hD();jd();Pd=class Pd extends Set{subject=new m4(this);add(J){return super.add(J),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return P1.from(this.subject)}dispose(){this.subject.complete()}};AC=class AC extends Map{subject=new m4(this);set(J,Q){return super.set(J,Q),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return P1.from(this.subject)}dispose(){this.subject.complete()}}});function Td(J,Q){if(J===Q)return!0;if(J==null||Q==null||typeof J!=="object"||typeof Q!=="object")return!1;let Y=Array.isArray(J),Z=Array.isArray(Q);if(Y!==Z)return!1;if(Y&&Z)return J.length===Q.length&&J.every((G,V)=>Td(G,Q[V]));let X=new Set([...Object.keys(J),...Object.keys(Q)]);for(let G of X)if(!Td(J[G],Q[G]))return!1;return!0}var Cd;var uZ1=i(()=>{Cd={now:()=>Date.now(),schedule:(J,Q)=>{let Y=setTimeout(J,Q);return()=>clearTimeout(Y)}}});function _d(J){return{dispose:J.unsubscribe.bind(J)}}async function A0(J,Q){return new Promise((Y,Z)=>{let X,G=()=>{X?.unsubscribe(),Z(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",G,{once:!0}),X=J.subscribe({next:(V)=>{X?.unsubscribe(),Q?.removeEventListener("abort",G),Y(V)},error:(V)=>{Q?.removeEventListener("abort",G),Z(V)},complete:()=>{Q?.removeEventListener("abort",G),Z("Observable completed without emitting a value")}})})}async function eW(J,Q){return new Promise((Y,Z)=>{let X,G=!1,V,K=()=>{V?.unsubscribe(),Z(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",K,{once:!0}),V=J.subscribe({next:(q)=>{X=q,G=!0},error:(q)=>{Q?.removeEventListener("abort",K),Z(q)},complete:()=>{if(Q?.removeEventListener("abort",K),G)Y(X);else Z("Observable completed without emitting a value")}})})}async function LW0(J,Q){return new Promise((Y,Z)=>{let X=J.subscribe({error:Z,complete:()=>Y()});Q?.addEventListener("abort",()=>{X.unsubscribe(),Z(new DOMException("Aborted","AbortError"))},{once:!0})})}function Y5(J){return new P1((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function n0(J){return new P1((Q)=>{let Y=!1,Z=new AbortController,X=Z.signal;return(async()=>{try{X?.throwIfAborted();let V=await J(X);if(X?.throwIfAborted(),!Y)Q.next(V),Q.complete()}catch(V){if(!Y)if(X.aborted)Q.complete();else Q.error(V)}})(),()=>{Y=!0,Z.abort()}})}function q0(J){return(Q)=>{return new P1((Y)=>{let Z=new fD(Y),X=0,G=Q.subscribe({complete(){Z.complete()},error(V){Z.error(V)},next(V){Z.schedule(async(K)=>{let q=await J(V,X);X++,K(q)})}});return()=>Z9(G)})}}function VO(J,Q=Cd){return new P1((Y)=>{let Z=0,X=null,G=()=>{Y.next(Z++),X=Q.schedule(G,J)};return X=Q.schedule(G,J),()=>{if(X)X()}})}function LK(...J){return new P1((Q)=>{let Y=0,Z=J.map((X)=>X.subscribe({next:(G)=>Q.next(G),error:(G)=>Q.error(G),complete:()=>{if(Y++,Y===J.length)Q.complete()}}));return()=>{OW0(Z)}})}function v4(...J){if(J.length===0)return IC;return new P1((Q)=>{let Y=Array(J.length),Z=Array(J.length).fill(0),X=Array(J.length).fill(!1),G=0,V=[],K=new fD(Q);for(let q=0;q<J.length;q++){let W=J[q];V.push(W.subscribe({next(H){Y[q]=H,X[q]=!0;let z=++Z[q];if(X.every(Boolean))K.schedule(async(F)=>{if(Z[q]===z)F([...Y])})},error(H){K.error(H)},complete(){if(G++,G===J.length)K.complete()}}))}return()=>{OW0(V)}})}function $4(J){let Y=J?.shouldCountRefs??!0,Z=y04++,X=(G,...V)=>{};return(G)=>{let V=new F6,K=null,q=!1,W,H=0;return new P1((z)=>{if(H++,q)X("new subscriber, emitting buffered value",W),z.next(W);else X("new subscriber, no buffered value to emit");if(!K)K=G.subscribe({next:(U)=>{q=!0,W=U,V.next(U)},error:(U)=>V.error(U),complete:()=>V.complete()});let F=V.subscribe(z);return()=>{if(H--,F.unsubscribe(),Y&&H===0){if(K)Z9(K),K=null;q=!1}}})}}function OW0(J){for(let Q of J)if(Q)Z9(Q)}function OK(J){return(Q)=>{return new P1((Y)=>{let Z=Q.subscribe({next:(G)=>Y.next(G),error:(G)=>Y.error(G),complete:()=>Y.complete()}),X=J.subscribe({next:()=>{Y.complete(),Z.unsubscribe(),X.unsubscribe()},error:(G)=>{Y.error(G),Z.unsubscribe()}});return()=>{Z.unsubscribe(),X.unsubscribe()}})}}function OX(J){return(Q)=>{return new P1((Y)=>{let Z,X=Q.subscribe({next(G){Z=G,Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{Z9(X),J(Z)}})}}function q6(J=Td){return(Q)=>{return new P1((Y)=>{let Z=MW0,X=new fD(Y),G=Q.subscribe({complete(){X.complete()},error(V){X.error(V)},next(V){X.schedule(async(K)=>{if(Z===MW0||!J(Z,V))Z=V,K(V)})}});return()=>Z9(G)})}}function WQ(J){return x04(typeof J==="function"?{next:J}:J)}function x04(J){return(Q)=>new P1((Y)=>{let Z=typeof J==="function"?J():J,X=Q.subscribe({next(G){if(Z.next)try{Z.next(G)}catch(V){Y.error(V);return}Y.next(G)},error(G){if(Z.error)try{Z.error(G)}catch(V){Y.error(V);return}Y.error(G)},complete(){if(Z.complete)try{Z.complete()}catch(G){Y.error(G);return}Y.complete()}});return()=>Z9(X)})}function GG(J){return(Q)=>{return new P1((Y)=>{let Z=!1,X=Q.subscribe({next:(V)=>{Z=!0,clearTimeout(G),Y.next(V)},error:(V)=>{clearTimeout(G),Y.error(V)},complete:()=>{clearTimeout(G),Y.complete()}}),G=setTimeout(()=>{if(!Z)X.unsubscribe(),Y.error(new Sd(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(G),X.unsubscribe()}})}}function H4(J){return(Q)=>new P1((Y)=>{let Z;try{Y.next(J),Z=Q.subscribe({next(X){Y.next(X)},error(X){Y.error(X)},complete(){Y.complete()}})}catch(X){Y.error(X)}return()=>{if(Z)Z9(Z)}})}function VG(J){return(Q)=>new P1((Y)=>{let Z=0,X=Q.subscribe({next(G){if(Z<J){if(Y.next(G),Z++,Z===J)Y.complete(),Z9(X)}},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{Z9(X)}})}function AW0(J){return(Q)=>new P1((Y)=>{let Z=0,X=Q.subscribe({next(G){if(Z>=J)Y.next(G);else Z++},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{Z9(X)}})}function pZ1(J){return(Q)=>{return new P1((Y)=>{let Z=0,X=new Set,G=!1,V=()=>{if(G&&X.size===0)Y.complete()},K=Q.subscribe({next(q){let H=J(q,Z++).subscribe({next(z){Y.next(z)},error(z){Y.error(z)},complete(){X.delete(H),V()}});X.add(H)},error(q){Y.error(q)},complete(){G=!0,V()}});return()=>{Z9(K);for(let q of X)if(q)Z9(q)}})}}function V6(J){return(Q)=>{return new P1((Y)=>{let Z=0,X=null,G=!1,V=()=>{if(G&&!X)Y.complete()},K=Q.subscribe({next(q){if(X)Z9(X),X=null;let W;try{W=J(q,Z++)}catch(H){Y.error(H);return}X=W.subscribe({next(H){Y.next(H)},error(H){Y.error(H)},complete(){X=null,V()}})},error(q){Y.error(q)},complete(){G=!0,V()}});return()=>{if(Z9(K),X)Z9(X)}})}}function MJ(J,Q){let Y=Q?.scheduler??Cd;return(Z)=>new P1((X)=>{let G=null,V=null,K=!1,q=Z.subscribe({next:(W)=>{if(V=W,K=!0,G===null)G=Y.schedule(()=>{if(K)X.next(V),K=!1;G=null},J)},error:(W)=>X.error(W),complete:()=>{if(G!==null)G();if(K)X.next(V);X.complete()}});return()=>{if(Z9(q),G!==null)G()}})}function EC(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");let Y=Q.scheduler??Cd;return(Z)=>new P1((X)=>{let G=0,V=null,K=null,q=!1,W=Z.subscribe({next:(H)=>{let z=Y.now();if(K=H,q=!0,z-G>=J)X.next(H),G=z,q=!1;else if(V===null)V=Y.schedule(()=>{if(q)X.next(K),G=Y.now(),q=!1;V=null},J-(z-G));if(G===0)X.next(H),G=z,q=!1},error:(H)=>X.error(H),complete:()=>{if(V!==null)V();if(q)X.next(K);X.complete()}});return()=>{if(Z9(W),V!==null)V()}})}function gD(...J){return new P1((Q)=>{let Y=0,Z=null;function X(){if(Y>=J.length){Q.complete();return}Z=J[Y].subscribe({next:(V)=>Q.next(V),error:(V)=>Q.error(V),complete:()=>{Y++,X()}})}return X(),()=>{if(Z)Z9(Z)}})}function HQ(J){return(Q)=>new P1((Y)=>{let Z=0,X=!1,G=null,V=Q.subscribe({next(K){try{let q=J(K,Z++);if(G)Z9(G);G=q.subscribe({next(W){Y.next(W)},error(W){Y.error(W)},complete(){if(G=null,X&&!G)Y.complete()}})}catch(q){Y.error(q)}},error(K){Y.error(K)},complete(){if(X=!0,!G)Y.complete()}});return()=>{if(Z9(V),G)Z9(G)}})}function RC({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new P1((Z)=>{J?.();let X=Y.subscribe(Z);return()=>{Z9(X),Q?.()}})}function AK(J){return(Q)=>P1.from(Q).pipe(V6((Y)=>n0((Z)=>J(Y,Z))))}function y9(J){return(Q)=>new P1((Y)=>{let Z,X=Q.subscribe({next(G){Y.next(G)},error(G){try{Z=J(G).subscribe({next(K){Y.next(K)},error(K){Y.error(K)},complete(){Y.complete()}})}catch(V){Y.error(V)}},complete(){Y.complete()}});return()=>{if(Z9(X),Z)Z9(Z)}})}function u4(J){return(Q)=>{return new P1((Y)=>{let Z=Q.subscribe({next(X){if(J(X))Y.next(X)},error(X){Y.error(X)},complete(){Y.complete()}});return()=>Z9(Z)})}}function IW0(J,Q){return(Y)=>{return new P1((Z)=>{let X,G=0,V=new fD(Z),K=Y.subscribe({complete(){V.complete()},error(q){V.error(q)},next(q){V.schedule(async(W)=>{X=await J(G===0?typeof Q>"u"?q:Q:X,q,G++),W(X)})}});return()=>Z9(K)})}}var IC,gY,Tf8,y04=0,MW0,Sd;var dZ1=i(()=>{hD();uZ1();jd();IC=new P1((J)=>{J.complete()}),gY=new P1(()=>{});Tf8=Symbol("noInitialValue");MW0={};Sd=class Sd extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function KO(J,Q){return(Y)=>{return P1.from(Y).pipe(V6((Z)=>Z===KG?P1.of(KG):J(Z).pipe(y9((X)=>P1.of(X instanceof Error?X:Error(X))),H4(KG))),$4(Q))}}function cZ1(){return(J)=>P1.from(J).pipe(u4((Q)=>Q!==KG))}async function EW0(J,Q){let Y=await A0(P1.from(J).pipe(cZ1()),Q);if(Y instanceof Error)throw Y;return Y}var KG;var RW0=i(()=>{hD();dZ1();KG=Symbol.for("@@pendingOperation")});function jW0(...J){return new P1((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}var PW0=i(()=>{hD()});var G0=i(()=>{wW0();hD();RW0();dZ1();uZ1();jd();PW0()});function p3(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function pD(J){return!!J&&!!J[zQ]}function JH(J){if(!J)return!1;return kW0(J)||Array.isArray(J)||!!J[jC]||!!J.constructor?.[jC]||SC(J)||kC(J)}function kW0(J){if(!J||typeof J!=="object")return!1;let Q=uD(J);if(Q===null)return!0;let Y=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(Y===Object)return!0;return typeof Y=="function"&&Function.toString.call(Y)===v04}function PC(J,Q){if(dD(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,Z)=>Q(Z,Y,J))}function dD(J){let Q=J[zQ];return Q?Q.type_:Array.isArray(J)?1:SC(J)?2:kC(J)?3:0}function TC(J,Q){return dD(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function lZ1(J,Q){return dD(J)===2?J.get(Q):J[Q]}function yW0(J,Q,Y){let Z=dD(J);if(Z===2)J.set(Q,Y);else if(Z===3)J.add(Y);else J[Q]=Y}function b04(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function SC(J){return J instanceof Map}function kC(J){return J instanceof Set}function mD(J){return J.copy_||J.base_}function aZ1(J,Q){if(SC(J))return new Map(J);if(kC(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=kW0(J);if(Q===!0||Q==="class_only"&&!Y){let Z=Object.getOwnPropertyDescriptors(J);delete Z[zQ];let X=Reflect.ownKeys(Z);for(let G=0;G<X.length;G++){let V=X[G],K=Z[V];if(K.writable===!1)K.writable=!0,K.configurable=!0;if(K.get||K.set)Z[V]={configurable:!0,writable:!0,enumerable:K.enumerable,value:J[V]}}return Object.create(uD(J),Z)}else{let Z=uD(J);if(Z!==null&&Y)return{...J};let X=Object.create(Z);return Object.assign(X,J)}}function UQ(J,Q=!1){if(xd(J)||pD(J)||!JH(J))return J;if(dD(J)>1)J.set=J.add=J.clear=J.delete=f04;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,Z])=>UQ(Z,!0));return J}function f04(){p3(2)}function xd(J){return Object.isFrozen(J)}function cD(J){let Q=oZ1[J];if(!Q)p3(0,J);return Q}function h04(J,Q){if(!oZ1[J])oZ1[J]=Q}function xW0(){return CC}function g04(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function TW0(J,Q){if(Q)cD("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function rZ1(J){sZ1(J),J.drafts_.forEach(m04),J.drafts_=null}function sZ1(J){if(J===CC)CC=J.parent_}function CW0(J){return CC=g04(CC,J)}function m04(J){let Q=J[zQ];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function _W0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[zQ].modified_)rZ1(Q),p3(4);if(JH(J)){if(J=kd(Q,J),!Q.parent_)yd(Q,J)}if(Q.patches_)cD("Patches").generateReplacementPatches_(Y[zQ].base_,J,Q.patches_,Q.inversePatches_)}else J=kd(Q,Y,[]);if(rZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==JX1?J:void 0}function kd(J,Q,Y){if(xd(Q))return Q;let Z=Q[zQ];if(!Z)return PC(Q,(X,G)=>SW0(J,Z,Q,X,G,Y)),Q;if(Z.scope_!==J)return Q;if(!Z.modified_)return yd(J,Z.base_,!0),Z.base_;if(!Z.finalized_){Z.finalized_=!0,Z.scope_.unfinalizedDrafts_--;let X=Z.copy_,G=X,V=!1;if(Z.type_===3)G=new Set(X),X.clear(),V=!0;if(PC(G,(K,q)=>SW0(J,Z,X,K,q,Y,V)),yd(J,X,!1),Y&&J.patches_)cD("Patches").generatePatches_(Z,Y,J.patches_,J.inversePatches_)}return Z.copy_}function SW0(J,Q,Y,Z,X,G,V){if(pD(X)){let K=G&&Q&&Q.type_!==3&&!TC(Q.assigned_,Z)?G.concat(Z):void 0,q=kd(J,X,K);if(yW0(Y,Z,q),pD(q))J.canAutoFreeze_=!1;else return}else if(V)Y.add(X);if(JH(X)&&!xd(X)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(kd(J,X),(!Q||!Q.scope_.parent_)&&typeof Z!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,Z))yd(J,X)}}function yd(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)UQ(Q,Y)}function u04(J,Q){let Y=Array.isArray(J),Z={type_:Y?1:0,scope_:Q?Q.scope_:xW0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},X=Z,G=QX1;if(Y)X=[Z],G=_C;let{revoke:V,proxy:K}=Proxy.revocable(X,G);return Z.draft_=K,Z.revoke_=V,K}function iZ1(J,Q){let Y=J[zQ];return(Y?mD(Y):J)[Q]}function p04(J,Q,Y){let Z=vW0(Q,Y);return Z?"value"in Z?Z.value:Z.get?.call(J.draft_):void 0}function vW0(J,Q){if(!(Q in J))return;let Y=uD(J);while(Y){let Z=Object.getOwnPropertyDescriptor(Y,Q);if(Z)return Z;Y=uD(Y)}return}function tZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)tZ1(J.parent_)}}function nZ1(J){if(!J.copy_)J.copy_=aZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function eZ1(J,Q){let Y=SC(J)?cD("MapSet").proxyMap_(J,Q):kC(J)?cD("MapSet").proxySet_(J,Q):u04(J,Q);return(Q?Q.scope_:xW0()).drafts_.push(Y),Y}function c04(J){if(!pD(J))p3(10,J);return bW0(J)}function bW0(J){if(!JH(J)||xd(J))return J;let Q=J[zQ],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=aZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=aZ1(J,!0);if(PC(Y,(Z,X)=>{yW0(Y,Z,bW0(X))}),Q)Q.finalized_=!1;return Y}function vd(){let Q="replace",Y="add",Z="remove";function X(F,U,D,B){switch(F.type_){case 0:case 2:return V(F,U,D,B);case 1:return G(F,U,D,B);case 3:return K(F,U,D,B)}}function G(F,U,D,B){let{base_:N,assigned_:w}=F,M=F.copy_;if(M.length<N.length)[N,M]=[M,N],[D,B]=[B,D];for(let L=0;L<N.length;L++)if(w[L]&&M[L]!==N[L]){let O=U.concat([L]);D.push({op:Q,path:O,value:z(M[L])}),B.push({op:Q,path:O,value:z(N[L])})}for(let L=N.length;L<M.length;L++){let O=U.concat([L]);D.push({op:Y,path:O,value:z(M[L])})}for(let L=M.length-1;N.length<=L;--L){let O=U.concat([L]);B.push({op:Z,path:O})}}function V(F,U,D,B){let{base_:N,copy_:w}=F;PC(F.assigned_,(M,L)=>{let O=lZ1(N,M),A=lZ1(w,M),I=!L?Z:TC(N,M)?Q:Y;if(O===A&&I===Q)return;let P=U.concat(M);D.push(I===Z?{op:I,path:P}:{op:I,path:P,value:A}),B.push(I===Y?{op:Z,path:P}:I===Z?{op:Y,path:P,value:z(O)}:{op:Q,path:P,value:z(O)})})}function K(F,U,D,B){let{base_:N,copy_:w}=F,M=0;N.forEach((L)=>{if(!w.has(L)){let O=U.concat([M]);D.push({op:Z,path:O,value:L}),B.unshift({op:Y,path:O,value:L})}M++}),M=0,w.forEach((L)=>{if(!N.has(L)){let O=U.concat([M]);D.push({op:Y,path:O,value:L}),B.unshift({op:Z,path:O,value:L})}M++})}function q(F,U,D,B){D.push({op:Q,path:[],value:U===JX1?void 0:U}),B.push({op:Q,path:[],value:F})}function W(F,U){return U.forEach((D)=>{let{path:B,op:N}=D,w=F;for(let A=0;A<B.length-1;A++){let I=dD(w),P=B[A];if(typeof P!=="string"&&typeof P!=="number")P=""+P;if((I===0||I===1)&&(P==="__proto__"||P==="constructor"))p3(19);if(typeof w==="function"&&P==="prototype")p3(19);if(w=lZ1(w,P),typeof w!=="object")p3(18,B.join("/"))}let M=dD(w),L=H(D.value),O=B[B.length-1];switch(N){case Q:switch(M){case 2:return w.set(O,L);case 3:p3(16);default:return w[O]=L}case Y:switch(M){case 1:return O==="-"?w.push(L):w.splice(O,0,L);case 2:return w.set(O,L);case 3:return w.add(L);default:return w[O]=L}case Z:switch(M){case 1:return w.splice(O,1);case 2:return w.delete(O);case 3:return w.delete(D.value);default:return delete w[O]}default:p3(17,N)}}),F}function H(F){if(!JH(F))return F;if(Array.isArray(F))return F.map(H);if(SC(F))return new Map(Array.from(F.entries()).map(([D,B])=>[D,H(B)]));if(kC(F))return new Set(Array.from(F).map(H));let U=Object.create(uD(F));for(let D in F)U[D]=H(F[D]);if(TC(F,jC))U[jC]=F[jC];return U}function z(F){if(pD(F))return H(F);else return F}h04("Patches",{applyPatches_:W,generatePatches_:X,generateReplacementPatches_:q})}function S4(J){return J}var JX1,jC,zQ,uD,v04,oZ1,CC,QX1,_C,d04=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Y,Z)=>{if(typeof Q==="function"&&typeof Y!=="function"){let G=Y;Y=Q;let V=this;return function(q=G,...W){return V.produce(q,(H)=>Y.call(this,H,...W))}}if(typeof Y!=="function")p3(6);if(Z!==void 0&&typeof Z!=="function")p3(7);let X;if(JH(Q)){let G=CW0(this),V=eZ1(Q,void 0),K=!0;try{X=Y(V),K=!1}finally{if(K)rZ1(G);else sZ1(G)}return TW0(G,Z),_W0(X,G)}else if(!Q||typeof Q!=="object"){if(X=Y(Q),X===void 0)X=Q;if(X===JX1)X=void 0;if(this.autoFreeze_)UQ(X,!0);if(Z){let G=[],V=[];cD("Patches").generateReplacementPatches_(Q,X,G,V),Z(G,V)}return X}else p3(1,Q)},this.produceWithPatches=(Q,Y)=>{if(typeof Q==="function")return(V,...K)=>this.produceWithPatches(V,(q)=>Q(q,...K));let Z,X;return[this.produce(Q,Y,(V,K)=>{Z=V,X=K}),Z,X]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!JH(J))p3(8);if(pD(J))J=c04(J);let Q=CW0(this),Y=eZ1(J,void 0);return Y[zQ].isManual_=!0,sZ1(Q),Y}finishDraft(J,Q){let Y=J&&J[zQ];if(!Y||!Y.isManual_)p3(9);let{scope_:Z}=Y;return TW0(Z,Q),_W0(void 0,Z)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Y;for(Y=Q.length-1;Y>=0;Y--){let X=Q[Y];if(X.path.length===0&&X.op==="replace"){J=X.value;break}}if(Y>-1)Q=Q.slice(Y+1);let Z=cD("Patches").applyPatches_;if(pD(J))return Z(J,Q);return this.produce(J,(X)=>Z(X,Q))}},FQ,B2,lD,df8,cf8,fW0,lf8,if8;var N2=i(()=>{JX1=Symbol.for("immer-nothing"),jC=Symbol.for("immer-draftable"),zQ=Symbol.for("immer-state");uD=Object.getPrototypeOf;v04=Object.prototype.constructor.toString();oZ1={};QX1={get(J,Q){if(Q===zQ)return J;let Y=mD(J);if(!TC(Y,Q))return p04(J,Y,Q);let Z=Y[Q];if(J.finalized_||!JH(Z))return Z;if(Z===iZ1(J.base_,Q))return nZ1(J),J.copy_[Q]=eZ1(Z,J);return Z},has(J,Q){return Q in mD(J)},ownKeys(J){return Reflect.ownKeys(mD(J))},set(J,Q,Y){let Z=vW0(mD(J),Q);if(Z?.set)return Z.set.call(J.draft_,Y),!0;if(!J.modified_){let X=iZ1(mD(J),Q),G=X?.[zQ];if(G&&G.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(b04(Y,X)&&(Y!==void 0||TC(J.base_,Q)))return!0;nZ1(J),tZ1(J)}if(J.copy_[Q]===Y&&(Y!==void 0||(Q in J.copy_))||Number.isNaN(Y)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Y,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(iZ1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,nZ1(J),tZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=mD(J),Z=Reflect.getOwnPropertyDescriptor(Y,Q);if(!Z)return Z;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:Z.enumerable,value:Y[Q]}},defineProperty(){p3(11)},getPrototypeOf(J){return uD(J.base_)},setPrototypeOf(){p3(12)}},_C={};PC(QX1,(J,Q)=>{_C[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});_C.deleteProperty=function(J,Q){return _C.set.call(this,J,Q,void 0)};_C.set=function(J,Q,Y){return QX1.set.call(this,J[0],Q,Y,J[0])};FQ=new d04,B2=FQ.produce,lD=FQ.produceWithPatches.bind(FQ),df8=FQ.setAutoFreeze.bind(FQ),cf8=FQ.setUseStrictShallowCopy.bind(FQ),fW0=FQ.applyPatches.bind(FQ),lf8=FQ.createDraft.bind(FQ),if8=FQ.finishDraft.bind(FQ)});function hW0(J,Q=0){return(K3[J[Q+0]]+K3[J[Q+1]]+K3[J[Q+2]]+K3[J[Q+3]]+"-"+K3[J[Q+4]]+K3[J[Q+5]]+"-"+K3[J[Q+6]]+K3[J[Q+7]]+"-"+K3[J[Q+8]]+K3[J[Q+9]]+"-"+K3[J[Q+10]]+K3[J[Q+11]]+K3[J[Q+12]]+K3[J[Q+13]]+K3[J[Q+14]]+K3[J[Q+15]]).toLowerCase()}var K3;var gW0=i(()=>{K3=[];for(let J=0;J<256;++J)K3.push((J+256).toString(16).slice(1))});import{randomFillSync as l04}from"crypto";function hd(){if(bd>fd.length-16)l04(fd),bd=0;return fd.slice(bd,bd+=16)}var fd,bd;var mW0=i(()=>{fd=new Uint8Array(256),bd=fd.length});function i04(J,Q,Y){let Z;if(J)Z=uW0(J.random??J.rng?.()??hd(),J.msecs,J.seq,Q,Y);else{let X=Date.now(),G=hd();n04(YX1,X,G),Z=uW0(G,YX1.msecs,YX1.seq,Q,Y)}return Q??hW0(Z)}function n04(J,Q,Y){if(J.msecs??=-1/0,J.seq??=0,Q>J.msecs)J.seq=Y[6]<<23|Y[7]<<16|Y[8]<<8|Y[9],J.msecs=Q;else if(J.seq=J.seq+1|0,J.seq===0)J.msecs++;return J}function uW0(J,Q,Y,Z,X=0){if(J.length<16)throw Error("Random bytes length must be >= 16");if(!Z)Z=new Uint8Array(16),X=0;else if(X<0||X+16>Z.length)throw RangeError(`UUID byte range ${X}:${X+15} is out of buffer bounds`);return Q??=Date.now(),Y??=J[6]*127<<24|J[7]<<16|J[8]<<8|J[9],Z[X++]=Q/1099511627776&255,Z[X++]=Q/4294967296&255,Z[X++]=Q/16777216&255,Z[X++]=Q/65536&255,Z[X++]=Q/256&255,Z[X++]=Q&255,Z[X++]=112|Y>>>28&15,Z[X++]=Y>>>20&255,Z[X++]=128|Y>>>14&63,Z[X++]=Y>>>6&255,Z[X++]=Y<<2&255|J[10]&3,Z[X++]=J[11],Z[X++]=J[12],Z[X++]=J[13],Z[X++]=J[14],Z[X++]=J[15],Z}var YX1,yC;var pW0=i(()=>{mW0();gW0();YX1={};yC=i04});var ZX1=i(()=>{pW0()});function XX1({onlyFirst:J=!1}={}){let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Y,J?void 0:"g")}function qO(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(a04,"")}var a04;var gd=i(()=>{a04=XX1()});var cW0=_((Gh8,$X1)=>{var QH={};if(typeof $X1>"u")window.eastasianwidth=QH;else $X1.exports=QH;QH.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Y=J.length==2?J.charCodeAt(1):0,Z=Q;if(55296<=Q&&Q<=56319&&(56320<=Y&&Y<=57343))Q&=1023,Y&=1023,Z=Q<<10|Y,Z+=65536;if(Z==12288||65281<=Z&&Z<=65376||65504<=Z&&Z<=65510)return"F";if(Z==8361||65377<=Z&&Z<=65470||65474<=Z&&Z<=65479||65482<=Z&&Z<=65487||65490<=Z&&Z<=65495||65498<=Z&&Z<=65500||65512<=Z&&Z<=65518)return"H";if(4352<=Z&&Z<=4447||4515<=Z&&Z<=4519||4602<=Z&&Z<=4607||9001<=Z&&Z<=9002||11904<=Z&&Z<=11929||11931<=Z&&Z<=12019||12032<=Z&&Z<=12245||12272<=Z&&Z<=12283||12289<=Z&&Z<=12350||12353<=Z&&Z<=12438||12441<=Z&&Z<=12543||12549<=Z&&Z<=12589||12593<=Z&&Z<=12686||12688<=Z&&Z<=12730||12736<=Z&&Z<=12771||12784<=Z&&Z<=12830||12832<=Z&&Z<=12871||12880<=Z&&Z<=13054||13056<=Z&&Z<=19903||19968<=Z&&Z<=42124||42128<=Z&&Z<=42182||43360<=Z&&Z<=43388||44032<=Z&&Z<=55203||55216<=Z&&Z<=55238||55243<=Z&&Z<=55291||63744<=Z&&Z<=64255||65040<=Z&&Z<=65049||65072<=Z&&Z<=65106||65108<=Z&&Z<=65126||65128<=Z&&Z<=65131||110592<=Z&&Z<=110593||127488<=Z&&Z<=127490||127504<=Z&&Z<=127546||127552<=Z&&Z<=127560||127568<=Z&&Z<=127569||131072<=Z&&Z<=194367||177984<=Z&&Z<=196605||196608<=Z&&Z<=262141)return"W";if(32<=Z&&Z<=126||162<=Z&&Z<=163||165<=Z&&Z<=166||Z==172||Z==175||10214<=Z&&Z<=10221||10629<=Z&&Z<=10630)return"Na";if(Z==161||Z==164||167<=Z&&Z<=168||Z==170||173<=Z&&Z<=174||176<=Z&&Z<=180||182<=Z&&Z<=186||188<=Z&&Z<=191||Z==198||Z==208||215<=Z&&Z<=216||222<=Z&&Z<=225||Z==230||232<=Z&&Z<=234||236<=Z&&Z<=237||Z==240||242<=Z&&Z<=243||247<=Z&&Z<=250||Z==252||Z==254||Z==257||Z==273||Z==275||Z==283||294<=Z&&Z<=295||Z==299||305<=Z&&Z<=307||Z==312||319<=Z&&Z<=322||Z==324||328<=Z&&Z<=331||Z==333||338<=Z&&Z<=339||358<=Z&&Z<=359||Z==363||Z==462||Z==464||Z==466||Z==468||Z==470||Z==472||Z==474||Z==476||Z==593||Z==609||Z==708||Z==711||713<=Z&&Z<=715||Z==717||Z==720||728<=Z&&Z<=731||Z==733||Z==735||768<=Z&&Z<=879||913<=Z&&Z<=929||931<=Z&&Z<=937||945<=Z&&Z<=961||963<=Z&&Z<=969||Z==1025||1040<=Z&&Z<=1103||Z==1105||Z==8208||8211<=Z&&Z<=8214||8216<=Z&&Z<=8217||8220<=Z&&Z<=8221||8224<=Z&&Z<=8226||8228<=Z&&Z<=8231||Z==8240||8242<=Z&&Z<=8243||Z==8245||Z==8251||Z==8254||Z==8308||Z==8319||8321<=Z&&Z<=8324||Z==8364||Z==8451||Z==8453||Z==8457||Z==8467||Z==8470||8481<=Z&&Z<=8482||Z==8486||Z==8491||8531<=Z&&Z<=8532||8539<=Z&&Z<=8542||8544<=Z&&Z<=8555||8560<=Z&&Z<=8569||Z==8585||8592<=Z&&Z<=8601||8632<=Z&&Z<=8633||Z==8658||Z==8660||Z==8679||Z==8704||8706<=Z&&Z<=8707||8711<=Z&&Z<=8712||Z==8715||Z==8719||Z==8721||Z==8725||Z==8730||8733<=Z&&Z<=8736||Z==8739||Z==8741||8743<=Z&&Z<=8748||Z==8750||8756<=Z&&Z<=8759||8764<=Z&&Z<=8765||Z==8776||Z==8780||Z==8786||8800<=Z&&Z<=8801||8804<=Z&&Z<=8807||8810<=Z&&Z<=8811||8814<=Z&&Z<=8815||8834<=Z&&Z<=8835||8838<=Z&&Z<=8839||Z==8853||Z==8857||Z==8869||Z==8895||Z==8978||9312<=Z&&Z<=9449||9451<=Z&&Z<=9547||9552<=Z&&Z<=9587||9600<=Z&&Z<=9615||9618<=Z&&Z<=9621||9632<=Z&&Z<=9633||9635<=Z&&Z<=9641||9650<=Z&&Z<=9651||9654<=Z&&Z<=9655||9660<=Z&&Z<=9661||9664<=Z&&Z<=9665||9670<=Z&&Z<=9672||Z==9675||9678<=Z&&Z<=9681||9698<=Z&&Z<=9701||Z==9711||9733<=Z&&Z<=9734||Z==9737||9742<=Z&&Z<=9743||9748<=Z&&Z<=9749||Z==9756||Z==9758||Z==9792||Z==9794||9824<=Z&&Z<=9825||9827<=Z&&Z<=9829||9831<=Z&&Z<=9834||9836<=Z&&Z<=9837||Z==9839||9886<=Z&&Z<=9887||9918<=Z&&Z<=9919||9924<=Z&&Z<=9933||9935<=Z&&Z<=9953||Z==9955||9960<=Z&&Z<=9983||Z==10045||Z==10071||10102<=Z&&Z<=10111||11093<=Z&&Z<=11097||12872<=Z&&Z<=12879||57344<=Z&&Z<=63743||65024<=Z&&Z<=65039||Z==65533||127232<=Z&&Z<=127242||127248<=Z&&Z<=127277||127280<=Z&&Z<=127337||127344<=Z&&Z<=127386||917760<=Z&&Z<=917999||983040<=Z&&Z<=1048573||1048576<=Z&&Z<=1114109)return"A";return"N"};QH.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function dW0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}QH.length=function(J){var Q=dW0(J),Y=0;for(var Z=0;Z<Q.length;Z++)Y=Y+this.characterLength(Q[Z]);return Y};QH.slice=function(J,Q,Y){if(textLen=QH.length(J),Q=Q?Q:0,Y=Y?Y:1,Q<0)Q=textLen+Q;if(Y<0)Y=textLen+Y;var Z="",X=0,G=dW0(J);for(var V=0;V<G.length;V++){var K=G[V],q=QH.length(K);if(X>=Q-(q==2?1:0))if(X+q<=Y)Z+=K;else break;X+=q}return Z}});var GX1=_((Vh8,lW0)=>{lW0.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var o04,r04;var iW0=i(()=>{gd();o04=H0(cW0(),1),r04=H0(GX1(),1)});function WO(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var md=i(()=>{iW0()});var nW0="run_terminal_command",VX1="read_file",w2="Task",mY="task_list",T8="finder",AX="get_diagnostics",x9="Bash",v9="oracle",IK="mermaid",aW0="walkthrough",ud="walkthrough_diagram",qG="todo_read",A9="todo_write",LJ="read_web_page",HO="read_thread",pd="find_thread",Z5="create_file",uY="glob",dd="undo_edit",cd="read_mcp_resource",R6="Read",X5="edit_file",zO="format_file",pY="web_search",E8="Grep",iD="Check",oW0="code_review",WG="librarian",FO="kraken",ld="look_at",id="read_github",nd="search_github",ad="commit_search",od="list_directory_github",rd="list_repositories",sd="glob_github",td="diff",M2="skill",ed="repl",rW0="handoff",Jc="illustrator",sW0;var j6=i(()=>{sW0=["Task","task_list","finder","get_diagnostics","Bash","oracle","mermaid","walkthrough","walkthrough_diagram","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","look_at","librarian","read_thread","find_thread","skill","read_github","search_github","commit_search","list_directory_github","list_repositories","glob_github","diff","handoff","illustrator"]});var xC=_((Uh8,eW0)=>{var tW0={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},s04={...tW0,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},t04={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};eW0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:t04,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(J){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${J.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(J){return J===!0?s04:tW0}}});var vC=_((Z64)=>{var{REGEX_BACKSLASH:e04,REGEX_REMOVE_BACKSLASH:J64,REGEX_SPECIAL_CHARS:Q64,REGEX_SPECIAL_CHARS_GLOBAL:Y64}=xC();Z64.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);Z64.hasRegexChars=(J)=>Q64.test(J);Z64.isRegexChar=(J)=>J.length===1&&Z64.hasRegexChars(J);Z64.escapeRegex=(J)=>J.replace(Y64,"\\$1");Z64.toPosixSlashes=(J)=>J.replace(e04,"/");Z64.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};Z64.removeBackslashes=(J)=>{return J.replace(J64,(Q)=>{return Q==="\\"?"":Q})};Z64.escapeLast=(J,Q,Y)=>{let Z=J.lastIndexOf(Q,Y);if(Z===-1)return J;if(J[Z-1]==="\\")return Z64.escapeLast(J,Q,Z-1);return`${J.slice(0,Z)}\\${J.slice(Z)}`};Z64.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};Z64.wrapOutput=(J,Q={},Y={})=>{let Z=Y.contains?"":"^",X=Y.contains?"":"$",G=`${Z}(?:${J})${X}`;if(Q.negated===!0)G=`(?:^(?!${G}).*$)`;return G};Z64.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),Z=Y[Y.length-1];if(Z==="")return Y[Y.length-2];return Z}});var qH0=_((Bh8,KH0)=>{var YH0=vC(),{CHAR_ASTERISK:KX1,CHAR_AT:F64,CHAR_BACKWARD_SLASH:bC,CHAR_COMMA:U64,CHAR_DOT:qX1,CHAR_EXCLAMATION_MARK:WX1,CHAR_FORWARD_SLASH:VH0,CHAR_LEFT_CURLY_BRACE:HX1,CHAR_LEFT_PARENTHESES:zX1,CHAR_LEFT_SQUARE_BRACKET:D64,CHAR_PLUS:B64,CHAR_QUESTION_MARK:ZH0,CHAR_RIGHT_CURLY_BRACE:N64,CHAR_RIGHT_PARENTHESES:XH0,CHAR_RIGHT_SQUARE_BRACKET:w64}=xC(),$H0=(J)=>{return J===VH0||J===bC},GH0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},M64=(J,Q)=>{let Y=Q||{},Z=J.length-1,X=Y.parts===!0||Y.scanToEnd===!0,G=[],V=[],K=[],q=J,W=-1,H=0,z=0,F=!1,U=!1,D=!1,B=!1,N=!1,w=!1,M=!1,L=!1,O=!1,A=!1,I=0,P,C,y={value:"",depth:0,isGlob:!1},S=()=>W>=Z,x=()=>q.charCodeAt(W+1),c=()=>{return P=C,q.charCodeAt(++W)};while(W<Z){C=c();let d;if(C===bC){if(M=y.backslashes=!0,C=c(),C===HX1)w=!0;continue}if(w===!0||C===HX1){I++;while(S()!==!0&&(C=c())){if(C===bC){M=y.backslashes=!0,c();continue}if(C===HX1){I++;continue}if(w!==!0&&C===qX1&&(C=c())===qX1){if(F=y.isBrace=!0,D=y.isGlob=!0,A=!0,X===!0)continue;break}if(w!==!0&&C===U64){if(F=y.isBrace=!0,D=y.isGlob=!0,A=!0,X===!0)continue;break}if(C===N64){if(I--,I===0){w=!1,F=y.isBrace=!0,A=!0;break}}}if(X===!0)continue;break}if(C===VH0){if(G.push(W),V.push(y),y={value:"",depth:0,isGlob:!1},A===!0)continue;if(P===qX1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((C===B64||C===F64||C===KX1||C===ZH0||C===WX1)===!0&&x()===zX1){if(D=y.isGlob=!0,B=y.isExtglob=!0,A=!0,C===WX1&&W===H)O=!0;if(X===!0){while(S()!==!0&&(C=c())){if(C===bC){M=y.backslashes=!0,C=c();continue}if(C===XH0){D=y.isGlob=!0,A=!0;break}}continue}break}}if(C===KX1){if(P===KX1)N=y.isGlobstar=!0;if(D=y.isGlob=!0,A=!0,X===!0)continue;break}if(C===ZH0){if(D=y.isGlob=!0,A=!0,X===!0)continue;break}if(C===D64){while(S()!==!0&&(d=c())){if(d===bC){M=y.backslashes=!0,c();continue}if(d===w64){U=y.isBracket=!0,D=y.isGlob=!0,A=!0;break}}if(X===!0)continue;break}if(Y.nonegate!==!0&&C===WX1&&W===H){L=y.negated=!0,H++;continue}if(Y.noparen!==!0&&C===zX1){if(D=y.isGlob=!0,X===!0){while(S()!==!0&&(C=c())){if(C===zX1){M=y.backslashes=!0,C=c();continue}if(C===XH0){A=!0;break}}continue}break}if(D===!0){if(A=!0,X===!0)continue;break}}if(Y.noext===!0)B=!1,D=!1;let m=q,v="",b="";if(H>0)v=q.slice(0,H),q=q.slice(H),z-=H;if(m&&D===!0&&z>0)m=q.slice(0,z),b=q.slice(z);else if(D===!0)m="",b=q;else m=q;if(m&&m!==""&&m!=="/"&&m!==q){if($H0(m.charCodeAt(m.length-1)))m=m.slice(0,-1)}if(Y.unescape===!0){if(b)b=YH0.removeBackslashes(b);if(m&&M===!0)m=YH0.removeBackslashes(m)}let u={prefix:v,input:J,start:H,base:m,glob:b,isBrace:F,isBracket:U,isGlob:D,isExtglob:B,isGlobstar:N,negated:L,negatedExtglob:O};if(Y.tokens===!0){if(u.maxDepth=0,!$H0(C))V.push(y);u.tokens=V}if(Y.parts===!0||Y.tokens===!0){let d;for(let h=0;h<G.length;h++){let l=d?d+1:H,g=G[h],V1=J.slice(l,g);if(Y.tokens){if(h===0&&H!==0)V[h].isPrefix=!0,V[h].value=v;else V[h].value=V1;GH0(V[h]),u.maxDepth+=V[h].depth}if(h!==0||V1!=="")K.push(V1);d=g}if(d&&d+1<J.length){let h=J.slice(d+1);if(K.push(h),Y.tokens)V[V.length-1].value=h,GH0(V[V.length-1]),u.maxDepth+=V[V.length-1].depth}u.slashes=G,u.parts=K}return u};KH0.exports=M64});var zH0=_((Nh8,HH0)=>{var Qc=xC(),HG=vC(),{MAX_LENGTH:Yc,POSIX_REGEX_SOURCE:L64,REGEX_NON_SPECIAL_CHARS:O64,REGEX_SPECIAL_CHARS_BACKREF:A64,REPLACEMENTS:WH0}=Qc,I64=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Y=`[${J.join("-")}]`;try{new RegExp(Y)}catch(Z){return J.map((X)=>HG.escapeRegex(X)).join("..")}return Y},UO=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},FX1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=WH0[J]||J;let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Yc,Y.maxLength):Yc,X=J.length;if(X>Z)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Z}`);let G={type:"bos",value:"",output:Y.prepend||""},V=[G],K=Y.capture?"":"?:",q=Qc.globChars(Y.windows),W=Qc.extglobChars(q),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:F,ONE_CHAR:U,DOTS_SLASH:D,NO_DOT:B,NO_DOT_SLASH:N,NO_DOTS_SLASH:w,QMARK:M,QMARK_NO_DOT:L,STAR:O,START_ANCHOR:A}=q,I=(L1)=>{return`(${K}(?:(?!${A}${L1.dot?D:H}).)*?)`},P=Y.dot?"":B,C=Y.dot?M:L,y=Y.bash===!0?I(Y):O;if(Y.capture)y=`(${y})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let S={input:J,index:-1,start:0,dot:Y.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};J=HG.removePrefix(J,S),X=J.length;let x=[],c=[],m=[],v=G,b,u=()=>S.index===X-1,d=S.peek=(L1=1)=>J[S.index+L1],h=S.advance=()=>J[++S.index]||"",l=()=>J.slice(S.index+1),g=(L1="",r=0)=>{S.consumed+=L1,S.index+=r},V1=(L1)=>{S.output+=L1.output!=null?L1.output:L1.value,g(L1.value)},O1=()=>{let L1=1;while(d()==="!"&&(d(2)!=="("||d(3)==="?"))h(),S.start++,L1++;if(L1%2===0)return!1;return S.negated=!0,S.start++,!0},a=(L1)=>{S[L1]++,m.push(L1)},N1=(L1)=>{S[L1]--,m.pop()},M1=(L1)=>{if(v.type==="globstar"){let r=S.braces>0&&(L1.type==="comma"||L1.type==="brace"),Q1=L1.extglob===!0||x.length&&(L1.type==="pipe"||L1.type==="paren");if(L1.type!=="slash"&&L1.type!=="paren"&&!r&&!Q1)S.output=S.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=y,S.output+=v.output}if(x.length&&L1.type!=="paren")x[x.length-1].inner+=L1.value;if(L1.value||L1.output)V1(L1);if(v&&v.type==="text"&&L1.type==="text"){v.output=(v.output||v.value)+L1.value,v.value+=L1.value;return}L1.prev=v,V.push(L1),v=L1},S1=(L1,r)=>{let Q1={...W[r],conditions:1,inner:""};Q1.prev=v,Q1.parens=S.parens,Q1.output=S.output;let s=(Y.capture?"(":"")+Q1.open;a("parens"),M1({type:L1,value:r,output:S.output?"":U}),M1({type:"paren",extglob:!0,value:h(),output:s}),x.push(Q1)},B1=(L1)=>{let r=L1.close+(Y.capture?")":""),Q1;if(L1.type==="negate"){let s=y;if(L1.inner&&L1.inner.length>1&&L1.inner.includes("/"))s=I(Y);if(s!==y||u()||/^\)+$/.test(l()))r=L1.close=`)$))${s}`;if(L1.inner.includes("*")&&(Q1=l())&&/^\.[^\\/.]+$/.test(Q1)){let n=FX1(Q1,{...Q,fastpaths:!1}).output;r=L1.close=`)${n})${s})`}if(L1.prev.type==="bos")S.negatedExtglob=!0}M1({type:"paren",extglob:!0,value:b,output:r}),N1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let L1=!1,r=J.replace(A64,(Q1,s,n,Y1,J1,H1)=>{if(Y1==="\\")return L1=!0,Q1;if(Y1==="?"){if(s)return s+Y1+(J1?M.repeat(J1.length):"");if(H1===0)return C+(J1?M.repeat(J1.length):"");return M.repeat(n.length)}if(Y1===".")return H.repeat(n.length);if(Y1==="*"){if(s)return s+Y1+(J1?y:"");return y}return s?Q1:`\\${Q1}`});if(L1===!0)if(Y.unescape===!0)r=r.replace(/\\/g,"");else r=r.replace(/\\+/g,(Q1)=>{return Q1.length%2===0?"\\\\":Q1?"\\":""});if(r===J&&Y.contains===!0)return S.output=J,S;return S.output=HG.wrapOutput(r,S,Q),S}while(!u()){if(b=h(),b==="\x00")continue;if(b==="\\"){let Q1=d();if(Q1==="/"&&Y.bash!==!0)continue;if(Q1==="."||Q1===";")continue;if(!Q1){b+="\\",M1({type:"text",value:b});continue}let s=/^\\+/.exec(l()),n=0;if(s&&s[0].length>2){if(n=s[0].length,S.index+=n,n%2!==0)b+="\\"}if(Y.unescape===!0)b=h();else b+=h();if(S.brackets===0){M1({type:"text",value:b});continue}}if(S.brackets>0&&(b!=="]"||v.value==="["||v.value==="[^")){if(Y.posix!==!1&&b===":"){let Q1=v.value.slice(1);if(Q1.includes("[")){if(v.posix=!0,Q1.includes(":")){let s=v.value.lastIndexOf("["),n=v.value.slice(0,s),Y1=v.value.slice(s+2),J1=L64[Y1];if(J1){if(v.value=n+J1,S.backtrack=!0,h(),!G.output&&V.indexOf(v)===1)G.output=U;continue}}}}if(b==="["&&d()!==":"||b==="-"&&d()==="]")b=`\\${b}`;if(b==="]"&&(v.value==="["||v.value==="[^"))b=`\\${b}`;if(Y.posix===!0&&b==="!"&&v.value==="[")b="^";v.value+=b,V1({value:b});continue}if(S.quotes===1&&b!=='"'){b=HG.escapeRegex(b),v.value+=b,V1({value:b});continue}if(b==='"'){if(S.quotes=S.quotes===1?0:1,Y.keepQuotes===!0)M1({type:"text",value:b});continue}if(b==="("){a("parens"),M1({type:"paren",value:b});continue}if(b===")"){if(S.parens===0&&Y.strictBrackets===!0)throw SyntaxError(UO("opening","("));let Q1=x[x.length-1];if(Q1&&S.parens===Q1.parens+1){B1(x.pop());continue}M1({type:"paren",value:b,output:S.parens?")":"\\)"}),N1("parens");continue}if(b==="["){if(Y.nobracket===!0||!l().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(UO("closing","]"));b=`\\${b}`}else a("brackets");M1({type:"bracket",value:b});continue}if(b==="]"){if(Y.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){M1({type:"text",value:b,output:`\\${b}`});continue}if(S.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(UO("opening","["));M1({type:"text",value:b,output:`\\${b}`});continue}N1("brackets");let Q1=v.value.slice(1);if(v.posix!==!0&&Q1[0]==="^"&&!Q1.includes("/"))b=`/${b}`;if(v.value+=b,V1({value:b}),Y.literalBrackets===!1||HG.hasRegexChars(Q1))continue;let s=HG.escapeRegex(v.value);if(S.output=S.output.slice(0,-v.value.length),Y.literalBrackets===!0){S.output+=s,v.value=s;continue}v.value=`(${K}${s}|${v.value})`,S.output+=v.value;continue}if(b==="{"&&Y.nobrace!==!0){a("braces");let Q1={type:"brace",value:b,output:"(",outputIndex:S.output.length,tokensIndex:S.tokens.length};c.push(Q1),M1(Q1);continue}if(b==="}"){let Q1=c[c.length-1];if(Y.nobrace===!0||!Q1){M1({type:"text",value:b,output:b});continue}let s=")";if(Q1.dots===!0){let n=V.slice(),Y1=[];for(let J1=n.length-1;J1>=0;J1--){if(V.pop(),n[J1].type==="brace")break;if(n[J1].type!=="dots")Y1.unshift(n[J1].value)}s=I64(Y1,Y),S.backtrack=!0}if(Q1.comma!==!0&&Q1.dots!==!0){let n=S.output.slice(0,Q1.outputIndex),Y1=S.tokens.slice(Q1.tokensIndex);Q1.value=Q1.output="\\{",b=s="\\}",S.output=n;for(let J1 of Y1)S.output+=J1.output||J1.value}M1({type:"brace",value:b,output:s}),N1("braces"),c.pop();continue}if(b==="|"){if(x.length>0)x[x.length-1].conditions++;M1({type:"text",value:b});continue}if(b===","){let Q1=b,s=c[c.length-1];if(s&&m[m.length-1]==="braces")s.comma=!0,Q1="|";M1({type:"comma",value:b,output:Q1});continue}if(b==="/"){if(v.type==="dot"&&S.index===S.start+1){S.start=S.index+1,S.consumed="",S.output="",V.pop(),v=G;continue}M1({type:"slash",value:b,output:F});continue}if(b==="."){if(S.braces>0&&v.type==="dot"){if(v.value===".")v.output=H;let Q1=c[c.length-1];v.type="dots",v.output+=b,v.value+=b,Q1.dots=!0;continue}if(S.braces+S.parens===0&&v.type!=="bos"&&v.type!=="slash"){M1({type:"text",value:b,output:H});continue}M1({type:"dot",value:b,output:H});continue}if(b==="?"){if(!(v&&v.value==="(")&&Y.noextglob!==!0&&d()==="("&&d(2)!=="?"){S1("qmark",b);continue}if(v&&v.type==="paren"){let s=d(),n=b;if(v.value==="("&&!/[!=<:]/.test(s)||s==="<"&&!/<([!=]|\w+>)/.test(l()))n=`\\${b}`;M1({type:"text",value:b,output:n});continue}if(Y.dot!==!0&&(v.type==="slash"||v.type==="bos")){M1({type:"qmark",value:b,output:L});continue}M1({type:"qmark",value:b,output:M});continue}if(b==="!"){if(Y.noextglob!==!0&&d()==="("){if(d(2)!=="?"||!/[!=<:]/.test(d(3))){S1("negate",b);continue}}if(Y.nonegate!==!0&&S.index===0){O1();continue}}if(b==="+"){if(Y.noextglob!==!0&&d()==="("&&d(2)!=="?"){S1("plus",b);continue}if(v&&v.value==="("||Y.regex===!1){M1({type:"plus",value:b,output:z});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||S.parens>0){M1({type:"plus",value:b});continue}M1({type:"plus",value:z});continue}if(b==="@"){if(Y.noextglob!==!0&&d()==="("&&d(2)!=="?"){M1({type:"at",extglob:!0,value:b,output:""});continue}M1({type:"text",value:b});continue}if(b!=="*"){if(b==="$"||b==="^")b=`\\${b}`;let Q1=O64.exec(l());if(Q1)b+=Q1[0],S.index+=Q1[0].length;M1({type:"text",value:b});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=b,v.output=y,S.backtrack=!0,S.globstar=!0,g(b);continue}let L1=l();if(Y.noextglob!==!0&&/^\([^?]/.test(L1)){S1("star",b);continue}if(v.type==="star"){if(Y.noglobstar===!0){g(b);continue}let Q1=v.prev,s=Q1.prev,n=Q1.type==="slash"||Q1.type==="bos",Y1=s&&(s.type==="star"||s.type==="globstar");if(Y.bash===!0&&(!n||L1[0]&&L1[0]!=="/")){M1({type:"star",value:b,output:""});continue}let J1=S.braces>0&&(Q1.type==="comma"||Q1.type==="brace"),H1=x.length&&(Q1.type==="pipe"||Q1.type==="paren");if(!n&&Q1.type!=="paren"&&!J1&&!H1){M1({type:"star",value:b,output:""});continue}while(L1.slice(0,3)==="/**"){let D1=J[S.index+4];if(D1&&D1!=="/")break;L1=L1.slice(3),g("/**",3)}if(Q1.type==="bos"&&u()){v.type="globstar",v.value+=b,v.output=I(Y),S.output=v.output,S.globstar=!0,g(b);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&!Y1&&u()){S.output=S.output.slice(0,-(Q1.output+v.output).length),Q1.output=`(?:${Q1.output}`,v.type="globstar",v.output=I(Y)+(Y.strictSlashes?")":"|$)"),v.value+=b,S.globstar=!0,S.output+=Q1.output+v.output,g(b);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&L1[0]==="/"){let D1=L1[1]!==void 0?"|$":"";S.output=S.output.slice(0,-(Q1.output+v.output).length),Q1.output=`(?:${Q1.output}`,v.type="globstar",v.output=`${I(Y)}${F}|${F}${D1})`,v.value+=b,S.output+=Q1.output+v.output,S.globstar=!0,g(b+h()),M1({type:"slash",value:"/",output:""});continue}if(Q1.type==="bos"&&L1[0]==="/"){v.type="globstar",v.value+=b,v.output=`(?:^|${F}|${I(Y)}${F})`,S.output=v.output,S.globstar=!0,g(b+h()),M1({type:"slash",value:"/",output:""});continue}S.output=S.output.slice(0,-v.output.length),v.type="globstar",v.output=I(Y),v.value+=b,S.output+=v.output,S.globstar=!0,g(b);continue}let r={type:"star",value:b,output:y};if(Y.bash===!0){if(r.output=".*?",v.type==="bos"||v.type==="slash")r.output=P+r.output;M1(r);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&Y.regex===!0){r.output=b,M1(r);continue}if(S.index===S.start||v.type==="slash"||v.type==="dot"){if(v.type==="dot")S.output+=N,v.output+=N;else if(Y.dot===!0)S.output+=w,v.output+=w;else S.output+=P,v.output+=P;if(d()!=="*")S.output+=U,v.output+=U}M1(r)}while(S.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(UO("closing","]"));S.output=HG.escapeLast(S.output,"["),N1("brackets")}while(S.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(UO("closing",")"));S.output=HG.escapeLast(S.output,"("),N1("parens")}while(S.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(UO("closing","}"));S.output=HG.escapeLast(S.output,"{"),N1("braces")}if(Y.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket"))M1({type:"maybe_slash",value:"",output:`${F}?`});if(S.backtrack===!0){S.output="";for(let L1 of S.tokens)if(S.output+=L1.output!=null?L1.output:L1.value,L1.suffix)S.output+=L1.suffix}return S};FX1.fastpaths=(J,Q)=>{let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Yc,Y.maxLength):Yc,X=J.length;if(X>Z)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Z}`);J=WH0[J]||J;let{DOT_LITERAL:G,SLASH_LITERAL:V,ONE_CHAR:K,DOTS_SLASH:q,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:F,START_ANCHOR:U}=Qc.globChars(Y.windows),D=Y.dot?H:W,B=Y.dot?z:W,N=Y.capture?"":"?:",w={negated:!1,prefix:""},M=Y.bash===!0?".*?":F;if(Y.capture)M=`(${M})`;let L=(P)=>{if(P.noglobstar===!0)return M;return`(${N}(?:(?!${U}${P.dot?q:G}).)*?)`},O=(P)=>{switch(P){case"*":return`${D}${K}${M}`;case".*":return`${G}${K}${M}`;case"*.*":return`${D}${M}${G}${K}${M}`;case"*/*":return`${D}${M}${V}${K}${B}${M}`;case"**":return D+L(Y);case"**/*":return`(?:${D}${L(Y)}${V})?${B}${K}${M}`;case"**/*.*":return`(?:${D}${L(Y)}${V})?${B}${M}${G}${K}${M}`;case"**/.*":return`(?:${D}${L(Y)}${V})?${G}${K}${M}`;default:{let C=/^(.*?)\.(\w+)$/.exec(P);if(!C)return;let y=O(C[1]);if(!y)return;return y+G+C[2]}}},A=HG.removePrefix(J,w),I=O(A);if(I&&Y.strictSlashes!==!0)I+=`${V}?`;return I};HH0.exports=FX1});var fC=_((wh8,UH0)=>{var E64=qH0(),UX1=zH0(),FH0=vC(),R64=xC(),j64=(J)=>J&&typeof J==="object"&&!Array.isArray(J),T5=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((F)=>T5(F,Q,Y));return(F)=>{for(let U of H){let D=U(F);if(D)return D}return!1}}let Z=j64(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!Z)throw TypeError("Expected pattern to be a non-empty string");let X=Q||{},G=X.windows,V=Z?T5.compileRe(J,Q):T5.makeRe(J,Q,!1,!0),K=V.state;delete V.state;let q=()=>!1;if(X.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};q=T5(X.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:F,match:U,output:D}=T5.test(H,V,Q,{glob:J,posix:G}),B={glob:J,state:K,regex:V,posix:G,input:H,output:D,match:U,isMatch:F};if(typeof X.onResult==="function")X.onResult(B);if(F===!1)return B.isMatch=!1,z?B:!1;if(q(H)){if(typeof X.onIgnore==="function")X.onIgnore(B);return B.isMatch=!1,z?B:!1}if(typeof X.onMatch==="function")X.onMatch(B);return z?B:!0};if(Y)W.state=K;return W};T5.test=(J,Q,Y,{glob:Z,posix:X}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let G=Y||{},V=G.format||(X?FH0.toPosixSlashes:null),K=J===Z,q=K&&V?V(J):J;if(K===!1)q=V?V(J):J,K=q===Z;if(K===!1||G.capture===!0)if(G.matchBase===!0||G.basename===!0)K=T5.matchBase(J,Q,Y,X);else K=Q.exec(q);return{isMatch:Boolean(K),match:K,output:q}};T5.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:T5.makeRe(Q,Y)).test(FH0.basename(J))};T5.isMatch=(J,Q,Y)=>T5(Q,Y)(J);T5.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>T5.parse(Y,Q));return UX1(J,{...Q,fastpaths:!1})};T5.scan=(J,Q)=>E64(J,Q);T5.compileRe=(J,Q,Y=!1,Z=!1)=>{if(Y===!0)return J.output;let X=Q||{},G=X.contains?"":"^",V=X.contains?"":"$",K=`${G}(?:${J.output})${V}`;if(J&&J.negated===!0)K=`^(?!${K}).*$`;let q=T5.toRegex(K,Q);if(Z===!0)q.state=J;return q};T5.makeRe=(J,Q={},Y=!1,Z=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let X={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))X.output=UX1.fastpaths(J,Q);if(!X.output)X=UX1(J,Q);return T5.compileRe(X,Q,Y,Z)};T5.toRegex=(J,Q)=>{try{let Y=Q||{};return new RegExp(J,Y.flags||(Y.nocase?"i":""))}catch(Y){if(Q&&Q.debug===!0)throw Y;return/$^/}};T5.constants=R64;UH0.exports=T5});var EK=_((Mh8,NH0)=>{var DH0=fC(),P64=vC();function BH0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:P64.isWindows()};return DH0(J,Q,Y)}Object.assign(BH0,DH0);NH0.exports=BH0});var DO;var DX1=i(()=>{DO={name:"amp",description:"The frontier coding agent, with a highly capable `smart` mode and a fast `free` mode. ",private:!0,displayName:"Amp (Research Preview)",version:"0.0.0-dev",publisher:"sourcegraph",license:"Apache-2.0",categories:["AI","Chat","Programming Languages","Machine Learning"],keywords:["sourcegraph","amp","amp code","ampcode","ai","assistant","llm","Claude","Claude Sonnet 4.5","GPT-5","agent","free","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","dev:watch":"NODE_ENV=development bun run scripts/watch.ts","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","dev:desktop":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop","dev:desktop:insiders":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop:insiders","build:dev:desktop":"NODE_ENV=development bun run scripts/build.ts",build:"pnpm run -s _build:extension && pnpm run -s _build:web","build:production":"pnpm run -s _build:extension:production && pnpm run -s _build:web:production","_build:extension":"NODE_ENV=development bun run scripts/build.ts","_build:extension:production":"NODE_ENV=production bun run scripts/build.ts","_build:web":"pnpm -C ../web run build && cp -R ../web/build dist/web-build","_build:web:production":"pnpm -C ../web run build:production && cp -R ../web/build dist/web-build","build:icon-font":"npx -y svgtofont --sources ./icon-font/svg --output ./icon-font/build && cp ./icon-font/build/amp-icons.woff ./resources","dev:forks":"pnpm dev:vsix && cursor --install-extension dist/amp-dev.vsix --force && windsurf --install-extension dist/amp-dev.vsix --force","dev:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force","prod:vsix":"pnpm run -s build:production && vsce package --no-dependencies --pre-release --out dist/amp-prod.vsix && code --install-extension dist/amp-prod.vsix --force","prod:vsix:test-manual":"bun run scripts/vsix-test-manual.ts","prod:vsix:test-ci":"bun run scripts/vsix-test-ci.ts",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team",email:"amp-devs@ampcode.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.openAgents",title:"Open Agents",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.findInThread",title:"Find in Thread",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.collapseAllInThread",title:"Collapse All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandAllInThread",title:"Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandToggleInThread",title:"Toggle Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.toggleThreadSwitcher",title:"Switch to Thread...",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.toggleDetailedCostsDisplay",title:"Toggle Detailed Costs",category:"Amp",enablement:"amp.isSourcegraphTeammate"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode || amp.isSourcegraphTeammate"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active && amp.agent.activeViewType != 'amp.reviewPanel'"},{command:"amp.agent.toggleDetailedCostsDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"amp.agent.openAgents",key:"ctrl+alt+i",mac:"cmd+alt+i"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.experimental.walkthroughs":{type:"boolean",default:!1,description:"Enable experimental walkthroughs feature.",scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"(Deprecated) Use large mode instead. See https://ampcode.com/news/large-mode",scope:"window",default:!1,deprecationMessage:"This setting has been removed. Use large mode instead: set amp.experimental.agentMode to 'large'. See https://ampcode.com/news/large-mode"},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.fuzzy.alwaysIncludePaths":{type:"array",items:{type:"string"},default:[],markdownDescription:"Glob patterns for paths that should always be included in fuzzy file search, even if they are gitignored. Dotfiles and directories starting with `.` are supported.\n\nExamples:\n- `dist/**`\n- `node_modules/@myorg/**`\n- `.hidden/**`",scope:"window"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debug.logReview":{type:"boolean",default:!1,description:"Enable debug logging for review git operations",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent as a tool for use by the main agent in smart mode.",scope:"window"},"amp.experimental.finalToolCalls":{type:"boolean",default:!1,description:"Enable final tool calls - allows the agent to mark tool calls with __isFinal to prevent follow-up inference.",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"},"amp.showCosts":{type:"boolean",default:!0,description:"Show cost information for threads",scope:"application"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@google/genai":"catalog:","@opentelemetry/api":"catalog:","@opentelemetry/api-logs":"catalog:","@opentelemetry/core":"catalog:","@opentelemetry/exporter-logs-otlp-http":"catalog:","@opentelemetry/exporter-metrics-otlp-http":"catalog:","@opentelemetry/exporter-trace-otlp-http":"catalog:","@opentelemetry/resources":"catalog:","@opentelemetry/sdk-logs":"catalog:","@opentelemetry/sdk-metrics":"catalog:","@opentelemetry/sdk-node":"catalog:","@opentelemetry/sdk-trace-base":"catalog:","@opentelemetry/sdk-trace-node":"catalog:","@opentelemetry/semantic-conventions":"catalog:","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","eventsource-parser":"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"catalog:","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3",zod:"catalog:"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function C64(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function MH0(J){let Q=J.settings["tools.inactivityTimeout"],Y=J.settings["tools.stopTimeout"],Z=Q;if(Z===void 0&&Y!==void 0)Z=Y;if(Z===void 0)Z=DO.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!C64(Z))return null;return Z*1000}function LH0(J){let Q=J.settings["tools.stopTimeout"],Y=DO.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var wH0;var Zc=i(()=>{DX1();wH0=DO.contributes.configuration.properties});function $5(J){let Q=N4[J];return`${Q.provider}/${Q.name}`}function Xc(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);return{provider:J.slice(0,Q),model:J.slice(Q+1)}}function k7(J){let{provider:Q,model:Y}=Xc(J);for(let Z of Object.values(N4))if(Z.provider===Q&&Z.name===Y)return Z;switch(Q){case"anthropic":return N4.CLAUDE_SONNET_4_5;case"openai":return N4.GPT_5;case"xai":return N4.GROK_CODE_FAST_1;case"cerebras":return N4.Z_AI_GLM_4_7;case"fireworks":return N4.FIREWORKS_GLM_4P6;case"moonshotai":return N4.KIMI_K2_INSTRUCT;case"openrouter":return N4.SONOMA_SKY_ALPHA;case"groq":return N4.GPT_OSS_120B;case"vertexai":return N4.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Q}`)}}function b9(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function DQ(J){let Q=k7(J);return Q.contextWindow-Q.maxOutputTokens}var R4,N4,BX1;var y7=i(()=>{R4={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},N4={CLAUDE_SONNET_4:{provider:R4.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:R4.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:R4.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:R4.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:R4.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,pricing:{input:5,output:25,cached:0.5,cacheWrite:6.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:R4.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,pricing:{input:1,output:5,cached:0.1,cacheWrite:1.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5:{provider:R4.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:R4.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_2:{provider:R4.OPENAI,name:"gpt-5.2",displayName:"GPT-5.2",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.75,output:14,cached:0.175},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:R4.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:R4.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:R4.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:R4.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:R4.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:R4.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:R4.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:R4.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GEMINI_2_5_PRO:{provider:R4.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:R4.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_LITE:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_3_PRO_PREVIEW:{provider:R4.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI3_FLASH_PREVIEW:{provider:R4.VERTEXAI,name:"gemini-3-flash-preview",displayName:"Gemini 3 Flash Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_3_PRO_IMAGE:{provider:R4.VERTEXAI,name:"gemini-3-pro-image-preview",displayName:"Gemini 3 Pro Image",contextWindow:1048576,maxOutputTokens:65535,capabilities:{vision:!0,imageGeneration:!0}},GEMINI_2_5_FLASH_IMAGE:{provider:R4.VERTEXAI,name:"gemini-2.5-flash-image",displayName:"Gemini 2.5 Flash Image",contextWindow:1048576,maxOutputTokens:65535,capabilities:{vision:!0,imageGeneration:!0}},Z_AI_GLM_4_7:{provider:R4.CEREBRAS,name:"zai-glm-4.7",displayName:"Z.ai GLM 4.7",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:R4.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:R4.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:R4.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:R4.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:R4.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:R4.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:R4.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};BX1={FINDER:"finder"}});function NX1(J,Q){let Y=IX(Q);if(!Y)return!1;if(_64.has(J)){let Z=Y.finder??BX1.FINDER,X=S64[Z];if(J!==X)return!1}if(Y.includeTools){if(Y.deferredTools?.includes(J))return!0;return Y.includeTools.includes(J)}return!0}function wX1(J,Q){let Y=IX(Q);if(!Y)return!1;return Y.deferredTools?.includes(J)??!1}function dY(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(BO).filter((Z)=>{if(Y.includes(`!${Z.key}`))return!1;if(Q===!1&&I9(Z.key))return!1;let G="visible"in Z?Z.visible:!1,V=Y.includes(Z.key);return G||V}).map((Z)=>({mode:Z.key,description:"description"in Z?Z.description:void 0})).sort((Z,X)=>Z.mode.localeCompare(X.mode))}function IX(J){return Object.values(BO).find((Q)=>Q.key===J)}function YH(J){return IX(J)?.primaryModel??$5("CLAUDE_SONNET_4_5")}function hC(J){let Q=IX(J);if(!Q)return!1;return k7(Q.primaryModel).capabilities?.vision??!1}function I9(J){return J==="free"||J.startsWith("free-")}function MX1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function LX1(J,Q){let Z=(Q.findIndex((G)=>G.mode===J)+1)%Q.length;return Q[Z]?.mode??"smart"}var _64,S64,IH0,EH0,k64,y64,OH0,AH0,BO,x64;var EX=i(()=>{y7();_64=new Set(["finder"]),S64={finder:"finder"},IH0={r:0,g:55,b:0},EH0={r:0,g:255,b:136},k64=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","task_list","todo_read","todo_write","read_thread","find_thread","mermaid","skill"],y64=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","find_thread","skill","oracle","librarian","Task","task_list","kraken","look_at","Check","illustrator"],OH0=["Read","finder","Bash","repl","create_file","edit_file","undo_edit","web_search","read_web_page","task_list","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","kraken","Task","Grep","glob","read_mcp_resource","mermaid","look_at","format_file","get_diagnostics","handoff","Check","illustrator"],AH0=["code_review","walkthrough","walkthrough_diagram"],BO={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:$5("CLAUDE_OPUS_4_5"),includeTools:OH0,deferredTools:AH0,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:$5("CLAUDE_HAIKU_4_5"),includeTools:k64,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:$5("CLAUDE_HAIKU_4_5"),includeTools:y64,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},LARGE:{key:"large",displayName:"Large",description:"The biggest context window possible (Sonnet 4.5 1M tokens), for large tasks",primaryModel:$5("CLAUDE_SONNET_4_5"),includeTools:OH0,deferredTools:AH0,visible:!1,uiHints:{labelAnimation:"glow",primaryColor:{r:42,g:26,b:77},secondaryColor:{r:153,g:102,b:255}}}},x64=Object.values(BO).map((J)=>J.key)});function $c(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let Z="subagentType"in Q?Q.subagentType:void 0;if(Z&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(Z)}return!0}return Q.includeTools.includes(J)}var v64,b64,OX1,f64,h64,g64,m64,AX1,G5,Ph8;var RX=i(()=>{y7();v64=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],b64=["Grep","glob","Read"],OX1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],f64=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder","skill","task_list"],h64=["Read","glob","Grep","enqueue_file_edit","fastmod"],g64=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],m64=["Read","Grep","glob","web_search","read_web_page","Bash"],AX1=["Read","Grep","glob","finder"],G5={finder:{key:"finder",displayName:"Finder",model:$5("CLAUDE_HAIKU_4_5"),includeTools:b64,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:$5("GPT_5_2"),includeTools:OX1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:$5("CLAUDE_HAIKU_4_5"),includeTools:v64,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:f64,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:$5("CLAUDE_HAIKU_4_5"),includeTools:h64,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:$5("CLAUDE_HAIKU_4_5"),includeTools:g64,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},"code-review":{key:"code-review",displayName:"Code Review",model:$5("CLAUDE_SONNET_4_5"),includeTools:m64,allowMcp:!1,allowToolbox:!1}},Ph8=Object.keys(G5)});function RH0(J,Q){return new P1((Y)=>{let Z=setTimeout(X,Q);function X(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function G(){if(Z)clearTimeout(Z);Z=setTimeout(X,Q)}let V=J.subscribe({next:(K)=>{G(),Y.next(K)},error:(K)=>{if(Z)clearTimeout(Z),Z=null;Y.error(K)},complete:()=>{if(Z)clearTimeout(Z),Z=null;Y.complete()}});return()=>{if(Z)clearTimeout(Z),Z=null;V.unsubscribe()}})}var jH0=i(()=>{G0()});function PH0(J){return{tool:J,action:"allow"}}var NO;var Gc=i(()=>{j6();NO=[{tool:"Bash",action:"ask",matches:{cmd:"*git*push*"}},{tool:"mcp__*",action:"allow"},{tool:cd,action:"allow"},{tool:"tb__*",action:"allow"},{tool:"Bash",matches:{cmd:"/^(.*\\s+)?(bazel|ibazel)\\s+.*\\/\\/[^\\s]*.*$/"},action:"allow"},{tool:"Bash",matches:{cmd:["ls","ls *","dir","dir *","cat *","head *","tail *","less *","more *","grep *","egrep *","fgrep *","tree","tree *","file *","wc *","pwd","stat *","du *","df *","ps *","top","htop","echo *","printenv *","id","which *","whereis *","date","cal *","uptime","free *","ping *","dig *","nslookup *","host *","netstat *","ss *","lsof *","ifconfig *","ip *","man *","info *","mkdir *","touch *","uname *","whoami","go version","go env *","go help *","cargo version","cargo --version","cargo help *","rustc --version","rustc --help","rustc --explain *","javac --version","javac -version","javac -help","javac --help","dotnet --info","dotnet --version","dotnet --help","dotnet help *","gcc --version","gcc -v","gcc --help","gcc -dumpversion","g++ --version","g++ -v","g++ --help","g++ -dumpversion","clang --version","clang --help","clang++ --version","clang++ --help","python -V","python --version","python -h","python --help","python3 -V","python3 --version","python3 -h","python3 --help","ruby -v","ruby --version","ruby -h","ruby --help","node -v","node --version","node -h","node --help","npm --help","npm --version","npm -v","npm help *","yarn --help","yarn --version","yarn -v","yarn help *","pnpm --help","pnpm --version","pnpm -v","pnpm help *","pytest -h","pytest --help","pytest --version","jest --help","jest --version","mocha --help","mocha --version","make --version","make --help","docker --version","docker --help","docker version","docker help *","git --version","git --help","git help *","git version"]},action:"allow"},{tool:"Bash",matches:{cmd:["go test *","go run *","go build *","go vet *","go fmt *","go list *","cargo test *","cargo run *","cargo build *","cargo check *","cargo fmt *","cargo tree *","make -n *","make --dry-run *","mvn test *","mvn verify *","mvn dependency:tree *","gradle tasks *","gradle dependencies *","gradle properties *","dotnet test *","dotnet list *","python -c *","ruby -e *","node -e *","npm list *","npm ls *","npm outdated *","npm test*","npm run*","npm view *","npm info *","yarn list*","yarn ls *","yarn info *","yarn test*","yarn run *","yarn why *","pnpm list*","pnpm ls *","pnpm outdated *","pnpm test*","pnpm run *","pytest --collect-only *","jest --listTests *","jest --showConfig *","mocha --list *","git status*","git show *","git diff*","git grep *","git branch *","git tag *","git remote -v *","git rev-parse --is-inside-work-tree *","git rev-parse --show-toplevel *","git config --list *","git log *"]},action:"allow"},{tool:"Bash",matches:{cmd:["./gradlew *","./mvnw *","./build.sh *","./configure *","cmake *","./node_modules/.bin/tsc *","./node_modules/.bin/eslint *","./node_modules/.bin/prettier *","prettier *","./node_modules/.bin/tailwindcss *","./node_modules/.bin/tsx *","./node_modules/.bin/vite *","bun *","tsx *","vite *"]},action:"allow"},{tool:"Bash",matches:{cmd:[".venv/bin/activate *",".venv/Scripts/activate *","source .venv/bin/activate *","source venv/bin/activate *","pip list *","pip show *","pip check *","pip freeze *","uv *","poetry show *","poetry check *","pipenv check *"]},action:"allow"},{tool:"Bash",matches:{cmd:["asdf list *","asdf current *","asdf which *","mise list *","mise current *","mise which *","mise use *","rbenv version *","rbenv versions *","rbenv which *","nvm list *","nvm current *","nvm which *"]},action:"allow"},{tool:"Bash",matches:{cmd:["./test*","./run_tests.sh *","./run_*_tests.sh *","vitest *","bundle exec rspec *","bundle exec rubocop *","rspec *","rubocop *","swiftlint *","clippy *","ruff *","black *","isort *","mypy *","flake8 *","bandit *","safety *","biome check *","biome format *"]},action:"allow"},{tool:"Bash",matches:{cmd:["rails server *","rails s *","bin/rails server *","bin/rails s *","flask run *","django-admin runserver *","python manage.py runserver *","uvicorn *","streamlit run *"]},action:"allow"},{tool:"Bash",matches:{cmd:["bin/rails db:status","bin/rails db:version","rails db:rollback *","rails db:status *","rails db:version *","alembic current *","alembic history *","bundle exec rails db:status","bundle exec rails db:version"]},action:"allow"},{tool:"Bash",matches:{cmd:["docker ps *","docker images *","docker logs *","docker inspect *","docker info *","docker stats *","docker system df *","docker system info *","podman ps *","podman images *","podman logs *","podman inspect *","podman info *"]},action:"allow"},{tool:"Bash",matches:{cmd:["aws --version *","aws configure list *","aws sts get-caller-identity *","aws s3 ls *","gcloud config list *","gcloud auth list *","gcloud projects list *","az account list *","az account show *","kubectl get *","kubectl describe *","kubectl logs *","kubectl version *","helm list *","helm status *","helm version *"]},action:"allow"},{tool:"Bash",matches:{cmd:["swift build *","swift test *","zig build *","zig build test*","kotlinc *","scalac *","javac *","javap *","clang *","jar *","sbt *","gradle *","bazel build *","bazel test *","bazel run *","mix *","lua *","ruby *","php *"]},action:"allow"},{tool:"Bash",matches:{cmd:["mkdir -p *","chmod +x *","dos2unix *","unix2dos *","ln -s *"]},action:"allow"},{tool:"Bash",matches:{cmd:["for *","while *","do *","done *","if *","then *","else *","elif *","fi *","case *","esac *","in *","function *","select *","until *","{ *","} *","[[ *","]] *"]},action:"ask"},{tool:"Bash",matches:{cmd:"/^find(?!.*(-delete|-exec|-execdir)).*$/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^(echo|ls|pwd|date|whoami|id|uname)\\s.*[&|;].*\\s*(echo|ls|pwd|date|whoami|id|uname)($|\\s.*)/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^(cat|grep|head|tail|less|more|find)\\s.*\\|\\s*(grep|head|tail|less|more|wc|sort|uniq)($|\\s.*)/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^rm\\s+.*(-[rf].*-[rf]|-[rf]{2,}|--recursive.*--force|--force.*--recursive).*$/"},action:"ask"},{tool:"Bash",matches:{cmd:"/^find.*(-delete|-exec|-execdir).*$/"},action:"ask"},{tool:"Bash",matches:{cmd:"/^(ls|cat|grep|head|tail|file|stat)\\s+[^/]*$/"},action:"allow"},{tool:"Bash",matches:{cmd:"/^(?!.*(rm|mv|cp|chmod|chown|sudo|su|dd)\\b).*/dev/(null|zero|stdout|stderr|stdin).*$/"},action:"allow"},{tool:"Bash",matches:{cmd:"/(^|\\s)(\\/(?!dev\\/(null|zero|stdout|stderr|stdin))[^\\s]*|\\.\\.\\/)(?![^\\s]*\\.(log|txt|md|json|yml|yaml)$)/"},action:"ask"},{tool:"Bash",action:"ask"},PH0("Glob"),...sW0.map(PH0)]});var r0=i(()=>{OC();Ed();$O()});function RX1(J){let Q=J;if(Q.startsWith("~/")){let Y=process.env.HOME||process.env.USERPROFILE||"";Q=Q.replace("~/",`${Y}/`)}else if(Q==="~")Q=process.env.HOME||process.env.USERPROFILE||"";if(Q=Q.replace(/%([^%]+)%/g,(Y,Z)=>{return process.env[Z]||`%${Z}%`}),Q.includes("%USERPROFILE%")&&process.env.USERPROFILE)Q=Q.replace(/%USERPROFILE%/g,process.env.USERPROFILE);return Q0.file(Q)}function IX1(J,Q){let Y=RX1(Q);if(Y.path.includes("*")){let Z=J.toString(),X=Y.path;if(!X.startsWith("file://")){if(!X.startsWith("/"))X=`/${X}`;X=`file://${X}`}let G=X.replace(/\./g,"\\.").replace(/\*\*/g,"§DOUBLESTAR§").replace(/\*/g,"[^/]*").replace(/§DOUBLESTAR§/g,".*");return new RegExp(`^${G}$`).test(Z)}else return Y.toString()===J.toString()}function TH0(J,Q){return Q.some((Y)=>IX1(J,Y))}async function u64(J,Q,Y){try{let Z=await Q.realpath(J).catch(()=>J),G=[...["~/.config/AGENT.md"],...Y];for(let V of G)if(IX1(Z,V)||IX1(J,V))return null;for(let{key:V,pattern:K}of EX1)if(TH0(Z,K.patterns)||TH0(J,K.patterns))return{key:V,pattern:K};return null}catch{return null}}async function Vc(J,Q,Y){if(Y?.dangerouslyAllowAll??!1)return{requiresConsent:!1};try{let X=await u64(J,Q,Y["guardedFiles.allowlist"]??[]);if(X)return{requiresConsent:!0,reason:`${X.pattern.description}`,toAllow:J.fsPath};return{requiresConsent:!1}}catch{return{requiresConsent:!0,reason:"Unable to resolve file path",toAllow:J.fsPath}}}var EX1;var gC=i(()=>{r0();EX1=[{key:"vscode-user-settings",pattern:{description:"VS Code User Settings",patterns:["~/Library/Application Support/Code/User/settings.json","~/.config/Code/User/settings.json","%APPDATA%/Code/User/settings.json"]}},{key:"vscode-workspace-settings",pattern:{description:"VS Code Workspace Settings",patterns:["**/.vscode/settings.json"]}},{key:"vscode-extensions",pattern:{description:"VS Code Extensions Configuration",patterns:["**/.vscode/extensions.json"]}},{key:"amp-settings",pattern:{description:"Amp Configuration Files",patterns:["**/amp.json","**/.amp/**"]}},{key:"shell-configs",pattern:{description:"Shell Configuration Files",patterns:["~/.bashrc","~/.zshrc","~/.fishrc","~/.cshrc","~/.tcshrc"]}},{key:"ssh-keys",pattern:{description:"SSH Keys and Configuration",patterns:["**/.ssh/**","~/.ssh/**"]}},{key:"gnupg-keys",pattern:{description:"GnuPG Keys and Configuration",patterns:["**/.gnupg/**","~/.gnupg/**"]}},{key:"environment-files",pattern:{description:"Environment Variable Files",patterns:["**/.env","**/.env.*"]}},{key:"claude-config",pattern:{description:"Claude AI Configuration",patterns:["**/.claude/**","~/.claude/**"]}},{key:"git-internals",pattern:{description:"Git Internal Files",patterns:["**/.git/**"]}},{key:"kubernetes-config",pattern:{description:"Kubernetes Configuration",patterns:["**/.kube/**","~/.kube/**"]}},{key:"cache-directories",pattern:{description:"Cache Directories",patterns:["**/.cache/**","~/.cache/**"]}},{key:"windows-appdata",pattern:{description:"Windows Application Data",patterns:["%APPDATA%/**"]}},{key:"sqlite3-files",pattern:{description:"SQLite Database Files",patterns:["**/*.db","**/*.sqlite","**/*.sqlite3"]}},{key:"common-configuration-patterns",pattern:{description:"Configuration Directories",patterns:["~/.*","~/.*/**","~/.config/**","~/Library/**","~/Libary/Preferences/**"]}}]});function p64(){if(nD.size===0)return;R.info("Killing all child processes");for(let J of nD)CH0(J);nD.clear(),R.info("All child processes killed")}function CH0(J){if(!J.pid){try{J.kill("SIGKILL")}catch(Q){R.error("Failed to kill process without PID",Q)}return}if(mC.has(J.pid)){R.debug(`Process ${J.pid} already being killed, skipping`);return}mC.add(J.pid);try{if(process.platform==="win32"){let{spawn:Q}=w1("node:child_process"),Y=Q("taskkill",["/F","/T","/PID",J.pid.toString()],{stdio:"ignore"});Y.on("error",(Z)=>{R.error(`Failed to kill Windows process tree ${J.pid}`,Z);try{J.kill("SIGKILL")}catch(X){R.error(`Fallback kill also failed for ${J.pid}`,X)}}),Y.on("exit",()=>{mC.delete(J.pid)})}else{try{process.kill(J.pid,0),process.kill(-J.pid,"SIGKILL")}catch(Q){R.debug(`Process ${J.pid} no longer exists, skipping kill`)}mC.delete(J.pid)}}catch(Q){R.error(`Failed to kill process ${J.pid}`,Q),mC.delete(J.pid)}}function zG(...J){return new P1((Q)=>{let Y=!1,Z,X=!1;return(async()=>{try{let{spawn:V}=await import("node:child_process");if(Y)return;let K={...J[2],detached:process.platform!=="win32",env:{...process.env,...J[2]?.env||{},NONINTERACTIVE:"1",DEBIAN_FRONTEND:"noninteractive"}};if(!K.stdio)K.stdio=["pipe","pipe","pipe"];Z=V(J[0],J[1],K),nD.add(Z);let q={stdout:"",stderr:"",combinedOutput:"",exitCode:null,exited:!1,pid:Z.pid};Z.on("spawn",()=>{Q.next({...q,process:Z})}),Z.stdout?.on("data",(W)=>{if(Y)return;let H=W.toString();q.stdout+=H,q.combinedOutput+=H,q.lastData=W,Q.next({...q,process:Z})}),Z.stderr?.on("data",(W)=>{if(Y)return;let H=W.toString();q.stderr+=H,q.combinedOutput+=H,q.lastData=W,Q.next({...q,process:Z})}),Z.on("exit",(W)=>{if(Y)return;if(X)return;if(X=!0,q.exitCode=W??-1,q.exited=!0,q.lastData=void 0,Q.next({...q,process:Z}),Q.complete(),Z)nD.delete(Z)}),Z.on("error",(W)=>{if(Y)return;if(Q.error(W),Z)nD.delete(Z)})}catch(V){if(Y)return;Q.error(V)}})(),()=>{if(Y=!0,Z&&!X)CH0(Z),nD.delete(Z)}})}function Kc(J){if(typeof J!=="string")throw Error("arg is not a string");if(J.startsWith("-"))throw Error("arg is not safe")}function wO(J){if(!J)throw Error("tool requires a working directory");if(J.scheme!=="file"&&J.scheme!=="vscode-vfs")throw Error(`tool requires a dir with a file: URI (got ${JSON.stringify(J.scheme)})`)}var nD,mC;var FG=i(()=>{G0();v1();nD=new Set,mC=new Set;if(typeof process<"u")process.on("exit",()=>{p64()})});function pC(J,Q){if(Q==="")return!1;let Y=J.toLowerCase(),Z=Q.toLowerCase();if(Z.length===1){if(Z==="*")return!0;return Z===Y}if(Y===Z)return!0;if(Z.includes("*")||Z.includes("?")||Z.includes("[")||Z.includes("{"))try{return _H0.default(Z,{dot:!0})(Y)}catch(X){return!1}return!1}function jX1(J,Q){let Y=Q.split("."),Z=J;for(let X of Y){if(Z===null||Z===void 0)return;if(Array.isArray(Z)){let G=parseInt(X,10);if(isNaN(G)||G<0||G>=Z.length)return;Z=Z[G]}else if(typeof Z==="object")Z=Z[X];else return}return Z}function d64(J,Q,Y,Z){if(!pC(Q,J.tool))return!1;if(J.context&&J.context!==Z)return!1;if(!J.matches||Object.keys(J.matches).length===0)return!0;return Object.entries(J.matches).every(([X,G])=>{if(G===void 0){if(X.includes("."))return jX1(Y,X)===void 0;return X in Y&&Y[X]===void 0}let V=X.includes(".")?jX1(Y,X):Y[X];return qc(V,G)})}async function c64(J,Q,Y,Z,X,G){if(J.action!=="delegate"){if(J.action==="reject"&&J.message)return{action:J.action,matchedEntry:J,error:J.message};return{action:J.action,matchedEntry:J}}if(!Y||!J.to)return{action:null,matchedEntry:J,error:"No spawn function provided"};try{let V=await l64(J.to,Q,Y,Z,X,G);return i64(V,J)}catch(V){return{action:"reject",error:V instanceof Error?V.message:"Unknown error",matchedEntry:J}}}async function l64(J,Q,Y,Z,X,G){let V={AGENT:"amp"};if(Z)V.AMP_THREAD_ID=Z;if(X)V.AGENT_TOOL_NAME=X;if(G)V.AGENT_TOOL_USE_ID=G;let q=J.includes("~")||J.includes("%")?RX1(J).path:J,H=Y(q,[],{env:V});return new Promise((z,F)=>{let U;H.subscribe({next:(D)=>{if(typeof D==="object"&&D!==null&&"status"in D&&D.status==="error"){F(Error("Delegate command timed out after 10 seconds"));return}if(D.process&&!D.exited)D.process.stdin?.write(JSON.stringify(Q)),D.process.stdin?.end();U=D},complete:()=>{if(U?.exited)z({exitCode:U.exitCode??-1,stdout:U.stdout,stderr:U.stderr});else F(Error("Process did not exit properly"))},error:(D)=>{F(D)}})})}function i64({exitCode:J,stderr:Q},Y){switch(J){case 0:return{action:"allow",matchedEntry:Y};case 1:return{action:"ask",matchedEntry:Y};default:return{action:"reject",matchedEntry:Y,error:Q}}}async function MO(J,Q,Y,Z,X,G,V,K){let q=0;for(let W of Y)try{if(!d64(W,J,Q,Z)){q=q+1;continue}let H=await c64(W,Q,X,G,J,K);if(H.matchIndex=q,V)H.source=V;return H}catch(H){return{action:null,error:H instanceof Error?H.message:"Unknown error"}}return{action:null}}function qc(J,Q){if(typeof Q==="string"){if(typeof J!=="string")return!1;return a64(J,Q)}if(Array.isArray(Q))return Q.some((Y)=>{if(typeof Y==="string")return typeof J==="string"&&PX1(J,Y);return J===Y});if(typeof Q==="object"&&Q!==null)return n64(J,Q);return J===Q}function n64(J,Q){if(Object.keys(Q).length===0)return typeof J==="object"&&J!==null;if(typeof J!=="object"||J===null)return!1;for(let[Y,Z]of Object.entries(Q)){let X=jX1(J,Y);if(!qc(X,Z))return!1}return!0}function a64(J,Q){if(typeof Q==="string")return PX1(J,Q);if(Array.isArray(Q))return Q.some((Y)=>typeof Y==="string"&&PX1(J,Y));return!1}function PX1(J,Q){if(Q.length>=3&&Q.startsWith("/")&&Q.endsWith("/"))try{let X=Q.slice(1,-1);return new RegExp(X,"m").test(J)}catch(X){throw Error(`Invalid regex pattern: ${Q}`)}if(Q==="*")return!0;if(!Q.includes("*"))return J===Q;let Y=Q.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${Y}$`,"m").test(J)}var _H0,uC;var LO=i(()=>{gC();FG();_H0=H0(EK(),1),uC=zG});class SH0{input;position=0;line=1;column=1;tokens=[];constructor(J){this.input=J}current(){return this.position<this.input.length?this.input[this.position]:""}peek(){return this.position+1<this.input.length?this.input[this.position+1]:""}advance(){let J=this.current();if(this.position++,J===`
|
|
48
48
|
`)this.line++,this.column=1;else this.column++;return J}skipWhitespace(){while(this.current()&&/\s/.test(this.current())&&this.current()!==`
|
|
49
49
|
`)this.advance()}readString(){let J="",Q=this.current();this.advance();while(this.current()&&this.current()!==Q)if(this.current()==="\\"&&this.peek()===Q)this.advance(),J+=this.advance();else J+=this.advance();if(!this.current())throw Error("Unterminated string");return this.advance(),J}readIdentifier(){let J="";if(this.current()==="-"&&/\d/.test(this.peek()))J+=this.advance();while(this.current()&&/[a-zA-Z0-9_*.-]/.test(this.current()))J+=this.advance();if((this.current()==="e"||this.current()==="E")&&/[-+]?\d/.test(this.peek())){if(J+=this.advance(),this.current()==="+"||this.current()==="-")J+=this.advance();while(this.current()&&/\d/.test(this.current()))J+=this.advance()}return J}readFlag(){let J="";this.advance(),this.advance();while(this.current()&&/[a-zA-Z0-9_*:.-]/.test(this.current()))J+=this.advance();return J}readComment(){let J="";this.advance();while(this.current()&&this.current()!==`
|
|
50
50
|
`)J+=this.advance();return J.trim()}tokenize(){this.tokens=[];while(this.position<this.input.length){let J={position:this.position,line:this.line,column:this.column};if(this.skipWhitespace(),!this.current())break;if(this.current()==="'"||this.current()==='"'){try{let Q=this.readString();this.tokens.push({type:"STRING",value:Q,...J})}catch(Q){throw Error(`Parse error at line ${this.line}, column ${this.column}: ${Q}`)}continue}if(this.current()===`
|
|
@@ -4280,11 +4280,11 @@ Actual: ${X}`)}async function qZ8(J,Q,Y){let Z=EV(Q,"package.tgz");R.debug("Do
|
|
|
4280
4280
|
${U}`;if(X==="pnpm"&&U.includes("Unable to find the global bin directory"))D+=`
|
|
4281
4281
|
|
|
4282
4282
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
4283
|
-
npm install -g @sourcegraph/amp`;K(Error(D))}},error:(F)=>{if(!H)H=!0,K(Error(`Failed to spawn ${X}: ${F.message}`))},complete:()=>{if(!H)H=!0,V()}})})}v1();v1();async function G61(J,Q){let Z=Q||"https://registry.npmjs.org";try{let X=new AbortController,G=setTimeout(()=>X.abort(),5000),V=await fetch(`${Z}/@sourcegraph/amp`,{signal:X.signal});if(clearTimeout(G),!V.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let K=await V.json(),q=K["dist-tags"]?.latest;if(!q)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=UZ8(J,q),H=W<0,z,F;if(K.time){let U=K.time[J],D=K.time[q],B=Date.now();if(U)z=Math.floor((B-new Date(U).getTime())/3600000);if(D)F=Math.floor((B-new Date(D).getTime())/3600000)}return R.info("NPM version comparison",{currentVersion:J,latestVersion:q,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:F}),{hasUpdate:H,latestVersion:q,currentVersion:J,currentVersionAge:z,latestVersionAge:F,source:"npm"}}catch(X){return R.debug("Error checking npm version",{error:X}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function UZ8(J,Q){let Y=(V)=>{let[K,q]=V.split("-");return{parts:K?.split(".").map(Number)||[],label:q}},Z=Y(J),X=Y(Q),G=Math.max(Z.parts.length,X.parts.length);for(let V=0;V<G;V++){let K=Z.parts[V]||0,q=X.parts[V]||0;if(K<q)return-1;if(K>q)return 1}if(Z.label===X.label)return 0;if(!Z.label&&X.label)return 1;if(Z.label&&!X.label)return-1;if(Z.label&&X.label)return Z.label<X.label?-1:1;return 0}G0();function V61(J,Q){let Y=new F6,Z=Y.pipe($4({shouldCountRefs:!1}));return setImmediate(async()=>{let X=new $G().scoped("update"),G=Z.subscribe({next:(V)=>{X.debug("emit new state",V)}});try{let V=process.env.AMP_TEST_UPDATE_STATUS;if(V){X.debug("using fake update status for testing",{status:V}),await GR(500),Y.next(V);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){X.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let K=await Q.get("updates.mode");if(K==="disabled"){X.debug("checking disabled");return}X.debug("checking",{currentVersion:J,mode:K});let q=aw(),W=await G61(J,q);if(!(W.latestVersion&&W.hasUpdate)){X.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let F=W.currentVersionAge-W.latestVersionAge,U=0.5;if(Math.abs(F)<0.5)return X.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:F}),!0}return!1},z=await $61();if(!K)K=z==="pnpm"?"warn":"auto",X.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:K});if(K==="warn"){if(!H())Y.next("update-available");return}if(!z){if(X.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}if(z==="binary"&&process.platform==="win32"){if(X.debug("binary auto-update not supported on Windows, falling back to warn mode"),!H())Y.next("update-available");return}try{await Fh(W.latestVersion,z);let F=await SF(W.latestVersion),U={from:W.currentVersion,to:W.latestVersion,...F};if(F.status==="same")X.info("success",U),Y.next("updated");else X.warn("success with warning",U),Y.next("updated-with-warning")}catch(F){Y.next("update-error")}}catch(V){X.debug("check failed",{error:V})}finally{await GR(5000),Y.next("hidden"),G.unsubscribe(),Y.complete()}}),{state:Z}}hn();import{stderr as RV}from"node:process";function C56(J){let Q=new U$().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(Z)=>{await DC1(Z.force||!1,Z.verbose||!1,"0.0.
|
|
4283
|
+
npm install -g @sourcegraph/amp`;K(Error(D))}},error:(F)=>{if(!H)H=!0,K(Error(`Failed to spawn ${X}: ${F.message}`))},complete:()=>{if(!H)H=!0,V()}})})}v1();v1();async function G61(J,Q){let Z=Q||"https://registry.npmjs.org";try{let X=new AbortController,G=setTimeout(()=>X.abort(),5000),V=await fetch(`${Z}/@sourcegraph/amp`,{signal:X.signal});if(clearTimeout(G),!V.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let K=await V.json(),q=K["dist-tags"]?.latest;if(!q)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=UZ8(J,q),H=W<0,z,F;if(K.time){let U=K.time[J],D=K.time[q],B=Date.now();if(U)z=Math.floor((B-new Date(U).getTime())/3600000);if(D)F=Math.floor((B-new Date(D).getTime())/3600000)}return R.info("NPM version comparison",{currentVersion:J,latestVersion:q,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:F}),{hasUpdate:H,latestVersion:q,currentVersion:J,currentVersionAge:z,latestVersionAge:F,source:"npm"}}catch(X){return R.debug("Error checking npm version",{error:X}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function UZ8(J,Q){let Y=(V)=>{let[K,q]=V.split("-");return{parts:K?.split(".").map(Number)||[],label:q}},Z=Y(J),X=Y(Q),G=Math.max(Z.parts.length,X.parts.length);for(let V=0;V<G;V++){let K=Z.parts[V]||0,q=X.parts[V]||0;if(K<q)return-1;if(K>q)return 1}if(Z.label===X.label)return 0;if(!Z.label&&X.label)return 1;if(Z.label&&!X.label)return-1;if(Z.label&&X.label)return Z.label<X.label?-1:1;return 0}G0();function V61(J,Q){let Y=new F6,Z=Y.pipe($4({shouldCountRefs:!1}));return setImmediate(async()=>{let X=new $G().scoped("update"),G=Z.subscribe({next:(V)=>{X.debug("emit new state",V)}});try{let V=process.env.AMP_TEST_UPDATE_STATUS;if(V){X.debug("using fake update status for testing",{status:V}),await GR(500),Y.next(V);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){X.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let K=await Q.get("updates.mode");if(K==="disabled"){X.debug("checking disabled");return}X.debug("checking",{currentVersion:J,mode:K});let q=aw(),W=await G61(J,q);if(!(W.latestVersion&&W.hasUpdate)){X.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let F=W.currentVersionAge-W.latestVersionAge,U=0.5;if(Math.abs(F)<0.5)return X.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:F}),!0}return!1},z=await $61();if(!K)K=z==="pnpm"?"warn":"auto",X.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:K});if(K==="warn"){if(!H())Y.next("update-available");return}if(!z){if(X.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}if(z==="binary"&&process.platform==="win32"){if(X.debug("binary auto-update not supported on Windows, falling back to warn mode"),!H())Y.next("update-available");return}try{await Fh(W.latestVersion,z);let F=await SF(W.latestVersion),U={from:W.currentVersion,to:W.latestVersion,...F};if(F.status==="same")X.info("success",U),Y.next("updated");else X.warn("success with warning",U),Y.next("updated-with-warning")}catch(F){Y.next("update-error")}}catch(V){X.debug("check failed",{error:V})}finally{await GR(5000),Y.next("hidden"),G.unsubscribe(),Y.complete()}}),{state:Z}}hn();import{stderr as RV}from"node:process";function C56(J){let Q=new U$().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(Z)=>{await DC1(Z.force||!1,Z.verbose||!1,"0.0.1768191623-gd520c9"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new U$("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(Z)=>{await DZ8(Z.targetVersion)});J.addCommand(Y)}async function DZ8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")RV.write(Z0.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
4284
4284
|
|
|
4285
4285
|
`));try{if(!J){RV.write(Z0.blue(`Checking for updates...
|
|
4286
|
-
`));let Y=aw(),{hasUpdate:Z,latestVersion:X}=await G61("0.0.
|
|
4287
|
-
`));let V=await SF("0.0.
|
|
4286
|
+
`));let Y=aw(),{hasUpdate:Z,latestVersion:X}=await G61("0.0.1768191623-gd520c9",Y);if(!Z){RV.write(Z0.green(`✓ Amp CLI is already up to date: ${"0.0.1768191623-gd520c9"} (${"released"} ${"2026-01-12T04:24:47.496Z"}${`, ${cA(new Date("2026-01-12T04:24:47.496Z"))} ago`})
|
|
4287
|
+
`));let V=await SF("0.0.1768191623-gd520c9");if(V.warning)RV.write(`
|
|
4288
4288
|
`+Z0.yellow(V.warning)+`
|
|
4289
4289
|
`);process.exit(0)}if(!X)RV.write(Z0.yellow("[WARN] could not find latest version")),process.exit(0);J=X}RV.write(Z0.blue(`Updating to version ${J}...
|
|
4290
4290
|
`)),await Fh(J,void 0,(Y)=>{RV.write(Z0.dim(`Running: ${Y}
|
|
@@ -5062,7 +5062,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||YO}function zY6(J,Q){let
|
|
|
5062
5062
|
`)+`
|
|
5063
5063
|
`;Z.push(new k(q,K))}return Z}function mB8(J,Q,Y){let Z=new f({italic:!0}),X=[];if(J.cwd){let G=eF(Y),V=Q0.file(J.cwd),K=q7(V,G??void 0);if(K.length>0)X.push(new k(" (",Z)),X.push(new k("in: ",Z.copyWith({dim:!0}))),X.push(new k(K,Z.copyWith({dim:!0})))}if(Q.status==="done"&&typeof Q.result.exitCode==="number"&&Q.result.exitCode!==0){if(X.length>0)X.push(new k(", ",Z));else X.push(new k(" (",Z));X.push(new k("exit code: ",Z)),X.push(new k(String(Q.result.exitCode),Z.copyWith({color:o.red})))}if(X.length>0)X.push(new k(")",Z));return X}class fX6 extends p1{props;constructor(J){super();this.props=J}createState(){return new hX6}}class hX6 extends u1{_animationTimer;_spinner=new ZJ;initState(){if(super.initState(),this.widget.props.toolRun.status==="in-progress")this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.props.toolRun.status!=="in-progress"&&this.widget.props.toolRun.status==="in-progress")this._startAnimation();else if(J.props.toolRun.status==="in-progress"&&this.widget.props.toolRun.status!=="in-progress")this._stopAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let{toolUse:Q,toolRun:Y}=this.widget.props,X=W0.of(J).colors,G=Q.input,V=Y.status,K=qg(Y.status),q=V==="done"&&typeof Y.result.exitCode==="number"&&Y.result.exitCode!==0,W=Q.name.replace(/^tb__/,""),H=new f({color:X.foreground,bold:!0}),z="";if(Object.keys(G).length>0)z=Object.entries(G).map(([U,D])=>`${U}: ${JSON.stringify(D)}`).join(", ");let F=[];if(V==="in-progress"){let U=this._spinner.toBraille();F.push(new k(`${U} `,new f({color:K})))}else{let U=new f({color:q?o.red:K,bold:!0});F.push(new k("• ",U))}if(F.push(new k(W,H)),z){let U=new f({color:X.foreground,dim:!0});F.push(new k(" ",void 0)),F.push(new k(z,U))}if(q){let U=new f({italic:!0});F.push(new k(" (",U)),F.push(new k("exit code: ",U)),F.push(new k(String(Y.result.exitCode),U.copyWith({color:o.red}))),F.push(new k(")",U))}if(V==="rejected-by-user")F.push(new k(" (rejected)",new f({dim:!0,italic:!0})));else if(V==="cancelled")F.push(new k(" (cancelled)",new f({color:o.yellow,italic:!0})));if(F.push(new k(`
|
|
5064
5064
|
`)),V==="error"&&Y.error.message)F.push(new k(` Error: ${Y.error.message}
|
|
5065
|
-
`,new f({color:o.red})));else if(V==="done")F.push(...ij(Y.result.output,!0,X));else if(V==="cancelled")F.push(...ij(Y.progress?.output,!0,X));else if(V==="in-progress"&&Y.progress?.output)F.push(...ij(Y.progress.output,!1,X));return new e({text:new k("",void 0,F),selectable:!0})}}class gX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,X=W0.of(J).colors,G=new f({color:X.foreground,dim:!0}),V=Q.input,K=V.repository,q=V.path,W=V.read_range,H=[];if(q&&K){let z=K.startsWith("http")?`${K}/blob/main/${
|
|
5065
|
+
`,new f({color:o.red})));else if(V==="done")F.push(...ij(Y.result.output,!0,X));else if(V==="cancelled")F.push(...ij(Y.progress?.output,!0,X));else if(V==="in-progress"&&Y.progress?.output)F.push(...ij(Y.progress.output,!1,X));return new e({text:new k("",void 0,F),selectable:!0})}}class gX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,X=W0.of(J).colors,G=new f({color:X.foreground,dim:!0}),V=Q.input,K=V.repository,q=V.path,W=V.read_range,H=[];if(q&&K){let z=q.startsWith("/")?q.slice(1):q,F=K.startsWith("http")?`${K}/blob/main/${z}`:`https://github.com/${K}/blob/main/${z}`,U=K.replace(/^https?:\/\/github\.com\//,"");if(H.push(new M9({uri:F,text:`${U}/${z}`,style:new f({color:o.cyan,dim:!0,underline:!0})})),W&&Array.isArray(W))H.push(new e({text:new k(` @${W[0]}-${W[1]}`,G),selectable:!0}))}return new W8({name:"Read",status:Y.status,children:H})}}class k81 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y,name:Z,patternField:X}=this.props,V=W0.of(J).colors,K=new f({color:V.foreground,dim:!0}),q=Q.input,W=q[X],H=q.repository,z=q.path,F=[];if(W)F.push(new k(W,new f({color:o.yellow})));if(H){let D=H.replace(/^https?:\/\/github\.com\//,"");if(F.push(new k(` in ${D}`,K)),z){let B=z.startsWith("/")?z.slice(1):z;F.push(new k(`/${B}`,K))}}let U=[];if(F.length>0)U.push(new e({text:new k("",void 0,F),selectable:!0}));return new W8({name:Z,status:Y.status,children:U})}}class mX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,X=W0.of(J).colors,G=new f({color:X.foreground,dim:!0}),V=Q.input,K=V.repository,q=V.path||"/",W=[];if(q)W.push(new k(q,new f({color:o.yellow})));if(K)W.push(new k(` in ${K}`,G));let H=[];if(W.length>0)H.push(new e({text:new k("",void 0,W),selectable:!0}));return new W8({name:"List",status:Y.status,children:H})}}class uX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,Z=Q.input,X=Z.pattern,G=Z.organization,V=Z.language,K=[],q=[];if(X)q.push(X);if(G)q.push(`org:${G}`);if(V)q.push(`language:${V}`);if(q.length>0)K.push(new k(q.join(" "),new f({color:o.yellow})));let W=[];if(K.length>0)W.push(new e({text:new k("",void 0,K),selectable:!0}));return new W8({name:"List Repositories",status:Y.status,children:W})}}class pX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,X=W0.of(J).colors,G=new f({color:X.foreground,dim:!0}),V=Q.input,K=[];if(V.base&&V.head){let W=Fy1(V.base),H=Fy1(V.head);K.push(new k(`${W}...${H}`,new f({color:o.yellow})))}if(V.repository){let W=V.repository.replace(/^https?:\/\/github\.com\//,"");K.push(new k(` in ${W}`,G))}let q=[];if(K.length>0)q.push(new e({text:new k("",void 0,K),selectable:!0}));return new W8({name:"Diff",status:Y.status,children:q})}}class dX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,X=W0.of(J).colors,G=new f({color:X.foreground,dim:!0}),V=[],K=Q.input,q="Web search";if(K.objective)q=K.objective;else if(K.search_queries&&Array.isArray(K.search_queries))q=K.search_queries.join(", ");else if("query"in K&&K.query&&typeof K.query==="string")q=K.query;if(V.push(new e({text:new k(q,G),selectable:!0})),Uy1(Y))V.push(new e({text:new k(" • Powered by Parallel",new f({dim:!0})),selectable:!1}));return new W8({name:"Web Search",status:Y.status,children:V})}}class cX6 extends p1{props;constructor(J){super();this.props=J}createState(){return new lX6}}class lX6 extends u1{scrollController=(()=>{let J=new a4;return J.followMode=!0,J})();viewportHeight=1;scrollListenerAttached=!1;dispose(){this.scrollController.dispose(),super.dispose()}updateViewportHeight(){let J=this.getViewportHeight();if(J!==this.viewportHeight)this.viewportHeight=J}getViewportHeight(){let J=this.context.findRenderObject();if(!J)return this.viewportHeight;let Q=(Z,X=0)=>{if(Z&&"size"in Z&&"children"in Z){let G=Z.children||[];for(let V of G){if(V&&"size"in V){let q=V.size;if(typeof q?.height==="number"&&q.height>0)return q.height}let K=Q(V,X+1);if(K>0)return K}}return 0},Y=Q(J);if(Y>0)return Y;return this.viewportHeight}build(J){let{toolUse:Q,toolRun:Y}=this.widget.props,Z=W0.of(J),X=Z.colors,G=new f({color:X.foreground,dim:!0});if(!this.scrollListenerAttached)this.scrollController.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0;let V=Q.input,K=new W8({name:"Read Thread",status:Y.status,children:V.threadID?[new e({text:new k(V.threadID,G),selectable:!0})]:[],content:V.goal?new J0({padding:new j1(2,0,2,1),child:new e({text:new k(V.goal,G),selectable:!0})}):void 0}),q;if(Y.status==="done")if(Y.result.split(`
|
|
5066
5066
|
`).length<20)q=new f8({markdown:Y.result});else q=new d1({constraints:new O0({maxHeight:20}),child:new X0({crossAxisAlignment:"stretch",children:[new I0({child:new q4({controller:this.scrollController,autofocus:!1,child:new f8({markdown:Y.result})})}),new _9({controller:this.scrollController,thumbColor:Z.app.scrollbarThumb,trackColor:Z.app.scrollbarTrack,getScrollInfo:()=>{let H=this.scrollController.maxScrollExtent,z=this.scrollController.offset,F=this.viewportHeight,U=H+F;return{totalContentHeight:Math.max(U,0),viewportHeight:Math.max(F,1),scrollOffset:Math.max(z,0)}}})]})});return new k1({crossAxisAlignment:"start",children:[K,new J0({padding:new j1(2,0,2,0),child:q})]})}}class iX6 extends S0{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Y}=this.props,Z=W0.of(J),X=Z.colors,G=new f({color:X.foreground,dim:!0}),K=Q.input.query||"Searching threads...",q=[new k(K,G)];if(Y.status==="done"){let z=Y.result.threads.length,F=Y.result.hasMore,U;if(z===0)U="No threads found";else if(z===1)U="1 thread";else U=`${z}${F?"+":""} threads`;q.push(new k(` (${U})`,new f({color:X.foreground,dim:!0})))}let W=new W8({name:"Find Thread",status:Y.status,children:[new e({text:new k("",void 0,q),selectable:!0})]}),H=[];if(Y.status==="done"&&Y.result.threads.length>0){for(let z of Y.result.threads){let F=z.title||"Untitled thread";H.push(new X0({children:[new M9({uri:`https://ampcode.com/threads/${z.id}`,text:F,style:new f({color:Z.app.link,underline:!0})}),new e({text:new k(` (${z.messageCount} messages${z.updatedAt?`, ${cA(new Date(z.updatedAt))} ago`:""})`,new f({color:X.foreground,dim:!0})),selectable:!0})]}))}if(Y.result.hasMore)H.push(new e({text:new k("More threads available...",new f({color:X.foreground,dim:!0,italic:!0})),selectable:!1}))}return new k1({crossAxisAlignment:"start",children:H.length>0?[W,new J0({padding:new j1(2,0,2,0),child:new BY({children:H})})]:[W]})}}H5();MG();n6();r0();v1();v1();class nX6{_listeners=new Set;_disposed=!1;addListener(J){if(this._disposed)throw Error("Cannot add listener to disposed ChangeNotifier");this._listeners.add(J)}removeListener(J){this._listeners.delete(J)}notifyListeners(){if(this._disposed)return;let J=Array.from(this._listeners);for(let Q of J)try{Q()}catch(Y){}}dispose(){this._disposed=!0,this._listeners.clear()}get disposed(){return this._disposed}get hasListeners(){return this._listeners.size>0}}class RM extends nX6{_value;constructor(J){super();this._value=J}get value(){return this._value}set value(J){let Q=typeof J==="object"||this._value!==J;if(this._value=J,Q)this.notifyListeners()}}function aX6(J,Q){let Y=()=>{Q()};return J.addListener(Y),{dispose:()=>J.removeListener(Y)}}class Sy1 extends d8{link;showWhenUnlinked;offset;constructor({key:J,link:Q,showWhenUnlinked:Y=!0,offset:Z={x:0,y:0},child:X}){super({key:J,child:X});this.link=Q,this.showWhenUnlinked=Y,this.offset=Z}createElement(){return new OV(this)}createRenderObject(){return new oX6(this.link,this.showWhenUnlinked,this.offset)}updateRenderObject(J){J.link=this.link,J.showWhenUnlinked=this.showWhenUnlinked,J.setFollowerOffset(this.offset)}}class oX6 extends W6{_link;_showWhenUnlinked;_followerOffset;_cachedPosition=null;constructor(J,Q,Y){super();this._link=J,this._showWhenUnlinked=Q,this._followerOffset=Y}get link(){return this._link}set link(J){this._link=J,this._cachedPosition=null,this.markNeedsLayout()}get showWhenUnlinked(){return this._showWhenUnlinked}set showWhenUnlinked(J){if(this._showWhenUnlinked!==J)this._showWhenUnlinked=J,this.markNeedsLayout()}setFollowerOffset(J){if(this._followerOffset.x!==J.x||this._followerOffset.y!==J.y)this._followerOffset={...J},this.markNeedsLayout()}calculatePosition(){let J=this._link.getTargetTransform();if(!J)return null;return{x:J.position.x+this._followerOffset.x,y:J.position.y+this._followerOffset.y}}shouldShow(){return this._link.target!==null||this._showWhenUnlinked}performLayout(){let J=this._lastConstraints;if(D6(!!J,"performLayout called without constraints"),!this.shouldShow()){this.setSize(0,0),super.performLayout();return}let Q=this.calculatePosition();if(this._cachedPosition=Q,Q)this.setOffset(Q.x,Q.y);if(this.children.length>0){let Y=this.children[0];Y.layout(J);let Z=Y.size;this.setSize(Z.width,Z.height)}else this.setSize(0,0);super.performLayout()}getCurrentPosition(){return this._cachedPosition}setOffset(J,Q){super.setOffset(J,Q)}paint(J,Q=0,Y=0){super.paint(J,Q,Y)}}class ky1 extends d8{link;constructor({key:J,link:Q,child:Y}){super({key:J,child:Y});this.link=Q}createElement(){return new OV(this)}createRenderObject(){return new rX6(this.link)}updateRenderObject(J){J.link=this.link}}class rX6 extends W6{_link;_globalPosition={x:0,y:0};constructor(J){super();this._link=J}get link(){return this._link}set link(J){if(this._link===J)return;this._link._setTarget(null),this._link=J,this._link._setTarget(this)}attach(){super.attach(),this._link._setTarget(this)}detach(){this._link._setTarget(null),super.detach()}getGlobalPosition(){let J=this.offset.x,Q=this.offset.y,Y=this.parent;while(Y&&Y instanceof W6)J+=Y.offset.x,Q+=Y.offset.y,Y=Y.parent;return{x:J,y:Q}}getSize(){let J=this.size;return{width:J.width,height:J.height}}updateGlobalPosition(){let J={...this._globalPosition};if(this._globalPosition=this.getGlobalPosition(),J.x!==this._globalPosition.x||J.y!==this._globalPosition.y)this._link._notifyFollowers()}performLayout(){let J=this._lastConstraints;if(D6(!!J,"performLayout called without constraints"),this.children.length>0){let Q=this.children[0];Q.layout(J);let Y=Q.size;this.setSize(Y.width,Y.height)}else this.setSize(0,0);this.updateGlobalPosition(),super.performLayout()}}v1();class yy1{_target=null;_followers=new Set;get target(){return this._target}_setTarget(J){if(this._target===J)return;this._target=J,this._notifyFollowers()}_addFollower(J){this._followers.add(J)}_removeFollower(J){this._followers.delete(J)}_notifyFollowers(){for(let J of this._followers)try{J()}catch(Q){R.error("Error in LayerLink follower callback:",Q)}}getTargetTransform(){if(!this._target)return null;return{position:this._target.getGlobalPosition(),size:this._target.getSize()}}}v1();class xy1{_state;_textController=null;_lastText="";_triggers=[];_optionsBuilder=null;_onSelected=null;_disposed=!1;constructor(){let J={trigger:null,options:[],selectedIndex:-1,isActive:!1,generationId:0};this._state=new RM(J)}get state(){return this._state}get currentState(){return this._state.value}initialize({textController:J,triggers:Q,optionsBuilder:Y,onSelected:Z}){if(this._disposed)throw Error("Cannot initialize disposed AutocompleteController");this._cleanup(),this._textController=J,this._lastText=J.text,this._triggers=Q,this._optionsBuilder=Y,this._onSelected=Z||null,this._textController.addListener(this._handleTextChange)}selectNext(){let J=this.currentState;if(!J.isActive||J.options.length===0)return;let Q=J.selectedIndex<J.options.length-1?J.selectedIndex+1:0;this._updateState({selectedIndex:Q})}selectPrevious(){let J=this.currentState;if(!J.isActive||J.options.length===0)return;let Q=J.selectedIndex>0?J.selectedIndex-1:J.options.length-1;this._updateState({selectedIndex:Q})}acceptSelected(){let J=this.currentState;if(!J.isActive||J.selectedIndex<0||J.selectedIndex>=J.options.length)return;let Q=J.options[J.selectedIndex];if(!Q)return;if(this.dismiss(),this._onSelected)this._onSelected(Q)}dismiss(){this._updateState({trigger:null,options:[],selectedIndex:-1,isActive:!1})}dispose(){this._disposed=!0,this._cleanup(),this._state.dispose()}_handleTextChange=()=>{if(!this._textController||!this._optionsBuilder)return;let J=this._textController.text,Q=J!==this._lastText;if(this._lastText=J,!Q&&!this.currentState.isActive)return;let Y=this._textController.cursorPosition,Z=null;for(let G of this._triggers){let V=G.detect(J,Y);if(V&&(!Z||V.start>Z.start))Z=V}if(!this.currentState.isActive&&Z){let G=n4(J),V=Y,K=V;while(K<G.length){let q=G[K];if(q&&/[\s)\]}]/.test(q))break;K++}if(K>V){let W=[...G.slice(0,V),...G.slice(K)].join("");this._textController.text=W,this._textController.cursorPosition=Y;return}}if(!Z){if(this.currentState.isActive)this.dismiss();return}let X=this.currentState.generationId+1;this._updateState({trigger:Z,generationId:X,isActive:!0,selectedIndex:-1}),this._buildOptions(Z.query,X)};async _buildOptions(J,Q){if(!this._optionsBuilder)return;try{let Y=await this._optionsBuilder(J);if(this.currentState.generationId===Q&&!this._disposed)this._updateState({options:Y,selectedIndex:Y.length>0?0:-1,isActive:Y.length>0})}catch(Y){if(R.error("Error building autocomplete options:",Y),this.currentState.generationId===Q&&!this._disposed)this._updateState({options:[],selectedIndex:-1,isActive:!1})}}_updateState(J){if(this._disposed)return;this._state.value={...this.currentState,...J}}_cleanup(){if(this._textController)this._textController.removeListener(this._handleTextChange)}}class Ug{}class Dg{}class Bg{}class y81{}class x81 extends p1{props;constructor(J){super({key:J.key});this.props=J}createState(){return new sX6(this.props)}}class sX6 extends u1{props;controller;stateListener=null;overlayEntry=null;layerLink=new yy1;scrollOffset=0;_effectiveFocusNode;_cachedMaxVisibleOptions=0;constructor(J){super();this.props=J}initState(){if(super.initState(),this._effectiveFocusNode=this.props.focusNode||new r6({debugLabel:"AutocompleteFocusOwned"}),this.controller=new xy1,this.controller.initialize({textController:this.props.controller,triggers:this.props.triggers,optionsBuilder:this.props.optionsBuilder,onSelected:this.props.onSelected}),this.stateListener=aX6(this.controller.state,()=>{this.updateOverlay(),this.setState(()=>{})}),this.props.handle)this.props.handle.dismiss=()=>this.controller.dismiss();if(this.props.autofocus??!0)Y4.instance.addPostFrameCallback(()=>{this._effectiveFocusNode.requestFocus()})}didUpdateWidget(J){super.didUpdateWidget(J);let Q=J.props,Y=this.widget.props;if(this.props=Y,Q.controller!==Y.controller||Q.triggers!==Y.triggers||Q.optionsBuilder!==Y.optionsBuilder||Q.textFieldProps!==Y.textFieldProps||Q.onSelected!==Y.onSelected)this.controller.initialize({textController:Y.controller,triggers:Y.triggers,optionsBuilder:Y.optionsBuilder,onSelected:Y.onSelected});if(Q.handle!==Y.handle){if(Y.handle)Y.handle.dismiss=()=>this.controller.dismiss()}this.setState(()=>{})}dispose(){this.removeOverlay(),this.stateListener?.dispose(),this.controller.dispose(),this._effectiveFocusNode.dispose(),super.dispose()}invoke=(J)=>{if(!this.controller.currentState.isActive)return"ignored";if(J instanceof Ug)return this.controller.selectNext(),this.updateScrollPosition(),"handled";if(J instanceof Dg)return this.controller.selectPrevious(),this.updateScrollPosition(),"handled";if(J instanceof Bg)return this.controller.acceptSelected(),"handled";if(J instanceof y81)return this.controller.dismiss(),"handled";return"ignored"};updateScrollPosition(){let J=this.controller.currentState;if(!J.isActive||J.selectedIndex<0)return;let Q=J.selectedIndex,Y=J.options.length,Z=this._cachedMaxVisibleOptions||Y;if(Z>=Y){this.scrollOffset=0;return}let X=Q-this.scrollOffset,G=1,V=this.scrollOffset;if(X>=Z-G)V=Math.max(0,Q-(Z-G-1));if(X<G)V=Math.max(0,Q-G);let K=Math.max(0,Y-Z);V=Math.min(V,K),this.scrollOffset=V}build(J){let Q=new P3({...this.props.textFieldProps,controller:this.props.controller,focusNode:this._effectiveFocusNode,autofocus:!1}),Y=new T3({shortcuts:new Map([[new p0("ArrowDown"),new Ug],[new p0("ArrowUp"),new Dg],[new p0("n",{ctrl:!0}),new Ug],[new p0("p",{ctrl:!0}),new Dg],[new p0("Enter"),new Bg],[new p0("Escape"),new y81],[new p0("Tab"),new Bg]]),focusNode:this._effectiveFocusNode,child:Q}),Z=new b5({actions:new Map([[Ug,new h6(this.invoke)],[Dg,new h6(this.invoke)],[Bg,new h6(this.invoke)],[y81,new h6(this.invoke)]]),child:Y});return new ky1({link:this.layerLink,child:Z})}updateOverlay(){let J=this.controller.currentState;if(J.isActive&&J.options.length>0)if(!this.overlayEntry)this.createOverlay();else this.overlayEntry.markNeedsBuild();else this.removeOverlay()}createOverlay(){if(this.overlayEntry)return;this.overlayEntry=new pk1((J)=>{let Q=this.controller.currentState;return this.buildOverlayContent(J,Q)});try{OM.of(this.context).insert(this.overlayEntry)}catch(J){R.error("Failed to insert autocomplete overlay:",J),this.overlayEntry=null}}removeOverlay(){if(this.overlayEntry)this.overlayEntry.remove(),this.overlayEntry=null}buildOverlayContent(J,Q){let Y=x0.maybeOf(J),Z=Y?.colorScheme.background??o.black,X=this.props.overlayBorderColor??Y?.colorScheme.border??o.default(),G=Q.options.length,V=t0.sizeOf(J).height,K=0;try{let C=this.layerLink.getTargetTransform();if(C)K=C.position.y}catch{}let q=this.props.autoOverlayPosition?K<V/3:!1,W=2,H;if(q){let C=this.props.controller.getCursorVisualRow(),y=K+C+1;H=V-y-W}else H=K-W;G=Math.min(G,Math.max(1,H)),this._cachedMaxVisibleOptions=G,this.updateScrollPosition();let z=this.scrollOffset,F=Math.min(Q.options.length,z+G),U=[],D=0;for(let C=z;C<F;C++){let y=Q.options[C];if(!y)continue;let S=C===Q.selectedIndex,x,c;if(this.props.optionViewBuilder){x=this.props.optionViewBuilder(J,y,S);let b=this.props.displayStringForOption?.(y)??String(y),u="",d=b,h=y;if(h&&typeof h==="object"&&"type"in h)switch(h.type){case"file":u="@",d=h.path||b;break;case"artifact":u="",d=h.label||b;break}c=u+d}else{let b=this.props.displayStringForOption?.(y)??String(y),u=Y?.colorScheme.selection??o.index(8),d=Y?.colorScheme.foreground??o.default();x=new e({text:new k(b,new f({color:d,backgroundColor:S?u:void 0}))}),c=b}let m=t0.of(J),v=R3(c,m.supportsEmojiWidth);D=Math.max(D,v),U.push(x)}let B=t0.sizeOf(J).width,N=D+4,w=Math.floor(B*0.9),M=Math.max(Math.min(N,w),Math.min(30,w)),A=U.length+2,I;if(q)I=this.props.controller.getCursorVisualRow()+1;else I=-A;let P=new I1({width:M,child:new d1({height:A,decoration:new w6(Z),child:new VY({decoration:{border:y0.all(new j0(X,1,"rounded"))},padding:j1.symmetric(1,0),overlays:this.props.showThreadMentionHint??!0?[{child:new e({text:new k(" ",new f({dim:!0}),[new k("@@",new f({color:W0.of(J).app.command})),new k(" to mention a thread ",new f({color:X}))])}),position:"top",alignment:"center"}]:[],child:new k1({crossAxisAlignment:"start",children:U})})})});return new Sy1({link:this.layerLink,showWhenUnlinked:!1,offset:{x:0,y:I},child:P})}}function tX6(J){if(J.kind!=="file"&&J.kind!=="folder")throw Error("Invalid completion item: missing path or kind");return{type:"file",path:J.path,kind:J.kind}}function vy1(J){switch(J.type){case"file":return J.path;case"hint":return J.message}}function eX6(J){switch(J.type){case"file":return;case"hint":return}}class XU{detect(J,Q){if(!J||Q<1)return null;let Y=n4(J);if(Q>Y.length)return null;let Z=this.findWordStart(Y,Q);if(Z>=Y.length||Y[Z]!=="@")return null;let X=Y.slice(Z+1,Q).join("");if(X.includes(" ")||X.includes("\t")||X.includes(`
|
|
5067
5067
|
`))return null;return{start:Z,end:Q,query:X,trigger:"@"}}findWordStart(J,Q){let Y=Q;for(let Z=Q-1;Z>=0;Z--){let X=J[Z];if(!X||/[\s([{]/.test(X)){Y=Z+1;break}if(Z===0)Y=0}return Y}}class Ng extends p1{props;constructor(J){super({key:J.key});this.props=J}createState(){return new J$6(this.props)}}class J$6 extends u1{props;_effectiveFocusNode;_textChangeListener=null;constructor(J){super();this.props=J}buildOptions=async(J)=>{let Q=this.props.controller.text,Y=this.props.controller.cursorPosition,X=new XU().detect(Q,Y);if(X&&this.props.completionBuilder){if(X.query==="@"&&this.props.onDoubleAtTrigger)return this.props.onDoubleAtTrigger(),[];return await this.props.completionBuilder.buildOptions(X)}return[]};defaultOnOptionSelected=(J)=>{switch(J.type){case"hint":return;case"file":{let Q=this.props.controller.text,Y=this.props.controller.cursorPosition,X=Q.slice(0,Y).lastIndexOf("@");if(X!==-1){let G=Q.slice(0,X),V=Q.slice(Y),K=G+`@${J.path} `+V;this.props.controller.clear(),this.props.controller.insertText(K),this.props.controller.cursorPosition=X+1+J.path.length+1}break}}};initState(){super.initState(),this._effectiveFocusNode=this.props.focusNode||new r6({debugLabel:"PromptEditorFocus"}),this._textChangeListener=()=>{this.setState()},this.props.controller.addListener(this._textChangeListener),this.props.controller.onInsertText=(J,Q)=>{if(J.length<=3)return!0;let Y=EZ6(J);if(!Y)return!0;if(this.props.onInsertImage)return this.props.onInsertImage(Y);return!0}}didUpdateWidget(J){super.didUpdateWidget(J),this.props=this.widget.props}dispose(){if(this._textChangeListener)this.props.controller.removeListener(this._textChangeListener),this._textChangeListener=null;if(!this.props.focusNode)this._effectiveFocusNode.dispose();super.dispose()}_handleOpenInEditor=async(J)=>{let{mkdtemp:Q,readFile:Y,unlink:Z,rmdir:X,writeFile:G}=await import("node:fs/promises"),{tmpdir:V}=await import("node:os"),K=await import("node:path");try{let q=await Q(K.join(V(),"amp-edit-")),W=K.join(q,"message.amp.md");await G(W,J,"utf-8"),await uZ(W);try{let H=await Y(W,"utf-8");this.props.controller.text=H}catch(H){if(H?.code!=="ENOENT")R.error("Failed to read temporary file",H)}try{await Z(W),await X(q)}catch(H){R.warn("Failed to clean up temporary file",H)}}catch(q){R.error("Error opening editor:",q)}};_handleBackspaceAtStart=()=>{if(this.props.imageAttachments.length>0&&this.props.popImage)return this.props.popImage(),!0;if((this.props.pendingSkills??[]).length>0&&this.props.popSkill)return this.props.popSkill(),!0;return!1};_handleSubmitted=(J)=>{if(this.props.previousThreadId&&J.trim()===""){this.props.onPreviousThreadHintAccepted?.();return}this.props.onSubmitted?.(J)};build(J){let Q=this.props.theme,Y=this.props.pendingSkills??[],Z=this.props.imageAttachments.length>0,X=Y.length>0?new X0({mainAxisSize:"min",children:[new e({text:new k("Skills: ",new f({color:Q.foreground,dim:!0}))}),...Y.flatMap((K,q)=>{let W=new H6({onClick:()=>{this.props.onSkillClick?.(q)},cursor:"pointer",child:new e({text:new k(K.name,new f({color:Q.success,underline:!0}))})});if(q<Y.length-1)return[W,new e({text:new k(" ")})];return[W]})]}):null,G=Z?new X0({mainAxisSize:"min",children:[new e({text:new k("Images: ",new f({color:Q.foreground,dim:!0}))}),...this.props.imageAttachments.flatMap((K,q)=>{let W=new H6({onClick:()=>{this.props.onImageClick?.(q)},cursor:"pointer",child:new e({text:new k(`[Image ${q+1}]`,new f({color:Q.success,underline:!0}))})});if(q<this.props.imageAttachments.length-1)return[W,new e({text:new k(" ")})];return[W]})]}):null,V=new x81({controller:this.props.controller,triggers:this.props.triggers,optionsBuilder:this.buildOptions,onSelected:this.props.onOptionSelected??this.defaultOnOptionSelected,displayStringForOption:(K)=>vy1(K),overlayBorderColor:Q.border,focusNode:this._effectiveFocusNode,autofocus:this.props.autofocus??!0,autoOverlayPosition:this.props.autoOverlayPosition,handle:this.props.autocompleteHandle,showThreadMentionHint:!!this.props.onDoubleAtTrigger,textFieldProps:{placeholder:this.props.placeholder,wrap:!0,minLines:this.props.minLines??3,maxLines:null,expands:!0,autofocus:!1,enabled:this.props.enabled??!0,onSubmitted:this._handleSubmitted,onOpenInEditor:this._handleOpenInEditor,submitKey:{character:"Enter"},prompts:this.props.shellPromptRules,style:{border:null,padding:j1.all(0),textColor:this.props.textColor},clipboard:this.props.clipboard,onCopy:this.props.onCopy,copyOnSelectionEnabled:!0,onBackspaceWhenEmpty:this._handleBackspaceAtStart},optionViewBuilder:(K,q,W)=>{let H=W?Q.selection:void 0,z=Q.secondary,F=Q.foreground,U=Q.foreground,D,B;switch(q.type){case"file":D="@",B=q.path;break;case"hint":D="",B=q.message;break;default:D="",B=vy1(q);break}let N=eX6(q),w=new k(D,new f({color:z})),M=new k(B,new f({color:F})),L=[w,M];if(N){let O=new k(" - ",new f({color:U,dim:!0})),A=new k(N,new f({color:U,dim:!0}));L.push(O,A)}return new d1({decoration:new w6(H),child:new e({text:new k("",void 0,L),maxLines:1,overflow:"ellipsis"})})}});if(X||G){let K=[];if(X)K.push(X);if(X&&G)K.push(new e({text:new k(" ")}));if(G)K.push(G);let q=new d1({padding:j1.only({bottom:1}),child:new X0({mainAxisSize:"min",children:K})});return new k1({crossAxisAlignment:"start",children:[q,new I0({child:V})]})}return V}requestFocus(){this._effectiveFocusNode.requestFocus()}}var Q$6=o.green,by1=o.cyan;function gy1(J,Q){let Z=W0.of(J).colors,X=Q.toolRun.status==="done"?Q.toolRun.result.output:("progress"in Q.toolRun)?Q.toolRun.progress?.output:void 0,G=Q.toolRun.status==="done"?Q.toolRun.result.exitCode:void 0,V=Q.toolRun.status==="cancelled"?"Cancelled":Q.toolRun.status==="error"?"Errored":void 0,K=[];if(X&&X.trim())K.push(new k(X.trimEnd(),new f({color:Z.foreground,dim:!0})));if(G!==void 0&&G!==0)K.push(new k(`
|
|
5068
5068
|
|
|
@@ -5075,7 +5075,7 @@ exit code: ${G}`,new f({color:Z.foreground,dim:!0,italic:!0})));if(V)K.push(new
|
|
|
5075
5075
|
`));let q=K.startsWith("file://")?Q0.parse(K):Q0.file(K),W=q7(q,X??void 0);G.push(new k(` • ${W}`,new f({color:Z.foreground,dim:!0})))}return new e({text:new k("",void 0,G)})}class $$6 extends S0{props;constructor(J){super();this.props=J}build(J){let Q=this.props.affectedFiles,Y=Q.length>0,X=[new e({text:new k(Y?"This will delete this message and any subsequent messages in the thread, and will restore the following files:":"This will delete this message and any subsequent messages in the thread.",new f({color:o.yellow,bold:!0}))}),new I1({height:1})],G=X$6(J,Q);if(G)X.push(G),X.push(new I1({height:1}));let V=[{value:"confirm",label:Y?"Delete and restore":"Delete"},{value:"cancel",label:"Cancel"}];return X.push(new O5({options:V,onSelect:(K)=>{if(K==="confirm")this.props.onConfirm();else this.props.onCancel()},padding:j1.all(0),showDismissalMessage:!1,enableMouseInteraction:!1,showBorder:!1})),new k1({mainAxisSize:"min",crossAxisAlignment:"start",children:X})}}class G$6 extends S0{props;constructor(J){super();this.props=J}build(J){let Q=this.props.affectedFiles,Y=[],Z=X$6(J,Q);if(Z)Y.push(new e({text:new k("This will restore the following files:",new f({color:o.yellow,bold:!0}))})),Y.push(new I1({height:1})),Y.push(Z),Y.push(new I1({height:1}));let X=[{value:"confirm",label:"Confirm edit"},{value:"cancel",label:"Cancel"}];return Y.push(new O5({options:X,onSelect:(G)=>{if(G==="confirm")this.props.onConfirm();else this.props.onCancel()},padding:j1.all(0),showDismissalMessage:!1,enableMouseInteraction:!1,showBorder:!1})),new k1({mainAxisSize:"min",crossAxisAlignment:"start",children:Y})}}class f81 extends p1{initialText;onSubmitted;message;completionBuilder;autocompleteHandle;onShowImagePreview;constructor(J){super();this.initialText=J.initialText,this.onSubmitted=J.onSubmitted,this.message=J.message,this.completionBuilder=J.completionBuilder,this.autocompleteHandle=J.autocompleteHandle,this.onShowImagePreview=J.onShowImagePreview}createState(){return new V$6}}class V$6 extends u1{controller=new Q7;currentShellModeStatus;imageAttachments=[];initState(){this.controller.text=this.widget.initialText,this.controller.addListener(this.textChangeListener);let J=tF(this.widget.initialText);if(this.currentShellModeStatus=J?.visibility,this.widget.message){let Q=this.widget.message.content.filter((Y)=>Y.type==="image");this.imageAttachments=Q}}dispose(){this.controller.removeListener(this.textChangeListener),this.controller.dispose(),super.dispose()}textChangeListener=()=>{let J=this.controller.text,Y=tF(J)?.visibility;if(Y!==this.currentShellModeStatus)this.currentShellModeStatus=Y,this.setState(()=>{})};handleSubmit=(J)=>{this.widget.onSubmitted(J,this.imageAttachments)};handleInsertImage=(J)=>{let Q=fj(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q]}),!1;return!1};handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1)})};handleImageClick=(J)=>{let Q=this.imageAttachments[J];if(Q)this.widget.onShowImagePreview(Q,J,()=>{this.setState(()=>{this.imageAttachments=this.imageAttachments.filter((Y,Z)=>Z!==J)})})};build(J){let Q=W0.of(J),Y=Q.colors,Z=Q.app,X=this.currentShellModeStatus?xZ6(Q,this.currentShellModeStatus):Q$6,G=null,V=this.widget.message&&_l(this.widget.message);if(V)G=gy1(J,V);let K=new Ng({controller:this.controller,triggers:[new XU],completionBuilder:this.widget.completionBuilder,ampURL:"",onSubmitted:this.handleSubmit,theme:Y,placeholder:"",enabled:!0,autofocus:!0,shellPromptRules:D81(Q),imageAttachments:this.imageAttachments,onInsertImage:this.handleInsertImage,popImage:this.handlePopImage,onImageClick:this.handleImageClick,minLines:1,textColor:X,autocompleteHandle:this.widget.autocompleteHandle,autoOverlayPosition:!0}),q=[];if(q.push(K),G)q.push(new I1({height:1})),q.push(G);let W;if(q.length===1)W=q[0];else W=new k1({mainAxisSize:"min",crossAxisAlignment:"start",children:q});let H=[];if(this.currentShellModeStatus===sF)H.push(new k("shell mode (incognito)",new f({color:Q.app.shellModeHidden})));else if(this.currentShellModeStatus===F81)H.push(new k("shell mode",new f({color:Q.app.shellMode})));else H.push(new k("esc",new f({color:Z.keybind})),new k(" to cancel",new f({color:Y.foreground,dim:!0})));return new Yh({child:new VY({decoration:{border:y0.all(new j0(X,2,"solid"))},padding:j1.only({left:1,right:1}),overlays:[{child:new e({text:new k("",void 0,H)}),position:"bottom",alignment:"left"}],child:W})})}}class h81 extends x8{}class g81 extends x8{}class my1 extends x8{}class uy1 extends x8{}class py1 extends x8{}class dy1 extends x8{}class cy1 extends x8{}class ly1 extends x8{}function pB8(J,Q,Y){let X=W0.maybeOf(J)?.colors??x0.of(J).colorScheme,V=Q.trimStart().startsWith("You're absolutely right"),K=new y8(`${Y}-text`),q=[];if(V)q.push(new zy1({key:K,markdown:Q,defaultColor:X.foreground}));else q.push(new f8({key:K,markdown:Q}));if(q.length===1)return q[0];return new k1({crossAxisAlignment:"stretch",mainAxisSize:"min",children:q})}function dB8(J,Q){let Z=x0.of(J).colorScheme;if(Q.summary.type!=="message")return new d1;return new k1({crossAxisAlignment:"start",children:[new e({text:new k("Summary:",new f({color:Z.foreground,dim:!0,bold:!0,italic:!0})),selectable:!0}),new I1({height:1}),new f8({markdown:Q.summary.summary,styleScheme:{text:new f({color:Z.foreground,dim:!0,italic:!0}),inlineCode:new f({color:Z.foreground,dim:!0,italic:!0}),codeBlock:new f({color:Z.foreground,dim:!0,italic:!0}),tableBorder:Z.foreground,link:new f({color:Z.foreground,dim:!0,italic:!0}),syntaxHighlight:{keyword:Z.foreground,string:Z.foreground,number:Z.foreground,comment:Z.foreground,function:Z.foreground,variable:Z.foreground,type:Z.foreground,operator:Z.foreground}}})]})}class m81 extends p1{items;subagentToolsByParentID;controller;autofocus;onNewMessage;showScrollbar;onCopy;onMessageEditSubmit;onShellCommandSubmit;onMessageRestoreSubmit;onMessageForkSubmit;getAffectedFiles;thread;focusNode;onDismissFocus;isInSelectionMode=!1;isInHandoffMode=!1;completionBuilder;onShowImagePreview;onSelectionChanged;get userMessageIndices(){let J=[];for(let Q=0;Q<this.items.length;Q++){let Y=this.items[Q];if(Y?.type==="message"){if(Y.message.role==="user"||mO(Y.message))J.push(Q)}}return J}constructor({key:J,items:Q,subagentToolsByParentID:Y={},controller:Z,autofocus:X=!1,onNewMessage:G,showScrollbar:V=!0,onCopy:K,onMessageEditSubmit:q,onMessageRestoreSubmit:W,onMessageForkSubmit:H,getAffectedFiles:z,thread:F,focusNode:U,onDismissFocus:D,isInSelectionMode:B=!1,isInHandoffMode:N=!1,completionBuilder:w,onShowImagePreview:M,onSelectionChanged:L}){super(J?{key:J}:{});this.items=Q,this.subagentToolsByParentID=Y,this.controller=Z,this.autofocus=X,this.onNewMessage=G,this.showScrollbar=V,this.onCopy=K,this.onMessageEditSubmit=q,this.onMessageRestoreSubmit=W,this.onMessageForkSubmit=H,this.getAffectedFiles=z,this.thread=F,this.focusNode=U,this.onDismissFocus=D,this.isInSelectionMode=B,this.isInHandoffMode=N,this.completionBuilder=w,this.onShowImagePreview=M,this.onSelectionChanged=L}createState(){return new K$6}}class K$6 extends u1{_controller=null;_isDisposed=!1;_thinkingBlockStates=new Map;_globalToggleListener;_streamingIndexes=new Set;_viewportHeight=25;_widgetCache=new Map;_lastCostDisplayState=null;_selectedUserMessageOrdinal=null;_editingMessageOrdinal=null;_isShowingRestoreConfirmation=!1;_isShowingEditConfirmation=!1;_pendingEditText=null;_pendingEditImageAttachments=[];_affectedFiles=[];_autocompleteHandle={dismiss:()=>{}};_scrollListener=null;get controller(){return this._controller}dismiss(){Y4.instance.addPostFrameCallback(()=>{this.widget.focusNode?.unfocus()}),this.widget.onDismissFocus?.()}_navigateUp(J,Q){if(Q<=0)return null;if(J===null)return Q-1;if(J<=0)return 0;return J-1}_navigateDown(J,Q){if(Q<=0)return null;if(J===null)return null;if(J>=Q-1)return null;return J+1}_ordinalToIndex(J,Q){if(Q===null)return null;if(Q<0||Q>=J.length)return null;return J[Q]??null}_getUserCount(){return this.widget.userMessageIndices.length}_clearSelectedUserMessage(){let J=this._selectedUserMessageOrdinal,Q=J!==null?this.getUserMessageIndexFromOrdinal(J):null;this.setState(()=>{if(Q!=null)this._widgetCache.delete(Q);this._selectedUserMessageOrdinal=null})}_selectUserMessageByOrdinal(J){let Q=this._selectedUserMessageOrdinal,Y=J,Z=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,X=this.getUserMessageIndexFromOrdinal(Y);if(Z!==null)this._widgetCache.delete(Z);if(X!==null)this._widgetCache.delete(X);if(this.setState(()=>{this._selectedUserMessageOrdinal=Y}),X!==null)Y4.instance.addPostFrameCallback(()=>{this.scrollToMessage(X,{animated:!0,edge:"top",duration:200})})}_selectEditingUserMessageByOrdinal(J){let Q=this._editingMessageOrdinal,Y=J,Z=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,X=Y!==null?this.getUserMessageIndexFromOrdinal(Y):null;if(Z!==null)this._widgetCache.delete(Z);if(X!==null)this._widgetCache.delete(X);this.setState(()=>{this._editingMessageOrdinal=Y})}getUserMessageIndexFromOrdinal(J){return this.widget.userMessageIndices[J]??null}getOrdinalFromUserMessageIndex(J){let Y=this.widget.userMessageIndices.indexOf(J);return Y>=0?Y:null}getLatestUserMessageOrdinal(){let J=this.widget.userMessageIndices;return J.length>0?J.length-1:null}navigateToUserMessage(J){let Q=this._getUserCount(),Y=J==="up"?this._navigateUp(this._selectedUserMessageOrdinal,Q):this._navigateDown(this._selectedUserMessageOrdinal,Q);if(Y===null&&J==="down"){this._controller?.animateToBottom(100),this._clearSelectedUserMessage(),this.dismiss();return}if(Y!==null)this._selectUserMessageByOrdinal(Y)}handleNavigateUserMessageUp=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("up"),"handled"};handleNavigateUserMessageDown=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("down"),"handled"};handleEscape=()=>{if(this._editingMessageOrdinal!==null)return this.setState(()=>{let J=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(J!=null)this._widgetCache.delete(J);this._editingMessageOrdinal=null}),"handled";else if(this._selectedUserMessageOrdinal!==null)return this._clearSelectedUserMessage(),this.setState(()=>{this._editingMessageOrdinal=null}),this.dismiss(),this._controller?.animateToBottom(100),"handled";return"ignored"};handleScrollDown=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollDown(1),"handled";return"ignored"};handleScrollUp=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollUp(1),"handled";return"ignored"};handleEditMessage=()=>{if(this._selectedUserMessageOrdinal!==null)return this._selectEditingUserMessageByOrdinal(this._selectedUserMessageOrdinal),"handled";return"ignored"};handleRestoreMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||mO(Q.message)))this.showRestoreConfirmation(Q.message,J)}return"handled"}return"ignored"};async showRestoreConfirmation(J,Q){let Y=[];if(this.widget.getAffectedFiles)try{Y=await this.widget.getAffectedFiles(J)}catch{Y=[]}if(this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!0,this._affectedFiles=Y}),this.controller.atBottom)Y4.instance.addPostFrameCallback(()=>{this.scrollToMessage(Q)})}handleRestoreConfirm=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||Q.message.role==="info"))this.widget.onMessageRestoreSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!1,this._affectedFiles=[]}),this.dismiss()}return"handled"}return"ignored"};handleRestoreCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!1,this._affectedFiles=[]}),this.controller.atBottom)Y4.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}}return"handled"};handleForkMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||mO(Q.message))){if(J===0)return"ignored";this.widget.onMessageForkSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{}),this.dismiss()}}return"handled"}return"ignored"};handleEditConfirmationRequest=async(J,Q)=>{if(J.trim()===""&&Q.length===0)return;if(this._editingMessageOrdinal!==null){let Y=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(Y!=null){let Z=this.widget.items[Y],X=[];if(this.widget.getAffectedFiles&&Z?.type==="message")try{X=await this.widget.getAffectedFiles(Z.message)}catch{X=[]}if(X.length===0&&Z?.type==="message"&&(Z.message.role==="user"||Z.message.role==="info")){this.widget.onMessageEditSubmit?.(Z.message,J,Q),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._editingMessageOrdinal=null}),this.dismiss(),this.controller.animateToBottom(100);return}if(this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!0,this._pendingEditText=J,this._pendingEditImageAttachments=Q,this._affectedFiles=X,this._editingMessageOrdinal=null}),this.controller.atBottom)Y4.instance.addPostFrameCallback(()=>{this.scrollToMessage(Y)})}}};handleEditConfirm=()=>{if(this._selectedUserMessageOrdinal!==null&&this._pendingEditText!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||Q.message.role==="info"))this.widget.onMessageEditSubmit?.(Q.message,this._pendingEditText,this._pendingEditImageAttachments),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!1,this._pendingEditText=null,this._pendingEditImageAttachments=[],this._affectedFiles=[]}),this.dismiss(),this.controller.animateToBottom(100)}}};handleEditCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!1,this._pendingEditText=null,this._pendingEditImageAttachments=[],this._affectedFiles=[]}),this.controller.atBottom)Y4.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}}};_signatureFor(J){if(J.type==="message"){let Q=J.message;if(Q.role==="user"){let Y=V7(Q.content),Z=Q.content.filter((X)=>X.type==="image").length;return`${J.id}|user|${Q.interrupted?1:0}|${Z}|${Y}`}else if(Q.role==="assistant"){let Y=V7(Q.content),Z=Q.state?.type??"none",X=Q.content.filter((q)=>q.type==="thinking"),G=Q.content.filter((q)=>q.type==="tool_use"),V=Q.usage,K=V?`${V.credits??""}|${V.inputTokens}|${V.outputTokens}|${V.cacheCreationInputTokens??""}|${V.cacheReadInputTokens??""}|${V.model??""}`:"no-usage";return`${J.id}|assistant|${Z}|${X.length}|${G.length}|${Y}|${K}`}else{let Z=Q.content.map((X)=>X.type).join(",");return`${J.id}|info|${Z}`}}else{let Y=J.toolResult.run.status;return`${J.id}|tool|${Y}|${J.toolUse.id}`}}getThinkingBlockExpanded(J,Q){let Y=`${J}-${Q}`;return this._thinkingBlockStates.get(Y)??Y7.instance.allExpanded}toggleThinkingBlock=(J,Q)=>{return(Y)=>{let Z=`${J}-${Q}`;this.setState(()=>{this._thinkingBlockStates.set(Z,Y),this._widgetCache.delete(J)})}};buildThinkingBlock(J,Q,Y,Z,X){let G=Y===X,V=Z.state?.type==="streaming"&&G,K=Z.state?.type==="cancelled"&&G;return new IM({key:new y8(`thinking-${Q}-${Y}`),thinkingBlock:J,expanded:this.getThinkingBlockExpanded(Q,Y),onToggle:this.toggleThinkingBlock(Q,Y),isStreaming:V,isCancelled:K})}buildAssistantMessageWidget(J,Q,Y,Z){let X=Q.content.map((U,D)=>({block:U,index:D})).filter((U)=>U.block.type==="thinking"&&Kg(U.block.thinking).length>0),G=X.length>0,V=X.length>0?X.at(-1).index:-1,K=Q.content.filter((U)=>U.type==="text"),q=[];if(q.push(...X.map(({block:U,index:D})=>this.buildThinkingBlock(U,Y,D,Q,V))),G&&K.length>0)q.push(new I1({height:1}));let W=V7(K);if(W.trim())q.push(pB8(J,W,Z));let H=Hy1(J),z=Q.usage!=null&&(Q.usage.inputTokens>0||Q.usage.outputTokens>0);if(H&&z){let D=W0.maybeOf(J)?.colors??x0.of(J).colorScheme,B=XX6(Q.usage);q.push(new J0({padding:j1.only({top:1}),child:new e({text:new k(B,new f({color:D.foreground,dim:!0}))})}))}let F;if(q.length===0)F=new d1;else if(q.length===1)F=q[0];else F=new k1({crossAxisAlignment:"stretch",mainAxisSize:"min",children:q});return F}buildThreadItemWidget(J,Q,Y){let Z=new y8(`thread-item-${Q.id}`);if(Q.type==="message"){let X=Q.message;if(X.role==="user"){let G,V=(K,q)=>{this.widget.onShowImagePreview(K,q,()=>{})};if(!this.widget.isInSelectionMode)G=new nj({message:X,isFirstMessage:Y>0,onShowImagePreview:V});else{let K=this.getOrdinalFromUserMessageIndex(Y);if(K===null)G=new nj({message:X,isFirstMessage:Y>0,onShowImagePreview:V});else if(this._editingMessageOrdinal===K)G=new f81({initialText:V7(X.content),message:X,onSubmitted:(q,W)=>{this.handleEditConfirmationRequest(q,W)},completionBuilder:this.widget.completionBuilder,autocompleteHandle:this._autocompleteHandle,onShowImagePreview:this.widget.onShowImagePreview});else if(this._selectedUserMessageOrdinal===K)G=new b81({message:X,isFirstMessage:Y>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,isShowingEditConfirmation:this._isShowingEditConfirmation,affectedFiles:this._affectedFiles,pendingEditText:this._pendingEditText??void 0,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()},onEditConfirm:()=>{this.handleEditConfirm()},onEditCancel:()=>{this.handleEditCancel()},onShowImagePreview:V});else G=new nj({message:X,isFirstMessage:Y>0,onShowImagePreview:V})}return G}else if(X.role==="assistant"){let G=this.buildAssistantMessageWidget(J,X,Y,Q.id);return new d1({key:Z,child:G})}else{let G=X,V=[],K=this.getOrdinalFromUserMessageIndex(Y),q=this.widget.isInSelectionMode&&K!==null&&this._selectedUserMessageOrdinal===K,W=(H,z)=>{this.widget.onShowImagePreview(H,z,()=>{})};for(let H of G.content)if(H.type==="manual_bash_invocation")if(this._editingMessageOrdinal===K){let F=`${U81(H.hidden??!1)}${H.args.cmd}`;V.push(new f81({initialText:F,message:G,onSubmitted:(U,D)=>{this.handleEditConfirmationRequest(U,D)},completionBuilder:this.widget.completionBuilder,autocompleteHandle:this._autocompleteHandle,onShowImagePreview:this.widget.onShowImagePreview}))}else if(!this.widget.isInSelectionMode||!q)V.push(new nj({message:G,isFirstMessage:Y>0,onShowImagePreview:W}));else V.push(new b81({message:G,isFirstMessage:Y>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,isShowingEditConfirmation:this._isShowingEditConfirmation,affectedFiles:this._affectedFiles,pendingEditText:this._pendingEditText??void 0,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()},onEditConfirm:()=>{this.handleEditConfirm()},onEditCancel:()=>{this.handleEditCancel()},onShowImagePreview:W}));else if(H.type==="summary"&&H.summary.type==="message")V.push(dB8(J,H));if(V.length===0)return new d1;if(V.length===1)return V[0];return new k1({crossAxisAlignment:"stretch",children:V})}}else{let X=new zW({toolUse:Q.toolUse,toolRun:Q.toolResult.run,subagentTools:this.widget.subagentToolsByParentID[Q.toolUse.id],thread:this.widget.thread});return new d1({key:Z,child:X})}}initState(){if(super.initState(),this._controller=this.widget.controller||new a4,this._scrollListener=()=>{this._autocompleteHandle.dismiss()},this._controller.addListener(this._scrollListener),this._globalToggleListener=()=>{this.setState(()=>{this._thinkingBlockStates.clear(),this._widgetCache.clear()})},Y7.instance.addListener(this._globalToggleListener),this.widget.items.length>0)Y4.instance.requestFrame()}didUpdateWidget(J){if(super.didUpdateWidget(J),!J.isInSelectionMode&&this.widget.isInSelectionMode){this.widget.focusNode?.requestFocus();let Y=this.getLatestUserMessageOrdinal();if(Y!==null)this._selectUserMessageByOrdinal(Y)}if(J.items===this.widget.items)return;let Q=Math.min(J.items.length,this.widget.items.length);for(let Y=0;Y<Q;Y++){let Z=J.items[Y],X=this.widget.items[Y];if(Z&&X){if(Z.type!==X.type){this._widgetCache.delete(Y);continue}if(Z.type==="toolResult"&&X.type==="toolResult"){let G=Z.toolResult.run,V=X.toolResult.run;if(G.status!==V.status||"result"in G!=="result"in V||"error"in G!=="error"in V)this._widgetCache.delete(Y)}if(Z.type==="message"&&X.type==="message"){let G=Z.message,V=X.message;if(G.content!==V.content)this._widgetCache.delete(Y)}}}if(this.widget.items.length<J.items.length)this._cleanupOrphanedCacheEntries();this._updateStreamingIndexes();for(let Y of this._streamingIndexes)if(Y>=this.widget.items.length)this._streamingIndexes.delete(Y)}_cleanupOrphanedCacheEntries(){for(let J of this._widgetCache.keys())if(J>=this.widget.items.length)this._widgetCache.delete(J)}_isMessageStreaming(J){if(J.type!=="message")return!1;let Q=J.message;if(Q.role!=="assistant")return!1;if(Q.state.type==="streaming")return!0;return Q.content.at(-1)?.type==="thinking"}_updateStreamingIndexes(){for(let J of this._streamingIndexes)if(J>=this.widget.items.length)this._streamingIndexes.delete(J);for(let J=0;J<this.widget.items.length;J++){let Q=this.widget.items[J];if(!Q)continue;let Y=this._isMessageStreaming(Q);if(Y&&!this._streamingIndexes.has(J))this._streamingIndexes.add(J);else if(!Y&&this._streamingIndexes.has(J))this._streamingIndexes.delete(J)}}_getViewportHeight(){let J=this.context.findRenderObject();if(J&&"size"in J){let Q=J.size;if(typeof Q.height==="number"&&Q.height>0)return this._viewportHeight=Q.height,Q.height}return this._viewportHeight}dispose(){if(this._isDisposed=!0,this._widgetCache.clear(),this._scrollListener&&this._controller)this._controller.removeListener(this._scrollListener),this._scrollListener=null;if(this._globalToggleListener)Y7.instance.removeListener(this._globalToggleListener);if(!this.widget.controller)this._controller?.dispose();this.widget.focusNode?.dispose(),super.dispose()}build(J){let Q=W0.of(J),Y=Hy1(J);if(this._lastCostDisplayState!==null&&this._lastCostDisplayState!==Y)this._widgetCache.clear();this._lastCostDisplayState=Y;let Z=this._getTotalItemCount(J),X=[];for(let F=0;F<Z;F++)if(X.push(this._buildItemAtIndex(J,F)),F<Z-1)X.push(new I1({height:1}));let G=new q4({controller:this._controller,autofocus:this.widget.autofocus,position:"bottom",child:new k1({key:new y8("message-list-column"),crossAxisAlignment:"start",children:X})}),K=[new J0({padding:j1.only({left:2,right:this.widget.showScrollbar?3:2,bottom:1}),child:G})];if(this.widget.showScrollbar&&this._controller){let F=new _9({controller:this._controller,getScrollInfo:()=>this._getScrollbarInfo(),thickness:1,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack});K.push(new f4({right:1,top:0,bottom:0,child:new I1({width:1,child:F})}))}let q=new x4({children:K}),W=new eq({child:q,onCopy:this.widget.onCopy,onSelectionChanged:this.widget.onSelectionChanged}),H=new Map([[h81,new h6(this.handleNavigateUserMessageUp)],[g81,new h6(this.handleNavigateUserMessageDown)],[my1,new h6(this.handleEscape)],[uy1,new h6(this.handleScrollDown)],[py1,new h6(this.handleScrollUp)],[dy1,new h6(this.handleEditMessage)],[cy1,new h6(this.handleRestoreMessage)],[ly1,new h6(this.handleForkMessage)]]),z=new Map([[p0.key("Tab"),new h81],[p0.shift("Tab"),new g81],[p0.key("Escape"),new my1],[p0.key("j"),new uy1],[p0.key("k"),new py1],[p0.key("e"),new dy1],[p0.key("r"),new cy1],[p0.key("f"),new ly1]]);if(!J7())z.set(p0.key("ArrowUp"),new h81),z.set(p0.key("ArrowDown"),new g81);if(this.widget.focusNode)return new I6({focusNode:this.widget.focusNode,child:new b5({actions:H,child:new T3({shortcuts:z,focusNode:this.widget.focusNode,child:W})})});return W}_getTotalItemCount(J){return this.widget.items.length}_shouldDimItem(J){if(this.widget.isInHandoffMode)return!0;if(this._isShowingRestoreConfirmation||this._isShowingEditConfirmation){let Q=this._selectedUserMessageOrdinal;if(Q===null)return!1;let Y=this.getUserMessageIndexFromOrdinal(Q);if(Y===null)return!1;return J>Y}if(this._editingMessageOrdinal!==null){let Q=this.getUserMessageIndexFromOrdinal(this._editingMessageOrdinal);if(Q===null)return!1;return J>Q}return!1}_buildItemAtIndex(J,Q){let Y=this.widget.items[Q];if(!Y)return new d1;let Z=Y.type==="message"&&this._isMessageStreaming(Y),X=Y.type==="toolResult"&&(Y.toolResult.run.status==="queued"||Y.toolResult.run.status==="in-progress")&&!("result"in Y.toolResult.run)&&!("error"in Y.toolResult.run),G=this._shouldDimItem(Q);if(!Z&&!X){let q=`${this._signatureFor(Y)}|dim:${G?1:0}`,W=this._widgetCache.get(Q);if(W&&W.sig===q)return W.widget;let H=this.buildThreadItemWidget(J,Y,Q),z=G?new GY({forceDim:!0,child:H}):H;return this._widgetCache.set(Q,{sig:q,widget:z}),z}let K=this.buildThreadItemWidget(J,Y,Q);return G?new GY({forceDim:!0,child:K}):K}onNewMessage(){if(this._isDisposed)return;this.widget.onNewMessage?.()}scrollToTop(){if(this._isDisposed||!this._controller)return;this._controller.scrollToTop()}scrollToMessage(J,{animated:Q=!1,offsetPercent:Y=0.25,edge:Z="top",duration:X}={}){if(this._isDisposed||!this._controller)return!1;let G=this._getMessageRelativeOffset(J,Z);if(G===null)return!1;let V=this._getViewportHeight(),K=Math.floor(V*Y),q=G-K;if(Q)this._controller.animateTo(q,X);else this._controller.jumpTo(q);return!0}_getColumnElement(){let J=this.context.element;if(!J)return null;let Q=new y8("message-list-column"),Y=(Z)=>{if(Z.widget.key?.equals(Q))return Z;for(let X of Z.children){let G=Y(X);if(G)return G}return null};return Y(J)}_getMessageRelativeOffset(J,Q){let Y=this._getColumnElement();if(!Y)return null;let Z=J*2,X=Y.children[Z];if(!X?.renderObject)return null;let G=X.renderObject,V=Y.renderObject;if(!V)return null;let K=G.localToGlobal({x:0,y:0}),q=V.localToGlobal({x:0,y:0}),W=0;if(Q==="bottom")W=G.size.height;return K.y+W-q.y}_getScrollbarInfo(){let J=this._controller?.maxScrollExtent??0,Q=this._getViewportHeight(),Y=this._controller?.offset??0,Z=J+Q;return{totalContentHeight:Math.max(Z,0),viewportHeight:Math.max(Q,1),scrollOffset:Math.max(Y,0)}}}n6();j6();n6();G0();class iy1{threadService;workers=new Map;threadsMap=new Map;mainThreadSubs=new Map;workerStatusSubs=new Map;mainThreadObservable;workerStatusObservable;emitMainThread=null;emitWorkerStatus=null;constructor(J){this.threadService=J;this.mainThreadObservable=new P1((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.workerStatusObservable=new P1((Q)=>{return this.emitWorkerStatus=(Y)=>Q.next(Y),()=>{this.emitWorkerStatus=null}})}registerWorker(J){let Q=J.thread.id;if(this.workers.has(Q))this.unregisterWorker(Q);this.threadsMap.set(Q,J.thread),this.workers.set(Q,{state:"initial"});let Y=this.threadService.observePatches(Q).pipe(kl()).subscribe((X)=>{this.threadsMap.set(Q,X);let G=this.workers.get(Q)||{state:"initial"};if(this.emitMainThread)this.emitMainThread({threadID:Q,mainThread:X,workerStatus:G})});this.mainThreadSubs.set(Q,Y);let Z=J.status.subscribe((X)=>{if(this.workers.set(Q,X),this.emitWorkerStatus)this.emitWorkerStatus({threadID:Q,status:X})});this.workerStatusSubs.set(Q,Z)}unregisterWorker(J){let Q=this.mainThreadSubs.get(J);if(Q)Q.unsubscribe(),this.mainThreadSubs.delete(J);let Y=this.workerStatusSubs.get(J);if(Y)Y.unsubscribe(),this.workerStatusSubs.delete(J);this.workers.delete(J),this.threadsMap.delete(J)}observeThread(J){return{mainThread:new P1((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new P1((Q)=>{return this.workerStatusObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})})}}get threadViewStates(){let J={};for(let[Q,Y]of this.threadsMap){let Z=this.workers.get(Q);if(Z)J[Q]=$w(Y,Z)}return J}dispose(){for(let J of this.mainThreadSubs.values())J.unsubscribe();for(let J of this.workerStatusSubs.values())J.unsubscribe();this.mainThreadSubs.clear(),this.workerStatusSubs.clear(),this.workers.clear(),this.threadsMap.clear()}}function cB8(J,Q){switch(Q.type){case"main-thread-patch":{let{thread:Y,workerStatus:Z}=Q,{items:X}=u81(Y),G=$w(Y,Z),V=HH({messages:Y.messages}),K=Array.isArray(V)?V:[];return{...J,items:X,viewState:G,todosList:K,mainThread:Y}}case"worker-status-change":{if(!J.mainThread)return J;let Y=$w(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function u81(J){let Q=[],Y=new Map,Z=new Set;for(let[X,G]of J.messages.entries()){let V=`${G.role}-${X}`;switch(G.role){case"assistant":{let K=G.state.type==="streaming";for(let W of G.content)if(W.type==="tool_use"){if(Y.set(W.id,W),K)Z.add(W.id)}if(G.content.some((W)=>W.type==="text"&&W.text.trim()||W.type==="thinking"))Q.push({type:"message",id:V,message:G});for(let W of G.content)if(W.type==="tool_use"){let H=!1;for(let z=X+1;z<J.messages.length;z++){let F=J.messages[z];if(F){for(let U of F.content)if(U.type==="tool_result"&&U.toolUseID===W.id){H=!0;break}}if(H)break}if(!H)Q.push({type:"toolResult",id:W.id,toolUse:W,toolResult:{type:"tool_result",toolUseID:W.id,run:{status:K?"in-progress":"queued"}}})}break}case"info":{if(G.content.some((q)=>q.type==="manual_bash_invocation"||q.type==="summary"&&q.summary.type==="message"))Q.push({type:"message",id:V,message:G});break}case"user":{let K=G.content.some((q)=>q.type==="text"&&q.text.trim()||q.type==="image");for(let q of G.content)if(q.type==="tool_result"){let W=Y.get(q.toolUseID)??E2(J,q.toolUseID);if(!W)throw Error(`(bug) tool use ${q.toolUseID} not found`);Q.push({type:"toolResult",id:q.toolUseID,toolUse:W,toolResult:q})}if(K)Q.push({type:"message",id:V,message:G});break}}}return{items:Q}}class ny1 extends p1{props;constructor(J){super();this.props=J}createState(){return new q$6}}class q$6 extends u1{state={items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null};workerController;subscriptions=[];recentThreadIDs=[];currentWorker;constructor(){super();this.workerController=null,this.currentWorker=null}addToRecentThreads(J){this.setState(()=>{let Q=this.recentThreadIDs.indexOf(J);if(Q!==-1)this.recentThreadIDs.splice(Q,1);if(this.recentThreadIDs.unshift(J),this.recentThreadIDs.length>50)this.recentThreadIDs.pop()})}initState(){let{threadService:J,worker:Q}=this.widget.props;this.workerController=new iy1(J),this.currentWorker=Q,this.setupSubscriptions(Q),this.addToRecentThreads(Q.thread.id)}dispose(){this.cleanup()}didUpdateWidget(J){if(J.props.threadService!==this.widget.props.threadService||J.props.worker!==this.widget.props.worker)this.cleanup(),this.setupSubscriptions(this.widget.props.worker)}setupSubscriptions(J){this.workerController.registerWorker(J);let Q=this.workerController.observeThread(J.thread.id),Y=Q.mainThread.subscribe((X)=>{this.dispatch({type:"main-thread-patch",thread:X.mainThread,workerStatus:X.workerStatus})});this.subscriptions.push(Y);let Z=Q.workerStatus.subscribe((X)=>{this.dispatch({type:"worker-status-change",workerStatus:X.status})});this.subscriptions.push(Z)}cleanup(){this.subscriptions.forEach((J)=>J.unsubscribe()),this.subscriptions=[]}switchWorker(J){this.cleanup(),this.setState(()=>{this.currentWorker=J}),this.setState(()=>{this.state={items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null}}),this.setupSubscriptions(J),this.addToRecentThreads(J.thread.id)}dispatch(J){this.setState(()=>{this.state=cB8(this.state,J)})}getThreadData(){let J=(X)=>X===v9||X===T8||X===WG||X===w2,Q=new Map;for(let X of this.state.items)if(X.type==="toolResult"&&J(X.toolUse.name))Q.set(X.toolUse.id,{toolUseId:X.toolUse.id,toolName:X.toolUse.name,toolRun:X.toolResult.run});let Y=Array.from(Q.values()),Z={};for(let{toolUseId:X,toolRun:G}of Y){let V=[],K;if(G.status==="in-progress"||G.status==="done"||G.status==="error"||G.status==="cancelled")K=G.progress;if(K){let q=0;for(let W of K)if(W.tool_uses)for(let H of W.tool_uses){let z=`${X}:progress:${q++}`,F=H.status==="done"&&H.result!==void 0?{status:"done",result:H.result}:{status:H.status};V.push({toolUse:gO(H.tool_name,H.input,z),toolRun:F})}}Z[X]=V}return{...this.state,subagentToolsByParentID:Z}}build(J){let Q=this.getThreadData();return this.widget.props.builder(J,Q,this.workerController,(Y)=>this.switchWorker(Y),()=>this.currentWorker,this.recentThreadIDs)}}class ay1 extends p1{props;constructor(J){super({key:J.key});this.props=J}createState(){return new W$6}}class W$6 extends u1{build(J){let Y=W0.of(J).colors,{todos:Z,title:X="TODOs"}=this.widget.props;if(!Array.isArray(Z)||Z.length===0)return new I1({width:0,height:0});let G=Z.map((V)=>this.buildTodoItem(V,Y));return new d1({child:new J0({padding:j1.symmetric(1,0),child:new k1({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new e({text:new k(X,new f({bold:!0,color:Y.foreground}))}),...G]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),Z=J.status==="completed",X=new f({bold:J.status==="in-progress",color:Q.foreground,dim:Z}),G=new f({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:Z});return new X0({crossAxisAlignment:"start",children:[new e({text:new k(Y,X)}),new I1({width:1}),new I0({child:new e({text:new k(J.content,G)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class oy1 extends p1{ad;onDismiss;onButtonClick;onImpression;onAdInfoClick;constructor({key:J,ad:Q,onDismiss:Y,onButtonClick:Z,onImpression:X,onAdInfoClick:G}){super({key:J});this.ad=Q,this.onDismiss=Y,this.onButtonClick=Z,this.onImpression=X,this.onAdInfoClick=G}createState(){return new H$6}}class H$6 extends u1{lastTrackedAdId=null;initState(){super.initState(),this.fireImpressionIfNeeded()}didUpdateWidget(J){super.didUpdateWidget(J),this.fireImpressionIfNeeded()}fireImpressionIfNeeded(){let J=this.widget.ad;if(J.id!==this.lastTrackedAdId)this.lastTrackedAdId=J.id,this.widget.onImpression?.(J)}build(J){let Q=W0.of(J),Y=Q.colors.primary,Z=Q.colors.foreground,X=this.widget.ad;return new d1({decoration:new w6(void 0,new y0(new j0(Y,1,"rounded"),new j0(Y,1,"rounded"),void 0,new j0(Y,1,"rounded"))),child:new J0({padding:j1.horizontal(1),child:new k1({children:[new X0({crossAxisAlignment:"start",children:[new I0({child:new e({text:new k(X.content,new f({color:Z}))})}),new I1({width:4}),new H6({onClick:()=>this.widget.onAdInfoClick?.(),cursor:"pointer",child:new e({text:new k("Ad",new f({color:Z,dim:!0}))})})]}),new X0({crossAxisAlignment:"start",children:[new kC1({text:X.buttonLabel,onPressed:()=>this.widget.onButtonClick?.(),padding:j1.horizontal(1),color:Y,reverse:!0}),new I1({width:2}),new e({text:new k(X.destinationUrlHostname,new f({color:Z,dim:!0}))})]})]})})})}}class ry1 extends p1{props;constructor(J){super();this.props=J}createState(){return new z$6(this.props.autofocus??!0)}}class z$6 extends u1{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(K)=>{if(K.key==="Enter"&&this.widget.props.showCopyOption)return this.widget.props.onSelect("copy"),"handled";if(K.ctrlKey&&K.key==="c"||K.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"},Y=t0.sizeOf(J),Z=Math.min(60,Y.width-4),X=Y.height-4,G=[];if(this.widget.props.title)G.push(new e({text:new k(this.widget.props.title,new f({bold:!0,color:o.blue}))}),new I1({height:1}));if(this.widget.props.message)G.push(new e({text:new k(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)G.push(new I1({height:1}));let V=[];if(this.widget.props.showCopyOption)V.push(new e({text:new k("Enter to copy",new f({dim:!0}))}));return V.push(new e({text:new k("Escape to close",new f({dim:!0}))})),G.push(new X0({children:V.flatMap((K,q)=>q<V.length-1?[K,new I1({width:1}),new e({text:new k("•",new f({dim:!0}))}),new I1({width:1})]:[K]),mainAxisSize:"min"})),new b0({child:new d1({constraints:new O0(Z,Z,0,X),decoration:new w6(o.default(),new y0(new j0(o.blue,1,"rounded"),new j0(o.blue,1,"rounded"),new j0(o.blue,1,"rounded"),new j0(o.blue,1,"rounded"))),padding:new j1(2,2,2,2),child:new I6({autofocus:this.autofocus,onKey:Q,child:new k1({children:G,mainAxisSize:"min"})})})})}}class sy1 extends p1{props;constructor(J){super();this.props=J}createState(){return new F$6(this.props.autofocus??!0)}}class F$6 extends u1{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(V)=>{if(V.key==="Enter"||V.key==="Escape"||V.ctrlKey&&V.key==="c")return this.widget.props.onClose(),"handled";return"ignored"},Y=t0.sizeOf(J),Z=Math.min(60,Y.width-4),X=Y.height-4,G=[];if(G.push(new e({text:new k("Ads make Amp Free possible",new f({bold:!0}))})),this.widget.props.provider)G.push(new I1({height:1}),new e({text:new k(`Ad source: ${this.widget.props.provider}`,new f({dim:!0}))}));return G.push(new I1({height:1}),new e({text:new k("Escape to close",new f({dim:!0}))})),new b0({child:new d1({constraints:new O0(Z,Z,0,X),decoration:new w6(o.default(),new y0(new j0(o.blue,1,"rounded"),new j0(o.blue,1,"rounded"),new j0(o.blue,1,"rounded"),new j0(o.blue,1,"rounded"))),padding:new j1(2,2,2,2),child:new I6({autofocus:this.autofocus,onKey:Q,child:new k1({children:G,mainAxisSize:"min"})})})})}}function ty1(J){let Q=J.match(/"([^"]*)"|'([^']*)'|([^\s"']+)/g);if(!Q)return[];return Q.map((Y)=>{if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);return Y})}bX();v1();import{spawn as lB8}from"node:child_process";import{promises as iB8}from"node:fs";function U$6(J){return J.kind==="executable"}function D$6(J){return J.kind==="markdown"}var FW=50000,B$6=300000;async function ey1(J,Q,Y,Z={}){let{timeoutMs:X=B$6,signal:G,source:V}=Z;try{let K=await Y.getCommand(J,V);if(!K)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Y.isCommandAvailable(J,V))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(R.debug("Executing command",{commandName:J,filePath:K.filePath,args:Q}),D$6(K))return await nB8(K,Q);else if(U$6(K))return await aB8(K,Q,X,G);else return{success:!1,output:"",error:"Unsupported command type"}}catch(K){return R.error("Failed to execute command",{commandName:J,error:K}),{success:!1,output:"",error:K instanceof Error?K.message:"Unknown error occurred"}}}async function nB8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await iB8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>FW?Y.slice(0,FW)+`
|
|
5076
5076
|
... (output truncated at ${FW} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function aB8(J,Q,Y=B$6,Z){return new Promise((X)=>{let[G,V]=oB8(J,Q);R.debug("Spawning command",{spawnCommand:G,spawnArgs:V.slice(0,10),filePath:J.filePath,timeoutMs:Y});let K=lS(Z),q=!1,W=setTimeout(()=>{q=!0,K.abort(),R.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=lB8(G,V,{stdio:["pipe","pipe","pipe"],signal:K.signal,detached:!0}),z=[],F=[],U=0;H.stdout?.on("data",(D)=>{let B=D.toString();if(U+=B.length,U<=FW)z.push(B);else{let N=FW-(U-B.length);if(N>0)z.push(B.slice(0,N))}}),H.stderr?.on("data",(D)=>{let B=D.toString();if(U+=B.length,U<=FW)F.push(B);else{let N=FW-(U-B.length);if(N>0)F.push(B.slice(0,N))}}),H.on("close",(D)=>{if(clearTimeout(W),q){X({success:!1,output:z.join(""),error:`Command timed out after ${Y}ms`,exitCode:void 0});return}if(K.signal.aborted){X({success:!1,output:z.join(""),error:"The command was aborted",exitCode:D??void 0});return}let B=D===0||D===1,N=z.join(""),w=F.join(""),M=N;if(!B&&!N.trim()&&w.trim())M=w;else if(w.trim())M+=N?`
|
|
5077
5077
|
${w}`:w;if(U>FW)M+=`
|
|
5078
|
-
... (output truncated at ${FW} characters)`;X({success:B,output:M.trim(),error:!B?w.trim()||"Command failed":void 0,exitCode:D??void 0})}),H.on("error",(D)=>{clearTimeout(W);let B=D.message;if(q)B=`Command timed out after ${Y}ms`;else if(D.message.includes("operation was aborted")||D.name==="AbortError")B="The command was aborted";X({success:!1,output:z.join(""),error:B})})})}function oB8(J,Q){let{filePath:Y,interpreter:Z,extension:X}=J;if(process.platform==="win32")return sB8(Y,Z?[...Z]:null,X,Q);else return rB8(Y,Z?[...Z]:null,X,Q)}function rB8(J,Q,Y,Z){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Z]];else return[J,Z]}function sB8(J,Q,Y,Z){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Z]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...Z]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...Z]];case".exe":return[J,Z];default:return[J,Z]}}v1();oO();EX();f9();y7();LO();MG();N3();jQ();SH();UZ();n6();Db();E9();OC();G0();var r$6=H0(aH(),1);import{writeFile as l$6}from"fs/promises";import i$6 from"path";v1();N3();class Jx1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Y])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1768176116-ged0d88"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await Xa(Q,this.configService)}catch(Q){R.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class $U extends p1{props;constructor(J){super();this.props=J}createState(){return new N$6}}class N$6 extends u1{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Y)=>{this.setState(()=>{this._state=Y(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class w$6 extends u1{controller=new Q7;focusNode=new r6({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=W0.of(J),{colors:Y,app:Z}=Q,X=this.widget.props.isRequiredArg??!0,G=this.controller.text.trim().length>0,V=!X||G,K=y0.all(new j0(Y.foreground,1,"solid")),q=new P3({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(U)=>{let D=U.trim();if(X&&D.length===0)return;this.widget.props.onSubmit(D)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new X0({children:[new d1({decoration:{color:o.default()},child:new e({text:new k(">",new f({color:Y.foreground}))})}),new I0({child:q})]}),H=new d1({padding:j1.symmetric(1,0),child:new e({text:new k("",void 0,[new k("Command: ",new f({color:Y.foreground})),new k(this.widget.props.commandName,new f({color:o.yellow,bold:!0}))])})}),z=[];if(V)z.push(new k("Enter",new f({color:Z.keybind}))),z.push(new k(" to submit, ",new f({color:Y.foreground,dim:!0})));z.push(new k("Esc",new f({color:Z.keybind}))),z.push(new k(" to cancel",new f({color:Y.foreground,dim:!0})));let F=new d1({padding:j1.symmetric(1,0),child:new e({text:new k("",void 0,z)})});return new d1({decoration:{border:K,color:o.default()},padding:j1.all(1),child:new k1({children:[H,new I1({height:1}),W,new O8,F]})})}}class wg extends p1{props;constructor(J){super();this.props=J}createState(){return new w$6}}import{isDeepStrictEqual as QN8}from"node:util";var tB8=/[\\/_ +.#"@[({&]/,eB8=/[\\/_ +.#"@[({&]/g,JN8=/[\s-]/,M$6=/[\s-]/g;function d81(J,Q,Y,Z,X,G,V){if(G===Q.length){if(X===J.length)return 1;return 0.99}let K=`${X},${G}`;if(V[K]!==void 0)return V[K];let q=Z.charAt(G),W=Y.indexOf(q,X),H=0,z,F,U,D;while(W>=0){if(z=d81(J,Q,Y,Z,W+1,G+1,V),z>H){if(W===X)z*=1;else if(JN8.test(J.charAt(W-1))){if(z*=0.9,D=J.slice(X,W-1).match(M$6),D&&X>0)z*=0.999**D.length}else if(tB8.test(J.charAt(W-1))){if(z*=0.8,U=J.slice(X,W-1).match(eB8),U&&X>0)z*=0.999**U.length}else if(z*=0.3,X>0)z*=0.999**(W-X);if(J.charAt(W)!==Q.charAt(G))z*=0.9999}if(z<0.1&&(Y.charAt(W-1)===Z.charAt(G+1)||Z.charAt(G+1)===Z.charAt(G)&&Y.charAt(W-1)!==Z.charAt(G))){if(F=d81(J,Q,Y,Z,W+1,G+2,V),F*0.1>z)z=F*0.1}if(z>H)H=z;W=Y.indexOf(q,W+1)}return V[K]=H,H}function p81(J){return J.toLowerCase().replace(M$6," ")}function L$6(J,Q){let Y=d81(J,Q,p81(J),p81(Q),0,0,{}),Z=Q.trim().split(/\s+/);if(Z.length>1){let X=0,G=0;for(let K of Z){let q=d81(J,K,p81(J),p81(K),0,0,{});if(q===0)return Y;X+=q,G+=K.length}let V=X/Z.length*0.95;return Math.max(Y,V)}return Y}class aj{}class oj{}class c81{}class l81{}class O$6 extends p1{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new A$6}}class A$6 extends u1{build(J){return this.widget.onContext(J),this.widget.child}}function YN8(J,Q){if(J==="")return{matches:!0,score:1};let Y=L$6(Q,J);return{matches:Y>0.15,score:Y}}class P7 extends p1{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new I$6}}class I$6 extends u1{controller=new Q7;focusNode;scrollController=new a4;selectedIndex=0;itemContexts=[];cachedQuery="";cachedItemsRef=null;cachedFiltered=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new r6({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.recomputeFilteredItems(),this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.cachedFiltered;this.widget.props.onSelectionChange?.(Q[0]??null)}),this.recomputeFilteredItems();let J=this.cachedFiltered;this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!QN8(J.props.items,this.widget.props.items)){this.recomputeFilteredItems(),this.ensureSelectedItemVisible();let Q=this.cachedFiltered;this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)}}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof aj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof oj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof c81){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Y=Q[this.selectedIndex];if(Y){if(!(this.widget.props.isItemDisabled?.(Y)??!1))this.widget.props.onAccept(Y)}}return"handled"}if(J instanceof l81)return this.widget.props.onDismiss?.(),"handled";return"ignored"};recomputeFilteredItems(){let J=this.controller.text,Q=this.widget.props.items,Y=Q.filter((Z)=>!this.widget.props.filterItem||this.widget.props.filterItem(Z,J)).map((Z)=>({item:Z,...YN8(J,this.widget.props.getLabel(Z))})).filter((Z)=>Z.matches).sort(this.widget.props.sortItems?(Z,X)=>this.widget.props.sortItems(Z,X,J):(Z,X)=>X.score-Z.score).map((Z)=>Z.item);this.cachedQuery=J,this.cachedItemsRef=Q,this.cachedFiltered=this.widget.props.maxRenderItems?Y.slice(0,this.widget.props.maxRenderItems):Y}getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items;if(this.cachedQuery===J&&this.cachedItemsRef===Q)return this.cachedFiltered;return this.recomputeFilteredItems(),this.cachedFiltered}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,Z=Q.size.height;oR(J,{top:Y,bottom:Z},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Y=this.getFilteredItems();if(J>=0&&J<Y.length){let Z=Y[J],X=Z?this.widget.props.isItemDisabled?.(Z)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Y[this.selectedIndex]??null);else if(Q===2&&!X){if(Z)this.widget.props.onAccept(Z)}}};build(J){let Q=W0.of(J),{colors:Y}=Q,Z=this.getFilteredItems(),X=y0.all(new j0(Y.foreground,1,"solid")),G=this.widget.props.enabled??!0,V=new P3({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:G,style:{textColor:Y.foreground,border:null},maxLines:1}),K=new T3({shortcuts:new Map([[new p0("ArrowDown"),new aj],[new p0("ArrowUp"),new oj],[new p0("Tab"),new aj],[new p0("Tab",{shift:!0}),new oj],[new p0("n",{ctrl:!0}),new aj],[new p0("p",{ctrl:!0}),new oj],[new p0("Enter"),new c81],[new p0("Escape"),new l81]]),focusNode:this.focusNode,child:V}),q=new b5({actions:new Map([[aj,new h6(this.invoke)],[oj,new h6(this.invoke)],[c81,new h6(this.invoke)],[l81,new h6(this.invoke)]]),child:K}),W=new X0({children:[new d1({decoration:{color:o.default()},child:new e({text:new k(">",new f({color:Y.foreground}))})}),new I0({child:q})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let B=this.widget.props.loadingText??"Loading...";H=new I1({height:10,child:new b0({child:new e({text:new k(B,new f({color:Y.foreground}))})})})}else if(Z.length===0&&this.widget.props.emptyStateText)H=new I0({child:new b0({child:new e({text:new k(this.widget.props.emptyStateText,new f({color:Y.foreground,dim:!0}))})})});else{let B=Z.map((N,w)=>{let M=w===this.selectedIndex,L=this.widget.props.isItemDisabled?.(N)??!1,O;if(this.widget.props.renderItem)O=this.widget.props.renderItem(N,M,L,J);else{let A=M?o.yellow:void 0,I=M?o.black:Y.foreground;O=new d1({decoration:A?{color:A}:void 0,padding:j1.symmetric(2,0),child:new e({text:new k(this.widget.props.getLabel(N),new f({color:I,dim:L}))})})}return new O$6(new H6({onClick:(A)=>this.handleItemClick(w,A.clickCount),child:O}),(A)=>{this.itemContexts[w]=A})});H=new k1({children:B,crossAxisAlignment:"start"})}let z=new I0({child:new H6({onScroll:this.handleScroll,opaque:!1,child:new q4({controller:this.scrollController,autofocus:!1,child:H})})}),F=[];if(this.widget.props.title){let B=new d1({padding:j1.symmetric(1,0),child:new e({text:new k(this.widget.props.title,new f({color:o.yellow,bold:!0}))})});F.push(B)}if(F.push(W,new I1({height:1}),z),this.controller.text!==""){let B=Z.length>0?Z[this.selectedIndex]:void 0,N=B&&this.widget.props.buildDisabledReasonWidget?.(B);if(N)F.push(new d1({padding:j1.vertical(1),child:new b0({child:N})}));else F.push(new I1({height:3}))}if(this.widget.props.footer)F.push(this.widget.props.footer);return new d1({decoration:{border:X,color:o.default()},padding:j1.symmetric(1,0),child:new k1({children:F})})}}function E$6(J){let Y=new Date().getTime()-J.getTime(),Z=Math.floor(Y/60000),X=Math.floor(Y/3600000),G=Math.floor(Y/86400000);if(Z<1)return"just now";if(Z<60)return`${Z}m ago`;if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;return J.toLocaleDateString()}class Qx1 extends S0{props;debugLabel="NewsFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((X,G)=>G.pubDate.getTime()-X.pubDate.getTime()),Y=Math.max(0,...Q.map((X)=>E$6(X.pubDate).length));return new P7({items:Q,getLabel:(X)=>X.title,onAccept:(X)=>this.props.onSelect?.(X),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No news entries available",maxRenderItems:100,renderItem:(X,G,V,K)=>{let q=W0.of(K),{colors:W}=q,H=G?o.yellow:void 0,z=G?o.black:W.foreground,F=o.index(8),U=(D,B)=>new I1({width:B,child:X0.end([new e({text:new k(D,new f({color:F}))})])});return new d1({decoration:H?{color:H}:void 0,padding:j1.symmetric(2,0),child:new X0({children:[new I0({child:new e({text:new k(X.title,new f({color:z})),overflow:"ellipsis",maxLines:1})}),new I1({width:2}),U(E$6(X.pubDate),Y)]})})}})}}class Yx1 extends p1{createState(){return new R$6}}class R$6 extends u1{isGreen=!0;timer;initState(){this.timer=setInterval(()=>{this.isGreen=!this.isGreen,this.setState()},700)}dispose(){if(this.timer)clearInterval(this.timer);super.dispose()}build(J){return new e({text:new k("●",new f({color:this.isGreen?o.green:o.index(8),bold:!0})),maxLines:1})}}function ZN8(J){let Q=new Map,Y=new Map,Z=new Map,X=[];for(let V of J)Q.set(V.id,V);for(let V of J){let K=V.parentRelationships.find((q)=>q.role==="child"&&Q.has(q.threadID)&&(q.type==="fork"||q.type==="handoff"));if(K){Z.set(V.id,K.type);let q=K.threadID,W=Y.get(q)||[];W.push(V),Y.set(q,W)}else X.push(V)}return BY.flatten(X,(V)=>Y.get(V.id)).map((V)=>({...V.item,depth:V.depth,isLast:V.isLast,ancestorsAreLast:V.ancestorsAreLast,relationshipType:Z.get(V.item.id)}))}function Zx1(J,Q,Y){return new e({text:new k(`${J}${Q}`,new f({color:Y})),maxLines:1})}function XN8(J,Q,Y,Z){return[Zx1("+",J,Z.success),O8.horizontal(1),Zx1("~",Q,Z.warning),O8.horizontal(1),Zx1("-",Y,Z.destructive)]}class i81 extends S0{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((z)=>z.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((z)=>z.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],Z=new Set(Y),X=this.props.currentThreadID,G=[...Q].sort((z,F)=>{if(X){if(z.id===X)return-1;if(F.id===X)return 1}let U=Y.indexOf(z.id),D=Y.indexOf(F.id);if(U!==-1&&D!==-1)return U-D;if(U!==-1)return-1;if(D!==-1)return 1;return 0}),V=ZN8(G),K=Math.max(0,...V.map((z)=>z.description.timeAgo.length)),q=W0.of(J),W=new J0({padding:j1.symmetric(0,1),child:new b0({child:new e({text:new k("",new f({color:q.colors.foreground,dim:!0}),[new k("Ctrl+T",new f({color:o.blue,dim:!0})),new k(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new f({color:q.colors.foreground,dim:!0}))])})})});return new P7({items:V,getLabel:(z)=>z.title,onAccept:(z)=>this.props.onSelect?.(z.id),onDismiss:this.props.onDismiss,onSelectionChange:(z)=>{if(this.props.previewController){if(z)this.props.previewController.select(z.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:200,footer:this.props.isLoading?void 0:W,renderItem:(z,F,U,D)=>{let B=W0.of(D),{colors:N}=B,w=F?o.yellow:void 0,M=F?o.black:N.foreground,L=o.index(8),O=(m,v)=>new I1({width:v,child:X0.end([new e({text:new k(m,new f({color:L}))})])}),A=this.props.threadViewStates[z.id],I=[],P=z.relationshipType==="handoff",C=new B81;if(z.depth>0){let m=[],v=z.ancestorsAreLast.slice(1);for(let d of v)m.push(new k(C.getAncestorPrefix(d),new f({color:C.connectorColor,dim:C.connectorDim})));let b=z.isLast?C.elbow:C.tee,u=C.getConnectorText(b);m.push(new k(u,new f({color:C.connectorColor,dim:C.connectorDim}))),I.push(new e({text:new k("",void 0,m)}))}let y=[],S=X===z.id?new k("(current) ",new f({color:o.green})):Z.has(z.id)?new k("(visited) ",new f({color:N.foreground,dim:!0})):null;if(S)y.push(new e({text:S}));if(A){if(A.state==="active"&&(A.interactionState==="tool-running"||A.interactionState==="handoff"||A.inferenceState==="running"))y.push(new Yx1),y.push(new I1({width:1}))}let x=z.title;if(z.relationshipType==="fork"){let m=x.match(/^Forked\((\d+)\): /);if(m)x=x.slice(m[0].length);else while(x.startsWith("Forked: "))x=x.slice(8);y.push(new e({text:new k("[fork] ",new f({color:o.blue}))}))}else if(P)y.push(new e({text:new k("[handoff] ",new f({color:o.index(208)}))}));if(y.push(new I0({child:new e({text:new k(x,new f({color:M})),overflow:"ellipsis",maxLines:1})})),y.push(new I1({width:2})),z.diffStats&&(z.diffStats.added>0||z.diffStats.changed>0||z.diffStats.deleted>0)){let m=F?{success:L,warning:L,destructive:L}:N;y.push(...XN8(z.diffStats.added,z.diffStats.changed,z.diffStats.deleted,m)),y.push(new I1({width:2}))}return y.push(O(z.description.timeAgo,K)),new d1({decoration:w?{color:w}:void 0,padding:j1.symmetric(2,0),child:new X0({children:[...I,...y]})})}})}}class P$6 extends p1{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new T$6}}class T$6 extends u1{build(J){return this.widget.onContext(J),this.widget.child}}var j$6=30,$N8=30;class rj{}class sj{}class n81{}class a81{}class Xx1 extends p1{props;constructor(J){super();this.props=J}createState(){return new C$6}}class C$6 extends u1{highlightedIndex=0;controller=new Q7;focusNode;scrollController=new a4;filteredClusters=[];itemContexts=[];initState(){this.focusNode=new r6({debugLabel:"ClusterPicker"}),this.scrollController.disableFollowMode(),this.recomputeFiltered(),this.controller.addListener(()=>{this.highlightedIndex=0,this.recomputeFiltered(),this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})})}didUpdateWidget(J){if(J.props.clusters!==this.widget.props.clusters){if(this.recomputeFiltered(),this.highlightedIndex>=this.filteredClusters.length)this.highlightedIndex=Math.max(0,this.filteredClusters.length-1)}}ensureSelectedItemVisible(){let J=this.itemContexts[this.highlightedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,Z=Q.size.height;oR(J,{top:Y,bottom:Z},{padding:1})}dispose(){this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}recomputeFiltered(){let J=this.controller.text.toLowerCase(),{clusters:Q}=this.widget.props;if(!J)this.filteredClusters=[...Q];else this.filteredClusters=Q.filter((Y)=>Y.label.toLowerCase().includes(J))}invoke=(J)=>{if(J instanceof rj){if(this.highlightedIndex<this.filteredClusters.length-1)this.highlightedIndex++,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});return"handled"}if(J instanceof sj){if(this.highlightedIndex>0)this.highlightedIndex--,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});return"handled"}if(J instanceof n81){let Q=this.filteredClusters[this.highlightedIndex];if(Q)this.widget.props.onAccept(Q);return"handled"}if(J instanceof a81)return this.widget.props.onDismiss(),"handled";return"ignored"};handleItemClick=(J,Q)=>{if(J>=0&&J<this.filteredClusters.length){if(Q===1)this.highlightedIndex=J,this.setState();else if(Q===2){let Y=this.filteredClusters[J];if(Y)this.widget.props.onAccept(Y)}}};handleScroll=(J)=>{if(this.filteredClusters.length===0)return;if(J.direction==="down")if(this.highlightedIndex<this.filteredClusters.length-1)this.highlightedIndex++;else return;else if(this.highlightedIndex>0)this.highlightedIndex--;else return;this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})};build(J){let{currentThreadID:Q}=this.widget.props,Y=W0.of(J),{colors:Z}=Y,V=t0.of(J).size.width>=$N8+j$6,K=y0.all(new j0(Z.foreground,1,"solid")),q=this.filteredClusters[this.highlightedIndex]??null,W=new d1({padding:j1.symmetric(1,0),child:new e({text:new k("Select a cluster",new f({color:o.yellow,bold:!0}))})}),H=new P3({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:!0,style:{textColor:Z.foreground,border:null},maxLines:1}),z=new T3({shortcuts:new Map([[new p0("ArrowDown"),new rj],[new p0("ArrowUp"),new sj],[new p0("Tab"),new rj],[new p0("Tab",{shift:!0}),new sj],[new p0("n",{ctrl:!0}),new rj],[new p0("p",{ctrl:!0}),new sj],[new p0("Enter"),new n81],[new p0("Escape"),new a81]]),focusNode:this.focusNode,child:H}),F=new b5({actions:new Map([[rj,new h6(this.invoke)],[sj,new h6(this.invoke)],[n81,new h6(this.invoke)],[a81,new h6(this.invoke)]]),child:z}),U=new X0({children:[new d1({decoration:{color:o.default()},child:new e({text:new k(">",new f({color:Z.foreground}))})}),new I0({child:F})]});this.itemContexts=[];let D=this.filteredClusters.map((O,A)=>{let I=A===this.highlightedIndex,P=Q?O.threads.some((x)=>x.id===Q):!1,C=I?o.yellow:void 0,y=I?o.black:o.default(),S=[new k(O.label,new f({color:y})),new k(` (${O.threads.length})`,new f({color:y,dim:!0}))];if(P)S.push(new k(" (current)",new f({color:I?o.black:o.green})));return new P$6(new H6({onClick:(x)=>this.handleItemClick(A,x.clickCount),child:new d1({decoration:C?{color:C}:void 0,padding:j1.symmetric(2,0),child:new e({text:new k("",void 0,S)})})}),(x)=>{this.itemContexts[A]=x})}),B=new k1({children:D,crossAxisAlignment:"start"}),N=new I0({child:new H6({onScroll:this.handleScroll,child:new q4({controller:this.scrollController,autofocus:!1,child:B})})}),w=q?q.threads.map((O)=>({id:O.id,title:O.title,parentID:O.parentID,updatedAt:O.updatedAt})):[],M=q?new d1({padding:j1.all(1),child:new EM({threads:w,autofocus:!1,offsetY:2})}):null,L;if(V){let O=M?new I0({child:M}):new I1({width:j$6});L=new X0({crossAxisAlignment:"stretch",mainAxisAlignment:"start",children:[N,O]})}else{let O=[new I0({child:new H6({onScroll:this.handleScroll,child:new q4({controller:this.scrollController,autofocus:!1,child:B})})})];if(M)O.push(new I0({child:M}));L=new k1({crossAxisAlignment:"stretch",children:O})}return new d1({decoration:{border:K,color:o.default()},padding:j1.symmetric(1,0),child:new k1({children:[W,U,new I1({height:1}),new I0({child:L})]})})}}class $x1 extends S0{props;constructor(J){super();this.props=J}build(){return new b0({child:new e({text:new k("",void 0,[new k(`Forked to new thread:
|
|
5078
|
+
... (output truncated at ${FW} characters)`;X({success:B,output:M.trim(),error:!B?w.trim()||"Command failed":void 0,exitCode:D??void 0})}),H.on("error",(D)=>{clearTimeout(W);let B=D.message;if(q)B=`Command timed out after ${Y}ms`;else if(D.message.includes("operation was aborted")||D.name==="AbortError")B="The command was aborted";X({success:!1,output:z.join(""),error:B})})})}function oB8(J,Q){let{filePath:Y,interpreter:Z,extension:X}=J;if(process.platform==="win32")return sB8(Y,Z?[...Z]:null,X,Q);else return rB8(Y,Z?[...Z]:null,X,Q)}function rB8(J,Q,Y,Z){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Z]];else return[J,Z]}function sB8(J,Q,Y,Z){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Z]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...Z]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...Z]];case".exe":return[J,Z];default:return[J,Z]}}v1();oO();EX();f9();y7();LO();MG();N3();jQ();SH();UZ();n6();Db();E9();OC();G0();var r$6=H0(aH(),1);import{writeFile as l$6}from"fs/promises";import i$6 from"path";v1();N3();class Jx1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Y])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1768191623-gd520c9"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await Xa(Q,this.configService)}catch(Q){R.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class $U extends p1{props;constructor(J){super();this.props=J}createState(){return new N$6}}class N$6 extends u1{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Y)=>{this.setState(()=>{this._state=Y(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class w$6 extends u1{controller=new Q7;focusNode=new r6({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=W0.of(J),{colors:Y,app:Z}=Q,X=this.widget.props.isRequiredArg??!0,G=this.controller.text.trim().length>0,V=!X||G,K=y0.all(new j0(Y.foreground,1,"solid")),q=new P3({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(U)=>{let D=U.trim();if(X&&D.length===0)return;this.widget.props.onSubmit(D)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new X0({children:[new d1({decoration:{color:o.default()},child:new e({text:new k(">",new f({color:Y.foreground}))})}),new I0({child:q})]}),H=new d1({padding:j1.symmetric(1,0),child:new e({text:new k("",void 0,[new k("Command: ",new f({color:Y.foreground})),new k(this.widget.props.commandName,new f({color:o.yellow,bold:!0}))])})}),z=[];if(V)z.push(new k("Enter",new f({color:Z.keybind}))),z.push(new k(" to submit, ",new f({color:Y.foreground,dim:!0})));z.push(new k("Esc",new f({color:Z.keybind}))),z.push(new k(" to cancel",new f({color:Y.foreground,dim:!0})));let F=new d1({padding:j1.symmetric(1,0),child:new e({text:new k("",void 0,z)})});return new d1({decoration:{border:K,color:o.default()},padding:j1.all(1),child:new k1({children:[H,new I1({height:1}),W,new O8,F]})})}}class wg extends p1{props;constructor(J){super();this.props=J}createState(){return new w$6}}import{isDeepStrictEqual as QN8}from"node:util";var tB8=/[\\/_ +.#"@[({&]/,eB8=/[\\/_ +.#"@[({&]/g,JN8=/[\s-]/,M$6=/[\s-]/g;function d81(J,Q,Y,Z,X,G,V){if(G===Q.length){if(X===J.length)return 1;return 0.99}let K=`${X},${G}`;if(V[K]!==void 0)return V[K];let q=Z.charAt(G),W=Y.indexOf(q,X),H=0,z,F,U,D;while(W>=0){if(z=d81(J,Q,Y,Z,W+1,G+1,V),z>H){if(W===X)z*=1;else if(JN8.test(J.charAt(W-1))){if(z*=0.9,D=J.slice(X,W-1).match(M$6),D&&X>0)z*=0.999**D.length}else if(tB8.test(J.charAt(W-1))){if(z*=0.8,U=J.slice(X,W-1).match(eB8),U&&X>0)z*=0.999**U.length}else if(z*=0.3,X>0)z*=0.999**(W-X);if(J.charAt(W)!==Q.charAt(G))z*=0.9999}if(z<0.1&&(Y.charAt(W-1)===Z.charAt(G+1)||Z.charAt(G+1)===Z.charAt(G)&&Y.charAt(W-1)!==Z.charAt(G))){if(F=d81(J,Q,Y,Z,W+1,G+2,V),F*0.1>z)z=F*0.1}if(z>H)H=z;W=Y.indexOf(q,W+1)}return V[K]=H,H}function p81(J){return J.toLowerCase().replace(M$6," ")}function L$6(J,Q){let Y=d81(J,Q,p81(J),p81(Q),0,0,{}),Z=Q.trim().split(/\s+/);if(Z.length>1){let X=0,G=0;for(let K of Z){let q=d81(J,K,p81(J),p81(K),0,0,{});if(q===0)return Y;X+=q,G+=K.length}let V=X/Z.length*0.95;return Math.max(Y,V)}return Y}class aj{}class oj{}class c81{}class l81{}class O$6 extends p1{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new A$6}}class A$6 extends u1{build(J){return this.widget.onContext(J),this.widget.child}}function YN8(J,Q){if(J==="")return{matches:!0,score:1};let Y=L$6(Q,J);return{matches:Y>0.15,score:Y}}class P7 extends p1{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new I$6}}class I$6 extends u1{controller=new Q7;focusNode;scrollController=new a4;selectedIndex=0;itemContexts=[];cachedQuery="";cachedItemsRef=null;cachedFiltered=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new r6({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.recomputeFilteredItems(),this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.cachedFiltered;this.widget.props.onSelectionChange?.(Q[0]??null)}),this.recomputeFilteredItems();let J=this.cachedFiltered;this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!QN8(J.props.items,this.widget.props.items)){this.recomputeFilteredItems(),this.ensureSelectedItemVisible();let Q=this.cachedFiltered;this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)}}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof aj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof oj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof c81){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Y=Q[this.selectedIndex];if(Y){if(!(this.widget.props.isItemDisabled?.(Y)??!1))this.widget.props.onAccept(Y)}}return"handled"}if(J instanceof l81)return this.widget.props.onDismiss?.(),"handled";return"ignored"};recomputeFilteredItems(){let J=this.controller.text,Q=this.widget.props.items,Y=Q.filter((Z)=>!this.widget.props.filterItem||this.widget.props.filterItem(Z,J)).map((Z)=>({item:Z,...YN8(J,this.widget.props.getLabel(Z))})).filter((Z)=>Z.matches).sort(this.widget.props.sortItems?(Z,X)=>this.widget.props.sortItems(Z,X,J):(Z,X)=>X.score-Z.score).map((Z)=>Z.item);this.cachedQuery=J,this.cachedItemsRef=Q,this.cachedFiltered=this.widget.props.maxRenderItems?Y.slice(0,this.widget.props.maxRenderItems):Y}getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items;if(this.cachedQuery===J&&this.cachedItemsRef===Q)return this.cachedFiltered;return this.recomputeFilteredItems(),this.cachedFiltered}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,Z=Q.size.height;oR(J,{top:Y,bottom:Z},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Y=this.getFilteredItems();if(J>=0&&J<Y.length){let Z=Y[J],X=Z?this.widget.props.isItemDisabled?.(Z)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Y[this.selectedIndex]??null);else if(Q===2&&!X){if(Z)this.widget.props.onAccept(Z)}}};build(J){let Q=W0.of(J),{colors:Y}=Q,Z=this.getFilteredItems(),X=y0.all(new j0(Y.foreground,1,"solid")),G=this.widget.props.enabled??!0,V=new P3({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:G,style:{textColor:Y.foreground,border:null},maxLines:1}),K=new T3({shortcuts:new Map([[new p0("ArrowDown"),new aj],[new p0("ArrowUp"),new oj],[new p0("Tab"),new aj],[new p0("Tab",{shift:!0}),new oj],[new p0("n",{ctrl:!0}),new aj],[new p0("p",{ctrl:!0}),new oj],[new p0("Enter"),new c81],[new p0("Escape"),new l81]]),focusNode:this.focusNode,child:V}),q=new b5({actions:new Map([[aj,new h6(this.invoke)],[oj,new h6(this.invoke)],[c81,new h6(this.invoke)],[l81,new h6(this.invoke)]]),child:K}),W=new X0({children:[new d1({decoration:{color:o.default()},child:new e({text:new k(">",new f({color:Y.foreground}))})}),new I0({child:q})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let B=this.widget.props.loadingText??"Loading...";H=new I1({height:10,child:new b0({child:new e({text:new k(B,new f({color:Y.foreground}))})})})}else if(Z.length===0&&this.widget.props.emptyStateText)H=new I0({child:new b0({child:new e({text:new k(this.widget.props.emptyStateText,new f({color:Y.foreground,dim:!0}))})})});else{let B=Z.map((N,w)=>{let M=w===this.selectedIndex,L=this.widget.props.isItemDisabled?.(N)??!1,O;if(this.widget.props.renderItem)O=this.widget.props.renderItem(N,M,L,J);else{let A=M?o.yellow:void 0,I=M?o.black:Y.foreground;O=new d1({decoration:A?{color:A}:void 0,padding:j1.symmetric(2,0),child:new e({text:new k(this.widget.props.getLabel(N),new f({color:I,dim:L}))})})}return new O$6(new H6({onClick:(A)=>this.handleItemClick(w,A.clickCount),child:O}),(A)=>{this.itemContexts[w]=A})});H=new k1({children:B,crossAxisAlignment:"start"})}let z=new I0({child:new H6({onScroll:this.handleScroll,opaque:!1,child:new q4({controller:this.scrollController,autofocus:!1,child:H})})}),F=[];if(this.widget.props.title){let B=new d1({padding:j1.symmetric(1,0),child:new e({text:new k(this.widget.props.title,new f({color:o.yellow,bold:!0}))})});F.push(B)}if(F.push(W,new I1({height:1}),z),this.controller.text!==""){let B=Z.length>0?Z[this.selectedIndex]:void 0,N=B&&this.widget.props.buildDisabledReasonWidget?.(B);if(N)F.push(new d1({padding:j1.vertical(1),child:new b0({child:N})}));else F.push(new I1({height:3}))}if(this.widget.props.footer)F.push(this.widget.props.footer);return new d1({decoration:{border:X,color:o.default()},padding:j1.symmetric(1,0),child:new k1({children:F})})}}function E$6(J){let Y=new Date().getTime()-J.getTime(),Z=Math.floor(Y/60000),X=Math.floor(Y/3600000),G=Math.floor(Y/86400000);if(Z<1)return"just now";if(Z<60)return`${Z}m ago`;if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;return J.toLocaleDateString()}class Qx1 extends S0{props;debugLabel="NewsFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((X,G)=>G.pubDate.getTime()-X.pubDate.getTime()),Y=Math.max(0,...Q.map((X)=>E$6(X.pubDate).length));return new P7({items:Q,getLabel:(X)=>X.title,onAccept:(X)=>this.props.onSelect?.(X),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No news entries available",maxRenderItems:100,renderItem:(X,G,V,K)=>{let q=W0.of(K),{colors:W}=q,H=G?o.yellow:void 0,z=G?o.black:W.foreground,F=o.index(8),U=(D,B)=>new I1({width:B,child:X0.end([new e({text:new k(D,new f({color:F}))})])});return new d1({decoration:H?{color:H}:void 0,padding:j1.symmetric(2,0),child:new X0({children:[new I0({child:new e({text:new k(X.title,new f({color:z})),overflow:"ellipsis",maxLines:1})}),new I1({width:2}),U(E$6(X.pubDate),Y)]})})}})}}class Yx1 extends p1{createState(){return new R$6}}class R$6 extends u1{isGreen=!0;timer;initState(){this.timer=setInterval(()=>{this.isGreen=!this.isGreen,this.setState()},700)}dispose(){if(this.timer)clearInterval(this.timer);super.dispose()}build(J){return new e({text:new k("●",new f({color:this.isGreen?o.green:o.index(8),bold:!0})),maxLines:1})}}function ZN8(J){let Q=new Map,Y=new Map,Z=new Map,X=[];for(let V of J)Q.set(V.id,V);for(let V of J){let K=V.parentRelationships.find((q)=>q.role==="child"&&Q.has(q.threadID)&&(q.type==="fork"||q.type==="handoff"));if(K){Z.set(V.id,K.type);let q=K.threadID,W=Y.get(q)||[];W.push(V),Y.set(q,W)}else X.push(V)}return BY.flatten(X,(V)=>Y.get(V.id)).map((V)=>({...V.item,depth:V.depth,isLast:V.isLast,ancestorsAreLast:V.ancestorsAreLast,relationshipType:Z.get(V.item.id)}))}function Zx1(J,Q,Y){return new e({text:new k(`${J}${Q}`,new f({color:Y})),maxLines:1})}function XN8(J,Q,Y,Z){return[Zx1("+",J,Z.success),O8.horizontal(1),Zx1("~",Q,Z.warning),O8.horizontal(1),Zx1("-",Y,Z.destructive)]}class i81 extends S0{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((z)=>z.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((z)=>z.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],Z=new Set(Y),X=this.props.currentThreadID,G=[...Q].sort((z,F)=>{if(X){if(z.id===X)return-1;if(F.id===X)return 1}let U=Y.indexOf(z.id),D=Y.indexOf(F.id);if(U!==-1&&D!==-1)return U-D;if(U!==-1)return-1;if(D!==-1)return 1;return 0}),V=ZN8(G),K=Math.max(0,...V.map((z)=>z.description.timeAgo.length)),q=W0.of(J),W=new J0({padding:j1.symmetric(0,1),child:new b0({child:new e({text:new k("",new f({color:q.colors.foreground,dim:!0}),[new k("Ctrl+T",new f({color:o.blue,dim:!0})),new k(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new f({color:q.colors.foreground,dim:!0}))])})})});return new P7({items:V,getLabel:(z)=>z.title,onAccept:(z)=>this.props.onSelect?.(z.id),onDismiss:this.props.onDismiss,onSelectionChange:(z)=>{if(this.props.previewController){if(z)this.props.previewController.select(z.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:200,footer:this.props.isLoading?void 0:W,renderItem:(z,F,U,D)=>{let B=W0.of(D),{colors:N}=B,w=F?o.yellow:void 0,M=F?o.black:N.foreground,L=o.index(8),O=(m,v)=>new I1({width:v,child:X0.end([new e({text:new k(m,new f({color:L}))})])}),A=this.props.threadViewStates[z.id],I=[],P=z.relationshipType==="handoff",C=new B81;if(z.depth>0){let m=[],v=z.ancestorsAreLast.slice(1);for(let d of v)m.push(new k(C.getAncestorPrefix(d),new f({color:C.connectorColor,dim:C.connectorDim})));let b=z.isLast?C.elbow:C.tee,u=C.getConnectorText(b);m.push(new k(u,new f({color:C.connectorColor,dim:C.connectorDim}))),I.push(new e({text:new k("",void 0,m)}))}let y=[],S=X===z.id?new k("(current) ",new f({color:o.green})):Z.has(z.id)?new k("(visited) ",new f({color:N.foreground,dim:!0})):null;if(S)y.push(new e({text:S}));if(A){if(A.state==="active"&&(A.interactionState==="tool-running"||A.interactionState==="handoff"||A.inferenceState==="running"))y.push(new Yx1),y.push(new I1({width:1}))}let x=z.title;if(z.relationshipType==="fork"){let m=x.match(/^Forked\((\d+)\): /);if(m)x=x.slice(m[0].length);else while(x.startsWith("Forked: "))x=x.slice(8);y.push(new e({text:new k("[fork] ",new f({color:o.blue}))}))}else if(P)y.push(new e({text:new k("[handoff] ",new f({color:o.index(208)}))}));if(y.push(new I0({child:new e({text:new k(x,new f({color:M})),overflow:"ellipsis",maxLines:1})})),y.push(new I1({width:2})),z.diffStats&&(z.diffStats.added>0||z.diffStats.changed>0||z.diffStats.deleted>0)){let m=F?{success:L,warning:L,destructive:L}:N;y.push(...XN8(z.diffStats.added,z.diffStats.changed,z.diffStats.deleted,m)),y.push(new I1({width:2}))}return y.push(O(z.description.timeAgo,K)),new d1({decoration:w?{color:w}:void 0,padding:j1.symmetric(2,0),child:new X0({children:[...I,...y]})})}})}}class P$6 extends p1{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new T$6}}class T$6 extends u1{build(J){return this.widget.onContext(J),this.widget.child}}var j$6=30,$N8=30;class rj{}class sj{}class n81{}class a81{}class Xx1 extends p1{props;constructor(J){super();this.props=J}createState(){return new C$6}}class C$6 extends u1{highlightedIndex=0;controller=new Q7;focusNode;scrollController=new a4;filteredClusters=[];itemContexts=[];initState(){this.focusNode=new r6({debugLabel:"ClusterPicker"}),this.scrollController.disableFollowMode(),this.recomputeFiltered(),this.controller.addListener(()=>{this.highlightedIndex=0,this.recomputeFiltered(),this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})})}didUpdateWidget(J){if(J.props.clusters!==this.widget.props.clusters){if(this.recomputeFiltered(),this.highlightedIndex>=this.filteredClusters.length)this.highlightedIndex=Math.max(0,this.filteredClusters.length-1)}}ensureSelectedItemVisible(){let J=this.itemContexts[this.highlightedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,Z=Q.size.height;oR(J,{top:Y,bottom:Z},{padding:1})}dispose(){this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}recomputeFiltered(){let J=this.controller.text.toLowerCase(),{clusters:Q}=this.widget.props;if(!J)this.filteredClusters=[...Q];else this.filteredClusters=Q.filter((Y)=>Y.label.toLowerCase().includes(J))}invoke=(J)=>{if(J instanceof rj){if(this.highlightedIndex<this.filteredClusters.length-1)this.highlightedIndex++,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});return"handled"}if(J instanceof sj){if(this.highlightedIndex>0)this.highlightedIndex--,this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});return"handled"}if(J instanceof n81){let Q=this.filteredClusters[this.highlightedIndex];if(Q)this.widget.props.onAccept(Q);return"handled"}if(J instanceof a81)return this.widget.props.onDismiss(),"handled";return"ignored"};handleItemClick=(J,Q)=>{if(J>=0&&J<this.filteredClusters.length){if(Q===1)this.highlightedIndex=J,this.setState();else if(Q===2){let Y=this.filteredClusters[J];if(Y)this.widget.props.onAccept(Y)}}};handleScroll=(J)=>{if(this.filteredClusters.length===0)return;if(J.direction==="down")if(this.highlightedIndex<this.filteredClusters.length-1)this.highlightedIndex++;else return;else if(this.highlightedIndex>0)this.highlightedIndex--;else return;this.setState(),Y4.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})};build(J){let{currentThreadID:Q}=this.widget.props,Y=W0.of(J),{colors:Z}=Y,V=t0.of(J).size.width>=$N8+j$6,K=y0.all(new j0(Z.foreground,1,"solid")),q=this.filteredClusters[this.highlightedIndex]??null,W=new d1({padding:j1.symmetric(1,0),child:new e({text:new k("Select a cluster",new f({color:o.yellow,bold:!0}))})}),H=new P3({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:!0,style:{textColor:Z.foreground,border:null},maxLines:1}),z=new T3({shortcuts:new Map([[new p0("ArrowDown"),new rj],[new p0("ArrowUp"),new sj],[new p0("Tab"),new rj],[new p0("Tab",{shift:!0}),new sj],[new p0("n",{ctrl:!0}),new rj],[new p0("p",{ctrl:!0}),new sj],[new p0("Enter"),new n81],[new p0("Escape"),new a81]]),focusNode:this.focusNode,child:H}),F=new b5({actions:new Map([[rj,new h6(this.invoke)],[sj,new h6(this.invoke)],[n81,new h6(this.invoke)],[a81,new h6(this.invoke)]]),child:z}),U=new X0({children:[new d1({decoration:{color:o.default()},child:new e({text:new k(">",new f({color:Z.foreground}))})}),new I0({child:F})]});this.itemContexts=[];let D=this.filteredClusters.map((O,A)=>{let I=A===this.highlightedIndex,P=Q?O.threads.some((x)=>x.id===Q):!1,C=I?o.yellow:void 0,y=I?o.black:o.default(),S=[new k(O.label,new f({color:y})),new k(` (${O.threads.length})`,new f({color:y,dim:!0}))];if(P)S.push(new k(" (current)",new f({color:I?o.black:o.green})));return new P$6(new H6({onClick:(x)=>this.handleItemClick(A,x.clickCount),child:new d1({decoration:C?{color:C}:void 0,padding:j1.symmetric(2,0),child:new e({text:new k("",void 0,S)})})}),(x)=>{this.itemContexts[A]=x})}),B=new k1({children:D,crossAxisAlignment:"start"}),N=new I0({child:new H6({onScroll:this.handleScroll,child:new q4({controller:this.scrollController,autofocus:!1,child:B})})}),w=q?q.threads.map((O)=>({id:O.id,title:O.title,parentID:O.parentID,updatedAt:O.updatedAt})):[],M=q?new d1({padding:j1.all(1),child:new EM({threads:w,autofocus:!1,offsetY:2})}):null,L;if(V){let O=M?new I0({child:M}):new I1({width:j$6});L=new X0({crossAxisAlignment:"stretch",mainAxisAlignment:"start",children:[N,O]})}else{let O=[new I0({child:new H6({onScroll:this.handleScroll,child:new q4({controller:this.scrollController,autofocus:!1,child:B})})})];if(M)O.push(new I0({child:M}));L=new k1({crossAxisAlignment:"stretch",children:O})}return new d1({decoration:{border:K,color:o.default()},padding:j1.symmetric(1,0),child:new k1({children:[W,U,new I1({height:1}),new I0({child:L})]})})}}class $x1 extends S0{props;constructor(J){super();this.props=J}build(){return new b0({child:new e({text:new k("",void 0,[new k(`Forked to new thread:
|
|
5079
5079
|
|
|
5080
5080
|
`,new f({color:o.white,dim:!0})),new k(`"${this.props.newThreadTitle||"Untitled"}"`,new f({color:o.white}))]),textAlign:"center"})})}}v1();class _$6 extends u1{labels=[];isLoading=!0;currentQuery="";initState(){this.loadLabels()}async loadLabels(){try{let J=await this.widget.props.internalAPIClient.getUserLabels({query:""},{config:this.widget.props.configService});if(!J.ok){R.error("Failed to load labels",J.error),this.isLoading=!1,this.labels=[],this.setState();return}this.labels=J.result,this.isLoading=!1,this.setState()}catch(J){R.error("Failed to load labels",J),this.isLoading=!1,this.labels=[],this.setState()}}getValidationError(J){if(J.length===0)return null;if(J.length>32)return"Label name cannot exceed 32 characters";if(!/^[a-z0-9][a-z0-9-]*$/.test(J))return"Label must be lowercase alphanumeric with hyphens, starting with a letter or number";return null}isValidLabelName(J){return this.getValidationError(J)===null&&J.length>0}getAvailableLabels(){let J=this.widget.props.currentLabels||[];return this.labels.filter((Q)=>!J.includes(Q.name))}shouldShowCreateMarker(J){if(J.length===0||this.isLoading)return!1;let Q=J.trim().toLowerCase();if(!this.isValidLabelName(Q))return!1;let Y=this.widget.props.currentLabels||[],Z=this.labels.some((G)=>G.name===Q),X=Y.includes(Q);return!Z&&!X}build(J){let Q=W0.of(J),{colors:Y}=Q,Z=this.currentQuery.trim().toLowerCase(),X=Z.length>0?this.getValidationError(Z):null,G=this.getAvailableLabels(),K=[{id:"__create__",name:"__create_placeholder__",createdAt:"",__isCreateMarker:!0},...G];return new P7({title:"Add Label",items:K,getLabel:(q)=>{if("__isCreateMarker"in q)return this.currentQuery.trim().toLowerCase();return q.name},onAccept:(q)=>{if("__isCreateMarker"in q)this.widget.props.onSelect(this.currentQuery.trim().toLowerCase());else this.widget.props.onSelect(q.name)},onDismiss:this.widget.props.onDismiss,isLoading:this.isLoading,loadingText:"Loading labels...",emptyStateText:X||"Type to create a new label",renderItem:(q,W,H,z)=>{let F=W?o.yellow:void 0,U=W?o.black:Y.foreground;if("__isCreateMarker"in q&&q.__isCreateMarker){let B=this.currentQuery.trim().toLowerCase();return new d1({decoration:F?{color:F}:void 0,padding:j1.symmetric(2,0),child:new e({text:new k("",void 0,[new k("Create new label: ",new f({color:U})),new k(B,new f({color:U,bold:!0}))])})})}return new d1({decoration:F?{color:F}:void 0,padding:j1.symmetric(2,0),child:new e({text:new k(q.name,new f({color:U}))})})},filterItem:(q,W)=>{if(this.currentQuery!==W)this.currentQuery=W,setTimeout(()=>this.setState(),0);if("__isCreateMarker"in q&&q.__isCreateMarker)return this.shouldShowCreateMarker(W);let z=W.trim().toLowerCase();return z.length===0||q.name.includes(z)},sortItems:(q,W,H)=>{let z="__isCreateMarker"in q.item&&q.item.__isCreateMarker,F="__isCreateMarker"in W.item&&W.item.__isCreateMarker;if(z&&!F)return-1;if(!z&&F)return 1;return W.score-q.score}})}}class Gx1 extends p1{props;constructor(J){super();this.props=J}createState(){return new _$6}}class GU extends p1{props;constructor(J){super();this.props=J}createState(){return new S$6}}class S$6 extends u1{_spinner=new ZJ;animationInterval=null;initState(){super.initState(),this.animationInterval=setInterval(()=>{this._spinner.step(),this.setState(()=>{})},100)}dispose(){if(this.animationInterval)clearInterval(this.animationInterval),this.animationInterval=null;super.dispose()}build(J){let Q=W0.of(J),{colors:Y}=Q,Z=y0.all(new j0(Y.foreground,1,"solid")),X=this._spinner.toBraille(),G=new e({textAlign:"center",text:new k("",void 0,[new k(X,new f({color:o.yellow})),new k(" ",void 0),new k(this.widget.props.message,new f({color:Y.foreground}))])}),K=[new I0({child:new k1({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[G]})})];if(this.widget.props.onAbort)K.push(new I1({height:2,child:new d1({padding:j1.symmetric(2,0),child:new e({text:new k("",new f({dim:!0}),[new k("Press ",new f({color:Y.foreground})),new k("Esc",new f({color:Y.info})),new k(" to cancel",new f({color:Y.foreground}))])})})}));let q=new d1({decoration:new w6(o.default(),Z),child:new I1({width:60,height:7,child:new k1({mainAxisAlignment:"start",children:K})})});if(this.widget.props.onAbort)return new I6({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:q});return q}}class jM extends p1{props;constructor(J){super();this.props=J}createState(){return new k$6}}class k$6 extends u1{scrollController=new a4;scrollAreaKey=new s7("message-dialog-scroll-area");viewportHeight=20;initState(){super.initState(),this.scrollController.followMode=!1,this.scrollController.addListener(()=>{this.setState()})}dispose(){this.scrollController.dispose(),super.dispose()}isWidgetMessage(J){return J instanceof DY}getViewportHeight(){let Q=this.scrollAreaKey.currentElement?.renderObject;if(Q&&"size"in Q){let Y=Q.size;if(typeof Y.height==="number"&&Y.height>0)return this.viewportHeight=Y.height,Y.height}return this.viewportHeight}build(J){let Q=W0.of(J),Y=this.widget.props.message,Z=(()=>{if(this.isWidgetMessage(Y))return{title:Y.title,type:Y.type};if(Y instanceof Error&&Y.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:Y.message};if(Y instanceof Error&&Y.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:Y.message};let H=z81(Y);return{title:H.title,type:H.type,description:H.description}})(),X=Z.type==="error"?o.red:o.yellow,G=y0.all(new j0(o.default(),1,"solid")),V=new d1({padding:j1.symmetric(1,0),child:new e({text:new k(Z.title,new f({color:X,bold:!0}))})}),K=this.isWidgetMessage(Y)?Y.widget:new e({text:new k(Z.description,new f({color:o.default()})),selectable:!0}),q=new I0({child:new eq({child:new d1({padding:j1.symmetric(1,0),child:new X0({key:this.scrollAreaKey,crossAxisAlignment:"stretch",children:[new I0({child:new q4({controller:this.scrollController,autofocus:!0,child:K})}),new _9({controller:this.scrollController,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack,getScrollInfo:()=>{let H=this.scrollController.maxScrollExtent,z=this.scrollController.offset,F=this.getViewportHeight(),U=H+F;return{totalContentHeight:Math.max(U,0),viewportHeight:Math.max(F,1),scrollOffset:Math.max(z,0)}}})]})})})}),W=new d1({padding:j1.symmetric(1,0),child:new e({text:this.widget.props.onRetry?new k("",void 0,[new k("Press ",new f({color:o.default(),dim:!0})),new k("R",new f({color:o.yellow})),new k(" to retry, ",new f({color:o.default(),dim:!0})),new k("Esc",new f({color:o.yellow})),new k(" to cancel",new f({color:o.default(),dim:!0}))]):new k("Press any key to close",new f({color:o.default(),dim:!0,italic:!0}))})});return new I6({onKey:(H)=>{if(this.widget.props.onRetry&&H.key==="r")return this.widget.props.onRetry(),"handled";if(H.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!1,child:new d1({decoration:{border:G,color:o.default()},padding:j1.all(1),child:new k1({mainAxisAlignment:"center",children:[V,new I1({height:1}),q,W]})})})}}class Vx1 extends S0{build(){return new b0({child:new e({text:new k("",void 0,[new k(`✓ Thread Shared
|
|
5081
5081
|
|
|
@@ -5185,7 +5185,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
|
|
|
5185
5185
|
|
|
5186
5186
|
To use Sonnet 4.5, use large mode instead: amp --mode large
|
|
5187
5187
|
Learn more: https://ampcode.com/news/large-mode
|
|
5188
|
-
`),process.exit(1);if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")wG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")wG("experimental.agentMode",Q.mode)}async function fb1(J){try{await oA8(K51.dirname(xb1),{recursive:!0}),await rA8(xb1,J,"utf-8")}catch(Q){R.debug("Failed to save last thread ID",Q)}}async function eA8(){try{return(await yW6(xb1,"utf-8")).trim()}catch(J){return null}}function JI8(J){return!!(J&&(J.endsWith("@sourcegraph.com")||J.endsWith("@ampcode.com")||J==="auth-bypass-user@example.com"))}async function QI8(J){try{let Q=await P4.getUserInfo({},{config:J,signal:AbortSignal.timeout(5000)});if(Q.ok)return Q.result}catch(Q){R.debug("Failed to fetch user info:",Q)}return}var _W6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??hZ,description:`Custom settings file path (overrides the default location ${hZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(R).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${_w})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:J7(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)",hidden:!0},{name:"mode",long:"mode",short:"m",type:"option",default:BO.SMART.key,description:`Set the agent mode (${dY().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:dY().map((J)=>J.mode).concat("large")},{name:"jmap",long:"jmap",type:"switch",default:!1,description:"Use experimental JMAP TUI (connects to server instead of running locally)",hidden:!0}],SW6=(J)=>("deprecated"in J)&&J.deprecated===!0,YI8=(J)=>("hidden"in J)&&J.hidden===!0,ZI8=(J)=>("default"in J),XI8=(J)=>("default"in J)?J.default:void 0;function $I8(J,Q){let Y=Q.args[0],Z=Q.commands.map((G)=>G.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let G=Z.filter((K)=>Y.includes(K)||K.includes(Y)),V="Run amp --help for a list of available commands.";if(G.length>0)V=`Did you mean: ${G.join(", ")}? Or run amp --help for all commands.`;throw new J4(xZ.unknownCommand(Y),1,V)}}var xW6=null;function Lb5(){return xW6}async function ng(J){let Q=await J.configService.getLatest(),Y=uT0(Q.settings["experimental.autoHandoff"]);return{...J,getThreadEnvironment:OR,vfs:BE0({os:J.fileSystem},J.configService.config),skillService:J.skillService,fileChangeTrackerStorage:new BI(J.fileSystem),generateThreadTitle:Pi0,deleteThread:(Z)=>J.threadService.delete(Z),getServerStatus:()=>PQ(J.configService),internalHooks:pT0(Y)}}var q51=Q0.file(sA8.homedir()),vb1=process.env.XDG_CONFIG_HOME?Q0.file(process.env.XDG_CONFIG_HOME):s1.joinPath(q51,".config");async function WJ(J,Q){eU0("0.0.
|
|
5188
|
+
`),process.exit(1);if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")wG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")wG("experimental.agentMode",Q.mode)}async function fb1(J){try{await oA8(K51.dirname(xb1),{recursive:!0}),await rA8(xb1,J,"utf-8")}catch(Q){R.debug("Failed to save last thread ID",Q)}}async function eA8(){try{return(await yW6(xb1,"utf-8")).trim()}catch(J){return null}}function JI8(J){return!!(J&&(J.endsWith("@sourcegraph.com")||J.endsWith("@ampcode.com")||J==="auth-bypass-user@example.com"))}async function QI8(J){try{let Q=await P4.getUserInfo({},{config:J,signal:AbortSignal.timeout(5000)});if(Q.ok)return Q.result}catch(Q){R.debug("Failed to fetch user info:",Q)}return}var _W6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??hZ,description:`Custom settings file path (overrides the default location ${hZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(R).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${_w})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:J7(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)",hidden:!0},{name:"mode",long:"mode",short:"m",type:"option",default:BO.SMART.key,description:`Set the agent mode (${dY().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:dY().map((J)=>J.mode).concat("large")},{name:"jmap",long:"jmap",type:"switch",default:!1,description:"Use experimental JMAP TUI (connects to server instead of running locally)",hidden:!0}],SW6=(J)=>("deprecated"in J)&&J.deprecated===!0,YI8=(J)=>("hidden"in J)&&J.hidden===!0,ZI8=(J)=>("default"in J),XI8=(J)=>("default"in J)?J.default:void 0;function $I8(J,Q){let Y=Q.args[0],Z=Q.commands.map((G)=>G.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let G=Z.filter((K)=>Y.includes(K)||K.includes(Y)),V="Run amp --help for a list of available commands.";if(G.length>0)V=`Did you mean: ${G.join(", ")}? Or run amp --help for all commands.`;throw new J4(xZ.unknownCommand(Y),1,V)}}var xW6=null;function Lb5(){return xW6}async function ng(J){let Q=await J.configService.getLatest(),Y=uT0(Q.settings["experimental.autoHandoff"]);return{...J,getThreadEnvironment:OR,vfs:BE0({os:J.fileSystem},J.configService.config),skillService:J.skillService,fileChangeTrackerStorage:new BI(J.fileSystem),generateThreadTitle:Pi0,deleteThread:(Z)=>J.threadService.delete(Z),getServerStatus:()=>PQ(J.configService),internalHooks:pT0(Y)}}var q51=Q0.file(sA8.homedir()),vb1=process.env.XDG_CONFIG_HOME?Q0.file(process.env.XDG_CONFIG_HOME):s1.joinPath(q51,".config");async function WJ(J,Q){eU0("0.0.1768191623-gd520c9");let Y=ml({storage:J.settings,secretStorage:J.secrets,workspaceRoots:P1.of([Q0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:q51,userConfigDir:vb1}),Z=A0(PQ(Y).pipe(u4((d)=>d!=="pending"))),X=QI8(Y),{initializeCLITelemetry:G}=await Promise.resolve().then(() => (N91(),B91));G(Y);let V=await Y.getLatest();R.debug("Global configuration initialized",{settingsKeys:Object.keys(V.settings)});let{toolService:K,dispose:q}=ur0({configService:Y}),W=new Map,H=()=>W.clear(),z=new aF1(Y,J.settings.getWorkspaceRootPath()),F=kT0({configService:Y,filesystem:Q8}),U=aI0({configService:Y,trustStore:z,skillMCPServers:F.skillMCPServers,createOAuthProvider:async(d,h,l)=>{let g=`${d}:${h}`,V1=W.get(g);if(V1)return R.debug("Reusing existing OAuth provider for server",{serverName:d,serverUrl:h}),V1;R.debug("Creating OAuth provider for server",{serverName:d,serverUrl:h});let O1=(async()=>{let a=new IB(J.secrets),N1=await a.getClientInfo(d,h),M1=l?.scopes??N1?.scopes,S1=x96();R.info("OAuth headless mode check",{useHeadless:S1,executeMode:J.executeMode,envVar:process.env.AMP_HEADLESS_OAUTH,isTTY:v8.isTTY});let B1;if(S1)B1=J.executeMode?y96():k96(d);let L1=new cF1({storage:a,serverName:d,serverUrl:h,clientId:l?.clientId??N1?.clientId,clientSecret:l?.clientSecret??N1?.clientSecret,authUrl:l?.authUrl??N1?.authUrl,tokenUrl:l?.tokenUrl??N1?.tokenUrl,scopes:M1,headlessAuthHandler:B1});return R.debug("OAuth provider created",{serverName:d,serverUrl:h,hasManualClientId:!!(l?.clientId??N1?.clientId),willUseDCR:!(l?.clientId??N1?.clientId),scopes:M1,headlessMode:S1,executeMode:J.executeMode}),L1})();return W.set(g,O1),O1}}),D=Pb({configService:Y,filesystem:Q8,spawn:GF}),{initializeToolProviders:B,startToolProviders:N}=await Promise.resolve().then(() => (CW6(),TW6)),w;if(J.executeMode){let d=await B({toolService:K,providers:[U,D],initialTimeout:15000});w=d.registrations;for(let[h,l]of d.initErrors)R.warn(`${h} provider initialization slow or failed:`,l)}else w=N({toolService:K,providers:[U,D]});if(Q.jetbrains)iO("JetBrains");else if(Q.ide&&F86())iO("VS Code");else if(Q.ide&&U86())iO("Neovim");if(J.executeMode)JD0(!0);let M,L=h9.status.pipe(q0((d)=>Boolean(d.connected&&d.authenticated)),q6()).subscribe((d)=>{if(d){if(!M)M=K.registerTool(va0)}else M?.dispose(),M=void 0}),O;if(!J.executeMode){let d=await J.settings.get("fuzzy.alwaysIncludePaths")??[];O=new z01(process.cwd(),{alwaysIncludePaths:d},!0)}else O=new class extends z01{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(v8.write(`No API key found. Starting login flow...
|
|
5189
5189
|
`),!await GI8(J))await Sw(),process.exit(1)}let A=await hT0({isDevelopment:!1}),I=await Z,P=W5(I)&&I.features.some((d)=>d.name===jX.LIVE_SYNC&&d.enabled),C=new OE1(A,Y,P),y=new qE1(A,{lazy:!0}),S=Q.notifications!==void 0?Q.notifications:!J.executeMode,x=nr0({playNotificationSound:async(d)=>{if(S){ir0(d);let h=a01(),l=hT1();if((!h||l)&&V.settings["notifications.system.enabled"]!==!1){if(d==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(d==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(a01()),threadService:C,configService:Y});R.info("Starting Amp background services");let c=yi0({threadService:C,threadHistoryService:y,configService:Y,isExtensionDevelopment:!1,liveSyncEnabled:P,fileChangeTrackerStorage:new BI(Q8),fileSystem:Q8,getServerStatus:()=>PQ(Y)}),m;h9.status.subscribe((d)=>{m=d});let v=new mq1({workspaceRoots:[Q0.file(process.cwd())],getCurrentFile:()=>{if(!m?.openFile)return;try{return Q0.parse(m.openFile)}catch(d){R.warn("Failed to parse current file URI",{uri:m.openFile,error:d});return}},getOpenFiles:()=>{if(!m?.visibleFiles?.length)return[];let d=m.openFile;return m.visibleFiles.filter((h)=>h!==d).map((h)=>{try{return Q0.parse(h)}catch(l){return R.warn("Failed to parse visible file URI",{uri:h,error:l}),null}}).filter((h)=>h!==null)}}),b=new Bk1,u={codebaseContextService:v,configService:Y,toolService:K,mcpService:U,skillService:F,toolboxService:D,trustStore:z,threadService:C,threadHistoryService:y,threadSyncService:c,threadStorage:A,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:O,notificationService:x,fileSystem:Q.jetbrains||Q.ide?FE0:Q8,terminal:b,userInfo:X};return{...u,async asyncDispose(){if(u.mcpService.hasAuthenticatingClients())R.info("Waiting for OAuth authentication to complete before exit..."),await u.mcpService.waitForAuthentication();for(let d of w.values())d.dispose();await u.mcpService.dispose(),H(),await u.threadService.asyncDispose(),await u.threadSyncService.flushFileChanges(),u.configService.unsubscribe(),q(),u.fuzzyServer.dispose(),u.threadSyncService.dispose(),u.settingsStorage[Symbol.dispose](),L.unsubscribe(),M?.dispose()}}}async function GI8(J){if(!J.executeMode){if(!await zk1("Would you like to log in to Amp? [(y)es, (n)o]: "))return v8.write(`Login cancelled. Run the command again to retry.
|
|
5190
5190
|
`),!1}return await vW6(J)}async function vW6(J){let Q=aA8(32).toString("hex"),Y=await Hk1(J.ampURL,Q),Z=new AbortController;try{await zH(Y,Z.signal)}catch(G){R.error("Error opening browser",{error:G})}let X=await Hk1(J.ampURL,Q,!1);v8.write(`If your browser does not open automatically, visit:
|
|
5191
5191
|
|
|
@@ -5193,7 +5193,7 @@ ${Z0.blue.bold(X)}
|
|
|
5193
5193
|
|
|
5194
5194
|
`);try{return await PQ6(J.ampURL,Q,J.secrets,Z),v8.write("\nLogin successful! Run `amp` to get started.\n"),!0}catch(G){return R.error("Login failed",{error:G}),W2.write(`
|
|
5195
5195
|
Login failed: ${G instanceof Error?G.message:String(G)}
|
|
5196
|
-
`),!1}}function VI8(){let J=new U$().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)kR(),process.exit(0);let z=H.originalError??H;c06(z)}),J.option("-V, --version","Print the version number and exit",()=>{let z;try{z=`, ${cA(new Date("2026-01-
|
|
5196
|
+
`),!1}}function VI8(){let J=new U$().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)kR(),process.exit(0);let z=H.originalError??H;c06(z)}),J.option("-V, --version","Print the version number and exit",()=>{let z;try{z=`, ${cA(new Date("2026-01-12T04:24:47.496Z"))} ago`}catch{}v8.write(`0.0.1768191623-gd520c9 (released 2026-01-12T04:24:47.496Z${z??""})
|
|
5197
5197
|
`),process.exit(0)}),J.addHelpText("after",q56()),J.configureHelp({formatHelp:W56}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let F=z.optsWithGlobals(),U=await X7(F);await HI8(U)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let F=z.optsWithGlobals(),U=await X7(F);await WI8(U,await KC1(F,U.settings))});let Q=async(H,z,F)=>{ml({storage:z.settings,secretStorage:z.secrets,workspaceRoots:P1.of([Q0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:q51,userConfigDir:vb1});let U={...z,executeMode:!1};await bb1(U,{...H,openThreadSwitcher:!0},F)},Y=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(H,z)=>{let F=z.optsWithGlobals(),U=await X7(F);await kW6(F,U,z)});if(Y.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(H,z)=>{let F=z.optsWithGlobals(),U=await X7(F);await MI8(F,U,z)}),Y.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);if(z.pick)W2.write(`${Z0.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
5198
5198
|
`);if(z.last||H||D.executeMode)await wI8(U,D,H,F);else await Q(U,D,F)}),Y.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);await NI8(U,D,H,F)}),Y.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(H,z)=>{let F=z.optsWithGlobals(),U=await X7(F);await kW6(F,U,z)}),Y.command("search <query>").alias("find").summary("Search threads").description(`Search for threads using a query DSL.
|
|
5199
5199
|
|
|
@@ -5205,11 +5205,11 @@ Query syntax:
|
|
|
5205
5205
|
|
|
5206
5206
|
All matching is case-insensitive. File paths use partial matching.`).option("-n, --limit <number>","Maximum number of threads to return","20").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);await OI8(U,D,H,z.limit?parseInt(z.limit,10):20)}),Y.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, unlisted, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);await BI8(U,D,H,F,z.support)}),Y.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(H,z,F,U)=>{let D=U.optsWithGlobals(),B=await X7(D);await zI8(D,B,H,z,U)}),Y.command("archive <threadId>").summary("Archive a thread").description("Archive a thread to hide it from the thread switcher and navigation. Use --unarchive to restore.").option("--unarchive","Unarchive the thread instead of archiving").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);await FI8(U,D,H,!z.unarchive)}),Y.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);await UI8(U,D,H,F)}),Y.command("replay <threadId>").alias("p").summary("Replay a thread").description("Replay a thread by downloading it and playing through all interactions. User messages are simulated with variable typing speed.").option("--wpm <wpm>","Typing speed in words per minute (default: 120)","120").option("--no-typing","Disable typing simulation and display messages instantly").option("--message-delay <ms>","Delay between messages in milliseconds (default: 1000)","1000").option("--tool-progress-delay <ms>","Delay to show tool in-progress state in milliseconds (default: 800)","800").option("--exit-delay <seconds>","Delay in seconds before exiting after replay completes (default: 3)","3").option("--no-indicator","Hide the replay progress indicator").action(async(H,z,F)=>{let U=F.optsWithGlobals(),D=await X7(U);await DI8(U,D,H,z,F)}),Ts0(Y,X7,YQ,WJ,W51,gM,q2),zY6(J,async(H,z)=>{let F=await X7(z);YQ(H,z);let U=await WJ(F,z);return{context:F,mcpService:U.mcpService,toolService:U.toolService,toolServices:U.toolService,configService:U.configService,cleanupTerminal:kR,asyncDispose:U.asyncDispose.bind(U)}}),tQ6(J,async(H)=>{let z=H.optsWithGlobals(),F=await X7(z);YQ(H,z);let U=await WJ(F,z);return{settings:F.settings,configService:U.configService,skillService:U.skillService,asyncDispose:U.asyncDispose.bind(U)}}),uQ6(J,async(H)=>{let z=H.optsWithGlobals();return await X7(z)}),yQ6(J,async(H)=>{let z=await X7(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(F)=>{YQ(F,H);let U=await WJ(z,H);return{mcpService:U.mcpService,settings:z.settings,asyncDispose:U.asyncDispose.bind(U)}}}}),process.env.AMP_EXPERIMENTAL_REMOTE==="1")cQ6(J,async(H,z)=>{let F=await X7(z);YQ(H,z);let U=ml({storage:F.settings,secretStorage:F.secrets,workspaceRoots:P1.of([Q0.file(process.cwd())]),defaultAmpURL:F.ampURL,homeDir:q51,userConfigDir:vb1}),D=await A0(PQ(U).pipe(u4((N)=>N!=="pending"))),B=W5(D)?D.features:[];return{ampURL:F.ampURL,secretStorage:F.secrets,features:B,asyncDispose:async()=>{}}});function X(H,z,F){let D=typeof H.description==="string"?H.description:F===void 0?H.description(!0):H.description(F),B=new gq(z,D),N=XI8(H);if(N)B.default(N);if(B.hidden=YI8(H)||SW6(H),"choices"in H)B.choices([...H.choices]);return B}for(let H of _W6)switch(H.type){case"flag":{J.addOption(X(H,`--${H.long}`)),J.addOption(X(H,`--no-${H.long}`,!1));break}case"switch":{J.addOption(X(H,`--${H.long}`,!0));break}default:{J.addOption(X(H,`${"short"in H?`-${H.short}, `:""}--${H.long} <value>`));break}}let G=new gq("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(G);let V=new gq("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(V);let K=new gq("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);J.addOption(K);let q=new gq("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(q);let W=new gq("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(W),process.env.AMP_EXPERIMENTAL_REMOTE==="1"){let H=new gq("--headless","Run in headless mode: listen for remote commands without showing TUI").default(!1);J.addOption(H)}if(process.env.AMP_CONNECT==="1"){let H=new gq("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(H)}return J.action(async(H,z)=>{let F=H,U=await X7(F);if(Object.keys(F).forEach((D)=>{let B=_W6.find((N)=>N.name===D);if(B&&SW6(B)&&!ZI8(B))W2.write(Z0.yellow(`Warning: '--${D}' flag is deprecated
|
|
5207
5207
|
`))}),z.args.length>0)$I8(U,z);await bb1(U,F,z)}),C56(J),J}async function V51(J,Q){let{thread:Y,visibility:Z}=Q,X=Y?.id??nY(),G=await ng(J);if(Y)await J.threadStorage.set(X,Y);let V=await b8.getOrCreateForThread(G,X),K=await J.threadStorage.get(X);if(Q.agentMode&&!K?.agentMode&&(!K||K7(K)===0))await V.handle({type:"agent-mode",mode:Q.agentMode});if(Z)await J.threadSyncService.updateThreadMeta(X,E41(Z));let q=J.threadService.observe(X).subscribe(async(W)=>{if(q5(W,"assistant"))await fb1(X),q.unsubscribe()});return await V.resume(),V}async function bb1(J,Q,Y){let Z=I41(Q);if(Z instanceof Error)q2(Z.message);let X,G=null;if(Q.streamJsonInput)X="";else if(typeof Q.execute==="string"){X=Q.execute;let S=(await Dk1()).trimEnd();if(S)G=S}else X=(await Dk1()).trimEnd();if(Q.remote&&!J.executeMode)throw new J4("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new J4("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new J4("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new J4("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.stats&&!J.executeMode)throw new J4("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new J4("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&X===""&&!Q.streamJsonInput&&!Q.jmap)throw new J4("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
|
|
5208
|
-
Or pipe via stdin: echo "your message" | amp --execute`);YQ(Y,Q);let V=await WJ(J,Q);xW6=V;let K=await ng(V),q=await V.userInfo,W=JI8(q?.email);if((J.executeMode||Q.streamJson)&&I9(Q.mode)&&!W)throw new J4(`Execute mode is not permitted with --mode '${Q.mode}'`,1);if(Q.headless){if(!q?.features.some((c)=>c.name===jX.AMP_CONNECT&&c.enabled))throw new J4("Remote control features require the amp-connect feature flag. Contact support to enable.",1);let x=await V.secretStorage.get("apiKey",J.ampURL);if(!x)throw new J4("API key required for headless mode. Please run `amp login` first.",1);await S96({ampURL:J.ampURL,apiKey:x,version:"0.0.
|
|
5208
|
+
Or pipe via stdin: echo "your message" | amp --execute`);YQ(Y,Q);let V=await WJ(J,Q);xW6=V;let K=await ng(V),q=await V.userInfo,W=JI8(q?.email);if((J.executeMode||Q.streamJson)&&I9(Q.mode)&&!W)throw new J4(`Execute mode is not permitted with --mode '${Q.mode}'`,1);if(Q.headless){if(!q?.features.some((c)=>c.name===jX.AMP_CONNECT&&c.enabled))throw new J4("Remote control features require the amp-connect feature flag. Contact support to enable.",1);let x=await V.secretStorage.get("apiKey",J.ampURL);if(!x)throw new J4("API key required for headless mode. Please run `amp login` first.",1);await S96({ampURL:J.ampURL,apiKey:x,version:"0.0.1768191623-gd520c9",dependencies:V,workerDeps:K}),await V.asyncDispose(),process.exit(0)}if(Q.jmap)throw new J4("JMAP mode is only available in development builds",1);let H=async(S)=>{let x=await yW6(S,"utf-8"),c=JSON.parse(x);if(!W3(c.id))throw new J4(xZ.invalidThreadId);return V51(V,{visibility:Z,agentMode:Q.mode,thread:c})},z=async(S)=>{if(!W3(S))throw new J4(xZ.invalidThreadId);try{let[c,m]=await Promise.all([P4.getThreadLinkInfo({thread:S},{config:V.configService}),P4.getUserInfo({},{config:V.configService})]);if(c.ok&&m.ok){let v=c.result.creatorUserID,b=m.result.id;if(v&&v!==b&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new J4(`Cannot resume thread created by another user.
|
|
5209
5209
|
|
|
5210
5210
|
This thread belongs to a different user and cannot be continued for security reasons. Set AMP_RESUME_OTHER_USER_THREADS_INSECURE=1 to bypass this check.`)}}catch(c){if(c instanceof J4)throw c;R.warn("Failed to validate thread ownership in CLI, allowing to open",{error:c})}let x=await V.threadService.get(S)??void 0;return R.info(`[fetchAndStartThread] Loaded thread ${S}, agentMode: ${x?.agentMode??"undefined"}`),V51(V,{visibility:Z,agentMode:x?void 0:Q.mode,thread:x})},F=async()=>{try{if(Q.threadId)return z(Q.threadId);else return V51(V,{visibility:Z,agentMode:Q.mode})}catch(S){if(S instanceof J4)throw S;throw await qf(S,Q.threadId),Error("handleError should have called process.exit()")}},U=async()=>{return V51(V,{visibility:Z,agentMode:Q.mode})};if(Q.format==="jsonl")W2.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
5211
|
-
`),await Sw(),process.exit(1);if(J.executeMode&&Q.remote)await pQ6(X,G,V.configService),await V.asyncDispose(),process.exit(0);let D=await F();if(J.executeMode)fQ6(V.mcpService,J.settings),await J66(D,D.threadID,X,G,V,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL,W,Q.mode),await V.asyncDispose(),process.exit(0);let B=!1,N=!1,w=!1;if(Q.jetbrains||Q.ide){await HD0();let S=sO({jetbrainsOnly:Q.jetbrains});if(S.length===0){if(Q.jetbrains)N=!await V.configService.get("jetbrains.skipInstall")}else if(S.length===1){let x=S[0];if(x)h9.selectConfig(x)}else w=!0}let M=V61("0.0.
|
|
5212
|
-
`);let Y=!J.headless&&(!!J.execute||!process.stdout.isTTY&&!J.streamJson),Z=process.stdout.isTTY&&process.stderr.isTTY,X=await n96({...J,workspaceTrust:{current:!0,changes:IC},getHook:process.env.AMP_URL?(K,q)=>{if(K==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let K=await vQ6(J.mcpConfig);X=bQ6(X,K)}let G=K51.dirname(X.getSettingsFilePath());lr0(Vh,G);let V=await X.get("url","global");if(!V)V=d3;if(!FH(V))R.info("Targeting custom Amp server",{ampURL:V});return X=iU0(X),{executeMode:Y,isTTY:Z,ampURL:V,settings:X,secrets:nQ6(await KC1(J,X))}}function KI8(J){let Q={};for(let Y=0;Y<J.length;Y++){let Z=J[Y];if(Z?.startsWith("--")){let G=Z.slice(2).replace(/-([a-z])/g,(K,q)=>q.toUpperCase()),V=J[Y+1];if(V&&!V.startsWith("--"))Q[G]=V,Y++}}return Q}async function qI8(){let J=KI8(process.argv);if(m06({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),tA8(R),R.info("Starting Amp CLI.",{version:"0.0.
|
|
5211
|
+
`),await Sw(),process.exit(1);if(J.executeMode&&Q.remote)await pQ6(X,G,V.configService),await V.asyncDispose(),process.exit(0);let D=await F();if(J.executeMode)fQ6(V.mcpService,J.settings),await J66(D,D.threadID,X,G,V,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL,W,Q.mode),await V.asyncDispose(),process.exit(0);let B=!1,N=!1,w=!1;if(Q.jetbrains||Q.ide){await HD0();let S=sO({jetbrainsOnly:Q.jetbrains});if(S.length===0){if(Q.jetbrains)N=!await V.configService.get("jetbrains.skipInstall")}else if(S.length===1){let x=S[0];if(x)h9.selectConfig(x)}else w=!0}let M=V61("0.0.1768191623-gd520c9",V.settingsStorage),L=new _e(V.threadStorage),O=P1.of([Q0.file(process.cwd())]),A=uq1(void 0,O),I=new A41(V.mcpService,J.settings.getWorkspaceRootPath());if(X)D.handle({type:"user:message",message:{content:[{type:"text",text:X}]}});let C=await(async()=>{try{let S=await P4.getUserFreeTierStatus({},{config:V.configService,signal:AbortSignal.timeout(5000)});if(S.ok)return R.info("User free tier status:",S),S.result}catch(S){throw R.error("Failed to fetch free tier status:",S),S}})(),y=await rQ6();R.info("Loaded session state:",y),await Gv1({codebaseContextService:V.codebaseContextService,stdout:process.stdout,history:new $01,fuzzyServer:V.fuzzyServer,settingsStorage:V.settingsStorage,threadService:V.threadService,threadHistoryService:V.threadHistoryService,threadSyncService:V.threadSyncService,threadID:D.threadID,threadFuzzyIndexer:L,worker:D,workerDeps:K,skillService:K.skillService,configService:V.configService,internalAPIClient:P4,ampURL:J.ampURL,startNewThread:U,switchToThread:z,ideClient:h9,commandRegistry:A,mcpService:V.mcpService,toolboxService:V.toolboxService,mcpTrustHandler:I,showJetBrainsInstaller:N,showIdePicker:B,showIdePickerHint:w,openThreadSwitcher:Q.openThreadSwitcher,updateService:M,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:y,freeTierStatus:C,workspace:q?.team??null,features:q?.features??[],isDogfooding:W,threadDependencies:V,initialAgentMode:Y.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0}),await V.asyncDispose(),process.exit(0)}async function X7(J){if(J.interactive)W2.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
5212
|
+
`);let Y=!J.headless&&(!!J.execute||!process.stdout.isTTY&&!J.streamJson),Z=process.stdout.isTTY&&process.stderr.isTTY,X=await n96({...J,workspaceTrust:{current:!0,changes:IC},getHook:process.env.AMP_URL?(K,q)=>{if(K==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let K=await vQ6(J.mcpConfig);X=bQ6(X,K)}let G=K51.dirname(X.getSettingsFilePath());lr0(Vh,G);let V=await X.get("url","global");if(!V)V=d3;if(!FH(V))R.info("Targeting custom Amp server",{ampURL:V});return X=iU0(X),{executeMode:Y,isTTY:Z,ampURL:V,settings:X,secrets:nQ6(await KC1(J,X))}}function KI8(J){let Q={};for(let Y=0;Y<J.length;Y++){let Z=J[Y];if(Z?.startsWith("--")){let G=Z.slice(2).replace(/-([a-z])/g,(K,q)=>q.toUpperCase()),V=J[Y+1];if(V&&!V.startsWith("--"))Q[G]=V,Y++}}return Q}async function qI8(){let J=KI8(process.argv);if(m06({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),tA8(R),R.info("Starting Amp CLI.",{version:"0.0.1768191623-gd520c9",buildTimestamp:"2026-01-12T04:24:47.496Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new J4(xZ.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await VI8().parseAsync(process.argv)}dr0().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await qI8().catch(qf)});async function WI8(J,Q){let Y=J.ampURL.includes("localhost")||J.ampURL.includes("127.0.0.1");if(process.env.AMP_URL&&!Y)await J.settings.set("url",process.env.AMP_URL,"global"),v8.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
5213
5213
|
`);else if(!FH(J.ampURL))v8.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
5214
5214
|
`);let Z=process.env.AMP_API_KEY;if(Z)v8.write(`API key found in environment variable, storing...
|
|
5215
5215
|
`),await Q.set("apiKey",Z,J.ampURL),v8.write(`API key successfully stored.
|
|
@@ -5223,7 +5223,7 @@ This thread belongs to a different user and cannot be continued for security rea
|
|
|
5223
5223
|
`);process.exit(0)}async function zI8(J,Q,Y,Z,X){YQ(X,J);let G=await WJ(Q,J);try{let V=ag(Y);if(!V)og(Y);let K=V,q=Z.trim();if(q.length===0)q2("Thread name cannot be empty");if(q.length>256)q2("Thread name cannot exceed 256 characters");if(!(await gM(K,G)).messages.length)q2("Cannot rename an empty thread.");let H=await ng(G);await(await b8.getOrCreateForThread(H,K)).handle({type:"title",value:q}),R.info("GOT HERE"),await G.threadSyncService.sync(),R.info("GOT THERE"),v8.write(Z0.green(`✓ Thread ${K} renamed to "${q}"
|
|
5224
5224
|
`)),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose();let K=`Failed to rename thread: ${V instanceof Error?V.message:String(V)}`;q2(K)}}async function FI8(J,Q,Y,Z){let X=await WJ(Q,J);try{let G=ag(Y);if(!G)og(Y);let V=await P4.archiveThread({thread:G,archived:Z},{config:X.configService});if(!V.ok)q2(`Failed to ${Z?"archive":"unarchive"} thread: ${V.error.message??V.error.code}`);v8.write(Z0.green(`✓ Thread ${Z?"archived":"unarchived"} successfully
|
|
5225
5225
|
`)),await X.asyncDispose(),process.exit(0)}catch(G){await X.asyncDispose(),q2(`Failed to ${Z?"archive":"unarchive"} thread: ${G instanceof Error?G.message:String(G)}`)}}async function UI8(J,Q,Y,Z){YQ(Z,J);let X=await WJ(Q,J);try{let G=ag(Y);if(!G)og(Y);let K=await gM(G,X),q=VR(K);v8.write(q+`
|
|
5226
|
-
`),await X.asyncDispose(),process.exit(0)}catch(G){await X.asyncDispose();let V=`Failed to render thread as markdown: ${G instanceof Error?G.message:String(G)}`;q2(V)}}async function DI8(J,Q,Y,Z,X){YQ(X,J);let G=await WJ(Q,J);try{let V=await W51(Y),K=await gM(V,G),q=Z.typing!==!1,W=parseInt(Z.wpm||"120",10),H=parseInt(Z.messageDelay||"1000",10),z=parseInt(Z.toolProgressDelay||"800",10),F=parseInt(Z.exitDelay||"3",10)*1000,U=Z.indicator!==!1,D=await ng(G),B=K.id;await G.threadStorage.set(B,K);let N=await b8.getOrCreateForThread(D,B);await N.resume();let w=Ce.fromWorker(N),M=new _e(G.threadStorage),L=P1.of([Q0.file(process.cwd())]),O=uq1(void 0,L),A=new A41(G.mcpService,Q.settings.getWorkspaceRootPath()),I=V61("0.0.
|
|
5226
|
+
`),await X.asyncDispose(),process.exit(0)}catch(G){await X.asyncDispose();let V=`Failed to render thread as markdown: ${G instanceof Error?G.message:String(G)}`;q2(V)}}async function DI8(J,Q,Y,Z,X){YQ(X,J);let G=await WJ(Q,J);try{let V=await W51(Y),K=await gM(V,G),q=Z.typing!==!1,W=parseInt(Z.wpm||"120",10),H=parseInt(Z.messageDelay||"1000",10),z=parseInt(Z.toolProgressDelay||"800",10),F=parseInt(Z.exitDelay||"3",10)*1000,U=Z.indicator!==!1,D=await ng(G),B=K.id;await G.threadStorage.set(B,K);let N=await b8.getOrCreateForThread(D,B);await N.resume();let w=Ce.fromWorker(N),M=new _e(G.threadStorage),L=P1.of([Q0.file(process.cwd())]),O=uq1(void 0,L),A=new A41(G.mcpService,Q.settings.getWorkspaceRootPath()),I=V61("0.0.1768191623-gd520c9",G.settingsStorage),P=Pb({configService:G.configService,filesystem:Q8,spawn:GF});await Gv1({codebaseContextService:G.codebaseContextService,stdout:process.stdout,history:new $01,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadHistoryService:G.threadHistoryService,threadSyncService:G.threadSyncService,threadID:B,threadFuzzyIndexer:M,worker:w,workerDeps:D,skillService:D.skillService,configService:G.configService,internalAPIClient:P4,ampURL:Q.ampURL,startNewThread:async()=>w,switchToThread:async()=>w,ideClient:h9,commandRegistry:O,mcpService:G.mcpService,toolboxService:P,mcpTrustHandler:A,showJetBrainsInstaller:!1,updateService:I,isDogfooding:!1,replayMode:{thread:K,typingEnabled:q,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:F,showIndicator:U},freeTierStatus:{canUseAmpFree:!0,isDailyGrantEnabled:!1},features:[]}),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),await qf(V,Y)}}async function BI8(J,Q,Y,Z,X){YQ(Z,J);let G=await WJ(Q,J);try{let V=ag(Y);if(!V)og(Y);let K=V,q=await P4.getUserInfo({},{config:G.configService}),W=q.ok?q.result:null,H=I41(J,W);if(!H&&!X)q2("Must specify either --visibility or --support");if(H&&X)q2("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)q2(H.message);if(H)await G.threadSyncService.updateThreadMeta(K,E41(H)),v8.write(Z0.green("✓ ")+`Thread ${K} visibility changed to ${H}.
|
|
5227
5227
|
`);if(X){await gM(K,G);let z=typeof X==="string"?X:void 0;await dR0(G.threadService,K,G.configService,z),v8.write(Z0.green("✓ ")+`Thread ${K} has been shared with Amp support. These thread reports will be aggregated and analysed.
|
|
5228
5228
|
`)}await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),q2(`Failed to update thread: ${V instanceof Error?V.message:String(V)}`)}}async function NI8(J,Q,Y,Z){YQ(Z,J);let X=await WJ(Q,J),G=await ng(X);try{let V=await W51(Y),q=(await gM(V,X)).messages.length-1,W=await b8.getOrCreateForThread(G,V),H=await WR(W,X.threadSyncService,q);await Promise.all([X.threadSyncService.uploadThread(V),X.threadSyncService.uploadThread(H)]),await fb1(H),v8.write(`${H}
|
|
5229
5229
|
`),await X.asyncDispose(),process.exit(0)}catch(V){W2.write(`Error forking thread: ${V instanceof Error?V.message:String(V)}
|