@sourcegraph/amp 0.0.1766260872-g384001 → 0.0.1766275311-g95fb3f
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 +10 -10
- 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=ZK1(J,Q);let{value:X,attributes:G}=Y,V=(0,rz0.hrTimeToMilliseconds)(Y.endTime);return Z+=hi(J,G,X,this._appendTimestamp?V:void 0,this._additionalAttributes),Z}_serializeHistogramDataPoint(J,Q,Y){let Z="";J=ZK1(J,Q);let{attributes:X,value:G}=Y,V=(0,rz0.hrTimeToMilliseconds)(Y.endTime);for(let H of["count","sum"]){let F=G[H];if(F!=null)Z+=hi(J+"_"+H,X,F,this._appendTimestamp?V:void 0,this._additionalAttributes)}let K=0,q=G.buckets.counts.entries(),W=!1;for(let[H,F]of q){K+=F;let U=G.buckets.boundaries[H];if(U===void 0&&W)break;if(U===1/0)W=!0;Z+=hi(J+"_bucket",X,K,this._appendTimestamp?V:void 0,Object.assign({},this._additionalAttributes??{},{le:U===void 0||U===1/0?"+Inf":String(U)}))}return Z}_serializeResource(J){if(this._withoutTargetInfo===!0)return"";let Q="target_info",Y=`# HELP ${Q} Target metadata`,Z=`# TYPE ${Q} gauge`,X=hi(Q,J.attributes,1).trim();return`${Y}
|
|
45
45
|
${Z}
|
|
46
46
|
${X}
|
|
47
|
-
`}}ez0.PrometheusSerializer=tz0});var ZU0=g((QU0)=>{Object.defineProperty(QU0,"__esModule",{value:!0});QU0.PrometheusExporter=void 0;var Iy=i6(),TY4=H8(),GK1=mM(),CY4=v1("http"),jY4=$K1(),SY4=v1("url");class PH extends GK1.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:GK1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(X)=>GK1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||PH.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||PH.DEFAULT_OPTIONS.port,this._prefix=J.prefix||PH.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:PH.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||PH.DEFAULT_OPTIONS.withResourceConstantLabels,Z=J.withoutTargetInfo||PH.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,CY4.createServer)(this._requestHandler).unref(),this._serializer=new jY4.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,Z),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||PH.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(X)=>{Iy.diag.error(X),Q(X)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return Iy.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)Iy.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,TY4.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},()=>{Iy.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 SY4.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)Iy.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()}}QU0.PrometheusExporter=PH});var XU0=g((bi)=>{Object.defineProperty(bi,"__esModule",{value:!0});bi.PrometheusSerializer=bi.PrometheusExporter=void 0;var _Y4=ZU0();Object.defineProperty(bi,"PrometheusExporter",{enumerable:!0,get:function(){return _Y4.PrometheusExporter}});var kY4=$K1();Object.defineProperty(bi,"PrometheusSerializer",{enumerable:!0,get:function(){return kY4.PrometheusSerializer}})});var qU0=g((VU0)=>{Object.defineProperty(VU0,"__esModule",{value:!0});VU0.OTLPTraceExporter=void 0;var xY4=uK(),vY4=iG(),$U0=BH();class GU0 extends xY4.OTLPExporterBase{constructor(J={}){super((0,$U0.createOtlpHttpExportDelegate)((0,$U0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),vY4.ProtobufTraceSerializer))}}VU0.OTLPTraceExporter=GU0});var WU0=g((VK1)=>{Object.defineProperty(VK1,"__esModule",{value:!0});VK1.OTLPTraceExporter=void 0;var hY4=qU0();Object.defineProperty(VK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return hY4.OTLPTraceExporter}})});var HU0=g((KK1)=>{Object.defineProperty(KK1,"__esModule",{value:!0});KK1.OTLPTraceExporter=void 0;var bY4=WU0();Object.defineProperty(KK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return bY4.OTLPTraceExporter}})});var FU0=g((qK1)=>{Object.defineProperty(qK1,"__esModule",{value:!0});qK1.OTLPTraceExporter=void 0;var mY4=HU0();Object.defineProperty(qK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return mY4.OTLPTraceExporter}})});var DU0=g((BU0)=>{Object.defineProperty(BU0,"__esModule",{value:!0});BU0.OTLPTraceExporter=void 0;var pY4=uK(),dY4=iG(),zU0=BH();class UU0 extends pY4.OTLPExporterBase{constructor(J={}){super((0,zU0.createOtlpHttpExportDelegate)((0,zU0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),dY4.JsonTraceSerializer))}}BU0.OTLPTraceExporter=UU0});var MU0=g((WK1)=>{Object.defineProperty(WK1,"__esModule",{value:!0});WK1.OTLPTraceExporter=void 0;var cY4=DU0();Object.defineProperty(WK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return cY4.OTLPTraceExporter}})});var LU0=g((HK1)=>{Object.defineProperty(HK1,"__esModule",{value:!0});HK1.OTLPTraceExporter=void 0;var nY4=MU0();Object.defineProperty(HK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return nY4.OTLPTraceExporter}})});var AU0=g((FK1)=>{Object.defineProperty(FK1,"__esModule",{value:!0});FK1.OTLPTraceExporter=void 0;var aY4=LU0();Object.defineProperty(FK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return aY4.OTLPTraceExporter}})});var PU0=g((IU0)=>{Object.defineProperty(IU0,"__esModule",{value:!0});IU0.OTLPTraceExporter=void 0;var OU0=ki(),rY4=iG(),sY4=uK();class wU0 extends sY4.OTLPExporterBase{constructor(J={}){super((0,OU0.createOtlpGrpcExportDelegate)((0,OU0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),rY4.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}IU0.OTLPTraceExporter=wU0});var RU0=g((zK1)=>{Object.defineProperty(zK1,"__esModule",{value:!0});zK1.OTLPTraceExporter=void 0;var tY4=PU0();Object.defineProperty(zK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return tY4.OTLPTraceExporter}})});var jU0=g((TU0)=>{Object.defineProperty(TU0,"__esModule",{value:!0});TU0.prepareSend=void 0;var UK1=i6(),gi=H8(),JZ4=v1("http"),QZ4=v1("https");function YZ4(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 UK1.diag.debug("Zipkin send with empty spans"),V({code:gi.ExportResultCode.SUCCESS});let{request:K}=Y.protocol==="http:"?JZ4:QZ4,q=K(Y,Z,(H)=>{let F="";H.on("data",(U)=>{F+=U}),H.on("end",()=>{let U=H.statusCode||0;if(UK1.diag.debug(`Zipkin response status code: ${U}, body: ${F}`),U<400)return V({code:gi.ExportResultCode.SUCCESS});else return V({code:gi.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${U}`)})})});q.on("error",(H)=>{return V({code:gi.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(G);UK1.diag.debug(`Zipkin request payload: ${W}`),q.write(W,"utf8"),q.end()}}TU0.prepareSend=YZ4});var SU0=g((BK1)=>{Object.defineProperty(BK1,"__esModule",{value:!0});BK1.prepareSend=void 0;var ZZ4=jU0();Object.defineProperty(BK1,"prepareSend",{enumerable:!0,get:function(){return ZZ4.prepareSend}})});var DK1=g((NK1)=>{Object.defineProperty(NK1,"__esModule",{value:!0});NK1.prepareSend=void 0;var $Z4=SU0();Object.defineProperty(NK1,"prepareSend",{enumerable:!0,get:function(){return $Z4.prepareSend}})});var kU0=g((_U0)=>{Object.defineProperty(_U0,"__esModule",{value:!0});_U0.SpanKind=void 0;var VZ4;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(VZ4=_U0.SpanKind||(_U0.SpanKind={}))});var fU0=g((vU0)=>{Object.defineProperty(vU0,"__esModule",{value:!0});vU0._toZipkinAnnotations=vU0._toZipkinTags=vU0.toZipkinSpan=vU0.defaultStatusErrorTagName=vU0.defaultStatusCodeTagName=void 0;var LU=i6(),LK1=H8(),mi=kU0(),KZ4={[LU.SpanKind.CLIENT]:mi.SpanKind.CLIENT,[LU.SpanKind.SERVER]:mi.SpanKind.SERVER,[LU.SpanKind.CONSUMER]:mi.SpanKind.CONSUMER,[LU.SpanKind.PRODUCER]:mi.SpanKind.PRODUCER,[LU.SpanKind.INTERNAL]:void 0};vU0.defaultStatusCodeTagName="otel.status_code";vU0.defaultStatusErrorTagName="error";function qZ4(J,Q,Y,Z){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:KZ4[J.kind],timestamp:(0,LK1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,LK1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:yU0(J,Y,Z),annotations:J.events.length?xU0(J.events):void 0}}vU0.toZipkinSpan=qZ4;function yU0({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!==LU.SpanStatusCode.UNSET)q[V]=String(LU.SpanStatusCode[Y.code]);if(Y.code===LU.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}vU0._toZipkinTags=yU0;function xU0(J){return J.map((Q)=>({timestamp:Math.round((0,LK1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}vU0._toZipkinAnnotations=xU0});var mU0=g((bU0)=>{Object.defineProperty(bU0,"__esModule",{value:!0});bU0.prepareGetHeaders=void 0;function UZ4(J){return function(){return J()}}bU0.prepareGetHeaders=UZ4});var iU0=g((lU0)=>{Object.defineProperty(lU0,"__esModule",{value:!0});lU0.ZipkinExporter=void 0;var uU0=i6(),pU0=H8(),dU0=DK1(),AK1=fU0(),OK1=tz(),BZ4=mU0();class cU0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,pU0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,dU0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||AK1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||AK1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,BZ4.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[OK1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(uU0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:pU0.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 uU0.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,dU0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let Z=J.map((X)=>(0,AK1.toZipkinSpan)(X,String(X.attributes[OK1.ATTR_SERVICE_NAME]||X.resource.attributes[OK1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(Z,(X)=>{if(Y)return Y(X)})}}lU0.ZipkinExporter=cU0});var aU0=g((ui)=>{Object.defineProperty(ui,"__esModule",{value:!0});ui.ZipkinExporter=ui.prepareSend=void 0;var NZ4=DK1();Object.defineProperty(ui,"prepareSend",{enumerable:!0,get:function(){return NZ4.prepareSend}});var DZ4=iU0();Object.defineProperty(ui,"ZipkinExporter",{enumerable:!0,get:function(){return DZ4.ZipkinExporter}})});var wK1=g((oU0)=>{Object.defineProperty(oU0,"__esModule",{value:!0});oU0.B3_DEBUG_FLAG_KEY=void 0;var LZ4=i6();oU0.B3_DEBUG_FLAG_KEY=(0,LZ4.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Ey=g((sU0)=>{Object.defineProperty(sU0,"__esModule",{value:!0});sU0.X_B3_FLAGS=sU0.X_B3_PARENT_SPAN_ID=sU0.X_B3_SAMPLED=sU0.X_B3_SPAN_ID=sU0.X_B3_TRACE_ID=sU0.B3_CONTEXT_HEADER=void 0;sU0.B3_CONTEXT_HEADER="b3";sU0.X_B3_TRACE_ID="x-b3-traceid";sU0.X_B3_SPAN_ID="x-b3-spanid";sU0.X_B3_SAMPLED="x-b3-sampled";sU0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";sU0.X_B3_FLAGS="x-b3-flags"});var XB0=g((YB0)=>{Object.defineProperty(YB0,"__esModule",{value:!0});YB0.B3MultiPropagator=void 0;var JV=i6(),PZ4=H8(),eU0=wK1(),vZ=Ey(),RZ4=new Set([!0,"true","True","1",1]),TZ4=new Set([!1,"false","False","0",0]);function CZ4(J){return J===JV.TraceFlags.SAMPLED||J===JV.TraceFlags.NONE}function jZ4(J){return Array.isArray(J)?J[0]:J}function pi(J,Q,Y){let Z=Q.get(J,Y);return jZ4(Z)}function SZ4(J,Q){let Y=pi(J,Q,vZ.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function _Z4(J,Q){let Y=pi(J,Q,vZ.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function JB0(J,Q){return pi(J,Q,vZ.X_B3_FLAGS)==="1"?"1":void 0}function kZ4(J,Q){let Y=pi(J,Q,vZ.X_B3_SAMPLED);if(JB0(J,Q)==="1"||RZ4.has(Y))return JV.TraceFlags.SAMPLED;if(Y===void 0||TZ4.has(Y))return JV.TraceFlags.NONE;return}class QB0{inject(J,Q,Y){let Z=JV.trace.getSpanContext(J);if(!Z||!(0,JV.isSpanContextValid)(Z)||(0,PZ4.isTracingSuppressed)(J))return;let X=J.getValue(eU0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,vZ.X_B3_TRACE_ID,Z.traceId),Y.set(Q,vZ.X_B3_SPAN_ID,Z.spanId),X==="1")Y.set(Q,vZ.X_B3_FLAGS,X);else if(Z.traceFlags!==void 0)Y.set(Q,vZ.X_B3_SAMPLED,(JV.TraceFlags.SAMPLED&Z.traceFlags)===JV.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let Z=SZ4(Q,Y),X=_Z4(Q,Y),G=kZ4(Q,Y),V=JB0(Q,Y);if((0,JV.isValidTraceId)(Z)&&(0,JV.isValidSpanId)(X)&&CZ4(G))return J=J.setValue(eU0.B3_DEBUG_FLAG_KEY,V),JV.trace.setSpanContext(J,{traceId:Z,spanId:X,isRemote:!0,traceFlags:G});return J}fields(){return[vZ.X_B3_TRACE_ID,vZ.X_B3_SPAN_ID,vZ.X_B3_FLAGS,vZ.X_B3_SAMPLED,vZ.X_B3_PARENT_SPAN_ID]}}YB0.B3MultiPropagator=QB0});var qB0=g((VB0)=>{Object.defineProperty(VB0,"__esModule",{value:!0});VB0.B3SinglePropagator=void 0;var KL=i6(),yZ4=H8(),$B0=wK1(),IK1=Ey(),xZ4=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,vZ4="0".repeat(16),hZ4=new Set(["d","1"]),fZ4="d";function bZ4(J){return J.length===32?J:`${vZ4}${J}`}function gZ4(J){if(J&&hZ4.has(J))return KL.TraceFlags.SAMPLED;return KL.TraceFlags.NONE}class GB0{inject(J,Q,Y){let Z=KL.trace.getSpanContext(J);if(!Z||!(0,KL.isSpanContextValid)(Z)||(0,yZ4.isTracingSuppressed)(J))return;let X=J.getValue($B0.B3_DEBUG_FLAG_KEY)||Z.traceFlags&1,G=`${Z.traceId}-${Z.spanId}-${X}`;Y.set(Q,IK1.B3_CONTEXT_HEADER,G)}extract(J,Q,Y){let Z=Y.get(Q,IK1.B3_CONTEXT_HEADER),X=Array.isArray(Z)?Z[0]:Z;if(typeof X!=="string")return J;let G=X.match(xZ4);if(!G)return J;let[,V,K,q]=G,W=bZ4(V);if(!(0,KL.isValidTraceId)(W)||!(0,KL.isValidSpanId)(K))return J;let H=gZ4(q);if(q===fZ4)J=J.setValue($B0.B3_DEBUG_FLAG_KEY,q);return KL.trace.setSpanContext(J,{traceId:W,spanId:K,isRemote:!0,traceFlags:H})}fields(){return[IK1.B3_CONTEXT_HEADER]}}VB0.B3SinglePropagator=GB0});var PK1=g((WB0)=>{Object.defineProperty(WB0,"__esModule",{value:!0});WB0.B3InjectEncoding=void 0;var mZ4;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(mZ4=WB0.B3InjectEncoding||(WB0.B3InjectEncoding={}))});var UB0=g((FB0)=>{Object.defineProperty(FB0,"__esModule",{value:!0});FB0.B3Propagator=void 0;var uZ4=H8(),pZ4=XB0(),dZ4=qB0(),cZ4=Ey(),lZ4=PK1();class HB0{_b3MultiPropagator=new pZ4.B3MultiPropagator;_b3SinglePropagator=new dZ4.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===lZ4.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,uZ4.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let Z=Y.get(Q,cZ4.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}}FB0.B3Propagator=HB0});var BB0=g((Yq)=>{Object.defineProperty(Yq,"__esModule",{value:!0});Yq.B3InjectEncoding=Yq.X_B3_TRACE_ID=Yq.X_B3_SPAN_ID=Yq.X_B3_SAMPLED=Yq.X_B3_PARENT_SPAN_ID=Yq.X_B3_FLAGS=Yq.B3_CONTEXT_HEADER=Yq.B3Propagator=void 0;var nZ4=UB0();Object.defineProperty(Yq,"B3Propagator",{enumerable:!0,get:function(){return nZ4.B3Propagator}});var lE=Ey();Object.defineProperty(Yq,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return lE.B3_CONTEXT_HEADER}});Object.defineProperty(Yq,"X_B3_FLAGS",{enumerable:!0,get:function(){return lE.X_B3_FLAGS}});Object.defineProperty(Yq,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return lE.X_B3_PARENT_SPAN_ID}});Object.defineProperty(Yq,"X_B3_SAMPLED",{enumerable:!0,get:function(){return lE.X_B3_SAMPLED}});Object.defineProperty(Yq,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return lE.X_B3_SPAN_ID}});Object.defineProperty(Yq,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return lE.X_B3_TRACE_ID}});var iZ4=PK1();Object.defineProperty(Yq,"B3InjectEncoding",{enumerable:!0,get:function(){return iZ4.B3InjectEncoding}})});var AB0=g((DB0)=>{Object.defineProperty(DB0,"__esModule",{value:!0});DB0.JaegerPropagator=DB0.UBER_BAGGAGE_HEADER_PREFIX=DB0.UBER_TRACE_ID_HEADER=void 0;var qL=i6(),oZ4=H8();DB0.UBER_TRACE_ID_HEADER="uber-trace-id";DB0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class NB0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=DB0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||DB0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||DB0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let Z=qL.trace.getSpanContext(J),X=qL.propagation.getBaggage(J);if(Z&&(0,oZ4.isTracingSuppressed)(J)===!1){let G=`0${(Z.traceFlags||qL.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=sZ4(X);if(q)V=qL.trace.setSpanContext(V,q)}if(G.length===0)return V;let K=qL.propagation.getBaggage(J)??qL.propagation.createBaggage();for(let q of G){if(q.value===void 0)continue;K=K.setEntry(q.key,{value:decodeURIComponent(q.value)})}return V=qL.propagation.setBaggage(V,K),V}fields(){return[this._jaegerTraceHeader]}}DB0.JaegerPropagator=NB0;var rZ4=/^[0-9a-f]{1,2}$/i;function sZ4(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=rZ4.test(X)?parseInt(X,16)&1:1;return{traceId:G,spanId:V,isRemote:!0,traceFlags:K}}});var OB0=g((Py)=>{Object.defineProperty(Py,"__esModule",{value:!0});Py.UBER_TRACE_ID_HEADER=Py.UBER_BAGGAGE_HEADER_PREFIX=Py.JaegerPropagator=void 0;var TK1=AB0();Object.defineProperty(Py,"JaegerPropagator",{enumerable:!0,get:function(){return TK1.JaegerPropagator}});Object.defineProperty(Py,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return TK1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(Py,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return TK1.UBER_TRACE_ID_HEADER}})});var TB0=g((PB0)=>{Object.defineProperty(PB0,"__esModule",{value:!0});PB0.setupPropagator=PB0.setupContextManager=PB0.getPropagatorFromEnv=PB0.getSpanProcessorsFromEnv=PB0.getOtlpProtocolFromEnv=PB0.filterBlanksAndNulls=PB0.getResourceDetectorsFromEnv=void 0;var N$=i6(),QV=H8(),wB0=FU0(),eZ4=AU0(),JX4=RU0(),QX4=aU0(),Ry=hM(),di=cM(),CK1=BB0(),YX4=OB0(),ZX4=ec(),XX4="env",$X4="host",GX4="os",VX4="process",KX4="serviceinstance";function qX4(){let J=new Map([[XX4,Ry.envDetector],[$X4,Ry.hostDetector],[GX4,Ry.osDetector],[KX4,Ry.serviceInstanceIdDetector],[VX4,Ry.processDetector]]),Q=(0,QV.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)N$.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return Z||[]})}PB0.getResourceDetectorsFromEnv=qX4;function IB0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}PB0.filterBlanksAndNulls=IB0;function EB0(){return(0,QV.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,QV.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}PB0.getOtlpProtocolFromEnv=EB0;function WX4(){let J=EB0();switch(J){case"grpc":return new JX4.OTLPTraceExporter;case"http/json":return new eZ4.OTLPTraceExporter;case"http/protobuf":return new wB0.OTLPTraceExporter;default:return N$.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new wB0.OTLPTraceExporter}}function HX4(){let J=new Map([["otlp",()=>WX4()],["zipkin",()=>new QX4.ZipkinExporter],["console",()=>new di.ConsoleSpanExporter]]),Q=[],Y=[],Z=IB0(Array.from(new Set((0,QV.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(Z[0]==="none")return N$.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(Z.length===0)N$.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),Z=["otlp"];else if(Z.length>1&&Z.includes("none"))N$.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 N$.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${X}.`)}for(let X of Q)if(X instanceof di.ConsoleSpanExporter)Y.push(new di.SimpleSpanProcessor(X));else Y.push(new di.BatchSpanProcessor(X));if(Q.length===0)N$.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}PB0.getSpanProcessorsFromEnv=HX4;function FX4(){let J=(0,QV.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new QV.W3CTraceContextPropagator],["baggage",()=>new QV.W3CBaggagePropagator],["b3",()=>new CK1.B3Propagator],["b3multi",()=>new CK1.B3Propagator({injectEncoding:CK1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new YX4.JaegerPropagator]]),Y=Array.from(new Set(J)),X=Y.map((G)=>{let V=Q.get(G)?.();if(!V){N$.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 QV.CompositePropagator({propagators:X})}PB0.getPropagatorFromEnv=FX4;function zX4(J){if(J===null)return;if(J===void 0){let Q=new ZX4.AsyncLocalStorageContextManager;Q.enable(),N$.context.setGlobalContextManager(Q);return}J.enable(),N$.context.setGlobalContextManager(J)}PB0.setupContextManager=zX4;function UX4(J){if(J===null)return;if(J===void 0){N$.propagation.setGlobalPropagator(new QV.CompositePropagator({propagators:[new QV.W3CTraceContextPropagator,new QV.W3CBaggagePropagator]}));return}N$.propagation.setGlobalPropagator(J)}PB0.setupPropagator=UX4});var yB0=g((_B0)=>{Object.defineProperty(_B0,"__esModule",{value:!0});_B0.NodeSDK=void 0;var YQ=i6(),OX4=Jk(),wX4=TZ1(),nE=hM(),Ty=pX1(),IX4=_$0(),EX4=Bz0(),jK1=Iz0(),PX4=uz0(),CB0=oz0(),RX4=vi(),TX4=XU0(),WL=mM(),CX4=cM(),jX4=J$1(),SX4=tz(),AU=H8(),Cy=TB0();function jB0(J,Q){return parseInt(process.env[J]||"")||Q}function _X4(){let J=[],Q=(0,AU.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)YQ.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return YQ.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=jB0("OTEL_METRIC_EXPORT_INTERVAL",60000),G=jB0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(Z){case"grpc":J.push(new WL.PeriodicExportingMetricReader({exporter:new PX4.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/json":J.push(new WL.PeriodicExportingMetricReader({exporter:new RX4.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/protobuf":J.push(new WL.PeriodicExportingMetricReader({exporter:new CB0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;default:YQ.diag.warn(`Unsupported OTLP metrics protocol: "${Z}". Using http/protobuf.`),J.push(new WL.PeriodicExportingMetricReader({exporter:new CB0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}))}}else if(Y==="console")J.push(new WL.PeriodicExportingMetricReader({exporter:new WL.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new TX4.PrometheusExporter);else YQ.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class SB0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,AU.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,AU.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)YQ.diag.setLogger(new YQ.DiagConsoleLogger,{logLevel:(0,AU.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,nE.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,AU.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,Cy.getResourceDetectorsFromEnv)();else this._resourceDetectors=[nE.envDetector,nE.processDetector,nE.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)YQ.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let Z=J.spanProcessor??new CX4.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]},YQ.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],YQ.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,wX4.registerInstrumentations)({instrumentations:this._instrumentations}),(0,Cy.setupContextManager)(this._configuration?.contextManager),(0,Cy.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,Cy.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,nE.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,nE.resourceFromAttributes)({[SX4.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,Cy.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new jX4.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),YQ.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new Ty.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,OX4.logs.setGlobalLoggerProvider(Y)}let Q=_X4();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 WL.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=Z,YQ.metrics.setGlobalMeterProvider(Z);for(let X of this._instrumentations)X.setMeterProvider(YQ.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,AU.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)YQ.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){YQ.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,AU.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,AU.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(Z){case"grpc":Q.push(new EX4.OTLPLogExporter);break;case"http/json":Q.push(new IX4.OTLPLogExporter);break;case"http/protobuf":Q.push(new jK1.OTLPLogExporter);break;case void 0:case"":Q.push(new jK1.OTLPLogExporter);break;default:YQ.diag.warn(`Unsupported OTLP logs protocol: "${Z}". Using http/protobuf.`),Q.push(new jK1.OTLPLogExporter)}}else if(Y==="console")Q.push(new Ty.ConsoleLogRecordExporter);else YQ.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 Ty.ConsoleLogRecordExporter)return new Ty.SimpleLogRecordProcessor(Y);else return new Ty.BatchLogRecordProcessor(Y)})}}}_B0.NodeSDK=SB0});var xB0=g((SK1)=>{Object.defineProperty(SK1,"__esModule",{value:!0});SK1.NodeSDK=SK1.tracing=SK1.resources=SK1.node=SK1.metrics=SK1.logs=SK1.core=SK1.contextBase=SK1.api=void 0;SK1.api=i6();SK1.contextBase=i6();SK1.core=H8();SK1.logs=pX1();SK1.metrics=mM();SK1.node=J$1();SK1.resources=hM();SK1.tracing=cM();var kX4=yB0();Object.defineProperty(SK1,"NodeSDK",{enumerable:!0,get:function(){return kX4.NodeSDK}})});import pX4 from"os";import ci from"path";var OU,HL,wU,IU,vB0,da8,ca8,dX4,cX4;var iE=$1(()=>{OU=pX4.homedir(),{env:HL}=process,wU=HL.XDG_DATA_HOME||(OU?ci.join(OU,".local","share"):void 0),IU=HL.XDG_CONFIG_HOME||(OU?ci.join(OU,".config"):void 0),vB0=HL.XDG_STATE_HOME||(OU?ci.join(OU,".local","state"):void 0),da8=HL.XDG_CACHE_HOME||(OU?ci.join(OU,".cache"):void 0),ca8=HL.XDG_RUNTIME_DIR||void 0,dX4=(HL.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(wU)dX4.unshift(wU);cX4=(HL.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(IU)cX4.unshift(IU)});import{homedir as li}from"node:os";import FL from"node:path";var hB0,lX4,fB0,nX4,ni,iX4,aE,Zq,oa8;var RH=$1(()=>{iE();hB0=FL.join(li(),".local/share"),lX4=process.platform==="win32"||process.platform==="darwin"?hB0:wU??hB0,fB0=FL.join(li(),".config"),nX4=process.platform==="win32"||process.platform==="darwin"?fB0:IU??fB0,ni=FL.join(lX4,"amp"),iX4=FL.join(nX4,"amp"),aE=FL.join(iX4,"tools"),Zq=FL.join(li(),".cache","amp"),oa8=FL.join(li(),".cache","amp","http-debug-logs")});function oX4(){return aX4}function bB0(J){let Q=zL;return zL=J,Q}class Xq{baseLogger;scope;context={};constructor(J=gB0){this.baseLogger=J}with(J){let Q=new Xq(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new Xq(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=_K1.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 _K1,aX4=!1,rX4,zL,gB0,v;var N0=$1(()=>{_K1=Q6(i6(),1);rX4={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(oX4())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=_K1.trace.getActiveSpan();if(Z){let X=Z.spanContext();if(X.traceId)Y.traceId=X.traceId,Y.spanId=X.spanId}console.info(J,Y)}},zL=rX4;gB0={error:(J,...Q)=>zL.error(J,...Q),warn:(J,...Q)=>zL.warn(J,...Q),info:(J,...Q)=>zL.info(J,...Q),debug:(J,...Q)=>zL.debug(J,...Q),audit:(J,...Q)=>zL.audit(J,...Q)};v=gB0});function nB0(){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 iB0(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&&!X$4.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!$$4.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(G$4.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 V$4(J,Q){if(!J&&!Q)return"file";return J}function K$4(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=YV;else if(Q[0]!==YV)Q=YV+Q;break}return Q}class u0{static isUri(J){if(J instanceof u0)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||v5,this.authority=J.authority||v5,this.path=J.path||v5,this.query=J.query||v5,this.fragment=J.fragment||v5,this.platform=J.platform;else this.scheme=V$4(J,G),this.authority=Q||v5,this.path=K$4(this.scheme,Y||v5),this.query=Z||v5,this.fragment=X||v5,this.platform=V,iB0(this,G)}get fsPath(){return tB0(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=v5;if(Y===void 0)Y=this.authority;else if(Y===null)Y=v5;if(Z===void 0)Z=this.path;else if(Z===null)Z=v5;if(X===void 0)X=this.query;else if(X===null)X=v5;if(G===void 0)G=this.fragment;else if(G===null)G=v5;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 UL(Q,Y,Z,X,G,!1,V)}static parse(J,Q=!1){let Y=q$4.exec(J);if(!Y)return new UL(v5,v5,v5,v5,v5);return new UL(Y[2]||v5,ai(Y[4]||v5),ai(Y[5]||v5),ai(Y[7]||v5),ai(Y[9]||v5),Q)}static file(J,Q=nB0()){let Y=v5;if(Q==="windows")J=J.replace(/\\/g,YV);if(J[0]===YV&&J[1]===YV){let Z=J.indexOf(YV,2);if(Z===-1)Y=J.substring(2),J=YV;else Y=J.substring(2,Z),J=J.substring(Z)||YV}return new UL("file",Y,J,v5,v5,!1,Q)}static from(J){let Q=new UL(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return iB0(Q,!0),Q}toString(J=!1){return yK1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof u0)return J;let Q=new UL(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===rB0(Q.platform)?Y.fsPath:null,Q}}function rB0(J){return J==="windows"?1:void 0}function aB0(J,Q,Y){let Z=void 0;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=sB0[G];if(V!==void 0)Z+=V;else Z+=encodeURIComponent(J.charAt(X))}}return Z!==void 0?Z:J}function W$4(J){let Q=void 0;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+=sB0[Z]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function tB0(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 yK1(J,Q){let Y=!Q?aB0:W$4,Z="",{scheme:X,authority:G,path:V,query:K,fragment:q}=J;if(X)Z+=X,Z+=":";if(G||X==="file")Z+=YV,Z+=YV;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?aB0(q,!1,!1):q;return Z}function eB0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+eB0(J.substring(3));else return J}}function ai(J){if(!J.match(oB0))return J;return J.replace(oB0,(Q)=>eB0(Q))}function EU(J){return J.scheme==="file"}function n7(J){return u0.parse(J)}function v6(J){return J.toString()}function o4(J){if(typeof J==="string"||J instanceof URL)return u0.parse(J.toString());return J}function Sy(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var X$4,$$4,G$4,v5="",YV="/",q$4,UL,sB0,oB0;var _y=$1(()=>{X$4=/^\w[\w\d+.-]*$/,$$4=/^\//,G$4=/^\/\//;q$4=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;UL=class UL extends u0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=tB0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=yK1(this,!1);return this._formatted}return yK1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=rB0(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}};sB0={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"};oB0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function xK1(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 BL(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function rE(...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 JN0(J,Q,Y="/",Z="/",X=!0){function G(F,U){return X?F===U:F.toLowerCase()===U.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 F=0;F<W;F++)H.push("..");return H.push(...K.slice(q)),H.join(Z)}function oi(J){let Q=BL(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function u3(J){try{if(J=o4(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var sE=$1(()=>{_y()});function H$4(J,...Q){return J=o4(J),J.with({path:rE(J.path,...Q)})}function F$4(J,...Q){let Y=J.path,Z=!1;if(Y[0]!==ri)Y=ri+Y,Z=!0;let X=Y;for(let G of Q)if(G.startsWith("/"))X=rE(G);else X=rE(X,G);if(X!=="/"&&X.endsWith("/"))X=X.replace(/\/+$/,"");if(Z&&X[0]===ri&&!J.authority)X=X.substring(1);return J.with({path:X})}function z$4(J){if(J=o4(J),J.path.length===0||J.path===ri)return J;let Q=xK1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function U$4(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 B$4(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 JN0(J.path,Q.path,Y,Y)}function N$4(J,Q){let Y=v6(J),Z=v6(Q);if(Y.startsWith("file:///")&&Z.startsWith("file:///"))return QN0(Y)===QN0(Z);return Y===Z}function QN0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var ri="/",i0;var si=$1(()=>{sE();_y();i0={joinPath:H$4,resolvePath:F$4,dirname:z$4,basename:(J)=>BL(o4(J).path),extname:(J)=>oi(o4(J).path),hasPrefix:U$4,relativePath:B$4,equalURIs:N$4}});var D$4=(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},tE=(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),tE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),tE(J);case"string":let Z=J[J.length-2];if(Z?.type==="delimiter")return J=J.slice(0,J.length-1),tE(J);else if(Z?.type==="brace"&&Z.value==="{")return J=J.slice(0,J.length-1),tE(J);break;case"delimiter":return J=J.slice(0,J.length-1),tE(J);break}return J},M$4=(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},L$4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},D$=(J)=>JSON.parse(L$4(M$4(tE(D$4(J)))));var NL=()=>{};function ti(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function YN0(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 hK1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function A$4(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(ZN0(J,Y.type,Y.value),J._state==="closed")break}function ZN0(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(hK1(J),Z&&typeof Z.error==="function")Z.error(Y);else throw Y;break;case"complete":if(hK1(J),Z&&typeof Z.complete==="function")Z.complete();break}}catch(X){console.error("notifySubscription",X)}if(J._state==="closed")YN0(J);else if(J._state==="running")J._state="ready"}function vK1(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}],ti(()=>A$4(J));return}ZN0(J,Q,Y)}class XN0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new $N0(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")hK1(this),YN0(this)}}class $N0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){vK1(this._subscription,"next",J)}error(J){vK1(this._subscription,"error",J)}complete(){vK1(this._subscription,"complete")}}function h5(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class eE{_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 fK1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function bK1(J){if(fK1(J))return J;return Y0.of(J)}var Y0;var JP=$1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");Y0=class Y0{_subscriber;constructor(J){if(!(this instanceof Y0))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 XN0(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 this==="function"?this:Y0;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 Y0)return X;return new Q((G)=>X.subscribe(G))}let Z=J[Symbol.iterator];if(typeof Z==="function")return new Q((X)=>{ti(()=>{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)=>{ti(()=>{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 this==="function"?this:Y0)((Y)=>{ti(()=>{if(Y.closed)return;for(let Z of J)if(Y.next(Z),Y.closed)return;Y.complete()})})}static get[Symbol.species](){return this}}});var r4,U5;var ei=$1(()=>{JP();r4=class r4 extends Y0{_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()}};U5=class U5 extends r4{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 gK1,ky;var GN0=$1(()=>{JP();ei();gK1=class gK1 extends Set{subject=new U5(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 Y0.from(this.subject)}dispose(){this.subject.complete()}};ky=class ky extends Map{subject=new U5(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 Y0.from(this.subject)}dispose(){this.subject.complete()}}});function Ja(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)=>Ja(G,Q[V]));let X=new Set([...Object.keys(J),...Object.keys(Q)]);for(let G of X)if(!Ja(J[G],Q[G]))return!1;return!0}function mK1(J){return{dispose:J.unsubscribe.bind(J)}}function KN0(...J){return new Y0((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}async function D6(J,Q){return new Promise((Y,Z)=>{let X=void 0,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 PU(J,Q){return new Promise((Y,Z)=>{let X,G=!1,V=void 0,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 qN0(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 i7(J){return new Y0((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function J4(J){return new Y0((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 X6(J){return(Q)=>{return new Y0((Y)=>{let Z=new eE(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()=>h5(G)})}}function Qa(J){return new Y0((Q)=>{let Y=0,Z=setInterval(()=>{Q.next(Y++)},J);return()=>clearInterval(Z)})}function TH(...J){return new Y0((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()=>{WN0(Z)}})}function h8(...J){if(J.length===0)return yy;return new Y0((Q)=>{let Y=Array(J.length),Z=Array(J.length).fill(0),X=Array(J.length).fill(!1),G=0,V=[],K=new eE(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 F=++Z[q];if(X.every(Boolean))K.schedule(async(U)=>{if(Z[q]===F)U([...Y])})},error(H){K.error(H)},complete(){if(G++,G===J.length)K.complete()}}))}return()=>{WN0(V)}})}function U8(J){let Y=J?.shouldCountRefs??!0,Z=O$4++,X=(G,...V)=>{};return(G)=>{let V=new r4,K=null,q=!1,W,H=0;return new Y0((F)=>{if(H++,q)X("new subscriber, emitting buffered value",W),F.next(W);else X("new subscriber, no buffered value to emit");if(!K)K=G.subscribe({next:(B)=>{q=!0,W=B,V.next(B)},error:(B)=>V.error(B),complete:()=>V.complete()});let U=V.subscribe(F);return()=>{if(H--,U.unsubscribe(),Y&&H===0){if(K)h5(K),K=null;q=!1}}})}}function WN0(J){for(let Q of J)if(Q)h5(Q)}function CH(J){return(Q)=>{return new Y0((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 ZV(J){return(Q)=>{return new Y0((Y)=>{let Z,X=Q.subscribe({next(G){Z=G,Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{h5(X),J(Z)}})}}function I4(J=Ja){return(Q)=>{return new Y0((Y)=>{let Z=VN0,X=new eE(Y),G=Q.subscribe({complete(){X.complete()},error(V){X.error(V)},next(V){X.schedule(async(K)=>{if(Z===VN0||!J(Z,V))Z=V,K(V)})}});return()=>h5(G)})}}function hZ(J){return w$4(typeof J==="function"?{next:J}:J)}function w$4(J){return(Q)=>new Y0((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()=>h5(X)})}function RU(J){return(Q)=>{return new Y0((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 Ya(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(G),X.unsubscribe()}})}}function d8(J){return(Q)=>new Y0((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)h5(Z)}})}function jH(J){return(Q)=>new Y0((Y)=>{let Z=0,X=Q.subscribe({next(G){if(Z<J){if(Y.next(G),Z++,Z===J)Y.complete(),h5(X)}},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{h5(X)}})}function HN0(J){return(Q)=>new Y0((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()=>{h5(X)}})}function uK1(J){return(Q)=>{return new Y0((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(F){Y.next(F)},error(F){Y.error(F)},complete(){X.delete(H),V()}});X.add(H)},error(q){Y.error(q)},complete(){G=!0,V()}});return()=>{h5(K);for(let q of X)if(q)h5(q)}})}}function L4(J){return(Q)=>{return new Y0((Y)=>{let Z=0,X=null,G=!1,V=()=>{if(G&&!X)Y.complete()},K=Q.subscribe({next(q){if(X)h5(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(h5(K),X)h5(X)}})}}function fZ(J){return(Q)=>new Y0((Y)=>{let Z=null,X=null,G=!1,V=Q.subscribe({next:(K)=>{if(X=K,G=!0,Z===null)Z=setTimeout(()=>{if(G)Y.next(X),G=!1;Z=null},J)},error:(K)=>Y.error(K),complete:()=>{if(Z!==null)clearTimeout(Z);if(G)Y.next(X);Y.complete()}});return()=>{if(h5(V),Z!==null)clearTimeout(Z)}})}function xy(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Y)=>new Y0((Z)=>{let X=0,G=null,V=null,K=!1,q=Y.subscribe({next:(W)=>{let H=Date.now();if(V=W,K=!0,H-X>=J)Z.next(W),X=H,K=!1;else if(G===null)G=setTimeout(()=>{if(K)Z.next(V),X=Date.now(),K=!1;G=null},J-(H-X));if(X===0)Z.next(W),X=H,K=!1},error:(W)=>Z.error(W),complete:()=>{if(G!==null)clearTimeout(G);if(K)Z.next(V);Z.complete()}});return()=>{if(h5(q),G!==null)clearTimeout(G)}})}function SH(...J){return new Y0((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)h5(Z)}})}function bZ(J){return(Q)=>new Y0((Y)=>{let Z=0,X=!1,G=null,V=Q.subscribe({next(K){try{let q=J(K,Z++);if(G)h5(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(h5(V),G)h5(G)}})}function vy({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new Y0((Z)=>{J?.();let X=Y.subscribe(Z);return()=>{h5(X),Q?.()}})}function TU(J){return(Q)=>Y0.from(Q).pipe(L4((Y)=>J4((Z)=>J(Y,Z))))}function a7(J){return(Q)=>new Y0((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(h5(X),Z)h5(Z)}})}function B5(J){return(Q)=>{return new Y0((Y)=>{let Z=Q.subscribe({next(X){if(J(X))Y.next(X)},error(X){Y.error(X)},complete(){Y.complete()}});return()=>h5(Z)})}}function FN0(J,Q){return(Y)=>{return new Y0((Z)=>{let X,G=0,V=new eE(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()=>h5(K)})}}var yy,M$,wo8,O$4=0,VN0,Ya;var pK1=$1(()=>{JP();ei();yy=new Y0((J)=>{J.complete()}),M$=new Y0(()=>{});wo8=Symbol("noInitialValue");VN0={};Ya=class Ya extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function Za(J,Q){return(Y)=>{return Y0.from(Y).pipe(L4((Z)=>Z===$q?Y0.of($q):J(Z).pipe(a7((X)=>Y0.of(X instanceof Error?X:Error(X))),d8($q))),U8(Q))}}function I$4(){return(J)=>Y0.from(J).pipe(B5((Q)=>Q!==$q))}async function zN0(J,Q){let Y=await D6(Y0.from(J).pipe(I$4()),Q);if(Y instanceof Error)throw Y;return Y}var $q;var UN0=$1(()=>{JP();pK1();$q=Symbol.for("@@pendingOperation")});var s0=$1(()=>{GN0();JP();UN0();pK1();ei()});function ZQ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function LL(J){return!!J&&!!J[gZ]}function CU(J){if(!J)return!1;return LN0(J)||Array.isArray(J)||!!J[hy]||!!J.constructor?.[hy]||uy(J)||py(J)}function LN0(J){if(!J||typeof J!=="object")return!1;let Q=ML(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)===E$4}function fy(J,Q){if(AL(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,Z)=>Q(Z,Y,J))}function AL(J){let Q=J[gZ];return Q?Q.type_:Array.isArray(J)?1:uy(J)?2:py(J)?3:0}function by(J,Q){return AL(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function dK1(J,Q){return AL(J)===2?J.get(Q):J[Q]}function AN0(J,Q,Y){let Z=AL(J);if(Z===2)J.set(Q,Y);else if(Z===3)J.add(Y);else J[Q]=Y}function P$4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function uy(J){return J instanceof Map}function py(J){return J instanceof Set}function DL(J){return J.copy_||J.base_}function nK1(J,Q){if(uy(J))return new Map(J);if(py(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=LN0(J);if(Q===!0||Q==="class_only"&&!Y){let Z=Object.getOwnPropertyDescriptors(J);delete Z[gZ];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(ML(J),Z)}else{let Z=ML(J);if(Z!==null&&Y)return{...J};let X=Object.create(Z);return Object.assign(X,J)}}function uZ(J,Q=!1){if(Ga(J)||LL(J)||!CU(J))return J;if(AL(J)>1)J.set=J.add=J.clear=J.delete=R$4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,Z])=>uZ(Z,!0));return J}function R$4(){ZQ(2)}function Ga(J){return Object.isFrozen(J)}function OL(J){let Q=iK1[J];if(!Q)ZQ(0,J);return Q}function T$4(J,Q){if(!iK1[J])iK1[J]=Q}function ON0(){return gy}function C$4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function BN0(J,Q){if(Q)OL("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function aK1(J){oK1(J),J.drafts_.forEach(j$4),J.drafts_=null}function oK1(J){if(J===gy)gy=J.parent_}function NN0(J){return gy=C$4(gy,J)}function j$4(J){let Q=J[gZ];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function DN0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[gZ].modified_)aK1(Q),ZQ(4);if(CU(J)){if(J=Xa(Q,J),!Q.parent_)$a(Q,J)}if(Q.patches_)OL("Patches").generateReplacementPatches_(Y[gZ].base_,J,Q.patches_,Q.inversePatches_)}else J=Xa(Q,Y,[]);if(aK1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==tK1?J:void 0}function Xa(J,Q,Y){if(Ga(Q))return Q;let Z=Q[gZ];if(!Z)return fy(Q,(X,G)=>MN0(J,Z,Q,X,G,Y)),Q;if(Z.scope_!==J)return Q;if(!Z.modified_)return $a(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(fy(G,(K,q)=>MN0(J,Z,X,K,q,Y,V)),$a(J,X,!1),Y&&J.patches_)OL("Patches").generatePatches_(Z,Y,J.patches_,J.inversePatches_)}return Z.copy_}function MN0(J,Q,Y,Z,X,G,V){if(LL(X)){let K=G&&Q&&Q.type_!==3&&!by(Q.assigned_,Z)?G.concat(Z):void 0,q=Xa(J,X,K);if(AN0(Y,Z,q),LL(q))J.canAutoFreeze_=!1;else return}else if(V)Y.add(X);if(CU(X)&&!Ga(X)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Xa(J,X),(!Q||!Q.scope_.parent_)&&typeof Z!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,Z))$a(J,X)}}function $a(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)uZ(Q,Y)}function S$4(J,Q){let Y=Array.isArray(J),Z={type_:Y?1:0,scope_:Q?Q.scope_:ON0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},X=Z,G=eK1;if(Y)X=[Z],G=my;let{revoke:V,proxy:K}=Proxy.revocable(X,G);return Z.draft_=K,Z.revoke_=V,K}function cK1(J,Q){let Y=J[gZ];return(Y?DL(Y):J)[Q]}function _$4(J,Q,Y){let Z=wN0(Q,Y);return Z?"value"in Z?Z.value:Z.get?.call(J.draft_):void 0}function wN0(J,Q){if(!(Q in J))return;let Y=ML(J);while(Y){let Z=Object.getOwnPropertyDescriptor(Y,Q);if(Z)return Z;Y=ML(Y)}return}function rK1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)rK1(J.parent_)}}function lK1(J){if(!J.copy_)J.copy_=nK1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function sK1(J,Q){let Y=uy(J)?OL("MapSet").proxyMap_(J,Q):py(J)?OL("MapSet").proxySet_(J,Q):S$4(J,Q);return(Q?Q.scope_:ON0()).drafts_.push(Y),Y}function y$4(J){if(!LL(J))ZQ(10,J);return IN0(J)}function IN0(J){if(!CU(J)||Ga(J))return J;let Q=J[gZ],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=nK1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=nK1(J,!0);if(fy(Y,(Z,X)=>{AN0(Y,Z,IN0(X))}),Q)Q.finalized_=!1;return Y}function Va(){let Q="replace",Y="add",Z="remove";function X(U,B,M,L){switch(U.type_){case 0:case 2:return V(U,B,M,L);case 1:return G(U,B,M,L);case 3:return K(U,B,M,L)}}function G(U,B,M,L){let{base_:A,assigned_:w}=U,E=U.copy_;if(E.length<A.length)[A,E]=[E,A],[M,L]=[L,M];for(let P=0;P<A.length;P++)if(w[P]&&E[P]!==A[P]){let R=B.concat([P]);M.push({op:Q,path:R,value:F(E[P])}),L.push({op:Q,path:R,value:F(A[P])})}for(let P=A.length;P<E.length;P++){let R=B.concat([P]);M.push({op:Y,path:R,value:F(E[P])})}for(let P=E.length-1;A.length<=P;--P){let R=B.concat([P]);L.push({op:Z,path:R})}}function V(U,B,M,L){let{base_:A,copy_:w}=U;fy(U.assigned_,(E,P)=>{let R=dK1(A,E),C=dK1(w,E),S=!P?Z:by(A,E)?Q:Y;if(R===C&&S===Q)return;let k=B.concat(E);M.push(S===Z?{op:S,path:k}:{op:S,path:k,value:C}),L.push(S===Y?{op:Z,path:k}:S===Z?{op:Y,path:k,value:F(R)}:{op:Q,path:k,value:F(R)})})}function K(U,B,M,L){let{base_:A,copy_:w}=U,E=0;A.forEach((P)=>{if(!w.has(P)){let R=B.concat([E]);M.push({op:Z,path:R,value:P}),L.unshift({op:Y,path:R,value:P})}E++}),E=0,w.forEach((P)=>{if(!A.has(P)){let R=B.concat([E]);M.push({op:Y,path:R,value:P}),L.unshift({op:Z,path:R,value:P})}E++})}function q(U,B,M,L){M.push({op:Q,path:[],value:B===tK1?void 0:B}),L.push({op:Q,path:[],value:U})}function W(U,B){return B.forEach((M)=>{let{path:L,op:A}=M,w=U;for(let C=0;C<L.length-1;C++){let S=AL(w),k=L[C];if(typeof k!=="string"&&typeof k!=="number")k=""+k;if((S===0||S===1)&&(k==="__proto__"||k==="constructor"))ZQ(19);if(typeof w==="function"&&k==="prototype")ZQ(19);if(w=dK1(w,k),typeof w!=="object")ZQ(18,L.join("/"))}let E=AL(w),P=H(M.value),R=L[L.length-1];switch(A){case Q:switch(E){case 2:return w.set(R,P);case 3:ZQ(16);default:return w[R]=P}case Y:switch(E){case 1:return R==="-"?w.push(P):w.splice(R,0,P);case 2:return w.set(R,P);case 3:return w.add(P);default:return w[R]=P}case Z:switch(E){case 1:return w.splice(R,1);case 2:return w.delete(R);case 3:return w.delete(M.value);default:return delete w[R]}default:ZQ(17,A)}}),U}function H(U){if(!CU(U))return U;if(Array.isArray(U))return U.map(H);if(uy(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(py(U))return new Set(Array.from(U).map(H));let B=Object.create(ML(U));for(let M in U)B[M]=H(U[M]);if(by(U,hy))B[hy]=U[hy];return B}function F(U){if(LL(U))return H(U);else return U}T$4("Patches",{applyPatches_:W,generatePatches_:X,generateReplacementPatches_:q})}function s8(J){return J}var tK1,hy,gZ,ML,E$4,iK1,gy,eK1,my,k$4=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")ZQ(6);if(Z!==void 0&&typeof Z!=="function")ZQ(7);let X;if(CU(Q)){let G=NN0(this),V=sK1(Q,void 0),K=!0;try{X=Y(V),K=!1}finally{if(K)aK1(G);else oK1(G)}return BN0(G,Z),DN0(X,G)}else if(!Q||typeof Q!=="object"){if(X=Y(Q),X===void 0)X=Q;if(X===tK1)X=void 0;if(this.autoFreeze_)uZ(X,!0);if(Z){let G=[],V=[];OL("Patches").generateReplacementPatches_(Q,X,G,V),Z(G,V)}return X}else ZQ(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(!CU(J))ZQ(8);if(LL(J))J=y$4(J);let Q=NN0(this),Y=sK1(J,void 0);return Y[gZ].isManual_=!0,oK1(Q),Y}finishDraft(J,Q){let Y=J&&J[gZ];if(!Y||!Y.isManual_)ZQ(9);let{scope_:Z}=Y;return BN0(Z,Q),DN0(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=OL("Patches").applyPatches_;if(LL(J))return Z(J,Q);return this.produce(J,(X)=>Z(X,Q))}},mZ,XQ,QP,yo8,xo8,EN0,vo8,ho8;var $Q=$1(()=>{tK1=Symbol.for("immer-nothing"),hy=Symbol.for("immer-draftable"),gZ=Symbol.for("immer-state");ML=Object.getPrototypeOf;E$4=Object.prototype.constructor.toString();iK1={};eK1={get(J,Q){if(Q===gZ)return J;let Y=DL(J);if(!by(Y,Q))return _$4(J,Y,Q);let Z=Y[Q];if(J.finalized_||!CU(Z))return Z;if(Z===cK1(J.base_,Q))return lK1(J),J.copy_[Q]=sK1(Z,J);return Z},has(J,Q){return Q in DL(J)},ownKeys(J){return Reflect.ownKeys(DL(J))},set(J,Q,Y){let Z=wN0(DL(J),Q);if(Z?.set)return Z.set.call(J.draft_,Y),!0;if(!J.modified_){let X=cK1(DL(J),Q),G=X?.[gZ];if(G&&G.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(P$4(Y,X)&&(Y!==void 0||by(J.base_,Q)))return!0;lK1(J),rK1(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(cK1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,lK1(J),rK1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=DL(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(){ZQ(11)},getPrototypeOf(J){return ML(J.base_)},setPrototypeOf(){ZQ(12)}},my={};fy(eK1,(J,Q)=>{my[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});my.deleteProperty=function(J,Q){return my.set.call(this,J,Q,void 0)};my.set=function(J,Q,Y){return eK1.set.call(this,J[0],Q,Y,J[0])};mZ=new k$4,XQ=mZ.produce,QP=mZ.produceWithPatches.bind(mZ),yo8=mZ.setAutoFreeze.bind(mZ),xo8=mZ.setUseStrictShallowCopy.bind(mZ),EN0=mZ.applyPatches.bind(mZ),vo8=mZ.createDraft.bind(mZ),ho8=mZ.finishDraft.bind(mZ)});function PN0(J,Q=0){return(FJ[J[Q+0]]+FJ[J[Q+1]]+FJ[J[Q+2]]+FJ[J[Q+3]]+"-"+FJ[J[Q+4]]+FJ[J[Q+5]]+"-"+FJ[J[Q+6]]+FJ[J[Q+7]]+"-"+FJ[J[Q+8]]+FJ[J[Q+9]]+"-"+FJ[J[Q+10]]+FJ[J[Q+11]]+FJ[J[Q+12]]+FJ[J[Q+13]]+FJ[J[Q+14]]+FJ[J[Q+15]]).toLowerCase()}var FJ;var RN0=$1(()=>{FJ=[];for(let J=0;J<256;++J)FJ.push((J+256).toString(16).slice(1))});import{randomFillSync as x$4}from"crypto";function Wa(){if(Ka>qa.length-16)x$4(qa),Ka=0;return qa.slice(Ka,Ka+=16)}var qa,Ka;var TN0=$1(()=>{qa=new Uint8Array(256),Ka=qa.length});function v$4(J,Q,Y){let Z;if(J)Z=CN0(J.random??J.rng?.()??Wa(),J.msecs,J.seq,Q,Y);else{let X=Date.now(),G=Wa();h$4(Jq1,X,G),Z=CN0(G,Jq1.msecs,Jq1.seq,Q,Y)}return Q??PN0(Z)}function h$4(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 CN0(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 Jq1,Qq1;var jN0=$1(()=>{TN0();RN0();Jq1={};Qq1=v$4});var SN0=$1(()=>{jN0()});function Yq1({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 YP(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(f$4,"")}var f$4;var Ha=$1(()=>{f$4=Yq1()});var kN0=g((ro8,Zq1)=>{var jU={};if(typeof Zq1>"u")window.eastasianwidth=jU;else Zq1.exports=jU;jU.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"};jU.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function _N0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}jU.length=function(J){var Q=_N0(J),Y=0;for(var Z=0;Z<Q.length;Z++)Y=Y+this.characterLength(Q[Z]);return Y};jU.slice=function(J,Q,Y){if(textLen=jU.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=_N0(J);for(var V=0;V<G.length;V++){var K=G[V],q=jU.length(K);if(X>=Q-(q==2?1:0))if(X+q<=Y)Z+=K;else break;X+=q}return Z}});var Xq1=g((so8,yN0)=>{yN0.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 b$4,g$4;var xN0=$1(()=>{Ha();b$4=Q6(kN0(),1),g$4=Q6(Xq1(),1)});function Fa(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var $q1=$1(()=>{xN0()});var vN0="run_terminal_command",Gq1="read_file",m2="Task",p3="task_list",A9="finder",pY="get_diagnostics",f5="Bash",t5="oracle",hN0="painter",Gq="mermaid",Vq="todo_read",V7="todo_write",zJ="read_web_page",ZP="read_thread",za="find_thread",K7="create_file",dQ="glob",Ua="undo_edit",Ba="read_mcp_resource",T4="Read",o7="edit_file",XP="format_file",cQ="web_search",T9="Grep",wL="Check",Kq="librarian",Na="kraken",fN0="look_at",Da="read_github",Ma="search_github",La="commit_search",Aa="list_directory_github",Oa="list_repositories",wa="glob_github",Ia="diff",bN0="bookkeeper",gN0="describe_workbook",mN0="execute_query",qq="skill",Ea="repl",uN0;var x4=$1(()=>{uN0=["Task","task_list","finder","get_diagnostics","Bash","oracle","painter","mermaid","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","bookkeeper","read_thread","find_thread","skill","read_github","search_github","commit_search","list_directory_github","list_repositories","glob_github","diff","describe_workbook","execute_query"]});var dy=g((Xr8,dN0)=>{var pN0={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:"/"},m$4={...pN0,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:"\\"},u$4={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"};dN0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:u$4,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?m$4:pN0}}});var cy=g((n$4)=>{var{REGEX_BACKSLASH:p$4,REGEX_REMOVE_BACKSLASH:d$4,REGEX_SPECIAL_CHARS:c$4,REGEX_SPECIAL_CHARS_GLOBAL:l$4}=dy();n$4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);n$4.hasRegexChars=(J)=>c$4.test(J);n$4.isRegexChar=(J)=>J.length===1&&n$4.hasRegexChars(J);n$4.escapeRegex=(J)=>J.replace(l$4,"\\$1");n$4.toPosixSlashes=(J)=>J.replace(p$4,"/");n$4.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};n$4.removeBackslashes=(J)=>{return J.replace(d$4,(Q)=>{return Q==="\\"?"":Q})};n$4.escapeLast=(J,Q,Y)=>{let Z=J.lastIndexOf(Q,Y);if(Z===-1)return J;if(J[Z-1]==="\\")return n$4.escapeLast(J,Q,Z-1);return`${J.slice(0,Z)}\\${J.slice(Z)}`};n$4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};n$4.wrapOutput=(J,Q={},Y={})=>{let Z=Y.contains?"":"^",X=Y.contains?"":"$",G=`${Z}(?:${J})${X}`;if(Q.negated===!0)G=`(?:^(?!${G}).*$)`;return G};n$4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),Z=Y[Y.length-1];if(Z==="")return Y[Y.length-2];return Z}});var eN0=g((Gr8,tN0)=>{var nN0=cy(),{CHAR_ASTERISK:Vq1,CHAR_AT:YG4,CHAR_BACKWARD_SLASH:ly,CHAR_COMMA:ZG4,CHAR_DOT:Kq1,CHAR_EXCLAMATION_MARK:qq1,CHAR_FORWARD_SLASH:sN0,CHAR_LEFT_CURLY_BRACE:Wq1,CHAR_LEFT_PARENTHESES:Hq1,CHAR_LEFT_SQUARE_BRACKET:XG4,CHAR_PLUS:$G4,CHAR_QUESTION_MARK:iN0,CHAR_RIGHT_CURLY_BRACE:GG4,CHAR_RIGHT_PARENTHESES:aN0,CHAR_RIGHT_SQUARE_BRACKET:VG4}=dy(),oN0=(J)=>{return J===sN0||J===ly},rN0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},KG4=(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,F=0,U=!1,B=!1,M=!1,L=!1,A=!1,w=!1,E=!1,P=!1,R=!1,C=!1,S=0,k,f,m={value:"",depth:0,isGlob:!1},b=()=>W>=Z,c=()=>q.charCodeAt(W+1),Z1=()=>{return k=f,q.charCodeAt(++W)};while(W<Z){f=Z1();let Y1;if(f===ly){if(E=m.backslashes=!0,f=Z1(),f===Wq1)w=!0;continue}if(w===!0||f===Wq1){S++;while(b()!==!0&&(f=Z1())){if(f===ly){E=m.backslashes=!0,Z1();continue}if(f===Wq1){S++;continue}if(w!==!0&&f===Kq1&&(f=Z1())===Kq1){if(U=m.isBrace=!0,M=m.isGlob=!0,C=!0,X===!0)continue;break}if(w!==!0&&f===ZG4){if(U=m.isBrace=!0,M=m.isGlob=!0,C=!0,X===!0)continue;break}if(f===GG4){if(S--,S===0){w=!1,U=m.isBrace=!0,C=!0;break}}}if(X===!0)continue;break}if(f===sN0){if(G.push(W),V.push(m),m={value:"",depth:0,isGlob:!1},C===!0)continue;if(k===Kq1&&W===H+1){H+=2;continue}F=W+1;continue}if(Y.noext!==!0){if((f===$G4||f===YG4||f===Vq1||f===iN0||f===qq1)===!0&&c()===Hq1){if(M=m.isGlob=!0,L=m.isExtglob=!0,C=!0,f===qq1&&W===H)R=!0;if(X===!0){while(b()!==!0&&(f=Z1())){if(f===ly){E=m.backslashes=!0,f=Z1();continue}if(f===aN0){M=m.isGlob=!0,C=!0;break}}continue}break}}if(f===Vq1){if(k===Vq1)A=m.isGlobstar=!0;if(M=m.isGlob=!0,C=!0,X===!0)continue;break}if(f===iN0){if(M=m.isGlob=!0,C=!0,X===!0)continue;break}if(f===XG4){while(b()!==!0&&(Y1=Z1())){if(Y1===ly){E=m.backslashes=!0,Z1();continue}if(Y1===VG4){B=m.isBracket=!0,M=m.isGlob=!0,C=!0;break}}if(X===!0)continue;break}if(Y.nonegate!==!0&&f===qq1&&W===H){P=m.negated=!0,H++;continue}if(Y.noparen!==!0&&f===Hq1){if(M=m.isGlob=!0,X===!0){while(b()!==!0&&(f=Z1())){if(f===Hq1){E=m.backslashes=!0,f=Z1();continue}if(f===aN0){C=!0;break}}continue}break}if(M===!0){if(C=!0,X===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let r=q,p="",s="";if(H>0)p=q.slice(0,H),q=q.slice(H),F-=H;if(r&&M===!0&&F>0)r=q.slice(0,F),s=q.slice(F);else if(M===!0)r="",s=q;else r=q;if(r&&r!==""&&r!=="/"&&r!==q){if(oN0(r.charCodeAt(r.length-1)))r=r.slice(0,-1)}if(Y.unescape===!0){if(s)s=nN0.removeBackslashes(s);if(r&&E===!0)r=nN0.removeBackslashes(r)}let Q1={prefix:p,input:J,start:H,base:r,glob:s,isBrace:U,isBracket:B,isGlob:M,isExtglob:L,isGlobstar:A,negated:P,negatedExtglob:R};if(Y.tokens===!0){if(Q1.maxDepth=0,!oN0(f))V.push(m);Q1.tokens=V}if(Y.parts===!0||Y.tokens===!0){let Y1;for(let n=0;n<G.length;n++){let o=Y1?Y1+1:H,i=G[n],q1=J.slice(o,i);if(Y.tokens){if(n===0&&H!==0)V[n].isPrefix=!0,V[n].value=p;else V[n].value=q1;rN0(V[n]),Q1.maxDepth+=V[n].depth}if(n!==0||q1!=="")K.push(q1);Y1=i}if(Y1&&Y1+1<J.length){let n=J.slice(Y1+1);if(K.push(n),Y.tokens)V[V.length-1].value=n,rN0(V[V.length-1]),Q1.maxDepth+=V[V.length-1].depth}Q1.slashes=G,Q1.parts=K}return Q1};tN0.exports=KG4});var YD0=g((Vr8,QD0)=>{var Pa=dy(),Wq=cy(),{MAX_LENGTH:Ra,POSIX_REGEX_SOURCE:qG4,REGEX_NON_SPECIAL_CHARS:WG4,REGEX_SPECIAL_CHARS_BACKREF:HG4,REPLACEMENTS:JD0}=Pa,FG4=(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)=>Wq.escapeRegex(X)).join("..")}return Y},$P=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},Fq1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=JD0[J]||J;let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Ra,Y.maxLength):Ra,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=Pa.globChars(Y.windows),W=Pa.extglobChars(q),{DOT_LITERAL:H,PLUS_LITERAL:F,SLASH_LITERAL:U,ONE_CHAR:B,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:w,QMARK:E,QMARK_NO_DOT:P,STAR:R,START_ANCHOR:C}=q,S=(f1)=>{return`(${K}(?:(?!${C}${f1.dot?M:H}).)*?)`},k=Y.dot?"":L,f=Y.dot?E:P,m=Y.bash===!0?S(Y):R;if(Y.capture)m=`(${m})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let b={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=Wq.removePrefix(J,b),X=J.length;let c=[],Z1=[],r=[],p=G,s,Q1=()=>b.index===X-1,Y1=b.peek=(f1=1)=>J[b.index+f1],n=b.advance=()=>J[++b.index]||"",o=()=>J.slice(b.index+1),i=(f1="",V1=0)=>{b.consumed+=f1,b.index+=V1},q1=(f1)=>{b.output+=f1.output!=null?f1.output:f1.value,i(f1.value)},T1=()=>{let f1=1;while(Y1()==="!"&&(Y1(2)!=="("||Y1(3)==="?"))n(),b.start++,f1++;if(f1%2===0)return!1;return b.negated=!0,b.start++,!0},J1=(f1)=>{b[f1]++,r.push(f1)},D1=(f1)=>{b[f1]--,r.pop()},L1=(f1)=>{if(p.type==="globstar"){let V1=b.braces>0&&(f1.type==="comma"||f1.type==="brace"),X1=f1.extglob===!0||c.length&&(f1.type==="pipe"||f1.type==="paren");if(f1.type!=="slash"&&f1.type!=="paren"&&!V1&&!X1)b.output=b.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=m,b.output+=p.output}if(c.length&&f1.type!=="paren")c[c.length-1].inner+=f1.value;if(f1.value||f1.output)q1(f1);if(p&&p.type==="text"&&f1.type==="text"){p.output=(p.output||p.value)+f1.value,p.value+=f1.value;return}f1.prev=p,V.push(f1),p=f1},t1=(f1,V1)=>{let X1={...W[V1],conditions:1,inner:""};X1.prev=p,X1.parens=b.parens,X1.output=b.output;let N1=(Y.capture?"(":"")+X1.open;J1("parens"),L1({type:f1,value:V1,output:b.output?"":B}),L1({type:"paren",extglob:!0,value:n(),output:N1}),c.push(X1)},R1=(f1)=>{let V1=f1.close+(Y.capture?")":""),X1;if(f1.type==="negate"){let N1=m;if(f1.inner&&f1.inner.length>1&&f1.inner.includes("/"))N1=S(Y);if(N1!==m||Q1()||/^\)+$/.test(o()))V1=f1.close=`)$))${N1}`;if(f1.inner.includes("*")&&(X1=o())&&/^\.[^\\/.]+$/.test(X1)){let F1=Fq1(X1,{...Q,fastpaths:!1}).output;V1=f1.close=`)${F1})${N1})`}if(f1.prev.type==="bos")b.negatedExtglob=!0}L1({type:"paren",extglob:!0,value:s,output:V1}),D1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let f1=!1,V1=J.replace(HG4,(X1,N1,F1,E1,w1,h1)=>{if(E1==="\\")return f1=!0,X1;if(E1==="?"){if(N1)return N1+E1+(w1?E.repeat(w1.length):"");if(h1===0)return f+(w1?E.repeat(w1.length):"");return E.repeat(F1.length)}if(E1===".")return H.repeat(F1.length);if(E1==="*"){if(N1)return N1+E1+(w1?m:"");return m}return N1?X1:`\\${X1}`});if(f1===!0)if(Y.unescape===!0)V1=V1.replace(/\\/g,"");else V1=V1.replace(/\\+/g,(X1)=>{return X1.length%2===0?"\\\\":X1?"\\":""});if(V1===J&&Y.contains===!0)return b.output=J,b;return b.output=Wq.wrapOutput(V1,b,Q),b}while(!Q1()){if(s=n(),s==="\x00")continue;if(s==="\\"){let X1=Y1();if(X1==="/"&&Y.bash!==!0)continue;if(X1==="."||X1===";")continue;if(!X1){s+="\\",L1({type:"text",value:s});continue}let N1=/^\\+/.exec(o()),F1=0;if(N1&&N1[0].length>2){if(F1=N1[0].length,b.index+=F1,F1%2!==0)s+="\\"}if(Y.unescape===!0)s=n();else s+=n();if(b.brackets===0){L1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||p.value==="["||p.value==="[^")){if(Y.posix!==!1&&s===":"){let X1=p.value.slice(1);if(X1.includes("[")){if(p.posix=!0,X1.includes(":")){let N1=p.value.lastIndexOf("["),F1=p.value.slice(0,N1),E1=p.value.slice(N1+2),w1=qG4[E1];if(w1){if(p.value=F1+w1,b.backtrack=!0,n(),!G.output&&V.indexOf(p)===1)G.output=B;continue}}}}if(s==="["&&Y1()!==":"||s==="-"&&Y1()==="]")s=`\\${s}`;if(s==="]"&&(p.value==="["||p.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&p.value==="[")s="^";p.value+=s,q1({value:s});continue}if(b.quotes===1&&s!=='"'){s=Wq.escapeRegex(s),p.value+=s,q1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)L1({type:"text",value:s});continue}if(s==="("){J1("parens"),L1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError($P("opening","("));let X1=c[c.length-1];if(X1&&b.parens===X1.parens+1){R1(c.pop());continue}L1({type:"paren",value:s,output:b.parens?")":"\\)"}),D1("parens");continue}if(s==="["){if(Y.nobracket===!0||!o().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError($P("closing","]"));s=`\\${s}`}else J1("brackets");L1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||p&&p.type==="bracket"&&p.value.length===1){L1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError($P("opening","["));L1({type:"text",value:s,output:`\\${s}`});continue}D1("brackets");let X1=p.value.slice(1);if(p.posix!==!0&&X1[0]==="^"&&!X1.includes("/"))s=`/${s}`;if(p.value+=s,q1({value:s}),Y.literalBrackets===!1||Wq.hasRegexChars(X1))continue;let N1=Wq.escapeRegex(p.value);if(b.output=b.output.slice(0,-p.value.length),Y.literalBrackets===!0){b.output+=N1,p.value=N1;continue}p.value=`(${K}${N1}|${p.value})`,b.output+=p.value;continue}if(s==="{"&&Y.nobrace!==!0){J1("braces");let X1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};Z1.push(X1),L1(X1);continue}if(s==="}"){let X1=Z1[Z1.length-1];if(Y.nobrace===!0||!X1){L1({type:"text",value:s,output:s});continue}let N1=")";if(X1.dots===!0){let F1=V.slice(),E1=[];for(let w1=F1.length-1;w1>=0;w1--){if(V.pop(),F1[w1].type==="brace")break;if(F1[w1].type!=="dots")E1.unshift(F1[w1].value)}N1=FG4(E1,Y),b.backtrack=!0}if(X1.comma!==!0&&X1.dots!==!0){let F1=b.output.slice(0,X1.outputIndex),E1=b.tokens.slice(X1.tokensIndex);X1.value=X1.output="\\{",s=N1="\\}",b.output=F1;for(let w1 of E1)b.output+=w1.output||w1.value}L1({type:"brace",value:s,output:N1}),D1("braces"),Z1.pop();continue}if(s==="|"){if(c.length>0)c[c.length-1].conditions++;L1({type:"text",value:s});continue}if(s===","){let X1=s,N1=Z1[Z1.length-1];if(N1&&r[r.length-1]==="braces")N1.comma=!0,X1="|";L1({type:"comma",value:s,output:X1});continue}if(s==="/"){if(p.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",V.pop(),p=G;continue}L1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&p.type==="dot"){if(p.value===".")p.output=H;let X1=Z1[Z1.length-1];p.type="dots",p.output+=s,p.value+=s,X1.dots=!0;continue}if(b.braces+b.parens===0&&p.type!=="bos"&&p.type!=="slash"){L1({type:"text",value:s,output:H});continue}L1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(p&&p.value==="(")&&Y.noextglob!==!0&&Y1()==="("&&Y1(2)!=="?"){t1("qmark",s);continue}if(p&&p.type==="paren"){let N1=Y1(),F1=s;if(p.value==="("&&!/[!=<:]/.test(N1)||N1==="<"&&!/<([!=]|\w+>)/.test(o()))F1=`\\${s}`;L1({type:"text",value:s,output:F1});continue}if(Y.dot!==!0&&(p.type==="slash"||p.type==="bos")){L1({type:"qmark",value:s,output:P});continue}L1({type:"qmark",value:s,output:E});continue}if(s==="!"){if(Y.noextglob!==!0&&Y1()==="("){if(Y1(2)!=="?"||!/[!=<:]/.test(Y1(3))){t1("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){T1();continue}}if(s==="+"){if(Y.noextglob!==!0&&Y1()==="("&&Y1(2)!=="?"){t1("plus",s);continue}if(p&&p.value==="("||Y.regex===!1){L1({type:"plus",value:s,output:F});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||b.parens>0){L1({type:"plus",value:s});continue}L1({type:"plus",value:F});continue}if(s==="@"){if(Y.noextglob!==!0&&Y1()==="("&&Y1(2)!=="?"){L1({type:"at",extglob:!0,value:s,output:""});continue}L1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let X1=WG4.exec(o());if(X1)s+=X1[0],b.index+=X1[0].length;L1({type:"text",value:s});continue}if(p&&(p.type==="globstar"||p.star===!0)){p.type="star",p.star=!0,p.value+=s,p.output=m,b.backtrack=!0,b.globstar=!0,i(s);continue}let f1=o();if(Y.noextglob!==!0&&/^\([^?]/.test(f1)){t1("star",s);continue}if(p.type==="star"){if(Y.noglobstar===!0){i(s);continue}let X1=p.prev,N1=X1.prev,F1=X1.type==="slash"||X1.type==="bos",E1=N1&&(N1.type==="star"||N1.type==="globstar");if(Y.bash===!0&&(!F1||f1[0]&&f1[0]!=="/")){L1({type:"star",value:s,output:""});continue}let w1=b.braces>0&&(X1.type==="comma"||X1.type==="brace"),h1=c.length&&(X1.type==="pipe"||X1.type==="paren");if(!F1&&X1.type!=="paren"&&!w1&&!h1){L1({type:"star",value:s,output:""});continue}while(f1.slice(0,3)==="/**"){let g1=J[b.index+4];if(g1&&g1!=="/")break;f1=f1.slice(3),i("/**",3)}if(X1.type==="bos"&&Q1()){p.type="globstar",p.value+=s,p.output=S(Y),b.output=p.output,b.globstar=!0,i(s);continue}if(X1.type==="slash"&&X1.prev.type!=="bos"&&!E1&&Q1()){b.output=b.output.slice(0,-(X1.output+p.output).length),X1.output=`(?:${X1.output}`,p.type="globstar",p.output=S(Y)+(Y.strictSlashes?")":"|$)"),p.value+=s,b.globstar=!0,b.output+=X1.output+p.output,i(s);continue}if(X1.type==="slash"&&X1.prev.type!=="bos"&&f1[0]==="/"){let g1=f1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(X1.output+p.output).length),X1.output=`(?:${X1.output}`,p.type="globstar",p.output=`${S(Y)}${U}|${U}${g1})`,p.value+=s,b.output+=X1.output+p.output,b.globstar=!0,i(s+n()),L1({type:"slash",value:"/",output:""});continue}if(X1.type==="bos"&&f1[0]==="/"){p.type="globstar",p.value+=s,p.output=`(?:^|${U}|${S(Y)}${U})`,b.output=p.output,b.globstar=!0,i(s+n()),L1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-p.output.length),p.type="globstar",p.output=S(Y),p.value+=s,b.output+=p.output,b.globstar=!0,i(s);continue}let V1={type:"star",value:s,output:m};if(Y.bash===!0){if(V1.output=".*?",p.type==="bos"||p.type==="slash")V1.output=k+V1.output;L1(V1);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&Y.regex===!0){V1.output=s,L1(V1);continue}if(b.index===b.start||p.type==="slash"||p.type==="dot"){if(p.type==="dot")b.output+=A,p.output+=A;else if(Y.dot===!0)b.output+=w,p.output+=w;else b.output+=k,p.output+=k;if(Y1()!=="*")b.output+=B,p.output+=B}L1(V1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError($P("closing","]"));b.output=Wq.escapeLast(b.output,"["),D1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError($P("closing",")"));b.output=Wq.escapeLast(b.output,"("),D1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError($P("closing","}"));b.output=Wq.escapeLast(b.output,"{"),D1("braces")}if(Y.strictSlashes!==!0&&(p.type==="star"||p.type==="bracket"))L1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let f1 of b.tokens)if(b.output+=f1.output!=null?f1.output:f1.value,f1.suffix)b.output+=f1.suffix}return b};Fq1.fastpaths=(J,Q)=>{let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Ra,Y.maxLength):Ra,X=J.length;if(X>Z)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Z}`);J=JD0[J]||J;let{DOT_LITERAL:G,SLASH_LITERAL:V,ONE_CHAR:K,DOTS_SLASH:q,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:F,STAR:U,START_ANCHOR:B}=Pa.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?F:W,A=Y.capture?"":"?:",w={negated:!1,prefix:""},E=Y.bash===!0?".*?":U;if(Y.capture)E=`(${E})`;let P=(k)=>{if(k.noglobstar===!0)return E;return`(${A}(?:(?!${B}${k.dot?q:G}).)*?)`},R=(k)=>{switch(k){case"*":return`${M}${K}${E}`;case".*":return`${G}${K}${E}`;case"*.*":return`${M}${E}${G}${K}${E}`;case"*/*":return`${M}${E}${V}${K}${L}${E}`;case"**":return M+P(Y);case"**/*":return`(?:${M}${P(Y)}${V})?${L}${K}${E}`;case"**/*.*":return`(?:${M}${P(Y)}${V})?${L}${E}${G}${K}${E}`;case"**/.*":return`(?:${M}${P(Y)}${V})?${G}${K}${E}`;default:{let f=/^(.*?)\.(\w+)$/.exec(k);if(!f)return;let m=R(f[1]);if(!m)return;return m+G+f[2]}}},C=Wq.removePrefix(J,w),S=R(C);if(S&&Y.strictSlashes!==!0)S+=`${V}?`;return S};QD0.exports=Fq1});var ny=g((Kr8,XD0)=>{var zG4=eN0(),zq1=YD0(),ZD0=cy(),UG4=dy(),BG4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),w3=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>w3(U,Q,Y));return(U)=>{for(let B of H){let M=B(U);if(M)return M}return!1}}let Z=BG4(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?w3.compileRe(J,Q):w3.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=w3(X.ignore,H,Y)}let W=(H,F=!1)=>{let{isMatch:U,match:B,output:M}=w3.test(H,V,Q,{glob:J,posix:G}),L={glob:J,state:K,regex:V,posix:G,input:H,output:M,match:B,isMatch:U};if(typeof X.onResult==="function")X.onResult(L);if(U===!1)return L.isMatch=!1,F?L:!1;if(q(H)){if(typeof X.onIgnore==="function")X.onIgnore(L);return L.isMatch=!1,F?L:!1}if(typeof X.onMatch==="function")X.onMatch(L);return F?L:!0};if(Y)W.state=K;return W};w3.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?ZD0.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=w3.matchBase(J,Q,Y,X);else K=Q.exec(q);return{isMatch:Boolean(K),match:K,output:q}};w3.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:w3.makeRe(Q,Y)).test(ZD0.basename(J))};w3.isMatch=(J,Q,Y)=>w3(Q,Y)(J);w3.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>w3.parse(Y,Q));return zq1(J,{...Q,fastpaths:!1})};w3.scan=(J,Q)=>zG4(J,Q);w3.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=w3.toRegex(K,Q);if(Z===!0)q.state=J;return q};w3.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=zq1.fastpaths(J,Q);if(!X.output)X=zq1(J,Q);return w3.compileRe(X,Q,Y,Z)};w3.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/$^/}};w3.constants=UG4;XD0.exports=w3});var _H=g((qr8,VD0)=>{var $D0=ny(),NG4=cy();function GD0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:NG4.isWindows()};return $D0(J,Q,Y)}Object.assign(GD0,$D0);VD0.exports=GD0});var GP;var Uq1=$1(()=>{GP={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.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.tab.autoAcceptChain",title:"Accept Suggestion Chain",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"},{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:"-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.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !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.guidanceFilesInContext":{type:"boolean",default:!0,markdownDescription:"Deliver AGENTS.md guidance files in message context instead of system prompt for improved cache efficiency.",scope:"window"},"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:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"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.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"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.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"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.courseCorrection.enabled":{type:"boolean",default:!1,description:"Enable course correction agent that monitors the thread and provides guidance when the model goes off track",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",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:","@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 MG4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function qD0(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=GP.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!MG4(Z))return null;return Z*1000}function WD0(J){let Q=J.settings["tools.stopTimeout"],Y=GP.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var KD0;var Ta=$1(()=>{Uq1();KD0=GP.contributes.configuration.properties});function r7(J){let Q=f8[J];return`${Q.provider}/${Q.name}`}function GQ(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);let Y=J.slice(0,Q),Z=J.slice(Q+1);for(let X of Object.values(f8))if(X.provider===Y&&X.name===Z)return X;switch(Y){case"anthropic":return f8.CLAUDE_SONNET_4_5;case"openai":return f8.GPT_5;case"xai":return f8.GROK_CODE_FAST_1;case"cerebras":return f8.Z_AI_GLM_4_6;case"fireworks":return f8.FIREWORKS_GLM_4P6;case"moonshotai":return f8.KIMI_K2_INSTRUCT;case"openrouter":return f8.SONOMA_SKY_ALPHA;case"groq":return f8.GPT_OSS_120B;case"vertexai":return f8.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Y}`)}}function G2(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function pZ(J,Q){let Y=GQ(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}var Z9,f8,Bq1;var lQ=$1(()=>{Z9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},f8={CLAUDE_SONNET_4:{provider:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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},maxInputTokensInFreeMode:120000},GPT_5:{provider:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.VERTEXAI,name:"gemini-3-flash-preview",displayName:"Gemini 3 Flash Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:Z9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:Z9.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:Z9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:Z9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:Z9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:Z9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:Z9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:Z9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:Z9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:Z9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:Z9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};Bq1={FINDER:"finder"}});function Nq1(J,Q){let Y=XV(Q);if(!Y)return!1;if(LG4.has(J)){let Z=Y.finder??Bq1.FINDER,X=AG4[Z];if(J!==X)return!1}if(Y.includeTools){if(Y.deferredTools?.includes(J))return!0;return Y.includeTools.includes(J)}return!0}function Dq1(J,Q){let Y=XV(Q);if(!Y)return!1;return Y.deferredTools?.includes(J)??!1}function L$(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(VP).filter((Z)=>{if(Y.includes(`!${Z.key}`))return!1;if(Q===!1&&O9(Z.key))return!1;let G="visible"in Z?Z.visible:!1,V=Y.includes(Z.key),K=J?.["experimental.dojoMode"]===!0;if(Z.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(Z.key==="dojo")return K&&(Q===!1||Q===void 0);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 XV(J){return Object.values(VP).find((Q)=>Q.key===J)}function IL(J){return XV(J)?.primaryModel??r7("CLAUDE_SONNET_4_5")}function iy(J){let Q=XV(J);if(!Q)return!1;return GQ(Q.primaryModel).capabilities?.vision??!1}function O9(J){return J==="free"||J.startsWith("free-")}function Mq1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function Lq1(J,Q){let Z=(Q.findIndex((G)=>G.mode===J)+1)%Q.length;return Q[Z]?.mode??"smart"}var LG4,AG4,UD0,BD0,OG4,wG4,HD0,FD0,zD0,VP,IG4;var A$=$1(()=>{lQ();LG4=new Set(["finder"]),AG4={finder:"finder"},UD0={r:0,g:55,b:0},BD0={r:0,g:255,b:136},OG4=["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"],wG4=["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","kraken","look_at"],HD0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],FD0=["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"],zD0=["painter","bookkeeper","code_review"],VP={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:r7("CLAUDE_OPUS_4_5"),includeTools:FD0,deferredTools:zD0,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:r7("CLAUDE_HAIKU_4_5"),includeTools:OG4,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:r7("CLAUDE_HAIKU_4_5"),includeTools:wG4,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:r7("CLAUDE_SONNET_4_5"),includeTools:FD0,deferredTools:zD0,visible:!1,uiHints:{labelAnimation:"glow",primaryColor:{r:42,g:26,b:77},secondaryColor:{r:153,g:102,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:r7("CLAUDE_HAIKU_4_5"),includeTools:HD0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:r7("CLAUDE_SONNET_4_5"),includeTools:HD0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},IG4=Object.values(VP).map((J)=>J.key)});function Ca(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 EG4,PG4,Aq1,RG4,TG4,CG4,jG4,SG4,_G4,D7,Dr8;var $V=$1(()=>{lQ();EG4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],PG4=["Grep","glob","Read"],Aq1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],RG4=["Read","Grep","glob","Bash","edit_file","create_file","format_file","get_diagnostics","web_search","read_web_page","finder"],TG4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],CG4=["Read","glob","Grep","enqueue_file_edit","fastmod"],jG4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],SG4=["describe_workbook","execute_query"],_G4=["Read","Grep","glob","web_search","read_web_page","Bash"],D7={finder:{key:"finder",displayName:"Finder",model:r7("CLAUDE_HAIKU_4_5"),includeTools:PG4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:r7("GPT_5_2"),includeTools:Aq1,allowMcp:!1,allowToolbox:!1},painter:{key:"painter",displayName:"Painter",model:r7("GEMINI_3_PRO_PREVIEW"),includeTools:RG4,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:r7("CLAUDE_HAIKU_4_5"),includeTools:EG4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:TG4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:r7("CLAUDE_HAIKU_4_5"),includeTools:CG4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:r7("CLAUDE_HAIKU_4_5"),includeTools:jG4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:r7("CLAUDE_HAIKU_4_5"),includeTools:SG4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:r7("CLAUDE_SONNET_4_5"),includeTools:_G4,allowMcp:!1,allowToolbox:!1}},Dr8=Object.keys(D7)});function ND0(J,Q){return new Y0((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 DD0=$1(()=>{s0()});var kG4="builtin://skills",yG4=`# Bookkeeper Skill
|
|
47
|
+
`}}ez0.PrometheusSerializer=tz0});var ZU0=g((QU0)=>{Object.defineProperty(QU0,"__esModule",{value:!0});QU0.PrometheusExporter=void 0;var Iy=i6(),TY4=H8(),GK1=mM(),CY4=v1("http"),jY4=$K1(),SY4=v1("url");class PH extends GK1.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:GK1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(X)=>GK1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||PH.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||PH.DEFAULT_OPTIONS.port,this._prefix=J.prefix||PH.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:PH.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||PH.DEFAULT_OPTIONS.withResourceConstantLabels,Z=J.withoutTargetInfo||PH.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,CY4.createServer)(this._requestHandler).unref(),this._serializer=new jY4.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,Z),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||PH.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(X)=>{Iy.diag.error(X),Q(X)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return Iy.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)Iy.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,TY4.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},()=>{Iy.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 SY4.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)Iy.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()}}QU0.PrometheusExporter=PH});var XU0=g((bi)=>{Object.defineProperty(bi,"__esModule",{value:!0});bi.PrometheusSerializer=bi.PrometheusExporter=void 0;var _Y4=ZU0();Object.defineProperty(bi,"PrometheusExporter",{enumerable:!0,get:function(){return _Y4.PrometheusExporter}});var kY4=$K1();Object.defineProperty(bi,"PrometheusSerializer",{enumerable:!0,get:function(){return kY4.PrometheusSerializer}})});var qU0=g((VU0)=>{Object.defineProperty(VU0,"__esModule",{value:!0});VU0.OTLPTraceExporter=void 0;var xY4=uK(),vY4=iG(),$U0=BH();class GU0 extends xY4.OTLPExporterBase{constructor(J={}){super((0,$U0.createOtlpHttpExportDelegate)((0,$U0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),vY4.ProtobufTraceSerializer))}}VU0.OTLPTraceExporter=GU0});var WU0=g((VK1)=>{Object.defineProperty(VK1,"__esModule",{value:!0});VK1.OTLPTraceExporter=void 0;var hY4=qU0();Object.defineProperty(VK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return hY4.OTLPTraceExporter}})});var HU0=g((KK1)=>{Object.defineProperty(KK1,"__esModule",{value:!0});KK1.OTLPTraceExporter=void 0;var bY4=WU0();Object.defineProperty(KK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return bY4.OTLPTraceExporter}})});var FU0=g((qK1)=>{Object.defineProperty(qK1,"__esModule",{value:!0});qK1.OTLPTraceExporter=void 0;var mY4=HU0();Object.defineProperty(qK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return mY4.OTLPTraceExporter}})});var DU0=g((BU0)=>{Object.defineProperty(BU0,"__esModule",{value:!0});BU0.OTLPTraceExporter=void 0;var pY4=uK(),dY4=iG(),zU0=BH();class UU0 extends pY4.OTLPExporterBase{constructor(J={}){super((0,zU0.createOtlpHttpExportDelegate)((0,zU0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),dY4.JsonTraceSerializer))}}BU0.OTLPTraceExporter=UU0});var MU0=g((WK1)=>{Object.defineProperty(WK1,"__esModule",{value:!0});WK1.OTLPTraceExporter=void 0;var cY4=DU0();Object.defineProperty(WK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return cY4.OTLPTraceExporter}})});var LU0=g((HK1)=>{Object.defineProperty(HK1,"__esModule",{value:!0});HK1.OTLPTraceExporter=void 0;var nY4=MU0();Object.defineProperty(HK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return nY4.OTLPTraceExporter}})});var AU0=g((FK1)=>{Object.defineProperty(FK1,"__esModule",{value:!0});FK1.OTLPTraceExporter=void 0;var aY4=LU0();Object.defineProperty(FK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return aY4.OTLPTraceExporter}})});var PU0=g((IU0)=>{Object.defineProperty(IU0,"__esModule",{value:!0});IU0.OTLPTraceExporter=void 0;var OU0=ki(),rY4=iG(),sY4=uK();class wU0 extends sY4.OTLPExporterBase{constructor(J={}){super((0,OU0.createOtlpGrpcExportDelegate)((0,OU0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),rY4.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}IU0.OTLPTraceExporter=wU0});var RU0=g((zK1)=>{Object.defineProperty(zK1,"__esModule",{value:!0});zK1.OTLPTraceExporter=void 0;var tY4=PU0();Object.defineProperty(zK1,"OTLPTraceExporter",{enumerable:!0,get:function(){return tY4.OTLPTraceExporter}})});var jU0=g((TU0)=>{Object.defineProperty(TU0,"__esModule",{value:!0});TU0.prepareSend=void 0;var UK1=i6(),gi=H8(),JZ4=v1("http"),QZ4=v1("https");function YZ4(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 UK1.diag.debug("Zipkin send with empty spans"),V({code:gi.ExportResultCode.SUCCESS});let{request:K}=Y.protocol==="http:"?JZ4:QZ4,q=K(Y,Z,(H)=>{let F="";H.on("data",(U)=>{F+=U}),H.on("end",()=>{let U=H.statusCode||0;if(UK1.diag.debug(`Zipkin response status code: ${U}, body: ${F}`),U<400)return V({code:gi.ExportResultCode.SUCCESS});else return V({code:gi.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${U}`)})})});q.on("error",(H)=>{return V({code:gi.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(G);UK1.diag.debug(`Zipkin request payload: ${W}`),q.write(W,"utf8"),q.end()}}TU0.prepareSend=YZ4});var SU0=g((BK1)=>{Object.defineProperty(BK1,"__esModule",{value:!0});BK1.prepareSend=void 0;var ZZ4=jU0();Object.defineProperty(BK1,"prepareSend",{enumerable:!0,get:function(){return ZZ4.prepareSend}})});var DK1=g((NK1)=>{Object.defineProperty(NK1,"__esModule",{value:!0});NK1.prepareSend=void 0;var $Z4=SU0();Object.defineProperty(NK1,"prepareSend",{enumerable:!0,get:function(){return $Z4.prepareSend}})});var kU0=g((_U0)=>{Object.defineProperty(_U0,"__esModule",{value:!0});_U0.SpanKind=void 0;var VZ4;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(VZ4=_U0.SpanKind||(_U0.SpanKind={}))});var fU0=g((vU0)=>{Object.defineProperty(vU0,"__esModule",{value:!0});vU0._toZipkinAnnotations=vU0._toZipkinTags=vU0.toZipkinSpan=vU0.defaultStatusErrorTagName=vU0.defaultStatusCodeTagName=void 0;var LU=i6(),LK1=H8(),mi=kU0(),KZ4={[LU.SpanKind.CLIENT]:mi.SpanKind.CLIENT,[LU.SpanKind.SERVER]:mi.SpanKind.SERVER,[LU.SpanKind.CONSUMER]:mi.SpanKind.CONSUMER,[LU.SpanKind.PRODUCER]:mi.SpanKind.PRODUCER,[LU.SpanKind.INTERNAL]:void 0};vU0.defaultStatusCodeTagName="otel.status_code";vU0.defaultStatusErrorTagName="error";function qZ4(J,Q,Y,Z){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:KZ4[J.kind],timestamp:(0,LK1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,LK1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:yU0(J,Y,Z),annotations:J.events.length?xU0(J.events):void 0}}vU0.toZipkinSpan=qZ4;function yU0({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!==LU.SpanStatusCode.UNSET)q[V]=String(LU.SpanStatusCode[Y.code]);if(Y.code===LU.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}vU0._toZipkinTags=yU0;function xU0(J){return J.map((Q)=>({timestamp:Math.round((0,LK1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}vU0._toZipkinAnnotations=xU0});var mU0=g((bU0)=>{Object.defineProperty(bU0,"__esModule",{value:!0});bU0.prepareGetHeaders=void 0;function UZ4(J){return function(){return J()}}bU0.prepareGetHeaders=UZ4});var iU0=g((lU0)=>{Object.defineProperty(lU0,"__esModule",{value:!0});lU0.ZipkinExporter=void 0;var uU0=i6(),pU0=H8(),dU0=DK1(),AK1=fU0(),OK1=tz(),BZ4=mU0();class cU0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,pU0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,dU0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||AK1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||AK1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,BZ4.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[OK1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(uU0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:pU0.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 uU0.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,dU0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let Z=J.map((X)=>(0,AK1.toZipkinSpan)(X,String(X.attributes[OK1.ATTR_SERVICE_NAME]||X.resource.attributes[OK1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(Z,(X)=>{if(Y)return Y(X)})}}lU0.ZipkinExporter=cU0});var aU0=g((ui)=>{Object.defineProperty(ui,"__esModule",{value:!0});ui.ZipkinExporter=ui.prepareSend=void 0;var NZ4=DK1();Object.defineProperty(ui,"prepareSend",{enumerable:!0,get:function(){return NZ4.prepareSend}});var DZ4=iU0();Object.defineProperty(ui,"ZipkinExporter",{enumerable:!0,get:function(){return DZ4.ZipkinExporter}})});var wK1=g((oU0)=>{Object.defineProperty(oU0,"__esModule",{value:!0});oU0.B3_DEBUG_FLAG_KEY=void 0;var LZ4=i6();oU0.B3_DEBUG_FLAG_KEY=(0,LZ4.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Ey=g((sU0)=>{Object.defineProperty(sU0,"__esModule",{value:!0});sU0.X_B3_FLAGS=sU0.X_B3_PARENT_SPAN_ID=sU0.X_B3_SAMPLED=sU0.X_B3_SPAN_ID=sU0.X_B3_TRACE_ID=sU0.B3_CONTEXT_HEADER=void 0;sU0.B3_CONTEXT_HEADER="b3";sU0.X_B3_TRACE_ID="x-b3-traceid";sU0.X_B3_SPAN_ID="x-b3-spanid";sU0.X_B3_SAMPLED="x-b3-sampled";sU0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";sU0.X_B3_FLAGS="x-b3-flags"});var XB0=g((YB0)=>{Object.defineProperty(YB0,"__esModule",{value:!0});YB0.B3MultiPropagator=void 0;var JV=i6(),PZ4=H8(),eU0=wK1(),vZ=Ey(),RZ4=new Set([!0,"true","True","1",1]),TZ4=new Set([!1,"false","False","0",0]);function CZ4(J){return J===JV.TraceFlags.SAMPLED||J===JV.TraceFlags.NONE}function jZ4(J){return Array.isArray(J)?J[0]:J}function pi(J,Q,Y){let Z=Q.get(J,Y);return jZ4(Z)}function SZ4(J,Q){let Y=pi(J,Q,vZ.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function _Z4(J,Q){let Y=pi(J,Q,vZ.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function JB0(J,Q){return pi(J,Q,vZ.X_B3_FLAGS)==="1"?"1":void 0}function kZ4(J,Q){let Y=pi(J,Q,vZ.X_B3_SAMPLED);if(JB0(J,Q)==="1"||RZ4.has(Y))return JV.TraceFlags.SAMPLED;if(Y===void 0||TZ4.has(Y))return JV.TraceFlags.NONE;return}class QB0{inject(J,Q,Y){let Z=JV.trace.getSpanContext(J);if(!Z||!(0,JV.isSpanContextValid)(Z)||(0,PZ4.isTracingSuppressed)(J))return;let X=J.getValue(eU0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,vZ.X_B3_TRACE_ID,Z.traceId),Y.set(Q,vZ.X_B3_SPAN_ID,Z.spanId),X==="1")Y.set(Q,vZ.X_B3_FLAGS,X);else if(Z.traceFlags!==void 0)Y.set(Q,vZ.X_B3_SAMPLED,(JV.TraceFlags.SAMPLED&Z.traceFlags)===JV.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let Z=SZ4(Q,Y),X=_Z4(Q,Y),G=kZ4(Q,Y),V=JB0(Q,Y);if((0,JV.isValidTraceId)(Z)&&(0,JV.isValidSpanId)(X)&&CZ4(G))return J=J.setValue(eU0.B3_DEBUG_FLAG_KEY,V),JV.trace.setSpanContext(J,{traceId:Z,spanId:X,isRemote:!0,traceFlags:G});return J}fields(){return[vZ.X_B3_TRACE_ID,vZ.X_B3_SPAN_ID,vZ.X_B3_FLAGS,vZ.X_B3_SAMPLED,vZ.X_B3_PARENT_SPAN_ID]}}YB0.B3MultiPropagator=QB0});var qB0=g((VB0)=>{Object.defineProperty(VB0,"__esModule",{value:!0});VB0.B3SinglePropagator=void 0;var KL=i6(),yZ4=H8(),$B0=wK1(),IK1=Ey(),xZ4=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,vZ4="0".repeat(16),hZ4=new Set(["d","1"]),fZ4="d";function bZ4(J){return J.length===32?J:`${vZ4}${J}`}function gZ4(J){if(J&&hZ4.has(J))return KL.TraceFlags.SAMPLED;return KL.TraceFlags.NONE}class GB0{inject(J,Q,Y){let Z=KL.trace.getSpanContext(J);if(!Z||!(0,KL.isSpanContextValid)(Z)||(0,yZ4.isTracingSuppressed)(J))return;let X=J.getValue($B0.B3_DEBUG_FLAG_KEY)||Z.traceFlags&1,G=`${Z.traceId}-${Z.spanId}-${X}`;Y.set(Q,IK1.B3_CONTEXT_HEADER,G)}extract(J,Q,Y){let Z=Y.get(Q,IK1.B3_CONTEXT_HEADER),X=Array.isArray(Z)?Z[0]:Z;if(typeof X!=="string")return J;let G=X.match(xZ4);if(!G)return J;let[,V,K,q]=G,W=bZ4(V);if(!(0,KL.isValidTraceId)(W)||!(0,KL.isValidSpanId)(K))return J;let H=gZ4(q);if(q===fZ4)J=J.setValue($B0.B3_DEBUG_FLAG_KEY,q);return KL.trace.setSpanContext(J,{traceId:W,spanId:K,isRemote:!0,traceFlags:H})}fields(){return[IK1.B3_CONTEXT_HEADER]}}VB0.B3SinglePropagator=GB0});var PK1=g((WB0)=>{Object.defineProperty(WB0,"__esModule",{value:!0});WB0.B3InjectEncoding=void 0;var mZ4;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(mZ4=WB0.B3InjectEncoding||(WB0.B3InjectEncoding={}))});var UB0=g((FB0)=>{Object.defineProperty(FB0,"__esModule",{value:!0});FB0.B3Propagator=void 0;var uZ4=H8(),pZ4=XB0(),dZ4=qB0(),cZ4=Ey(),lZ4=PK1();class HB0{_b3MultiPropagator=new pZ4.B3MultiPropagator;_b3SinglePropagator=new dZ4.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===lZ4.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,uZ4.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let Z=Y.get(Q,cZ4.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}}FB0.B3Propagator=HB0});var BB0=g((Yq)=>{Object.defineProperty(Yq,"__esModule",{value:!0});Yq.B3InjectEncoding=Yq.X_B3_TRACE_ID=Yq.X_B3_SPAN_ID=Yq.X_B3_SAMPLED=Yq.X_B3_PARENT_SPAN_ID=Yq.X_B3_FLAGS=Yq.B3_CONTEXT_HEADER=Yq.B3Propagator=void 0;var nZ4=UB0();Object.defineProperty(Yq,"B3Propagator",{enumerable:!0,get:function(){return nZ4.B3Propagator}});var lE=Ey();Object.defineProperty(Yq,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return lE.B3_CONTEXT_HEADER}});Object.defineProperty(Yq,"X_B3_FLAGS",{enumerable:!0,get:function(){return lE.X_B3_FLAGS}});Object.defineProperty(Yq,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return lE.X_B3_PARENT_SPAN_ID}});Object.defineProperty(Yq,"X_B3_SAMPLED",{enumerable:!0,get:function(){return lE.X_B3_SAMPLED}});Object.defineProperty(Yq,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return lE.X_B3_SPAN_ID}});Object.defineProperty(Yq,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return lE.X_B3_TRACE_ID}});var iZ4=PK1();Object.defineProperty(Yq,"B3InjectEncoding",{enumerable:!0,get:function(){return iZ4.B3InjectEncoding}})});var AB0=g((DB0)=>{Object.defineProperty(DB0,"__esModule",{value:!0});DB0.JaegerPropagator=DB0.UBER_BAGGAGE_HEADER_PREFIX=DB0.UBER_TRACE_ID_HEADER=void 0;var qL=i6(),oZ4=H8();DB0.UBER_TRACE_ID_HEADER="uber-trace-id";DB0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class NB0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=DB0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||DB0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||DB0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let Z=qL.trace.getSpanContext(J),X=qL.propagation.getBaggage(J);if(Z&&(0,oZ4.isTracingSuppressed)(J)===!1){let G=`0${(Z.traceFlags||qL.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=sZ4(X);if(q)V=qL.trace.setSpanContext(V,q)}if(G.length===0)return V;let K=qL.propagation.getBaggage(J)??qL.propagation.createBaggage();for(let q of G){if(q.value===void 0)continue;K=K.setEntry(q.key,{value:decodeURIComponent(q.value)})}return V=qL.propagation.setBaggage(V,K),V}fields(){return[this._jaegerTraceHeader]}}DB0.JaegerPropagator=NB0;var rZ4=/^[0-9a-f]{1,2}$/i;function sZ4(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=rZ4.test(X)?parseInt(X,16)&1:1;return{traceId:G,spanId:V,isRemote:!0,traceFlags:K}}});var OB0=g((Py)=>{Object.defineProperty(Py,"__esModule",{value:!0});Py.UBER_TRACE_ID_HEADER=Py.UBER_BAGGAGE_HEADER_PREFIX=Py.JaegerPropagator=void 0;var TK1=AB0();Object.defineProperty(Py,"JaegerPropagator",{enumerable:!0,get:function(){return TK1.JaegerPropagator}});Object.defineProperty(Py,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return TK1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(Py,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return TK1.UBER_TRACE_ID_HEADER}})});var TB0=g((PB0)=>{Object.defineProperty(PB0,"__esModule",{value:!0});PB0.setupPropagator=PB0.setupContextManager=PB0.getPropagatorFromEnv=PB0.getSpanProcessorsFromEnv=PB0.getOtlpProtocolFromEnv=PB0.filterBlanksAndNulls=PB0.getResourceDetectorsFromEnv=void 0;var N$=i6(),QV=H8(),wB0=FU0(),eZ4=AU0(),JX4=RU0(),QX4=aU0(),Ry=hM(),di=cM(),CK1=BB0(),YX4=OB0(),ZX4=ec(),XX4="env",$X4="host",GX4="os",VX4="process",KX4="serviceinstance";function qX4(){let J=new Map([[XX4,Ry.envDetector],[$X4,Ry.hostDetector],[GX4,Ry.osDetector],[KX4,Ry.serviceInstanceIdDetector],[VX4,Ry.processDetector]]),Q=(0,QV.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)N$.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return Z||[]})}PB0.getResourceDetectorsFromEnv=qX4;function IB0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}PB0.filterBlanksAndNulls=IB0;function EB0(){return(0,QV.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,QV.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}PB0.getOtlpProtocolFromEnv=EB0;function WX4(){let J=EB0();switch(J){case"grpc":return new JX4.OTLPTraceExporter;case"http/json":return new eZ4.OTLPTraceExporter;case"http/protobuf":return new wB0.OTLPTraceExporter;default:return N$.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new wB0.OTLPTraceExporter}}function HX4(){let J=new Map([["otlp",()=>WX4()],["zipkin",()=>new QX4.ZipkinExporter],["console",()=>new di.ConsoleSpanExporter]]),Q=[],Y=[],Z=IB0(Array.from(new Set((0,QV.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(Z[0]==="none")return N$.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(Z.length===0)N$.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),Z=["otlp"];else if(Z.length>1&&Z.includes("none"))N$.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 N$.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${X}.`)}for(let X of Q)if(X instanceof di.ConsoleSpanExporter)Y.push(new di.SimpleSpanProcessor(X));else Y.push(new di.BatchSpanProcessor(X));if(Q.length===0)N$.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}PB0.getSpanProcessorsFromEnv=HX4;function FX4(){let J=(0,QV.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new QV.W3CTraceContextPropagator],["baggage",()=>new QV.W3CBaggagePropagator],["b3",()=>new CK1.B3Propagator],["b3multi",()=>new CK1.B3Propagator({injectEncoding:CK1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new YX4.JaegerPropagator]]),Y=Array.from(new Set(J)),X=Y.map((G)=>{let V=Q.get(G)?.();if(!V){N$.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 QV.CompositePropagator({propagators:X})}PB0.getPropagatorFromEnv=FX4;function zX4(J){if(J===null)return;if(J===void 0){let Q=new ZX4.AsyncLocalStorageContextManager;Q.enable(),N$.context.setGlobalContextManager(Q);return}J.enable(),N$.context.setGlobalContextManager(J)}PB0.setupContextManager=zX4;function UX4(J){if(J===null)return;if(J===void 0){N$.propagation.setGlobalPropagator(new QV.CompositePropagator({propagators:[new QV.W3CTraceContextPropagator,new QV.W3CBaggagePropagator]}));return}N$.propagation.setGlobalPropagator(J)}PB0.setupPropagator=UX4});var yB0=g((_B0)=>{Object.defineProperty(_B0,"__esModule",{value:!0});_B0.NodeSDK=void 0;var YQ=i6(),OX4=Jk(),wX4=TZ1(),nE=hM(),Ty=pX1(),IX4=_$0(),EX4=Bz0(),jK1=Iz0(),PX4=uz0(),CB0=oz0(),RX4=vi(),TX4=XU0(),WL=mM(),CX4=cM(),jX4=J$1(),SX4=tz(),AU=H8(),Cy=TB0();function jB0(J,Q){return parseInt(process.env[J]||"")||Q}function _X4(){let J=[],Q=(0,AU.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)YQ.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return YQ.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=jB0("OTEL_METRIC_EXPORT_INTERVAL",60000),G=jB0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(Z){case"grpc":J.push(new WL.PeriodicExportingMetricReader({exporter:new PX4.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/json":J.push(new WL.PeriodicExportingMetricReader({exporter:new RX4.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;case"http/protobuf":J.push(new WL.PeriodicExportingMetricReader({exporter:new CB0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}));break;default:YQ.diag.warn(`Unsupported OTLP metrics protocol: "${Z}". Using http/protobuf.`),J.push(new WL.PeriodicExportingMetricReader({exporter:new CB0.OTLPMetricExporter,exportIntervalMillis:X,exportTimeoutMillis:G}))}}else if(Y==="console")J.push(new WL.PeriodicExportingMetricReader({exporter:new WL.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new TX4.PrometheusExporter);else YQ.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class SB0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,AU.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,AU.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)YQ.diag.setLogger(new YQ.DiagConsoleLogger,{logLevel:(0,AU.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,nE.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,AU.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,Cy.getResourceDetectorsFromEnv)();else this._resourceDetectors=[nE.envDetector,nE.processDetector,nE.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)YQ.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let Z=J.spanProcessor??new CX4.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]},YQ.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],YQ.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,wX4.registerInstrumentations)({instrumentations:this._instrumentations}),(0,Cy.setupContextManager)(this._configuration?.contextManager),(0,Cy.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,Cy.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,nE.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,nE.resourceFromAttributes)({[SX4.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,Cy.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new jX4.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),YQ.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new Ty.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,OX4.logs.setGlobalLoggerProvider(Y)}let Q=_X4();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 WL.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=Z,YQ.metrics.setGlobalMeterProvider(Z);for(let X of this._instrumentations)X.setMeterProvider(YQ.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,AU.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)YQ.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){YQ.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,AU.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,AU.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(Z){case"grpc":Q.push(new EX4.OTLPLogExporter);break;case"http/json":Q.push(new IX4.OTLPLogExporter);break;case"http/protobuf":Q.push(new jK1.OTLPLogExporter);break;case void 0:case"":Q.push(new jK1.OTLPLogExporter);break;default:YQ.diag.warn(`Unsupported OTLP logs protocol: "${Z}". Using http/protobuf.`),Q.push(new jK1.OTLPLogExporter)}}else if(Y==="console")Q.push(new Ty.ConsoleLogRecordExporter);else YQ.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 Ty.ConsoleLogRecordExporter)return new Ty.SimpleLogRecordProcessor(Y);else return new Ty.BatchLogRecordProcessor(Y)})}}}_B0.NodeSDK=SB0});var xB0=g((SK1)=>{Object.defineProperty(SK1,"__esModule",{value:!0});SK1.NodeSDK=SK1.tracing=SK1.resources=SK1.node=SK1.metrics=SK1.logs=SK1.core=SK1.contextBase=SK1.api=void 0;SK1.api=i6();SK1.contextBase=i6();SK1.core=H8();SK1.logs=pX1();SK1.metrics=mM();SK1.node=J$1();SK1.resources=hM();SK1.tracing=cM();var kX4=yB0();Object.defineProperty(SK1,"NodeSDK",{enumerable:!0,get:function(){return kX4.NodeSDK}})});import pX4 from"os";import ci from"path";var OU,HL,wU,IU,vB0,da8,ca8,dX4,cX4;var iE=$1(()=>{OU=pX4.homedir(),{env:HL}=process,wU=HL.XDG_DATA_HOME||(OU?ci.join(OU,".local","share"):void 0),IU=HL.XDG_CONFIG_HOME||(OU?ci.join(OU,".config"):void 0),vB0=HL.XDG_STATE_HOME||(OU?ci.join(OU,".local","state"):void 0),da8=HL.XDG_CACHE_HOME||(OU?ci.join(OU,".cache"):void 0),ca8=HL.XDG_RUNTIME_DIR||void 0,dX4=(HL.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(wU)dX4.unshift(wU);cX4=(HL.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(IU)cX4.unshift(IU)});import{homedir as li}from"node:os";import FL from"node:path";var hB0,lX4,fB0,nX4,ni,iX4,aE,Zq,oa8;var RH=$1(()=>{iE();hB0=FL.join(li(),".local/share"),lX4=process.platform==="win32"||process.platform==="darwin"?hB0:wU??hB0,fB0=FL.join(li(),".config"),nX4=process.platform==="win32"||process.platform==="darwin"?fB0:IU??fB0,ni=FL.join(lX4,"amp"),iX4=FL.join(nX4,"amp"),aE=FL.join(iX4,"tools"),Zq=FL.join(li(),".cache","amp"),oa8=FL.join(li(),".cache","amp","http-debug-logs")});function oX4(){return aX4}function bB0(J){let Q=zL;return zL=J,Q}class Xq{baseLogger;scope;context={};constructor(J=gB0){this.baseLogger=J}with(J){let Q=new Xq(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new Xq(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=_K1.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 _K1,aX4=!1,rX4,zL,gB0,v;var N0=$1(()=>{_K1=Q6(i6(),1);rX4={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(oX4())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=_K1.trace.getActiveSpan();if(Z){let X=Z.spanContext();if(X.traceId)Y.traceId=X.traceId,Y.spanId=X.spanId}console.info(J,Y)}},zL=rX4;gB0={error:(J,...Q)=>zL.error(J,...Q),warn:(J,...Q)=>zL.warn(J,...Q),info:(J,...Q)=>zL.info(J,...Q),debug:(J,...Q)=>zL.debug(J,...Q),audit:(J,...Q)=>zL.audit(J,...Q)};v=gB0});function nB0(){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 iB0(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&&!X$4.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!$$4.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(G$4.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 V$4(J,Q){if(!J&&!Q)return"file";return J}function K$4(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=YV;else if(Q[0]!==YV)Q=YV+Q;break}return Q}class u0{static isUri(J){if(J instanceof u0)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||v5,this.authority=J.authority||v5,this.path=J.path||v5,this.query=J.query||v5,this.fragment=J.fragment||v5,this.platform=J.platform;else this.scheme=V$4(J,G),this.authority=Q||v5,this.path=K$4(this.scheme,Y||v5),this.query=Z||v5,this.fragment=X||v5,this.platform=V,iB0(this,G)}get fsPath(){return tB0(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=v5;if(Y===void 0)Y=this.authority;else if(Y===null)Y=v5;if(Z===void 0)Z=this.path;else if(Z===null)Z=v5;if(X===void 0)X=this.query;else if(X===null)X=v5;if(G===void 0)G=this.fragment;else if(G===null)G=v5;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 UL(Q,Y,Z,X,G,!1,V)}static parse(J,Q=!1){let Y=q$4.exec(J);if(!Y)return new UL(v5,v5,v5,v5,v5);return new UL(Y[2]||v5,ai(Y[4]||v5),ai(Y[5]||v5),ai(Y[7]||v5),ai(Y[9]||v5),Q)}static file(J,Q=nB0()){let Y=v5;if(Q==="windows")J=J.replace(/\\/g,YV);if(J[0]===YV&&J[1]===YV){let Z=J.indexOf(YV,2);if(Z===-1)Y=J.substring(2),J=YV;else Y=J.substring(2,Z),J=J.substring(Z)||YV}return new UL("file",Y,J,v5,v5,!1,Q)}static from(J){let Q=new UL(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return iB0(Q,!0),Q}toString(J=!1){return yK1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof u0)return J;let Q=new UL(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===rB0(Q.platform)?Y.fsPath:null,Q}}function rB0(J){return J==="windows"?1:void 0}function aB0(J,Q,Y){let Z=void 0;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=sB0[G];if(V!==void 0)Z+=V;else Z+=encodeURIComponent(J.charAt(X))}}return Z!==void 0?Z:J}function W$4(J){let Q=void 0;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+=sB0[Z]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function tB0(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 yK1(J,Q){let Y=!Q?aB0:W$4,Z="",{scheme:X,authority:G,path:V,query:K,fragment:q}=J;if(X)Z+=X,Z+=":";if(G||X==="file")Z+=YV,Z+=YV;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?aB0(q,!1,!1):q;return Z}function eB0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+eB0(J.substring(3));else return J}}function ai(J){if(!J.match(oB0))return J;return J.replace(oB0,(Q)=>eB0(Q))}function EU(J){return J.scheme==="file"}function n7(J){return u0.parse(J)}function v6(J){return J.toString()}function o4(J){if(typeof J==="string"||J instanceof URL)return u0.parse(J.toString());return J}function Sy(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var X$4,$$4,G$4,v5="",YV="/",q$4,UL,sB0,oB0;var _y=$1(()=>{X$4=/^\w[\w\d+.-]*$/,$$4=/^\//,G$4=/^\/\//;q$4=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;UL=class UL extends u0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=tB0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=yK1(this,!1);return this._formatted}return yK1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=rB0(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}};sB0={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"};oB0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function xK1(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 BL(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function rE(...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 JN0(J,Q,Y="/",Z="/",X=!0){function G(F,U){return X?F===U:F.toLowerCase()===U.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 F=0;F<W;F++)H.push("..");return H.push(...K.slice(q)),H.join(Z)}function oi(J){let Q=BL(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function u3(J){try{if(J=o4(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var sE=$1(()=>{_y()});function H$4(J,...Q){return J=o4(J),J.with({path:rE(J.path,...Q)})}function F$4(J,...Q){let Y=J.path,Z=!1;if(Y[0]!==ri)Y=ri+Y,Z=!0;let X=Y;for(let G of Q)if(G.startsWith("/"))X=rE(G);else X=rE(X,G);if(X!=="/"&&X.endsWith("/"))X=X.replace(/\/+$/,"");if(Z&&X[0]===ri&&!J.authority)X=X.substring(1);return J.with({path:X})}function z$4(J){if(J=o4(J),J.path.length===0||J.path===ri)return J;let Q=xK1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function U$4(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 B$4(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 JN0(J.path,Q.path,Y,Y)}function N$4(J,Q){let Y=v6(J),Z=v6(Q);if(Y.startsWith("file:///")&&Z.startsWith("file:///"))return QN0(Y)===QN0(Z);return Y===Z}function QN0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var ri="/",i0;var si=$1(()=>{sE();_y();i0={joinPath:H$4,resolvePath:F$4,dirname:z$4,basename:(J)=>BL(o4(J).path),extname:(J)=>oi(o4(J).path),hasPrefix:U$4,relativePath:B$4,equalURIs:N$4}});var D$4=(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},tE=(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),tE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),tE(J);case"string":let Z=J[J.length-2];if(Z?.type==="delimiter")return J=J.slice(0,J.length-1),tE(J);else if(Z?.type==="brace"&&Z.value==="{")return J=J.slice(0,J.length-1),tE(J);break;case"delimiter":return J=J.slice(0,J.length-1),tE(J);break}return J},M$4=(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},L$4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},D$=(J)=>JSON.parse(L$4(M$4(tE(D$4(J)))));var NL=()=>{};function ti(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function YN0(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 hK1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function A$4(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(ZN0(J,Y.type,Y.value),J._state==="closed")break}function ZN0(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(hK1(J),Z&&typeof Z.error==="function")Z.error(Y);else throw Y;break;case"complete":if(hK1(J),Z&&typeof Z.complete==="function")Z.complete();break}}catch(X){console.error("notifySubscription",X)}if(J._state==="closed")YN0(J);else if(J._state==="running")J._state="ready"}function vK1(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}],ti(()=>A$4(J));return}ZN0(J,Q,Y)}class XN0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new $N0(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")hK1(this),YN0(this)}}class $N0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){vK1(this._subscription,"next",J)}error(J){vK1(this._subscription,"error",J)}complete(){vK1(this._subscription,"complete")}}function h5(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class eE{_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 fK1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function bK1(J){if(fK1(J))return J;return Y0.of(J)}var Y0;var JP=$1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");Y0=class Y0{_subscriber;constructor(J){if(!(this instanceof Y0))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 XN0(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 this==="function"?this:Y0;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 Y0)return X;return new Q((G)=>X.subscribe(G))}let Z=J[Symbol.iterator];if(typeof Z==="function")return new Q((X)=>{ti(()=>{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)=>{ti(()=>{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 this==="function"?this:Y0)((Y)=>{ti(()=>{if(Y.closed)return;for(let Z of J)if(Y.next(Z),Y.closed)return;Y.complete()})})}static get[Symbol.species](){return this}}});var r4,U5;var ei=$1(()=>{JP();r4=class r4 extends Y0{_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()}};U5=class U5 extends r4{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 gK1,ky;var GN0=$1(()=>{JP();ei();gK1=class gK1 extends Set{subject=new U5(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 Y0.from(this.subject)}dispose(){this.subject.complete()}};ky=class ky extends Map{subject=new U5(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 Y0.from(this.subject)}dispose(){this.subject.complete()}}});function Ja(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)=>Ja(G,Q[V]));let X=new Set([...Object.keys(J),...Object.keys(Q)]);for(let G of X)if(!Ja(J[G],Q[G]))return!1;return!0}function mK1(J){return{dispose:J.unsubscribe.bind(J)}}function KN0(...J){return new Y0((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}async function D6(J,Q){return new Promise((Y,Z)=>{let X=void 0,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 PU(J,Q){return new Promise((Y,Z)=>{let X,G=!1,V=void 0,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 qN0(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 i7(J){return new Y0((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function J4(J){return new Y0((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 X6(J){return(Q)=>{return new Y0((Y)=>{let Z=new eE(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()=>h5(G)})}}function Qa(J){return new Y0((Q)=>{let Y=0,Z=setInterval(()=>{Q.next(Y++)},J);return()=>clearInterval(Z)})}function TH(...J){return new Y0((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()=>{WN0(Z)}})}function h8(...J){if(J.length===0)return yy;return new Y0((Q)=>{let Y=Array(J.length),Z=Array(J.length).fill(0),X=Array(J.length).fill(!1),G=0,V=[],K=new eE(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 F=++Z[q];if(X.every(Boolean))K.schedule(async(U)=>{if(Z[q]===F)U([...Y])})},error(H){K.error(H)},complete(){if(G++,G===J.length)K.complete()}}))}return()=>{WN0(V)}})}function U8(J){let Y=J?.shouldCountRefs??!0,Z=O$4++,X=(G,...V)=>{};return(G)=>{let V=new r4,K=null,q=!1,W,H=0;return new Y0((F)=>{if(H++,q)X("new subscriber, emitting buffered value",W),F.next(W);else X("new subscriber, no buffered value to emit");if(!K)K=G.subscribe({next:(B)=>{q=!0,W=B,V.next(B)},error:(B)=>V.error(B),complete:()=>V.complete()});let U=V.subscribe(F);return()=>{if(H--,U.unsubscribe(),Y&&H===0){if(K)h5(K),K=null;q=!1}}})}}function WN0(J){for(let Q of J)if(Q)h5(Q)}function CH(J){return(Q)=>{return new Y0((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 ZV(J){return(Q)=>{return new Y0((Y)=>{let Z,X=Q.subscribe({next(G){Z=G,Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{h5(X),J(Z)}})}}function I4(J=Ja){return(Q)=>{return new Y0((Y)=>{let Z=VN0,X=new eE(Y),G=Q.subscribe({complete(){X.complete()},error(V){X.error(V)},next(V){X.schedule(async(K)=>{if(Z===VN0||!J(Z,V))Z=V,K(V)})}});return()=>h5(G)})}}function hZ(J){return w$4(typeof J==="function"?{next:J}:J)}function w$4(J){return(Q)=>new Y0((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()=>h5(X)})}function RU(J){return(Q)=>{return new Y0((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 Ya(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(G),X.unsubscribe()}})}}function d8(J){return(Q)=>new Y0((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)h5(Z)}})}function jH(J){return(Q)=>new Y0((Y)=>{let Z=0,X=Q.subscribe({next(G){if(Z<J){if(Y.next(G),Z++,Z===J)Y.complete(),h5(X)}},error(G){Y.error(G)},complete(){Y.complete()}});return()=>{h5(X)}})}function HN0(J){return(Q)=>new Y0((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()=>{h5(X)}})}function uK1(J){return(Q)=>{return new Y0((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(F){Y.next(F)},error(F){Y.error(F)},complete(){X.delete(H),V()}});X.add(H)},error(q){Y.error(q)},complete(){G=!0,V()}});return()=>{h5(K);for(let q of X)if(q)h5(q)}})}}function L4(J){return(Q)=>{return new Y0((Y)=>{let Z=0,X=null,G=!1,V=()=>{if(G&&!X)Y.complete()},K=Q.subscribe({next(q){if(X)h5(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(h5(K),X)h5(X)}})}}function fZ(J){return(Q)=>new Y0((Y)=>{let Z=null,X=null,G=!1,V=Q.subscribe({next:(K)=>{if(X=K,G=!0,Z===null)Z=setTimeout(()=>{if(G)Y.next(X),G=!1;Z=null},J)},error:(K)=>Y.error(K),complete:()=>{if(Z!==null)clearTimeout(Z);if(G)Y.next(X);Y.complete()}});return()=>{if(h5(V),Z!==null)clearTimeout(Z)}})}function xy(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Y)=>new Y0((Z)=>{let X=0,G=null,V=null,K=!1,q=Y.subscribe({next:(W)=>{let H=Date.now();if(V=W,K=!0,H-X>=J)Z.next(W),X=H,K=!1;else if(G===null)G=setTimeout(()=>{if(K)Z.next(V),X=Date.now(),K=!1;G=null},J-(H-X));if(X===0)Z.next(W),X=H,K=!1},error:(W)=>Z.error(W),complete:()=>{if(G!==null)clearTimeout(G);if(K)Z.next(V);Z.complete()}});return()=>{if(h5(q),G!==null)clearTimeout(G)}})}function SH(...J){return new Y0((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)h5(Z)}})}function bZ(J){return(Q)=>new Y0((Y)=>{let Z=0,X=!1,G=null,V=Q.subscribe({next(K){try{let q=J(K,Z++);if(G)h5(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(h5(V),G)h5(G)}})}function vy({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new Y0((Z)=>{J?.();let X=Y.subscribe(Z);return()=>{h5(X),Q?.()}})}function TU(J){return(Q)=>Y0.from(Q).pipe(L4((Y)=>J4((Z)=>J(Y,Z))))}function a7(J){return(Q)=>new Y0((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(h5(X),Z)h5(Z)}})}function B5(J){return(Q)=>{return new Y0((Y)=>{let Z=Q.subscribe({next(X){if(J(X))Y.next(X)},error(X){Y.error(X)},complete(){Y.complete()}});return()=>h5(Z)})}}function FN0(J,Q){return(Y)=>{return new Y0((Z)=>{let X,G=0,V=new eE(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()=>h5(K)})}}var yy,M$,wo8,O$4=0,VN0,Ya;var pK1=$1(()=>{JP();ei();yy=new Y0((J)=>{J.complete()}),M$=new Y0(()=>{});wo8=Symbol("noInitialValue");VN0={};Ya=class Ya extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function Za(J,Q){return(Y)=>{return Y0.from(Y).pipe(L4((Z)=>Z===$q?Y0.of($q):J(Z).pipe(a7((X)=>Y0.of(X instanceof Error?X:Error(X))),d8($q))),U8(Q))}}function I$4(){return(J)=>Y0.from(J).pipe(B5((Q)=>Q!==$q))}async function zN0(J,Q){let Y=await D6(Y0.from(J).pipe(I$4()),Q);if(Y instanceof Error)throw Y;return Y}var $q;var UN0=$1(()=>{JP();pK1();$q=Symbol.for("@@pendingOperation")});var s0=$1(()=>{GN0();JP();UN0();pK1();ei()});function ZQ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function LL(J){return!!J&&!!J[gZ]}function CU(J){if(!J)return!1;return LN0(J)||Array.isArray(J)||!!J[hy]||!!J.constructor?.[hy]||uy(J)||py(J)}function LN0(J){if(!J||typeof J!=="object")return!1;let Q=ML(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)===E$4}function fy(J,Q){if(AL(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,Z)=>Q(Z,Y,J))}function AL(J){let Q=J[gZ];return Q?Q.type_:Array.isArray(J)?1:uy(J)?2:py(J)?3:0}function by(J,Q){return AL(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function dK1(J,Q){return AL(J)===2?J.get(Q):J[Q]}function AN0(J,Q,Y){let Z=AL(J);if(Z===2)J.set(Q,Y);else if(Z===3)J.add(Y);else J[Q]=Y}function P$4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function uy(J){return J instanceof Map}function py(J){return J instanceof Set}function DL(J){return J.copy_||J.base_}function nK1(J,Q){if(uy(J))return new Map(J);if(py(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=LN0(J);if(Q===!0||Q==="class_only"&&!Y){let Z=Object.getOwnPropertyDescriptors(J);delete Z[gZ];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(ML(J),Z)}else{let Z=ML(J);if(Z!==null&&Y)return{...J};let X=Object.create(Z);return Object.assign(X,J)}}function uZ(J,Q=!1){if(Ga(J)||LL(J)||!CU(J))return J;if(AL(J)>1)J.set=J.add=J.clear=J.delete=R$4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,Z])=>uZ(Z,!0));return J}function R$4(){ZQ(2)}function Ga(J){return Object.isFrozen(J)}function OL(J){let Q=iK1[J];if(!Q)ZQ(0,J);return Q}function T$4(J,Q){if(!iK1[J])iK1[J]=Q}function ON0(){return gy}function C$4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function BN0(J,Q){if(Q)OL("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function aK1(J){oK1(J),J.drafts_.forEach(j$4),J.drafts_=null}function oK1(J){if(J===gy)gy=J.parent_}function NN0(J){return gy=C$4(gy,J)}function j$4(J){let Q=J[gZ];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function DN0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[gZ].modified_)aK1(Q),ZQ(4);if(CU(J)){if(J=Xa(Q,J),!Q.parent_)$a(Q,J)}if(Q.patches_)OL("Patches").generateReplacementPatches_(Y[gZ].base_,J,Q.patches_,Q.inversePatches_)}else J=Xa(Q,Y,[]);if(aK1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==tK1?J:void 0}function Xa(J,Q,Y){if(Ga(Q))return Q;let Z=Q[gZ];if(!Z)return fy(Q,(X,G)=>MN0(J,Z,Q,X,G,Y)),Q;if(Z.scope_!==J)return Q;if(!Z.modified_)return $a(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(fy(G,(K,q)=>MN0(J,Z,X,K,q,Y,V)),$a(J,X,!1),Y&&J.patches_)OL("Patches").generatePatches_(Z,Y,J.patches_,J.inversePatches_)}return Z.copy_}function MN0(J,Q,Y,Z,X,G,V){if(LL(X)){let K=G&&Q&&Q.type_!==3&&!by(Q.assigned_,Z)?G.concat(Z):void 0,q=Xa(J,X,K);if(AN0(Y,Z,q),LL(q))J.canAutoFreeze_=!1;else return}else if(V)Y.add(X);if(CU(X)&&!Ga(X)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Xa(J,X),(!Q||!Q.scope_.parent_)&&typeof Z!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,Z))$a(J,X)}}function $a(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)uZ(Q,Y)}function S$4(J,Q){let Y=Array.isArray(J),Z={type_:Y?1:0,scope_:Q?Q.scope_:ON0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},X=Z,G=eK1;if(Y)X=[Z],G=my;let{revoke:V,proxy:K}=Proxy.revocable(X,G);return Z.draft_=K,Z.revoke_=V,K}function cK1(J,Q){let Y=J[gZ];return(Y?DL(Y):J)[Q]}function _$4(J,Q,Y){let Z=wN0(Q,Y);return Z?"value"in Z?Z.value:Z.get?.call(J.draft_):void 0}function wN0(J,Q){if(!(Q in J))return;let Y=ML(J);while(Y){let Z=Object.getOwnPropertyDescriptor(Y,Q);if(Z)return Z;Y=ML(Y)}return}function rK1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)rK1(J.parent_)}}function lK1(J){if(!J.copy_)J.copy_=nK1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function sK1(J,Q){let Y=uy(J)?OL("MapSet").proxyMap_(J,Q):py(J)?OL("MapSet").proxySet_(J,Q):S$4(J,Q);return(Q?Q.scope_:ON0()).drafts_.push(Y),Y}function y$4(J){if(!LL(J))ZQ(10,J);return IN0(J)}function IN0(J){if(!CU(J)||Ga(J))return J;let Q=J[gZ],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=nK1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=nK1(J,!0);if(fy(Y,(Z,X)=>{AN0(Y,Z,IN0(X))}),Q)Q.finalized_=!1;return Y}function Va(){let Q="replace",Y="add",Z="remove";function X(U,B,M,L){switch(U.type_){case 0:case 2:return V(U,B,M,L);case 1:return G(U,B,M,L);case 3:return K(U,B,M,L)}}function G(U,B,M,L){let{base_:A,assigned_:w}=U,E=U.copy_;if(E.length<A.length)[A,E]=[E,A],[M,L]=[L,M];for(let P=0;P<A.length;P++)if(w[P]&&E[P]!==A[P]){let R=B.concat([P]);M.push({op:Q,path:R,value:F(E[P])}),L.push({op:Q,path:R,value:F(A[P])})}for(let P=A.length;P<E.length;P++){let R=B.concat([P]);M.push({op:Y,path:R,value:F(E[P])})}for(let P=E.length-1;A.length<=P;--P){let R=B.concat([P]);L.push({op:Z,path:R})}}function V(U,B,M,L){let{base_:A,copy_:w}=U;fy(U.assigned_,(E,P)=>{let R=dK1(A,E),C=dK1(w,E),S=!P?Z:by(A,E)?Q:Y;if(R===C&&S===Q)return;let k=B.concat(E);M.push(S===Z?{op:S,path:k}:{op:S,path:k,value:C}),L.push(S===Y?{op:Z,path:k}:S===Z?{op:Y,path:k,value:F(R)}:{op:Q,path:k,value:F(R)})})}function K(U,B,M,L){let{base_:A,copy_:w}=U,E=0;A.forEach((P)=>{if(!w.has(P)){let R=B.concat([E]);M.push({op:Z,path:R,value:P}),L.unshift({op:Y,path:R,value:P})}E++}),E=0,w.forEach((P)=>{if(!A.has(P)){let R=B.concat([E]);M.push({op:Y,path:R,value:P}),L.unshift({op:Z,path:R,value:P})}E++})}function q(U,B,M,L){M.push({op:Q,path:[],value:B===tK1?void 0:B}),L.push({op:Q,path:[],value:U})}function W(U,B){return B.forEach((M)=>{let{path:L,op:A}=M,w=U;for(let C=0;C<L.length-1;C++){let S=AL(w),k=L[C];if(typeof k!=="string"&&typeof k!=="number")k=""+k;if((S===0||S===1)&&(k==="__proto__"||k==="constructor"))ZQ(19);if(typeof w==="function"&&k==="prototype")ZQ(19);if(w=dK1(w,k),typeof w!=="object")ZQ(18,L.join("/"))}let E=AL(w),P=H(M.value),R=L[L.length-1];switch(A){case Q:switch(E){case 2:return w.set(R,P);case 3:ZQ(16);default:return w[R]=P}case Y:switch(E){case 1:return R==="-"?w.push(P):w.splice(R,0,P);case 2:return w.set(R,P);case 3:return w.add(P);default:return w[R]=P}case Z:switch(E){case 1:return w.splice(R,1);case 2:return w.delete(R);case 3:return w.delete(M.value);default:return delete w[R]}default:ZQ(17,A)}}),U}function H(U){if(!CU(U))return U;if(Array.isArray(U))return U.map(H);if(uy(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(py(U))return new Set(Array.from(U).map(H));let B=Object.create(ML(U));for(let M in U)B[M]=H(U[M]);if(by(U,hy))B[hy]=U[hy];return B}function F(U){if(LL(U))return H(U);else return U}T$4("Patches",{applyPatches_:W,generatePatches_:X,generateReplacementPatches_:q})}function s8(J){return J}var tK1,hy,gZ,ML,E$4,iK1,gy,eK1,my,k$4=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")ZQ(6);if(Z!==void 0&&typeof Z!=="function")ZQ(7);let X;if(CU(Q)){let G=NN0(this),V=sK1(Q,void 0),K=!0;try{X=Y(V),K=!1}finally{if(K)aK1(G);else oK1(G)}return BN0(G,Z),DN0(X,G)}else if(!Q||typeof Q!=="object"){if(X=Y(Q),X===void 0)X=Q;if(X===tK1)X=void 0;if(this.autoFreeze_)uZ(X,!0);if(Z){let G=[],V=[];OL("Patches").generateReplacementPatches_(Q,X,G,V),Z(G,V)}return X}else ZQ(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(!CU(J))ZQ(8);if(LL(J))J=y$4(J);let Q=NN0(this),Y=sK1(J,void 0);return Y[gZ].isManual_=!0,oK1(Q),Y}finishDraft(J,Q){let Y=J&&J[gZ];if(!Y||!Y.isManual_)ZQ(9);let{scope_:Z}=Y;return BN0(Z,Q),DN0(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=OL("Patches").applyPatches_;if(LL(J))return Z(J,Q);return this.produce(J,(X)=>Z(X,Q))}},mZ,XQ,QP,yo8,xo8,EN0,vo8,ho8;var $Q=$1(()=>{tK1=Symbol.for("immer-nothing"),hy=Symbol.for("immer-draftable"),gZ=Symbol.for("immer-state");ML=Object.getPrototypeOf;E$4=Object.prototype.constructor.toString();iK1={};eK1={get(J,Q){if(Q===gZ)return J;let Y=DL(J);if(!by(Y,Q))return _$4(J,Y,Q);let Z=Y[Q];if(J.finalized_||!CU(Z))return Z;if(Z===cK1(J.base_,Q))return lK1(J),J.copy_[Q]=sK1(Z,J);return Z},has(J,Q){return Q in DL(J)},ownKeys(J){return Reflect.ownKeys(DL(J))},set(J,Q,Y){let Z=wN0(DL(J),Q);if(Z?.set)return Z.set.call(J.draft_,Y),!0;if(!J.modified_){let X=cK1(DL(J),Q),G=X?.[gZ];if(G&&G.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(P$4(Y,X)&&(Y!==void 0||by(J.base_,Q)))return!0;lK1(J),rK1(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(cK1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,lK1(J),rK1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=DL(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(){ZQ(11)},getPrototypeOf(J){return ML(J.base_)},setPrototypeOf(){ZQ(12)}},my={};fy(eK1,(J,Q)=>{my[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});my.deleteProperty=function(J,Q){return my.set.call(this,J,Q,void 0)};my.set=function(J,Q,Y){return eK1.set.call(this,J[0],Q,Y,J[0])};mZ=new k$4,XQ=mZ.produce,QP=mZ.produceWithPatches.bind(mZ),yo8=mZ.setAutoFreeze.bind(mZ),xo8=mZ.setUseStrictShallowCopy.bind(mZ),EN0=mZ.applyPatches.bind(mZ),vo8=mZ.createDraft.bind(mZ),ho8=mZ.finishDraft.bind(mZ)});function PN0(J,Q=0){return(FJ[J[Q+0]]+FJ[J[Q+1]]+FJ[J[Q+2]]+FJ[J[Q+3]]+"-"+FJ[J[Q+4]]+FJ[J[Q+5]]+"-"+FJ[J[Q+6]]+FJ[J[Q+7]]+"-"+FJ[J[Q+8]]+FJ[J[Q+9]]+"-"+FJ[J[Q+10]]+FJ[J[Q+11]]+FJ[J[Q+12]]+FJ[J[Q+13]]+FJ[J[Q+14]]+FJ[J[Q+15]]).toLowerCase()}var FJ;var RN0=$1(()=>{FJ=[];for(let J=0;J<256;++J)FJ.push((J+256).toString(16).slice(1))});import{randomFillSync as x$4}from"crypto";function Wa(){if(Ka>qa.length-16)x$4(qa),Ka=0;return qa.slice(Ka,Ka+=16)}var qa,Ka;var TN0=$1(()=>{qa=new Uint8Array(256),Ka=qa.length});function v$4(J,Q,Y){let Z;if(J)Z=CN0(J.random??J.rng?.()??Wa(),J.msecs,J.seq,Q,Y);else{let X=Date.now(),G=Wa();h$4(Jq1,X,G),Z=CN0(G,Jq1.msecs,Jq1.seq,Q,Y)}return Q??PN0(Z)}function h$4(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 CN0(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 Jq1,Qq1;var jN0=$1(()=>{TN0();RN0();Jq1={};Qq1=v$4});var SN0=$1(()=>{jN0()});function Yq1({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 YP(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(f$4,"")}var f$4;var Ha=$1(()=>{f$4=Yq1()});var kN0=g((ro8,Zq1)=>{var jU={};if(typeof Zq1>"u")window.eastasianwidth=jU;else Zq1.exports=jU;jU.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"};jU.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function _N0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}jU.length=function(J){var Q=_N0(J),Y=0;for(var Z=0;Z<Q.length;Z++)Y=Y+this.characterLength(Q[Z]);return Y};jU.slice=function(J,Q,Y){if(textLen=jU.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=_N0(J);for(var V=0;V<G.length;V++){var K=G[V],q=jU.length(K);if(X>=Q-(q==2?1:0))if(X+q<=Y)Z+=K;else break;X+=q}return Z}});var Xq1=g((so8,yN0)=>{yN0.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 b$4,g$4;var xN0=$1(()=>{Ha();b$4=Q6(kN0(),1),g$4=Q6(Xq1(),1)});function Fa(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var $q1=$1(()=>{xN0()});var vN0="run_terminal_command",Gq1="read_file",m2="Task",p3="task_list",A9="finder",pY="get_diagnostics",f5="Bash",t5="oracle",hN0="painter",Gq="mermaid",Vq="todo_read",V7="todo_write",zJ="read_web_page",ZP="read_thread",za="find_thread",K7="create_file",dQ="glob",Ua="undo_edit",Ba="read_mcp_resource",T4="Read",o7="edit_file",XP="format_file",cQ="web_search",T9="Grep",wL="Check",Kq="librarian",Na="kraken",fN0="look_at",Da="read_github",Ma="search_github",La="commit_search",Aa="list_directory_github",Oa="list_repositories",wa="glob_github",Ia="diff",bN0="bookkeeper",gN0="describe_workbook",mN0="execute_query",qq="skill",Ea="repl",uN0;var x4=$1(()=>{uN0=["Task","task_list","finder","get_diagnostics","Bash","oracle","painter","mermaid","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","bookkeeper","read_thread","find_thread","skill","read_github","search_github","commit_search","list_directory_github","list_repositories","glob_github","diff","describe_workbook","execute_query"]});var dy=g((Xr8,dN0)=>{var pN0={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:"/"},m$4={...pN0,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:"\\"},u$4={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"};dN0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:u$4,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?m$4:pN0}}});var cy=g((n$4)=>{var{REGEX_BACKSLASH:p$4,REGEX_REMOVE_BACKSLASH:d$4,REGEX_SPECIAL_CHARS:c$4,REGEX_SPECIAL_CHARS_GLOBAL:l$4}=dy();n$4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);n$4.hasRegexChars=(J)=>c$4.test(J);n$4.isRegexChar=(J)=>J.length===1&&n$4.hasRegexChars(J);n$4.escapeRegex=(J)=>J.replace(l$4,"\\$1");n$4.toPosixSlashes=(J)=>J.replace(p$4,"/");n$4.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};n$4.removeBackslashes=(J)=>{return J.replace(d$4,(Q)=>{return Q==="\\"?"":Q})};n$4.escapeLast=(J,Q,Y)=>{let Z=J.lastIndexOf(Q,Y);if(Z===-1)return J;if(J[Z-1]==="\\")return n$4.escapeLast(J,Q,Z-1);return`${J.slice(0,Z)}\\${J.slice(Z)}`};n$4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};n$4.wrapOutput=(J,Q={},Y={})=>{let Z=Y.contains?"":"^",X=Y.contains?"":"$",G=`${Z}(?:${J})${X}`;if(Q.negated===!0)G=`(?:^(?!${G}).*$)`;return G};n$4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),Z=Y[Y.length-1];if(Z==="")return Y[Y.length-2];return Z}});var eN0=g((Gr8,tN0)=>{var nN0=cy(),{CHAR_ASTERISK:Vq1,CHAR_AT:YG4,CHAR_BACKWARD_SLASH:ly,CHAR_COMMA:ZG4,CHAR_DOT:Kq1,CHAR_EXCLAMATION_MARK:qq1,CHAR_FORWARD_SLASH:sN0,CHAR_LEFT_CURLY_BRACE:Wq1,CHAR_LEFT_PARENTHESES:Hq1,CHAR_LEFT_SQUARE_BRACKET:XG4,CHAR_PLUS:$G4,CHAR_QUESTION_MARK:iN0,CHAR_RIGHT_CURLY_BRACE:GG4,CHAR_RIGHT_PARENTHESES:aN0,CHAR_RIGHT_SQUARE_BRACKET:VG4}=dy(),oN0=(J)=>{return J===sN0||J===ly},rN0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},KG4=(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,F=0,U=!1,B=!1,M=!1,L=!1,A=!1,w=!1,E=!1,P=!1,R=!1,C=!1,S=0,k,f,m={value:"",depth:0,isGlob:!1},b=()=>W>=Z,c=()=>q.charCodeAt(W+1),Z1=()=>{return k=f,q.charCodeAt(++W)};while(W<Z){f=Z1();let Y1;if(f===ly){if(E=m.backslashes=!0,f=Z1(),f===Wq1)w=!0;continue}if(w===!0||f===Wq1){S++;while(b()!==!0&&(f=Z1())){if(f===ly){E=m.backslashes=!0,Z1();continue}if(f===Wq1){S++;continue}if(w!==!0&&f===Kq1&&(f=Z1())===Kq1){if(U=m.isBrace=!0,M=m.isGlob=!0,C=!0,X===!0)continue;break}if(w!==!0&&f===ZG4){if(U=m.isBrace=!0,M=m.isGlob=!0,C=!0,X===!0)continue;break}if(f===GG4){if(S--,S===0){w=!1,U=m.isBrace=!0,C=!0;break}}}if(X===!0)continue;break}if(f===sN0){if(G.push(W),V.push(m),m={value:"",depth:0,isGlob:!1},C===!0)continue;if(k===Kq1&&W===H+1){H+=2;continue}F=W+1;continue}if(Y.noext!==!0){if((f===$G4||f===YG4||f===Vq1||f===iN0||f===qq1)===!0&&c()===Hq1){if(M=m.isGlob=!0,L=m.isExtglob=!0,C=!0,f===qq1&&W===H)R=!0;if(X===!0){while(b()!==!0&&(f=Z1())){if(f===ly){E=m.backslashes=!0,f=Z1();continue}if(f===aN0){M=m.isGlob=!0,C=!0;break}}continue}break}}if(f===Vq1){if(k===Vq1)A=m.isGlobstar=!0;if(M=m.isGlob=!0,C=!0,X===!0)continue;break}if(f===iN0){if(M=m.isGlob=!0,C=!0,X===!0)continue;break}if(f===XG4){while(b()!==!0&&(Y1=Z1())){if(Y1===ly){E=m.backslashes=!0,Z1();continue}if(Y1===VG4){B=m.isBracket=!0,M=m.isGlob=!0,C=!0;break}}if(X===!0)continue;break}if(Y.nonegate!==!0&&f===qq1&&W===H){P=m.negated=!0,H++;continue}if(Y.noparen!==!0&&f===Hq1){if(M=m.isGlob=!0,X===!0){while(b()!==!0&&(f=Z1())){if(f===Hq1){E=m.backslashes=!0,f=Z1();continue}if(f===aN0){C=!0;break}}continue}break}if(M===!0){if(C=!0,X===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let r=q,p="",s="";if(H>0)p=q.slice(0,H),q=q.slice(H),F-=H;if(r&&M===!0&&F>0)r=q.slice(0,F),s=q.slice(F);else if(M===!0)r="",s=q;else r=q;if(r&&r!==""&&r!=="/"&&r!==q){if(oN0(r.charCodeAt(r.length-1)))r=r.slice(0,-1)}if(Y.unescape===!0){if(s)s=nN0.removeBackslashes(s);if(r&&E===!0)r=nN0.removeBackslashes(r)}let Q1={prefix:p,input:J,start:H,base:r,glob:s,isBrace:U,isBracket:B,isGlob:M,isExtglob:L,isGlobstar:A,negated:P,negatedExtglob:R};if(Y.tokens===!0){if(Q1.maxDepth=0,!oN0(f))V.push(m);Q1.tokens=V}if(Y.parts===!0||Y.tokens===!0){let Y1;for(let n=0;n<G.length;n++){let o=Y1?Y1+1:H,i=G[n],q1=J.slice(o,i);if(Y.tokens){if(n===0&&H!==0)V[n].isPrefix=!0,V[n].value=p;else V[n].value=q1;rN0(V[n]),Q1.maxDepth+=V[n].depth}if(n!==0||q1!=="")K.push(q1);Y1=i}if(Y1&&Y1+1<J.length){let n=J.slice(Y1+1);if(K.push(n),Y.tokens)V[V.length-1].value=n,rN0(V[V.length-1]),Q1.maxDepth+=V[V.length-1].depth}Q1.slashes=G,Q1.parts=K}return Q1};tN0.exports=KG4});var YD0=g((Vr8,QD0)=>{var Pa=dy(),Wq=cy(),{MAX_LENGTH:Ra,POSIX_REGEX_SOURCE:qG4,REGEX_NON_SPECIAL_CHARS:WG4,REGEX_SPECIAL_CHARS_BACKREF:HG4,REPLACEMENTS:JD0}=Pa,FG4=(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)=>Wq.escapeRegex(X)).join("..")}return Y},$P=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},Fq1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=JD0[J]||J;let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Ra,Y.maxLength):Ra,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=Pa.globChars(Y.windows),W=Pa.extglobChars(q),{DOT_LITERAL:H,PLUS_LITERAL:F,SLASH_LITERAL:U,ONE_CHAR:B,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:w,QMARK:E,QMARK_NO_DOT:P,STAR:R,START_ANCHOR:C}=q,S=(f1)=>{return`(${K}(?:(?!${C}${f1.dot?M:H}).)*?)`},k=Y.dot?"":L,f=Y.dot?E:P,m=Y.bash===!0?S(Y):R;if(Y.capture)m=`(${m})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let b={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=Wq.removePrefix(J,b),X=J.length;let c=[],Z1=[],r=[],p=G,s,Q1=()=>b.index===X-1,Y1=b.peek=(f1=1)=>J[b.index+f1],n=b.advance=()=>J[++b.index]||"",o=()=>J.slice(b.index+1),i=(f1="",V1=0)=>{b.consumed+=f1,b.index+=V1},q1=(f1)=>{b.output+=f1.output!=null?f1.output:f1.value,i(f1.value)},T1=()=>{let f1=1;while(Y1()==="!"&&(Y1(2)!=="("||Y1(3)==="?"))n(),b.start++,f1++;if(f1%2===0)return!1;return b.negated=!0,b.start++,!0},J1=(f1)=>{b[f1]++,r.push(f1)},D1=(f1)=>{b[f1]--,r.pop()},L1=(f1)=>{if(p.type==="globstar"){let V1=b.braces>0&&(f1.type==="comma"||f1.type==="brace"),X1=f1.extglob===!0||c.length&&(f1.type==="pipe"||f1.type==="paren");if(f1.type!=="slash"&&f1.type!=="paren"&&!V1&&!X1)b.output=b.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=m,b.output+=p.output}if(c.length&&f1.type!=="paren")c[c.length-1].inner+=f1.value;if(f1.value||f1.output)q1(f1);if(p&&p.type==="text"&&f1.type==="text"){p.output=(p.output||p.value)+f1.value,p.value+=f1.value;return}f1.prev=p,V.push(f1),p=f1},t1=(f1,V1)=>{let X1={...W[V1],conditions:1,inner:""};X1.prev=p,X1.parens=b.parens,X1.output=b.output;let N1=(Y.capture?"(":"")+X1.open;J1("parens"),L1({type:f1,value:V1,output:b.output?"":B}),L1({type:"paren",extglob:!0,value:n(),output:N1}),c.push(X1)},R1=(f1)=>{let V1=f1.close+(Y.capture?")":""),X1;if(f1.type==="negate"){let N1=m;if(f1.inner&&f1.inner.length>1&&f1.inner.includes("/"))N1=S(Y);if(N1!==m||Q1()||/^\)+$/.test(o()))V1=f1.close=`)$))${N1}`;if(f1.inner.includes("*")&&(X1=o())&&/^\.[^\\/.]+$/.test(X1)){let F1=Fq1(X1,{...Q,fastpaths:!1}).output;V1=f1.close=`)${F1})${N1})`}if(f1.prev.type==="bos")b.negatedExtglob=!0}L1({type:"paren",extglob:!0,value:s,output:V1}),D1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let f1=!1,V1=J.replace(HG4,(X1,N1,F1,E1,w1,h1)=>{if(E1==="\\")return f1=!0,X1;if(E1==="?"){if(N1)return N1+E1+(w1?E.repeat(w1.length):"");if(h1===0)return f+(w1?E.repeat(w1.length):"");return E.repeat(F1.length)}if(E1===".")return H.repeat(F1.length);if(E1==="*"){if(N1)return N1+E1+(w1?m:"");return m}return N1?X1:`\\${X1}`});if(f1===!0)if(Y.unescape===!0)V1=V1.replace(/\\/g,"");else V1=V1.replace(/\\+/g,(X1)=>{return X1.length%2===0?"\\\\":X1?"\\":""});if(V1===J&&Y.contains===!0)return b.output=J,b;return b.output=Wq.wrapOutput(V1,b,Q),b}while(!Q1()){if(s=n(),s==="\x00")continue;if(s==="\\"){let X1=Y1();if(X1==="/"&&Y.bash!==!0)continue;if(X1==="."||X1===";")continue;if(!X1){s+="\\",L1({type:"text",value:s});continue}let N1=/^\\+/.exec(o()),F1=0;if(N1&&N1[0].length>2){if(F1=N1[0].length,b.index+=F1,F1%2!==0)s+="\\"}if(Y.unescape===!0)s=n();else s+=n();if(b.brackets===0){L1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||p.value==="["||p.value==="[^")){if(Y.posix!==!1&&s===":"){let X1=p.value.slice(1);if(X1.includes("[")){if(p.posix=!0,X1.includes(":")){let N1=p.value.lastIndexOf("["),F1=p.value.slice(0,N1),E1=p.value.slice(N1+2),w1=qG4[E1];if(w1){if(p.value=F1+w1,b.backtrack=!0,n(),!G.output&&V.indexOf(p)===1)G.output=B;continue}}}}if(s==="["&&Y1()!==":"||s==="-"&&Y1()==="]")s=`\\${s}`;if(s==="]"&&(p.value==="["||p.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&p.value==="[")s="^";p.value+=s,q1({value:s});continue}if(b.quotes===1&&s!=='"'){s=Wq.escapeRegex(s),p.value+=s,q1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)L1({type:"text",value:s});continue}if(s==="("){J1("parens"),L1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError($P("opening","("));let X1=c[c.length-1];if(X1&&b.parens===X1.parens+1){R1(c.pop());continue}L1({type:"paren",value:s,output:b.parens?")":"\\)"}),D1("parens");continue}if(s==="["){if(Y.nobracket===!0||!o().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError($P("closing","]"));s=`\\${s}`}else J1("brackets");L1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||p&&p.type==="bracket"&&p.value.length===1){L1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError($P("opening","["));L1({type:"text",value:s,output:`\\${s}`});continue}D1("brackets");let X1=p.value.slice(1);if(p.posix!==!0&&X1[0]==="^"&&!X1.includes("/"))s=`/${s}`;if(p.value+=s,q1({value:s}),Y.literalBrackets===!1||Wq.hasRegexChars(X1))continue;let N1=Wq.escapeRegex(p.value);if(b.output=b.output.slice(0,-p.value.length),Y.literalBrackets===!0){b.output+=N1,p.value=N1;continue}p.value=`(${K}${N1}|${p.value})`,b.output+=p.value;continue}if(s==="{"&&Y.nobrace!==!0){J1("braces");let X1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};Z1.push(X1),L1(X1);continue}if(s==="}"){let X1=Z1[Z1.length-1];if(Y.nobrace===!0||!X1){L1({type:"text",value:s,output:s});continue}let N1=")";if(X1.dots===!0){let F1=V.slice(),E1=[];for(let w1=F1.length-1;w1>=0;w1--){if(V.pop(),F1[w1].type==="brace")break;if(F1[w1].type!=="dots")E1.unshift(F1[w1].value)}N1=FG4(E1,Y),b.backtrack=!0}if(X1.comma!==!0&&X1.dots!==!0){let F1=b.output.slice(0,X1.outputIndex),E1=b.tokens.slice(X1.tokensIndex);X1.value=X1.output="\\{",s=N1="\\}",b.output=F1;for(let w1 of E1)b.output+=w1.output||w1.value}L1({type:"brace",value:s,output:N1}),D1("braces"),Z1.pop();continue}if(s==="|"){if(c.length>0)c[c.length-1].conditions++;L1({type:"text",value:s});continue}if(s===","){let X1=s,N1=Z1[Z1.length-1];if(N1&&r[r.length-1]==="braces")N1.comma=!0,X1="|";L1({type:"comma",value:s,output:X1});continue}if(s==="/"){if(p.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",V.pop(),p=G;continue}L1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&p.type==="dot"){if(p.value===".")p.output=H;let X1=Z1[Z1.length-1];p.type="dots",p.output+=s,p.value+=s,X1.dots=!0;continue}if(b.braces+b.parens===0&&p.type!=="bos"&&p.type!=="slash"){L1({type:"text",value:s,output:H});continue}L1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(p&&p.value==="(")&&Y.noextglob!==!0&&Y1()==="("&&Y1(2)!=="?"){t1("qmark",s);continue}if(p&&p.type==="paren"){let N1=Y1(),F1=s;if(p.value==="("&&!/[!=<:]/.test(N1)||N1==="<"&&!/<([!=]|\w+>)/.test(o()))F1=`\\${s}`;L1({type:"text",value:s,output:F1});continue}if(Y.dot!==!0&&(p.type==="slash"||p.type==="bos")){L1({type:"qmark",value:s,output:P});continue}L1({type:"qmark",value:s,output:E});continue}if(s==="!"){if(Y.noextglob!==!0&&Y1()==="("){if(Y1(2)!=="?"||!/[!=<:]/.test(Y1(3))){t1("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){T1();continue}}if(s==="+"){if(Y.noextglob!==!0&&Y1()==="("&&Y1(2)!=="?"){t1("plus",s);continue}if(p&&p.value==="("||Y.regex===!1){L1({type:"plus",value:s,output:F});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||b.parens>0){L1({type:"plus",value:s});continue}L1({type:"plus",value:F});continue}if(s==="@"){if(Y.noextglob!==!0&&Y1()==="("&&Y1(2)!=="?"){L1({type:"at",extglob:!0,value:s,output:""});continue}L1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let X1=WG4.exec(o());if(X1)s+=X1[0],b.index+=X1[0].length;L1({type:"text",value:s});continue}if(p&&(p.type==="globstar"||p.star===!0)){p.type="star",p.star=!0,p.value+=s,p.output=m,b.backtrack=!0,b.globstar=!0,i(s);continue}let f1=o();if(Y.noextglob!==!0&&/^\([^?]/.test(f1)){t1("star",s);continue}if(p.type==="star"){if(Y.noglobstar===!0){i(s);continue}let X1=p.prev,N1=X1.prev,F1=X1.type==="slash"||X1.type==="bos",E1=N1&&(N1.type==="star"||N1.type==="globstar");if(Y.bash===!0&&(!F1||f1[0]&&f1[0]!=="/")){L1({type:"star",value:s,output:""});continue}let w1=b.braces>0&&(X1.type==="comma"||X1.type==="brace"),h1=c.length&&(X1.type==="pipe"||X1.type==="paren");if(!F1&&X1.type!=="paren"&&!w1&&!h1){L1({type:"star",value:s,output:""});continue}while(f1.slice(0,3)==="/**"){let g1=J[b.index+4];if(g1&&g1!=="/")break;f1=f1.slice(3),i("/**",3)}if(X1.type==="bos"&&Q1()){p.type="globstar",p.value+=s,p.output=S(Y),b.output=p.output,b.globstar=!0,i(s);continue}if(X1.type==="slash"&&X1.prev.type!=="bos"&&!E1&&Q1()){b.output=b.output.slice(0,-(X1.output+p.output).length),X1.output=`(?:${X1.output}`,p.type="globstar",p.output=S(Y)+(Y.strictSlashes?")":"|$)"),p.value+=s,b.globstar=!0,b.output+=X1.output+p.output,i(s);continue}if(X1.type==="slash"&&X1.prev.type!=="bos"&&f1[0]==="/"){let g1=f1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(X1.output+p.output).length),X1.output=`(?:${X1.output}`,p.type="globstar",p.output=`${S(Y)}${U}|${U}${g1})`,p.value+=s,b.output+=X1.output+p.output,b.globstar=!0,i(s+n()),L1({type:"slash",value:"/",output:""});continue}if(X1.type==="bos"&&f1[0]==="/"){p.type="globstar",p.value+=s,p.output=`(?:^|${U}|${S(Y)}${U})`,b.output=p.output,b.globstar=!0,i(s+n()),L1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-p.output.length),p.type="globstar",p.output=S(Y),p.value+=s,b.output+=p.output,b.globstar=!0,i(s);continue}let V1={type:"star",value:s,output:m};if(Y.bash===!0){if(V1.output=".*?",p.type==="bos"||p.type==="slash")V1.output=k+V1.output;L1(V1);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&Y.regex===!0){V1.output=s,L1(V1);continue}if(b.index===b.start||p.type==="slash"||p.type==="dot"){if(p.type==="dot")b.output+=A,p.output+=A;else if(Y.dot===!0)b.output+=w,p.output+=w;else b.output+=k,p.output+=k;if(Y1()!=="*")b.output+=B,p.output+=B}L1(V1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError($P("closing","]"));b.output=Wq.escapeLast(b.output,"["),D1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError($P("closing",")"));b.output=Wq.escapeLast(b.output,"("),D1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError($P("closing","}"));b.output=Wq.escapeLast(b.output,"{"),D1("braces")}if(Y.strictSlashes!==!0&&(p.type==="star"||p.type==="bracket"))L1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let f1 of b.tokens)if(b.output+=f1.output!=null?f1.output:f1.value,f1.suffix)b.output+=f1.suffix}return b};Fq1.fastpaths=(J,Q)=>{let Y={...Q},Z=typeof Y.maxLength==="number"?Math.min(Ra,Y.maxLength):Ra,X=J.length;if(X>Z)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Z}`);J=JD0[J]||J;let{DOT_LITERAL:G,SLASH_LITERAL:V,ONE_CHAR:K,DOTS_SLASH:q,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:F,STAR:U,START_ANCHOR:B}=Pa.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?F:W,A=Y.capture?"":"?:",w={negated:!1,prefix:""},E=Y.bash===!0?".*?":U;if(Y.capture)E=`(${E})`;let P=(k)=>{if(k.noglobstar===!0)return E;return`(${A}(?:(?!${B}${k.dot?q:G}).)*?)`},R=(k)=>{switch(k){case"*":return`${M}${K}${E}`;case".*":return`${G}${K}${E}`;case"*.*":return`${M}${E}${G}${K}${E}`;case"*/*":return`${M}${E}${V}${K}${L}${E}`;case"**":return M+P(Y);case"**/*":return`(?:${M}${P(Y)}${V})?${L}${K}${E}`;case"**/*.*":return`(?:${M}${P(Y)}${V})?${L}${E}${G}${K}${E}`;case"**/.*":return`(?:${M}${P(Y)}${V})?${G}${K}${E}`;default:{let f=/^(.*?)\.(\w+)$/.exec(k);if(!f)return;let m=R(f[1]);if(!m)return;return m+G+f[2]}}},C=Wq.removePrefix(J,w),S=R(C);if(S&&Y.strictSlashes!==!0)S+=`${V}?`;return S};QD0.exports=Fq1});var ny=g((Kr8,XD0)=>{var zG4=eN0(),zq1=YD0(),ZD0=cy(),UG4=dy(),BG4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),w3=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>w3(U,Q,Y));return(U)=>{for(let B of H){let M=B(U);if(M)return M}return!1}}let Z=BG4(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?w3.compileRe(J,Q):w3.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=w3(X.ignore,H,Y)}let W=(H,F=!1)=>{let{isMatch:U,match:B,output:M}=w3.test(H,V,Q,{glob:J,posix:G}),L={glob:J,state:K,regex:V,posix:G,input:H,output:M,match:B,isMatch:U};if(typeof X.onResult==="function")X.onResult(L);if(U===!1)return L.isMatch=!1,F?L:!1;if(q(H)){if(typeof X.onIgnore==="function")X.onIgnore(L);return L.isMatch=!1,F?L:!1}if(typeof X.onMatch==="function")X.onMatch(L);return F?L:!0};if(Y)W.state=K;return W};w3.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?ZD0.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=w3.matchBase(J,Q,Y,X);else K=Q.exec(q);return{isMatch:Boolean(K),match:K,output:q}};w3.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:w3.makeRe(Q,Y)).test(ZD0.basename(J))};w3.isMatch=(J,Q,Y)=>w3(Q,Y)(J);w3.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>w3.parse(Y,Q));return zq1(J,{...Q,fastpaths:!1})};w3.scan=(J,Q)=>zG4(J,Q);w3.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=w3.toRegex(K,Q);if(Z===!0)q.state=J;return q};w3.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=zq1.fastpaths(J,Q);if(!X.output)X=zq1(J,Q);return w3.compileRe(X,Q,Y,Z)};w3.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/$^/}};w3.constants=UG4;XD0.exports=w3});var _H=g((qr8,VD0)=>{var $D0=ny(),NG4=cy();function GD0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:NG4.isWindows()};return $D0(J,Q,Y)}Object.assign(GD0,$D0);VD0.exports=GD0});var GP;var Uq1=$1(()=>{GP={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"},{type:"webview",id:"amp.tabReviewPanel",name:"Tab",icon:"$(zap)",visibility:"hidden",when:"config.amp.tab.experimental.review"}]},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.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.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showTabReviewPanel",title:"Show Tab Review Panel",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{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"},{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:"-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.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.showTabReviewPanel",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{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.guidanceFilesInContext":{type:"boolean",default:!0,markdownDescription:"Deliver AGENTS.md guidance files in message context instead of system prompt for improved cache efficiency.",scope:"window"},"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:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"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.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"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.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"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.courseCorrection.enabled":{type:"boolean",default:!1,description:"Enable course correction agent that monitors the thread and provides guidance when the model goes off track",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",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:","@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 MG4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function qD0(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=GP.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!MG4(Z))return null;return Z*1000}function WD0(J){let Q=J.settings["tools.stopTimeout"],Y=GP.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var KD0;var Ta=$1(()=>{Uq1();KD0=GP.contributes.configuration.properties});function r7(J){let Q=f8[J];return`${Q.provider}/${Q.name}`}function GQ(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);let Y=J.slice(0,Q),Z=J.slice(Q+1);for(let X of Object.values(f8))if(X.provider===Y&&X.name===Z)return X;switch(Y){case"anthropic":return f8.CLAUDE_SONNET_4_5;case"openai":return f8.GPT_5;case"xai":return f8.GROK_CODE_FAST_1;case"cerebras":return f8.Z_AI_GLM_4_6;case"fireworks":return f8.FIREWORKS_GLM_4P6;case"moonshotai":return f8.KIMI_K2_INSTRUCT;case"openrouter":return f8.SONOMA_SKY_ALPHA;case"groq":return f8.GPT_OSS_120B;case"vertexai":return f8.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Y}`)}}function G2(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function pZ(J,Q){let Y=GQ(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}var Z9,f8,Bq1;var lQ=$1(()=>{Z9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},f8={CLAUDE_SONNET_4:{provider:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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},maxInputTokensInFreeMode:120000},GPT_5:{provider:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.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:Z9.VERTEXAI,name:"gemini-3-flash-preview",displayName:"Gemini 3 Flash Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:Z9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:Z9.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:Z9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:Z9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:Z9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:Z9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:Z9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:Z9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:Z9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:Z9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:Z9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};Bq1={FINDER:"finder"}});function Nq1(J,Q){let Y=XV(Q);if(!Y)return!1;if(LG4.has(J)){let Z=Y.finder??Bq1.FINDER,X=AG4[Z];if(J!==X)return!1}if(Y.includeTools){if(Y.deferredTools?.includes(J))return!0;return Y.includeTools.includes(J)}return!0}function Dq1(J,Q){let Y=XV(Q);if(!Y)return!1;return Y.deferredTools?.includes(J)??!1}function L$(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(VP).filter((Z)=>{if(Y.includes(`!${Z.key}`))return!1;if(Q===!1&&O9(Z.key))return!1;let G="visible"in Z?Z.visible:!1,V=Y.includes(Z.key),K=J?.["experimental.dojoMode"]===!0;if(Z.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(Z.key==="dojo")return K&&(Q===!1||Q===void 0);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 XV(J){return Object.values(VP).find((Q)=>Q.key===J)}function IL(J){return XV(J)?.primaryModel??r7("CLAUDE_SONNET_4_5")}function iy(J){let Q=XV(J);if(!Q)return!1;return GQ(Q.primaryModel).capabilities?.vision??!1}function O9(J){return J==="free"||J.startsWith("free-")}function Mq1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function Lq1(J,Q){let Z=(Q.findIndex((G)=>G.mode===J)+1)%Q.length;return Q[Z]?.mode??"smart"}var LG4,AG4,UD0,BD0,OG4,wG4,HD0,FD0,zD0,VP,IG4;var A$=$1(()=>{lQ();LG4=new Set(["finder"]),AG4={finder:"finder"},UD0={r:0,g:55,b:0},BD0={r:0,g:255,b:136},OG4=["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"],wG4=["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","kraken","look_at"],HD0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],FD0=["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"],zD0=["painter","bookkeeper","code_review"],VP={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:r7("CLAUDE_OPUS_4_5"),includeTools:FD0,deferredTools:zD0,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:r7("CLAUDE_HAIKU_4_5"),includeTools:OG4,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:r7("CLAUDE_HAIKU_4_5"),includeTools:wG4,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:r7("CLAUDE_SONNET_4_5"),includeTools:FD0,deferredTools:zD0,visible:!1,uiHints:{labelAnimation:"glow",primaryColor:{r:42,g:26,b:77},secondaryColor:{r:153,g:102,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:r7("CLAUDE_HAIKU_4_5"),includeTools:HD0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:r7("CLAUDE_SONNET_4_5"),includeTools:HD0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},IG4=Object.values(VP).map((J)=>J.key)});function Ca(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 EG4,PG4,Aq1,RG4,TG4,CG4,jG4,SG4,_G4,D7,Dr8;var $V=$1(()=>{lQ();EG4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],PG4=["Grep","glob","Read"],Aq1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],RG4=["Read","Grep","glob","Bash","edit_file","create_file","format_file","get_diagnostics","web_search","read_web_page","finder"],TG4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],CG4=["Read","glob","Grep","enqueue_file_edit","fastmod"],jG4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],SG4=["describe_workbook","execute_query"],_G4=["Read","Grep","glob","web_search","read_web_page","Bash"],D7={finder:{key:"finder",displayName:"Finder",model:r7("CLAUDE_HAIKU_4_5"),includeTools:PG4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:r7("GPT_5_2"),includeTools:Aq1,allowMcp:!1,allowToolbox:!1},painter:{key:"painter",displayName:"Painter",model:r7("GEMINI_3_PRO_PREVIEW"),includeTools:RG4,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:r7("CLAUDE_HAIKU_4_5"),includeTools:EG4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:TG4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:r7("CLAUDE_HAIKU_4_5"),includeTools:CG4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:r7("CLAUDE_HAIKU_4_5"),includeTools:jG4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:r7("CLAUDE_HAIKU_4_5"),includeTools:SG4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:r7("CLAUDE_SONNET_4_5"),includeTools:_G4,allowMcp:!1,allowToolbox:!1}},Dr8=Object.keys(D7)});function ND0(J,Q){return new Y0((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 DD0=$1(()=>{s0()});var kG4="builtin://skills",yG4=`# Bookkeeper Skill
|
|
48
48
|
|
|
49
49
|
Use this skill when you need to analyze Excel spreadsheet data.
|
|
50
50
|
|
|
@@ -4021,11 +4021,11 @@ Actual: ${X}`)}async function jU8(J,Q,Y){let{execSync:Z}=await import("node:ch
|
|
|
4021
4021
|
${B}`;if(X==="pnpm"&&B.includes("Unable to find the global bin directory"))M+=`
|
|
4022
4022
|
|
|
4023
4023
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
4024
|
-
npm install -g @sourcegraph/amp`;K(Error(M))}},error:(U)=>{if(!H)H=!0,K(Error(`Failed to spawn ${X}: ${U.message}`))},complete:()=>{if(!H)H=!0,V()}})})}N0();N0();async function V51(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=xU8(J,q),H=W<0,F,U;if(K.time){let B=K.time[J],M=K.time[q],L=Date.now();if(B)F=Math.floor((L-new Date(B).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return v.info("NPM version comparison",{currentVersion:J,latestVersion:q,compareResult:W,hasUpdate:H,currentVersionAge:F,latestVersionAge:U}),{hasUpdate:H,latestVersion:q,currentVersion:J,currentVersionAge:F,latestVersionAge:U,source:"npm"}}catch(X){return v.debug("Error checking npm version",{error:X}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function xU8(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}s0();function K51(J,Q){let Y=new r4,Z=Y.pipe(U8({shouldCountRefs:!1}));return setImmediate(async()=>{let X=new Xq().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 Jj(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=Lw(),W=await V51(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 U=W.currentVersionAge-W.latestVersionAge,B=0.5;if(Math.abs(U)<0.5)return X.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},F=await G51();if(!K)K=F==="pnpm"?"warn":"auto",X.debug("no configured update mode; selected default based on package manager",{packageManager:F,mode:K});if(K==="warn"){if(!H())Y.next("update-available");return}if(!F){if(X.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}if(F==="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 Hp(W.latestVersion,F);let U=await sN(W.latestVersion),B={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")X.info("success",B),Y.next("updated");else X.warn("success with warning",B),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(V){X.debug("check failed",{error:V})}finally{await Jj(5000),Y.next("hidden"),G.unsubscribe(),Y.complete()}}),{state:Z}}rs();import{stderr as LW}from"node:process";function iJ6(J){let Q=new tV().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 Ty1(Z.force||!1,Z.verbose||!1,"0.0.
|
|
4024
|
+
npm install -g @sourcegraph/amp`;K(Error(M))}},error:(U)=>{if(!H)H=!0,K(Error(`Failed to spawn ${X}: ${U.message}`))},complete:()=>{if(!H)H=!0,V()}})})}N0();N0();async function V51(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=xU8(J,q),H=W<0,F,U;if(K.time){let B=K.time[J],M=K.time[q],L=Date.now();if(B)F=Math.floor((L-new Date(B).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return v.info("NPM version comparison",{currentVersion:J,latestVersion:q,compareResult:W,hasUpdate:H,currentVersionAge:F,latestVersionAge:U}),{hasUpdate:H,latestVersion:q,currentVersion:J,currentVersionAge:F,latestVersionAge:U,source:"npm"}}catch(X){return v.debug("Error checking npm version",{error:X}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function xU8(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}s0();function K51(J,Q){let Y=new r4,Z=Y.pipe(U8({shouldCountRefs:!1}));return setImmediate(async()=>{let X=new Xq().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 Jj(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=Lw(),W=await V51(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 U=W.currentVersionAge-W.latestVersionAge,B=0.5;if(Math.abs(U)<0.5)return X.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},F=await G51();if(!K)K=F==="pnpm"?"warn":"auto",X.debug("no configured update mode; selected default based on package manager",{packageManager:F,mode:K});if(K==="warn"){if(!H())Y.next("update-available");return}if(!F){if(X.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}if(F==="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 Hp(W.latestVersion,F);let U=await sN(W.latestVersion),B={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")X.info("success",B),Y.next("updated");else X.warn("success with warning",B),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(V){X.debug("check failed",{error:V})}finally{await Jj(5000),Y.next("hidden"),G.unsubscribe(),Y.complete()}}),{state:Z}}rs();import{stderr as LW}from"node:process";function iJ6(J){let Q=new tV().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 Ty1(Z.force||!1,Z.verbose||!1,"0.0.1766275311-g95fb3f"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new tV("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 vU8(Z.targetVersion)});J.addCommand(Y)}async function vU8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")LW.write(V6.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
4025
4025
|
|
|
4026
4026
|
`));try{if(!J){LW.write(V6.blue(`Checking for updates...
|
|
4027
|
-
`));let Y=Lw(),{hasUpdate:Z,latestVersion:X}=await V51("0.0.
|
|
4028
|
-
`));let V=await sN("0.0.
|
|
4027
|
+
`));let Y=Lw(),{hasUpdate:Z,latestVersion:X}=await V51("0.0.1766275311-g95fb3f",Y);if(!Z){LW.write(V6.green(`✓ Amp CLI is already up to date: ${"0.0.1766275311-g95fb3f"} (${"released"} ${"2025-12-21T00:06:54.623Z"}${`, ${kR(new Date("2025-12-21T00:06:54.623Z"))} ago`})
|
|
4028
|
+
`));let V=await sN("0.0.1766275311-g95fb3f");if(V.warning)LW.write(`
|
|
4029
4029
|
`+V6.yellow(V.warning)+`
|
|
4030
4030
|
`);process.exit(0)}if(!X)LW.write(V6.yellow("[WARN] could not find latest version")),process.exit(0);J=X}LW.write(V6.blue(`Updating to version ${J}...
|
|
4031
4031
|
`)),await Hp(J,void 0,(Y)=>{LW.write(V6.dim(`Running: ${Y}
|
|
@@ -4745,7 +4745,7 @@ Ctrl-X, Y, Z to unlock`;if(U){let c=W.text.replace(/`([^`]+)`/g,"$1")+`
|
|
|
4745
4745
|
`,A)])}),S];if(!q&&!U&&W.url){let b=W.url.replace(/^https?:\/\//,"");f.push(new _5({uri:W.url,text:b,style:new e({color:Y.secondary,underline:!0})}))}if(C&&!U)f.push(C);let m=new Q0({width:40,child:new C0({crossAxisAlignment:"start",mainAxisSize:"min",children:f})});return A4.child(new F6({mainAxisAlignment:"center",crossAxisAlignment:"center",mainAxisSize:"min",children:[new dx1({width:zb1,height:Ub1,agentMode:this.widget.agentMode,glow:this._glow,t:H,fps:0,shockwaves:this._shockwaves,onShockwave:P,...V==="disabled"&&{seed:42}}),new Q0({width:2}),m]}))}}N0();B8();x4();L7();B8();s0();function mC8(J,Q){return`${J}:${Q}`}class Bb1{threadService;workers=new Map;threadsMap=new Map;subthreadsMap=new Map;mainThreadSubs=new Map;subthreadsSubs=new Map;workerStatusSubs=new Map;subthreadPatchSubs=new Map;mainThreadObservable;subthreadObservable;workerStatusObservable;emitMainThread=null;emitSubthread=null;emitWorkerStatus=null;constructor(J){this.threadService=J;this.mainThreadObservable=new Y0((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.subthreadObservable=new Y0((Q)=>{return this.emitSubthread=(Y)=>Q.next(Y),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new Y0((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.subthreadsMap.set(Q,[]),this.workers.set(Q,{state:"initial"});let Y=this.threadService.observePatches(Q).pipe(PL()).subscribe((G)=>{this.threadsMap.set(Q,G);let V=this.subthreadsMap.get(Q)||[],K=this.workers.get(Q)||{state:"initial"};if(this.emitMainThread)this.emitMainThread({threadID:Q,mainThread:G,subthreads:V,workerStatus:K})});this.mainThreadSubs.set(Q,Y);let Z=J.status.subscribe((G)=>{if(this.workers.set(Q,G),this.emitWorkerStatus)this.emitWorkerStatus({threadID:Q,status:G})});this.workerStatusSubs.set(Q,Z);let X=J.subthreads.subscribe((G)=>{this.subthreadsMap.set(Q,G);for(let V of G){let K=mC8(Q,V.toolUse.id);if(this.subthreadPatchSubs.has(K))continue;let q=this.threadService.observePatches(V.threadID).pipe(PL()).subscribe((W)=>{if(this.emitSubthread)this.emitSubthread({threadID:Q,thread:W,subthread:V})});this.subthreadPatchSubs.set(K,q)}});this.subthreadsSubs.set(Q,X)}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);let Z=this.subthreadsSubs.get(J);if(Z)Z.unsubscribe(),this.subthreadsSubs.delete(J);for(let[X,G]of this.subthreadPatchSubs.entries())if(X.startsWith(`${J}:`))G.unsubscribe(),this.subthreadPatchSubs.delete(X);this.workers.delete(J),this.threadsMap.delete(J),this.subthreadsMap.delete(J)}observeThread(J){return{mainThread:new Y0((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),subthreads:new Y0((Q)=>{return this.subthreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new Y0((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]=fO(Y,Z)}return J}dispose(){for(let J of this.mainThreadSubs.values())J.unsubscribe();for(let J of this.subthreadsSubs.values())J.unsubscribe();for(let J of this.workerStatusSubs.values())J.unsubscribe();for(let J of this.subthreadPatchSubs.values())J.unsubscribe();this.mainThreadSubs.clear(),this.subthreadsSubs.clear(),this.workerStatusSubs.clear(),this.subthreadPatchSubs.clear(),this.workers.clear(),this.threadsMap.clear(),this.subthreadsMap.clear()}}function uC8(J,Q){switch(Q.type){case"subthread-patch":{let{thread:Y,subthread:Z}=Q,X=J.subagents[Z.threadID];if(!X){if(X={subThreadID:Y.id,parentToolID:Z.toolUse.id,taskDescription:Z.toolUse.input.description||"Task",isCompleted:!1,agentState:{type:"idle"}},J.mainThread){let W=VQ(J.mainThread);X.isCompleted=KW6(W,Z.toolUse.id)}}let G=pC8(Y,X.agentState),V=X.agentState===G?X:{...X,agentState:G},K={...J.tools},q=kS(Y).items.filter((W)=>W.type==="toolResult");for(let W of q)K[W.id]={id:W.id,subthreadID:Y.id,toolRun:W.toolResult.run,toolUse:W.toolUse};return{subagents:{...J.subagents,[Z.threadID]:V},tools:K,items:J.items,viewState:J.viewState,todosList:J.todosList,mainThread:J.mainThread}}case"main-thread-patch":{let{thread:Y,subthreads:Z,workerStatus:X}=Q,G=VQ(Y),V={...J.subagents};for(let F of Z){let U=V[F.threadID];if(!U)continue;let B=KW6(G,F.toolUse.id);V[F.threadID]={...U,isCompleted:B}}let{items:K}=kS(Y),q=fO(Y,X),W=SU({messages:Y.messages}),H=Array.isArray(W)?W:[];return{...J,subagents:V,items:K,viewState:q,todosList:H,mainThread:Y}}case"worker-status-change":{if(!J.mainThread)return J;let Y=fO(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function kS(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 F=X+1;F<J.messages.length;F++){let U=J.messages[F];if(U){for(let B of U.content)if(B.type==="tool_result"&&B.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":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)??dZ(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}}function KW6(J,Q){let Y=J.get(Q);return(Y&&y7(Y.run))??!1}function pC8(J,Q){let Y=J.messages.at(-1);if(Y?.content.some((X)=>X.type==="tool_result"&&X.run.status==="blocked-on-user"))return v.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(kS(J).items.some((X)=>X.type==="toolResult"&&X.toolResult.run.status==="in-progress")){let X=Q?.type==="running-tools"?Q.startTime:Date.now();return v.info("Subagent status: running-tools",{threadID:J.id,startTime:X,hasStartTime:!!X}),{type:"running-tools",startTime:X}}if(Y&&Y.role==="assistant"&&Y.state.type==="streaming")switch(Y.content.at(-1)?.type){case"text":return v.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return v.info("Subagent status: streaming-thinking",{threadID:J.id}),{type:"streaming-thinking"};case"tool_use":{let G=Q?.type==="running-tools"?Q.startTime:Date.now();return v.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:G,hasStartTime:!!G}),{type:"running-tools",startTime:G}}default:return v.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return v.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class Nb1 extends p0{props;constructor(J){super();this.props=J}createState(){return new qW6}}class qW6 extends m0{state={subagents:{},tools:{},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 Bb1(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((G)=>{this.dispatch({type:"main-thread-patch",thread:G.mainThread,subthreads:G.subthreads,workerStatus:G.workerStatus})});this.subscriptions.push(Y);let Z=Q.subthreads.subscribe((G)=>{this.dispatch({type:"subthread-patch",thread:G.thread,subthread:G.subthread})});this.subscriptions.push(Z);let X=Q.workerStatus.subscribe((G)=>{this.dispatch({type:"worker-status-change",workerStatus:G.status})});this.subscriptions.push(X)}cleanup(){this.subscriptions.forEach((J)=>J.unsubscribe()),this.subscriptions=[]}switchWorker(J){this.cleanup(),this.setState(()=>{this.currentWorker=J}),this.setState(()=>{this.state={subagents:{},tools:{},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=uC8(this.state,J)})}getThreadData(){let J=Object.values(this.state.tools).map((G)=>({toolUse:G.toolUse,toolRun:G.toolRun,subthreadID:G.subthreadID})),Q={};for(let G of Object.values(this.state.subagents)){let V=J.filter((K)=>K.subthreadID===G.subThreadID);Q[G.parentToolID]=V}let Y=(G)=>G===t5||G===A9||G===Kq,Z=new Map;for(let G of this.state.items)if(G.type==="toolResult"&&Y(G.toolUse.name))Z.set(G.toolUse.id,{toolUseId:G.toolUse.id,toolName:G.toolUse.name,toolRun:G.toolResult.run});let X=Array.from(Z.values());for(let{toolUseId:G,toolRun:V}of X){let K=[],q;if(V.status==="in-progress"||V.status==="done"||V.status==="error"||V.status==="cancelled")q=V.progress;if(q){let W=0;for(let H of q)if(H.tool_uses)for(let F of H.tool_uses){let U=`${G}:progress:${W++}`;K.push({toolUse:qP(F.tool_name,F.input,U),toolRun:{status:F.status}})}}Q[G]=K}return{...this.state,subagents:Object.values(this.state.subagents),subagentActiveTools:J,subagentToolsByParentID:Q}}build(J){let Q=this.getThreadData();return this.widget.props.builder(J,Q,this.workerController,(Y)=>this.switchWorker(Y),()=>this.currentWorker,this.recentThreadIDs)}}class Db1 extends p0{props;constructor(J){super({key:J.key});this.props=J}createState(){return new WW6}}class WW6 extends m0{build(J){let Y=q6.of(J).colors,{todos:Z,title:X="TODOs"}=this.widget.props;if(!Array.isArray(Z)||Z.length===0)return new Q0({width:0,height:0});let G=Z.map((V)=>this.buildTodoItem(V,Y));return new f0({child:new B6({padding:W0.symmetric(1,0),child:new C0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new C1({text:new d(X,new e({bold:!0,color:Y.foreground}))}),...G]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),Z=J.status==="completed",X=new e({bold:J.status==="in-progress",color:Q.foreground,dim:Z}),G=new e({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:Z});return new F6({crossAxisAlignment:"start",children:[new C1({text:new d(Y,X)}),new Q0({width:1}),new a6({child:new C1({text:new d(J.content,G)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class Mb1 extends l6{ad;onDismiss;onButtonClick;constructor({key:J,ad:Q,onDismiss:Y,onButtonClick:Z}){super({key:J});this.ad=Q,this.onDismiss=Y,this.onButtonClick=Z}build(J){let Q=q6.of(J),Y=Q.colors.primary,Z=Q.colors.foreground;return new f0({decoration:new C8(void 0,new z4(new G4(Y,1,"rounded"),new G4(Y,1,"rounded"),void 0,new G4(Y,1,"rounded"))),child:new B6({padding:W0.horizontal(1),child:new C0({children:[new F6({crossAxisAlignment:"start",children:[new a6({child:new C1({text:new d(this.ad.content,new e({color:Z}))})}),new Q0({width:4}),new _5({uri:"https://ampcode.com/free",text:"Ad",style:new e({color:Z,dim:!0})})]}),new F6({crossAxisAlignment:"start",children:[new ex1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:W0.horizontal(1),color:Y,reverse:!0}),new Q0({width:2}),new C1({text:new d(this.ad.destinationUrlHostname,new e({color:Z,dim:!0}))})]})]})})})}}class Lb1 extends p0{props;constructor(J){super();this.props=J}createState(){return new HW6(this.props.autofocus??!0)}}class HW6 extends m0{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=E4.sizeOf(J),Z=Math.min(60,Y.width-4),X=Y.height-4,G=[];if(this.widget.props.title)G.push(new C1({text:new d(this.widget.props.title,new e({bold:!0,color:B1.blue}))}),new Q0({height:1}));if(this.widget.props.message)G.push(new C1({text:new d(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)G.push(new Q0({height:1}));let V=[];if(this.widget.props.showCopyOption)V.push(new C1({text:new d("Enter to copy",new e({dim:!0}))}));return V.push(new C1({text:new d("Escape to close",new e({dim:!0}))})),G.push(new F6({children:V.flatMap((K,q)=>q<V.length-1?[K,new Q0({width:1}),new C1({text:new d("•",new e({dim:!0}))}),new Q0({width:1})]:[K]),mainAxisSize:"min"})),new A4({child:new f0({constraints:new M6(Z,Z,0,X),decoration:new C8(B1.default(),new z4(new G4(B1.blue,1,"rounded"),new G4(B1.blue,1,"rounded"),new G4(B1.blue,1,"rounded"),new G4(B1.blue,1,"rounded"))),padding:new W0(2,2,2,2),child:new z8({autofocus:this.autofocus,onKey:Q,child:new C0({children:G,mainAxisSize:"min"})})})})}}function Ab1(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})}oH();N0();import{spawn as dC8}from"node:child_process";import{promises as cC8}from"node:fs";function FW6(J){return J.kind==="executable"}function zW6(J){return J.kind==="markdown"}var Mz=50000,UW6=300000;async function Ob1(J,Q,Y,Z={}){let{timeoutMs:X=UW6,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(v.debug("Executing command",{commandName:J,filePath:K.filePath,args:Q}),zW6(K))return await lC8(K,Q);else if(FW6(K))return await nC8(K,Q,X,G);else return{success:!1,output:"",error:"Unsupported command type"}}catch(K){return v.error("Failed to execute command",{commandName:J,error:K}),{success:!1,output:"",error:K instanceof Error?K.message:"Unknown error occurred"}}}async function lC8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await cC8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>Mz?Y.slice(0,Mz)+`
|
|
4746
4746
|
... (output truncated at ${Mz} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function nC8(J,Q,Y=UW6,Z){return new Promise((X)=>{let[G,V]=iC8(J,Q);v.debug("Spawning command",{spawnCommand:G,spawnArgs:V.slice(0,10),filePath:J.filePath,timeoutMs:Y});let K=KC0(Z),q=!1,W=setTimeout(()=>{q=!0,K.abort(),v.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=dC8(G,V,{stdio:["pipe","pipe","pipe"],signal:K.signal,detached:!0}),F=[],U=[],B=0;H.stdout?.on("data",(M)=>{let L=M.toString();if(B+=L.length,B<=Mz)F.push(L);else{let A=Mz-(B-L.length);if(A>0)F.push(L.slice(0,A))}}),H.stderr?.on("data",(M)=>{let L=M.toString();if(B+=L.length,B<=Mz)U.push(L);else{let A=Mz-(B-L.length);if(A>0)U.push(L.slice(0,A))}}),H.on("close",(M)=>{if(clearTimeout(W),q){X({success:!1,output:F.join(""),error:`Command timed out after ${Y}ms`,exitCode:void 0});return}if(K.signal.aborted){X({success:!1,output:F.join(""),error:"The command was aborted",exitCode:M??void 0});return}let L=M===0||M===1,A=F.join(""),w=U.join(""),E=A;if(!L&&!A.trim()&&w.trim())E=w;else if(w.trim())E+=A?`
|
|
4747
4747
|
${w}`:w;if(B>Mz)E+=`
|
|
4748
|
-
... (output truncated at ${Mz} characters)`;X({success:L,output:E.trim(),error:!L?w.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(q)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";X({success:!1,output:F.join(""),error:L})})})}function iC8(J,Q){let{filePath:Y,interpreter:Z,extension:X}=J;if(process.platform==="win32")return oC8(Y,Z?[...Z]:null,X,Q);else return aC8(Y,Z?[...Z]:null,X,Q)}function aC8(J,Q,Y,Z){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Z]];else return[J,Z]}function oC8(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]}}N0();ne();A$();q7();CR();hH();NQ();f$();rH();fq();B8();Im();L7();_y();s0();var lW6=Q6(EB(),1);import{writeFile as mW6}from"fs/promises";import uW6 from"path";N0();NQ();class wb1{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.1766260872-g384001"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await Ut(Q,this.configService)}catch(Q){v.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 RD extends p0{props;constructor(J){super();this.props=J}createState(){return new BW6}}class BW6 extends m0{_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 NW6 extends m0{controller=new LZ;focusNode=new M8({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=q6.of(J),{colors:Y,app:Z}=Q,X=this.widget.props.isRequiredArg??!0,G=this.controller.text.trim().length>0,V=!X||G,K=z4.all(new G4(Y.foreground,1,"solid")),q=new qz({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(B)=>{let M=B.trim();if(X&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new F6({children:[new f0({decoration:{color:B1.default()},child:new C1({text:new d(">",new e({color:Y.foreground}))})}),new a6({child:q})]}),H=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d("",void 0,[new d("Command: ",new e({color:Y.foreground})),new d(this.widget.props.commandName,new e({color:B1.yellow,bold:!0}))])})}),F=[];if(V)F.push(new d("Enter",new e({color:Z.keybind}))),F.push(new d(" to submit, ",new e({color:Y.foreground,dim:!0})));F.push(new d("Esc",new e({color:Z.keybind}))),F.push(new d(" to cancel",new e({color:Y.foreground,dim:!0})));let U=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d("",void 0,F)})});return new f0({decoration:{border:K,color:B1.default()},padding:W0.all(1),child:new C0({children:[H,new Q0({height:1}),W,new l5,U]})})}}class Ed extends p0{props;constructor(J){super();this.props=J}createState(){return new NW6}}rH();class DW6 extends m0{controller=new LZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new M8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=XB)return!1;let Q=YS(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=q6.of(J),{colors:Y,app:Z}=Q,G=E4.of(J).size.height,V=Math.max(Math.floor(G*0.5),10),K=new tw({controller:this.controller,triggers:[new vW],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(B)=>{this.widget.props.onSubmit(B.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:E8.instance.tuiInstance.clipboard,autoOverlayPosition:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),q=new z8({focusNode:this.focusNode,child:K}),W=new f0({constraints:new M6({maxHeight:V}),padding:W0.symmetric(1,0),child:q}),H=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d("",void 0,[new d("Command: ",new e({color:Y.foreground})),new d(this.widget.props.commandName,new e({color:B1.yellow,bold:!0}))])})}),F=new f0({padding:W0.symmetric(1,0),child:new C1({text:this.isConfirmingClearInput?new d("",void 0,[new d("Esc",new e({color:Z.keybind})),new d(" again to clear input",new e({color:Y.foreground,dim:!0}))]):new d("",void 0,[new d("Press ",new e({color:Y.foreground,dim:!0})),new d("Enter",new e({color:Z.keybind})),new d(" to submit, ",new e({color:Y.foreground,dim:!0})),new d("Esc",new e({color:Z.keybind})),new d(" to clear",new e({color:Y.foreground,dim:!0}))])})}),U=[H,new Q0({height:1}),new a6({child:W}),new Q0({height:1}),F];return new f0({decoration:{border:z4.all(new G4(Y.foreground,1,"solid")),color:B1.default()},padding:W0.all(1),child:new C0({children:U})})}}class Ib1 extends p0{props;constructor(J){super();this.props=J}createState(){return new DW6}}import{isDeepStrictEqual as eC8}from"node:util";var rC8=/[\\/_ +.#"@[({&]/,sC8=/[\\/_ +.#"@[({&]/g,tC8=/[\s-]/,MW6=/[\s-]/g;function Z21(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,F,U,B,M;while(W>=0){if(F=Z21(J,Q,Y,Z,W+1,G+1,V),F>H){if(W===X)F*=1;else if(tC8.test(J.charAt(W-1))){if(F*=0.9,M=J.slice(X,W-1).match(MW6),M&&X>0)F*=Math.pow(0.999,M.length)}else if(rC8.test(J.charAt(W-1))){if(F*=0.8,B=J.slice(X,W-1).match(sC8),B&&X>0)F*=Math.pow(0.999,B.length)}else if(F*=0.3,X>0)F*=Math.pow(0.999,W-X);if(J.charAt(W)!==Q.charAt(G))F*=0.9999}if(F<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(U=Z21(J,Q,Y,Z,W+1,G+2,V),U*0.1>F)F=U*0.1}if(F>H)H=F;W=Y.indexOf(q,W+1)}return V[K]=H,H}function Y21(J){return J.toLowerCase().replace(MW6," ")}function LW6(J,Q){let Y=Z21(J,Q,Y21(J),Y21(Q),0,0,{}),Z=Q.trim().split(/\s+/);if(Z.length>1){let X=0,G=0;for(let K of Z){let q=Z21(J,K,Y21(J),Y21(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 yS{}class xS{}class X21{}class $21{}class AW6 extends p0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new OW6}}class OW6 extends m0{build(J){return this.widget.onContext(J),this.widget.child}}function Jj8(J,Q){if(J==="")return{matches:!0,score:1};let Y=LW6(Q,J);return{matches:Y>0.15,score:Y}}class QJ extends p0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new wW6}}class wW6 extends m0{controller=new LZ;focusNode;scrollController=new O5;selectedIndex=0;itemContexts=[];cachedQuery="";cachedItemsRef=null;cachedFiltered=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new M8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.recomputeFilteredItems(),this.setState(),n8.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(!eC8(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 yS){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),n8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof xS){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),n8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof X21){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 $21)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,...Jj8(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;j71(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(),n8.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=q6.of(J),{colors:Y}=Q,Z=this.getFilteredItems(),X=z4.all(new G4(Y.foreground,1,"solid")),G=this.widget.props.enabled??!0,V=new qz({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:G,style:{textColor:Y.foreground,border:null},maxLines:1}),K=new xX({shortcuts:new Map([[new D4("ArrowDown"),new yS],[new D4("ArrowUp"),new xS],[new D4("Tab"),new yS],[new D4("Tab",{shift:!0}),new xS],[new D4("n",{ctrl:!0}),new yS],[new D4("p",{ctrl:!0}),new xS],[new D4("Enter"),new X21],[new D4("Escape"),new $21]]),focusNode:this.focusNode,child:V}),q=new yJ({actions:new Map([[yS,new j8(this.invoke)],[xS,new j8(this.invoke)],[X21,new j8(this.invoke)],[$21,new j8(this.invoke)]]),child:K}),W=new F6({children:[new f0({decoration:{color:B1.default()},child:new C1({text:new d(">",new e({color:Y.foreground}))})}),new a6({child:q})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new Q0({height:10,child:new A4({child:new C1({text:new d(L,new e({color:Y.foreground}))})})})}else if(Z.length===0&&this.widget.props.emptyStateText)H=new a6({child:new A4({child:new C1({text:new d(this.widget.props.emptyStateText,new e({color:Y.foreground,dim:!0}))})})});else{let L=Z.map((A,w)=>{let E=w===this.selectedIndex,P=this.widget.props.isItemDisabled?.(A)??!1,R;if(this.widget.props.renderItem)R=this.widget.props.renderItem(A,E,P,J);else{let C=E?B1.yellow:void 0,S=E?B1.black:Y.foreground;R=new f0({decoration:C?{color:C}:void 0,padding:W0.symmetric(2,0),child:new C1({text:new d(this.widget.props.getLabel(A),new e({color:S,dim:P}))})})}return new AW6(new L8({onClick:(C)=>this.handleItemClick(w,C.clickCount),child:R}),(C)=>{this.itemContexts[w]=C})});H=new C0({children:L,crossAxisAlignment:"start"})}let F=new a6({child:new L8({onScroll:this.handleScroll,opaque:!1,child:new J5({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d(this.widget.props.title,new e({color:B1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new Q0({height:1}),F),this.controller.text!==""){let L=Z.length>0?Z[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new f0({padding:W0.vertical(1),child:new A4({child:A})}));else U.push(new Q0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new f0({decoration:{border:X,color:B1.default()},padding:W0.symmetric(1,0),child:new C0({children:U})})}}function IW6(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 Eb1 extends l6{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)=>IW6(X.pubDate).length));return new QJ({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=q6.of(K),{colors:W}=q,H=G?B1.yellow:void 0,F=G?B1.black:W.foreground,U=B1.index(8),B=(M,L)=>new Q0({width:L,child:F6.end([new C1({text:new d(M,new e({color:U}))})])});return new f0({decoration:H?{color:H}:void 0,padding:W0.symmetric(2,0),child:new F6({children:[new a6({child:new C1({text:new d(X.title,new e({color:F})),overflow:"ellipsis",maxLines:1})}),new Q0({width:2}),B(IW6(X.pubDate),Y)]})})}})}}class Pb1 extends p0{createState(){return new EW6}}class EW6 extends m0{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 C1({text:new d("●",new e({color:this.isGreen?B1.green:B1.index(8),bold:!0})),maxLines:1})}}function Qj8(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 fX.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 Rb1(J,Q,Y){return new C1({text:new d(`${J}${Q}`,new e({color:Y})),maxLines:1})}function Yj8(J,Q,Y,Z){return[Rb1("+",J,Z.success),l5.horizontal(1),Rb1("~",Q,Z.warning),l5.horizontal(1),Rb1("-",Y,Z.destructive)]}class G21 extends l6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((F)=>F.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((F)=>F.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],Z=new Set(Y),X=this.props.currentThreadID,G=[...Q].sort((F,U)=>{if(X){if(F.id===X)return-1;if(U.id===X)return 1}let B=Y.indexOf(F.id),M=Y.indexOf(U.id);if(B!==-1&&M!==-1)return B-M;if(B!==-1)return-1;if(M!==-1)return 1;return 0}),V=Qj8(G),K=Math.max(0,...V.map((F)=>F.description.timeAgo.length)),q=q6.of(J),W=new B6({padding:W0.symmetric(0,1),child:new A4({child:new C1({text:new d("",new e({color:q.colors.foreground,dim:!0}),[new d("Ctrl+T",new e({color:B1.blue,dim:!0})),new d(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new e({color:q.colors.foreground,dim:!0}))])})})});return new QJ({items:V,getLabel:(F)=>F.title,onAccept:(F)=>this.props.onSelect?.(F.id),onDismiss:this.props.onDismiss,onSelectionChange:(F)=>{if(this.props.previewController){if(F)this.props.previewController.select(F.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:(F,U,B,M)=>{let L=q6.of(M),{colors:A}=L,w=U?B1.yellow:void 0,E=U?B1.black:A.foreground,P=B1.index(8),R=(r,p)=>new Q0({width:p,child:F6.end([new C1({text:new d(r,new e({color:P}))})])}),C=this.props.threadViewStates[F.id],S=[],k=F.relationshipType==="handoff",f=new Y31;if(F.depth>0){let r=[],p=F.ancestorsAreLast.slice(1);for(let Y1 of p)r.push(new d(f.getAncestorPrefix(Y1),new e({color:f.connectorColor,dim:f.connectorDim})));let s=F.isLast?f.elbow:f.tee,Q1=f.getConnectorText(s);r.push(new d(Q1,new e({color:f.connectorColor,dim:f.connectorDim}))),S.push(new C1({text:new d("",void 0,r)}))}let m=[],b=X===F.id?new d("(current) ",new e({color:B1.green})):Z.has(F.id)?new d("(visited) ",new e({color:A.foreground,dim:!0})):null;if(b)m.push(new C1({text:b}));if(C){if(C.state==="active"&&(C.interactionState==="tool-running"||C.inferenceState==="running"))m.push(new Pb1),m.push(new Q0({width:1}))}let c=F.title;if(F.relationshipType==="fork"){let r=c.match(/^Forked\((\d+)\): /);if(r)c=c.slice(r[0].length);else while(c.startsWith("Forked: "))c=c.slice(8);m.push(new C1({text:new d("[fork] ",new e({color:B1.blue}))}))}else if(k)m.push(new C1({text:new d("[handoff] ",new e({color:B1.index(208)}))}));if(m.push(new a6({child:new C1({text:new d(c,new e({color:E})),overflow:"ellipsis",maxLines:1})})),m.push(new Q0({width:2})),F.diffStats&&(F.diffStats.added>0||F.diffStats.changed>0||F.diffStats.deleted>0)){let r=U?{success:P,warning:P,destructive:P}:A;m.push(...Yj8(F.diffStats.added,F.diffStats.changed,F.diffStats.deleted,r)),m.push(new Q0({width:2}))}return m.push(R(F.description.timeAgo,K)),new f0({decoration:w?{color:w}:void 0,padding:W0.symmetric(2,0),child:new F6({children:[...S,...m]})})}})}}class Tb1 extends l6{props;constructor(J){super();this.props=J}build(){return new A4({child:new C1({text:new d("",void 0,[new d(`Forked to new thread:
|
|
4748
|
+
... (output truncated at ${Mz} characters)`;X({success:L,output:E.trim(),error:!L?w.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(q)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";X({success:!1,output:F.join(""),error:L})})})}function iC8(J,Q){let{filePath:Y,interpreter:Z,extension:X}=J;if(process.platform==="win32")return oC8(Y,Z?[...Z]:null,X,Q);else return aC8(Y,Z?[...Z]:null,X,Q)}function aC8(J,Q,Y,Z){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Z]];else return[J,Z]}function oC8(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]}}N0();ne();A$();q7();CR();hH();NQ();f$();rH();fq();B8();Im();L7();_y();s0();var lW6=Q6(EB(),1);import{writeFile as mW6}from"fs/promises";import uW6 from"path";N0();NQ();class wb1{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.1766275311-g95fb3f"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await Ut(Q,this.configService)}catch(Q){v.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 RD extends p0{props;constructor(J){super();this.props=J}createState(){return new BW6}}class BW6 extends m0{_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 NW6 extends m0{controller=new LZ;focusNode=new M8({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=q6.of(J),{colors:Y,app:Z}=Q,X=this.widget.props.isRequiredArg??!0,G=this.controller.text.trim().length>0,V=!X||G,K=z4.all(new G4(Y.foreground,1,"solid")),q=new qz({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(B)=>{let M=B.trim();if(X&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new F6({children:[new f0({decoration:{color:B1.default()},child:new C1({text:new d(">",new e({color:Y.foreground}))})}),new a6({child:q})]}),H=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d("",void 0,[new d("Command: ",new e({color:Y.foreground})),new d(this.widget.props.commandName,new e({color:B1.yellow,bold:!0}))])})}),F=[];if(V)F.push(new d("Enter",new e({color:Z.keybind}))),F.push(new d(" to submit, ",new e({color:Y.foreground,dim:!0})));F.push(new d("Esc",new e({color:Z.keybind}))),F.push(new d(" to cancel",new e({color:Y.foreground,dim:!0})));let U=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d("",void 0,F)})});return new f0({decoration:{border:K,color:B1.default()},padding:W0.all(1),child:new C0({children:[H,new Q0({height:1}),W,new l5,U]})})}}class Ed extends p0{props;constructor(J){super();this.props=J}createState(){return new NW6}}rH();class DW6 extends m0{controller=new LZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new M8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=XB)return!1;let Q=YS(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=q6.of(J),{colors:Y,app:Z}=Q,G=E4.of(J).size.height,V=Math.max(Math.floor(G*0.5),10),K=new tw({controller:this.controller,triggers:[new vW],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(B)=>{this.widget.props.onSubmit(B.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:E8.instance.tuiInstance.clipboard,autoOverlayPosition:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),q=new z8({focusNode:this.focusNode,child:K}),W=new f0({constraints:new M6({maxHeight:V}),padding:W0.symmetric(1,0),child:q}),H=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d("",void 0,[new d("Command: ",new e({color:Y.foreground})),new d(this.widget.props.commandName,new e({color:B1.yellow,bold:!0}))])})}),F=new f0({padding:W0.symmetric(1,0),child:new C1({text:this.isConfirmingClearInput?new d("",void 0,[new d("Esc",new e({color:Z.keybind})),new d(" again to clear input",new e({color:Y.foreground,dim:!0}))]):new d("",void 0,[new d("Press ",new e({color:Y.foreground,dim:!0})),new d("Enter",new e({color:Z.keybind})),new d(" to submit, ",new e({color:Y.foreground,dim:!0})),new d("Esc",new e({color:Z.keybind})),new d(" to clear",new e({color:Y.foreground,dim:!0}))])})}),U=[H,new Q0({height:1}),new a6({child:W}),new Q0({height:1}),F];return new f0({decoration:{border:z4.all(new G4(Y.foreground,1,"solid")),color:B1.default()},padding:W0.all(1),child:new C0({children:U})})}}class Ib1 extends p0{props;constructor(J){super();this.props=J}createState(){return new DW6}}import{isDeepStrictEqual as eC8}from"node:util";var rC8=/[\\/_ +.#"@[({&]/,sC8=/[\\/_ +.#"@[({&]/g,tC8=/[\s-]/,MW6=/[\s-]/g;function Z21(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,F,U,B,M;while(W>=0){if(F=Z21(J,Q,Y,Z,W+1,G+1,V),F>H){if(W===X)F*=1;else if(tC8.test(J.charAt(W-1))){if(F*=0.9,M=J.slice(X,W-1).match(MW6),M&&X>0)F*=Math.pow(0.999,M.length)}else if(rC8.test(J.charAt(W-1))){if(F*=0.8,B=J.slice(X,W-1).match(sC8),B&&X>0)F*=Math.pow(0.999,B.length)}else if(F*=0.3,X>0)F*=Math.pow(0.999,W-X);if(J.charAt(W)!==Q.charAt(G))F*=0.9999}if(F<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(U=Z21(J,Q,Y,Z,W+1,G+2,V),U*0.1>F)F=U*0.1}if(F>H)H=F;W=Y.indexOf(q,W+1)}return V[K]=H,H}function Y21(J){return J.toLowerCase().replace(MW6," ")}function LW6(J,Q){let Y=Z21(J,Q,Y21(J),Y21(Q),0,0,{}),Z=Q.trim().split(/\s+/);if(Z.length>1){let X=0,G=0;for(let K of Z){let q=Z21(J,K,Y21(J),Y21(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 yS{}class xS{}class X21{}class $21{}class AW6 extends p0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new OW6}}class OW6 extends m0{build(J){return this.widget.onContext(J),this.widget.child}}function Jj8(J,Q){if(J==="")return{matches:!0,score:1};let Y=LW6(Q,J);return{matches:Y>0.15,score:Y}}class QJ extends p0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new wW6}}class wW6 extends m0{controller=new LZ;focusNode;scrollController=new O5;selectedIndex=0;itemContexts=[];cachedQuery="";cachedItemsRef=null;cachedFiltered=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new M8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.recomputeFilteredItems(),this.setState(),n8.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(!eC8(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 yS){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),n8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof xS){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),n8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof X21){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 $21)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,...Jj8(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;j71(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(),n8.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=q6.of(J),{colors:Y}=Q,Z=this.getFilteredItems(),X=z4.all(new G4(Y.foreground,1,"solid")),G=this.widget.props.enabled??!0,V=new qz({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:G,style:{textColor:Y.foreground,border:null},maxLines:1}),K=new xX({shortcuts:new Map([[new D4("ArrowDown"),new yS],[new D4("ArrowUp"),new xS],[new D4("Tab"),new yS],[new D4("Tab",{shift:!0}),new xS],[new D4("n",{ctrl:!0}),new yS],[new D4("p",{ctrl:!0}),new xS],[new D4("Enter"),new X21],[new D4("Escape"),new $21]]),focusNode:this.focusNode,child:V}),q=new yJ({actions:new Map([[yS,new j8(this.invoke)],[xS,new j8(this.invoke)],[X21,new j8(this.invoke)],[$21,new j8(this.invoke)]]),child:K}),W=new F6({children:[new f0({decoration:{color:B1.default()},child:new C1({text:new d(">",new e({color:Y.foreground}))})}),new a6({child:q})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new Q0({height:10,child:new A4({child:new C1({text:new d(L,new e({color:Y.foreground}))})})})}else if(Z.length===0&&this.widget.props.emptyStateText)H=new a6({child:new A4({child:new C1({text:new d(this.widget.props.emptyStateText,new e({color:Y.foreground,dim:!0}))})})});else{let L=Z.map((A,w)=>{let E=w===this.selectedIndex,P=this.widget.props.isItemDisabled?.(A)??!1,R;if(this.widget.props.renderItem)R=this.widget.props.renderItem(A,E,P,J);else{let C=E?B1.yellow:void 0,S=E?B1.black:Y.foreground;R=new f0({decoration:C?{color:C}:void 0,padding:W0.symmetric(2,0),child:new C1({text:new d(this.widget.props.getLabel(A),new e({color:S,dim:P}))})})}return new AW6(new L8({onClick:(C)=>this.handleItemClick(w,C.clickCount),child:R}),(C)=>{this.itemContexts[w]=C})});H=new C0({children:L,crossAxisAlignment:"start"})}let F=new a6({child:new L8({onScroll:this.handleScroll,opaque:!1,child:new J5({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d(this.widget.props.title,new e({color:B1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new Q0({height:1}),F),this.controller.text!==""){let L=Z.length>0?Z[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new f0({padding:W0.vertical(1),child:new A4({child:A})}));else U.push(new Q0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new f0({decoration:{border:X,color:B1.default()},padding:W0.symmetric(1,0),child:new C0({children:U})})}}function IW6(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 Eb1 extends l6{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)=>IW6(X.pubDate).length));return new QJ({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=q6.of(K),{colors:W}=q,H=G?B1.yellow:void 0,F=G?B1.black:W.foreground,U=B1.index(8),B=(M,L)=>new Q0({width:L,child:F6.end([new C1({text:new d(M,new e({color:U}))})])});return new f0({decoration:H?{color:H}:void 0,padding:W0.symmetric(2,0),child:new F6({children:[new a6({child:new C1({text:new d(X.title,new e({color:F})),overflow:"ellipsis",maxLines:1})}),new Q0({width:2}),B(IW6(X.pubDate),Y)]})})}})}}class Pb1 extends p0{createState(){return new EW6}}class EW6 extends m0{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 C1({text:new d("●",new e({color:this.isGreen?B1.green:B1.index(8),bold:!0})),maxLines:1})}}function Qj8(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 fX.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 Rb1(J,Q,Y){return new C1({text:new d(`${J}${Q}`,new e({color:Y})),maxLines:1})}function Yj8(J,Q,Y,Z){return[Rb1("+",J,Z.success),l5.horizontal(1),Rb1("~",Q,Z.warning),l5.horizontal(1),Rb1("-",Y,Z.destructive)]}class G21 extends l6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((F)=>F.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((F)=>F.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],Z=new Set(Y),X=this.props.currentThreadID,G=[...Q].sort((F,U)=>{if(X){if(F.id===X)return-1;if(U.id===X)return 1}let B=Y.indexOf(F.id),M=Y.indexOf(U.id);if(B!==-1&&M!==-1)return B-M;if(B!==-1)return-1;if(M!==-1)return 1;return 0}),V=Qj8(G),K=Math.max(0,...V.map((F)=>F.description.timeAgo.length)),q=q6.of(J),W=new B6({padding:W0.symmetric(0,1),child:new A4({child:new C1({text:new d("",new e({color:q.colors.foreground,dim:!0}),[new d("Ctrl+T",new e({color:B1.blue,dim:!0})),new d(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new e({color:q.colors.foreground,dim:!0}))])})})});return new QJ({items:V,getLabel:(F)=>F.title,onAccept:(F)=>this.props.onSelect?.(F.id),onDismiss:this.props.onDismiss,onSelectionChange:(F)=>{if(this.props.previewController){if(F)this.props.previewController.select(F.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:(F,U,B,M)=>{let L=q6.of(M),{colors:A}=L,w=U?B1.yellow:void 0,E=U?B1.black:A.foreground,P=B1.index(8),R=(r,p)=>new Q0({width:p,child:F6.end([new C1({text:new d(r,new e({color:P}))})])}),C=this.props.threadViewStates[F.id],S=[],k=F.relationshipType==="handoff",f=new Y31;if(F.depth>0){let r=[],p=F.ancestorsAreLast.slice(1);for(let Y1 of p)r.push(new d(f.getAncestorPrefix(Y1),new e({color:f.connectorColor,dim:f.connectorDim})));let s=F.isLast?f.elbow:f.tee,Q1=f.getConnectorText(s);r.push(new d(Q1,new e({color:f.connectorColor,dim:f.connectorDim}))),S.push(new C1({text:new d("",void 0,r)}))}let m=[],b=X===F.id?new d("(current) ",new e({color:B1.green})):Z.has(F.id)?new d("(visited) ",new e({color:A.foreground,dim:!0})):null;if(b)m.push(new C1({text:b}));if(C){if(C.state==="active"&&(C.interactionState==="tool-running"||C.inferenceState==="running"))m.push(new Pb1),m.push(new Q0({width:1}))}let c=F.title;if(F.relationshipType==="fork"){let r=c.match(/^Forked\((\d+)\): /);if(r)c=c.slice(r[0].length);else while(c.startsWith("Forked: "))c=c.slice(8);m.push(new C1({text:new d("[fork] ",new e({color:B1.blue}))}))}else if(k)m.push(new C1({text:new d("[handoff] ",new e({color:B1.index(208)}))}));if(m.push(new a6({child:new C1({text:new d(c,new e({color:E})),overflow:"ellipsis",maxLines:1})})),m.push(new Q0({width:2})),F.diffStats&&(F.diffStats.added>0||F.diffStats.changed>0||F.diffStats.deleted>0)){let r=U?{success:P,warning:P,destructive:P}:A;m.push(...Yj8(F.diffStats.added,F.diffStats.changed,F.diffStats.deleted,r)),m.push(new Q0({width:2}))}return m.push(R(F.description.timeAgo,K)),new f0({decoration:w?{color:w}:void 0,padding:W0.symmetric(2,0),child:new F6({children:[...S,...m]})})}})}}class Tb1 extends l6{props;constructor(J){super();this.props=J}build(){return new A4({child:new C1({text:new d("",void 0,[new d(`Forked to new thread:
|
|
4749
4749
|
|
|
4750
4750
|
`,new e({color:B1.white,dim:!0})),new d(`"${this.props.newThreadTitle||"Untitled"}"`,new e({color:B1.white}))]),textAlign:"center"})})}}N0();class PW6 extends m0{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){v.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){v.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=q6.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 QJ({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,F)=>{let U=W?B1.yellow:void 0,B=W?B1.black:Y.foreground;if("__isCreateMarker"in q&&q.__isCreateMarker){let L=this.currentQuery.trim().toLowerCase();return new f0({decoration:U?{color:U}:void 0,padding:W0.symmetric(2,0),child:new C1({text:new d("",void 0,[new d("Create new label: ",new e({color:B})),new d(L,new e({color:B,bold:!0}))])})})}return new f0({decoration:U?{color:U}:void 0,padding:W0.symmetric(2,0),child:new C1({text:new d(q.name,new e({color:B}))})})},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 F=W.trim().toLowerCase();return F.length===0||q.name.includes(F)},sortItems:(q,W,H)=>{let F="__isCreateMarker"in q.item&&q.item.__isCreateMarker,U="__isCreateMarker"in W.item&&W.item.__isCreateMarker;if(F&&!U)return-1;if(!F&&U)return 1;return W.score-q.score}})}}class Cb1 extends p0{props;constructor(J){super();this.props=J}createState(){return new PW6}}class TD extends p0{props;constructor(J){super();this.props=J}createState(){return new RW6}}class RW6 extends m0{_spinner=new MY;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=q6.of(J),{colors:Y}=Q,Z=z4.all(new G4(Y.foreground,1,"solid")),X=this._spinner.toBraille(),G=new C1({textAlign:"center",text:new d("",void 0,[new d(X,new e({color:B1.yellow})),new d(" ",void 0),new d(this.widget.props.message,new e({color:Y.foreground}))])}),K=[new a6({child:new C0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[G]})})];if(this.widget.props.onAbort)K.push(new Q0({height:2,child:new f0({padding:W0.symmetric(2,0),child:new C1({text:new d("",new e({dim:!0}),[new d("Press ",new e({color:Y.foreground})),new d("Esc",new e({color:Y.info})),new d(" to cancel",new e({color:Y.foreground}))])})})}));let q=new f0({decoration:new C8(B1.default(),Z),child:new Q0({width:60,height:7,child:new C0({mainAxisAlignment:"start",children:K})})});if(this.widget.props.onAbort)return new z8({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:q});return q}}class ew extends p0{props;constructor(J){super();this.props=J}createState(){return new TW6}}class TW6 extends m0{scrollController=new O5;scrollAreaKey=new RQ("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 hX}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=q6.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=t71(Y);return{title:H.title,type:H.type,description:H.description}})(),X=Z.type==="error"?B1.red:B1.yellow,G=z4.all(new G4(B1.default(),1,"solid")),V=new f0({padding:W0.symmetric(1,0),child:new C1({text:new d(Z.title,new e({color:X,bold:!0}))})}),K=this.isWidgetMessage(Y)?Y.widget:new C1({text:new d(Z.description,new e({color:B1.default()})),selectable:!0}),q=new a6({child:new Vz({child:new f0({padding:W0.symmetric(1,0),child:new F6({key:this.scrollAreaKey,crossAxisAlignment:"stretch",children:[new a6({child:new J5({controller:this.scrollController,autofocus:!0,child:K})}),new R2({controller:this.scrollController,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack,getScrollInfo:()=>{let H=this.scrollController.maxScrollExtent,F=this.scrollController.offset,U=this.getViewportHeight(),B=H+U;return{totalContentHeight:Math.max(B,0),viewportHeight:Math.max(U,1),scrollOffset:Math.max(F,0)}}})]})})})}),W=new f0({padding:W0.symmetric(1,0),child:new C1({text:this.widget.props.onRetry?new d("",void 0,[new d("Press ",new e({color:B1.default(),dim:!0})),new d("R",new e({color:B1.yellow})),new d(" to retry, ",new e({color:B1.default(),dim:!0})),new d("Esc",new e({color:B1.yellow})),new d(" to cancel",new e({color:B1.default(),dim:!0}))]):new d("Press any key to close",new e({color:B1.default(),dim:!0,italic:!0}))})});return new z8({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 f0({decoration:{border:G,color:B1.default()},padding:W0.all(1),child:new C0({mainAxisAlignment:"center",children:[V,new Q0({height:1}),q,W]})})})}}class jb1 extends l6{build(){return new A4({child:new C1({text:new d("",void 0,[new d(`✓ Thread Shared
|
|
4751
4751
|
|
|
@@ -4856,7 +4856,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
|
|
|
4856
4856
|
`)?`${K}...`:X,W=new e({color:B1.index(8)}),H=[new d(q,W)];if(V>0){let F=new e({color:Y.success});for(let U=1;U<=V;U++)H.push(new d(" ")),H.push(new d(`[${U}]`,F))}return new B6({padding:W0.only({bottom:0}),child:new F6({crossAxisAlignment:"start",children:[new B6({padding:W0.only({right:1}),child:new C1({text:new d("•",new e({color:B1.index(8)}))})}),new a6({child:new C1({text:new d("",void 0,H)})})]})})}}class Ag1 extends p0{createState(){return new gH6}}class gH6 extends m0{_animationTimer;_visible=!0;initState(){super.initState(),this._startAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._visible=!this._visible})},500)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let Q=new e({color:B1.red}),Y=new e({color:this._visible?B1.red:B1.transparent()});return new F6({children:[new C1({text:new d("⏺",Y)}),new Q0({width:1}),new C1({text:new d("Replay",Q)})]})}}s0();function IS8(J){let Y=new Date().getTime()-J.getTime(),Z=Math.floor(Y/3600000),X=Math.floor(Z/24),G=Math.floor(X/7),V=Math.floor(X/30);if(Z<1)return"Just now";if(Z<24)return`${Z}h ago`;if(X<7)return`${X}d ago`;if(G<=4)return`${G}w ago`;return`${V}mo ago`}class Og1{threadHistoryService;constructor(J){this.threadHistoryService=J}async fetchThreadSummaries(J=""){try{let Q=await new Promise((Y)=>{let Z=this.threadHistoryService.observeThreadList().subscribe((X)=>{Z.unsubscribe(),Y(X)})});return{ok:!0,threads:this.formatThreadSummaries(Q,J)}}catch(Q){return{ok:!1,errorMsg:Q instanceof Error?Q.message:"An unexpected error occurred"}}}observeThreadSummaries(J=""){return this.threadHistoryService.observeHistory().pipe(X6((Q)=>this.formatThreadSummaries(Q,J)))}formatThreadSummaries(J,Q){return J.filter((Z)=>{if(Z.mainThreadID)return!1;if(!Q.trim())return!0;let X=Z.title?.toLowerCase()||"untitled",G=Z.id.toLowerCase(),V=Q.toLowerCase();return X.includes(V)||G.includes(V)}).map((Z)=>{let X=new Date(Z.userLastInteractedAt),G=IS8(X),V=Z.id.slice(-8),K=Z.env?.initial.trees?.[0]?.uri;return{id:Z.id,title:Z.title||"Untitled",updatedAt:new Date(Z.userLastInteractedAt).toISOString(),description:{timeAgo:G,title:Z.title||"Untitled",shortThreadID:V},diffStats:Z.summaryStats?.diffStats,workspaceURI:K,parentRelationships:Z.parentRelationships,agentMode:Z.agentMode,details:{messageCount:Z.summaryStats?.messageCount}}})}}N0();B8();B8();vb();function mH6(J){let Q=mD0(J),Y=Array.from(Q.entries()).map(([V,K])=>({path:V,diffStats:K})),Z=Gu0(J),G=WP(J)?.totalInputTokens??0;return{filesAffected:Y,totalTokens:G,totalCredits:Z}}class wg1{currentId=null;current=null;statsCache=new Map;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new O5;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){v.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId===J)return;this.cancelTimerAndSubscription(),this.currentId=J;let Q=await this.threadService.get(J);if(Q){if(this.currentId===J)this.current=Q,this.notifyListeners()}this.subscribeTimer=setTimeout(()=>{this.subscribeLive(J)},1000)}clear(){this.cancelTimerAndSubscription(),this.currentId=null,this.current=null,this.notifyListeners()}addListener(J){this.listeners.push(J)}removeListener(J){let Q=this.listeners.indexOf(J);if(Q!==-1)this.listeners.splice(Q,1)}getCurrentThread(){return this.current}getCurrentStats(){if(!this.current)return null;let J=this.statsCache.get(this.current.id);if(J&&J.version===this.current.v)return J.stats;let Q=mH6(this.current);return this.statsCache.set(this.current.id,{stats:Q,version:this.current.v}),Q}dispose(){this.cancelTimerAndSubscription(),this.scrollController.dispose(),this.listeners=[]}subscribeLive(J){if(!this.threadService){v.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(PL()).subscribe((Q)=>{if(this.currentId===J)this.current=Q,this.notifyListeners()})}cancelTimerAndSubscription(){if(this.subscribeTimer)clearTimeout(this.subscribeTimer),this.subscribeTimer=null;if(this.subscription)this.subscription.unsubscribe(),this.subscription=null}notifyListeners(){for(let J of this.listeners)J(this.current)}}function uH6(J,Q){switch(J){case"update-available":return[new d("A newer Amp is available. Run ",new e({color:Q.foreground,dim:!0})),new d("amp update",new e({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new d("Update complete, run ",new e({color:Q.foreground,dim:!0})),new d("amp update",new e({color:Q.warning})),new d(" to see warnings",new e({color:Q.foreground,dim:!0}))];case"update-error":return[new d("Update failed, run ",new e({color:Q.foreground,dim:!0})),new d("amp update",new e({color:Q.warning})),new d(" to see warnings",new e({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function CS8(J){return new Promise((Q)=>{PS8("git",["branch","--show-current"],{cwd:J},(Y,Z)=>{if(Y){Q(null);return}let X=Z.trim();Q(X||null)})})}class nH6 extends p0{dependencies;constructor(J){super();this.dependencies=J}createState(){return new y21}}class y21 extends m0{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;randomAd=null;adSubscription=null;adReadinessTimeout=null;threadLoadSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;statusMessage=null;statusMessageTimer=null;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingMCPStatusModal=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingContextDetailOverlay=!1;threadCostInfo=void 0;threadCostInfoThreadID=void 0;threadCostInfoLastUsageLedgerLength=0;lastInferenceState=void 0;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;cancelProcessingConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];pendingSkills=[];pendingSkillsSubscription=null;displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;paletteShowOptions=null;threadsForPicker=[];clustersForPicker=[];isLoadingThreads=!1;threadPreviewController=new wg1;previewThread=null;todoScrollController=(()=>{let J=new O5;return J.followMode=!1,J})();filterThreadPickerByWorkspace=!0;currentGitBranch=null;messageViewFocusNode=new M8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new M8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;imagePreviewIndex=null;fileImagePreviewPath=null;adActionModal=null;newsFeedReader=null;newsFeedEntries=[];newsFeedSubscription=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;previousThreadIdForHint=null;handoffController=null;handoffState={isInHandoffMode:!1,isGeneratingHandoff:!1,isConfirmingAbortHandoff:!1,pendingHandoffPrompt:null,spinner:null};pendingMCPServers=[];mcpTrustSubscription=null;pendingOAuthRequest=null;mcpServers=[];mcpServersSubscription=null;agentModeController=null;freeTierStatus={canUseAmpFree:!1};agentModePulseSeq=0;agentModeSlideProgress=null;agentModeSlideTimer=null;updateState="hidden";updateServiceSubscription=null;toastController=new Vv1;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=null;mysteriousMessage=null;isShowingMysteriousMessageModal=!1;mysteriousMessageSubscription=null;mysterySequenceManager=null;mysterySequenceProgress=null;mysteryKeyInterceptorUnsubscribe=null;static MYSTERY_SEQUENCE=["ctrl+x","y","z"];userDisplayBalanceInfo=null;balanceInfoSubscription=null;async initNewsFeed(){let J=async(Y)=>{return D5(Y,void 0,this.widget.dependencies.configService)},Q=Yt0();this.newsFeedReader=new jx1(Q,J,"/news.rss"),this.newsFeedSubscription=this.newsFeedReader.stream().subscribe({next:(Y)=>{if(Y.length>0)this.setState(()=>{this.newsFeedEntries=[...Y,...this.newsFeedEntries]})},error:(Y)=>{v.error("News feed error:",Y)}})}recordNavigation(J){this.threadBackStack.push(J),this.threadForwardStack=[]}navigateBack=async()=>{if(this.threadBackStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadBackStack.pop();this.threadForwardStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};navigateForward=async()=>{if(this.threadForwardStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadForwardStack.pop();this.threadBackStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};onThreadSwitch(){this.handoffController?.resetUIState(),this.isMessageViewInSelectionMode=!1}startAndSwitchToNewThread=async()=>{let J=this.widget.dependencies.worker.thread.id;this.recordNavigation(J);let Q=await this.widget.dependencies.startNewThread();return this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,this.widget.dependencies.switchWorker(Q),this.setState(()=>{this.onThreadSwitch(),this.previousThreadIdForHint=J}),Q};async startReplay(){let J=this.widget.dependencies.replayMode;if(!J)return;let{thread:Q,typingEnabled:Y,baseWpm:Z}=J,X=Q.messages;for(let G=0;G<X.length;G++){if(this.replayAbortController.signal.aborted)break;let V=X[G];if(!V)continue;if(G>0)await this.replaySleep(J.messageDelayMs);if(V.role==="user"&&Y){let W=V.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
|
|
4857
4857
|
`);if(W)await this.replayTypeMessage(W,Z)}if(V.role==="assistant"){let W=V.content.some((U)=>U.type==="tool_use"),H=X[G+1],F=H?.role==="user"&&H.content.some((U)=>U.type==="tool_result");if(W&&F){let U={...V,state:{type:"streaming"}};this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,U],this.textController.clear()});let B=J.thread.id;this.getMessageScrollController(B).scrollToBottom(),await this.replaySleep(J.toolProgressDelayMs),this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages.slice(0,-1),V]});continue}}this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,V],this.textController.clear()});let K=J.thread.id;this.getMessageScrollController(K).scrollToBottom()}await this.replaySleep(J.exitDelayMs),E8.instance.stop()}async replayTypeMessage(J,Q){this.textController.clear();let Y=J.split(/(?<=\s)/),Z=60000/Q;for(let X of Y){if(this.replayAbortController.signal.aborted)break;if(this.looksLikePastedContent(X.trim())){await this.replaySleep(150),this.textController.text=this.textController.text+X,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{}),await this.replaySleep(300);continue}let G=Z/X.length;for(let V of X){this.textController.text=this.textController.text+V,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{});let K=0.8+Math.random()*0.4,q=G*K;await this.replaySleep(q)}}}looksLikePastedContent(J){if(/^[a-z][a-z0-9+.-]*:\/\//i.test(J))return!0;if(J.startsWith("/")&&J.length>10)return!0;if(/^[a-z]:\\/i.test(J))return!0;if(/^[a-f0-9]{7,40}$/i.test(J))return!0;if(/^T-[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(J))return!0;return!1}replaySleep(J){return new Promise((Q)=>{this.replayTypingTimer=setTimeout(Q,J)})}getEffectiveAgentMode(){return this.agentModeController?.getEffectiveMode()??"smart"}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Y=J.items.filter((G)=>G.type==="toolResult").filter((G)=>G.toolResult.run.status==="in-progress"||G.toolResult.run.status==="queued"),Z=J.subagentActiveTools.filter((G)=>G.toolRun.status==="in-progress"||G.toolRun.status==="queued");return[...Y,...Z].length>0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new d(this.submitDisabledHint,new e({color:J.foreground,dim:!0}));if(this.isExiting)return new d("Exiting...",new e({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new d("",void 0,[new d("Ctrl+C",new e({color:Q.keybind})),new d(" again to exit",new e({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new d("",void 0,[new d("Esc",new e({color:Q.keybind})),new d(" again to clear input",new e({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new d("",void 0,[new d("Escape",new e({color:Q.keybind})),new d(" to close help",new e({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let Z=this.getEffectiveAgentMode(),X=k21(Z);return new d("",void 0,[new d("Images aren't supported in ",new e({color:J.warning,dim:!1})),new d(Z,new e({color:X})),new d(" mode.",new e({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new d("",void 0,[new d("Esc",new e({color:Q.keybind})),new d(" again to cancel",new e({color:J.foreground,dim:!0}))]);return new d("",void 0,[new d("Esc",new e({color:Q.keybind})),new d(" to cancel",new e({color:J.foreground,dim:!0}))])}if(this.statusMessage)return new d(this.statusMessage,new e({color:J.foreground,dim:!0}));let Y=uH6(this.updateState,J);if(Y)return new d("",void 0,Y);return null}getParentThreadInfo(){let J=this.previewThread??this.widget.dependencies.threadState.mainThread;if(!J)return null;let Q=RL(J).filter((V)=>V.type==="fork"||V.type==="handoff");if(Q.length===0)return null;let Y=Q[0],Z=Y.threadID,G=this.threadsForPicker.find((V)=>V.id===Z)?.title??Z.slice(-8);return{type:Y.type==="handoff"?"handoff":"fork",title:G}}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}handleMessageRestoreSubmit=async(J)=>{let{threadState:Q,worker:Y}=this.widget.dependencies;if(!Q.mainThread?.id)return;let X=Q.mainThread?.messages.findIndex((G)=>G===J);if(X===void 0||X===-1)return;try{this.cancelBashInvocations(),await Y.cancel(),await Y.handle({type:"thread:truncate",fromIndex:X}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(G){v.error("Failed to edit message:",G)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Y,threadSyncService:Z}=this.widget.dependencies,X=Q.mainThread?.id;if(!X)return;let G=Q.mainThread?.messages.findIndex((V)=>V===J);if(G===void 0||G<=0)return;try{let V=await s3.getOrCreateForThread(Y,X),K=await qj(V,Z,G-1);await this.switchToExistingThread(K)}catch(V){v.error("Failed to fork thread:",V),this.showErrorMessage(`Failed to fork thread: ${V}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Y,worker:Z}=this.widget.dependencies,X=Y.mainThread;if(!X)return;let G=X.messages.findIndex((V)=>V.messageId!==void 0&&V.messageId===J.messageId);if(G===-1)return;try{this.cancelBashInvocations(),await Z.cancel(),this.widget.dependencies.history.add(Q);let V=UD(Q);if(V)await Z.handle({type:"thread:truncate",fromIndex:G}),this.invokeBashCommand(V.cmd,{visibility:V.visibility});else{let K=[{type:"text",text:Q}];if(this.imageAttachments.length>0)K.push(...this.imageAttachments);let q={content:K,agentMode:X.agentMode},W=G===0;if(X.agentMode&&!W&&q.agentMode!==X.agentMode){v.error(`Cannot edit message: This thread uses ${X.agentMode} mode. To change mode, create a new thread.`);return}await Z.handle({type:"user:message",message:q,index:G})}this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(V){v.error("Failed to edit message:",V)}};getAffectedFiles=async(J)=>{let{worker:Q,threadState:Y}=this.widget.dependencies;try{let Z=Y.mainThread;if(!Z)return[];let X=Z.messages.findIndex((V)=>V===J);if(X===-1)return[];return(await Q.getFilesAffectedByTruncation(X)).map(u3)}catch(Z){return v.error("Failed to get affected files:",Z),[]}};textController=new LZ;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new O5);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let Z=this.searchElementTreeByKey(J.child,Q);if(Z)return Z}if(J?.children)for(let Z of J.children){let X=this.searchElementTreeByKey(Z,Q);if(X)return X}return null}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{this.toastController.show("Selection copied to clipboard","success",2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Y=process.cwd().replace(process.env.HOME||"","~"),Z=Q?`amp - ${Q} - ${Y}`:"";process.stdout.write(dy1(Z))}}_handleTextCopy(J){if(J&&J.length>0)this.toastController.show("Selection copied to clipboard","success",2000)}textFieldKey=new V3("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;paletteCommands;paletteConfig;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"&&!this.handoffState.isGeneratingHandoff){this.showCommandPalette(),this.textController.clear();return}let Q=UD(J);this.currentShellModeStatus=this.handoffState.isInHandoffMode?void 0:Q?.visibility,this.setState(()=>{})};navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!1}),n8.instance.addPostFrameCallback(()=>{this.autocompleteFocusNode.requestFocus()})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.dismissIdePicker();return}try{await this.connectToSelectedIde(J,Q)}catch(Y){let Z=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${Z}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.dismissIdePicker()};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}previewControllerListener=(J)=>{this.setState(()=>{this.previewThread=J})};showStandaloneThreadPicker=()=>{this.showCommandPalette({type:"standalone",commandId:"continue",onSubmit:()=>{this.threadPreviewController.clear(),this.setState(()=>{this.isShowingPalette=!1,this.paletteShowOptions=null}),n8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette)this.autocompleteFocusNode.requestFocus()})},onCancel:()=>{this.exitApplication()}})};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(J){if(this.handoffState.isGeneratingHandoff)return;if(this.setState(()=>{this.isShowingPalette=!this.isShowingPalette,this.paletteShowOptions=J??null}),this.isShowingPalette)this.loadThreadsForPicker()}isShowingStandalonePalette(){return this.isShowingPalette&&this.paletteShowOptions?.type==="standalone"}getPaletteCommands(){if(!this.paletteCommands){if(!this.paletteConfig)throw Error("Config not yet available");this.paletteCommands=new pb1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})},this.widget.dependencies.isDogfooding,this.paletteConfig)}return this.paletteCommands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new lb1(this.widget.dependencies.fuzzyServer);return this.completionBuilder}dismissPalette=()=>{this.setState(()=>{this.isShowingPalette=!1,this.paletteShowOptions=null})};getCommandPaletteContext=(J)=>{let{threadState:Q,recentThreadIDs:Y}=this.widget.dependencies;if(!Q.mainThread)return null;let Z=u0.file(process.cwd()),X=v6(Z);return{recentThreadIDs:Y,currentThreadID:Q.mainThread.id,context:J,worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:Q.mainThread,ampURL:this.widget.dependencies.ampURL,threadService:this.widget.dependencies.threadService,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,skillService:this.widget.dependencies.skillService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let G=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),G},setImageAttachments:(G)=>{this.setState(()=>{this.imageAttachments=G})},editorDispatch:(G)=>{switch(G.type){case"set-input":this.textController.clear(),this.textController.insertText(G.input);break;case"insert-text":this.textController.insertText(G.text);break;case"clear":this.textController.clear();break}},submitMessage:(G)=>{return this.proceedWithUserMessage(G)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,mcpService:this.widget.dependencies.mcpService,toolboxService:this.widget.dependencies.toolboxService,startNewThread:async()=>{await this.startAndSwitchToNewThread()},navigateBack:this.navigateBack,navigateForward:this.navigateForward,canNavigateBack:this.threadBackStack.length>0,canNavigateForward:this.threadForwardStack.length>0,canUseAmpFree:this.widget.dependencies.freeTierStatus.canUseAmpFree,switchToThread:async(G)=>{return await this.switchToExistingThread(G),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(G,V,K)=>{let q=this.widget.dependencies.threadState.mainThread?.id;if(!q)throw Error("No active thread");let W=setTimeout(()=>{K.throwIfAborted()},60000);try{let H=await this.widget.dependencies.threadService.generateHandoffPrompt(q,G,V,this.widget.dependencies.configService,K,this.widget.dependencies.worker.fs.fileSystemReader());return clearTimeout(W),H}catch(H){throw clearTimeout(W),H}},handleHandoff:async(G,V)=>{let{goal:K,generatedPrompt:q,images:W}=V;if(!K&&!q)return{ok:!1,error:Error("Either goal or generatedPrompt required")};try{let H=this.widget.dependencies.threadState.mainThread?.id;if(!H)return{ok:!1,error:Error("No active thread")};let F=setTimeout(()=>G.abort(new WS("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let U=await this.widget.dependencies.threadService.createHandoffThread(H,{goal:K,generatedPrompt:q,images:W,filesystem:this.widget.dependencies.worker.fs.fileSystemReader()},this.widget.dependencies.configService,G.signal);return clearTimeout(F),await this.switchToExistingThread(U),{ok:!0}}catch(U){if(clearTimeout(F),U instanceof Error&&(U.name==="AbortError"||U.message.includes("aborted")))throw G.signal.reason;throw U}}catch(H){return v.error("Failed to create handoff thread",H),{ok:!1,error:H instanceof Error?H:Error(String(H))}}},getGuidanceFiles:async(G)=>{if(!Q.mainThread)return[];return(await $e({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,G)).map((K)=>({uri:K.uri,type:K.type}))},openIdePicker:()=>{this.openIdePicker()},getAgentMode:()=>{return this.agentModeController?.getMode()??null},setAgentMode:(G)=>{this.agentModeController?.setMode(G)},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,clusters:this.clustersForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:X,threadViewStates:this.widget.dependencies.workerController.threadViewStates,newsFeedEntries:this.newsFeedEntries,showMCPStatusModal:()=>{this.setState(()=>{this.isShowingMCPStatusModal=!0})},internalAPIClient:this.widget.dependencies.internalAPIClient,features:this.widget.dependencies.features,showStatusMessage:(G,V=2000)=>{if(this.statusMessageTimer)clearTimeout(this.statusMessageTimer);this.setState(()=>{this.statusMessage=G}),this.statusMessageTimer=setTimeout(()=>{this.setState(()=>{this.statusMessage=null}),this.statusMessageTimer=null},V)},showToast:(G,V="success",K)=>{this.toastController.show(G,V,K)},enterHandoffMode:this.enterHandoffMode,addPendingSkill:(G)=>{(this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker).addPendingSkill(G)}}};loadThreadsForPicker(){if(this.threadLoadSubscription)return;this.setState(()=>{this.isLoadingThreads=!0});let J=new Og1(this.widget.dependencies.threadHistoryService);this.threadLoadSubscription=J.observeThreadSummaries("").subscribe({next:(Q)=>{this.setState(()=>{this.threadsForPicker=Q,this.clustersForPicker=gW6(Q),this.isLoadingThreads=!1})},error:()=>{this.setState(()=>{this.isLoadingThreads=!1})}})}updateGitBranch=async()=>{let J=await CS8(process.cwd());this.setState(()=>{this.currentGitBranch=J})};removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{visibility:Q})=>{let Y=Date.now(),Z=`bash-${Y}-${Math.random().toString(36).substring(7)}`,X={cmd:J},G=new AbortController;this.widget.dependencies.worker.invokeBashTool(X,G.signal,Q===zD).subscribe({next:(V)=>{this.setState(()=>{if(this.bashInvocations.find((q)=>q.id===Z))this.bashInvocations=this.bashInvocations.map((q)=>q.id===Z?{...q,toolRun:V}:q);else{let q={id:Z,args:X,toolRun:V,startTime:Y,abortController:G,hidden:Q===zD};this.bashInvocations=[...this.bashInvocations,q]}})},error:()=>this.removeBashInvocation(Z),complete:()=>this.removeBashInvocation(Z)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};showContextDetailOverlay=()=>{this.setState(()=>{this.isShowingContextDetailOverlay=!0}),this.fetchThreadCostInfo()};fetchThreadCostInfo=IY6(()=>{let J=this.widget.dependencies.threadID;this.widget.dependencies.internalAPIClient.threadDisplayCostInfo({threadID:J},{config:this.widget.dependencies.configService}).then((Q)=>{if(Q.ok)this.setState(()=>{this.threadCostInfo=Q.result,this.threadCostInfoThreadID=J})}).catch(()=>{this.setState(()=>{this.threadCostInfo=void 0,this.threadCostInfoThreadID=J})})},150);maybeRefetchThreadCostInfo=(J,Q)=>{let Y=J!==this.threadCostInfoLastUsageLedgerLength,Z=Q==="idle"&&this.lastInferenceState==="running";if(this.threadCostInfoLastUsageLedgerLength=J,this.lastInferenceState=Q,Y||Z)this.fetchThreadCostInfo()};toggleAgentMode=()=>{if(!this.agentModeController)return;if(this.agentModeController.toggle())this.setState(()=>{this.showImageUnsupportedHint=!1,this.agentModePulseSeq++})};startAgentModeSlide=()=>{if(this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer);this.setState(()=>{this.agentModeSlideProgress=0});let J=400,Q=16,Y=Q/J;this.agentModeSlideTimer=setInterval(()=>{this.setState(()=>{if(this.agentModeSlideProgress!==null){if(this.agentModeSlideProgress=Math.min(1,this.agentModeSlideProgress+Y),this.agentModeSlideProgress>=1){if(this.agentModeSlideProgress=null,this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer),this.agentModeSlideTimer=null}}})},Q)};handleInsertImage=(J)=>{let Q=this.getEffectiveAgentMode();if(!iy(Q)){if(this.imageUnsupportedHintTimer)clearTimeout(this.imageUnsupportedHintTimer);return this.setState(()=>{this.showImageUnsupportedHint=!0}),this.imageUnsupportedHintTimer=setTimeout(()=>{this.setState(()=>{this.showImageUnsupportedHint=!1}),this.imageUnsupportedHintTimer=null},5000),!1}if(this.imageAttachments.length>=XB)return!1;let Y=YS(J);if(typeof Y==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Y]}),!1;return this.setState(()=>{this.displayMessage=Error(`Failed to attach image: ${Y}`)}),!1};handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1)})};handleImageClick=(J)=>{this.setState(()=>{this.imagePreviewIndex=J})};handleImagePreviewDismiss=()=>{this.setState(()=>{this.imagePreviewIndex=null})};handleImageRemove=(J)=>{this.setState(()=>{this.imageAttachments=this.imageAttachments.filter((Q,Y)=>Y!==J),this.imagePreviewIndex=null})};handleShowFileImagePreview=(J)=>{this.setState(()=>{this.fileImagePreviewPath=J})};handleFileImagePreviewDismiss=()=>{this.setState(()=>{this.fileImagePreviewPath=null})};handleShowMysteryModal=()=>{if(this.mysteriousMessage)this.setState(()=>{this.isShowingMysteriousMessageModal=!0})};handleDestructMysteriousMessage=()=>{if(!this.mysteriousMessage)return;let J=this.mysteriousMessage.id;this.widget.dependencies.internalAPIClient.markAsReadMysteriousMessage({messageId:J},{config:this.widget.dependencies.configService}).then((Q)=>{if(!Q.ok)v.error("Failed to destruct mysterious message",Q.error);else this.setState(()=>{this.mysteriousMessage=null,this.isShowingMysteriousMessageModal=!1})}).catch((Q)=>{v.error("Failed to destruct mysterious message",Q)})};enterHandoffMode=()=>{this.handoffController?.enter(),this.dismissPalette()};exitHandoffMode=()=>{this.handoffController?.exit()};submitHandoff=async(J)=>{let Q=this.imageAttachments;if(this.resetHistory(),this.setState(()=>{this.imageAttachments=[]}),!this.handoffController){this.showSubmitDisabledHint("Handoff controller not initialized");return}let Y=await this.handoffController.submit(J,Q);if(!Y.ok&&Y.error.message!=="Cancelled")this.displayMessage=Y.error,this.setState(()=>{})};openInEditor=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 MG(W);try{let H=await Y(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")v.error("Failed to read temporary file",H)}try{await Z(W),await X(q)}catch(H){v.warn("Failed to clean up temporary file",H)}}catch(q){v.error("Error opening editor:",q)}};onTextSubmitted=async(J)=>{if(!J.trim()&&this.imageAttachments.length===0)return;if(this.handoffState.isInHandoffMode){await this.submitHandoff(J);return}let Q=UD(J);if(Q)if(!Q.cmd){this.showSubmitDisabledHint("No command provided");return}else if(this.isProcessing()){this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}else{this.invokeBashCommand(Q.cmd,{visibility:Q.visibility}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();return}this.textController.clear(),this.resetHistory(),await this.updateGitBranch(),await this.sendUserMessage(J)};agentModeListener=()=>{this.setState(()=>{})};handoffListener=(J)=>{this.setState(()=>{this.handoffState=J})};initState(){if(CX.getInstance().interceptConsole(),this.freeTierStatus=this.widget.dependencies.freeTierStatus,this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.handoffController=new Hv1({threadService:this.widget.dependencies.threadService,configService:this.widget.dependencies.configService,getMainThread:()=>this.widget.dependencies.threadState.mainThread,getFilesystemReader:()=>this.widget.dependencies.worker.fs.fileSystemReader(),switchToThread:(Y)=>this.switchToExistingThread(Y)}),this.handoffController.addListener(this.handoffListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();E8.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),E8.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),E8.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Y)=>{n8.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Y.hasFocus})})}),D6(this.widget.dependencies.configService.config).then((Y)=>{this.paletteConfig=Y,this.agentModeController=new Sx1({initialCliMode:this.widget.dependencies.initialAgentMode,sessionState:this.widget.dependencies.sessionState??null,freeTierStatus:this.freeTierStatus,initialSettings:Y.settings,config$:this.widget.dependencies.configService.config,getThread:()=>this.widget.dependencies.getCurrentWorker()?.thread??this.widget.dependencies.worker.thread}),this.agentModeController.addListener(this.agentModeListener)}),this.updateGitBranch(),this.loadThreadsForPicker(),this.balanceInfoSubscription=Js0(async()=>{let Y=await this.widget.dependencies.internalAPIClient.userDisplayBalanceInfo({},{config:this.widget.dependencies.configService});if(!Y.ok)throw Y.error;return Y.result}).subscribe({next:(Y)=>{this.setState(()=>{this.userDisplayBalanceInfo=Y})},error:(Y)=>{v.debug("Failed to fetch user balance info",Y)}}),this.scheduleAdSubscriptionWithIdeReadiness();let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((Y)=>{this.setState(()=>{this.pendingMCPServers=Y})}),My1((Y)=>{this.setState(()=>{this.pendingOAuthRequest=Y})}),this.mcpServersSubscription=this.widget.dependencies.mcpService.servers.subscribe((Y)=>{this.setState(()=>{this.mcpServers=Y})}),this.pendingSkillsSubscription=this.widget.dependencies.worker.pendingSkills.subscribe((Y)=>{this.setState(()=>{this.pendingSkills=Y})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Y)=>{let Z=this.isIdeReadyForAdContext();if(this.setState(()=>{this.ideStatus=Y}),!Z&&this.isIdeReadyForAdContext()){if(this.adReadinessTimeout)clearTimeout(this.adReadinessTimeout),this.adReadinessTimeout=null;if(!this.adSubscription)this.subscribeToAds()}}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Y)=>{let Z=this.widget.dependencies.getCurrentWorker();if(!Z){v.warn("No active thread worker found to handle IDE message");return}await new Promise((X)=>setTimeout(X,50)),await Z.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}}),v.debug("Message sent from IDE to agent",{message:Y.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Y)=>{this.textController.insertText(Y),v.debug("Appended text to CLI prompt from IDE",{text:Y.slice(0,100)})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Y)=>{this.setState(()=>{this.updateState=Y})}),this.mysteriousMessageSubscription=dR(this.widget.dependencies.configService).pipe(B5((Y)=>Y!=="pending"),X6((Y)=>cR(Y)?Y.mysteriousMessage??null:null),I4((Y,Z)=>Y?.id===Z?.id)).subscribe((Y)=>{this.setState(()=>{if(Y?.id!==this.mysteriousMessage?.id)this.isShowingMysteriousMessageModal=!1;if(this.mysteriousMessage=Y,Y&&!this.mysterySequenceManager)this.mysterySequenceManager=new O71(new Map([[new A71(y21.MYSTERY_SEQUENCE),new dp]])),this.mysteryKeyInterceptorUnsubscribe=E8.instance.addKeyInterceptor((Z)=>{if(!this.mysterySequenceManager)return!1;if(this.isShowingMysteriousMessageModal)return!1;let X=this.mysterySequenceManager.handleKeyEvent(Z);if(X.consumed){if(X.intent)this.handleShowMysteryModal();return this.setState(()=>{this.mysterySequenceProgress=X.progress}),!0}else if(this.mysterySequenceProgress)this.setState(()=>{this.mysterySequenceProgress=null});return!1});else if(!Y)this.mysteryKeyInterceptorUnsubscribe?.(),this.mysteryKeyInterceptorUnsubscribe=null,this.mysterySequenceManager?.dispose(),this.mysterySequenceManager=null,this.mysterySequenceProgress=null})}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Y)=>{let Z=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${Z}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showIdePickerHint)this.toastController.show("Use /ide to connect to an IDE","success",5000);else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller();if(this.widget.dependencies.replayMode)setTimeout(()=>this.startReplay(),100);this.initNewsFeed()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener();let Q=this.widget.dependencies.threadID;if(this.threadCostInfoThreadID!==void 0&&this.threadCostInfoThreadID!==Q)this.threadCostInfo=void 0,this.threadCostInfoThreadID=void 0,this.threadCostInfoLastUsageLedgerLength=0,this.fetchThreadCostInfo();let{threadState:Y}=this.widget.dependencies;this.maybeRefetchThreadCostInfo(Y.mainThread?.usageLedger?.events.length??0,Y.viewState.state==="active"?Y.viewState.inferenceState:void 0)}dispose(){if(this.replayAbortController.abort(),this.replayTypingTimer)clearTimeout(this.replayTypingTimer);if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeController)this.agentModeController.removeListener(this.agentModeListener),this.agentModeController.dispose();if(this.handoffController)this.handoffController.removeListener(this.handoffListener),this.handoffController.dispose();if(this.adReadinessTimeout)clearTimeout(this.adReadinessTimeout),this.adReadinessTimeout=null;if(this.adSubscription)this.adSubscription.unsubscribe();if(this.balanceInfoSubscription)this.balanceInfoSubscription.unsubscribe();if(this.mcpTrustSubscription)this.mcpTrustSubscription.unsubscribe();if(My1(null),this.mcpServersSubscription)this.mcpServersSubscription.unsubscribe();if(this.pendingSkillsSubscription)this.pendingSkillsSubscription.unsubscribe();if(this.threadLoadSubscription)this.threadLoadSubscription.unsubscribe();if(this.newsFeedSubscription)this.newsFeedSubscription.unsubscribe();if(this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer),this.agentModeSlideTimer=null;if(this.mysteriousMessageSubscription)this.mysteriousMessageSubscription.unsubscribe();if(this.mysteryKeyInterceptorUnsubscribe?.(),this.mysterySequenceManager?.dispose(),this.threadPreviewController.removeListener(this.previewControllerListener),this.threadPreviewController.dispose(),this.toastController.dispose(),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.textController.removeListener(this.textChangeListener);for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(dy1("")),this.shouldUseProgressBar())process.stdout.write(mQ6())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,Z=[...J.items.filter((K)=>K.type==="toolResult").map((K)=>({toolUse:K.toolUse,toolRun:K.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((K)=>K.toolRun.status==="blocked-on-user");if(Z.length===0)return null;let X=Z[0],G=X.toolRun.status==="blocked-on-user"?X.toolRun.toAllow??[]:[],V=X.toolRun.status==="blocked-on-user"?X.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:X.toolUse,toAllow:G}],subthreadID:X.subthreadID,reason:V}}shouldUseProgressBar(){return!1}updateProgressBar(){}static AD_READINESS_TIMEOUT_MS=1000;scheduleAdSubscriptionWithIdeReadiness(){if(this.isIdeReadyForAdContext()){this.subscribeToAds();return}this.adReadinessTimeout=setTimeout(()=>{if(this.adReadinessTimeout=null,!this.adSubscription)this.subscribeToAds()},y21.AD_READINESS_TIMEOUT_MS)}isIdeReadyForAdContext(){let J=this.ideStatus;if(!J||!J.enabled)return!1;return Boolean(J.openFile||J.visibleFiles&&J.visibleFiles.length>0)}subscribeToAds(){if(this.adSubscription)return;this.adSubscription=qx1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{let J=this.agentModeController?.getMode();return(J&&O9(J)||this.randomAd===null)&&Kx1(this.lastUserInteractionTime)},this.widget.dependencies.codebaseContextService,()=>this.widget.dependencies.worker.thread).subscribe({next:(J)=>{if(J){let Q=RS8(16).toString("hex");if(this.lastAdImpressionId=Q,Promise.resolve().then(() => (_21(),S21)).then(({recordAdEvent:Y})=>{let Z=this.widget.dependencies.worker.thread,X=Z.messages[Z.messages.length-1];Y("viewed",{adId:J.id,advertiserId:J.advertiserId,threadId:Z.id,messageId:X?.messageId,impressionId:Q,placement:"tui",matchType:J.metadata?.matchType,matchedPatterns:J.metadata?.matchedPatterns,candidateAdPoolCount:J.metadata?.candidateAdPoolCount,clientRegion:J.metadata?.clientRegion})}),J.externalImpressionUrl)this.widget.dependencies.internalAPIClient.recordAdImpression({adId:J.id,externalImpressionUrl:J.externalImpressionUrl},{config:this.widget.dependencies.configService}).catch(()=>{})}this.setState(()=>{this.randomAd=J}),n8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}})}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){v.error("No current tool confirmation found");return}let Y=Q.tools[0]?.useBlock;if(!Y){v.error("No tool use block found in confirmation");return}if(J==="allow-all-session")GV("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0,"global")}catch(X){if(X&&X instanceof Error)this.setState(()=>{this.displayMessage=X});else v.error("Failed to write dangerouslyAllowAll setting:",X);return}if(J==="always-guarded"){let X=Q.tools[0]?.toAllow??[],G=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],V=[...X,...G];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",V,"global")}if(J==="connect-github"){let X=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();await OZ(this.context,X);return}if(J==="disable-librarian"){let X=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!X.includes(Kq))await this.widget.dependencies.settingsStorage.set("tools.disable",[...X,Kq],"global")}let Z=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let X={type:"user:tool-input",toolUse:Y.id,value:{accepted:Z}};if(Q.subthreadID)await(await s3.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(X);else await this.widget.dependencies.worker.handle(X)}catch(X){v.error("Failed to send tool confirmation:",X)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.widget.dependencies.worker;switch(J){case"retry":await Q.retry();break;case"dismiss":Q.dismissEphemeralError();break;case"new-thread":Q.dismissEphemeralError(),await this.startAndSwitchToNewThread();break;case"new-smart-thread":this.agentModeController?.setMode("smart"),Q.dismissEphemeralError(),z51({agentMode:"smart"}),await this.startAndSwitchToNewThread();break;case"handoff":Q.dismissEphemeralError(),this.showCommandPalette({type:"normal",commandId:"handoff"});break}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};handleMCPTrustOpenSettings=async()=>{let{mcpTrustHandler:J,settingsStorage:Q}=this.widget.dependencies;await J.deny();try{await MG(Q.getSettingsFilePath())}catch(Y){let Z=Y instanceof Error?Y.message:String(Y);await this.showErrorMessage(`Failed to open settings: ${Z}`)}};cancelStreamingMessage=async()=>{await s3.cancel(this.widget.dependencies.threadID)};markLastUserMessageAsInterrupted=async()=>{let J=this.widget.dependencies.threadState.mainThread;if(!J)return;for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="user"&&!Y.interrupted){await this.widget.dependencies.worker.handle({type:"user:message:interrupt",messageIndex:Q});break}}};switchToExistingThread=async(J,Q={})=>{let{recordInNavigationHistory:Y=!0}=Q;if(Y){let Z=this.widget.dependencies.worker.thread.id;if(Z!==J)this.recordNavigation(Z)}try{v.info(`[switchToExistingThread] Switching to thread: ${J}`);let Z=await this.widget.dependencies.switchToThread(J);if(v.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${Z.thread.agentMode}`),this.widget.dependencies.worker=Z,this.widget.dependencies.threadID=Z.thread.id,this.widget.dependencies.switchWorker(Z),v.info("[switchToExistingThread] Clearing agent mode"),this.agentModeController?.setMode(null),this.onThreadSwitch(),Z.thread.draft)if(v.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),typeof Z.thread.draft==="string")this.textController.insertText(Z.thread.draft);else{let X=Z.thread.draft.filter((K)=>K.type==="text"),G=Z.thread.draft.filter((K)=>K.type==="image"),V=X.map((K)=>K.text).join(`
|
|
4858
4858
|
`);if(V)this.textController.insertText(V);if(G.length>0)this.setState(()=>{this.imageAttachments=G})}}catch(Z){throw v.error("Failed to switch to thread:",J,Z),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.handoffController?.clearPendingPrompt(),this.widget.dependencies.history.add(J);let Q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,Y=V2(Q.thread)===0,Z=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Y&&Z!==Q.thread.agentMode){await this.showErrorMessage(`This thread uses ${Q.thread.agentMode} mode. To change mode, edit the first message or create a new thread.`);return}let X=[{type:"text",text:J}];if(this.imageAttachments.length>0)X.push(...this.imageAttachments);if(Y)this.startAgentModeSlide();if(await Q.handle({type:"user:message",message:{content:X,agentMode:Z}}),Y)z51({agentMode:Z});this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]}),n8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{this.setState(()=>{this.isExiting=!0});let J=this.widget.dependencies.threadState.mainThread;if(J?.messages.length===0){if(J.relationships?.find((Z)=>Z.type==="handoff"&&Z.role==="child"))await this.widget.dependencies.threadService.discardHandoffThread(J.id).catch(()=>{})}let Q=this.getEffectiveAgentMode();z51({agentMode:Q}).catch((Y)=>{v.warn("Failed to save session state on exit:",Y)}).finally(()=>{E8.instance.stop()})};onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;this.exitApplication()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=TS8();if(J===Q)return"~";if(J.startsWith(Q+jd.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(jd.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(jd.sep),"…",Q.slice(-2).join(jd.sep)].join(jd.sep)}build(J){let Q=E4.of(J),Y=q6.of(J),Z=Y.base;this.themeColors=Z;let{colors:X,app:G}=Y;this.themeApp=G;let V=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,K=V.thread.agentMode&&O9(V.thread.agentMode),q=this.widget.dependencies.features.some((_6)=>_6.name===AT.UBI&&_6.enabled),W=this.widget.dependencies.freeTierStatus.canUseAmpFree&&q,H=(K||W)&&this.randomAd!==null,F=Boolean(H),{threadState:U}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let B=this.getCurrentConfirmation(),M=this.widget.dependencies.replayMode,L=Boolean(M),A=U.items,w=U.mainThread||void 0,E=U.subagentToolsByParentID,P=U.todosList;if(L){let _6={...M.thread,messages:this.replayDisplayedMessages};A=kS(_6).items,w=_6,E={};let w6=SU({messages:this.replayDisplayedMessages});P=Array.isArray(w6)?w6:[]}let R=w?.id,C=w,S=L?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),k=(_6)=>new t31({key:new V3(`preview-message-view-${_6.id}`),items:kS(_6).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:_6,focusNode:new M8({debugLabel:"PreviewFocus"})}),f=this.previewThread,m=f?f.messages.length>2000?new C0({mainAxisSize:"max",children:[new a6({child:new Q0}),new B6({padding:W0.all(2),child:new A4({child:new C1({text:new d("Thread too long for preview",new e({color:X.mutedForeground,dim:!0}))})})})]}):k(f):S?new Q21({agentMode:this.getEffectiveAgentMode(),mysteriousMessage:this.mysteriousMessage,mysterySequenceProgress:this.mysterySequenceProgress,onShowMysteryModal:this.handleShowMysteryModal,userDisplayBalanceInfo:this.userDisplayBalanceInfo}):new t31({key:R?new V3(`message-view-${R}`):void 0,items:A,subagentToolsByParentID:E,controller:R?this.getMessageScrollController(R):new O5,autofocus:!1,onCopy:L?void 0:this._handleTextCopy.bind(this),thread:C,onMessageEditSubmit:L?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:L?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:L?void 0:this.forkMessage,getAffectedFiles:L?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode,isInHandoffMode:this.handoffState.isInHandoffMode,completionBuilder:L?void 0:this.getCompletionBuilder()}),b=Math.max(Math.floor(Q.size.height*0.4),12),c=this.getCurrentEphemeralError(),Z1=Q.size.width<40,r=U.mainThread?WP(U.mainThread):void 0,p=u31(J),s=this.buildBottomWidget(c,B,X,Y,U,P,b,F,L,r,Q,p),Q1=new z31({threadViewState:U.viewState,threadTokenUsage:r,threadID:R??null,thread:U.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,mcpServers:this.mcpServers,isNarrow:Z1,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!B,showingEphemeralError:Boolean(U.viewState.state==="active"&&U.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandNoun:this.executingCommand?.noun??null,executingCommandVerb:this.executingCommand?.verb??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),Y1=new Z31({bashInvocations:this.bashInvocations}),n=[],o=this.getEffectiveAgentMode(),i=this.currentShellModeStatus,q1=k21(o),T1=!i?o.length+1:0,J1=Q.capabilities.animationSupport,D1=J1==="disabled"?0:J1==="slow"?30:60,L1=XV(o)?.uiHints?.fasterAnimation?3:1,t1=D1>0&&this.agentModePulseSeq>0?new $5({children:[s,new A5({top:0,left:1,right:1,height:1,child:new Ug1({color:q1,trigger:this.agentModePulseSeq,fps:D1,speed:L1,leftOffset:T1})})]}):s;n.push(new a6({child:m}),Y1);let R1=new $5({children:[new C0({mainAxisSize:"min",children:[H?new Mb1({ad:this.randomAd,onButtonClick:async()=>{let _6=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (_21(),S21)).then(({recordAdEvent:Z8})=>{let S8=this.widget.dependencies.worker.thread,W3=S8.messages[S8.messages.length-1];Z8("clicked",{adId:_6.id,advertiserId:_6.advertiserId,threadId:S8.id,messageId:W3?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:_6.metadata?.matchType,matchedPatterns:_6.metadata?.matchedPatterns,candidateAdPoolCount:_6.metadata?.candidateAdPoolCount,clientRegion:_6.metadata?.clientRegion})});if(!await OZ(this.context,_6.shortDestinationUrl)){let S8=E8.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:S8,url:_6.shortDestinationUrl}})}}}):new Q0({height:0}),new f0({constraints:new M6(0,Q.size.width,0,b),child:t1})]}),F?new A5({top:0,left:0,right:0,child:new oH6({userHeight:this.bottomGridUserHeight,maxHeight:b,onInitializeHeight:(_6)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(_6,b)})},onDrag:(_6)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(_6.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let w6=Math.floor(_6.localPosition.y)-this.bottomGridDragStartY,Z8=Math.max(4,this.bottomGridDragStartHeight-w6),S8=Math.min(Z8,b),W3=Math.floor(S8);if(this.bottomGridUserHeight!==W3)this.setState(()=>{this.bottomGridUserHeight=W3})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new Q0({height:0})]}),f1=this.getParentThreadInfo();if(f1&&!L){let _6=f1.type==="handoff"?"Handed off from":"Forked from",w6=f1.type==="handoff"?G.handoffMode:X.primary,Z8=40,S8=B9(f1.title),W3=S8.length>40?S8.slice(0,39).join("")+"…":f1.title;n.push(new Q0({height:1,child:new F6({mainAxisAlignment:"end",children:[new L8({cursor:"pointer",onClick:()=>{this.showCommandPalette({type:"standalone",commandId:"thread-map",onSubmit:this.dismissPalette,onCancel:this.dismissPalette})},child:new B6({padding:W0.only({right:2}),child:new C1({text:new d("",void 0,[new d("↳ ",new e({color:w6})),new d(`${_6}: `,new e({color:X.mutedForeground,dim:!0})),new d(W3,new e({color:X.foreground}))])})})})]})}))}n.push(R1,new Q0({height:1,child:new B6({padding:W0.horizontal(1),child:Q1})}));let V1=new C0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:n}),N1=L&&M?.showIndicator!==!1?new $5({children:[V1,new A5({top:0,left:0,child:new Ag1})]}):V1,F1=new j8(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.isShowingMCPStatusModal)return this.setState(()=>{this.isShowingMCPStatusModal=!1}),"handled";if(this.pendingMCPServers.length>0)return this.widget.dependencies.mcpTrustHandler.deny(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingContextDetailOverlay)return this.setState(()=>{this.isShowingContextDetailOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.handoffState.isInHandoffMode){if(this.handoffState.isGeneratingHandoff)this.handoffController?.cancelGeneration();else this.exitHandoffMode();return"handled"}if(this.textController.hasSelection)return this.textController.clearSelection(),"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.handoffState.isConfirmingAbortHandoff&&this.handoffController){let w6=this.handoffController.getPendingPrompt();return this.textController.clear(),this.setState(()=>{this.imageAttachments=[]}),this.handoffController.confirmAbort().then((Z8)=>{if(Z8&&w6)this.textController.text=w6,this.handoffController?.clearPendingPrompt()}),"handled"}if(this.isConfirmingCancelProcessing){if(this.bashInvocations.length>0)this.cancelBashInvocations();if(this.isProcessing())this.markLastUserMessageAsInterrupted().catch((w6)=>{v.error("Failed to mark message as interrupted:",w6)}),this.cancelStreamingMessage().catch((w6)=>{v.error("Failed to cancel streaming message:",w6)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return v.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.bashInvocations.length>0||this.isProcessing()){if(this.setState(()=>{this.isConfirmingCancelProcessing=!0}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout);return this.cancelProcessingConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout=null},1000),"handled"}if(this.handoffController?.getEmptyHandoffParentThreadID())return this.handoffController.startAbortConfirmation(),"handled";if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),E1=new j8(()=>{return this.onExitPressed(),"handled"}),w1=new j8(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),h1=new j8(()=>{return this.setState(()=>{this.isShowingMCPStatusModal=!this.isShowingMCPStatusModal}),"handled"}),g1=new j8(()=>{return bJ.instance.toggleAll(),"handled"}),o1=new j8(()=>{return this.widget.dependencies.configService.getLatest().then((_6)=>{GV("internal.showDetailedCosts",!(_6.settings["internal.showDetailedCosts"]??!1))}),"handled"}),x1=new j8(()=>{return E8.instance.toggleFrameStatsOverlay(),"handled"}),r1=new j8(()=>{return E8.instance.tuiInstance.getScreen().markForRefresh(),n8.instance.requestFrame(),"handled"}),V0=new j8(()=>{return this.toggleAgentMode(),"handled"}),l0=new j8(()=>{let w6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,S8=Z8.mainThread?.id;return S8?this.getMessageScrollController(S8):null})();if(w6){let Z8=Math.max(Math.floor(Q.size.height*0.4),10),S8=Q.size.height-Z8;w6.animatePageUp(S8,100)}return"handled"}),e0=new j8(()=>{let w6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,S8=Z8.mainThread?.id;return S8?this.getMessageScrollController(S8):null})();if(w6){let Z8=Math.max(Math.floor(Q.size.height*0.4),10),S8=Q.size.height-Z8;w6.animatePageDown(S8,100)}return"handled"}),L6=new j8(()=>{let w6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,S8=Z8.mainThread?.id;return S8?this.getMessageScrollController(S8):null})();if(w6)w6.animateTo(0,100);return"handled"}),O6=new j8(()=>{let w6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,S8=Z8.mainThread?.id;return S8?this.getMessageScrollController(S8):null})();if(w6)w6.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),U4=new j8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";if(this.handoffState.isInHandoffMode)return"ignored";let{threadState:_6}=this.widget.dependencies;if(!_6.mainThread?.messages.some((Z8)=>Z8.role==="user"||FP(Z8)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),F0=new j8((_6)=>{if(_6.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),S0=new j8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return k71().then(async(_6)=>{if(_6)try{this.handleInsertImage(_6)}finally{try{let{unlink:w6}=await import("node:fs/promises");await w6(_6)}catch{}}}),"handled"}),R0=new Map([[D4.ctrl("c"),new hp],[D4.ctrl("l"),new up],[D4.ctrl("o"),new T71],[D4.ctrl("v"),new xp],[D4.alt("s"),new GS],[D4.ctrl("s"),new GS],[D4.alt("p"),new mp],[D4.ctrl("r"),new bp],[D4.alt("d"),new gp],[D4.ctrl("t"),new pp],[D4.key("PageUp"),new I71],[D4.key("PageDown"),new E71],[D4.key("Home"),new P71],[D4.key("End"),new R71],[D4.key("Escape"),new vp],[D4.ctrl("p"),new VS("previous")],[D4.ctrl("n"),new VS("next")],[D4.key("Tab"),new cp]]);if(!J2())R0.set(D4.key("ArrowUp"),new cp);if(!1)R0.set(D4.alt("c"),new fp);let u6=new j8(()=>{if(this.isShowingStandalonePalette())return"handled";return this.showCommandPalette(),"handled"}),W8=new j8(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),B4=new j8(()=>{if(this.mysteriousMessage)this.handleShowMysteryModal();return"handled"}),C4=new Map([[vp,F1],[up,r1],[GS,V0],[T71,u6],[xp,S0],[fp,w1],[D71,h1],[bp,g1],[gp,o1],[mp,x1],[pp,W8],[hp,E1],[I71,l0],[E71,e0],[P71,L6],[R71,O6],[cp,U4],[VS,F0],[dp,B4]]),F4=[N1];if(this.isShowingConsoleOverlay)F4.push(new ab1);if(this.isShowingHelp&&this.paletteConfig)F4.push(new sb1({commands:this.getPaletteCommands().getAllCommands()}));if(this.isShowingMCPStatusModal)F4.push(new ff1({servers:this.mcpServers,onDismiss:()=>{this.setState(()=>{this.isShowingMCPStatusModal=!1})}}));if(this.isShowingMysteriousMessageModal&&this.mysteriousMessage)F4.push(new Dg1({message:this.mysteriousMessage,onDestruct:this.handleDestructMysteriousMessage}));if(this.adActionModal)F4.push(new Lb1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(_6)=>{let w6=this.adActionModal.url;if(_6==="copy")try{await E8.instance.tuiInstance.clipboard.writeText(w6),this.setState(()=>{this.displayMessage=new AY("Link copied to clipboard")})}catch(Z8){v.error("Failed to copy to clipboard",{error:Z8}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.pendingMCPServers.length>0){let{mcpTrustHandler:_6}=this.widget.dependencies;F4.push(new Bg1({servers:this.pendingMCPServers,onAlwaysTrust:_6.trustAlways.bind(_6),onTrustOnce:_6.trustOnce.bind(_6),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:_6.deny.bind(_6)}))}if(this.pendingOAuthRequest)F4.push(new Mg1({request:this.pendingOAuthRequest,onDismiss:()=>{this.setState(()=>{this.pendingOAuthRequest=null})}}));if(this.isShowingFileChangesOverlay)F4.push(new qh1({threadData:U}));if(this.isShowingContextDetailOverlay){let _6=this.threadCostInfo?.costBreakdownURL;F4.push(new ob1({thread:U.mainThread??void 0,tokenUsage:r??void 0,costInfo:this.threadCostInfo,onDismiss:()=>{this.setState(()=>{this.isShowingContextDetailOverlay=!1})},onOpenCostBreakdown:_6?()=>{OZ(J,_6)}:void 0}))}if(this.isShowingConfirmationOverlay)F4.push(new nb1({details:this.confirmationOverlayContent}));if(this.imagePreviewIndex!==null&&this.imagePreviewIndex<this.imageAttachments.length){let _6=this.imageAttachments[this.imagePreviewIndex];if(_6)F4.push(new A4({child:new Jg1({image:_6,imageIndex:this.imagePreviewIndex,onDismiss:this.handleImagePreviewDismiss,onRemove:()=>this.handleImageRemove(this.imagePreviewIndex)})}))}if(this.fileImagePreviewPath!==null)F4.push(new A4({child:new Zh1({filePath:this.fileImagePreviewPath,onDismiss:this.handleFileImagePreviewDismiss})}));let r6=this.getCommandPaletteContext(J);if(r6&&this.isShowingPalette&&this.paletteConfig)F4.push(new A4({child:new cb1({commandContext:r6,mainThread:U.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,showOptions:this.paletteShowOptions??void 0})}));if(this.isShowingIdePicker)F4.push(new eb1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));let n6=new $5({children:F4});if(this.isShowingJetBrainsInstaller)return new _w({child:new yJ({actions:C4,child:new xX({shortcuts:R0,debugLabel:"jetbrains-installer-shortcuts",child:new zg1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new HS({onShowImagePreview:this.handleShowFileImagePreview,child:new Kz({controller:this.toastController,child:new _w({child:new Kv1({controller:this.toastController,child:new yJ({actions:C4,child:new xX({shortcuts:R0,debugLabel:"main-app-shortcuts",child:n6})})})})})})}buildScrollableTodoList(J,Q,Y){return new iH6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Y})}buildBottomWidget(J,Q,Y,Z,X,G,V,K,q,W,H,F){if(J)return new rb1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new ib1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new Ng1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let U=this.handoffState.isInHandoffMode?[]:Q31(Z),B=this.agentModeController?.isInRestrictedFreeMode()??!1,M=new tw({key:this.textFieldKey,controller:this.textController,triggers:q?[]:[new vW],completionBuilder:q?void 0:this.getCompletionBuilder(),ampURL:this.widget.dependencies.ampURL,onSubmitted:q?void 0:this.onTextSubmitted,theme:Y,placeholder:q?"Press Ctrl+C to exit":B?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!B&&!this.isShowingStandalonePalette()&&!this.handoffState.isGeneratingHandoff,shellPromptRules:U,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandalonePalette()&&!this.isShowingIdePicker,clipboard:E8.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage,onImageClick:this.handleImageClick,previousThreadId:this.previousThreadIdForHint&&(X.mainThread?.messages.length??0)===0?this.previousThreadIdForHint:void 0,onPreviousThreadHintAccepted:()=>{let Y1=this.previousThreadIdForHint;if(Y1)this.setState(()=>{this.previousThreadIdForHint=null}),this.textController.text=`following: @${Y1} `},onDoubleAtTrigger:q?void 0:()=>{let Y1=this.textController.text,n=this.textController.cursorPosition,i=Y1.slice(0,n).lastIndexOf("@@");this.showCommandPalette({type:"standalone",commandId:"mention-thread",onBeforeExecute:()=>{if(i!==-1){let q1=this.textController.text,T1=q1.slice(0,i)+q1.slice(i+2);this.textController.text=T1,this.textController.cursorPosition=i}},onSubmit:()=>{this.dismissPalette()},onCancel:()=>{this.dismissPalette()}})},pendingSkills:this.pendingSkills,onClearPendingSkill:(Y1)=>{(this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker).removePendingSkill(Y1)},popSkill:()=>{let Y1=this.pendingSkills[this.pendingSkills.length-1];if(Y1)(this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker).removePendingSkill(Y1.name)}}),L=X.mainThread?.queuedMessages??[],A=Array.isArray(G)&&G.length>0,E=Array.isArray(L)&&L.length>0?new Lg1({queuedMessages:L}):void 0,P=A?this.buildScrollableTodoList(G,this.isTextfieldAndAutocompleteFocused&&!B,Z):void 0,R=[],C=this.currentShellModeStatus;if(C)R.push({child:new C1({text:new d(C==="hidden"?"shell mode (incognito)":"shell mode",new e({color:C==="hidden"?Z.app.shellModeHidden:Z.app.shellMode}))}),position:"top-left"});if(this.handoffState.isInHandoffMode){let Y1=new e({color:Z.app.handoffMode}),n=this.handoffState.isGeneratingHandoff&&this.handoffState.spinner?new d("",void 0,[new d("handoff ",Y1),new d(this.handoffState.spinner.toBraille(),Y1)]):new d("handoff (submit a goal for the new thread)",Y1);if(R.push({child:new C1({text:n}),position:"top-left"}),this.handoffState.isGeneratingHandoff)R.push({child:new C1({text:new d("",void 0,[new d("Esc",new e({color:Z.app.keybind})),new d(" to cancel",new e({color:Y.foreground,dim:!0}))])}),position:"bottom-left"})}let S=this.handoffController?.getEmptyHandoffParentThreadID()??null,k=this.agentModeController?.getVisibleModes()??[];if(!C&&!this.handoffState.isInHandoffMode&&!S&&k.length>1){let Y1=this.previewThread,n=Y1?Y1.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),o=k21(n),i=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,q1=Y1??i.thread,T1=V2(q1)>0,J1=this.agentModeSlideProgress!==null,D1,L1,t1=(V1)=>Math.pow(V1,4);if(J1){D1="top-left";let X1=H.size.width-n.length-4,N1=t1(this.agentModeSlideProgress);L1=Math.floor(N1*X1)}else if(T1)D1="top-right",L1=0;else D1="top-left",L1=void 0;let R1=T1&&!J1,f1;if(J1){let V1=t1(this.agentModeSlideProgress??0);f1=new e({color:o,dim:V1>0.3})}else if(R1)f1=new e({color:Y.foreground,dim:!0});else f1=new e({color:o});if(Y1)R.push({child:new C1({text:new d(n,f1)}),position:D1,offsetX:L1});else{let V1=!T1&&!J1,X1=new C1({text:new d(n,f1)});R.push({child:V1?new L8({child:X1,onClick:this.toggleAgentMode,cursor:"pointer"}):X1,position:D1,offsetX:L1})}}let f=q?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:X.mainThread?.env?.initial.trees?.[0]?.uri,m;if(f)m=u0.parse(f).fsPath;else m=process.cwd();let b=this.toHomeRelative(m),c=this.shorten(b),Z1=!q&&this.currentGitBranch?`${c} (${this.currentGitBranch})`:c;if(R.push({child:new C1({text:new d(Z1,new e({color:Y.foreground,dim:!0}))}),position:"bottom-right"}),S){let Y1=this.getEffectiveAgentMode(),n=k21(Y1);R.push({child:new C1({text:new d(Y1,new e({color:n}))}),position:"top-left"});let o=this.handoffState.isConfirmingAbortHandoff?" again to abort ":" to abort ";R.push({child:new C1({text:new d("",void 0,[new d("Esc",new e({color:Z.app.keybind})),new d(o,new e({color:Y.foreground,dim:!0})),new d("handoff",new e({color:Z.app.handoffMode}))])}),position:"bottom-left"})}if(!S&&this.previousThreadIdForHint&&(X.mainThread?.messages.length??0)===0&&this.textController.text.trim()==="")R.push({child:new C1({text:new d("",void 0,[new d("press ",new e({color:Y.foreground,dim:!0})),new d("enter",new e({color:Z.app.keybind})),new d(" to reference the previous thread",new e({color:Y.foreground,dim:!0}))])}),position:"bottom-left"});let p=this.previewThread,s=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker;if(V2(s.thread)>0&&!C&&!this.handoffState.isInHandoffMode&&!p){let Y1=[],n=new e({color:Y.foreground,dim:!0}),o=new d(" · ",n);if(W){let i=W.totalInputTokens/W.maxInputTokens,q1=Math.round(i*100),T1=Math.max(0,Math.min(q1,100)),J1=F31(i,W.maxInputTokens),D1=n;if(J1==="danger")D1=new e({color:Y.destructive});else if(J1==="warning")D1=new e({color:Y.warning});else if(J1==="recommendation")D1=new e({color:Z.app.recommendation});let L1=Math.round(W.maxInputTokens/1000);Y1.push(new d(`${T1}% of ${L1}k`,D1))}if(F&&this.threadCostInfo){let i=z21(this.threadCostInfo,{colors:{foreground:Y.foreground},dim:!0});if(i.length>0){if(Y1.length>0)Y1.push(o);Y1.push(...i)}}if(Y1.length>0){let i=new C1({text:new d("",void 0,Y1)});R.push({child:F?new L8({child:i,onClick:this.showContextDetailOverlay,cursor:"pointer"}):i,position:"top-left"})}}return new Xh1({leftChild:new a6({child:M}),rightChild1:E,rightChild2:P,maxHeight:V,overlayTexts:R,borderColor:B||!this.isTextfieldAndAutocompleteFocused||this.handoffState.isGeneratingHandoff?B1.index(8):void 0,hasBanner:K,userHeight:this.bottomGridUserHeight,onInitializeHeight:(Y1)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(Y1,V)})},onDrag:(Y1)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(Y1.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let n=Math.floor(Y1.localPosition.y)-this.bottomGridDragStartY,o=Math.max(4,this.bottomGridDragStartHeight-n),i=Math.min(o,V),q1=Math.floor(i);if(this.bottomGridUserHeight!==q1)this.setState(()=>{this.bottomGridUserHeight=q1})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:!K})}}async function Rg1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)E8.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let Z=()=>null,G=!1;if(G)process.env.AMP_INSPECTOR_ENABLED="1";let V=new Qz(G,1000,J.inspectorPort),K=new Nb1({threadService:J.threadService,worker:J.worker,builder:(L,A,w,E,P,R)=>{Z=P;let C=P(),S={...J,worker:C,threadID:C.thread.id};return new nH6({...S,threadState:A,workerController:w,switchWorker:E,getCurrentWorker:P,recentThreadIDs:R})}}),q=new $h1({configService:J.configService,child:K}),W=new bf1({configService:J.configService,child:q}),H=new Jv1(W),F=new q6({data:KS.fromBaseTheme(LG.default()),child:H});try{await Xx1(F,{onRootElementMounted:(L)=>{if(v.info("TUI input ready for user interaction"),G)V.start(L),vZ6(L)}})}finally{if(G)V.stop(),hZ6()}let B=Z()?.thread.id||J.threadID,M=await J.threadService.get(B);if(M&&M.messages.length>0){let L=`${J.ampURL.replace(/\/$/,"")}/threads/${B}`;XX6(M,L,J.stdout)}}function k21(J){let Y=XV(J)?.uiHints?.secondaryColor;if(Y)return B1.rgb(Y.r,Y.g,Y.b);return jS8(J)}class iH6 extends p0{props;constructor(J){super();this.props=J}createState(){return new aH6}}class aH6 extends m0{viewportHeight=1;scrollListenerAttached=!1;initState(){if(!this.scrollListenerAttached)this.widget.props.controller.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0}build(J){let{todos:Q,controller:Y,appTheme:Z}=this.widget.props;return new F6({crossAxisAlignment:"stretch",children:[new a6({child:new J5({controller:Y,autofocus:!1,child:new Db1({todos:Q})})}),new R2({controller:Y,thumbColor:Z.app.scrollbarThumb,trackColor:Z.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:X,offset:G}=Y,V=this.viewportHeight,K=X+V;return{totalContentHeight:Math.max(K,0),viewportHeight:Math.max(V,1),scrollOffset:Math.max(G,0)}}})]})}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;if("size"in J){let Z=J.size;if(typeof Z?.height==="number"&&Z.height>0)return Z.height}return this.viewportHeight}}class oH6 extends l6{props;constructor(J){super();this.props=J}build(J){return new L8({child:new Q0({height:1}),cursor:E9.NS_RESIZE,onDrag:(Q)=>{if(this.props.userHeight===void 0){let Z=J.findRenderObject()?.size.height??0;if(Z>0){this.props.onInitializeHeight(Z);return}}this.props.onDrag(Q)},onRelease:this.props.onRelease})}}function jS8(J){let Q=0;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}let Y=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],Z=Math.abs(Q)%Y.length;return B1.index(Y[Z])}Zx1();try{if(process.platform==="win32")await Promise.resolve().then(() => Q6(eS(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){TY.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
4859
|
-
`)}var Qu1=Ju1.join(vB0||Ju1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function rx8(J){process.emitWarning=function(Q,Y,Z,X){let G=typeof Q==="string"?Q:Q.message||String(Q),V=Y||"Warning",K=!1;J.warn(G,{name:V,code:Z})}}function SG(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")GV("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")GV("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")GV("model.sonnet",Q.useSonnet)}async function Zu1(J){try{await ix8(Ju1.dirname(Qu1),{recursive:!0}),await ax8(Qu1,J,"utf-8")}catch(Q){v.debug("Failed to save last thread ID",Q)}}async function sx8(){try{return(await wB6(Qu1,"utf-8")).trim()}catch(J){return null}}function tx8(J){return!!(J&&(J.endsWith("@sourcegraph.com")||J.endsWith("@ampcode.com")||J==="auth-bypass-user@example.com"))}async function ex8(J){try{let Q=await _9.getUserInfo({},{config:J,signal:AbortSignal.timeout(5000)});if(Q.ok)return Q.result}catch(Q){v.debug("Failed to fetch user info:",Q)}return}var LB6=[{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??FG,description:`Custom settings file path (overrides the default location ${FG})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(v).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Bw})`},{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:J2(),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)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:VP.SMART.key,description:`Set the agent mode (${L$().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:L$().map((J)=>J.mode).concat("large")}],AB6=(J)=>("deprecated"in J)&&J.deprecated===!0,Jv8=(J)=>("hidden"in J)&&J.hidden===!0,Qv8=(J)=>("default"in J),Yv8=(J)=>("default"in J)?J.default:void 0;function Zv8(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 b8(HG.unknownCommand(Y),1,V)}}var IB6=null;function qm5(){return IB6}function td(J){return{...J,getThreadEnvironment:p91,vfs:QS0({os:J.fileSystem},J.configService.config),skillService:J.skillService,fileChangeTrackerStorage:new Xf(J.fileSystem),generateThreadTitle:F16,deleteThread:(Q)=>J.threadService.delete(Q),getServerStatus:()=>dR(J.configService)}}var Xu1=u0.file(ox8.homedir()),EB6=process.env.XDG_CONFIG_HOME?u0.file(process.env.XDG_CONFIG_HOME):i0.joinPath(Xu1,".config");async function pX(J,Q){fA0("0.0.
|
|
4859
|
+
`)}var Qu1=Ju1.join(vB0||Ju1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function rx8(J){process.emitWarning=function(Q,Y,Z,X){let G=typeof Q==="string"?Q:Q.message||String(Q),V=Y||"Warning",K=!1;J.warn(G,{name:V,code:Z})}}function SG(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")GV("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")GV("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")GV("model.sonnet",Q.useSonnet)}async function Zu1(J){try{await ix8(Ju1.dirname(Qu1),{recursive:!0}),await ax8(Qu1,J,"utf-8")}catch(Q){v.debug("Failed to save last thread ID",Q)}}async function sx8(){try{return(await wB6(Qu1,"utf-8")).trim()}catch(J){return null}}function tx8(J){return!!(J&&(J.endsWith("@sourcegraph.com")||J.endsWith("@ampcode.com")||J==="auth-bypass-user@example.com"))}async function ex8(J){try{let Q=await _9.getUserInfo({},{config:J,signal:AbortSignal.timeout(5000)});if(Q.ok)return Q.result}catch(Q){v.debug("Failed to fetch user info:",Q)}return}var LB6=[{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??FG,description:`Custom settings file path (overrides the default location ${FG})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(v).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Bw})`},{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:J2(),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)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:VP.SMART.key,description:`Set the agent mode (${L$().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:L$().map((J)=>J.mode).concat("large")}],AB6=(J)=>("deprecated"in J)&&J.deprecated===!0,Jv8=(J)=>("hidden"in J)&&J.hidden===!0,Qv8=(J)=>("default"in J),Yv8=(J)=>("default"in J)?J.default:void 0;function Zv8(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 b8(HG.unknownCommand(Y),1,V)}}var IB6=null;function qm5(){return IB6}function td(J){return{...J,getThreadEnvironment:p91,vfs:QS0({os:J.fileSystem},J.configService.config),skillService:J.skillService,fileChangeTrackerStorage:new Xf(J.fileSystem),generateThreadTitle:F16,deleteThread:(Q)=>J.threadService.delete(Q),getServerStatus:()=>dR(J.configService)}}var Xu1=u0.file(ox8.homedir()),EB6=process.env.XDG_CONFIG_HOME?u0.file(process.env.XDG_CONFIG_HOME):i0.joinPath(Xu1,".config");async function pX(J,Q){fA0("0.0.1766275311-g95fb3f");let Y=rU1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:Y0.of([u0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Xu1,userConfigDir:EB6}),{initializeCLITelemetry:Z}=await Promise.resolve().then(() => (_21(),S21));Z(Y);let X=await Y.getLatest();v.debug("Global configuration initialized",{settingsKeys:Object.keys(X.settings)});let{toolService:G,dispose:V}=I86({configService:Y}),K=new Map,q=()=>K.clear(),W=new sM1(Y,J.settings.getWorkspaceRootPath()),H=Bx0({configService:Y,filesystem:s9}),F=Sj0({configService:Y,trustStore:W,skillMCPServers:H.skillMCPServers,createOAuthProvider:async(r,p,s)=>{let Q1=`${r}:${p}`,Y1=K.get(Q1);if(Y1)return v.debug("Reusing existing OAuth provider for server",{serverName:r,serverUrl:p}),Y1;v.debug("Creating OAuth provider for server",{serverName:r,serverUrl:p});let n=(async()=>{let o=new ZA(J.secrets),i=await o.getClientInfo(r,p),q1=s?.scopes??i?.scopes,T1=i26();v.info("OAuth headless mode check",{useHeadless:T1,executeMode:J.executeMode,envVar:process.env.AMP_HEADLESS_OAUTH,isTTY:G5.isTTY});let J1=void 0;if(T1)J1=J.executeMode?n26():l26(r);let D1=new iM1({storage:o,serverName:r,serverUrl:p,clientId:s?.clientId??i?.clientId,clientSecret:s?.clientSecret??i?.clientSecret,authUrl:s?.authUrl??i?.authUrl,tokenUrl:s?.tokenUrl??i?.tokenUrl,scopes:q1,headlessAuthHandler:J1});return v.debug("OAuth provider created",{serverName:r,serverUrl:p,hasManualClientId:!!(s?.clientId??i?.clientId),willUseDCR:!(s?.clientId??i?.clientId),scopes:q1,headlessMode:T1,executeMode:J.executeMode}),D1})();return K.set(Q1,n),n}}),U=Wu({configService:Y,filesystem:s9,spawn:fN,skillToolboxDirs:H.skillToolboxDirs}),{initializeToolProviders:B,startToolProviders:M}=await Promise.resolve().then(() => (MB6(),DB6)),L;if(J.executeMode){let r=await B({toolService:G,providers:[F,U],initialTimeout:15000});L=r.registrations;for(let[p,s]of r.initErrors)v.warn(`${p} provider initialization slow or failed:`,s)}else L=M({toolService:G,providers:[F,U]});if(Q.jetbrains)vP("JetBrains");else if(Q.ide&&RJ6())vP("VS Code");else if(Q.ide&&TJ6())vP("Neovim");if(J.executeMode)bA0(!0);let A,w=v7.status.pipe(X6((r)=>Boolean(r.connected&&r.authenticated)),I4()).subscribe((r)=>{if(r){if(!A)A=G.registerTool(F66)}else A?.dispose(),A=void 0}),E;if(!J.executeMode){let r=await J.settings.get("fuzzy.alwaysIncludePaths")??[];E=new t91(process.cwd(),{alwaysIncludePaths:r},!0)}else E=new class extends t91{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(G5.write(`No API key found. Starting login flow...
|
|
4860
4860
|
`),!await Xv8(J))await Nw(),process.exit(1)}let P=await Ox0({isDevelopment:!1}),R=new qS1(P,Y),C=new Dj1(P,{lazy:!0}),S=Q.notifications!==void 0?Q.notifications:!J.executeMode,k=P86({playNotificationSound:async(r)=>{if(S){E86(r);let p=Qx1(),s=Yx1();if((!p||s)&&X.settings["notifications.system.enabled"]!==!1){if(r==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(r==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:R,configService:Y});v.info("Starting Amp background services");let f=U16({threadService:R,threadHistoryService:C,configService:Y,isExtensionDevelopment:!1}),m;v7.status.subscribe((r)=>{m=r});let b=new _q1({workspaceRoots:[u0.file(process.cwd())],getCurrentFile:()=>{if(!m?.openFile)return;try{return u0.parse(m.openFile)}catch(r){v.warn("Failed to parse current file URI",{uri:m.openFile,error:r});return}},getOpenFiles:()=>{if(!m?.visibleFiles?.length)return[];let r=m.openFile;return m.visibleFiles.filter((p)=>p!==r).map((p)=>{try{return u0.parse(p)}catch(s){return v.warn("Failed to parse visible file URI",{uri:p,error:s}),null}}).filter((p)=>p!==null)}}),c=new $x1,Z1={codebaseContextService:b,configService:Y,toolService:G,mcpService:F,skillService:H,toolboxService:U,trustStore:W,threadService:R,threadHistoryService:C,threadSyncService:f,threadStorage:P,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:E,notificationService:k,fileSystem:Q.jetbrains||Q.ide?tj0:s9,terminal:c};return{...Z1,async asyncDispose(){if(Z1.mcpService.hasAuthenticatingClients())v.info("Waiting for OAuth authentication to complete before exit..."),await Z1.mcpService.waitForAuthentication();for(let r of L.values())r.dispose();await Z1.mcpService.dispose(),q(),await Z1.threadService.asyncDispose(),Z1.configService.unsubscribe(),V(),Z1.fuzzyServer.dispose(),Z1.threadSyncService.dispose(),Z1.settingsStorage[Symbol.dispose](),w.unsubscribe(),A?.dispose()}}}async function Xv8(J){if(!J.executeMode){if(!await ky1("Would you like to log in to Amp? [(y)es, (n)o]: "))return G5.write(`Login cancelled. Run the command again to retry.
|
|
4861
4861
|
`),!1}return await PB6(J)}async function PB6(J){let Q=nx8(32).toString("hex"),Y=await _y1(J.ampURL,Q),Z=new AbortController;try{await _U(Y,Z.signal)}catch(G){v.error("Error opening browser",{error:G})}let X=await _y1(J.ampURL,Q,!1);G5.write(`If your browser does not open automatically, visit:
|
|
4862
4862
|
|
|
@@ -4866,7 +4866,7 @@ ${V6.blue.bold(X)}
|
|
|
4866
4866
|
Login successful! You can now use the Amp CLI.
|
|
4867
4867
|
`),!0}catch(G){return v.error("Login failed",{error:G}),TY.write(`
|
|
4868
4868
|
Login failed: ${G instanceof Error?G.message:String(G)}
|
|
4869
|
-
`),!1}}function $v8(){let J=new tV().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)_j(),process.exit(0);let F=H.originalError??H;O26(F)}),J.option("-V, --version","Print the version number and exit",()=>{let F;try{F=`, ${kR(new Date("2025-12-
|
|
4869
|
+
`),!1}}function $v8(){let J=new tV().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)_j(),process.exit(0);let F=H.originalError??H;O26(F)}),J.option("-V, --version","Print the version number and exit",()=>{let F;try{F=`, ${kR(new Date("2025-12-21T00:06:54.623Z"))} ago`}catch{}G5.write(`0.0.1766275311-g95fb3f (released 2025-12-21T00:06:54.623Z${F??""})
|
|
4870
4870
|
`),process.exit(0)}),J.addHelpText("after",IJ6()),J.configureHelp({formatHelp:EJ6}),J.command("logout").description("Log out by removing stored API key").action(async(H,F)=>{let U=F.optsWithGlobals(),B=await pJ(U);await qv8(B)}),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,F)=>{let U=F.optsWithGlobals(),B=await pJ(U);await Kv8(B,await Ay1(U,B.settings))});let Q=async(H,F,U)=>{rU1({storage:F.settings,secretStorage:F.secrets,workspaceRoots:Y0.of([u0.file(process.cwd())]),defaultAmpURL:F.ampURL,homeDir:Xu1,userConfigDir:EB6});let B={...F,executeMode:!1};await Yu1(B,{...H,openThreadSwitcher:!0},U)},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,F)=>{let U=F.optsWithGlobals(),B=await pJ(U);await OB6(U,B,F)});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,F)=>{let U=F.optsWithGlobals(),B=await pJ(U);await Nv8(U,B,F)}),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,F,U)=>{let B=U.optsWithGlobals(),M=await pJ(B);if(F.pick)TY.write(`${V6.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
4871
4871
|
`);if(F.last||H||M.executeMode)await Bv8(B,M,H,U);else await Q(B,M,U)}),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,F,U)=>{let B=U.optsWithGlobals(),M=await pJ(B);await Uv8(B,M,H,U)}),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,F)=>{let U=F.optsWithGlobals(),B=await pJ(U);await OB6(U,B,F)}),Y.command("search <query>").alias("find").summary("Search threads").description(`Search for threads using a query DSL.
|
|
4872
4872
|
|
|
@@ -4882,8 +4882,8 @@ All matching is case-insensitive. File paths use partial matching.`).option("-n,
|
|
|
4882
4882
|
Or pipe via stdin: echo "your message" | amp --execute`);SG(Y,Q);let V=await pX(J,Q);IB6=V;let K=td(V),q=await ex8(V.configService),W=tx8(q?.email);if((J.executeMode||Q.streamJson)&&O9(Q.mode)&&!W)throw new b8(`Execute mode is not permitted with --mode '${Q.mode}'`,1);let H=async(b)=>{let c=await wB6(b,"utf-8"),Z1=JSON.parse(c);if(!w$(Z1.id))throw new b8(HG.invalidThreadId);return OJ1(V,{visibility:Z,agentMode:Q.mode,thread:Z1})},F=async(b)=>{if(!w$(b))throw new b8(HG.invalidThreadId);try{let[Z1,r]=await Promise.all([_9.getThreadLinkInfo({thread:b},{config:V.configService}),_9.getUserInfo({},{config:V.configService})]);if(Z1.ok&&r.ok){let p=Z1.result.creatorUserID,s=r.result.id;if(p&&p!==s&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new b8(`Cannot resume thread created by another user.
|
|
4883
4883
|
|
|
4884
4884
|
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(Z1){if(Z1 instanceof b8)throw Z1;v.warn("Failed to validate thread ownership in CLI, allowing to open",{error:Z1})}let c=await V.threadService.get(b)??void 0;return v.info(`[fetchAndStartThread] Loaded thread ${b}, agentMode: ${c?.agentMode??"undefined"}`),OJ1(V,{visibility:Z,agentMode:c?void 0:Q.mode,thread:c})},U=async()=>{try{if(Q.threadId)return F(Q.threadId);else return OJ1(V,{visibility:Z,agentMode:Q.mode})}catch(b){if(b instanceof b8)throw b;throw await ru(b,Q.threadId),Error("handleError should have called process.exit()")}},B=async()=>{return OJ1(V,{visibility:Z,agentMode:Q.mode})};if(Q.format==="jsonl")TY.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
4885
|
-
`),await Nw(),process.exit(1);if(J.executeMode&&Q.remote)await zQ6(X,G,V.configService),await V.asyncDispose(),process.exit(0);let M=await U();if(J.executeMode)$Q6(V.mcpService,J.settings),await _26(M,M.threadID,X,G,V,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL,W,Q.mode),await V.asyncDispose(),process.exit(0);let L=!1,A=!1,w=!1;if(Q.jetbrains||Q.ide){await oA0();let b=bP({jetbrainsOnly:Q.jetbrains});if(b.length===0){if(Q.jetbrains)A=!await V.configService.get("jetbrains.skipInstall")}else if(b.length===1){let c=b[0];if(c)v7.selectConfig(c)}else w=!0}let E=K51("0.0.
|
|
4886
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,Z=await VJ6({...J,workspaceTrust:{current:!0,changes:yy},getHook:process.env.AMP_URL?(G,V)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return V()}:void 0});if(J.mcpConfig){let G=await ZQ6(J.mcpConfig);Z=XQ6(Z,G)}let X=await Z.get("url","global");if(!X)X=dY;if(!kU(X))v.info("Targeting custom Amp server",{ampURL:X});return Z=KM0(Z),{executeMode:Q,isTTY:Y,ampURL:X,settings:Z,secrets:UQ6(await Ay1(J,Z))}}function Gv8(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 Vv8(){let J=Gv8(process.argv);if(F26({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),rx8(v),v.info("Starting Amp CLI.",{version:"0.0.
|
|
4885
|
+
`),await Nw(),process.exit(1);if(J.executeMode&&Q.remote)await zQ6(X,G,V.configService),await V.asyncDispose(),process.exit(0);let M=await U();if(J.executeMode)$Q6(V.mcpService,J.settings),await _26(M,M.threadID,X,G,V,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL,W,Q.mode),await V.asyncDispose(),process.exit(0);let L=!1,A=!1,w=!1;if(Q.jetbrains||Q.ide){await oA0();let b=bP({jetbrainsOnly:Q.jetbrains});if(b.length===0){if(Q.jetbrains)A=!await V.configService.get("jetbrains.skipInstall")}else if(b.length===1){let c=b[0];if(c)v7.selectConfig(c)}else w=!0}let E=K51("0.0.1766275311-g95fb3f",V.settingsStorage),P=new i41(V.threadStorage),R=Y0.of([u0.file(process.cwd())]),C=kq1(void 0,R),S=new q51(V.mcpService,J.settings.getWorkspaceRootPath());if(X)M.handle({type:"user:message",message:{content:[{type:"text",text:X}]}});let f=await(async()=>{try{let b=await _9.getUserFreeTierStatus({},{config:V.configService,signal:AbortSignal.timeout(5000)});if(b.ok)return v.info("User free tier status:",b),b.result}catch(b){throw v.error("Failed to fetch free tier status:",b),b}})(),m=await DQ6();v.info("Loaded session state:",m),await Rg1({codebaseContextService:V.codebaseContextService,stdout:process.stdout,history:new l91,fuzzyServer:V.fuzzyServer,settingsStorage:V.settingsStorage,threadService:V.threadService,threadHistoryService:V.threadHistoryService,threadSyncService:V.threadSyncService,threadID:M.threadID,threadFuzzyIndexer:P,worker:M,workerDeps:K,skillService:K.skillService,configService:V.configService,internalAPIClient:_9,ampURL:J.ampURL,startNewThread:B,switchToThread:F,ideClient:v7,commandRegistry:C,mcpService:V.mcpService,toolboxService:V.toolboxService,mcpTrustHandler:S,showJetBrainsInstaller:A,showIdePicker:L,showIdePickerHint:w,openThreadSwitcher:Q.openThreadSwitcher,updateService:E,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:m,freeTierStatus:{canUseAmpFree:f.canUseAmpFree},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 pJ(J){if(J.interactive)TY.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
4886
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,Z=await VJ6({...J,workspaceTrust:{current:!0,changes:yy},getHook:process.env.AMP_URL?(G,V)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return V()}:void 0});if(J.mcpConfig){let G=await ZQ6(J.mcpConfig);Z=XQ6(Z,G)}let X=await Z.get("url","global");if(!X)X=dY;if(!kU(X))v.info("Targeting custom Amp server",{ampURL:X});return Z=KM0(Z),{executeMode:Q,isTTY:Y,ampURL:X,settings:Z,secrets:UQ6(await Ay1(J,Z))}}function Gv8(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 Vv8(){let J=Gv8(process.argv);if(F26({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),rx8(v),v.info("Starting Amp CLI.",{version:"0.0.1766275311-g95fb3f",buildTimestamp:"2025-12-21T00:06:54.623Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new b8(HG.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await $v8().parseAsync(process.argv)}Vj1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await Vv8().catch(ru)});async function Kv8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),G5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
4887
4887
|
`);else if(!kU(J.ampURL))G5.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
4888
4888
|
`);let Y=process.env.AMP_API_KEY;if(Y)G5.write(`API key found in environment variable, storing...
|
|
4889
4889
|
`),await Q.set("apiKey",Y,J.ampURL),G5.write(`API key successfully stored.
|
|
@@ -4896,7 +4896,7 @@ This thread belongs to a different user and cannot be continued for security rea
|
|
|
4896
4896
|
`);else G5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
|
|
4897
4897
|
`);process.exit(0)}async function Wv8(J,Q,Y,Z,X){SG(X,J);let G=await pX(Q,J);try{let V=wJ1(Y);if(!V)IJ1(Y);let K=V,q=Z.trim();if(q.length===0)uX("Thread name cannot be empty");if(q.length>256)uX("Thread name cannot exceed 256 characters");if(!(await J_(K,G)).messages.length)uX("Cannot rename an empty thread.");let H=td(G);await(await s3.getOrCreateForThread(H,K)).handle({type:"title",value:q}),v.info("GOT HERE"),await G.threadSyncService.sync(),v.info("GOT THERE"),G5.write(V6.green(`✓ Thread ${K} renamed to "${q}"
|
|
4898
4898
|
`)),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose();let K=`Failed to rename thread: ${V instanceof Error?V.message:String(V)}`;uX(K)}}async function Hv8(J,Q,Y,Z){SG(Z,J);let X=await pX(Q,J);try{let G=wJ1(Y);if(!G)IJ1(Y);let K=await J_(G,X),q=Qj(K);G5.write(q+`
|
|
4899
|
-
`),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)}`;uX(V)}}async function Fv8(J,Q,Y,Z,X){SG(X,J);let G=await pX(Q,J);try{let V=await $u1(Y),K=await J_(V,G),q=Z.typing!==!1,W=parseInt(Z.wpm||"120",10),H=parseInt(Z.messageDelay||"1000",10),F=parseInt(Z.toolProgressDelay||"800",10),U=parseInt(Z.exitDelay||"3",10)*1000,B=Z.indicator!==!1,M=td(G),L=K.id;await G.threadStorage.set(L,K);let A=await s3.getOrCreateForThread(M,L);await A.resume();let w=n41.fromWorker(A),E=new i41(G.threadStorage),P=Y0.of([u0.file(process.cwd())]),R=kq1(void 0,P),C=new q51(G.mcpService,Q.settings.getWorkspaceRootPath()),S=K51("0.0.
|
|
4899
|
+
`),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)}`;uX(V)}}async function Fv8(J,Q,Y,Z,X){SG(X,J);let G=await pX(Q,J);try{let V=await $u1(Y),K=await J_(V,G),q=Z.typing!==!1,W=parseInt(Z.wpm||"120",10),H=parseInt(Z.messageDelay||"1000",10),F=parseInt(Z.toolProgressDelay||"800",10),U=parseInt(Z.exitDelay||"3",10)*1000,B=Z.indicator!==!1,M=td(G),L=K.id;await G.threadStorage.set(L,K);let A=await s3.getOrCreateForThread(M,L);await A.resume();let w=n41.fromWorker(A),E=new i41(G.threadStorage),P=Y0.of([u0.file(process.cwd())]),R=kq1(void 0,P),C=new q51(G.mcpService,Q.settings.getWorkspaceRootPath()),S=K51("0.0.1766275311-g95fb3f",G.settingsStorage),k=Wu({configService:G.configService,filesystem:s9,spawn:fN,skillToolboxDirs:G.skillService.skillToolboxDirs});await Rg1({codebaseContextService:G.codebaseContextService,stdout:process.stdout,history:new l91,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadHistoryService:G.threadHistoryService,threadSyncService:G.threadSyncService,threadID:L,threadFuzzyIndexer:E,worker:w,workerDeps:M,skillService:M.skillService,configService:G.configService,internalAPIClient:_9,ampURL:Q.ampURL,startNewThread:async()=>w,switchToThread:async()=>w,ideClient:v7,commandRegistry:R,mcpService:G.mcpService,toolboxService:k,mcpTrustHandler:C,showJetBrainsInstaller:!1,updateService:S,isDogfooding:!1,replayMode:{thread:K,typingEnabled:q,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:F,exitDelayMs:U,showIndicator:B},freeTierStatus:{canUseAmpFree:!0},features:[]}),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),await ru(V,Y)}}async function zv8(J,Q,Y,Z,X){SG(Z,J);let G=await pX(Q,J);try{let V=wJ1(Y);if(!V)IJ1(Y);let K=V,q=await _9.getUserInfo({},{config:G.configService}),W=q.ok?q.result:null,H=W51(J,W);if(!H&&!X)uX("Must specify either --visibility or --support");if(H&&X)uX("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)uX(H.message);if(H)await G.threadSyncService.updateThreadMeta(K,H51(H)),G5.write(V6.green("✓ ")+`Thread ${K} visibility changed to ${H}.
|
|
4900
4900
|
`);if(X){await J_(K,G);let F=typeof X==="string"?X:void 0;await R_0(G.threadService,K,G.configService,F),G5.write(V6.green("✓ ")+`Thread ${K} has been shared with Amp support. These thread reports will be aggregated and analysed.
|
|
4901
4901
|
`)}await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),uX(`Failed to update thread: ${V instanceof Error?V.message:String(V)}`)}}async function Uv8(J,Q,Y,Z){SG(Z,J);let X=await pX(Q,J),G=td(X);try{let V=await $u1(Y),q=(await J_(V,X)).messages.length-1,W=await s3.getOrCreateForThread(G,V),H=await qj(W,X.threadSyncService,q);await Promise.all([X.threadSyncService.uploadThread(V),X.threadSyncService.uploadThread(H)]),await Zu1(H),G5.write(`${H}
|
|
4902
4902
|
`),await X.asyncDispose(),process.exit(0)}catch(V){TY.write(`Error forking thread: ${V instanceof Error?V.message:String(V)}
|