@sourcegraph/amp 0.0.1764417684-g51a9e4 → 0.0.1764446481-g6c75f9

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.
Files changed (2) hide show
  1. package/dist/main.js +11 -11
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -45,7 +45,7 @@ ${q}`.trim()}_serializeSingularDataPoint(J,Q,Y){let X="";J=WZ1(J,Q);let{value:G,
45
45
  ${X}
46
46
  ${G}
47
47
  `}}uH0.PrometheusSerializer=mH0});var lH0=f((dH0)=>{Object.defineProperty(dH0,"__esModule",{value:!0});dH0.PrometheusExporter=void 0;var Jk=h6(),MJ4=V8(),FZ1=_D(),LJ4=k1("http"),AJ4=zZ1(),OJ4=k1("url");class dW extends FZ1.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:(G)=>{return{type:FZ1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(G)=>FZ1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||dW.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||dW.DEFAULT_OPTIONS.port,this._prefix=J.prefix||dW.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:dW.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||dW.DEFAULT_OPTIONS.withResourceConstantLabels,X=J.withoutTargetInfo||dW.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,LJ4.createServer)(this._requestHandler).unref(),this._serializer=new AJ4.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,X),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||dW.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(G)=>{Jk.diag.error(G),Q(G)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return Jk.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)Jk.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,MJ4.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},()=>{Jk.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 OJ4.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:X}=Q;if(X.length)Jk.diag.error("PrometheusExporter: metrics collection errors",...X);J.end(this._serializer.serialize(Y))},(Q)=>{J.end(`# failed to export metrics: ${Q}`)})};_notFound=(J)=>{J.statusCode=404,J.end()}}dH0.PrometheusExporter=dW});var iH0=f((Ol)=>{Object.defineProperty(Ol,"__esModule",{value:!0});Ol.PrometheusSerializer=Ol.PrometheusExporter=void 0;var wJ4=lH0();Object.defineProperty(Ol,"PrometheusExporter",{enumerable:!0,get:function(){return wJ4.PrometheusExporter}});var EJ4=zZ1();Object.defineProperty(Ol,"PrometheusSerializer",{enumerable:!0,get:function(){return EJ4.PrometheusSerializer}})});var sH0=f((oH0)=>{Object.defineProperty(oH0,"__esModule",{value:!0});oH0.OTLPTraceExporter=void 0;var PJ4=HV(),RJ4=U$(),nH0=yW();class aH0 extends PJ4.OTLPExporterBase{constructor(J={}){super((0,nH0.createOtlpHttpExportDelegate)((0,nH0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),RJ4.ProtobufTraceSerializer))}}oH0.OTLPTraceExporter=aH0});var tH0=f((UZ1)=>{Object.defineProperty(UZ1,"__esModule",{value:!0});UZ1.OTLPTraceExporter=void 0;var TJ4=sH0();Object.defineProperty(UZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return TJ4.OTLPTraceExporter}})});var eH0=f((BZ1)=>{Object.defineProperty(BZ1,"__esModule",{value:!0});BZ1.OTLPTraceExporter=void 0;var jJ4=tH0();Object.defineProperty(BZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return jJ4.OTLPTraceExporter}})});var Jz0=f((NZ1)=>{Object.defineProperty(NZ1,"__esModule",{value:!0});NZ1.OTLPTraceExporter=void 0;var _J4=eH0();Object.defineProperty(NZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return _J4.OTLPTraceExporter}})});var Zz0=f((Xz0)=>{Object.defineProperty(Xz0,"__esModule",{value:!0});Xz0.OTLPTraceExporter=void 0;var yJ4=HV(),xJ4=U$(),Qz0=yW();class Yz0 extends yJ4.OTLPExporterBase{constructor(J={}){super((0,Qz0.createOtlpHttpExportDelegate)((0,Qz0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),xJ4.JsonTraceSerializer))}}Xz0.OTLPTraceExporter=Yz0});var $z0=f((DZ1)=>{Object.defineProperty(DZ1,"__esModule",{value:!0});DZ1.OTLPTraceExporter=void 0;var vJ4=Zz0();Object.defineProperty(DZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return vJ4.OTLPTraceExporter}})});var qz0=f((MZ1)=>{Object.defineProperty(MZ1,"__esModule",{value:!0});MZ1.OTLPTraceExporter=void 0;var hJ4=$z0();Object.defineProperty(MZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return hJ4.OTLPTraceExporter}})});var Vz0=f((LZ1)=>{Object.defineProperty(LZ1,"__esModule",{value:!0});LZ1.OTLPTraceExporter=void 0;var gJ4=qz0();Object.defineProperty(LZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return gJ4.OTLPTraceExporter}})});var Fz0=f((Hz0)=>{Object.defineProperty(Hz0,"__esModule",{value:!0});Hz0.OTLPTraceExporter=void 0;var Kz0=Bl(),uJ4=U$(),pJ4=HV();class Wz0 extends pJ4.OTLPExporterBase{constructor(J={}){super((0,Kz0.createOtlpGrpcExportDelegate)((0,Kz0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),uJ4.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}Hz0.OTLPTraceExporter=Wz0});var Uz0=f((AZ1)=>{Object.defineProperty(AZ1,"__esModule",{value:!0});AZ1.OTLPTraceExporter=void 0;var dJ4=Fz0();Object.defineProperty(AZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return dJ4.OTLPTraceExporter}})});var Dz0=f((Bz0)=>{Object.defineProperty(Bz0,"__esModule",{value:!0});Bz0.prepareSend=void 0;var OZ1=h6(),wl=V8(),lJ4=k1("http"),iJ4=k1("https");function nJ4(J,Q){let Y=new URL(J),X=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...Q}});return function(Z,q){if(Z.length===0)return OZ1.diag.debug("Zipkin send with empty spans"),q({code:wl.ExportResultCode.SUCCESS});let{request:V}=Y.protocol==="http:"?lJ4:iJ4,K=V(Y,X,(H)=>{let z="";H.on("data",(U)=>{z+=U}),H.on("end",()=>{let U=H.statusCode||0;if(OZ1.diag.debug(`Zipkin response status code: ${U}, body: ${z}`),U<400)return q({code:wl.ExportResultCode.SUCCESS});else return q({code:wl.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${U}`)})})});K.on("error",(H)=>{return q({code:wl.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(Z);OZ1.diag.debug(`Zipkin request payload: ${W}`),K.write(W,"utf8"),K.end()}}Bz0.prepareSend=nJ4});var Mz0=f((wZ1)=>{Object.defineProperty(wZ1,"__esModule",{value:!0});wZ1.prepareSend=void 0;var aJ4=Dz0();Object.defineProperty(wZ1,"prepareSend",{enumerable:!0,get:function(){return aJ4.prepareSend}})});var IZ1=f((EZ1)=>{Object.defineProperty(EZ1,"__esModule",{value:!0});EZ1.prepareSend=void 0;var rJ4=Mz0();Object.defineProperty(EZ1,"prepareSend",{enumerable:!0,get:function(){return rJ4.prepareSend}})});var Az0=f((Lz0)=>{Object.defineProperty(Lz0,"__esModule",{value:!0});Lz0.SpanKind=void 0;var tJ4;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(tJ4=Lz0.SpanKind||(Lz0.SpanKind={}))});var Pz0=f((Ez0)=>{Object.defineProperty(Ez0,"__esModule",{value:!0});Ez0._toZipkinAnnotations=Ez0._toZipkinTags=Ez0.toZipkinSpan=Ez0.defaultStatusErrorTagName=Ez0.defaultStatusCodeTagName=void 0;var kF=h6(),RZ1=V8(),El=Az0(),eJ4={[kF.SpanKind.CLIENT]:El.SpanKind.CLIENT,[kF.SpanKind.SERVER]:El.SpanKind.SERVER,[kF.SpanKind.CONSUMER]:El.SpanKind.CONSUMER,[kF.SpanKind.PRODUCER]:El.SpanKind.PRODUCER,[kF.SpanKind.INTERNAL]:void 0};Ez0.defaultStatusCodeTagName="otel.status_code";Ez0.defaultStatusErrorTagName="error";function JQ4(J,Q,Y,X){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:eJ4[J.kind],timestamp:(0,RZ1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,RZ1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:Oz0(J,Y,X),annotations:J.events.length?wz0(J.events):void 0}}Ez0.toZipkinSpan=JQ4;function Oz0({attributes:J,resource:Q,status:Y,droppedAttributesCount:X,droppedEventsCount:G,droppedLinksCount:Z},q,V){let K={};for(let W of Object.keys(J))K[W]=String(J[W]);if(Y.code!==kF.SpanStatusCode.UNSET)K[q]=String(kF.SpanStatusCode[Y.code]);if(Y.code===kF.SpanStatusCode.ERROR&&Y.message)K[V]=Y.message;if(X)K["otel.dropped_attributes_count"]=String(X);if(G)K["otel.dropped_events_count"]=String(G);if(Z)K["otel.dropped_links_count"]=String(Z);return Object.keys(Q.attributes).forEach((W)=>K[W]=String(Q.attributes[W])),K}Ez0._toZipkinTags=Oz0;function wz0(J){return J.map((Q)=>({timestamp:Math.round((0,RZ1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}Ez0._toZipkinAnnotations=wz0});var Cz0=f((Rz0)=>{Object.defineProperty(Rz0,"__esModule",{value:!0});Rz0.prepareGetHeaders=void 0;function ZQ4(J){return function(){return J()}}Rz0.prepareGetHeaders=ZQ4});var vz0=f((yz0)=>{Object.defineProperty(yz0,"__esModule",{value:!0});yz0.ZipkinExporter=void 0;var jz0=h6(),Sz0=V8(),_z0=IZ1(),TZ1=Pz0(),CZ1=WF(),$Q4=Cz0();class kz0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,Sz0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,_z0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||TZ1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||TZ1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,$Q4.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[CZ1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(jz0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:Sz0.ExportResultCode.FAILED,error:Error("Exporter has been shutdown")}));return}let X=new Promise((Z)=>{this._sendSpans(J,Y,(q)=>{Z(),Q(q)})});this._sendingPromises.push(X);let G=()=>{let Z=this._sendingPromises.indexOf(X);this._sendingPromises.splice(Z,1)};X.then(G,G)}shutdown(){return jz0.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,_z0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let X=J.map((G)=>(0,TZ1.toZipkinSpan)(G,String(G.attributes[CZ1.ATTR_SERVICE_NAME]||G.resource.attributes[CZ1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(X,(G)=>{if(Y)return Y(G)})}}yz0.ZipkinExporter=kz0});var fz0=f((Il)=>{Object.defineProperty(Il,"__esModule",{value:!0});Il.ZipkinExporter=Il.prepareSend=void 0;var qQ4=IZ1();Object.defineProperty(Il,"prepareSend",{enumerable:!0,get:function(){return qQ4.prepareSend}});var VQ4=vz0();Object.defineProperty(Il,"ZipkinExporter",{enumerable:!0,get:function(){return VQ4.ZipkinExporter}})});var jZ1=f((hz0)=>{Object.defineProperty(hz0,"__esModule",{value:!0});hz0.B3_DEBUG_FLAG_KEY=void 0;var WQ4=h6();hz0.B3_DEBUG_FLAG_KEY=(0,WQ4.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Qk=f((gz0)=>{Object.defineProperty(gz0,"__esModule",{value:!0});gz0.X_B3_FLAGS=gz0.X_B3_PARENT_SPAN_ID=gz0.X_B3_SAMPLED=gz0.X_B3_SPAN_ID=gz0.X_B3_TRACE_ID=gz0.B3_CONTEXT_HEADER=void 0;gz0.B3_CONTEXT_HEADER="b3";gz0.X_B3_TRACE_ID="x-b3-traceid";gz0.X_B3_SPAN_ID="x-b3-spanid";gz0.X_B3_SAMPLED="x-b3-sampled";gz0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";gz0.X_B3_FLAGS="x-b3-flags"});var iz0=f((cz0)=>{Object.defineProperty(cz0,"__esModule",{value:!0});cz0.B3MultiPropagator=void 0;var E$=h6(),NQ4=V8(),uz0=jZ1(),WX=Qk(),DQ4=new Set([!0,"true","True","1",1]),MQ4=new Set([!1,"false","False","0",0]);function LQ4(J){return J===E$.TraceFlags.SAMPLED||J===E$.TraceFlags.NONE}function AQ4(J){return Array.isArray(J)?J[0]:J}function Pl(J,Q,Y){let X=Q.get(J,Y);return AQ4(X)}function OQ4(J,Q){let Y=Pl(J,Q,WX.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function wQ4(J,Q){let Y=Pl(J,Q,WX.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function pz0(J,Q){return Pl(J,Q,WX.X_B3_FLAGS)==="1"?"1":void 0}function EQ4(J,Q){let Y=Pl(J,Q,WX.X_B3_SAMPLED);if(pz0(J,Q)==="1"||DQ4.has(Y))return E$.TraceFlags.SAMPLED;if(Y===void 0||MQ4.has(Y))return E$.TraceFlags.NONE;return}class dz0{inject(J,Q,Y){let X=E$.trace.getSpanContext(J);if(!X||!(0,E$.isSpanContextValid)(X)||(0,NQ4.isTracingSuppressed)(J))return;let G=J.getValue(uz0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,WX.X_B3_TRACE_ID,X.traceId),Y.set(Q,WX.X_B3_SPAN_ID,X.spanId),G==="1")Y.set(Q,WX.X_B3_FLAGS,G);else if(X.traceFlags!==void 0)Y.set(Q,WX.X_B3_SAMPLED,(E$.TraceFlags.SAMPLED&X.traceFlags)===E$.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let X=OQ4(Q,Y),G=wQ4(Q,Y),Z=EQ4(Q,Y),q=pz0(Q,Y);if((0,E$.isValidTraceId)(X)&&(0,E$.isValidSpanId)(G)&&LQ4(Z))return J=J.setValue(uz0.B3_DEBUG_FLAG_KEY,q),E$.trace.setSpanContext(J,{traceId:X,spanId:G,isRemote:!0,traceFlags:Z});return J}fields(){return[WX.X_B3_TRACE_ID,WX.X_B3_SPAN_ID,WX.X_B3_FLAGS,WX.X_B3_SAMPLED,WX.X_B3_PARENT_SPAN_ID]}}cz0.B3MultiPropagator=dz0});var sz0=f((oz0)=>{Object.defineProperty(oz0,"__esModule",{value:!0});oz0.B3SinglePropagator=void 0;var tD=h6(),IQ4=V8(),nz0=jZ1(),SZ1=Qk(),PQ4=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,RQ4="0".repeat(16),TQ4=new Set(["d","1"]),CQ4="d";function jQ4(J){return J.length===32?J:`${RQ4}${J}`}function SQ4(J){if(J&&TQ4.has(J))return tD.TraceFlags.SAMPLED;return tD.TraceFlags.NONE}class az0{inject(J,Q,Y){let X=tD.trace.getSpanContext(J);if(!X||!(0,tD.isSpanContextValid)(X)||(0,IQ4.isTracingSuppressed)(J))return;let G=J.getValue(nz0.B3_DEBUG_FLAG_KEY)||X.traceFlags&1,Z=`${X.traceId}-${X.spanId}-${G}`;Y.set(Q,SZ1.B3_CONTEXT_HEADER,Z)}extract(J,Q,Y){let X=Y.get(Q,SZ1.B3_CONTEXT_HEADER),G=Array.isArray(X)?X[0]:X;if(typeof G!=="string")return J;let Z=G.match(PQ4);if(!Z)return J;let[,q,V,K]=Z,W=jQ4(q);if(!(0,tD.isValidTraceId)(W)||!(0,tD.isValidSpanId)(V))return J;let H=SQ4(K);if(K===CQ4)J=J.setValue(nz0.B3_DEBUG_FLAG_KEY,K);return tD.trace.setSpanContext(J,{traceId:W,spanId:V,isRemote:!0,traceFlags:H})}fields(){return[SZ1.B3_CONTEXT_HEADER]}}oz0.B3SinglePropagator=az0});var kZ1=f((tz0)=>{Object.defineProperty(tz0,"__esModule",{value:!0});tz0.B3InjectEncoding=void 0;var _Q4;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(_Q4=tz0.B3InjectEncoding||(tz0.B3InjectEncoding={}))});var YF0=f((JF0)=>{Object.defineProperty(JF0,"__esModule",{value:!0});JF0.B3Propagator=void 0;var kQ4=V8(),yQ4=iz0(),xQ4=sz0(),vQ4=Qk(),fQ4=kZ1();class ez0{_b3MultiPropagator=new yQ4.B3MultiPropagator;_b3SinglePropagator=new xQ4.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===fQ4.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,kQ4.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let X=Y.get(Q,vQ4.B3_CONTEXT_HEADER);if(Array.isArray(X)?X[0]:X)return this._b3SinglePropagator.extract(J,Q,Y);else return this._b3MultiPropagator.extract(J,Q,Y)}fields(){return this._fields}}JF0.B3Propagator=ez0});var XF0=f((RV)=>{Object.defineProperty(RV,"__esModule",{value:!0});RV.B3InjectEncoding=RV.X_B3_TRACE_ID=RV.X_B3_SPAN_ID=RV.X_B3_SAMPLED=RV.X_B3_PARENT_SPAN_ID=RV.X_B3_FLAGS=RV.B3_CONTEXT_HEADER=RV.B3Propagator=void 0;var hQ4=YF0();Object.defineProperty(RV,"B3Propagator",{enumerable:!0,get:function(){return hQ4.B3Propagator}});var OE=Qk();Object.defineProperty(RV,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return OE.B3_CONTEXT_HEADER}});Object.defineProperty(RV,"X_B3_FLAGS",{enumerable:!0,get:function(){return OE.X_B3_FLAGS}});Object.defineProperty(RV,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return OE.X_B3_PARENT_SPAN_ID}});Object.defineProperty(RV,"X_B3_SAMPLED",{enumerable:!0,get:function(){return OE.X_B3_SAMPLED}});Object.defineProperty(RV,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return OE.X_B3_SPAN_ID}});Object.defineProperty(RV,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return OE.X_B3_TRACE_ID}});var bQ4=kZ1();Object.defineProperty(RV,"B3InjectEncoding",{enumerable:!0,get:function(){return bQ4.B3InjectEncoding}})});var VF0=f((ZF0)=>{Object.defineProperty(ZF0,"__esModule",{value:!0});ZF0.JaegerPropagator=ZF0.UBER_BAGGAGE_HEADER_PREFIX=ZF0.UBER_TRACE_ID_HEADER=void 0;var eD=h6(),mQ4=V8();ZF0.UBER_TRACE_ID_HEADER="uber-trace-id";ZF0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class GF0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=ZF0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||ZF0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||ZF0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let X=eD.trace.getSpanContext(J),G=eD.propagation.getBaggage(J);if(X&&(0,mQ4.isTracingSuppressed)(J)===!1){let Z=`0${(X.traceFlags||eD.TraceFlags.NONE).toString(16)}`;Y.set(Q,this._jaegerTraceHeader,`${X.traceId}:${X.spanId}:0:${Z}`)}if(G)for(let[Z,q]of G.getAllEntries())Y.set(Q,`${this._jaegerBaggageHeaderPrefix}-${Z}`,encodeURIComponent(q.value))}extract(J,Q,Y){let X=Y.get(Q,this._jaegerTraceHeader),G=Array.isArray(X)?X[0]:X,Z=Y.keys(Q).filter((K)=>K.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map((K)=>{let W=Y.get(Q,K);return{key:K.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(W)?W[0]:W}}),q=J;if(typeof G==="string"){let K=pQ4(G);if(K)q=eD.trace.setSpanContext(q,K)}if(Z.length===0)return q;let V=eD.propagation.getBaggage(J)??eD.propagation.createBaggage();for(let K of Z){if(K.value===void 0)continue;V=V.setEntry(K.key,{value:decodeURIComponent(K.value)})}return q=eD.propagation.setBaggage(q,V),q}fields(){return[this._jaegerTraceHeader]}}ZF0.JaegerPropagator=GF0;var uQ4=/^[0-9a-f]{1,2}$/i;function pQ4(J){let Q=decodeURIComponent(J).split(":");if(Q.length!==4)return null;let[Y,X,,G]=Q,Z=Y.padStart(32,"0"),q=X.padStart(16,"0"),V=uQ4.test(G)?parseInt(G,16)&1:1;return{traceId:Z,spanId:q,isRemote:!0,traceFlags:V}}});var KF0=f((Yk)=>{Object.defineProperty(Yk,"__esModule",{value:!0});Yk.UBER_TRACE_ID_HEADER=Yk.UBER_BAGGAGE_HEADER_PREFIX=Yk.JaegerPropagator=void 0;var xZ1=VF0();Object.defineProperty(Yk,"JaegerPropagator",{enumerable:!0,get:function(){return xZ1.JaegerPropagator}});Object.defineProperty(Yk,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return xZ1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(Yk,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return xZ1.UBER_TRACE_ID_HEADER}})});var BF0=f((FF0)=>{Object.defineProperty(FF0,"__esModule",{value:!0});FF0.setupPropagator=FF0.setupContextManager=FF0.getPropagatorFromEnv=FF0.getSpanProcessorsFromEnv=FF0.getOtlpProtocolFromEnv=FF0.filterBlanksAndNulls=FF0.getResourceDetectorsFromEnv=void 0;var dG=h6(),I$=V8(),WF0=Jz0(),cQ4=Vz0(),lQ4=Uz0(),iQ4=fz0(),Xk=TD(),Rl=xD(),vZ1=XF0(),nQ4=KF0(),aQ4=Np(),oQ4="env",rQ4="host",sQ4="os",tQ4="process",eQ4="serviceinstance";function JY4(){let J=new Map([[oQ4,Xk.envDetector],[rQ4,Xk.hostDetector],[sQ4,Xk.osDetector],[eQ4,Xk.serviceInstanceIdDetector],[tQ4,Xk.processDetector]]),Q=(0,I$.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];if(Q.includes("all"))return[...J.values()].flat();if(Q.includes("none"))return[];return Q.flatMap((Y)=>{let X=J.get(Y);if(!X)dG.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return X||[]})}FF0.getResourceDetectorsFromEnv=JY4;function HF0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}FF0.filterBlanksAndNulls=HF0;function zF0(){return(0,I$.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,I$.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}FF0.getOtlpProtocolFromEnv=zF0;function QY4(){let J=zF0();switch(J){case"grpc":return new lQ4.OTLPTraceExporter;case"http/json":return new cQ4.OTLPTraceExporter;case"http/protobuf":return new WF0.OTLPTraceExporter;default:return dG.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new WF0.OTLPTraceExporter}}function YY4(){let J=new Map([["otlp",()=>QY4()],["zipkin",()=>new iQ4.ZipkinExporter],["console",()=>new Rl.ConsoleSpanExporter]]),Q=[],Y=[],X=HF0(Array.from(new Set((0,I$.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(X[0]==="none")return dG.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(X.length===0)dG.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),X=["otlp"];else if(X.length>1&&X.includes("none"))dG.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),X=["otlp"];for(let G of X){let Z=J.get(G)?.();if(Z)Q.push(Z);else dG.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${G}.`)}for(let G of Q)if(G instanceof Rl.ConsoleSpanExporter)Y.push(new Rl.SimpleSpanProcessor(G));else Y.push(new Rl.BatchSpanProcessor(G));if(Q.length===0)dG.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}FF0.getSpanProcessorsFromEnv=YY4;function XY4(){let J=(0,I$.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new I$.W3CTraceContextPropagator],["baggage",()=>new I$.W3CBaggagePropagator],["b3",()=>new vZ1.B3Propagator],["b3multi",()=>new vZ1.B3Propagator({injectEncoding:vZ1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new nQ4.JaegerPropagator]]),Y=Array.from(new Set(J)),G=Y.map((Z)=>{let q=Q.get(Z)?.();if(!q){dG.diag.warn(`Propagator "${Z}" requested through environment variable is unavailable.`);return}return q}).reduce((Z,q)=>{if(q)Z.push(q);return Z},[]);if(G.length===0)return null;else if(Y.length===1)return G[0];else return new I$.CompositePropagator({propagators:G})}FF0.getPropagatorFromEnv=XY4;function GY4(J){if(J===null)return;if(J===void 0){let Q=new aQ4.AsyncLocalStorageContextManager;Q.enable(),dG.context.setGlobalContextManager(Q);return}J.enable(),dG.context.setGlobalContextManager(J)}FF0.setupContextManager=GY4;function ZY4(J){if(J===null)return;if(J===void 0){dG.propagation.setGlobalPropagator(new I$.CompositePropagator({propagators:[new I$.W3CTraceContextPropagator,new I$.W3CBaggagePropagator]}));return}dG.propagation.setGlobalPropagator(J)}FF0.setupPropagator=ZY4});var OF0=f((LF0)=>{Object.defineProperty(LF0,"__esModule",{value:!0});LF0.NodeSDK=void 0;var oJ=h6(),zY4=Q_(),FY4=lQ0(),wE=TD(),Gk=RQ1(),UY4=LX0(),BY4=XH0(),fZ1=HH0(),NY4=jH0(),NF0=hH0(),DY4=Ml(),MY4=iH0(),JM=_D(),LY4=xD(),AY4=bQ1(),OY4=WF(),yF=V8(),Zk=BF0();function DF0(J,Q){return parseInt(process.env[J]||"")||Q}function wY4(){let J=[],Q=(0,yF.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)oJ.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return oJ.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),J;return Q.forEach((Y)=>{if(Y==="otlp"){let X=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),G=DF0("OTEL_METRIC_EXPORT_INTERVAL",60000),Z=DF0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(X){case"grpc":J.push(new JM.PeriodicExportingMetricReader({exporter:new NY4.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/json":J.push(new JM.PeriodicExportingMetricReader({exporter:new DY4.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/protobuf":J.push(new JM.PeriodicExportingMetricReader({exporter:new NF0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;default:oJ.diag.warn(`Unsupported OTLP metrics protocol: "${X}". Using http/protobuf.`),J.push(new JM.PeriodicExportingMetricReader({exporter:new NF0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}))}}else if(Y==="console")J.push(new JM.PeriodicExportingMetricReader({exporter:new JM.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new MY4.PrometheusExporter);else oJ.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class MF0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,yF.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,yF.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)oJ.diag.setLogger(new oJ.DiagConsoleLogger,{logLevel:(0,yF.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,wE.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,yF.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,Zk.getResourceDetectorsFromEnv)();else this._resourceDetectors=[wE.envDetector,wE.processDetector,wE.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)oJ.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let X=J.spanProcessor??new LY4.BatchSpanProcessor(J.traceExporter),G=J.spanProcessors??[X];this._tracerProviderConfig={tracerConfig:Y,spanProcessors:G}}if(J.logRecordProcessors)this._loggerProviderConfig={logRecordProcessors:J.logRecordProcessors};else if(J.logRecordProcessor)this._loggerProviderConfig={logRecordProcessors:[J.logRecordProcessor]},oJ.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],oJ.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,FY4.registerInstrumentations)({instrumentations:this._instrumentations}),(0,Zk.setupContextManager)(this._configuration?.contextManager),(0,Zk.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,Zk.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,wE.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,wE.resourceFromAttributes)({[OY4.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,Zk.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new AY4.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),oJ.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new Gk.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,zY4.logs.setGlobalLoggerProvider(Y)}let Q=wY4();if(this._meterProviderConfig||Q.length>0){let Y=[];if(this._meterProviderConfig?.readers)Y.push(...this._meterProviderConfig.readers);if(Y.length===0)Q.forEach((G)=>Y.push(G));let X=new JM.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=X,oJ.metrics.setGlobalMeterProvider(X);for(let G of this._instrumentations)G.setMeterProvider(oJ.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,yF.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)oJ.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){oJ.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let Q=[];if(J.forEach((Y)=>{if(Y==="otlp"){let X=((0,yF.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,yF.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(X){case"grpc":Q.push(new BY4.OTLPLogExporter);break;case"http/json":Q.push(new UY4.OTLPLogExporter);break;case"http/protobuf":Q.push(new fZ1.OTLPLogExporter);break;case void 0:case"":Q.push(new fZ1.OTLPLogExporter);break;default:oJ.diag.warn(`Unsupported OTLP logs protocol: "${X}". Using http/protobuf.`),Q.push(new fZ1.OTLPLogExporter)}}else if(Y==="console")Q.push(new Gk.ConsoleLogRecordExporter);else oJ.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 Gk.ConsoleLogRecordExporter)return new Gk.SimpleLogRecordProcessor(Y);else return new Gk.BatchLogRecordProcessor(Y)})}}}LF0.NodeSDK=MF0});var wF0=f((hZ1)=>{Object.defineProperty(hZ1,"__esModule",{value:!0});hZ1.NodeSDK=hZ1.tracing=hZ1.resources=hZ1.node=hZ1.metrics=hZ1.logs=hZ1.core=hZ1.contextBase=hZ1.api=void 0;hZ1.api=h6();hZ1.contextBase=h6();hZ1.core=V8();hZ1.logs=RQ1();hZ1.metrics=_D();hZ1.node=bQ1();hZ1.resources=TD();hZ1.tracing=xD();var EY4=OF0();Object.defineProperty(hZ1,"NodeSDK",{enumerable:!0,get:function(){return EY4.NodeSDK}})});import yY4 from"os";import Tl from"path";var xF,QM,vF,fF,EF0,mm8,um8,xY4,vY4;var EE=N1(()=>{xF=yY4.homedir(),{env:QM}=process,vF=QM.XDG_DATA_HOME||(xF?Tl.join(xF,".local","share"):void 0),fF=QM.XDG_CONFIG_HOME||(xF?Tl.join(xF,".config"):void 0),EF0=QM.XDG_STATE_HOME||(xF?Tl.join(xF,".local","state"):void 0),mm8=QM.XDG_CACHE_HOME||(xF?Tl.join(xF,".cache"):void 0),um8=QM.XDG_RUNTIME_DIR||void 0,xY4=(QM.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(vF)xY4.unshift(vF);vY4=(QM.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(fF)vY4.unshift(fF)});import{homedir as Cl}from"node:os";import YM from"node:path";var IF0,fY4,PF0,hY4,jl,bY4,IE,TV,im8;var cW=N1(()=>{EE();IF0=YM.join(Cl(),".local/share"),fY4=process.platform==="win32"||process.platform==="darwin"?IF0:vF??IF0,PF0=YM.join(Cl(),".config"),hY4=process.platform==="win32"||process.platform==="darwin"?PF0:fF??PF0,jl=YM.join(fY4,"amp"),bY4=YM.join(hY4,"amp"),IE=YM.join(bY4,"tools"),TV=YM.join(Cl(),".cache","amp"),im8=YM.join(Cl(),".cache","amp","http-debug-logs")});function mY4(){return gY4}function RF0(J){let Q=XM;return XM=J,Q}class CV{baseLogger;scope;context={};constructor(J=TF0){this.baseLogger=J}with(J){let Q=new CV(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new CV(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=bZ1.trace.getActiveSpan();if(Y){let G=Y.spanContext();if(G.traceId)Q.traceId=G.traceId,Q.spanId=G.spanId}if(J.length===0)return[Q];let X=J[0];if(typeof X==="object"&&X!==null)return[{...X,...Q},...J.slice(1)];else return[Q,...J]}}var bZ1,gY4=!1,uY4,XM,TF0,h;var L0=N1(()=>{bZ1=B6(h6(),1);uY4={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(mY4())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 X=bZ1.trace.getActiveSpan();if(X){let G=X.spanContext();if(G.traceId)Y.traceId=G.traceId,Y.spanId=G.spanId}console.info(J,Y)}},XM=uY4;TF0={error:(J,...Q)=>XM.error(J,...Q),warn:(J,...Q)=>XM.warn(J,...Q),info:(J,...Q)=>XM.info(J,...Q),debug:(J,...Q)=>XM.debug(J,...Q),audit:(J,...Q)=>XM.audit(J,...Q)};h=TF0});function xF0(){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 vF0(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&&!oY4.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!rY4.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(sY4.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 tY4(J,Q){if(!J&&!Q)return"file";return J}function eY4(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=P$;else if(Q[0]!==P$)Q=P$+Q;break}return Q}class i0{static isUri(J){if(J instanceof i0)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,X,G,Z=!1,q){if(typeof J==="object")this.scheme=J.scheme||u5,this.authority=J.authority||u5,this.path=J.path||u5,this.query=J.query||u5,this.fragment=J.fragment||u5,this.platform=J.platform;else this.scheme=tY4(J,Z),this.authority=Q||u5,this.path=eY4(this.scheme,Y||u5),this.query=X||u5,this.fragment=G||u5,this.platform=q,vF0(this,Z)}get fsPath(){return mF0(this,!1)}with(J){if(!J)return this;let{scheme:Q,authority:Y,path:X,query:G,fragment:Z,platform:q}=J;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=u5;if(Y===void 0)Y=this.authority;else if(Y===null)Y=u5;if(X===void 0)X=this.path;else if(X===null)X=u5;if(G===void 0)G=this.query;else if(G===null)G=u5;if(Z===void 0)Z=this.fragment;else if(Z===null)Z=u5;if(q===void 0)q=this.platform;else if(q===null)q=void 0;if(Q===this.scheme&&Y===this.authority&&X===this.path&&G===this.query&&Z===this.fragment&&q===this.platform)return this;return new GM(Q,Y,X,G,Z,!1,q)}static parse(J,Q=!1){let Y=JX4.exec(J);if(!Y)return new GM(u5,u5,u5,u5,u5);return new GM(Y[2]||u5,_l(Y[4]||u5),_l(Y[5]||u5),_l(Y[7]||u5),_l(Y[9]||u5),Q)}static file(J,Q=xF0()){let Y=u5;if(Q==="windows")J=J.replace(/\\/g,P$);if(J[0]===P$&&J[1]===P$){let X=J.indexOf(P$,2);if(X===-1)Y=J.substring(2),J=P$;else Y=J.substring(2,X),J=J.substring(X)||P$}return new GM("file",Y,J,u5,u5,!1,Q)}static from(J){let Q=new GM(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return vF0(Q,!0),Q}toString(J=!1){return mZ1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof i0)return J;let Q=new GM(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===bF0(Q.platform)?Y.fsPath:null,Q}}function bF0(J){return J==="windows"?1:void 0}function fF0(J,Q,Y){let X=void 0;for(let G=0;G<J.length;G++){let Z=J.charCodeAt(G);if(Z>=97&&Z<=122||Z>=65&&Z<=90||Z>=48&&Z<=57||Z===45||Z===46||Z===95||Z===126||Q&&Z===47||Y&&Z===91||Y&&Z===93||Y&&Z===58){if(X!==void 0)X+=J.charAt(G)}else{if(X===void 0)X=J.substring(0,G);let q=gF0[Z];if(q!==void 0)X+=q;else X+=encodeURIComponent(J.charAt(G))}}return X!==void 0?X:J}function QX4(J){let Q=void 0;for(let Y=0;Y<J.length;Y++){let X=J.charCodeAt(Y);if(X===35||X===63){if(Q===void 0)Q=J.substring(0,Y);Q+=gF0[X]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function mF0(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 mZ1(J,Q){let Y=!Q?fF0:QX4,X="",{scheme:G,authority:Z,path:q,query:V,fragment:K}=J;if(G)X+=G,X+=":";if(Z||G==="file")X+=P$,X+=P$;if(Z){let W=Z.indexOf("@");if(W!==-1){let H=Z.substring(0,W);if(Z=Z.substring(W+1),W=H.lastIndexOf(":"),W===-1)X+=Y(H,!1,!1);else X+=Y(H.substring(0,W),!1,!1),X+=":",X+=Y(H.substring(W+1),!1,!0);X+="@"}if(Z=Z.toLowerCase(),W=Z.lastIndexOf(":"),W===-1)X+=Y(Z,!1,!0);else X+=Y(Z.substring(0,W),!1,!0),X+=Z.substring(W)}if(q){if(q.length>=3&&q.charCodeAt(0)===47&&q.charCodeAt(2)===58){let W=q.charCodeAt(1);if(W>=65&&W<=90)q=`/${String.fromCharCode(W+32)}:${q.substring(3)}`}else if(q.length>=2&&q.charCodeAt(1)===58){let W=q.charCodeAt(0);if(W>=65&&W<=90)q=`${String.fromCharCode(W+32)}:${q.substring(2)}`}X+=Y(q,!0,!1)}if(V)X+="?",X+=Y(V,!1,!1);if(K)X+="#",X+=!Q?fF0(K,!1,!1):K;return X}function uF0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+uF0(J.substring(3));else return J}}function _l(J){if(!J.match(hF0))return J;return J.replace(hF0,(Q)=>uF0(Q))}function hF(J){return J.scheme==="file"}function rJ(J){return i0.parse(J)}function A6(J){return J.toString()}function l4(J){if(typeof J==="string"||J instanceof URL)return i0.parse(J.toString());return J}function qk(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var oY4,rY4,sY4,u5="",P$="/",JX4,GM,gF0,hF0;var Vk=N1(()=>{oY4=/^\w[\w\d+.-]*$/,rY4=/^\//,sY4=/^\/\//;JX4=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;GM=class GM extends i0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=mF0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=mZ1(this,!1);return this._formatted}return mZ1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=bF0(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}};gF0={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"};hF0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function uZ1(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 ZM(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 q of J)if(q)if(Q)Q+="/"+q;else Q=q;if(!Q)return".";let Y=Q.endsWith("/"),X=Q.split("/").filter(Boolean),G=[];for(let q of X)if(q===".."){if(G.length>0&&G[G.length-1]!=="..")G.pop();else if(!Q.startsWith("/"))G.push("..")}else if(q!==".")G.push(q);let Z=Q.startsWith("/")?"/"+G.join("/"):G.join("/");if(!Z)Z=Q.startsWith("/")?"/":".";if(Y&&Z!=="/"&&Z!==".")Z+="/";return Z}function pF0(J,Q,Y="/",X="/",G=!0){function Z(z,U){return G?z===U:z.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(Z(J,Q))return"";if(!J.startsWith(Y)&&Q.startsWith(Y))return Q;let q=J===Y?[""]:J.split(Y),V=Q===Y?[""]:Q.split(Y),K=0;while(K<q.length&&K<V.length&&Z(q[K],V[K]))K++;let W=q.length-K,H=[];for(let z=0;z<W;z++)H.push("..");return H.push(...V.slice(K)),H.join(X)}function kl(J){let Q=ZM(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function GJ(J){try{if(J=l4(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var TE=N1(()=>{Vk()});function YX4(J,...Q){return J=l4(J),J.with({path:RE(J.path,...Q)})}function XX4(J,...Q){let Y=J.path,X=!1;if(Y[0]!==yl)Y=yl+Y,X=!0;let G=Y;for(let Z of Q)if(Z.startsWith("/"))G=RE(Z);else G=RE(G,Z);if(G!=="/"&&G.endsWith("/"))G=G.replace(/\/+$/,"");if(X&&G[0]===yl&&!J.authority)G=G.substring(1);return J.with({path:G})}function GX4(J){if(J=l4(J),J.path.length===0||J.path===yl)return J;let Q=uZ1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function ZX4(J,Q){if(Q.scheme!==J.scheme||(Q.authority??"")!==(J.authority??""))return!1;let Y=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),X=Y?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,G=Y?J.path.slice(0,2).toUpperCase()+J.path.slice(2):J.path;return G===X||G.startsWith(X.endsWith("/")?X:`${X}/`)||X.endsWith("/")&&G===X.slice(0,-1)}function $X4(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 pF0(J.path,Q.path,Y,Y)}function qX4(J,Q){let Y=A6(J),X=A6(Q);if(Y.startsWith("file:///")&&X.startsWith("file:///"))return dF0(Y)===dF0(X);return Y===X}function dF0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var yl="/",s0;var xl=N1(()=>{TE();Vk();s0={joinPath:YX4,resolvePath:XX4,dirname:GX4,basename:(J)=>ZM(l4(J).path),extname:(J)=>kl(l4(J).path),hasPrefix:ZX4,relativePath:$X4,equalURIs:qX4}});function vl(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function cF0(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 cZ1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function KX4(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(lF0(J,Y.type,Y.value),J._state==="closed")break}function lF0(J,Q,Y){J._state="running";let X=J._observer;try{switch(Q){case"next":if(X&&typeof X.next==="function")X.next(Y);break;case"error":if(cZ1(J),X&&typeof X.error==="function")X.error(Y);else throw Y;break;case"complete":if(cZ1(J),X&&typeof X.complete==="function")X.complete();break}}catch(G){console.error("notifySubscription",G)}if(J._state==="closed")cF0(J);else if(J._state==="running")J._state="ready"}function dZ1(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}],vl(()=>KX4(J));return}lF0(J,Q,Y)}class iF0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new nF0(this);try{this._cleanup=Q.call(void 0,Y)}catch(X){Y.error(X)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")cZ1(this),cF0(this)}}class nF0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){dZ1(this._subscription,"next",J)}error(J){dZ1(this._subscription,"error",J)}complete(){dZ1(this._subscription,"complete")}}function p5(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class CE{_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=[],X=(Z)=>Y.push(Z),G=Promise.resolve().then(async()=>{await Q,await J(X),this._pendingPromises.delete(G);for(let Z of Y)this._baseObserver.next(Z)}).catch((Z)=>{this._pendingPromises.delete(G),this._baseObserver.error(Z)});this._pendingPromises.add(G)}}function lZ1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function iZ1(J){if(lZ1(J))return J;return X0.of(J)}var X0;var jE=N1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");X0=class X0{_subscriber;constructor(J){if(!(this instanceof X0))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 iF0(J,this._subscriber)}pipe(J,...Q){let Y=this;for(let X of[J,...Q])Y=X(Y);return Y}[Symbol.observable](){return this}static from(J){let Q=typeof this==="function"?this:X0;if(J==null)throw TypeError(J+" is not an object");let Y=J[Symbol.observable];if(typeof Y==="function"){let G=Y.call(J);if(Object(G)!==G)throw TypeError(G+" is not an object");if(G instanceof X0)return G;return new Q((Z)=>G.subscribe(Z))}let X=J[Symbol.iterator];if(typeof X==="function")return new Q((G)=>{vl(()=>{if(G.closed)return;for(let Z of X.call(J))if(G.next(Z),G.closed)return;G.complete()})});if(Array.isArray(J))return new Q((G)=>{vl(()=>{if(G.closed)return;for(let Z of J)if(G.next(Z),G.closed)return;G.complete()})});throw TypeError(J+" is not observable")}static of(...J){return new(typeof this==="function"?this:X0)((Y)=>{vl(()=>{if(Y.closed)return;for(let X of J)if(Y.next(X),Y.closed)return;Y.complete()})})}static get[Symbol.species](){return this}}});var i4,P5;var fl=N1(()=>{jE();i4=class i4 extends X0{_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()}};P5=class P5 extends i4{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 X={};if(J)X.next=J;if(Q)X.error=Q;if(Y)X.complete=Y;J=X}return J.next?.(this.currentValue),super.subscribe(J)}getValue(){return this.currentValue}}});var nZ1,Kk;var aF0=N1(()=>{jE();fl();nZ1=class nZ1 extends Set{subject=new P5(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 X0.from(this.subject)}dispose(){this.subject.complete()}};Kk=class Kk extends Map{subject=new P5(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 X0.from(this.subject)}dispose(){this.subject.complete()}}});function hl(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),X=Array.isArray(Q);if(Y!==X)return!1;if(Y&&X)return J.length===Q.length&&J.every((Z,q)=>hl(Z,Q[q]));let G=new Set([...Object.keys(J),...Object.keys(Q)]);for(let Z of G)if(!hl(J[Z],Q[Z]))return!1;return!0}function aZ1(J){return{dispose:J.unsubscribe.bind(J)}}function rF0(...J){return new X0((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}async function N6(J,Q){return new Promise((Y,X)=>{let G=void 0,Z=()=>{G?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",Z,{once:!0}),G=J.subscribe({next:(q)=>{G?.unsubscribe(),Q?.removeEventListener("abort",Z),Y(q)},error:(q)=>{Q?.removeEventListener("abort",Z),X(q)},complete:()=>{Q?.removeEventListener("abort",Z),X("Observable completed without emitting a value")}})})}async function bF(J,Q){return new Promise((Y,X)=>{let G,Z=!1,q=void 0,V=()=>{q?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",V,{once:!0}),q=J.subscribe({next:(K)=>{G=K,Z=!0},error:(K)=>{Q?.removeEventListener("abort",V),X(K)},complete:()=>{if(Q?.removeEventListener("abort",V),Z)Y(G);else X("Observable completed without emitting a value")}})})}async function sF0(J,Q){return new Promise((Y,X)=>{let G=J.subscribe({error:X,complete:()=>Y()});Q?.addEventListener("abort",()=>{G.unsubscribe(),X(new DOMException("Aborted","AbortError"))},{once:!0})})}function k3(J){return new X0((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function r6(J){return new X0((Q)=>{let Y=!1,X=new AbortController,G=X.signal;return(async()=>{try{G?.throwIfAborted();let q=await J(G);if(G?.throwIfAborted(),!Y)Q.next(q),Q.complete()}catch(q){if(!Y)if(G.aborted)Q.complete();else Q.error(q)}})(),()=>{Y=!0,X.abort()}})}function q6(J){return(Q)=>{return new X0((Y)=>{let X=new CE(Y),G=0,Z=Q.subscribe({complete(){X.complete()},error(q){X.error(q)},next(q){X.schedule(async(V)=>{let K=await J(q,G);G++,V(K)})}});return()=>p5(Z)})}}function bl(J){return new X0((Q)=>{let Y=0,X=setInterval(()=>{Q.next(Y++)},J);return()=>clearInterval(X)})}function lW(...J){return new X0((Q)=>{let Y=0,X=J.map((G)=>G.subscribe({next:(Z)=>Q.next(Z),error:(Z)=>Q.error(Z),complete:()=>{if(Y++,Y===J.length)Q.complete()}}));return()=>{tF0(X)}})}function p8(...J){if(J.length===0)return Wk;return new X0((Q)=>{let Y=Array(J.length),X=Array(J.length).fill(0),G=Array(J.length).fill(!1),Z=0,q=[],V=new CE(Q);for(let K=0;K<J.length;K++){let W=J[K];q.push(W.subscribe({next(H){Y[K]=H,G[K]=!0;let z=++X[K];if(G.every(Boolean))V.schedule(async(U)=>{if(X[K]===z)U([...Y])})},error(H){V.error(H)},complete(){if(Z++,Z===J.length)V.complete()}}))}return()=>{tF0(q)}})}function o8(J){let Y=J?.shouldCountRefs??!0,X=WX4++,G=(Z,...q)=>{};return(Z)=>{let q=new i4,V=null,K=!1,W,H=0;return new X0((z)=>{if(H++,K)G("new subscriber, emitting buffered value",W),z.next(W);else G("new subscriber, no buffered value to emit");if(!V)V=Z.subscribe({next:(N)=>{K=!0,W=N,q.next(N)},error:(N)=>q.error(N),complete:()=>q.complete()});let U=q.subscribe(z);return()=>{if(H--,U.unsubscribe(),Y&&H===0){if(V)p5(V),V=null;K=!1}}})}}function tF0(J){for(let Q of J)if(Q)p5(Q)}function gF(J){return(Q)=>{return new X0((Y)=>{let X=Q.subscribe({next:(Z)=>Y.next(Z),error:(Z)=>Y.error(Z),complete:()=>Y.complete()}),G=J.subscribe({next:()=>{Y.complete(),X.unsubscribe(),G.unsubscribe()},error:(Z)=>{Y.error(Z),X.unsubscribe()}});return()=>{X.unsubscribe(),G.unsubscribe()}})}}function R$(J){return(Q)=>{return new X0((Y)=>{let X,G=Q.subscribe({next(Z){X=Z,Y.next(Z)},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{p5(G),J(X)}})}}function v4(J=hl){return(Q)=>{return new X0((Y)=>{let X=oF0,G=new CE(Y),Z=Q.subscribe({complete(){G.complete()},error(q){G.error(q)},next(q){G.schedule(async(V)=>{if(X===oF0||!J(X,q))X=q,V(q)})}});return()=>p5(Z)})}}function HX(J){return HX4(typeof J==="function"?{next:J}:J)}function HX4(J){return(Q)=>new X0((Y)=>{let X=typeof J==="function"?J():J,G=Q.subscribe({next(Z){if(X.next)try{X.next(Z)}catch(q){Y.error(q);return}Y.next(Z)},error(Z){if(X.error)try{X.error(Z)}catch(q){Y.error(q);return}Y.error(Z)},complete(){if(X.complete)try{X.complete()}catch(Z){Y.error(Z);return}Y.complete()}});return()=>p5(G)})}function mF(J){return(Q)=>{return new X0((Y)=>{let X=!1,G=Q.subscribe({next:(q)=>{X=!0,clearTimeout(Z),Y.next(q)},error:(q)=>{clearTimeout(Z),Y.error(q)},complete:()=>{clearTimeout(Z),Y.complete()}}),Z=setTimeout(()=>{if(!X)G.unsubscribe(),Y.error(new gl(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(Z),G.unsubscribe()}})}}function d8(J){return(Q)=>new X0((Y)=>{let X;try{Y.next(J),X=Q.subscribe({next(G){Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}})}catch(G){Y.error(G)}return()=>{if(X)p5(X)}})}function uF(J){return(Q)=>new X0((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X<J){if(Y.next(Z),X++,X===J)Y.complete(),p5(G)}},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{p5(G)}})}function eF0(J){return(Q)=>new X0((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X>=J)Y.next(Z);else X++},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{p5(G)}})}function oZ1(J){return(Q)=>{return new X0((Y)=>{let X=0,G=new Set,Z=!1,q=()=>{if(Z&&G.size===0)Y.complete()},V=Q.subscribe({next(K){let H=J(K,X++).subscribe({next(z){Y.next(z)},error(z){Y.error(z)},complete(){G.delete(H),q()}});G.add(H)},error(K){Y.error(K)},complete(){Z=!0,q()}});return()=>{p5(V);for(let K of G)if(K)p5(K)}})}}function f4(J){return(Q)=>{return new X0((Y)=>{let X=0,G=null,Z=!1,q=()=>{if(Z&&!G)Y.complete()},V=Q.subscribe({next(K){if(G)p5(G),G=null;let W;try{W=J(K,X++)}catch(H){Y.error(H);return}G=W.subscribe({next(H){Y.next(H)},error(H){Y.error(H)},complete(){G=null,q()}})},error(K){Y.error(K)},complete(){Z=!0,q()}});return()=>{if(p5(V),G)p5(G)}})}}function T$(J){return(Q)=>new X0((Y)=>{let X=null,G=null,Z=!1,q=Q.subscribe({next:(V)=>{if(G=V,Z=!0,X===null)X=setTimeout(()=>{if(Z)Y.next(G),Z=!1;X=null},J)},error:(V)=>Y.error(V),complete:()=>{if(X!==null)clearTimeout(X);if(Z)Y.next(G);Y.complete()}});return()=>{if(p5(q),X!==null)clearTimeout(X)}})}function Hk(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Y)=>new X0((X)=>{let G=0,Z=null,q=null,V=!1,K=Y.subscribe({next:(W)=>{let H=Date.now();if(q=W,V=!0,H-G>=J)X.next(W),G=H,V=!1;else if(Z===null)Z=setTimeout(()=>{if(V)X.next(q),G=Date.now(),V=!1;Z=null},J-(H-G));if(G===0)X.next(W),G=H,V=!1},error:(W)=>X.error(W),complete:()=>{if(Z!==null)clearTimeout(Z);if(V)X.next(q);X.complete()}});return()=>{if(p5(K),Z!==null)clearTimeout(Z)}})}function $M(...J){return new X0((Q)=>{let Y=0,X=null;function G(){if(Y>=J.length){Q.complete();return}X=J[Y].subscribe({next:(q)=>Q.next(q),error:(q)=>Q.error(q),complete:()=>{Y++,G()}})}return G(),()=>{if(X)p5(X)}})}function zX(J){return(Q)=>new X0((Y)=>{let X=0,G=!1,Z=null,q=Q.subscribe({next(V){try{let K=J(V,X++);if(Z)p5(Z);Z=K.subscribe({next(W){Y.next(W)},error(W){Y.error(W)},complete(){if(Z=null,G&&!Z)Y.complete()}})}catch(K){Y.error(K)}},error(V){Y.error(V)},complete(){if(G=!0,!Z)Y.complete()}});return()=>{if(p5(q),Z)p5(Z)}})}function zk({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new X0((X)=>{J?.();let G=Y.subscribe(X);return()=>{p5(G),Q?.()}})}function pF(J){return(Q)=>X0.from(Q).pipe(f4((Y)=>r6((X)=>J(Y,X))))}function u7(J){return(Q)=>new X0((Y)=>{let X,G=Q.subscribe({next(Z){Y.next(Z)},error(Z){try{X=J(Z).subscribe({next(V){Y.next(V)},error(V){Y.error(V)},complete(){Y.complete()}})}catch(q){Y.error(q)}},complete(){Y.complete()}});return()=>{if(p5(G),X)p5(X)}})}function N7(J){return(Q)=>{return new X0((Y)=>{let X=Q.subscribe({next(G){if(J(G))Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>p5(X)})}}function JU0(J,Q){return(Y)=>{return new X0((X)=>{let G,Z=0,q=new CE(X),V=Y.subscribe({complete(){q.complete()},error(K){q.error(K)},next(K){q.schedule(async(W)=>{G=await J(Z===0?typeof Q>"u"?K:Q:G,K,Z++),W(G)})}});return()=>p5(V)})}}var Wk,cG,Ou8,WX4=0,oF0,gl;var rZ1=N1(()=>{jE();fl();Wk=new X0((J)=>{J.complete()}),cG=new X0(()=>{});Ou8=Symbol("noInitialValue");oF0={};gl=class gl extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function ml(J,Q){return(Y)=>{return X0.from(Y).pipe(f4((X)=>X===jV?X0.of(jV):J(X).pipe(u7((G)=>X0.of(G instanceof Error?G:Error(G))),d8(jV))),o8(Q))}}function zX4(){return(J)=>X0.from(J).pipe(N7((Q)=>Q!==jV))}async function QU0(J,Q){let Y=await N6(X0.from(J).pipe(zX4()),Q);if(Y instanceof Error)throw Y;return Y}var jV;var YU0=N1(()=>{jE();rZ1();jV=Symbol.for("@@pendingOperation")});var a0=N1(()=>{aF0();jE();YU0();rZ1();fl()});var G4=N1(()=>{Vk();xl();TE()});import{promises as FX4}from"node:fs";import*as qM from"node:path";async function XU0(J){try{let Q=await FX4.open(J,"r");try{let Y=Buffer.alloc(128);await Q.read(Y,0,128,0);let X=Y.toString("utf-8").split(`
48
- `)[0];if(!X?.startsWith("#!"))return{interpreter:null,isValid:!1};let G=X.slice(2).trim();if(!G)return{interpreter:null,isValid:!1};let Z=G.split(/\s+/).filter((q)=>q.length>0);if(Z[0]?.endsWith("/env")&&Z.length>1)return{interpreter:Z.slice(1),isValid:!0};return{interpreter:Z,isValid:!0}}finally{await Q.close()}}catch{return{interpreter:null,isValid:!1}}}function GU0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=qM.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function ZU0(J){return qM.extname(J).toLowerCase()===".md"}function $U0(J){let Q=J.replace(/\\/g,"/"),Y=qM.basename(Q);return qM.basename(Y,qM.extname(Y))}function qU0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var VU0=()=>{};var zU0={};y8(zU0,{CommandDiscovery:()=>HU0});import*as WU0 from"node:fs";import{promises as ul}from"node:fs";import{homedir as KU0}from"node:os";import*as FX from"node:path";function tZ1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class HU0{config;workspaceRoots;watchFactory;debounceMs;changes=new i4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??UX4,this.debounceMs=Y.debounceMs??200}get commandChanges(){return this.changes}async discoverCommands(){if(this.disposed)return[];try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());if(h.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return h.error("Failed to discover commands",{error:J}),[]}}async discoverWorkspaceCommands(){let J=[];for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=s0.joinPath(Q,Y),G=await this.discoverCommandsInDirectory(X,"workspace");J.push(...G)}return J}async discoverGlobalCommands(){let J=[];for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q),X=i0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await tZ1(ul.access(Y),sZ1,"directory access")}catch{return[]}let G=(await tZ1(ul.readdir(Y,{withFileTypes:!0}),sZ1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=FX.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return h.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return h.warn(`Failed to discover commands in directory: ${J.fsPath}`,{error:Y}),[]}}ignoreCommandName(J){return J.startsWith(".")||J==="README.md"}async createCommand(J,Q){try{let Y=await ul.stat(J),X=FX.basename(J);if(this.ignoreCommandName(X))return null;let G=$U0(X);if(!qU0(G))return h.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(ZU0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return h.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:FX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=FX.basename(J),Z=GU0(Q.mode,G),q=await XU0(J),V=FX.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return h.debug(`Skipping non-executable file without shebang: ${J}`),null;let K=Z&&(q.isValid||this.isNativeBinary(V)),W=this.getExecutableUnavailableReason(Z,q.isValid,V);return{kind:"executable",name:Y,filePath:J,sourceDirectory:FX.dirname(J),lastModified:Q.mtimeMs,isExecutable:Z,interpreter:q.interpreter,extension:V,available:K,unavailableReason:W,source:X}}isNativeBinary(J){if(process.platform==="win32")return[".exe",".bat",".cmd",".ps1"].includes(J.toLowerCase());return J===""}getExecutableUnavailableReason(J,Q,Y){let X=this.isNativeBinary(Y);if(!J)return"File is not executable (missing execute permissions)";if(!Q&&!X)return"Missing shebang and not a recognized binary type";return}resolveGlobalPath(J){if(J.startsWith("~/"))return FX.join(KU0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=fF||FX.join(KU0(),".config");return FX.join(Q,J.slice(10))}return J}async setupWatching(){if(this.disposed)return;this.stopWatching();let J=new Set;for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=s0.joinPath(Q,Y);J.add(X.fsPath)}for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q);J.add(Y)}for(let Q of J)await this.watchDirectory(Q)}async watchDirectory(J){try{await tZ1(ul.access(J),sZ1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{h.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{h.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),h.debug("Started watching command directory",{directory:J})}catch(Q){h.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){h.debug("Skipping watch for non-existent directory",{directory:J})}}scheduleRefresh(){if(this.disposed)return;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());h.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){h.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),h.debug("Stopped watching command directory",{directory:J})}catch(Y){h.warn("Failed to close watcher",{directory:J,error:Y})}this.watchers.clear()}finally{if(this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=void 0}}dispose(){this.disposed=!0;try{this.stopWatching()}catch(J){h.warn("Error during command discovery cleanup",{error:J})}}}var sZ1=5000,UX4=(J,Q)=>WU0.watch(J,Q);var FU0=N1(()=>{G4();a0();EE();L0();VU0()});function r9(J,Q,Y=Q+"s"){return J===1?Q:Y}function dF(J){let Q=typeof J==="string"?J:J.toString();return Q===BY||Q===BY.slice(0,-1)}function yE(J){return dF(J)?BY:J}var yX4,BY,xX4,Rp8;var cF=N1(()=>{yX4=new URL("https://ampcode.com/"),BY=yX4.toString(),xX4=new URL("https://api.anthropic.com/"),Rp8=xX4.toString()});var D9,W$1,y6,SV=(J)=>{switch(typeof J){case"undefined":return y6.undefined;case"string":return y6.string;case"number":return Number.isNaN(J)?y6.nan:y6.number;case"boolean":return y6.boolean;case"function":return y6.function;case"bigint":return y6.bigint;case"symbol":return y6.symbol;case"object":if(Array.isArray(J))return y6.array;if(J===null)return y6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return y6.promise;if(typeof Map<"u"&&J instanceof Map)return y6.map;if(typeof Set<"u"&&J instanceof Set)return y6.set;if(typeof Date<"u"&&J instanceof Date)return y6.date;return y6.object;default:return y6.unknown}};var Dk=N1(()=>{(function(J){J.assertEqual=(G)=>{};function Q(G){}J.assertIs=Q;function Y(G){throw Error()}J.assertNever=Y,J.arrayToEnum=(G)=>{let Z={};for(let q of G)Z[q]=q;return Z},J.getValidEnumValues=(G)=>{let Z=J.objectKeys(G).filter((V)=>typeof G[G[V]]!=="number"),q={};for(let V of Z)q[V]=G[V];return J.objectValues(q)},J.objectValues=(G)=>{return J.objectKeys(G).map(function(Z){return G[Z]})},J.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let Z=[];for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q))Z.push(q);return Z},J.find=(G,Z)=>{for(let q of G)if(Z(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function X(G,Z=" | "){return G.map((q)=>typeof q==="string"?`'${q}'`:q).join(Z)}J.joinValues=X,J.jsonStringifyReplacer=(G,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(D9||(D9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(W$1||(W$1={}));y6=D9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var z6,vX4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},NY;var il=N1(()=>{Dk();z6=D9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);NY=class NY extends Error{get errors(){return this.issues}constructor(J){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=J}format(J){let Q=J||function(G){return G.message},Y={_errors:[]},X=(G)=>{for(let Z of G.issues)if(Z.code==="invalid_union")Z.unionErrors.map(X);else if(Z.code==="invalid_return_type")X(Z.returnTypeError);else if(Z.code==="invalid_arguments")X(Z.argumentsError);else if(Z.path.length===0)Y._errors.push(Q(Z));else{let q=Y,V=0;while(V<Z.path.length){let K=Z.path[V];if(V!==Z.path.length-1)q[K]=q[K]||{_errors:[]};else q[K]=q[K]||{_errors:[]},q[K]._errors.push(Q(Z));q=q[K],V++}}};return X(this),Y}static assert(J){if(!(J instanceof NY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,D9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(J=(Q)=>Q.message){let Q={},Y=[];for(let X of this.issues)if(X.path.length>0){let G=X.path[0];Q[G]=Q[G]||[],Q[G].push(J(X))}else Y.push(J(X));return{formErrors:Y,fieldErrors:Q}}get formErrors(){return this.flatten()}};NY.create=(J)=>{return new NY(J)}});var fX4=(J,Q)=>{let Y;switch(J.code){case z6.invalid_type:if(J.received===y6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case z6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,D9.jsonStringifyReplacer)}`;break;case z6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${D9.joinValues(J.keys,", ")}`;break;case z6.invalid_union:Y="Invalid input";break;case z6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${D9.joinValues(J.options)}`;break;case z6.invalid_enum_value:Y=`Invalid enum value. Expected ${D9.joinValues(J.options)}, received '${J.received}'`;break;case z6.invalid_arguments:Y="Invalid function arguments";break;case z6.invalid_return_type:Y="Invalid function return type";break;case z6.invalid_date:Y="Invalid date";break;case z6.invalid_string:if(typeof J.validation==="object")if("includes"in J.validation){if(Y=`Invalid input: must include "${J.validation.includes}"`,typeof J.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${J.validation.position}`}else if("startsWith"in J.validation)Y=`Invalid input: must start with "${J.validation.startsWith}"`;else if("endsWith"in J.validation)Y=`Invalid input: must end with "${J.validation.endsWith}"`;else D9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case z6.too_small:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at least":"more than"} ${J.minimum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at least":"over"} ${J.minimum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="bigint")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(J.minimum))}`;else Y="Invalid input";break;case z6.too_big:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at most":"less than"} ${J.maximum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at most":"under"} ${J.maximum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="bigint")Y=`BigInt must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly":J.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(J.maximum))}`;else Y="Invalid input";break;case z6.custom:Y="Invalid input";break;case z6.invalid_intersection_types:Y="Intersection results could not be merged";break;case z6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case z6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,D9.assertNever(J)}return{message:Y}},iW;var H$1=N1(()=>{il();Dk();iW=fX4});function hX4(J){EU0=J}function xE(){return EU0}var EU0;var nl=N1(()=>{H$1();EU0=iW});function a6(J,Q){let Y=xE(),X=Mk({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===iW?void 0:iW].filter((G)=>!!G)});J.common.issues.push(X)}class ZJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Y=[];for(let X of Q){if(X.status==="aborted")return t4;if(X.status==="dirty")J.dirty();Y.push(X.value)}return{status:J.value,value:Y}}static async mergeObjectAsync(J,Q){let Y=[];for(let X of Q){let G=await X.key,Z=await X.value;Y.push({key:G,value:Z})}return ZJ.mergeObjectSync(J,Y)}static mergeObjectSync(J,Q){let Y={};for(let X of Q){let{key:G,value:Z}=X;if(G.status==="aborted")return t4;if(Z.status==="aborted")return t4;if(G.status==="dirty")J.dirty();if(Z.status==="dirty")J.dirty();if(G.value!=="__proto__"&&(typeof Z.value<"u"||X.alwaysSet))Y[G.value]=Z.value}return{status:J.value,value:Y}}}var Mk=(J)=>{let{data:Q,path:Y,errorMaps:X,issueData:G}=J,Z=[...Y,...G.path||[]],q={...G,path:Z};if(G.message!==void 0)return{...G,path:Z,message:G.message};let V="",K=X.filter((W)=>!!W).slice().reverse();for(let W of K)V=W(q,{data:Q,defaultError:V}).message;return{...G,path:Z,message:V}},bX4,t4,KM=(J)=>({status:"dirty",value:J}),sJ=(J)=>({status:"valid",value:J}),al=(J)=>J.status==="aborted",ol=(J)=>J.status==="dirty",lF=(J)=>J.status==="valid",vE=(J)=>typeof Promise<"u"&&J instanceof Promise;var z$1=N1(()=>{nl();H$1();bX4=[];t4=Object.freeze({status:"aborted"})});var IU0=()=>{};var L4;var PU0=N1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(L4||(L4={}))});class k${constructor(J,Q,Y,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Y,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function k8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Y,required_error:X,description:G}=J;if(Q&&(Y||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(q,V)=>{let{message:K}=J;if(q.code==="invalid_enum_value")return{message:K??V.defaultError};if(typeof V.data>"u")return{message:K??X??V.defaultError};if(q.code!=="invalid_type")return{message:V.defaultError};return{message:K??Y??V.defaultError}},description:G}}class r8{get description(){return this._def.description}_getType(J){return SV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:SV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new ZJ,ctx:{common:J.parent.common,data:J.data,parsedType:SV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(vE(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(J){let Q=this._parse(J);return Promise.resolve(Q)}parse(J,Q){let Y=this.safeParse(J,Q);if(Y.success)return Y.data;throw Y.error}safeParse(J,Q){let Y={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:SV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return RU0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:SV(J)};if(!this["~standard"].async)try{let Y=this._parseSync({data:J,path:[],parent:Q});return lF(Y)?{value:Y.value}:{issues:Q.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:J,path:[],parent:Q}).then((Y)=>lF(Y)?{value:Y.value}:{issues:Q.common.issues})}async parseAsync(J,Q){let Y=await this.safeParseAsync(J,Q);if(Y.success)return Y.data;throw Y.error}async safeParseAsync(J,Q){let Y={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:SV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(vE(X)?X:Promise.resolve(X));return RU0(Y,G)}refine(J,Q){let Y=(X)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(X);else return Q};return this._refinement((X,G)=>{let Z=J(X),q=()=>G.addIssue({code:z6.custom,...Y(X)});if(typeof Promise<"u"&&Z instanceof Promise)return Z.then((V)=>{if(!V)return q(),!1;else return!0});if(!Z)return q(),!1;else return!0})}refinement(J,Q){return this._refinement((Y,X)=>{if(!J(Y))return X.addIssue(typeof Q==="function"?Q(Y,X):Q),!1;else return!0})}_refinement(J){return new y$({schema:this,typeName:q8.ZodEffects,effect:{type:"refinement",refinement:J}})}superRefine(J){return this._refinement(J)}constructor(J){this.spa=this.safeParseAsync,this._def=J,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Q)=>this["~validate"](Q)}}optional(){return _$.create(this,this._def)}nullable(){return aW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S$.create(this)}promise(){return FM.create(this,this._def)}or(J){return uE.create([this,J],this._def)}and(J){return pE.create(this,J,this._def)}transform(J){return new y$({...k8(this._def),schema:this,typeName:q8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new iE({...k8(this._def),innerType:this,defaultValue:Q,typeName:q8.ZodDefault})}brand(){return new sl({typeName:q8.ZodBranded,type:this,...k8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new nE({...k8(this._def),innerType:this,catchValue:Q,typeName:q8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return Ik.create(this,J)}readonly(){return aE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function jU0(J){let Q="[0-5]\\d";if(J.precision)Q=`${Q}\\.\\d{${J.precision}}`;else if(J.precision==null)Q=`${Q}(\\.\\d+)?`;let Y=J.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${Y}`}function QG4(J){return new RegExp(`^${jU0(J)}$`)}function SU0(J){let Q=`${CU0}T${jU0(J)}`,Y=[];if(Y.push(J.local?"Z?":"Z"),J.offset)Y.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${Y.join("|")})`,new RegExp(`^${Q}$`)}function YG4(J,Q){if((Q==="v4"||!Q)&&aX4.test(J))return!0;if((Q==="v6"||!Q)&&rX4.test(J))return!0;return!1}function XG4(J,Q){if(!cX4.test(J))return!1;try{let[Y]=J.split(".");if(!Y)return!1;let X=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),G=JSON.parse(atob(X));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&G.alg!==Q)return!1;return!0}catch{return!1}}function GG4(J,Q){if((Q==="v4"||!Q)&&oX4.test(J))return!0;if((Q==="v6"||!Q)&&sX4.test(J))return!0;return!1}function ZG4(J,Q){let Y=(J.toString().split(".")[1]||"").length,X=(Q.toString().split(".")[1]||"").length,G=Y>X?Y:X,Z=Number.parseInt(J.toFixed(G).replace(".","")),q=Number.parseInt(Q.toFixed(G).replace(".",""));return Z%q/10**G}function fE(J){if(J instanceof _7){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=_$.create(fE(X))}return new _7({...J._def,shape:()=>Q})}else if(J instanceof S$)return new S$({...J._def,type:fE(J.element)});else if(J instanceof _$)return _$.create(fE(J.unwrap()));else if(J instanceof aW)return aW.create(fE(J.unwrap()));else if(J instanceof kV)return kV.create(J.items.map((Q)=>fE(Q)));else return J}function U$1(J,Q){let Y=SV(J),X=SV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===y6.object&&X===y6.object){let G=D9.objectKeys(Q),Z=D9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=U$1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===y6.array&&X===y6.array){if(J.length!==Q.length)return{valid:!1};let G=[];for(let Z=0;Z<J.length;Z++){let q=J[Z],V=Q[Z],K=U$1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===y6.date&&X===y6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function _U0(J,Q){return new oF({values:J,typeName:q8.ZodEnum,...k8(Q)})}function TU0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function kU0(J,Q={},Y){if(J)return HM.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=TU0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=TU0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return HM.create()}var RU0=(J,Q)=>{if(lF(Q))return{success:!0,data:Q.value};else{if(!J.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Y=new NY(J.common.issues);return this._error=Y,this._error}}}},gX4,mX4,uX4,pX4,dX4,cX4,lX4,iX4,nX4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",F$1,aX4,oX4,rX4,sX4,tX4,eX4,CU0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",JG4,j$,nF,aF,bE,WM,Lk,gE,mE,HM,iF,_V,Ak,S$,_7,uE,nW=(J)=>{if(J instanceof dE)return nW(J.schema);else if(J instanceof y$)return nW(J.innerType());else if(J instanceof cE)return[J.value];else if(J instanceof oF)return J.options;else if(J instanceof lE)return D9.objectValues(J.enum);else if(J instanceof iE)return nW(J._def.innerType);else if(J instanceof gE)return[void 0];else if(J instanceof mE)return[null];else if(J instanceof _$)return[void 0,...nW(J.unwrap())];else if(J instanceof aW)return[null,...nW(J.unwrap())];else if(J instanceof sl)return nW(J.unwrap());else if(J instanceof aE)return nW(J.unwrap());else if(J instanceof nE)return nW(J._def.innerType);else return[]},rl,pE,kV,Ok,wk,zM,hE,dE,cE,oF,lE,FM,y$,_$,aW,iE,nE,Ek,$G4,sl,Ik,aE,qG4,q8,VG4=(J,Q={message:`Input not instance of ${J.name}`})=>kU0((Y)=>Y instanceof J,Q),yU0,xU0,KG4,WG4,vU0,HG4,zG4,FG4,UG4,BG4,NG4,DG4,MG4,LG4,AG4,OG4,wG4,EG4,IG4,PG4,RG4,TG4,CG4,jG4,SG4,_G4,kG4,yG4,xG4,vG4,fG4,hG4,bG4,gG4,mG4=()=>yU0().optional(),uG4=()=>xU0().optional(),pG4=()=>vU0().optional(),dG4,cG4;var fU0=N1(()=>{il();nl();PU0();z$1();Dk();gX4=/^c[^\s-]{8,}$/i,mX4=/^[0-9a-z]+$/,uX4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pX4=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dX4=/^[a-z0-9_-]{21}$/i,cX4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lX4=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iX4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aX4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,oX4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rX4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,sX4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tX4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eX4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,JG4=new RegExp(`^${CU0}$`);j$=class j$ extends r8{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==y6.string){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_type,expected:y6.string,received:G.parsedType}),t4}let Y=new ZJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.length<G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(J.data.length>G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="length"){let Z=J.data.length>G.value,q=J.data.length<G.value;if(Z||q){if(X=this._getOrReturnCtx(J,X),Z)a6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)a6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!iX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"email",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!F$1)F$1=new RegExp(nX4,"u");if(!F$1.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"emoji",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!pX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"uuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!dX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"nanoid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!gX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"cuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!mX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"cuid2",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!uX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"ulid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),a6(X,{validation:"url",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"regex",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="trim")J.data=J.data.trim();else if(G.kind==="includes"){if(!J.data.includes(G.value,G.position))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Y.dirty()}else if(G.kind==="toLowerCase")J.data=J.data.toLowerCase();else if(G.kind==="toUpperCase")J.data=J.data.toUpperCase();else if(G.kind==="startsWith"){if(!J.data.startsWith(G.value))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:{startsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="endsWith"){if(!J.data.endsWith(G.value))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!SU0(G).test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!JG4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!QG4(G).test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!lX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"duration",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!YG4(J.data,G.version))X=this._getOrReturnCtx(J,X),a6(X,{validation:"ip",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!XG4(J.data,G.alg))X=this._getOrReturnCtx(J,X),a6(X,{validation:"jwt",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!GG4(J.data,G.version))X=this._getOrReturnCtx(J,X),a6(X,{validation:"cidr",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!tX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"base64",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!eX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"base64url",code:z6.invalid_string,message:G.message}),Y.dirty()}else D9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:z6.invalid_string,...L4.errToObj(Y)})}_addCheck(J){return new j$({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...L4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...L4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...L4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...L4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...L4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...L4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...L4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...L4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...L4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...L4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...L4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...L4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...L4.errToObj(J)})}datetime(J){if(typeof J==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:J});return this._addCheck({kind:"datetime",precision:typeof J?.precision>"u"?null:J?.precision,offset:J?.offset??!1,local:J?.local??!1,...L4.errToObj(J?.message)})}date(J){return this._addCheck({kind:"date",message:J})}time(J){if(typeof J==="string")return this._addCheck({kind:"time",precision:null,message:J});return this._addCheck({kind:"time",precision:typeof J?.precision>"u"?null:J?.precision,...L4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...L4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...L4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...L4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...L4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...L4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...L4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...L4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...L4.errToObj(Q)})}nonempty(J){return this.min(1,L4.errToObj(J))}trim(){return new j$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((J)=>J.kind==="datetime")}get isDate(){return!!this._def.checks.find((J)=>J.kind==="date")}get isTime(){return!!this._def.checks.find((J)=>J.kind==="time")}get isDuration(){return!!this._def.checks.find((J)=>J.kind==="duration")}get isEmail(){return!!this._def.checks.find((J)=>J.kind==="email")}get isURL(){return!!this._def.checks.find((J)=>J.kind==="url")}get isEmoji(){return!!this._def.checks.find((J)=>J.kind==="emoji")}get isUUID(){return!!this._def.checks.find((J)=>J.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((J)=>J.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((J)=>J.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((J)=>J.kind==="cuid2")}get isULID(){return!!this._def.checks.find((J)=>J.kind==="ulid")}get isIP(){return!!this._def.checks.find((J)=>J.kind==="ip")}get isCIDR(){return!!this._def.checks.find((J)=>J.kind==="cidr")}get isBase64(){return!!this._def.checks.find((J)=>J.kind==="base64")}get isBase64url(){return!!this._def.checks.find((J)=>J.kind==="base64url")}get minLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};j$.create=(J)=>{return new j$({checks:[],typeName:q8.ZodString,coerce:J?.coerce??!1,...k8(J)})};nF=class nF extends r8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(J){if(this._def.coerce)J.data=Number(J.data);if(this._getType(J)!==y6.number){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_type,expected:y6.number,received:G.parsedType}),t4}let Y=void 0,X=new ZJ;for(let G of this._def.checks)if(G.kind==="int"){if(!D9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.invalid_type,expected:"integer",received:"float",message:G.message}),X.dirty()}else if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(ZG4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(J.data))Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.not_finite,message:G.message}),X.dirty()}else D9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,L4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,L4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,L4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,L4.toString(Q))}setLimit(J,Q,Y,X){return new nF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:L4.toString(X)}]})}_addCheck(J){return new nF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:L4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:L4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:L4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L4.toString(J)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}get isInt(){return!!this._def.checks.find((J)=>J.kind==="int"||J.kind==="multipleOf"&&D9.isInteger(J.value))}get isFinite(){let J=null,Q=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(Q===null||Y.value>Q)Q=Y.value}else if(Y.kind==="max"){if(J===null||Y.value<J)J=Y.value}return Number.isFinite(Q)&&Number.isFinite(J)}};nF.create=(J)=>{return new nF({checks:[],typeName:q8.ZodNumber,coerce:J?.coerce||!1,...k8(J)})};aF=class aF extends r8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(J){if(this._def.coerce)try{J.data=BigInt(J.data)}catch{return this._getInvalidInput(J)}if(this._getType(J)!==y6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new ZJ;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(J.data%G.value!==BigInt(0))Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else D9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return a6(Q,{code:z6.invalid_type,expected:y6.bigint,received:Q.parsedType}),t4}gte(J,Q){return this.setLimit("min",J,!0,L4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,L4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,L4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,L4.toString(Q))}setLimit(J,Q,Y,X){return new aF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:L4.toString(X)}]})}_addCheck(J){return new aF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:L4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:L4.toString(Q)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};aF.create=(J)=>{return new aF({checks:[],typeName:q8.ZodBigInt,coerce:J?.coerce??!1,...k8(J)})};bE=class bE extends r8{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==y6.boolean){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.boolean,received:Y.parsedType}),t4}return sJ(J.data)}};bE.create=(J)=>{return new bE({typeName:q8.ZodBoolean,coerce:J?.coerce||!1,...k8(J)})};WM=class WM extends r8{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==y6.date){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_type,expected:y6.date,received:G.parsedType}),t4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_date}),t4}let Y=new ZJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.getTime()<G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Y.dirty()}else if(G.kind==="max"){if(J.data.getTime()>G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else D9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new WM({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:L4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:L4.toString(Q)})}get minDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J!=null?new Date(J):null}get maxDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J!=null?new Date(J):null}};WM.create=(J)=>{return new WM({checks:[],coerce:J?.coerce||!1,typeName:q8.ZodDate,...k8(J)})};Lk=class Lk extends r8{_parse(J){if(this._getType(J)!==y6.symbol){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.symbol,received:Y.parsedType}),t4}return sJ(J.data)}};Lk.create=(J)=>{return new Lk({typeName:q8.ZodSymbol,...k8(J)})};gE=class gE extends r8{_parse(J){if(this._getType(J)!==y6.undefined){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.undefined,received:Y.parsedType}),t4}return sJ(J.data)}};gE.create=(J)=>{return new gE({typeName:q8.ZodUndefined,...k8(J)})};mE=class mE extends r8{_parse(J){if(this._getType(J)!==y6.null){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.null,received:Y.parsedType}),t4}return sJ(J.data)}};mE.create=(J)=>{return new mE({typeName:q8.ZodNull,...k8(J)})};HM=class HM extends r8{constructor(){super(...arguments);this._any=!0}_parse(J){return sJ(J.data)}};HM.create=(J)=>{return new HM({typeName:q8.ZodAny,...k8(J)})};iF=class iF extends r8{constructor(){super(...arguments);this._unknown=!0}_parse(J){return sJ(J.data)}};iF.create=(J)=>{return new iF({typeName:q8.ZodUnknown,...k8(J)})};_V=class _V extends r8{_parse(J){let Q=this._getOrReturnCtx(J);return a6(Q,{code:z6.invalid_type,expected:y6.never,received:Q.parsedType}),t4}};_V.create=(J)=>{return new _V({typeName:q8.ZodNever,...k8(J)})};Ak=class Ak extends r8{_parse(J){if(this._getType(J)!==y6.undefined){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.void,received:Y.parsedType}),t4}return sJ(J.data)}};Ak.create=(J)=>{return new Ak({typeName:q8.ZodVoid,...k8(J)})};S$=class S$ extends r8{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==y6.array)return a6(Q,{code:z6.invalid_type,expected:y6.array,received:Q.parsedType}),t4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)a6(Q,{code:Z?z6.too_big:z6.too_small,minimum:q?X.exactLength.value:void 0,maximum:Z?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Y.dirty()}if(X.minLength!==null){if(Q.data.length<X.minLength.value)a6(Q,{code:z6.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Y.dirty()}if(X.maxLength!==null){if(Q.data.length>X.maxLength.value)a6(Q,{code:z6.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Y.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((Z,q)=>{return X.type._parseAsync(new k$(Q,Z,Q.path,q))})).then((Z)=>{return ZJ.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new k$(Q,Z,Q.path,q))});return ZJ.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new S$({...this._def,minLength:{value:J,message:L4.toString(Q)}})}max(J,Q){return new S$({...this._def,maxLength:{value:J,message:L4.toString(Q)}})}length(J,Q){return new S$({...this._def,exactLength:{value:J,message:L4.toString(Q)}})}nonempty(J){return this.min(1,J)}};S$.create=(J,Q)=>{return new S$({type:J,minLength:null,maxLength:null,exactLength:null,typeName:q8.ZodArray,...k8(Q)})};_7=class _7 extends r8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let J=this._def.shape(),Q=D9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==y6.object){let K=this._getOrReturnCtx(J);return a6(K,{code:z6.invalid_type,expected:y6.object,received:K.parsedType}),t4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof _V&&this._def.unknownKeys==="strip")){for(let K in X.data)if(!Z.includes(K))q.push(K)}let V=[];for(let K of Z){let W=G[K],H=X.data[K];V.push({key:{status:"valid",value:K},value:W._parse(new k$(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof _V){let K=this._def.unknownKeys;if(K==="passthrough")for(let W of q)V.push({key:{status:"valid",value:W},value:{status:"valid",value:X.data[W]}});else if(K==="strict"){if(q.length>0)a6(X,{code:z6.unrecognized_keys,keys:q}),Y.dirty()}else if(K==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let W of q){let H=X.data[W];V.push({key:{status:"valid",value:W},value:K._parse(new k$(X,H,X.path,W)),alwaysSet:W in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let K=[];for(let W of V){let H=await W.key,z=await W.value;K.push({key:H,value:z,alwaysSet:W.alwaysSet})}return K}).then((K)=>{return ZJ.mergeObjectSync(Y,K)});else return ZJ.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return L4.errToObj,new _7({...this._def,unknownKeys:"strict",...J!==void 0?{errorMap:(Q,Y)=>{let X=this._def.errorMap?.(Q,Y).message??Y.defaultError;if(Q.code==="unrecognized_keys")return{message:L4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new _7({...this._def,unknownKeys:"strip"})}passthrough(){return new _7({...this._def,unknownKeys:"passthrough"})}extend(J){return new _7({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new _7({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:q8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new _7({...this._def,catchall:J})}pick(J){let Q={};for(let Y of D9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new _7({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of D9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new _7({...this._def,shape:()=>Q})}deepPartial(){return fE(this)}partial(J){let Q={};for(let Y of D9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new _7({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of D9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof _$)G=G._def.innerType;Q[Y]=G}return new _7({...this._def,shape:()=>Q})}keyof(){return _U0(D9.objectKeys(this.shape))}};_7.create=(J,Q)=>{return new _7({shape:()=>J,unknownKeys:"strip",catchall:_V.create(),typeName:q8.ZodObject,...k8(Q)})};_7.strictCreate=(J,Q)=>{return new _7({shape:()=>J,unknownKeys:"strict",catchall:_V.create(),typeName:q8.ZodObject,...k8(Q)})};_7.lazycreate=(J,Q)=>{return new _7({shape:J,unknownKeys:"strip",catchall:_V.create(),typeName:q8.ZodObject,...k8(Q)})};uE=class uE extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=this._def.options;function X(G){for(let q of G)if(q.result.status==="valid")return q.result;for(let q of G)if(q.result.status==="dirty")return Q.common.issues.push(...q.ctx.common.issues),q.result;let Z=G.map((q)=>new NY(q.ctx.common.issues));return a6(Q,{code:z6.invalid_union,unionErrors:Z}),t4}if(Q.common.async)return Promise.all(Y.map(async(G)=>{let Z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:Z}),ctx:Z}})).then(X);else{let G=void 0,Z=[];for(let V of Y){let K={...Q,common:{...Q.common,issues:[]},parent:null},W=V._parseSync({data:Q.data,path:Q.path,parent:K});if(W.status==="valid")return W;else if(W.status==="dirty"&&!G)G={result:W,ctx:K};if(K.common.issues.length)Z.push(K.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let q=Z.map((V)=>new NY(V));return a6(Q,{code:z6.invalid_union,unionErrors:q}),t4}}get options(){return this._def.options}};uE.create=(J,Q)=>{return new uE({options:J,typeName:q8.ZodUnion,...k8(Q)})};rl=class rl extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==y6.object)return a6(Q,{code:z6.invalid_type,expected:y6.object,received:Q.parsedType}),t4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return a6(Q,{code:z6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),t4;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Y){let X=new Map;for(let G of Q){let Z=nW(G.shape[J]);if(!Z.length)throw Error(`A discriminator value for key \`${J}\` could not be extracted from all schema options`);for(let q of Z){if(X.has(q))throw Error(`Discriminator property ${String(J)} has duplicate value ${String(q)}`);X.set(q,G)}}return new rl({typeName:q8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...k8(Y)})}};pE=class pE extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(al(G)||al(Z))return t4;let q=U$1(G.value,Z.value);if(!q.valid)return a6(Y,{code:z6.invalid_intersection_types}),t4;if(ol(G)||ol(Z))Q.dirty();return{status:Q.value,value:q.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([G,Z])=>X(G,Z));else return X(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}};pE.create=(J,Q,Y)=>{return new pE({left:J,right:Q,typeName:q8.ZodIntersection,...k8(Y)})};kV=class kV extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.array)return a6(Y,{code:z6.invalid_type,expected:y6.array,received:Y.parsedType}),t4;if(Y.data.length<this._def.items.length)return a6(Y,{code:z6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t4;if(!this._def.rest&&Y.data.length>this._def.items.length)a6(Y,{code:z6.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let G=[...Y.data].map((Z,q)=>{let V=this._def.items[q]||this._def.rest;if(!V)return null;return V._parse(new k$(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return ZJ.mergeArray(Q,Z)});else return ZJ.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new kV({...this._def,rest:J})}};kV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new kV({items:J,typeName:q8.ZodTuple,rest:null,...k8(Q)})};Ok=class Ok extends r8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.object)return a6(Y,{code:z6.invalid_type,expected:y6.object,received:Y.parsedType}),t4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new k$(Y,q,Y.path,q)),value:Z._parse(new k$(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return ZJ.mergeObjectAsync(Q,X);else return ZJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof r8)return new Ok({keyType:J,valueType:Q,typeName:q8.ZodRecord,...k8(Y)});return new Ok({keyType:j$.create(),valueType:J,typeName:q8.ZodRecord,...k8(Q)})}};wk=class wk extends r8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.map)return a6(Y,{code:z6.invalid_type,expected:y6.map,received:Y.parsedType}),t4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new k$(Y,q,Y.path,[K,"key"])),value:G._parse(new k$(Y,V,Y.path,[K,"value"]))}});if(Y.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let V of Z){let K=await V.key,W=await V.value;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let V of Z){let{key:K,value:W}=V;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};wk.create=(J,Q,Y)=>{return new wk({valueType:Q,keyType:J,typeName:q8.ZodMap,...k8(Y)})};zM=class zM extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.set)return a6(Y,{code:z6.invalid_type,expected:y6.set,received:Y.parsedType}),t4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)a6(Y,{code:z6.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),Q.dirty()}if(X.maxSize!==null){if(Y.data.size>X.maxSize.value)a6(Y,{code:z6.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let G=this._def.valueType;function Z(V){let K=new Set;for(let W of V){if(W.status==="aborted")return t4;if(W.status==="dirty")Q.dirty();K.add(W.value)}return{status:Q.value,value:K}}let q=[...Y.data.values()].map((V,K)=>G._parse(new k$(Y,V,Y.path,K)));if(Y.common.async)return Promise.all(q).then((V)=>Z(V));else return Z(q)}min(J,Q){return new zM({...this._def,minSize:{value:J,message:L4.toString(Q)}})}max(J,Q){return new zM({...this._def,maxSize:{value:J,message:L4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};zM.create=(J,Q)=>{return new zM({valueType:J,minSize:null,maxSize:null,typeName:q8.ZodSet,...k8(Q)})};hE=class hE extends r8{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==y6.function)return a6(Q,{code:z6.invalid_type,expected:y6.function,received:Q.parsedType}),t4;function Y(q,V){return Mk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,xE(),iW].filter((K)=>!!K),issueData:{code:z6.invalid_arguments,argumentsError:V}})}function X(q,V){return Mk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,xE(),iW].filter((K)=>!!K),issueData:{code:z6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof FM){let q=this;return sJ(async function(...V){let K=new NY([]),W=await q._def.args.parseAsync(V,G).catch((U)=>{throw K.addIssue(Y(V,U)),K}),H=await Reflect.apply(Z,this,W);return await q._def.returns._def.type.parseAsync(H,G).catch((U)=>{throw K.addIssue(X(H,U)),K})})}else{let q=this;return sJ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new NY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new NY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new hE({...this._def,args:kV.create(J).rest(iF.create())})}returns(J){return new hE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new hE({args:J?J:kV.create([]).rest(iF.create()),returns:Q||iF.create(),typeName:q8.ZodFunction,...k8(Y)})}};dE=class dE extends r8{get schema(){return this._def.getter()}_parse(J){let{ctx:Q}=this._processInputParams(J);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};dE.create=(J,Q)=>{return new dE({getter:J,typeName:q8.ZodLazy,...k8(Q)})};cE=class cE extends r8{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return a6(Q,{received:Q.data,code:z6.invalid_literal,expected:this._def.value}),t4}return{status:"valid",value:J.data}}get value(){return this._def.value}};cE.create=(J,Q)=>{return new cE({value:J,typeName:q8.ZodLiteral,...k8(Q)})};oF=class oF extends r8{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return a6(Q,{expected:D9.joinValues(Y),received:Q.parsedType,code:z6.invalid_type}),t4}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Y=this._def.values;return a6(Q,{received:Q.data,code:z6.invalid_enum_value,options:Y}),t4}return sJ(J.data)}get options(){return this._def.values}get enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Values(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}extract(J,Q=this._def){return oF.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return oF.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};oF.create=_U0;lE=class lE extends r8{_parse(J){let Q=D9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==y6.string&&Y.parsedType!==y6.number){let X=D9.objectValues(Q);return a6(Y,{expected:D9.joinValues(X),received:Y.parsedType,code:z6.invalid_type}),t4}if(!this._cache)this._cache=new Set(D9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=D9.objectValues(Q);return a6(Y,{received:Y.data,code:z6.invalid_enum_value,options:X}),t4}return sJ(J.data)}get enum(){return this._def.values}};lE.create=(J,Q)=>{return new lE({values:J,typeName:q8.ZodNativeEnum,...k8(Q)})};FM=class FM extends r8{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==y6.promise&&Q.common.async===!1)return a6(Q,{code:z6.invalid_type,expected:y6.promise,received:Q.parsedType}),t4;let Y=Q.parsedType===y6.promise?Q.data:Promise.resolve(Q.data);return sJ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};FM.create=(J,Q)=>{return new FM({type:J,typeName:q8.ZodPromise,...k8(Q)})};y$=class y$ extends r8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=this._def.effect||null,G={addIssue:(Z)=>{if(a6(Y,Z),Z.fatal)Q.abort();else Q.dirty()},get path(){return Y.path}};if(G.addIssue=G.addIssue.bind(G),X.type==="preprocess"){let Z=X.transform(Y.data,G);if(Y.common.async)return Promise.resolve(Z).then(async(q)=>{if(Q.value==="aborted")return t4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return t4;if(V.status==="dirty")return KM(V.value);if(Q.value==="dirty")return KM(V.value);return V});else{if(Q.value==="aborted")return t4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")return KM(q.value);if(Q.value==="dirty")return KM(q.value);return q}}if(X.type==="refinement"){let Z=(q)=>{let V=X.refinement(q,G);if(Y.common.async)return Promise.resolve(V);if(V instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Y.common.async===!1){let q=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((q)=>{if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Y.common.async===!1){let Z=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!lF(Z))return t4;let q=X.transform(Z.value,G);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((Z)=>{if(!lF(Z))return t4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});D9.assertNever(X)}};y$.create=(J,Q,Y)=>{return new y$({schema:J,typeName:q8.ZodEffects,effect:Q,...k8(Y)})};y$.createWithPreprocess=(J,Q,Y)=>{return new y$({schema:Q,effect:{type:"preprocess",transform:J},typeName:q8.ZodEffects,...k8(Y)})};_$=class _$ extends r8{_parse(J){if(this._getType(J)===y6.undefined)return sJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};_$.create=(J,Q)=>{return new _$({innerType:J,typeName:q8.ZodOptional,...k8(Q)})};aW=class aW extends r8{_parse(J){if(this._getType(J)===y6.null)return sJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};aW.create=(J,Q)=>{return new aW({innerType:J,typeName:q8.ZodNullable,...k8(Q)})};iE=class iE extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===y6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};iE.create=(J,Q)=>{return new iE({innerType:J,typeName:q8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...k8(Q)})};nE=class nE extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y={...Q,common:{...Q.common,issues:[]}},X=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(vE(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new NY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new NY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};nE.create=(J,Q)=>{return new nE({innerType:J,typeName:q8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...k8(Q)})};Ek=class Ek extends r8{_parse(J){if(this._getType(J)!==y6.nan){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.nan,received:Y.parsedType}),t4}return{status:"valid",value:J.data}}};Ek.create=(J)=>{return new Ek({typeName:q8.ZodNaN,...k8(J)})};$G4=Symbol("zod_brand");sl=class sl extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;return this._def.type._parse({data:Y,path:Q.path,parent:Q})}unwrap(){return this._def.type}};Ik=class Ik extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return t4;if(G.status==="dirty")return Q.dirty(),KM(G.value);else return this._def.out._parseAsync({data:G.value,path:Y.path,parent:Y})})();else{let X=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(X.status==="aborted")return t4;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Y.path,parent:Y})}}static create(J,Q){return new Ik({in:J,out:Q,typeName:q8.ZodPipeline})}};aE=class aE extends r8{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(lF(X))X.value=Object.freeze(X.value);return X};return vE(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};aE.create=(J,Q)=>{return new aE({innerType:J,typeName:q8.ZodReadonly,...k8(Q)})};qG4={object:_7.lazycreate};(function(J){J.ZodString="ZodString",J.ZodNumber="ZodNumber",J.ZodNaN="ZodNaN",J.ZodBigInt="ZodBigInt",J.ZodBoolean="ZodBoolean",J.ZodDate="ZodDate",J.ZodSymbol="ZodSymbol",J.ZodUndefined="ZodUndefined",J.ZodNull="ZodNull",J.ZodAny="ZodAny",J.ZodUnknown="ZodUnknown",J.ZodNever="ZodNever",J.ZodVoid="ZodVoid",J.ZodArray="ZodArray",J.ZodObject="ZodObject",J.ZodUnion="ZodUnion",J.ZodDiscriminatedUnion="ZodDiscriminatedUnion",J.ZodIntersection="ZodIntersection",J.ZodTuple="ZodTuple",J.ZodRecord="ZodRecord",J.ZodMap="ZodMap",J.ZodSet="ZodSet",J.ZodFunction="ZodFunction",J.ZodLazy="ZodLazy",J.ZodLiteral="ZodLiteral",J.ZodEnum="ZodEnum",J.ZodEffects="ZodEffects",J.ZodNativeEnum="ZodNativeEnum",J.ZodOptional="ZodOptional",J.ZodNullable="ZodNullable",J.ZodDefault="ZodDefault",J.ZodCatch="ZodCatch",J.ZodPromise="ZodPromise",J.ZodBranded="ZodBranded",J.ZodPipeline="ZodPipeline",J.ZodReadonly="ZodReadonly"})(q8||(q8={}));yU0=j$.create,xU0=nF.create,KG4=Ek.create,WG4=aF.create,vU0=bE.create,HG4=WM.create,zG4=Lk.create,FG4=gE.create,UG4=mE.create,BG4=HM.create,NG4=iF.create,DG4=_V.create,MG4=Ak.create,LG4=S$.create,AG4=_7.create,OG4=_7.strictCreate,wG4=uE.create,EG4=rl.create,IG4=pE.create,PG4=kV.create,RG4=Ok.create,TG4=wk.create,CG4=zM.create,jG4=hE.create,SG4=dE.create,_G4=cE.create,kG4=oF.create,yG4=lE.create,xG4=FM.create,vG4=y$.create,fG4=_$.create,hG4=aW.create,bG4=y$.createWithPreprocess,gG4=Ik.create,dG4={string:(J)=>j$.create({...J,coerce:!0}),number:(J)=>nF.create({...J,coerce:!0}),boolean:(J)=>bE.create({...J,coerce:!0}),bigint:(J)=>aF.create({...J,coerce:!0}),date:(J)=>WM.create({...J,coerce:!0})},cG4=t4});var Q1={};y8(Q1,{void:()=>MG4,util:()=>D9,unknown:()=>NG4,union:()=>wG4,undefined:()=>FG4,tuple:()=>PG4,transformer:()=>vG4,symbol:()=>zG4,string:()=>yU0,strictObject:()=>OG4,setErrorMap:()=>hX4,set:()=>CG4,record:()=>RG4,quotelessJson:()=>vX4,promise:()=>xG4,preprocess:()=>bG4,pipeline:()=>gG4,ostring:()=>mG4,optional:()=>fG4,onumber:()=>uG4,oboolean:()=>pG4,objectUtil:()=>W$1,object:()=>AG4,number:()=>xU0,nullable:()=>hG4,null:()=>UG4,never:()=>DG4,nativeEnum:()=>yG4,nan:()=>KG4,map:()=>TG4,makeIssue:()=>Mk,literal:()=>_G4,lazy:()=>SG4,late:()=>qG4,isValid:()=>lF,isDirty:()=>ol,isAsync:()=>vE,isAborted:()=>al,intersection:()=>IG4,instanceof:()=>VG4,getParsedType:()=>SV,getErrorMap:()=>xE,function:()=>jG4,enum:()=>kG4,effect:()=>vG4,discriminatedUnion:()=>EG4,defaultErrorMap:()=>iW,datetimeRegex:()=>SU0,date:()=>HG4,custom:()=>kU0,coerce:()=>dG4,boolean:()=>vU0,bigint:()=>WG4,array:()=>LG4,any:()=>BG4,addIssueToContext:()=>a6,ZodVoid:()=>Ak,ZodUnknown:()=>iF,ZodUnion:()=>uE,ZodUndefined:()=>gE,ZodType:()=>r8,ZodTuple:()=>kV,ZodTransformer:()=>y$,ZodSymbol:()=>Lk,ZodString:()=>j$,ZodSet:()=>zM,ZodSchema:()=>r8,ZodRecord:()=>Ok,ZodReadonly:()=>aE,ZodPromise:()=>FM,ZodPipeline:()=>Ik,ZodParsedType:()=>y6,ZodOptional:()=>_$,ZodObject:()=>_7,ZodNumber:()=>nF,ZodNullable:()=>aW,ZodNull:()=>mE,ZodNever:()=>_V,ZodNativeEnum:()=>lE,ZodNaN:()=>Ek,ZodMap:()=>wk,ZodLiteral:()=>cE,ZodLazy:()=>dE,ZodIssueCode:()=>z6,ZodIntersection:()=>pE,ZodFunction:()=>hE,ZodFirstPartyTypeKind:()=>q8,ZodError:()=>NY,ZodEnum:()=>oF,ZodEffects:()=>y$,ZodDiscriminatedUnion:()=>rl,ZodDefault:()=>iE,ZodDate:()=>WM,ZodCatch:()=>nE,ZodBranded:()=>sl,ZodBoolean:()=>bE,ZodBigInt:()=>aF,ZodArray:()=>S$,ZodAny:()=>HM,Schema:()=>r8,ParseStatus:()=>ZJ,OK:()=>sJ,NEVER:()=>cG4,INVALID:()=>t4,EMPTY_PATH:()=>bX4,DIRTY:()=>KM,BRAND:()=>$G4});var B$1=N1(()=>{nl();z$1();IU0();Dk();fU0();il()});var Pk=N1(()=>{B$1();B$1()});function tJ(J,Q){let Y=nG4(J,Q);return typeof Y==="string"?Y:Y.toString()}function nG4(J,Q,Y=!0){if(!Q)Q=aG4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?i0.parse(J):i0.from(J);if(X)for(let V of X){let K=l4(V);if(s0.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?ZM(K.path)+(G?"\\":"/"):"";return D$1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=l4(Z);if(s0.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return D$1("~"+(G?"\\":"/")+W,G,q.scheme)}}return D$1(q.fsPath,G,q.scheme)}return q}function D$1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function el(J){let Q=tl;return tl=J,Q}function aG4(){if(tl)return tl;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var tl=null;var oW=N1(()=>{G4();TE();xl()});var oG4=(J)=>{let Q=0,Y=[];while(Q<J.length){let X=J[Q];if(X==="\\"){Q++;continue}if(X==="{"){Y.push({type:"brace",value:"{"}),Q++;continue}if(X==="}"){Y.push({type:"brace",value:"}"}),Q++;continue}if(X==="["){Y.push({type:"paren",value:"["}),Q++;continue}if(X==="]"){Y.push({type:"paren",value:"]"}),Q++;continue}if(X===":"){Y.push({type:"separator",value:":"}),Q++;continue}if(X===","){Y.push({type:"delimiter",value:","}),Q++;continue}if(X==='"'){let V="",K=!1;X=J[++Q];while(X!=='"'){if(Q===J.length){K=!0;break}if(X==="\\"){if(Q++,Q===J.length){K=!0;break}V+=X+J[Q],X=J[++Q]}else V+=X,X=J[++Q]}if(X=J[++Q],!K)Y.push({type:"string",value:V});continue}if(X&&/\s/.test(X)){Q++;continue}let Z=/[0-9]/;if(X&&Z.test(X)||X==="-"||X==="."){let V="";if(X==="-")V+=X,X=J[++Q];while(X&&Z.test(X)||X===".")V+=X,X=J[++Q];Y.push({type:"number",value:V});continue}let q=/[a-z]/i;if(X&&q.test(X)){let V="";while(X&&q.test(X)){if(Q===J.length)break;V+=X,X=J[++Q]}if(V=="true"||V=="false"||V==="null")Y.push({type:"name",value:V});else{Q++;continue}continue}Q++}return Y},rE=(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),rE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),rE(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),rE(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),rE(J);break;case"delimiter":return J=J.slice(0,J.length-1),rE(J);break}return J},rG4=(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},sG4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},lG=(J)=>JSON.parse(sG4(rG4(rE(oG4(J)))));var UM=()=>{};function eJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function DM(J){return!!J&&!!J[BX]}function sF(J){if(!J)return!1;return pU0(J)||Array.isArray(J)||!!J[Rk]||!!J.constructor?.[Rk]||_k(J)||kk(J)}function pU0(J){if(!J||typeof J!=="object")return!1;let Q=NM(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)===tG4}function Tk(J,Q){if(MM(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function MM(J){let Q=J[BX];return Q?Q.type_:Array.isArray(J)?1:_k(J)?2:kk(J)?3:0}function Ck(J,Q){return MM(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function M$1(J,Q){return MM(J)===2?J.get(Q):J[Q]}function dU0(J,Q,Y){let X=MM(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function eG4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function _k(J){return J instanceof Map}function kk(J){return J instanceof Set}function BM(J){return J.copy_||J.base_}function O$1(J,Q){if(_k(J))return new Map(J);if(kk(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=pU0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[BX];let G=Reflect.ownKeys(X);for(let Z=0;Z<G.length;Z++){let q=G[Z],V=X[q];if(V.writable===!1)V.writable=!0,V.configurable=!0;if(V.get||V.set)X[q]={configurable:!0,writable:!0,enumerable:V.enumerable,value:J[q]}}return Object.create(NM(J),X)}else{let X=NM(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function DX(J,Q=!1){if(Yi(J)||DM(J)||!sF(J))return J;if(MM(J)>1)J.set=J.add=J.clear=J.delete=JZ4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>DX(X,!0));return J}function JZ4(){eJ(2)}function Yi(J){return Object.isFrozen(J)}function LM(J){let Q=w$1[J];if(!Q)eJ(0,J);return Q}function QZ4(J,Q){if(!w$1[J])w$1[J]=Q}function cU0(){return jk}function YZ4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function bU0(J,Q){if(Q)LM("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function E$1(J){I$1(J),J.drafts_.forEach(XZ4),J.drafts_=null}function I$1(J){if(J===jk)jk=J.parent_}function gU0(J){return jk=YZ4(jk,J)}function XZ4(J){let Q=J[BX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function mU0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[BX].modified_)E$1(Q),eJ(4);if(sF(J)){if(J=Ji(Q,J),!Q.parent_)Qi(Q,J)}if(Q.patches_)LM("Patches").generateReplacementPatches_(Y[BX].base_,J,Q.patches_,Q.inversePatches_)}else J=Ji(Q,Y,[]);if(E$1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==T$1?J:void 0}function Ji(J,Q,Y){if(Yi(Q))return Q;let X=Q[BX];if(!X)return Tk(Q,(G,Z)=>uU0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Qi(J,X.base_,!0),X.base_;if(!X.finalized_){X.finalized_=!0,X.scope_.unfinalizedDrafts_--;let G=X.copy_,Z=G,q=!1;if(X.type_===3)Z=new Set(G),G.clear(),q=!0;if(Tk(Z,(V,K)=>uU0(J,X,G,V,K,Y,q)),Qi(J,G,!1),Y&&J.patches_)LM("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function uU0(J,Q,Y,X,G,Z,q){if(DM(G)){let V=Z&&Q&&Q.type_!==3&&!Ck(Q.assigned_,X)?Z.concat(X):void 0,K=Ji(J,G,V);if(dU0(Y,X,K),DM(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(sF(G)&&!Yi(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Ji(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))Qi(J,G)}}function Qi(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)DX(Q,Y)}function GZ4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:cU0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=C$1;if(Y)G=[X],Z=Sk;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function L$1(J,Q){let Y=J[BX];return(Y?BM(Y):J)[Q]}function ZZ4(J,Q,Y){let X=lU0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function lU0(J,Q){if(!(Q in J))return;let Y=NM(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=NM(Y)}return}function P$1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)P$1(J.parent_)}}function A$1(J){if(!J.copy_)J.copy_=O$1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function R$1(J,Q){let Y=_k(J)?LM("MapSet").proxyMap_(J,Q):kk(J)?LM("MapSet").proxySet_(J,Q):GZ4(J,Q);return(Q?Q.scope_:cU0()).drafts_.push(Y),Y}function qZ4(J){if(!DM(J))eJ(10,J);return iU0(J)}function iU0(J){if(!sF(J)||Yi(J))return J;let Q=J[BX],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=O$1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=O$1(J,!0);if(Tk(Y,(X,G)=>{dU0(Y,X,iU0(G))}),Q)Q.finalized_=!1;return Y}function Xi(){let Q="replace",Y="add",X="remove";function G(U,N,M,L){switch(U.type_){case 0:case 2:return q(U,N,M,L);case 1:return Z(U,N,M,L);case 3:return V(U,N,M,L)}}function Z(U,N,M,L){let{base_:A,assigned_:E}=U,P=U.copy_;if(P.length<A.length)[A,P]=[P,A],[M,L]=[L,M];for(let I=0;I<A.length;I++)if(E[I]&&P[I]!==A[I]){let T=N.concat([I]);M.push({op:Q,path:T,value:z(P[I])}),L.push({op:Q,path:T,value:z(A[I])})}for(let I=A.length;I<P.length;I++){let T=N.concat([I]);M.push({op:Y,path:T,value:z(P[I])})}for(let I=P.length-1;A.length<=I;--I){let T=N.concat([I]);L.push({op:X,path:T})}}function q(U,N,M,L){let{base_:A,copy_:E}=U;Tk(U.assigned_,(P,I)=>{let T=M$1(A,P),S=M$1(E,P),y=!I?X:Ck(A,P)?Q:Y;if(T===S&&y===Q)return;let x=N.concat(P);M.push(y===X?{op:y,path:x}:{op:y,path:x,value:S}),L.push(y===Y?{op:X,path:x}:y===X?{op:Y,path:x,value:z(T)}:{op:Q,path:x,value:z(T)})})}function V(U,N,M,L){let{base_:A,copy_:E}=U,P=0;A.forEach((I)=>{if(!E.has(I)){let T=N.concat([P]);M.push({op:X,path:T,value:I}),L.unshift({op:Y,path:T,value:I})}P++}),P=0,E.forEach((I)=>{if(!A.has(I)){let T=N.concat([P]);M.push({op:Y,path:T,value:I}),L.unshift({op:X,path:T,value:I})}P++})}function K(U,N,M,L){M.push({op:Q,path:[],value:N===T$1?void 0:N}),L.push({op:Q,path:[],value:U})}function W(U,N){return N.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let S=0;S<L.length-1;S++){let y=MM(E),x=L[S];if(typeof x!=="string"&&typeof x!=="number")x=""+x;if((y===0||y===1)&&(x==="__proto__"||x==="constructor"))eJ(19);if(typeof E==="function"&&x==="prototype")eJ(19);if(E=M$1(E,x),typeof E!=="object")eJ(18,L.join("/"))}let P=MM(E),I=H(M.value),T=L[L.length-1];switch(A){case Q:switch(P){case 2:return E.set(T,I);case 3:eJ(16);default:return E[T]=I}case Y:switch(P){case 1:return T==="-"?E.push(I):E.splice(T,0,I);case 2:return E.set(T,I);case 3:return E.add(I);default:return E[T]=I}case X:switch(P){case 1:return E.splice(T,1);case 2:return E.delete(T);case 3:return E.delete(M.value);default:return delete E[T]}default:eJ(17,A)}}),U}function H(U){if(!sF(U))return U;if(Array.isArray(U))return U.map(H);if(_k(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(kk(U))return new Set(Array.from(U).map(H));let N=Object.create(NM(U));for(let M in U)N[M]=H(U[M]);if(Ck(U,Rk))N[Rk]=U[Rk];return N}function z(U){if(DM(U))return H(U);else return U}QZ4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function $9(J){return J}var T$1,Rk,BX,NM,tG4,w$1,jk,C$1,Sk,$Z4=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Y,X)=>{if(typeof Q==="function"&&typeof Y!=="function"){let Z=Y;Y=Q;let q=this;return function(K=Z,...W){return q.produce(K,(H)=>Y.call(this,H,...W))}}if(typeof Y!=="function")eJ(6);if(X!==void 0&&typeof X!=="function")eJ(7);let G;if(sF(Q)){let Z=gU0(this),q=R$1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)E$1(Z);else I$1(Z)}return bU0(Z,X),mU0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===T$1)G=void 0;if(this.autoFreeze_)DX(G,!0);if(X){let Z=[],q=[];LM("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else eJ(1,Q)},this.produceWithPatches=(Q,Y)=>{if(typeof Q==="function")return(q,...V)=>this.produceWithPatches(q,(K)=>Q(K,...V));let X,G;return[this.produce(Q,Y,(q,V)=>{X=q,G=V}),X,G]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!sF(J))eJ(8);if(DM(J))J=qZ4(J);let Q=gU0(this),Y=R$1(J,void 0);return Y[BX].isManual_=!0,I$1(Q),Y}finishDraft(J,Q){let Y=J&&J[BX];if(!Y||!Y.isManual_)eJ(9);let{scope_:X}=Y;return bU0(X,Q),mU0(void 0,X)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Y;for(Y=Q.length-1;Y>=0;Y--){let G=Q[Y];if(G.path.length===0&&G.op==="replace"){J=G.value;break}}if(Y>-1)Q=Q.slice(Y+1);let X=LM("Patches").applyPatches_;if(DM(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},NX,tF,AM,Wd8,Hd8,nU0,zd8,Fd8;var DY=N1(()=>{T$1=Symbol.for("immer-nothing"),Rk=Symbol.for("immer-draftable"),BX=Symbol.for("immer-state");NM=Object.getPrototypeOf;tG4=Object.prototype.constructor.toString();w$1={};C$1={get(J,Q){if(Q===BX)return J;let Y=BM(J);if(!Ck(Y,Q))return ZZ4(J,Y,Q);let X=Y[Q];if(J.finalized_||!sF(X))return X;if(X===L$1(J.base_,Q))return A$1(J),J.copy_[Q]=R$1(X,J);return X},has(J,Q){return Q in BM(J)},ownKeys(J){return Reflect.ownKeys(BM(J))},set(J,Q,Y){let X=lU0(BM(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=L$1(BM(J),Q),Z=G?.[BX];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(eG4(Y,G)&&(Y!==void 0||Ck(J.base_,Q)))return!0;A$1(J),P$1(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(L$1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,A$1(J),P$1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=BM(J),X=Reflect.getOwnPropertyDescriptor(Y,Q);if(!X)return X;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:X.enumerable,value:Y[Q]}},defineProperty(){eJ(11)},getPrototypeOf(J){return NM(J.base_)},setPrototypeOf(){eJ(12)}},Sk={};Tk(C$1,(J,Q)=>{Sk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});Sk.deleteProperty=function(J,Q){return Sk.set.call(this,J,Q,void 0)};Sk.set=function(J,Q,Y){return C$1.set.call(this,J[0],Q,Y,J[0])};NX=new $Z4,tF=NX.produce,AM=NX.produceWithPatches.bind(NX),Wd8=NX.setAutoFreeze.bind(NX),Hd8=NX.setUseStrictShallowCopy.bind(NX),nU0=NX.applyPatches.bind(NX),zd8=NX.createDraft.bind(NX),Fd8=NX.finishDraft.bind(NX)});function j$1({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 sE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(VZ4,"")}var VZ4;var Gi=N1(()=>{VZ4=j$1()});var oU0=f((Ld8,S$1)=>{var eF={};if(typeof S$1>"u")window.eastasianwidth=eF;else S$1.exports=eF;eF.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Y=J.length==2?J.charCodeAt(1):0,X=Q;if(55296<=Q&&Q<=56319&&(56320<=Y&&Y<=57343))Q&=1023,Y&=1023,X=Q<<10|Y,X+=65536;if(X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510)return"F";if(X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518)return"H";if(4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141)return"W";if(32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630)return"Na";if(X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109)return"A";return"N"};eF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function aU0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}eF.length=function(J){var Q=aU0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};eF.slice=function(J,Q,Y){if(textLen=eF.length(J),Q=Q?Q:0,Y=Y?Y:1,Q<0)Q=textLen+Q;if(Y<0)Y=textLen+Y;var X="",G=0,Z=aU0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=eF.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var _$1=f((Ad8,rU0)=>{rU0.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 KZ4,WZ4;var sU0=N1(()=>{Gi();KZ4=B6(oU0(),1),WZ4=B6(_$1(),1)});function Zi(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var k$1=N1(()=>{sU0()});var tU0="run_terminal_command",y$1="read_file",$J="Task",q9="finder",MY="get_diagnostics",d9="Bash",$i="InteractiveShell",s5="oracle",yV="mermaid",xV="todo_read",V7="todo_write",F2="read_web_page",tE="read_thread",qi="find_thread",U5="create_file",$3="glob",Vi="undo_edit",Ki="read_mcp_resource",d6="Read",D7="edit_file",eE="format_file",y3="web_search",x8="Grep",OM="Check",MX="librarian",Wi="kraken",eU0="look_at",JB0="read_artifact",QB0="edit_artifact",Hi="read_plan",JI="edit_plan",zi="read_github",Fi="search_github",Ui="commit_search",Bi="list_directory_github",Ni="list_repositories",Di="glob_github",Mi="diff",YB0="bookkeeper",XB0="describe_workbook",GB0="execute_query",yk="skill",ZB0;var B4=N1(()=>{ZB0=["Task","finder","get_diagnostics","Bash","InteractiveShell","oracle","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","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var xk=f((Td8,qB0)=>{var $B0={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:"/"},HZ4={...$B0,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:"\\"},zZ4={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"};qB0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:zZ4,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?HZ4:$B0}}});var vk=f((DZ4)=>{var{REGEX_BACKSLASH:FZ4,REGEX_REMOVE_BACKSLASH:UZ4,REGEX_SPECIAL_CHARS:BZ4,REGEX_SPECIAL_CHARS_GLOBAL:NZ4}=xk();DZ4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);DZ4.hasRegexChars=(J)=>BZ4.test(J);DZ4.isRegexChar=(J)=>J.length===1&&DZ4.hasRegexChars(J);DZ4.escapeRegex=(J)=>J.replace(NZ4,"\\$1");DZ4.toPosixSlashes=(J)=>J.replace(FZ4,"/");DZ4.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};DZ4.removeBackslashes=(J)=>{return J.replace(UZ4,(Q)=>{return Q==="\\"?"":Q})};DZ4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return DZ4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};DZ4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};DZ4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};DZ4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var DB0=f((jd8,NB0)=>{var WB0=vk(),{CHAR_ASTERISK:x$1,CHAR_AT:TZ4,CHAR_BACKWARD_SLASH:fk,CHAR_COMMA:CZ4,CHAR_DOT:v$1,CHAR_EXCLAMATION_MARK:f$1,CHAR_FORWARD_SLASH:BB0,CHAR_LEFT_CURLY_BRACE:h$1,CHAR_LEFT_PARENTHESES:b$1,CHAR_LEFT_SQUARE_BRACKET:jZ4,CHAR_PLUS:SZ4,CHAR_QUESTION_MARK:HB0,CHAR_RIGHT_CURLY_BRACE:_Z4,CHAR_RIGHT_PARENTHESES:zB0,CHAR_RIGHT_SQUARE_BRACKET:kZ4}=xk(),FB0=(J)=>{return J===BB0||J===fk},UB0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},yZ4=(J,Q)=>{let Y=Q||{},X=J.length-1,G=Y.parts===!0||Y.scanToEnd===!0,Z=[],q=[],V=[],K=J,W=-1,H=0,z=0,U=!1,N=!1,M=!1,L=!1,A=!1,E=!1,P=!1,I=!1,T=!1,S=!1,y=0,x,g,p={value:"",depth:0,isGlob:!1},b=()=>W>=X,l=()=>K.charCodeAt(W+1),J1=()=>{return x=g,K.charCodeAt(++W)};while(W<X){g=J1();let W1;if(g===fk){if(P=p.backslashes=!0,g=J1(),g===h$1)E=!0;continue}if(E===!0||g===h$1){y++;while(b()!==!0&&(g=J1())){if(g===fk){P=p.backslashes=!0,J1();continue}if(g===h$1){y++;continue}if(E!==!0&&g===v$1&&(g=J1())===v$1){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(E!==!0&&g===CZ4){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===_Z4){if(y--,y===0){E=!1,U=p.isBrace=!0,S=!0;break}}}if(G===!0)continue;break}if(g===BB0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},S===!0)continue;if(x===v$1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((g===SZ4||g===TZ4||g===x$1||g===HB0||g===f$1)===!0&&l()===b$1){if(M=p.isGlob=!0,L=p.isExtglob=!0,S=!0,g===f$1&&W===H)T=!0;if(G===!0){while(b()!==!0&&(g=J1())){if(g===fk){P=p.backslashes=!0,g=J1();continue}if(g===zB0){M=p.isGlob=!0,S=!0;break}}continue}break}}if(g===x$1){if(x===x$1)A=p.isGlobstar=!0;if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===HB0){if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===jZ4){while(b()!==!0&&(W1=J1())){if(W1===fk){P=p.backslashes=!0,J1();continue}if(W1===kZ4){N=p.isBracket=!0,M=p.isGlob=!0,S=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&g===f$1&&W===H){I=p.negated=!0,H++;continue}if(Y.noparen!==!0&&g===b$1){if(M=p.isGlob=!0,G===!0){while(b()!==!0&&(g=J1())){if(g===b$1){P=p.backslashes=!0,g=J1();continue}if(g===zB0){S=!0;break}}continue}break}if(M===!0){if(S=!0,G===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let n=K,u="",s="";if(H>0)u=K.slice(0,H),K=K.slice(H),z-=H;if(n&&M===!0&&z>0)n=K.slice(0,z),s=K.slice(z);else if(M===!0)n="",s=K;else n=K;if(n&&n!==""&&n!=="/"&&n!==K){if(FB0(n.charCodeAt(n.length-1)))n=n.slice(0,-1)}if(Y.unescape===!0){if(s)s=WB0.removeBackslashes(s);if(n&&P===!0)n=WB0.removeBackslashes(n)}let H1={prefix:u,input:J,start:H,base:n,glob:s,isBrace:U,isBracket:N,isGlob:M,isExtglob:L,isGlobstar:A,negated:I,negatedExtglob:T};if(Y.tokens===!0){if(H1.maxDepth=0,!FB0(g))q.push(p);H1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let W1;for(let o=0;o<Z.length;o++){let r=W1?W1+1:H,i=Z[o],F1=J.slice(r,i);if(Y.tokens){if(o===0&&H!==0)q[o].isPrefix=!0,q[o].value=u;else q[o].value=F1;UB0(q[o]),H1.maxDepth+=q[o].depth}if(o!==0||F1!=="")V.push(F1);W1=i}if(W1&&W1+1<J.length){let o=J.slice(W1+1);if(V.push(o),Y.tokens)q[q.length-1].value=o,UB0(q[q.length-1]),H1.maxDepth+=q[q.length-1].depth}H1.slashes=Z,H1.parts=V}return H1};NB0.exports=yZ4});var AB0=f((Sd8,LB0)=>{var Li=xk(),vV=vk(),{MAX_LENGTH:Ai,POSIX_REGEX_SOURCE:xZ4,REGEX_NON_SPECIAL_CHARS:vZ4,REGEX_SPECIAL_CHARS_BACKREF:fZ4,REPLACEMENTS:MB0}=Li,hZ4=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Y=`[${J.join("-")}]`;try{new RegExp(Y)}catch(X){return J.map((G)=>vV.escapeRegex(G)).join("..")}return Y},QI=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},g$1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=MB0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(Ai,Y.maxLength):Ai,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);let Z={type:"bos",value:"",output:Y.prepend||""},q=[Z],V=Y.capture?"":"?:",K=Li.globChars(Y.windows),W=Li.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:P,QMARK_NO_DOT:I,STAR:T,START_ANCHOR:S}=K,y=(s1)=>{return`(${V}(?:(?!${S}${s1.dot?M:H}).)*?)`},x=Y.dot?"":L,g=Y.dot?P:I,p=Y.bash===!0?y(Y):T;if(Y.capture)p=`(${p})`;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:q};J=vV.removePrefix(J,b),G=J.length;let l=[],J1=[],n=[],u=Z,s,H1=()=>b.index===G-1,W1=b.peek=(s1=1)=>J[b.index+s1],o=b.advance=()=>J[++b.index]||"",r=()=>J.slice(b.index+1),i=(s1="",U1=0)=>{b.consumed+=s1,b.index+=U1},F1=(s1)=>{b.output+=s1.output!=null?s1.output:s1.value,i(s1.value)},y1=()=>{let s1=1;while(W1()==="!"&&(W1(2)!=="("||W1(3)==="?"))o(),b.start++,s1++;if(s1%2===0)return!1;return b.negated=!0,b.start++,!0},t=(s1)=>{b[s1]++,n.push(s1)},f1=(s1)=>{b[s1]--,n.pop()},C1=(s1)=>{if(u.type==="globstar"){let U1=b.braces>0&&(s1.type==="comma"||s1.type==="brace"),Y1=s1.extglob===!0||l.length&&(s1.type==="pipe"||s1.type==="paren");if(s1.type!=="slash"&&s1.type!=="paren"&&!U1&&!Y1)b.output=b.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=p,b.output+=u.output}if(l.length&&s1.type!=="paren")l[l.length-1].inner+=s1.value;if(s1.value||s1.output)F1(s1);if(u&&u.type==="text"&&s1.type==="text"){u.output=(u.output||u.value)+s1.value,u.value+=s1.value;return}s1.prev=u,q.push(s1),u=s1},w0=(s1,U1)=>{let Y1={...W[U1],conditions:1,inner:""};Y1.prev=u,Y1.parens=b.parens,Y1.output=b.output;let O1=(Y.capture?"(":"")+Y1.open;t("parens"),C1({type:s1,value:U1,output:b.output?"":N}),C1({type:"paren",extglob:!0,value:o(),output:O1}),l.push(Y1)},j1=(s1)=>{let U1=s1.close+(Y.capture?")":""),Y1;if(s1.type==="negate"){let O1=p;if(s1.inner&&s1.inner.length>1&&s1.inner.includes("/"))O1=y(Y);if(O1!==p||H1()||/^\)+$/.test(r()))U1=s1.close=`)$))${O1}`;if(s1.inner.includes("*")&&(Y1=r())&&/^\.[^\\/.]+$/.test(Y1)){let w1=g$1(Y1,{...Q,fastpaths:!1}).output;U1=s1.close=`)${w1})${O1})`}if(s1.prev.type==="bos")b.negatedExtglob=!0}C1({type:"paren",extglob:!0,value:s,output:U1}),f1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let s1=!1,U1=J.replace(fZ4,(Y1,O1,w1,I1,E1,d1)=>{if(I1==="\\")return s1=!0,Y1;if(I1==="?"){if(O1)return O1+I1+(E1?P.repeat(E1.length):"");if(d1===0)return g+(E1?P.repeat(E1.length):"");return P.repeat(w1.length)}if(I1===".")return H.repeat(w1.length);if(I1==="*"){if(O1)return O1+I1+(E1?p:"");return p}return O1?Y1:`\\${Y1}`});if(s1===!0)if(Y.unescape===!0)U1=U1.replace(/\\/g,"");else U1=U1.replace(/\\+/g,(Y1)=>{return Y1.length%2===0?"\\\\":Y1?"\\":""});if(U1===J&&Y.contains===!0)return b.output=J,b;return b.output=vV.wrapOutput(U1,b,Q),b}while(!H1()){if(s=o(),s==="\x00")continue;if(s==="\\"){let Y1=W1();if(Y1==="/"&&Y.bash!==!0)continue;if(Y1==="."||Y1===";")continue;if(!Y1){s+="\\",C1({type:"text",value:s});continue}let O1=/^\\+/.exec(r()),w1=0;if(O1&&O1[0].length>2){if(w1=O1[0].length,b.index+=w1,w1%2!==0)s+="\\"}if(Y.unescape===!0)s=o();else s+=o();if(b.brackets===0){C1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||u.value==="["||u.value==="[^")){if(Y.posix!==!1&&s===":"){let Y1=u.value.slice(1);if(Y1.includes("[")){if(u.posix=!0,Y1.includes(":")){let O1=u.value.lastIndexOf("["),w1=u.value.slice(0,O1),I1=u.value.slice(O1+2),E1=xZ4[I1];if(E1){if(u.value=w1+E1,b.backtrack=!0,o(),!Z.output&&q.indexOf(u)===1)Z.output=N;continue}}}}if(s==="["&&W1()!==":"||s==="-"&&W1()==="]")s=`\\${s}`;if(s==="]"&&(u.value==="["||u.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&u.value==="[")s="^";u.value+=s,F1({value:s});continue}if(b.quotes===1&&s!=='"'){s=vV.escapeRegex(s),u.value+=s,F1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)C1({type:"text",value:s});continue}if(s==="("){t("parens"),C1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError(QI("opening","("));let Y1=l[l.length-1];if(Y1&&b.parens===Y1.parens+1){j1(l.pop());continue}C1({type:"paren",value:s,output:b.parens?")":"\\)"}),f1("parens");continue}if(s==="["){if(Y.nobracket===!0||!r().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(QI("closing","]"));s=`\\${s}`}else t("brackets");C1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||u&&u.type==="bracket"&&u.value.length===1){C1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(QI("opening","["));C1({type:"text",value:s,output:`\\${s}`});continue}f1("brackets");let Y1=u.value.slice(1);if(u.posix!==!0&&Y1[0]==="^"&&!Y1.includes("/"))s=`/${s}`;if(u.value+=s,F1({value:s}),Y.literalBrackets===!1||vV.hasRegexChars(Y1))continue;let O1=vV.escapeRegex(u.value);if(b.output=b.output.slice(0,-u.value.length),Y.literalBrackets===!0){b.output+=O1,u.value=O1;continue}u.value=`(${V}${O1}|${u.value})`,b.output+=u.value;continue}if(s==="{"&&Y.nobrace!==!0){t("braces");let Y1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};J1.push(Y1),C1(Y1);continue}if(s==="}"){let Y1=J1[J1.length-1];if(Y.nobrace===!0||!Y1){C1({type:"text",value:s,output:s});continue}let O1=")";if(Y1.dots===!0){let w1=q.slice(),I1=[];for(let E1=w1.length-1;E1>=0;E1--){if(q.pop(),w1[E1].type==="brace")break;if(w1[E1].type!=="dots")I1.unshift(w1[E1].value)}O1=hZ4(I1,Y),b.backtrack=!0}if(Y1.comma!==!0&&Y1.dots!==!0){let w1=b.output.slice(0,Y1.outputIndex),I1=b.tokens.slice(Y1.tokensIndex);Y1.value=Y1.output="\\{",s=O1="\\}",b.output=w1;for(let E1 of I1)b.output+=E1.output||E1.value}C1({type:"brace",value:s,output:O1}),f1("braces"),J1.pop();continue}if(s==="|"){if(l.length>0)l[l.length-1].conditions++;C1({type:"text",value:s});continue}if(s===","){let Y1=s,O1=J1[J1.length-1];if(O1&&n[n.length-1]==="braces")O1.comma=!0,Y1="|";C1({type:"comma",value:s,output:Y1});continue}if(s==="/"){if(u.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",q.pop(),u=Z;continue}C1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&u.type==="dot"){if(u.value===".")u.output=H;let Y1=J1[J1.length-1];u.type="dots",u.output+=s,u.value+=s,Y1.dots=!0;continue}if(b.braces+b.parens===0&&u.type!=="bos"&&u.type!=="slash"){C1({type:"text",value:s,output:H});continue}C1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(u&&u.value==="(")&&Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){w0("qmark",s);continue}if(u&&u.type==="paren"){let O1=W1(),w1=s;if(u.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(r()))w1=`\\${s}`;C1({type:"text",value:s,output:w1});continue}if(Y.dot!==!0&&(u.type==="slash"||u.type==="bos")){C1({type:"qmark",value:s,output:I});continue}C1({type:"qmark",value:s,output:P});continue}if(s==="!"){if(Y.noextglob!==!0&&W1()==="("){if(W1(2)!=="?"||!/[!=<:]/.test(W1(3))){w0("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){y1();continue}}if(s==="+"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){w0("plus",s);continue}if(u&&u.value==="("||Y.regex===!1){C1({type:"plus",value:s,output:z});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||b.parens>0){C1({type:"plus",value:s});continue}C1({type:"plus",value:z});continue}if(s==="@"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){C1({type:"at",extglob:!0,value:s,output:""});continue}C1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let Y1=vZ4.exec(r());if(Y1)s+=Y1[0],b.index+=Y1[0].length;C1({type:"text",value:s});continue}if(u&&(u.type==="globstar"||u.star===!0)){u.type="star",u.star=!0,u.value+=s,u.output=p,b.backtrack=!0,b.globstar=!0,i(s);continue}let s1=r();if(Y.noextglob!==!0&&/^\([^?]/.test(s1)){w0("star",s);continue}if(u.type==="star"){if(Y.noglobstar===!0){i(s);continue}let Y1=u.prev,O1=Y1.prev,w1=Y1.type==="slash"||Y1.type==="bos",I1=O1&&(O1.type==="star"||O1.type==="globstar");if(Y.bash===!0&&(!w1||s1[0]&&s1[0]!=="/")){C1({type:"star",value:s,output:""});continue}let E1=b.braces>0&&(Y1.type==="comma"||Y1.type==="brace"),d1=l.length&&(Y1.type==="pipe"||Y1.type==="paren");if(!w1&&Y1.type!=="paren"&&!E1&&!d1){C1({type:"star",value:s,output:""});continue}while(s1.slice(0,3)==="/**"){let h1=J[b.index+4];if(h1&&h1!=="/")break;s1=s1.slice(3),i("/**",3)}if(Y1.type==="bos"&&H1()){u.type="globstar",u.value+=s,u.output=y(Y),b.output=u.output,b.globstar=!0,i(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&!I1&&H1()){b.output=b.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=y(Y)+(Y.strictSlashes?")":"|$)"),u.value+=s,b.globstar=!0,b.output+=Y1.output+u.output,i(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&s1[0]==="/"){let h1=s1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=`${y(Y)}${U}|${U}${h1})`,u.value+=s,b.output+=Y1.output+u.output,b.globstar=!0,i(s+o()),C1({type:"slash",value:"/",output:""});continue}if(Y1.type==="bos"&&s1[0]==="/"){u.type="globstar",u.value+=s,u.output=`(?:^|${U}|${y(Y)}${U})`,b.output=u.output,b.globstar=!0,i(s+o()),C1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-u.output.length),u.type="globstar",u.output=y(Y),u.value+=s,b.output+=u.output,b.globstar=!0,i(s);continue}let U1={type:"star",value:s,output:p};if(Y.bash===!0){if(U1.output=".*?",u.type==="bos"||u.type==="slash")U1.output=x+U1.output;C1(U1);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&Y.regex===!0){U1.output=s,C1(U1);continue}if(b.index===b.start||u.type==="slash"||u.type==="dot"){if(u.type==="dot")b.output+=A,u.output+=A;else if(Y.dot===!0)b.output+=E,u.output+=E;else b.output+=x,u.output+=x;if(W1()!=="*")b.output+=N,u.output+=N}C1(U1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(QI("closing","]"));b.output=vV.escapeLast(b.output,"["),f1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(QI("closing",")"));b.output=vV.escapeLast(b.output,"("),f1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(QI("closing","}"));b.output=vV.escapeLast(b.output,"{"),f1("braces")}if(Y.strictSlashes!==!0&&(u.type==="star"||u.type==="bracket"))C1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let s1 of b.tokens)if(b.output+=s1.output!=null?s1.output:s1.value,s1.suffix)b.output+=s1.suffix}return b};g$1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(Ai,Y.maxLength):Ai,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=MB0[J]||J;let{DOT_LITERAL:Z,SLASH_LITERAL:q,ONE_CHAR:V,DOTS_SLASH:K,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:N}=Li.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?z:W,A=Y.capture?"":"?:",E={negated:!1,prefix:""},P=Y.bash===!0?".*?":U;if(Y.capture)P=`(${P})`;let I=(x)=>{if(x.noglobstar===!0)return P;return`(${A}(?:(?!${N}${x.dot?K:Z}).)*?)`},T=(x)=>{switch(x){case"*":return`${M}${V}${P}`;case".*":return`${Z}${V}${P}`;case"*.*":return`${M}${P}${Z}${V}${P}`;case"*/*":return`${M}${P}${q}${V}${L}${P}`;case"**":return M+I(Y);case"**/*":return`(?:${M}${I(Y)}${q})?${L}${V}${P}`;case"**/*.*":return`(?:${M}${I(Y)}${q})?${L}${P}${Z}${V}${P}`;case"**/.*":return`(?:${M}${I(Y)}${q})?${Z}${V}${P}`;default:{let g=/^(.*?)\.(\w+)$/.exec(x);if(!g)return;let p=T(g[1]);if(!p)return;return p+Z+g[2]}}},S=vV.removePrefix(J,E),y=T(S);if(y&&Y.strictSlashes!==!0)y+=`${q}?`;return y};LB0.exports=g$1});var hk=f((_d8,wB0)=>{var bZ4=DB0(),m$1=AB0(),OB0=vk(),gZ4=xk(),mZ4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),U2=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>U2(U,Q,Y));return(U)=>{for(let N of H){let M=N(U);if(M)return M}return!1}}let X=mZ4(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!X)throw TypeError("Expected pattern to be a non-empty string");let G=Q||{},Z=G.windows,q=X?U2.compileRe(J,Q):U2.makeRe(J,Q,!1,!0),V=q.state;delete q.state;let K=()=>!1;if(G.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};K=U2(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:N,output:M}=U2.test(H,q,Q,{glob:J,posix:Z}),L={glob:J,state:V,regex:q,posix:Z,input:H,output:M,match:N,isMatch:U};if(typeof G.onResult==="function")G.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof G.onMatch==="function")G.onMatch(L);return z?L:!0};if(Y)W.state=V;return W};U2.test=(J,Q,Y,{glob:X,posix:G}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let Z=Y||{},q=Z.format||(G?OB0.toPosixSlashes:null),V=J===X,K=V&&q?q(J):J;if(V===!1)K=q?q(J):J,V=K===X;if(V===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)V=U2.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};U2.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:U2.makeRe(Q,Y)).test(OB0.basename(J))};U2.isMatch=(J,Q,Y)=>U2(Q,Y)(J);U2.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>U2.parse(Y,Q));return m$1(J,{...Q,fastpaths:!1})};U2.scan=(J,Q)=>bZ4(J,Q);U2.compileRe=(J,Q,Y=!1,X=!1)=>{if(Y===!0)return J.output;let G=Q||{},Z=G.contains?"":"^",q=G.contains?"":"$",V=`${Z}(?:${J.output})${q}`;if(J&&J.negated===!0)V=`^(?!${V}).*$`;let K=U2.toRegex(V,Q);if(X===!0)K.state=J;return K};U2.makeRe=(J,Q={},Y=!1,X=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let G={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))G.output=m$1.fastpaths(J,Q);if(!G.output)G=m$1(J,Q);return U2.compileRe(G,Q,Y,X)};U2.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/$^/}};U2.constants=gZ4;wB0.exports=U2});var wM=f((kd8,PB0)=>{var EB0=hk(),uZ4=vk();function IB0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:uZ4.isWindows()};return EB0(J,Q,Y)}Object.assign(IB0,EB0);PB0.exports=IB0});var YI;var u$1=N1(()=>{YI={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","start:dev:debugger":"pnpm run -s build:dev:desktop && pnpm run -s ./src/autoedit/webview dev","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 && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger' 'pnpm run -s _build:web' 'pnpm run -s _build:tab:review'","build:production":"pnpm run -s _build:extension:production && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production' 'pnpm run -s _build:tab:review: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:debugger":"pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:debugger:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:tab:review":"pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","_build:tab:review:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","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 at Sourcegraph",email:"amp-devs@sourcegraph.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.setPromptFromRecentActions",title:"Create Prompt from Recent Actions",category:"Amp"},{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.toggleCostDisplay",title:"Toggle Cost Display",category:"Amp"},{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"},{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.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{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.toggleCostDisplay",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.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{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.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !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.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.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"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.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.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"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.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",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"}}},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":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"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:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3"},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 dZ4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function TB0(J){let Q=J.settings["tools.inactivityTimeout"],Y=J.settings["tools.stopTimeout"],X=Q;if(X===void 0&&Y!==void 0)X=Y;if(X===void 0)X=YI.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!dZ4(X))return null;return X*1000}function CB0(J){let Q=J.settings["tools.stopTimeout"],Y=YI.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var RB0;var Oi=N1(()=>{u$1();RB0=YI.contributes.configuration.properties});function qJ(J){let Q=V9[J];return`${Q.provider}/${Q.name}`}function iG(J){let[Q,Y]=J.split("/");for(let X of Object.values(V9))if(X.provider===Q&&X.name===Y)return X;switch(Q){case"anthropic":return V9.CLAUDE_SONNET_4_5;case"openai":return V9.GPT_5;case"xai":return V9.GROK_CODE_FAST_1;case"cerebras":return V9.Z_AI_GLM_4_6;case"fireworks":return V9.FIREWORKS_GLM_4P6;case"moonshotai":return V9.KIMI_K2_INSTRUCT;case"openrouter":return V9.SONOMA_SKY_ALPHA;case"groq":return V9.GPT_OSS_120B;case"vertexai":return V9.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Q}`)}}function nG(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function rW(J,Q){let Y=iG(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}var j9,V9,p$1;var x$=N1(()=>{j9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},V9={CLAUDE_SONNET_4:{provider:j9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:j9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:j9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:j9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:j9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:j9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:j9.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:j9.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_CODEX:{provider:j9.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:j9.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:j9.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:j9.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:j9.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:j9.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:j9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:j9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:j9.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:j9.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:j9.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},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:j9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:j9.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},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:j9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:j9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:j9.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:j9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:j9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:j9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0}},KIMI_K2_INSTRUCT:{provider:j9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:j9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:j9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:j9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:j9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:j9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};p$1={FINDER:"finder"}});function d$1(J,Q){let Y=fV(Q);if(!Y)return!1;if(cZ4.has(J)){let X=Y.finder??p$1.FINDER,G=lZ4[X];if(J!==G)return!1}if(Y.includeTools)return Y.includeTools.includes(J);return!0}function aG(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(XI).filter((X)=>{if(Y.includes(`!${X.key}`))return!1;if(Q===!1&&R5(X.key))return!1;let Z="visible"in X?X.visible:!1,q=Y.includes(X.key),V=X.key==="plan"&&J?.["experimental.planMode"]===!0,K=J?.["experimental.dojoMode"]===!0;if(X.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(X.key==="dojo")return K&&(Q===!1||Q===void 0);return Z||q||V}).map((X)=>({mode:X.key,description:"description"in X?X.description:void 0})).sort((X,G)=>X.mode.localeCompare(G.mode))}function fV(J){return Object.values(XI).find((Q)=>Q.key===J)}function bk(J){return fV(J)?.primaryModel??qJ("CLAUDE_SONNET_4_5")}function gk(J){let Q=fV(J);if(!Q)return!1;return iG(Q.primaryModel).capabilities?.vision??!1}function R5(J){return J==="free"||J.startsWith("free-")}function c$1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function wi(J,Q){let X=(Q.findIndex((Z)=>Z.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var cZ4,lZ4,SB0,_B0,iZ4,nZ4,jB0,aZ4,oZ4,XI,rZ4;var v$=N1(()=>{x$();cZ4=new Set(["finder"]),lZ4={finder:"finder"},SB0={r:0,g:55,b:0},_B0={r:0,g:255,b:136},iZ4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","find_thread","skill"],nZ4=["Read","Grep","glob","finder","Bash","InteractiveShell","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"],jB0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],aZ4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","web_search","read_web_page"],oZ4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at","edit_plan","read_plan","code_review"],XI={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:qJ("CLAUDE_OPUS_4_5"),includeTools:oZ4,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:qJ("CLAUDE_HAIKU_4_5"),includeTools:iZ4,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:qJ("CLAUDE_HAIKU_4_5"),includeTools:nZ4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:qJ("GPT_5_1_CODEX"),includeTools:aZ4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:qJ("CLAUDE_HAIKU_4_5"),includeTools:jB0,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:qJ("CLAUDE_SONNET_4_5"),includeTools:jB0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},rZ4=Object.values(XI).map((J)=>J.key)});function Ei(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let X="subagentType"in Q?Q.subagentType:void 0;if(X&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(X)}return!0}return Q.includeTools.includes(J)}var sZ4,tZ4,l$1,eZ4,J$4,Q$4,Y$4,X$4,g2,md8;var sW=N1(()=>{x$();sZ4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],tZ4=["Grep","glob","Read"],l$1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],eZ4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],J$4=["Read","glob","Grep","enqueue_file_edit","fastmod"],Q$4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],Y$4=["describe_workbook","execute_query"],X$4=["Read","Grep","glob","web_search","read_web_page","Bash"],g2={finder:{key:"finder",displayName:"Finder",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:tZ4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:qJ("GPT_5_1"),includeTools:l$1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:sZ4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:eZ4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:J$4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:Q$4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:Y$4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:qJ("CLAUDE_SONNET_4_5"),includeTools:X$4,allowMcp:!1,allowToolbox:!1}},md8=Object.keys(g2)});function kB0(J,Q){return new X0((Y)=>{let X=setTimeout(G,Q);function G(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function Z(){if(X)clearTimeout(X);X=setTimeout(G,Q)}let q=J.subscribe({next:(V)=>{Z(),Y.next(V)},error:(V)=>{if(X)clearTimeout(X),X=null;Y.error(V)},complete:()=>{if(X)clearTimeout(X),X=null;Y.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var yB0=N1(()=>{a0()});function p7(J,Q){let Y={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},X=Q.modelCustomizations;if(X){for(let G of X)if(G.modelSelector.test(J))Y={...Y,name:G.name??Y.name,description:G.description??Y.description,inputSchema:G.inputSchema??Y.inputSchema,customizedForModel:!0}}return Y}function B2(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function fB0(J){return["done","error","cancelled"].includes(J.status)}function i$1(J){return typeof J==="object"&&"key"in J}function Ii(J){let Q=[],Y=new i4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0){let W=q.toLowerCase();K=Q.filter((H)=>H.spec.name.toLowerCase()===W)}for(let W of K)if(ZI(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return h.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let N={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))Q[W]=N;else Q.push(N);return Y.next(),{dispose:()=>{let L=Q.indexOf(N);if(L!==-1)Q.splice(L,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return G$4;return Z(q,V,K)},tools:p8(J.configService.config,Y.pipe(d8(void 0))).pipe(q6(([q])=>{return Q.map((V)=>({spec:V.spec,...ZI(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>Z$4.record(performance.now()-W,{toolName:q});if(q===a$1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){GI.add(1,{toolName:q,error:"invalid"});let N=n$1(V.args.invalid_tool_name);return new X0((M)=>{M.error(Error(N))})}let z=G(q,K.config);if(!z){let N=q.toLowerCase(),M=Q.filter((P)=>P.spec.name.toLowerCase()===N);if(M.length===0)return GI.add(1,{toolName:q,error:"not_found"}),new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} not found`))});let L=M[0],A=ZI(L.spec,K.config);GI.add(1,{toolName:q,error:"disabled"});let E=A.enabled?"unknown":A.disabledReason;return new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} is disabled: ${E}`))})}let U=K.subagentSpec??K.agentMode;if(U&&!this.isToolAllowed(q,U)){GI.add(1,{toolName:q,error:"disabled"});let N=i$1(U)?U.displayName??U.key:`${U} mode`;return new X0((M)=>{M.error(Error(`tool ${JSON.stringify(q)} is not allowed for ${N}`))})}if(K.thread.mainThreadID&&!K.subagentSpec&&!Ei(q,g2["task-subagent"]))return GI.add(1,{toolName:q,error:"disabled"}),new X0((N)=>{N.error(Error(`tool ${JSON.stringify(q)} is not allowed for subagents`))});return GI.add(1,{toolName:q}),r6(()=>z.fn).pipe(f4((N)=>{let M=N(V,K);if(z.spec.meta?.disableTimeout)return M;return kB0(M,CB0(K.config))}),R$(()=>H()))},preprocessArgs(q,V,K){let W=G(q,K.config);if(!W||!W.preprocessArgs)return;let H=W.preprocessArgs;try{return H(V,K)}catch(z){h.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},isToolAllowed(q,V){let K=Q.find((H)=>H.spec.name===q),W=K?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(i$1(V))return Ei(q,V,K?.spec.meta);return d$1(q,V)},getTools(q){return p8(J.configService.config,Y.pipe(d8(void 0))).pipe(q6(([V])=>{return Q.filter((K)=>{let W=K.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(i$1(q))return Ei(K.spec.name,q,K.spec.meta);return d$1(K.spec.name,q)}).map((K)=>({spec:K.spec,...ZI(K.spec,V)})).sort((K,W)=>K.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(q,V){if(V)return this.getTools(g2["task-subagent"]);return this.getTools(q)},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function mk(J,Q){for(let Y of Q){if(Y==="")continue;if(Y.length===1){if(Y==="*")return!0;if(Y===J)return!0;continue}if(J===Y)return!0;if(Y.includes("*")||Y.includes("?")||Y.includes("[")||Y.includes("{"))try{if(vB0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function ZI(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(mk(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=$$4(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(mk(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(mk(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&mk(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&mk(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===V7||J.name===xV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function n$1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${uk.toString()}. Try again with a valid tool name.`}function $$4(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function o$1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var xB0,vB0,G$4,a$1="invalid_tool",uk,hB0,GI,Z$4;var d7=N1(()=>{a0();L0();Oi();v$();sW();yB0();B4();xB0=B6(h6(),1),vB0=B6(wM(),1);G$4={dispose(){}};uk=/^[-a-zA-Z0-9_]{1,64}$/,hB0=xB0.metrics.getMeter("tool_service"),GI=hB0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),Z$4=hB0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var dB0=f((uB0)=>{Object.defineProperty(uB0,"__esModule",{value:!0});uB0.calcSlices=uB0.applyPatch=uB0.calcPatch=uB0.lcs=uB0.diff=uB0.diff_core=void 0;function q$4(J,Q){let{b:Y,eq:X,stack_base:G}=J,{i:Z,N:q,j:V,M:K,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(q>0&&K>0){Y.fill(0,0,2*W);let z=q-K,U=q+K,N=U&1,M=Z+q-1,L=V+K-1,A=(U+N)/2,E;Q:for(let P=0;P<=A;P++){let I=2*Math.max(0,P-K)-P,T=P-2*Math.max(0,P-q);for(let S=I;S<=T;S+=2){let y=Y[S-1-W*Math.floor((S-1)/W)],x=Y[S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,l=p;while(b<q&&l<K&&X(Z+b,V+l))b++,l++;if(Y[S-W*Math.floor(S/W)]=b,N===1&&(E=z-S)>=1-P&&E<P&&b+Y[W+E-W*Math.floor(E/W)]>=q)if(P>1||b!==g){G[H++]=Z+b,G[H++]=q-b,G[H++]=V+l,G[H++]=K-l,q=g,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let S=I;S<=T;S+=2){let y=Y[W+S-1-W*Math.floor((S-1)/W)],x=Y[W+S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,l=p;while(b<q&&l<K&&X(M-b,L-l))b++,l++;if(Y[W+S-W*Math.floor(S/W)]=b,N===0&&(E=z-S)>=-P&&E<=P&&b+Y[E-W*Math.floor(E/W)]>=q)if(P>0||b!==g){G[H++]=Z+q-g,G[H++]=g,G[H++]=V+K-p,G[H++]=p,q=q-b,K=K-l,W=2*(Math.min(q,K)+1);continue J}else break Q}}if(q===K)continue;if(K>q)Z+=q,V+=q,K-=q,q=0;else Z+=K,V+=K,q-=K,K=0;break}if(q+K!==0)if(J.pxe===Z||J.pye===V)J.pxe=Z+q,J.pye=V+K;else{let z=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=Z,J.pxe=Z+q,J.pys=V,J.pye=V+K,z>=0)return J.i=Z,J.N=q,J.j=V,J.M=K,J.Z=W,J.stack_top=H,1}}case 1:{if(H===0)return 2;K=G[--H],V=G[--H],q=G[--H],Z=G[--H],W=2*(Math.min(q,K)+1),Q=0}}}class bB0{constructor(J){this.state=J,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:J,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let Y=q$4(J,this.c);if(this.c=Y,Y===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function gB0(J,Q,Y,X,G){let Z=(Math.min(Q,X)+1)*2,q=Q+X,V=new(q<256?Uint8Array:q<65536?Uint16Array:Uint32Array)(2*Z);return new bB0({i:J,N:Q,j:Y,M:X,Z,b:V,eq:G,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}uB0.diff_core=gB0;function Pi(J,Q,Y){let[X,G,Z]=[0,J.length,Q.length];if(typeof Y==="function"){while(X<G&&X<Z&&Y(X,X))X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(Y(--G,--Z)&&G>X&&Z>X);}else{while(X<G&&X<Z&&J[X]===Q[X])X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(J[--G]===Q[--Z]&&G>X&&Z>X);Y=(q,V)=>J[q]===Q[V]}return gB0(X,G+1-X,X,Z+1-X,Y)}uB0.diff=Pi;class mB0{constructor(J,Q){this.diff=J,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let J=this.diff.next();if(J.done){let{i:V,j:K,N:W}=this;if(V<W)J.done=!1,J.value=[V,K,W-V],this.i=W;return J}let Q=J.value,Y=Q[0],X=Q[1],G=Q[3],{i:Z,j:q}=this;if(Z!==Y)Q.length--,Q[0]=Z,Q[1]=q,Q[2]=Y-Z;return this.i=X,this.j=G,J}}function V$4(J,Q,Y){return new mB0(Pi(J,Q,Y),J.length)}uB0.lcs=V$4;function*K$4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of Pi(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}uB0.calcPatch=K$4;function*W$4(J,Q){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,Z,q]of Q){if(Y<G)yield X.call(J,Y,G);if(q.length>0)yield q;Y=Z}if(Y<J.length)yield X.call(J,Y)}uB0.applyPatch=W$4;function*H$4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of Pi(J,Q,Y)){if(X<Z)yield[0,G.call(J,X,Z)];if(Z<q)yield[-1,G.call(J,Z,q)];if(V<K)yield[1,G.call(Q,V,K)];X=q}if(X<J.length)yield[0,J.slice(X)]}uB0.calcSlices=H$4});function $I(J,Q){let Y={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Y;if(J===Q)return Y;try{let X={added:0,deleted:0,changed:0};for(let[G,Z,q,V]of cB0.diff(J.split(`
48
+ `)[0];if(!X?.startsWith("#!"))return{interpreter:null,isValid:!1};let G=X.slice(2).trim();if(!G)return{interpreter:null,isValid:!1};let Z=G.split(/\s+/).filter((q)=>q.length>0);if(Z[0]?.endsWith("/env")&&Z.length>1)return{interpreter:Z.slice(1),isValid:!0};return{interpreter:Z,isValid:!0}}finally{await Q.close()}}catch{return{interpreter:null,isValid:!1}}}function GU0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=qM.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function ZU0(J){return qM.extname(J).toLowerCase()===".md"}function $U0(J){let Q=J.replace(/\\/g,"/"),Y=qM.basename(Q);return qM.basename(Y,qM.extname(Y))}function qU0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var VU0=()=>{};var zU0={};y8(zU0,{CommandDiscovery:()=>HU0});import*as WU0 from"node:fs";import{promises as ul}from"node:fs";import{homedir as KU0}from"node:os";import*as FX from"node:path";function tZ1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class HU0{config;workspaceRoots;watchFactory;debounceMs;changes=new i4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??UX4,this.debounceMs=Y.debounceMs??200}get commandChanges(){return this.changes}async discoverCommands(){if(this.disposed)return[];try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());if(h.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return h.error("Failed to discover commands",{error:J}),[]}}async discoverWorkspaceCommands(){let J=[];for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=s0.joinPath(Q,Y),G=await this.discoverCommandsInDirectory(X,"workspace");J.push(...G)}return J}async discoverGlobalCommands(){let J=[];for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q),X=i0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await tZ1(ul.access(Y),sZ1,"directory access")}catch{return[]}let G=(await tZ1(ul.readdir(Y,{withFileTypes:!0}),sZ1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=FX.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return h.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return h.warn(`Failed to discover commands in directory: ${J.fsPath}`,{error:Y}),[]}}ignoreCommandName(J){return J.startsWith(".")||J==="README.md"}async createCommand(J,Q){try{let Y=await ul.stat(J),X=FX.basename(J);if(this.ignoreCommandName(X))return null;let G=$U0(X);if(!qU0(G))return h.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(ZU0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return h.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:FX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=FX.basename(J),Z=GU0(Q.mode,G),q=await XU0(J),V=FX.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return h.debug(`Skipping non-executable file without shebang: ${J}`),null;let K=Z&&(q.isValid||this.isNativeBinary(V)),W=this.getExecutableUnavailableReason(Z,q.isValid,V);return{kind:"executable",name:Y,filePath:J,sourceDirectory:FX.dirname(J),lastModified:Q.mtimeMs,isExecutable:Z,interpreter:q.interpreter,extension:V,available:K,unavailableReason:W,source:X}}isNativeBinary(J){if(process.platform==="win32")return[".exe",".bat",".cmd",".ps1"].includes(J.toLowerCase());return J===""}getExecutableUnavailableReason(J,Q,Y){let X=this.isNativeBinary(Y);if(!J)return"File is not executable (missing execute permissions)";if(!Q&&!X)return"Missing shebang and not a recognized binary type";return}resolveGlobalPath(J){if(J.startsWith("~/"))return FX.join(KU0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=fF||FX.join(KU0(),".config");return FX.join(Q,J.slice(10))}return J}async setupWatching(){if(this.disposed)return;this.stopWatching();let J=new Set;for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=s0.joinPath(Q,Y);J.add(X.fsPath)}for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q);J.add(Y)}for(let Q of J)await this.watchDirectory(Q)}async watchDirectory(J){try{await tZ1(ul.access(J),sZ1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{h.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{h.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),h.debug("Started watching command directory",{directory:J})}catch(Q){h.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){h.debug("Skipping watch for non-existent directory",{directory:J})}}scheduleRefresh(){if(this.disposed)return;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());h.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){h.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),h.debug("Stopped watching command directory",{directory:J})}catch(Y){h.warn("Failed to close watcher",{directory:J,error:Y})}this.watchers.clear()}finally{if(this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=void 0}}dispose(){this.disposed=!0;try{this.stopWatching()}catch(J){h.warn("Error during command discovery cleanup",{error:J})}}}var sZ1=5000,UX4=(J,Q)=>WU0.watch(J,Q);var FU0=N1(()=>{G4();a0();EE();L0();VU0()});function r9(J,Q,Y=Q+"s"){return J===1?Q:Y}function dF(J){let Q=typeof J==="string"?J:J.toString();return Q===BY||Q===BY.slice(0,-1)}function yE(J){return dF(J)?BY:J}var yX4,BY,xX4,Rp8;var cF=N1(()=>{yX4=new URL("https://ampcode.com/"),BY=yX4.toString(),xX4=new URL("https://api.anthropic.com/"),Rp8=xX4.toString()});var D9,W$1,y6,SV=(J)=>{switch(typeof J){case"undefined":return y6.undefined;case"string":return y6.string;case"number":return Number.isNaN(J)?y6.nan:y6.number;case"boolean":return y6.boolean;case"function":return y6.function;case"bigint":return y6.bigint;case"symbol":return y6.symbol;case"object":if(Array.isArray(J))return y6.array;if(J===null)return y6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return y6.promise;if(typeof Map<"u"&&J instanceof Map)return y6.map;if(typeof Set<"u"&&J instanceof Set)return y6.set;if(typeof Date<"u"&&J instanceof Date)return y6.date;return y6.object;default:return y6.unknown}};var Dk=N1(()=>{(function(J){J.assertEqual=(G)=>{};function Q(G){}J.assertIs=Q;function Y(G){throw Error()}J.assertNever=Y,J.arrayToEnum=(G)=>{let Z={};for(let q of G)Z[q]=q;return Z},J.getValidEnumValues=(G)=>{let Z=J.objectKeys(G).filter((V)=>typeof G[G[V]]!=="number"),q={};for(let V of Z)q[V]=G[V];return J.objectValues(q)},J.objectValues=(G)=>{return J.objectKeys(G).map(function(Z){return G[Z]})},J.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let Z=[];for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q))Z.push(q);return Z},J.find=(G,Z)=>{for(let q of G)if(Z(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function X(G,Z=" | "){return G.map((q)=>typeof q==="string"?`'${q}'`:q).join(Z)}J.joinValues=X,J.jsonStringifyReplacer=(G,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(D9||(D9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(W$1||(W$1={}));y6=D9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var z6,vX4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},NY;var il=N1(()=>{Dk();z6=D9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);NY=class NY extends Error{get errors(){return this.issues}constructor(J){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=J}format(J){let Q=J||function(G){return G.message},Y={_errors:[]},X=(G)=>{for(let Z of G.issues)if(Z.code==="invalid_union")Z.unionErrors.map(X);else if(Z.code==="invalid_return_type")X(Z.returnTypeError);else if(Z.code==="invalid_arguments")X(Z.argumentsError);else if(Z.path.length===0)Y._errors.push(Q(Z));else{let q=Y,V=0;while(V<Z.path.length){let K=Z.path[V];if(V!==Z.path.length-1)q[K]=q[K]||{_errors:[]};else q[K]=q[K]||{_errors:[]},q[K]._errors.push(Q(Z));q=q[K],V++}}};return X(this),Y}static assert(J){if(!(J instanceof NY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,D9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(J=(Q)=>Q.message){let Q={},Y=[];for(let X of this.issues)if(X.path.length>0){let G=X.path[0];Q[G]=Q[G]||[],Q[G].push(J(X))}else Y.push(J(X));return{formErrors:Y,fieldErrors:Q}}get formErrors(){return this.flatten()}};NY.create=(J)=>{return new NY(J)}});var fX4=(J,Q)=>{let Y;switch(J.code){case z6.invalid_type:if(J.received===y6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case z6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,D9.jsonStringifyReplacer)}`;break;case z6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${D9.joinValues(J.keys,", ")}`;break;case z6.invalid_union:Y="Invalid input";break;case z6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${D9.joinValues(J.options)}`;break;case z6.invalid_enum_value:Y=`Invalid enum value. Expected ${D9.joinValues(J.options)}, received '${J.received}'`;break;case z6.invalid_arguments:Y="Invalid function arguments";break;case z6.invalid_return_type:Y="Invalid function return type";break;case z6.invalid_date:Y="Invalid date";break;case z6.invalid_string:if(typeof J.validation==="object")if("includes"in J.validation){if(Y=`Invalid input: must include "${J.validation.includes}"`,typeof J.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${J.validation.position}`}else if("startsWith"in J.validation)Y=`Invalid input: must start with "${J.validation.startsWith}"`;else if("endsWith"in J.validation)Y=`Invalid input: must end with "${J.validation.endsWith}"`;else D9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case z6.too_small:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at least":"more than"} ${J.minimum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at least":"over"} ${J.minimum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="bigint")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(J.minimum))}`;else Y="Invalid input";break;case z6.too_big:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at most":"less than"} ${J.maximum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at most":"under"} ${J.maximum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="bigint")Y=`BigInt must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly":J.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(J.maximum))}`;else Y="Invalid input";break;case z6.custom:Y="Invalid input";break;case z6.invalid_intersection_types:Y="Intersection results could not be merged";break;case z6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case z6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,D9.assertNever(J)}return{message:Y}},iW;var H$1=N1(()=>{il();Dk();iW=fX4});function hX4(J){EU0=J}function xE(){return EU0}var EU0;var nl=N1(()=>{H$1();EU0=iW});function a6(J,Q){let Y=xE(),X=Mk({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===iW?void 0:iW].filter((G)=>!!G)});J.common.issues.push(X)}class ZJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Y=[];for(let X of Q){if(X.status==="aborted")return t4;if(X.status==="dirty")J.dirty();Y.push(X.value)}return{status:J.value,value:Y}}static async mergeObjectAsync(J,Q){let Y=[];for(let X of Q){let G=await X.key,Z=await X.value;Y.push({key:G,value:Z})}return ZJ.mergeObjectSync(J,Y)}static mergeObjectSync(J,Q){let Y={};for(let X of Q){let{key:G,value:Z}=X;if(G.status==="aborted")return t4;if(Z.status==="aborted")return t4;if(G.status==="dirty")J.dirty();if(Z.status==="dirty")J.dirty();if(G.value!=="__proto__"&&(typeof Z.value<"u"||X.alwaysSet))Y[G.value]=Z.value}return{status:J.value,value:Y}}}var Mk=(J)=>{let{data:Q,path:Y,errorMaps:X,issueData:G}=J,Z=[...Y,...G.path||[]],q={...G,path:Z};if(G.message!==void 0)return{...G,path:Z,message:G.message};let V="",K=X.filter((W)=>!!W).slice().reverse();for(let W of K)V=W(q,{data:Q,defaultError:V}).message;return{...G,path:Z,message:V}},bX4,t4,KM=(J)=>({status:"dirty",value:J}),sJ=(J)=>({status:"valid",value:J}),al=(J)=>J.status==="aborted",ol=(J)=>J.status==="dirty",lF=(J)=>J.status==="valid",vE=(J)=>typeof Promise<"u"&&J instanceof Promise;var z$1=N1(()=>{nl();H$1();bX4=[];t4=Object.freeze({status:"aborted"})});var IU0=()=>{};var L4;var PU0=N1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(L4||(L4={}))});class k${constructor(J,Q,Y,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Y,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function k8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Y,required_error:X,description:G}=J;if(Q&&(Y||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(q,V)=>{let{message:K}=J;if(q.code==="invalid_enum_value")return{message:K??V.defaultError};if(typeof V.data>"u")return{message:K??X??V.defaultError};if(q.code!=="invalid_type")return{message:V.defaultError};return{message:K??Y??V.defaultError}},description:G}}class r8{get description(){return this._def.description}_getType(J){return SV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:SV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new ZJ,ctx:{common:J.parent.common,data:J.data,parsedType:SV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(vE(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(J){let Q=this._parse(J);return Promise.resolve(Q)}parse(J,Q){let Y=this.safeParse(J,Q);if(Y.success)return Y.data;throw Y.error}safeParse(J,Q){let Y={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:SV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return RU0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:SV(J)};if(!this["~standard"].async)try{let Y=this._parseSync({data:J,path:[],parent:Q});return lF(Y)?{value:Y.value}:{issues:Q.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:J,path:[],parent:Q}).then((Y)=>lF(Y)?{value:Y.value}:{issues:Q.common.issues})}async parseAsync(J,Q){let Y=await this.safeParseAsync(J,Q);if(Y.success)return Y.data;throw Y.error}async safeParseAsync(J,Q){let Y={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:SV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(vE(X)?X:Promise.resolve(X));return RU0(Y,G)}refine(J,Q){let Y=(X)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(X);else return Q};return this._refinement((X,G)=>{let Z=J(X),q=()=>G.addIssue({code:z6.custom,...Y(X)});if(typeof Promise<"u"&&Z instanceof Promise)return Z.then((V)=>{if(!V)return q(),!1;else return!0});if(!Z)return q(),!1;else return!0})}refinement(J,Q){return this._refinement((Y,X)=>{if(!J(Y))return X.addIssue(typeof Q==="function"?Q(Y,X):Q),!1;else return!0})}_refinement(J){return new y$({schema:this,typeName:q8.ZodEffects,effect:{type:"refinement",refinement:J}})}superRefine(J){return this._refinement(J)}constructor(J){this.spa=this.safeParseAsync,this._def=J,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Q)=>this["~validate"](Q)}}optional(){return _$.create(this,this._def)}nullable(){return aW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S$.create(this)}promise(){return FM.create(this,this._def)}or(J){return uE.create([this,J],this._def)}and(J){return pE.create(this,J,this._def)}transform(J){return new y$({...k8(this._def),schema:this,typeName:q8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new iE({...k8(this._def),innerType:this,defaultValue:Q,typeName:q8.ZodDefault})}brand(){return new sl({typeName:q8.ZodBranded,type:this,...k8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new nE({...k8(this._def),innerType:this,catchValue:Q,typeName:q8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return Ik.create(this,J)}readonly(){return aE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function jU0(J){let Q="[0-5]\\d";if(J.precision)Q=`${Q}\\.\\d{${J.precision}}`;else if(J.precision==null)Q=`${Q}(\\.\\d+)?`;let Y=J.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${Y}`}function QG4(J){return new RegExp(`^${jU0(J)}$`)}function SU0(J){let Q=`${CU0}T${jU0(J)}`,Y=[];if(Y.push(J.local?"Z?":"Z"),J.offset)Y.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${Y.join("|")})`,new RegExp(`^${Q}$`)}function YG4(J,Q){if((Q==="v4"||!Q)&&aX4.test(J))return!0;if((Q==="v6"||!Q)&&rX4.test(J))return!0;return!1}function XG4(J,Q){if(!cX4.test(J))return!1;try{let[Y]=J.split(".");if(!Y)return!1;let X=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),G=JSON.parse(atob(X));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&G.alg!==Q)return!1;return!0}catch{return!1}}function GG4(J,Q){if((Q==="v4"||!Q)&&oX4.test(J))return!0;if((Q==="v6"||!Q)&&sX4.test(J))return!0;return!1}function ZG4(J,Q){let Y=(J.toString().split(".")[1]||"").length,X=(Q.toString().split(".")[1]||"").length,G=Y>X?Y:X,Z=Number.parseInt(J.toFixed(G).replace(".","")),q=Number.parseInt(Q.toFixed(G).replace(".",""));return Z%q/10**G}function fE(J){if(J instanceof _7){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=_$.create(fE(X))}return new _7({...J._def,shape:()=>Q})}else if(J instanceof S$)return new S$({...J._def,type:fE(J.element)});else if(J instanceof _$)return _$.create(fE(J.unwrap()));else if(J instanceof aW)return aW.create(fE(J.unwrap()));else if(J instanceof kV)return kV.create(J.items.map((Q)=>fE(Q)));else return J}function U$1(J,Q){let Y=SV(J),X=SV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===y6.object&&X===y6.object){let G=D9.objectKeys(Q),Z=D9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=U$1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===y6.array&&X===y6.array){if(J.length!==Q.length)return{valid:!1};let G=[];for(let Z=0;Z<J.length;Z++){let q=J[Z],V=Q[Z],K=U$1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===y6.date&&X===y6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function _U0(J,Q){return new oF({values:J,typeName:q8.ZodEnum,...k8(Q)})}function TU0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function kU0(J,Q={},Y){if(J)return HM.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=TU0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=TU0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return HM.create()}var RU0=(J,Q)=>{if(lF(Q))return{success:!0,data:Q.value};else{if(!J.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Y=new NY(J.common.issues);return this._error=Y,this._error}}}},gX4,mX4,uX4,pX4,dX4,cX4,lX4,iX4,nX4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",F$1,aX4,oX4,rX4,sX4,tX4,eX4,CU0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",JG4,j$,nF,aF,bE,WM,Lk,gE,mE,HM,iF,_V,Ak,S$,_7,uE,nW=(J)=>{if(J instanceof dE)return nW(J.schema);else if(J instanceof y$)return nW(J.innerType());else if(J instanceof cE)return[J.value];else if(J instanceof oF)return J.options;else if(J instanceof lE)return D9.objectValues(J.enum);else if(J instanceof iE)return nW(J._def.innerType);else if(J instanceof gE)return[void 0];else if(J instanceof mE)return[null];else if(J instanceof _$)return[void 0,...nW(J.unwrap())];else if(J instanceof aW)return[null,...nW(J.unwrap())];else if(J instanceof sl)return nW(J.unwrap());else if(J instanceof aE)return nW(J.unwrap());else if(J instanceof nE)return nW(J._def.innerType);else return[]},rl,pE,kV,Ok,wk,zM,hE,dE,cE,oF,lE,FM,y$,_$,aW,iE,nE,Ek,$G4,sl,Ik,aE,qG4,q8,VG4=(J,Q={message:`Input not instance of ${J.name}`})=>kU0((Y)=>Y instanceof J,Q),yU0,xU0,KG4,WG4,vU0,HG4,zG4,FG4,UG4,BG4,NG4,DG4,MG4,LG4,AG4,OG4,wG4,EG4,IG4,PG4,RG4,TG4,CG4,jG4,SG4,_G4,kG4,yG4,xG4,vG4,fG4,hG4,bG4,gG4,mG4=()=>yU0().optional(),uG4=()=>xU0().optional(),pG4=()=>vU0().optional(),dG4,cG4;var fU0=N1(()=>{il();nl();PU0();z$1();Dk();gX4=/^c[^\s-]{8,}$/i,mX4=/^[0-9a-z]+$/,uX4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pX4=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dX4=/^[a-z0-9_-]{21}$/i,cX4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lX4=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iX4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aX4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,oX4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rX4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,sX4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tX4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eX4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,JG4=new RegExp(`^${CU0}$`);j$=class j$ extends r8{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==y6.string){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_type,expected:y6.string,received:G.parsedType}),t4}let Y=new ZJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.length<G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(J.data.length>G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="length"){let Z=J.data.length>G.value,q=J.data.length<G.value;if(Z||q){if(X=this._getOrReturnCtx(J,X),Z)a6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)a6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!iX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"email",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!F$1)F$1=new RegExp(nX4,"u");if(!F$1.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"emoji",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!pX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"uuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!dX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"nanoid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!gX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"cuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!mX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"cuid2",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!uX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"ulid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),a6(X,{validation:"url",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"regex",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="trim")J.data=J.data.trim();else if(G.kind==="includes"){if(!J.data.includes(G.value,G.position))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Y.dirty()}else if(G.kind==="toLowerCase")J.data=J.data.toLowerCase();else if(G.kind==="toUpperCase")J.data=J.data.toUpperCase();else if(G.kind==="startsWith"){if(!J.data.startsWith(G.value))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:{startsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="endsWith"){if(!J.data.endsWith(G.value))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!SU0(G).test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!JG4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!QG4(G).test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{code:z6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!lX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"duration",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!YG4(J.data,G.version))X=this._getOrReturnCtx(J,X),a6(X,{validation:"ip",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!XG4(J.data,G.alg))X=this._getOrReturnCtx(J,X),a6(X,{validation:"jwt",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!GG4(J.data,G.version))X=this._getOrReturnCtx(J,X),a6(X,{validation:"cidr",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!tX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"base64",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!eX4.test(J.data))X=this._getOrReturnCtx(J,X),a6(X,{validation:"base64url",code:z6.invalid_string,message:G.message}),Y.dirty()}else D9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:z6.invalid_string,...L4.errToObj(Y)})}_addCheck(J){return new j$({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...L4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...L4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...L4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...L4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...L4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...L4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...L4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...L4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...L4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...L4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...L4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...L4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...L4.errToObj(J)})}datetime(J){if(typeof J==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:J});return this._addCheck({kind:"datetime",precision:typeof J?.precision>"u"?null:J?.precision,offset:J?.offset??!1,local:J?.local??!1,...L4.errToObj(J?.message)})}date(J){return this._addCheck({kind:"date",message:J})}time(J){if(typeof J==="string")return this._addCheck({kind:"time",precision:null,message:J});return this._addCheck({kind:"time",precision:typeof J?.precision>"u"?null:J?.precision,...L4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...L4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...L4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...L4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...L4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...L4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...L4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...L4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...L4.errToObj(Q)})}nonempty(J){return this.min(1,L4.errToObj(J))}trim(){return new j$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((J)=>J.kind==="datetime")}get isDate(){return!!this._def.checks.find((J)=>J.kind==="date")}get isTime(){return!!this._def.checks.find((J)=>J.kind==="time")}get isDuration(){return!!this._def.checks.find((J)=>J.kind==="duration")}get isEmail(){return!!this._def.checks.find((J)=>J.kind==="email")}get isURL(){return!!this._def.checks.find((J)=>J.kind==="url")}get isEmoji(){return!!this._def.checks.find((J)=>J.kind==="emoji")}get isUUID(){return!!this._def.checks.find((J)=>J.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((J)=>J.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((J)=>J.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((J)=>J.kind==="cuid2")}get isULID(){return!!this._def.checks.find((J)=>J.kind==="ulid")}get isIP(){return!!this._def.checks.find((J)=>J.kind==="ip")}get isCIDR(){return!!this._def.checks.find((J)=>J.kind==="cidr")}get isBase64(){return!!this._def.checks.find((J)=>J.kind==="base64")}get isBase64url(){return!!this._def.checks.find((J)=>J.kind==="base64url")}get minLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};j$.create=(J)=>{return new j$({checks:[],typeName:q8.ZodString,coerce:J?.coerce??!1,...k8(J)})};nF=class nF extends r8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(J){if(this._def.coerce)J.data=Number(J.data);if(this._getType(J)!==y6.number){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_type,expected:y6.number,received:G.parsedType}),t4}let Y=void 0,X=new ZJ;for(let G of this._def.checks)if(G.kind==="int"){if(!D9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.invalid_type,expected:"integer",received:"float",message:G.message}),X.dirty()}else if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(ZG4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(J.data))Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.not_finite,message:G.message}),X.dirty()}else D9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,L4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,L4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,L4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,L4.toString(Q))}setLimit(J,Q,Y,X){return new nF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:L4.toString(X)}]})}_addCheck(J){return new nF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:L4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:L4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:L4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L4.toString(J)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}get isInt(){return!!this._def.checks.find((J)=>J.kind==="int"||J.kind==="multipleOf"&&D9.isInteger(J.value))}get isFinite(){let J=null,Q=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(Q===null||Y.value>Q)Q=Y.value}else if(Y.kind==="max"){if(J===null||Y.value<J)J=Y.value}return Number.isFinite(Q)&&Number.isFinite(J)}};nF.create=(J)=>{return new nF({checks:[],typeName:q8.ZodNumber,coerce:J?.coerce||!1,...k8(J)})};aF=class aF extends r8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(J){if(this._def.coerce)try{J.data=BigInt(J.data)}catch{return this._getInvalidInput(J)}if(this._getType(J)!==y6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new ZJ;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(J.data%G.value!==BigInt(0))Y=this._getOrReturnCtx(J,Y),a6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else D9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return a6(Q,{code:z6.invalid_type,expected:y6.bigint,received:Q.parsedType}),t4}gte(J,Q){return this.setLimit("min",J,!0,L4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,L4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,L4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,L4.toString(Q))}setLimit(J,Q,Y,X){return new aF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:L4.toString(X)}]})}_addCheck(J){return new aF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:L4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:L4.toString(Q)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};aF.create=(J)=>{return new aF({checks:[],typeName:q8.ZodBigInt,coerce:J?.coerce??!1,...k8(J)})};bE=class bE extends r8{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==y6.boolean){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.boolean,received:Y.parsedType}),t4}return sJ(J.data)}};bE.create=(J)=>{return new bE({typeName:q8.ZodBoolean,coerce:J?.coerce||!1,...k8(J)})};WM=class WM extends r8{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==y6.date){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_type,expected:y6.date,received:G.parsedType}),t4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return a6(G,{code:z6.invalid_date}),t4}let Y=new ZJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.getTime()<G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Y.dirty()}else if(G.kind==="max"){if(J.data.getTime()>G.value)X=this._getOrReturnCtx(J,X),a6(X,{code:z6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else D9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new WM({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:L4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:L4.toString(Q)})}get minDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J!=null?new Date(J):null}get maxDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J!=null?new Date(J):null}};WM.create=(J)=>{return new WM({checks:[],coerce:J?.coerce||!1,typeName:q8.ZodDate,...k8(J)})};Lk=class Lk extends r8{_parse(J){if(this._getType(J)!==y6.symbol){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.symbol,received:Y.parsedType}),t4}return sJ(J.data)}};Lk.create=(J)=>{return new Lk({typeName:q8.ZodSymbol,...k8(J)})};gE=class gE extends r8{_parse(J){if(this._getType(J)!==y6.undefined){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.undefined,received:Y.parsedType}),t4}return sJ(J.data)}};gE.create=(J)=>{return new gE({typeName:q8.ZodUndefined,...k8(J)})};mE=class mE extends r8{_parse(J){if(this._getType(J)!==y6.null){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.null,received:Y.parsedType}),t4}return sJ(J.data)}};mE.create=(J)=>{return new mE({typeName:q8.ZodNull,...k8(J)})};HM=class HM extends r8{constructor(){super(...arguments);this._any=!0}_parse(J){return sJ(J.data)}};HM.create=(J)=>{return new HM({typeName:q8.ZodAny,...k8(J)})};iF=class iF extends r8{constructor(){super(...arguments);this._unknown=!0}_parse(J){return sJ(J.data)}};iF.create=(J)=>{return new iF({typeName:q8.ZodUnknown,...k8(J)})};_V=class _V extends r8{_parse(J){let Q=this._getOrReturnCtx(J);return a6(Q,{code:z6.invalid_type,expected:y6.never,received:Q.parsedType}),t4}};_V.create=(J)=>{return new _V({typeName:q8.ZodNever,...k8(J)})};Ak=class Ak extends r8{_parse(J){if(this._getType(J)!==y6.undefined){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.void,received:Y.parsedType}),t4}return sJ(J.data)}};Ak.create=(J)=>{return new Ak({typeName:q8.ZodVoid,...k8(J)})};S$=class S$ extends r8{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==y6.array)return a6(Q,{code:z6.invalid_type,expected:y6.array,received:Q.parsedType}),t4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)a6(Q,{code:Z?z6.too_big:z6.too_small,minimum:q?X.exactLength.value:void 0,maximum:Z?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Y.dirty()}if(X.minLength!==null){if(Q.data.length<X.minLength.value)a6(Q,{code:z6.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Y.dirty()}if(X.maxLength!==null){if(Q.data.length>X.maxLength.value)a6(Q,{code:z6.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Y.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((Z,q)=>{return X.type._parseAsync(new k$(Q,Z,Q.path,q))})).then((Z)=>{return ZJ.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new k$(Q,Z,Q.path,q))});return ZJ.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new S$({...this._def,minLength:{value:J,message:L4.toString(Q)}})}max(J,Q){return new S$({...this._def,maxLength:{value:J,message:L4.toString(Q)}})}length(J,Q){return new S$({...this._def,exactLength:{value:J,message:L4.toString(Q)}})}nonempty(J){return this.min(1,J)}};S$.create=(J,Q)=>{return new S$({type:J,minLength:null,maxLength:null,exactLength:null,typeName:q8.ZodArray,...k8(Q)})};_7=class _7 extends r8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let J=this._def.shape(),Q=D9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==y6.object){let K=this._getOrReturnCtx(J);return a6(K,{code:z6.invalid_type,expected:y6.object,received:K.parsedType}),t4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof _V&&this._def.unknownKeys==="strip")){for(let K in X.data)if(!Z.includes(K))q.push(K)}let V=[];for(let K of Z){let W=G[K],H=X.data[K];V.push({key:{status:"valid",value:K},value:W._parse(new k$(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof _V){let K=this._def.unknownKeys;if(K==="passthrough")for(let W of q)V.push({key:{status:"valid",value:W},value:{status:"valid",value:X.data[W]}});else if(K==="strict"){if(q.length>0)a6(X,{code:z6.unrecognized_keys,keys:q}),Y.dirty()}else if(K==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let W of q){let H=X.data[W];V.push({key:{status:"valid",value:W},value:K._parse(new k$(X,H,X.path,W)),alwaysSet:W in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let K=[];for(let W of V){let H=await W.key,z=await W.value;K.push({key:H,value:z,alwaysSet:W.alwaysSet})}return K}).then((K)=>{return ZJ.mergeObjectSync(Y,K)});else return ZJ.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return L4.errToObj,new _7({...this._def,unknownKeys:"strict",...J!==void 0?{errorMap:(Q,Y)=>{let X=this._def.errorMap?.(Q,Y).message??Y.defaultError;if(Q.code==="unrecognized_keys")return{message:L4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new _7({...this._def,unknownKeys:"strip"})}passthrough(){return new _7({...this._def,unknownKeys:"passthrough"})}extend(J){return new _7({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new _7({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:q8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new _7({...this._def,catchall:J})}pick(J){let Q={};for(let Y of D9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new _7({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of D9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new _7({...this._def,shape:()=>Q})}deepPartial(){return fE(this)}partial(J){let Q={};for(let Y of D9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new _7({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of D9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof _$)G=G._def.innerType;Q[Y]=G}return new _7({...this._def,shape:()=>Q})}keyof(){return _U0(D9.objectKeys(this.shape))}};_7.create=(J,Q)=>{return new _7({shape:()=>J,unknownKeys:"strip",catchall:_V.create(),typeName:q8.ZodObject,...k8(Q)})};_7.strictCreate=(J,Q)=>{return new _7({shape:()=>J,unknownKeys:"strict",catchall:_V.create(),typeName:q8.ZodObject,...k8(Q)})};_7.lazycreate=(J,Q)=>{return new _7({shape:J,unknownKeys:"strip",catchall:_V.create(),typeName:q8.ZodObject,...k8(Q)})};uE=class uE extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=this._def.options;function X(G){for(let q of G)if(q.result.status==="valid")return q.result;for(let q of G)if(q.result.status==="dirty")return Q.common.issues.push(...q.ctx.common.issues),q.result;let Z=G.map((q)=>new NY(q.ctx.common.issues));return a6(Q,{code:z6.invalid_union,unionErrors:Z}),t4}if(Q.common.async)return Promise.all(Y.map(async(G)=>{let Z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:Z}),ctx:Z}})).then(X);else{let G=void 0,Z=[];for(let V of Y){let K={...Q,common:{...Q.common,issues:[]},parent:null},W=V._parseSync({data:Q.data,path:Q.path,parent:K});if(W.status==="valid")return W;else if(W.status==="dirty"&&!G)G={result:W,ctx:K};if(K.common.issues.length)Z.push(K.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let q=Z.map((V)=>new NY(V));return a6(Q,{code:z6.invalid_union,unionErrors:q}),t4}}get options(){return this._def.options}};uE.create=(J,Q)=>{return new uE({options:J,typeName:q8.ZodUnion,...k8(Q)})};rl=class rl extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==y6.object)return a6(Q,{code:z6.invalid_type,expected:y6.object,received:Q.parsedType}),t4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return a6(Q,{code:z6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),t4;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Y){let X=new Map;for(let G of Q){let Z=nW(G.shape[J]);if(!Z.length)throw Error(`A discriminator value for key \`${J}\` could not be extracted from all schema options`);for(let q of Z){if(X.has(q))throw Error(`Discriminator property ${String(J)} has duplicate value ${String(q)}`);X.set(q,G)}}return new rl({typeName:q8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...k8(Y)})}};pE=class pE extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(al(G)||al(Z))return t4;let q=U$1(G.value,Z.value);if(!q.valid)return a6(Y,{code:z6.invalid_intersection_types}),t4;if(ol(G)||ol(Z))Q.dirty();return{status:Q.value,value:q.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([G,Z])=>X(G,Z));else return X(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}};pE.create=(J,Q,Y)=>{return new pE({left:J,right:Q,typeName:q8.ZodIntersection,...k8(Y)})};kV=class kV extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.array)return a6(Y,{code:z6.invalid_type,expected:y6.array,received:Y.parsedType}),t4;if(Y.data.length<this._def.items.length)return a6(Y,{code:z6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t4;if(!this._def.rest&&Y.data.length>this._def.items.length)a6(Y,{code:z6.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let G=[...Y.data].map((Z,q)=>{let V=this._def.items[q]||this._def.rest;if(!V)return null;return V._parse(new k$(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return ZJ.mergeArray(Q,Z)});else return ZJ.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new kV({...this._def,rest:J})}};kV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new kV({items:J,typeName:q8.ZodTuple,rest:null,...k8(Q)})};Ok=class Ok extends r8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.object)return a6(Y,{code:z6.invalid_type,expected:y6.object,received:Y.parsedType}),t4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new k$(Y,q,Y.path,q)),value:Z._parse(new k$(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return ZJ.mergeObjectAsync(Q,X);else return ZJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof r8)return new Ok({keyType:J,valueType:Q,typeName:q8.ZodRecord,...k8(Y)});return new Ok({keyType:j$.create(),valueType:J,typeName:q8.ZodRecord,...k8(Q)})}};wk=class wk extends r8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.map)return a6(Y,{code:z6.invalid_type,expected:y6.map,received:Y.parsedType}),t4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new k$(Y,q,Y.path,[K,"key"])),value:G._parse(new k$(Y,V,Y.path,[K,"value"]))}});if(Y.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let V of Z){let K=await V.key,W=await V.value;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let V of Z){let{key:K,value:W}=V;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};wk.create=(J,Q,Y)=>{return new wk({valueType:Q,keyType:J,typeName:q8.ZodMap,...k8(Y)})};zM=class zM extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==y6.set)return a6(Y,{code:z6.invalid_type,expected:y6.set,received:Y.parsedType}),t4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)a6(Y,{code:z6.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),Q.dirty()}if(X.maxSize!==null){if(Y.data.size>X.maxSize.value)a6(Y,{code:z6.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let G=this._def.valueType;function Z(V){let K=new Set;for(let W of V){if(W.status==="aborted")return t4;if(W.status==="dirty")Q.dirty();K.add(W.value)}return{status:Q.value,value:K}}let q=[...Y.data.values()].map((V,K)=>G._parse(new k$(Y,V,Y.path,K)));if(Y.common.async)return Promise.all(q).then((V)=>Z(V));else return Z(q)}min(J,Q){return new zM({...this._def,minSize:{value:J,message:L4.toString(Q)}})}max(J,Q){return new zM({...this._def,maxSize:{value:J,message:L4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};zM.create=(J,Q)=>{return new zM({valueType:J,minSize:null,maxSize:null,typeName:q8.ZodSet,...k8(Q)})};hE=class hE extends r8{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==y6.function)return a6(Q,{code:z6.invalid_type,expected:y6.function,received:Q.parsedType}),t4;function Y(q,V){return Mk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,xE(),iW].filter((K)=>!!K),issueData:{code:z6.invalid_arguments,argumentsError:V}})}function X(q,V){return Mk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,xE(),iW].filter((K)=>!!K),issueData:{code:z6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof FM){let q=this;return sJ(async function(...V){let K=new NY([]),W=await q._def.args.parseAsync(V,G).catch((U)=>{throw K.addIssue(Y(V,U)),K}),H=await Reflect.apply(Z,this,W);return await q._def.returns._def.type.parseAsync(H,G).catch((U)=>{throw K.addIssue(X(H,U)),K})})}else{let q=this;return sJ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new NY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new NY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new hE({...this._def,args:kV.create(J).rest(iF.create())})}returns(J){return new hE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new hE({args:J?J:kV.create([]).rest(iF.create()),returns:Q||iF.create(),typeName:q8.ZodFunction,...k8(Y)})}};dE=class dE extends r8{get schema(){return this._def.getter()}_parse(J){let{ctx:Q}=this._processInputParams(J);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};dE.create=(J,Q)=>{return new dE({getter:J,typeName:q8.ZodLazy,...k8(Q)})};cE=class cE extends r8{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return a6(Q,{received:Q.data,code:z6.invalid_literal,expected:this._def.value}),t4}return{status:"valid",value:J.data}}get value(){return this._def.value}};cE.create=(J,Q)=>{return new cE({value:J,typeName:q8.ZodLiteral,...k8(Q)})};oF=class oF extends r8{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return a6(Q,{expected:D9.joinValues(Y),received:Q.parsedType,code:z6.invalid_type}),t4}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Y=this._def.values;return a6(Q,{received:Q.data,code:z6.invalid_enum_value,options:Y}),t4}return sJ(J.data)}get options(){return this._def.values}get enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Values(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}extract(J,Q=this._def){return oF.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return oF.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};oF.create=_U0;lE=class lE extends r8{_parse(J){let Q=D9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==y6.string&&Y.parsedType!==y6.number){let X=D9.objectValues(Q);return a6(Y,{expected:D9.joinValues(X),received:Y.parsedType,code:z6.invalid_type}),t4}if(!this._cache)this._cache=new Set(D9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=D9.objectValues(Q);return a6(Y,{received:Y.data,code:z6.invalid_enum_value,options:X}),t4}return sJ(J.data)}get enum(){return this._def.values}};lE.create=(J,Q)=>{return new lE({values:J,typeName:q8.ZodNativeEnum,...k8(Q)})};FM=class FM extends r8{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==y6.promise&&Q.common.async===!1)return a6(Q,{code:z6.invalid_type,expected:y6.promise,received:Q.parsedType}),t4;let Y=Q.parsedType===y6.promise?Q.data:Promise.resolve(Q.data);return sJ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};FM.create=(J,Q)=>{return new FM({type:J,typeName:q8.ZodPromise,...k8(Q)})};y$=class y$ extends r8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=this._def.effect||null,G={addIssue:(Z)=>{if(a6(Y,Z),Z.fatal)Q.abort();else Q.dirty()},get path(){return Y.path}};if(G.addIssue=G.addIssue.bind(G),X.type==="preprocess"){let Z=X.transform(Y.data,G);if(Y.common.async)return Promise.resolve(Z).then(async(q)=>{if(Q.value==="aborted")return t4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return t4;if(V.status==="dirty")return KM(V.value);if(Q.value==="dirty")return KM(V.value);return V});else{if(Q.value==="aborted")return t4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")return KM(q.value);if(Q.value==="dirty")return KM(q.value);return q}}if(X.type==="refinement"){let Z=(q)=>{let V=X.refinement(q,G);if(Y.common.async)return Promise.resolve(V);if(V instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Y.common.async===!1){let q=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((q)=>{if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Y.common.async===!1){let Z=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!lF(Z))return t4;let q=X.transform(Z.value,G);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((Z)=>{if(!lF(Z))return t4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});D9.assertNever(X)}};y$.create=(J,Q,Y)=>{return new y$({schema:J,typeName:q8.ZodEffects,effect:Q,...k8(Y)})};y$.createWithPreprocess=(J,Q,Y)=>{return new y$({schema:Q,effect:{type:"preprocess",transform:J},typeName:q8.ZodEffects,...k8(Y)})};_$=class _$ extends r8{_parse(J){if(this._getType(J)===y6.undefined)return sJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};_$.create=(J,Q)=>{return new _$({innerType:J,typeName:q8.ZodOptional,...k8(Q)})};aW=class aW extends r8{_parse(J){if(this._getType(J)===y6.null)return sJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};aW.create=(J,Q)=>{return new aW({innerType:J,typeName:q8.ZodNullable,...k8(Q)})};iE=class iE extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===y6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};iE.create=(J,Q)=>{return new iE({innerType:J,typeName:q8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...k8(Q)})};nE=class nE extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y={...Q,common:{...Q.common,issues:[]}},X=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(vE(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new NY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new NY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};nE.create=(J,Q)=>{return new nE({innerType:J,typeName:q8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...k8(Q)})};Ek=class Ek extends r8{_parse(J){if(this._getType(J)!==y6.nan){let Y=this._getOrReturnCtx(J);return a6(Y,{code:z6.invalid_type,expected:y6.nan,received:Y.parsedType}),t4}return{status:"valid",value:J.data}}};Ek.create=(J)=>{return new Ek({typeName:q8.ZodNaN,...k8(J)})};$G4=Symbol("zod_brand");sl=class sl extends r8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;return this._def.type._parse({data:Y,path:Q.path,parent:Q})}unwrap(){return this._def.type}};Ik=class Ik extends r8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return t4;if(G.status==="dirty")return Q.dirty(),KM(G.value);else return this._def.out._parseAsync({data:G.value,path:Y.path,parent:Y})})();else{let X=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(X.status==="aborted")return t4;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Y.path,parent:Y})}}static create(J,Q){return new Ik({in:J,out:Q,typeName:q8.ZodPipeline})}};aE=class aE extends r8{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(lF(X))X.value=Object.freeze(X.value);return X};return vE(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};aE.create=(J,Q)=>{return new aE({innerType:J,typeName:q8.ZodReadonly,...k8(Q)})};qG4={object:_7.lazycreate};(function(J){J.ZodString="ZodString",J.ZodNumber="ZodNumber",J.ZodNaN="ZodNaN",J.ZodBigInt="ZodBigInt",J.ZodBoolean="ZodBoolean",J.ZodDate="ZodDate",J.ZodSymbol="ZodSymbol",J.ZodUndefined="ZodUndefined",J.ZodNull="ZodNull",J.ZodAny="ZodAny",J.ZodUnknown="ZodUnknown",J.ZodNever="ZodNever",J.ZodVoid="ZodVoid",J.ZodArray="ZodArray",J.ZodObject="ZodObject",J.ZodUnion="ZodUnion",J.ZodDiscriminatedUnion="ZodDiscriminatedUnion",J.ZodIntersection="ZodIntersection",J.ZodTuple="ZodTuple",J.ZodRecord="ZodRecord",J.ZodMap="ZodMap",J.ZodSet="ZodSet",J.ZodFunction="ZodFunction",J.ZodLazy="ZodLazy",J.ZodLiteral="ZodLiteral",J.ZodEnum="ZodEnum",J.ZodEffects="ZodEffects",J.ZodNativeEnum="ZodNativeEnum",J.ZodOptional="ZodOptional",J.ZodNullable="ZodNullable",J.ZodDefault="ZodDefault",J.ZodCatch="ZodCatch",J.ZodPromise="ZodPromise",J.ZodBranded="ZodBranded",J.ZodPipeline="ZodPipeline",J.ZodReadonly="ZodReadonly"})(q8||(q8={}));yU0=j$.create,xU0=nF.create,KG4=Ek.create,WG4=aF.create,vU0=bE.create,HG4=WM.create,zG4=Lk.create,FG4=gE.create,UG4=mE.create,BG4=HM.create,NG4=iF.create,DG4=_V.create,MG4=Ak.create,LG4=S$.create,AG4=_7.create,OG4=_7.strictCreate,wG4=uE.create,EG4=rl.create,IG4=pE.create,PG4=kV.create,RG4=Ok.create,TG4=wk.create,CG4=zM.create,jG4=hE.create,SG4=dE.create,_G4=cE.create,kG4=oF.create,yG4=lE.create,xG4=FM.create,vG4=y$.create,fG4=_$.create,hG4=aW.create,bG4=y$.createWithPreprocess,gG4=Ik.create,dG4={string:(J)=>j$.create({...J,coerce:!0}),number:(J)=>nF.create({...J,coerce:!0}),boolean:(J)=>bE.create({...J,coerce:!0}),bigint:(J)=>aF.create({...J,coerce:!0}),date:(J)=>WM.create({...J,coerce:!0})},cG4=t4});var Q1={};y8(Q1,{void:()=>MG4,util:()=>D9,unknown:()=>NG4,union:()=>wG4,undefined:()=>FG4,tuple:()=>PG4,transformer:()=>vG4,symbol:()=>zG4,string:()=>yU0,strictObject:()=>OG4,setErrorMap:()=>hX4,set:()=>CG4,record:()=>RG4,quotelessJson:()=>vX4,promise:()=>xG4,preprocess:()=>bG4,pipeline:()=>gG4,ostring:()=>mG4,optional:()=>fG4,onumber:()=>uG4,oboolean:()=>pG4,objectUtil:()=>W$1,object:()=>AG4,number:()=>xU0,nullable:()=>hG4,null:()=>UG4,never:()=>DG4,nativeEnum:()=>yG4,nan:()=>KG4,map:()=>TG4,makeIssue:()=>Mk,literal:()=>_G4,lazy:()=>SG4,late:()=>qG4,isValid:()=>lF,isDirty:()=>ol,isAsync:()=>vE,isAborted:()=>al,intersection:()=>IG4,instanceof:()=>VG4,getParsedType:()=>SV,getErrorMap:()=>xE,function:()=>jG4,enum:()=>kG4,effect:()=>vG4,discriminatedUnion:()=>EG4,defaultErrorMap:()=>iW,datetimeRegex:()=>SU0,date:()=>HG4,custom:()=>kU0,coerce:()=>dG4,boolean:()=>vU0,bigint:()=>WG4,array:()=>LG4,any:()=>BG4,addIssueToContext:()=>a6,ZodVoid:()=>Ak,ZodUnknown:()=>iF,ZodUnion:()=>uE,ZodUndefined:()=>gE,ZodType:()=>r8,ZodTuple:()=>kV,ZodTransformer:()=>y$,ZodSymbol:()=>Lk,ZodString:()=>j$,ZodSet:()=>zM,ZodSchema:()=>r8,ZodRecord:()=>Ok,ZodReadonly:()=>aE,ZodPromise:()=>FM,ZodPipeline:()=>Ik,ZodParsedType:()=>y6,ZodOptional:()=>_$,ZodObject:()=>_7,ZodNumber:()=>nF,ZodNullable:()=>aW,ZodNull:()=>mE,ZodNever:()=>_V,ZodNativeEnum:()=>lE,ZodNaN:()=>Ek,ZodMap:()=>wk,ZodLiteral:()=>cE,ZodLazy:()=>dE,ZodIssueCode:()=>z6,ZodIntersection:()=>pE,ZodFunction:()=>hE,ZodFirstPartyTypeKind:()=>q8,ZodError:()=>NY,ZodEnum:()=>oF,ZodEffects:()=>y$,ZodDiscriminatedUnion:()=>rl,ZodDefault:()=>iE,ZodDate:()=>WM,ZodCatch:()=>nE,ZodBranded:()=>sl,ZodBoolean:()=>bE,ZodBigInt:()=>aF,ZodArray:()=>S$,ZodAny:()=>HM,Schema:()=>r8,ParseStatus:()=>ZJ,OK:()=>sJ,NEVER:()=>cG4,INVALID:()=>t4,EMPTY_PATH:()=>bX4,DIRTY:()=>KM,BRAND:()=>$G4});var B$1=N1(()=>{nl();z$1();IU0();Dk();fU0();il()});var Pk=N1(()=>{B$1();B$1()});function tJ(J,Q){let Y=nG4(J,Q);return typeof Y==="string"?Y:Y.toString()}function nG4(J,Q,Y=!0){if(!Q)Q=aG4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?i0.parse(J):i0.from(J);if(X)for(let V of X){let K=l4(V);if(s0.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?ZM(K.path)+(G?"\\":"/"):"";return D$1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=l4(Z);if(s0.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return D$1("~"+(G?"\\":"/")+W,G,q.scheme)}}return D$1(q.fsPath,G,q.scheme)}return q}function D$1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function el(J){let Q=tl;return tl=J,Q}function aG4(){if(tl)return tl;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var tl=null;var oW=N1(()=>{G4();TE();xl()});var oG4=(J)=>{let Q=0,Y=[];while(Q<J.length){let X=J[Q];if(X==="\\"){Q++;continue}if(X==="{"){Y.push({type:"brace",value:"{"}),Q++;continue}if(X==="}"){Y.push({type:"brace",value:"}"}),Q++;continue}if(X==="["){Y.push({type:"paren",value:"["}),Q++;continue}if(X==="]"){Y.push({type:"paren",value:"]"}),Q++;continue}if(X===":"){Y.push({type:"separator",value:":"}),Q++;continue}if(X===","){Y.push({type:"delimiter",value:","}),Q++;continue}if(X==='"'){let V="",K=!1;X=J[++Q];while(X!=='"'){if(Q===J.length){K=!0;break}if(X==="\\"){if(Q++,Q===J.length){K=!0;break}V+=X+J[Q],X=J[++Q]}else V+=X,X=J[++Q]}if(X=J[++Q],!K)Y.push({type:"string",value:V});continue}if(X&&/\s/.test(X)){Q++;continue}let Z=/[0-9]/;if(X&&Z.test(X)||X==="-"||X==="."){let V="";if(X==="-")V+=X,X=J[++Q];while(X&&Z.test(X)||X===".")V+=X,X=J[++Q];Y.push({type:"number",value:V});continue}let q=/[a-z]/i;if(X&&q.test(X)){let V="";while(X&&q.test(X)){if(Q===J.length)break;V+=X,X=J[++Q]}if(V=="true"||V=="false"||V==="null")Y.push({type:"name",value:V});else{Q++;continue}continue}Q++}return Y},rE=(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),rE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),rE(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),rE(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),rE(J);break;case"delimiter":return J=J.slice(0,J.length-1),rE(J);break}return J},rG4=(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},sG4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},lG=(J)=>JSON.parse(sG4(rG4(rE(oG4(J)))));var UM=()=>{};function eJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function DM(J){return!!J&&!!J[BX]}function sF(J){if(!J)return!1;return pU0(J)||Array.isArray(J)||!!J[Rk]||!!J.constructor?.[Rk]||_k(J)||kk(J)}function pU0(J){if(!J||typeof J!=="object")return!1;let Q=NM(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)===tG4}function Tk(J,Q){if(MM(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function MM(J){let Q=J[BX];return Q?Q.type_:Array.isArray(J)?1:_k(J)?2:kk(J)?3:0}function Ck(J,Q){return MM(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function M$1(J,Q){return MM(J)===2?J.get(Q):J[Q]}function dU0(J,Q,Y){let X=MM(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function eG4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function _k(J){return J instanceof Map}function kk(J){return J instanceof Set}function BM(J){return J.copy_||J.base_}function O$1(J,Q){if(_k(J))return new Map(J);if(kk(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=pU0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[BX];let G=Reflect.ownKeys(X);for(let Z=0;Z<G.length;Z++){let q=G[Z],V=X[q];if(V.writable===!1)V.writable=!0,V.configurable=!0;if(V.get||V.set)X[q]={configurable:!0,writable:!0,enumerable:V.enumerable,value:J[q]}}return Object.create(NM(J),X)}else{let X=NM(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function DX(J,Q=!1){if(Yi(J)||DM(J)||!sF(J))return J;if(MM(J)>1)J.set=J.add=J.clear=J.delete=JZ4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>DX(X,!0));return J}function JZ4(){eJ(2)}function Yi(J){return Object.isFrozen(J)}function LM(J){let Q=w$1[J];if(!Q)eJ(0,J);return Q}function QZ4(J,Q){if(!w$1[J])w$1[J]=Q}function cU0(){return jk}function YZ4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function bU0(J,Q){if(Q)LM("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function E$1(J){I$1(J),J.drafts_.forEach(XZ4),J.drafts_=null}function I$1(J){if(J===jk)jk=J.parent_}function gU0(J){return jk=YZ4(jk,J)}function XZ4(J){let Q=J[BX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function mU0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[BX].modified_)E$1(Q),eJ(4);if(sF(J)){if(J=Ji(Q,J),!Q.parent_)Qi(Q,J)}if(Q.patches_)LM("Patches").generateReplacementPatches_(Y[BX].base_,J,Q.patches_,Q.inversePatches_)}else J=Ji(Q,Y,[]);if(E$1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==T$1?J:void 0}function Ji(J,Q,Y){if(Yi(Q))return Q;let X=Q[BX];if(!X)return Tk(Q,(G,Z)=>uU0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Qi(J,X.base_,!0),X.base_;if(!X.finalized_){X.finalized_=!0,X.scope_.unfinalizedDrafts_--;let G=X.copy_,Z=G,q=!1;if(X.type_===3)Z=new Set(G),G.clear(),q=!0;if(Tk(Z,(V,K)=>uU0(J,X,G,V,K,Y,q)),Qi(J,G,!1),Y&&J.patches_)LM("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function uU0(J,Q,Y,X,G,Z,q){if(DM(G)){let V=Z&&Q&&Q.type_!==3&&!Ck(Q.assigned_,X)?Z.concat(X):void 0,K=Ji(J,G,V);if(dU0(Y,X,K),DM(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(sF(G)&&!Yi(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Ji(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))Qi(J,G)}}function Qi(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)DX(Q,Y)}function GZ4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:cU0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=C$1;if(Y)G=[X],Z=Sk;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function L$1(J,Q){let Y=J[BX];return(Y?BM(Y):J)[Q]}function ZZ4(J,Q,Y){let X=lU0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function lU0(J,Q){if(!(Q in J))return;let Y=NM(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=NM(Y)}return}function P$1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)P$1(J.parent_)}}function A$1(J){if(!J.copy_)J.copy_=O$1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function R$1(J,Q){let Y=_k(J)?LM("MapSet").proxyMap_(J,Q):kk(J)?LM("MapSet").proxySet_(J,Q):GZ4(J,Q);return(Q?Q.scope_:cU0()).drafts_.push(Y),Y}function qZ4(J){if(!DM(J))eJ(10,J);return iU0(J)}function iU0(J){if(!sF(J)||Yi(J))return J;let Q=J[BX],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=O$1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=O$1(J,!0);if(Tk(Y,(X,G)=>{dU0(Y,X,iU0(G))}),Q)Q.finalized_=!1;return Y}function Xi(){let Q="replace",Y="add",X="remove";function G(U,N,M,L){switch(U.type_){case 0:case 2:return q(U,N,M,L);case 1:return Z(U,N,M,L);case 3:return V(U,N,M,L)}}function Z(U,N,M,L){let{base_:A,assigned_:E}=U,P=U.copy_;if(P.length<A.length)[A,P]=[P,A],[M,L]=[L,M];for(let I=0;I<A.length;I++)if(E[I]&&P[I]!==A[I]){let T=N.concat([I]);M.push({op:Q,path:T,value:z(P[I])}),L.push({op:Q,path:T,value:z(A[I])})}for(let I=A.length;I<P.length;I++){let T=N.concat([I]);M.push({op:Y,path:T,value:z(P[I])})}for(let I=P.length-1;A.length<=I;--I){let T=N.concat([I]);L.push({op:X,path:T})}}function q(U,N,M,L){let{base_:A,copy_:E}=U;Tk(U.assigned_,(P,I)=>{let T=M$1(A,P),S=M$1(E,P),y=!I?X:Ck(A,P)?Q:Y;if(T===S&&y===Q)return;let x=N.concat(P);M.push(y===X?{op:y,path:x}:{op:y,path:x,value:S}),L.push(y===Y?{op:X,path:x}:y===X?{op:Y,path:x,value:z(T)}:{op:Q,path:x,value:z(T)})})}function V(U,N,M,L){let{base_:A,copy_:E}=U,P=0;A.forEach((I)=>{if(!E.has(I)){let T=N.concat([P]);M.push({op:X,path:T,value:I}),L.unshift({op:Y,path:T,value:I})}P++}),P=0,E.forEach((I)=>{if(!A.has(I)){let T=N.concat([P]);M.push({op:Y,path:T,value:I}),L.unshift({op:X,path:T,value:I})}P++})}function K(U,N,M,L){M.push({op:Q,path:[],value:N===T$1?void 0:N}),L.push({op:Q,path:[],value:U})}function W(U,N){return N.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let S=0;S<L.length-1;S++){let y=MM(E),x=L[S];if(typeof x!=="string"&&typeof x!=="number")x=""+x;if((y===0||y===1)&&(x==="__proto__"||x==="constructor"))eJ(19);if(typeof E==="function"&&x==="prototype")eJ(19);if(E=M$1(E,x),typeof E!=="object")eJ(18,L.join("/"))}let P=MM(E),I=H(M.value),T=L[L.length-1];switch(A){case Q:switch(P){case 2:return E.set(T,I);case 3:eJ(16);default:return E[T]=I}case Y:switch(P){case 1:return T==="-"?E.push(I):E.splice(T,0,I);case 2:return E.set(T,I);case 3:return E.add(I);default:return E[T]=I}case X:switch(P){case 1:return E.splice(T,1);case 2:return E.delete(T);case 3:return E.delete(M.value);default:return delete E[T]}default:eJ(17,A)}}),U}function H(U){if(!sF(U))return U;if(Array.isArray(U))return U.map(H);if(_k(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(kk(U))return new Set(Array.from(U).map(H));let N=Object.create(NM(U));for(let M in U)N[M]=H(U[M]);if(Ck(U,Rk))N[Rk]=U[Rk];return N}function z(U){if(DM(U))return H(U);else return U}QZ4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function $9(J){return J}var T$1,Rk,BX,NM,tG4,w$1,jk,C$1,Sk,$Z4=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Y,X)=>{if(typeof Q==="function"&&typeof Y!=="function"){let Z=Y;Y=Q;let q=this;return function(K=Z,...W){return q.produce(K,(H)=>Y.call(this,H,...W))}}if(typeof Y!=="function")eJ(6);if(X!==void 0&&typeof X!=="function")eJ(7);let G;if(sF(Q)){let Z=gU0(this),q=R$1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)E$1(Z);else I$1(Z)}return bU0(Z,X),mU0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===T$1)G=void 0;if(this.autoFreeze_)DX(G,!0);if(X){let Z=[],q=[];LM("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else eJ(1,Q)},this.produceWithPatches=(Q,Y)=>{if(typeof Q==="function")return(q,...V)=>this.produceWithPatches(q,(K)=>Q(K,...V));let X,G;return[this.produce(Q,Y,(q,V)=>{X=q,G=V}),X,G]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!sF(J))eJ(8);if(DM(J))J=qZ4(J);let Q=gU0(this),Y=R$1(J,void 0);return Y[BX].isManual_=!0,I$1(Q),Y}finishDraft(J,Q){let Y=J&&J[BX];if(!Y||!Y.isManual_)eJ(9);let{scope_:X}=Y;return bU0(X,Q),mU0(void 0,X)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Y;for(Y=Q.length-1;Y>=0;Y--){let G=Q[Y];if(G.path.length===0&&G.op==="replace"){J=G.value;break}}if(Y>-1)Q=Q.slice(Y+1);let X=LM("Patches").applyPatches_;if(DM(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},NX,tF,AM,Wd8,Hd8,nU0,zd8,Fd8;var DY=N1(()=>{T$1=Symbol.for("immer-nothing"),Rk=Symbol.for("immer-draftable"),BX=Symbol.for("immer-state");NM=Object.getPrototypeOf;tG4=Object.prototype.constructor.toString();w$1={};C$1={get(J,Q){if(Q===BX)return J;let Y=BM(J);if(!Ck(Y,Q))return ZZ4(J,Y,Q);let X=Y[Q];if(J.finalized_||!sF(X))return X;if(X===L$1(J.base_,Q))return A$1(J),J.copy_[Q]=R$1(X,J);return X},has(J,Q){return Q in BM(J)},ownKeys(J){return Reflect.ownKeys(BM(J))},set(J,Q,Y){let X=lU0(BM(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=L$1(BM(J),Q),Z=G?.[BX];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(eG4(Y,G)&&(Y!==void 0||Ck(J.base_,Q)))return!0;A$1(J),P$1(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(L$1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,A$1(J),P$1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=BM(J),X=Reflect.getOwnPropertyDescriptor(Y,Q);if(!X)return X;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:X.enumerable,value:Y[Q]}},defineProperty(){eJ(11)},getPrototypeOf(J){return NM(J.base_)},setPrototypeOf(){eJ(12)}},Sk={};Tk(C$1,(J,Q)=>{Sk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});Sk.deleteProperty=function(J,Q){return Sk.set.call(this,J,Q,void 0)};Sk.set=function(J,Q,Y){return C$1.set.call(this,J[0],Q,Y,J[0])};NX=new $Z4,tF=NX.produce,AM=NX.produceWithPatches.bind(NX),Wd8=NX.setAutoFreeze.bind(NX),Hd8=NX.setUseStrictShallowCopy.bind(NX),nU0=NX.applyPatches.bind(NX),zd8=NX.createDraft.bind(NX),Fd8=NX.finishDraft.bind(NX)});function j$1({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 sE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(VZ4,"")}var VZ4;var Gi=N1(()=>{VZ4=j$1()});var oU0=f((Ld8,S$1)=>{var eF={};if(typeof S$1>"u")window.eastasianwidth=eF;else S$1.exports=eF;eF.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Y=J.length==2?J.charCodeAt(1):0,X=Q;if(55296<=Q&&Q<=56319&&(56320<=Y&&Y<=57343))Q&=1023,Y&=1023,X=Q<<10|Y,X+=65536;if(X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510)return"F";if(X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518)return"H";if(4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141)return"W";if(32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630)return"Na";if(X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109)return"A";return"N"};eF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function aU0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}eF.length=function(J){var Q=aU0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};eF.slice=function(J,Q,Y){if(textLen=eF.length(J),Q=Q?Q:0,Y=Y?Y:1,Q<0)Q=textLen+Q;if(Y<0)Y=textLen+Y;var X="",G=0,Z=aU0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=eF.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var _$1=f((Ad8,rU0)=>{rU0.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 KZ4,WZ4;var sU0=N1(()=>{Gi();KZ4=B6(oU0(),1),WZ4=B6(_$1(),1)});function Zi(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var k$1=N1(()=>{sU0()});var tU0="run_terminal_command",y$1="read_file",$J="Task",q9="finder",MY="get_diagnostics",d9="Bash",$i="InteractiveShell",s5="oracle",yV="mermaid",xV="todo_read",V7="todo_write",F2="read_web_page",tE="read_thread",qi="find_thread",U5="create_file",$3="glob",Vi="undo_edit",Ki="read_mcp_resource",d6="Read",D7="edit_file",eE="format_file",y3="web_search",x8="Grep",OM="Check",MX="librarian",Wi="kraken",eU0="look_at",JB0="read_artifact",QB0="edit_artifact",Hi="read_plan",JI="edit_plan",zi="read_github",Fi="search_github",Ui="commit_search",Bi="list_directory_github",Ni="list_repositories",Di="glob_github",Mi="diff",YB0="bookkeeper",XB0="describe_workbook",GB0="execute_query",yk="skill",ZB0;var B4=N1(()=>{ZB0=["Task","finder","get_diagnostics","Bash","InteractiveShell","oracle","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","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var xk=f((Td8,qB0)=>{var $B0={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:"/"},HZ4={...$B0,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:"\\"},zZ4={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"};qB0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:zZ4,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?HZ4:$B0}}});var vk=f((DZ4)=>{var{REGEX_BACKSLASH:FZ4,REGEX_REMOVE_BACKSLASH:UZ4,REGEX_SPECIAL_CHARS:BZ4,REGEX_SPECIAL_CHARS_GLOBAL:NZ4}=xk();DZ4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);DZ4.hasRegexChars=(J)=>BZ4.test(J);DZ4.isRegexChar=(J)=>J.length===1&&DZ4.hasRegexChars(J);DZ4.escapeRegex=(J)=>J.replace(NZ4,"\\$1");DZ4.toPosixSlashes=(J)=>J.replace(FZ4,"/");DZ4.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};DZ4.removeBackslashes=(J)=>{return J.replace(UZ4,(Q)=>{return Q==="\\"?"":Q})};DZ4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return DZ4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};DZ4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};DZ4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};DZ4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var DB0=f((jd8,NB0)=>{var WB0=vk(),{CHAR_ASTERISK:x$1,CHAR_AT:TZ4,CHAR_BACKWARD_SLASH:fk,CHAR_COMMA:CZ4,CHAR_DOT:v$1,CHAR_EXCLAMATION_MARK:f$1,CHAR_FORWARD_SLASH:BB0,CHAR_LEFT_CURLY_BRACE:h$1,CHAR_LEFT_PARENTHESES:b$1,CHAR_LEFT_SQUARE_BRACKET:jZ4,CHAR_PLUS:SZ4,CHAR_QUESTION_MARK:HB0,CHAR_RIGHT_CURLY_BRACE:_Z4,CHAR_RIGHT_PARENTHESES:zB0,CHAR_RIGHT_SQUARE_BRACKET:kZ4}=xk(),FB0=(J)=>{return J===BB0||J===fk},UB0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},yZ4=(J,Q)=>{let Y=Q||{},X=J.length-1,G=Y.parts===!0||Y.scanToEnd===!0,Z=[],q=[],V=[],K=J,W=-1,H=0,z=0,U=!1,N=!1,M=!1,L=!1,A=!1,E=!1,P=!1,I=!1,T=!1,S=!1,y=0,x,g,p={value:"",depth:0,isGlob:!1},b=()=>W>=X,l=()=>K.charCodeAt(W+1),J1=()=>{return x=g,K.charCodeAt(++W)};while(W<X){g=J1();let W1;if(g===fk){if(P=p.backslashes=!0,g=J1(),g===h$1)E=!0;continue}if(E===!0||g===h$1){y++;while(b()!==!0&&(g=J1())){if(g===fk){P=p.backslashes=!0,J1();continue}if(g===h$1){y++;continue}if(E!==!0&&g===v$1&&(g=J1())===v$1){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(E!==!0&&g===CZ4){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===_Z4){if(y--,y===0){E=!1,U=p.isBrace=!0,S=!0;break}}}if(G===!0)continue;break}if(g===BB0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},S===!0)continue;if(x===v$1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((g===SZ4||g===TZ4||g===x$1||g===HB0||g===f$1)===!0&&l()===b$1){if(M=p.isGlob=!0,L=p.isExtglob=!0,S=!0,g===f$1&&W===H)T=!0;if(G===!0){while(b()!==!0&&(g=J1())){if(g===fk){P=p.backslashes=!0,g=J1();continue}if(g===zB0){M=p.isGlob=!0,S=!0;break}}continue}break}}if(g===x$1){if(x===x$1)A=p.isGlobstar=!0;if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===HB0){if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===jZ4){while(b()!==!0&&(W1=J1())){if(W1===fk){P=p.backslashes=!0,J1();continue}if(W1===kZ4){N=p.isBracket=!0,M=p.isGlob=!0,S=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&g===f$1&&W===H){I=p.negated=!0,H++;continue}if(Y.noparen!==!0&&g===b$1){if(M=p.isGlob=!0,G===!0){while(b()!==!0&&(g=J1())){if(g===b$1){P=p.backslashes=!0,g=J1();continue}if(g===zB0){S=!0;break}}continue}break}if(M===!0){if(S=!0,G===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let n=K,u="",s="";if(H>0)u=K.slice(0,H),K=K.slice(H),z-=H;if(n&&M===!0&&z>0)n=K.slice(0,z),s=K.slice(z);else if(M===!0)n="",s=K;else n=K;if(n&&n!==""&&n!=="/"&&n!==K){if(FB0(n.charCodeAt(n.length-1)))n=n.slice(0,-1)}if(Y.unescape===!0){if(s)s=WB0.removeBackslashes(s);if(n&&P===!0)n=WB0.removeBackslashes(n)}let H1={prefix:u,input:J,start:H,base:n,glob:s,isBrace:U,isBracket:N,isGlob:M,isExtglob:L,isGlobstar:A,negated:I,negatedExtglob:T};if(Y.tokens===!0){if(H1.maxDepth=0,!FB0(g))q.push(p);H1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let W1;for(let o=0;o<Z.length;o++){let r=W1?W1+1:H,i=Z[o],F1=J.slice(r,i);if(Y.tokens){if(o===0&&H!==0)q[o].isPrefix=!0,q[o].value=u;else q[o].value=F1;UB0(q[o]),H1.maxDepth+=q[o].depth}if(o!==0||F1!=="")V.push(F1);W1=i}if(W1&&W1+1<J.length){let o=J.slice(W1+1);if(V.push(o),Y.tokens)q[q.length-1].value=o,UB0(q[q.length-1]),H1.maxDepth+=q[q.length-1].depth}H1.slashes=Z,H1.parts=V}return H1};NB0.exports=yZ4});var AB0=f((Sd8,LB0)=>{var Li=xk(),vV=vk(),{MAX_LENGTH:Ai,POSIX_REGEX_SOURCE:xZ4,REGEX_NON_SPECIAL_CHARS:vZ4,REGEX_SPECIAL_CHARS_BACKREF:fZ4,REPLACEMENTS:MB0}=Li,hZ4=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Y=`[${J.join("-")}]`;try{new RegExp(Y)}catch(X){return J.map((G)=>vV.escapeRegex(G)).join("..")}return Y},QI=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},g$1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=MB0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(Ai,Y.maxLength):Ai,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);let Z={type:"bos",value:"",output:Y.prepend||""},q=[Z],V=Y.capture?"":"?:",K=Li.globChars(Y.windows),W=Li.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:P,QMARK_NO_DOT:I,STAR:T,START_ANCHOR:S}=K,y=(s1)=>{return`(${V}(?:(?!${S}${s1.dot?M:H}).)*?)`},x=Y.dot?"":L,g=Y.dot?P:I,p=Y.bash===!0?y(Y):T;if(Y.capture)p=`(${p})`;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:q};J=vV.removePrefix(J,b),G=J.length;let l=[],J1=[],n=[],u=Z,s,H1=()=>b.index===G-1,W1=b.peek=(s1=1)=>J[b.index+s1],o=b.advance=()=>J[++b.index]||"",r=()=>J.slice(b.index+1),i=(s1="",U1=0)=>{b.consumed+=s1,b.index+=U1},F1=(s1)=>{b.output+=s1.output!=null?s1.output:s1.value,i(s1.value)},y1=()=>{let s1=1;while(W1()==="!"&&(W1(2)!=="("||W1(3)==="?"))o(),b.start++,s1++;if(s1%2===0)return!1;return b.negated=!0,b.start++,!0},t=(s1)=>{b[s1]++,n.push(s1)},f1=(s1)=>{b[s1]--,n.pop()},C1=(s1)=>{if(u.type==="globstar"){let U1=b.braces>0&&(s1.type==="comma"||s1.type==="brace"),Y1=s1.extglob===!0||l.length&&(s1.type==="pipe"||s1.type==="paren");if(s1.type!=="slash"&&s1.type!=="paren"&&!U1&&!Y1)b.output=b.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=p,b.output+=u.output}if(l.length&&s1.type!=="paren")l[l.length-1].inner+=s1.value;if(s1.value||s1.output)F1(s1);if(u&&u.type==="text"&&s1.type==="text"){u.output=(u.output||u.value)+s1.value,u.value+=s1.value;return}s1.prev=u,q.push(s1),u=s1},w0=(s1,U1)=>{let Y1={...W[U1],conditions:1,inner:""};Y1.prev=u,Y1.parens=b.parens,Y1.output=b.output;let O1=(Y.capture?"(":"")+Y1.open;t("parens"),C1({type:s1,value:U1,output:b.output?"":N}),C1({type:"paren",extglob:!0,value:o(),output:O1}),l.push(Y1)},j1=(s1)=>{let U1=s1.close+(Y.capture?")":""),Y1;if(s1.type==="negate"){let O1=p;if(s1.inner&&s1.inner.length>1&&s1.inner.includes("/"))O1=y(Y);if(O1!==p||H1()||/^\)+$/.test(r()))U1=s1.close=`)$))${O1}`;if(s1.inner.includes("*")&&(Y1=r())&&/^\.[^\\/.]+$/.test(Y1)){let w1=g$1(Y1,{...Q,fastpaths:!1}).output;U1=s1.close=`)${w1})${O1})`}if(s1.prev.type==="bos")b.negatedExtglob=!0}C1({type:"paren",extglob:!0,value:s,output:U1}),f1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let s1=!1,U1=J.replace(fZ4,(Y1,O1,w1,I1,E1,d1)=>{if(I1==="\\")return s1=!0,Y1;if(I1==="?"){if(O1)return O1+I1+(E1?P.repeat(E1.length):"");if(d1===0)return g+(E1?P.repeat(E1.length):"");return P.repeat(w1.length)}if(I1===".")return H.repeat(w1.length);if(I1==="*"){if(O1)return O1+I1+(E1?p:"");return p}return O1?Y1:`\\${Y1}`});if(s1===!0)if(Y.unescape===!0)U1=U1.replace(/\\/g,"");else U1=U1.replace(/\\+/g,(Y1)=>{return Y1.length%2===0?"\\\\":Y1?"\\":""});if(U1===J&&Y.contains===!0)return b.output=J,b;return b.output=vV.wrapOutput(U1,b,Q),b}while(!H1()){if(s=o(),s==="\x00")continue;if(s==="\\"){let Y1=W1();if(Y1==="/"&&Y.bash!==!0)continue;if(Y1==="."||Y1===";")continue;if(!Y1){s+="\\",C1({type:"text",value:s});continue}let O1=/^\\+/.exec(r()),w1=0;if(O1&&O1[0].length>2){if(w1=O1[0].length,b.index+=w1,w1%2!==0)s+="\\"}if(Y.unescape===!0)s=o();else s+=o();if(b.brackets===0){C1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||u.value==="["||u.value==="[^")){if(Y.posix!==!1&&s===":"){let Y1=u.value.slice(1);if(Y1.includes("[")){if(u.posix=!0,Y1.includes(":")){let O1=u.value.lastIndexOf("["),w1=u.value.slice(0,O1),I1=u.value.slice(O1+2),E1=xZ4[I1];if(E1){if(u.value=w1+E1,b.backtrack=!0,o(),!Z.output&&q.indexOf(u)===1)Z.output=N;continue}}}}if(s==="["&&W1()!==":"||s==="-"&&W1()==="]")s=`\\${s}`;if(s==="]"&&(u.value==="["||u.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&u.value==="[")s="^";u.value+=s,F1({value:s});continue}if(b.quotes===1&&s!=='"'){s=vV.escapeRegex(s),u.value+=s,F1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)C1({type:"text",value:s});continue}if(s==="("){t("parens"),C1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError(QI("opening","("));let Y1=l[l.length-1];if(Y1&&b.parens===Y1.parens+1){j1(l.pop());continue}C1({type:"paren",value:s,output:b.parens?")":"\\)"}),f1("parens");continue}if(s==="["){if(Y.nobracket===!0||!r().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(QI("closing","]"));s=`\\${s}`}else t("brackets");C1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||u&&u.type==="bracket"&&u.value.length===1){C1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(QI("opening","["));C1({type:"text",value:s,output:`\\${s}`});continue}f1("brackets");let Y1=u.value.slice(1);if(u.posix!==!0&&Y1[0]==="^"&&!Y1.includes("/"))s=`/${s}`;if(u.value+=s,F1({value:s}),Y.literalBrackets===!1||vV.hasRegexChars(Y1))continue;let O1=vV.escapeRegex(u.value);if(b.output=b.output.slice(0,-u.value.length),Y.literalBrackets===!0){b.output+=O1,u.value=O1;continue}u.value=`(${V}${O1}|${u.value})`,b.output+=u.value;continue}if(s==="{"&&Y.nobrace!==!0){t("braces");let Y1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};J1.push(Y1),C1(Y1);continue}if(s==="}"){let Y1=J1[J1.length-1];if(Y.nobrace===!0||!Y1){C1({type:"text",value:s,output:s});continue}let O1=")";if(Y1.dots===!0){let w1=q.slice(),I1=[];for(let E1=w1.length-1;E1>=0;E1--){if(q.pop(),w1[E1].type==="brace")break;if(w1[E1].type!=="dots")I1.unshift(w1[E1].value)}O1=hZ4(I1,Y),b.backtrack=!0}if(Y1.comma!==!0&&Y1.dots!==!0){let w1=b.output.slice(0,Y1.outputIndex),I1=b.tokens.slice(Y1.tokensIndex);Y1.value=Y1.output="\\{",s=O1="\\}",b.output=w1;for(let E1 of I1)b.output+=E1.output||E1.value}C1({type:"brace",value:s,output:O1}),f1("braces"),J1.pop();continue}if(s==="|"){if(l.length>0)l[l.length-1].conditions++;C1({type:"text",value:s});continue}if(s===","){let Y1=s,O1=J1[J1.length-1];if(O1&&n[n.length-1]==="braces")O1.comma=!0,Y1="|";C1({type:"comma",value:s,output:Y1});continue}if(s==="/"){if(u.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",q.pop(),u=Z;continue}C1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&u.type==="dot"){if(u.value===".")u.output=H;let Y1=J1[J1.length-1];u.type="dots",u.output+=s,u.value+=s,Y1.dots=!0;continue}if(b.braces+b.parens===0&&u.type!=="bos"&&u.type!=="slash"){C1({type:"text",value:s,output:H});continue}C1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(u&&u.value==="(")&&Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){w0("qmark",s);continue}if(u&&u.type==="paren"){let O1=W1(),w1=s;if(u.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(r()))w1=`\\${s}`;C1({type:"text",value:s,output:w1});continue}if(Y.dot!==!0&&(u.type==="slash"||u.type==="bos")){C1({type:"qmark",value:s,output:I});continue}C1({type:"qmark",value:s,output:P});continue}if(s==="!"){if(Y.noextglob!==!0&&W1()==="("){if(W1(2)!=="?"||!/[!=<:]/.test(W1(3))){w0("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){y1();continue}}if(s==="+"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){w0("plus",s);continue}if(u&&u.value==="("||Y.regex===!1){C1({type:"plus",value:s,output:z});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||b.parens>0){C1({type:"plus",value:s});continue}C1({type:"plus",value:z});continue}if(s==="@"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){C1({type:"at",extglob:!0,value:s,output:""});continue}C1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let Y1=vZ4.exec(r());if(Y1)s+=Y1[0],b.index+=Y1[0].length;C1({type:"text",value:s});continue}if(u&&(u.type==="globstar"||u.star===!0)){u.type="star",u.star=!0,u.value+=s,u.output=p,b.backtrack=!0,b.globstar=!0,i(s);continue}let s1=r();if(Y.noextglob!==!0&&/^\([^?]/.test(s1)){w0("star",s);continue}if(u.type==="star"){if(Y.noglobstar===!0){i(s);continue}let Y1=u.prev,O1=Y1.prev,w1=Y1.type==="slash"||Y1.type==="bos",I1=O1&&(O1.type==="star"||O1.type==="globstar");if(Y.bash===!0&&(!w1||s1[0]&&s1[0]!=="/")){C1({type:"star",value:s,output:""});continue}let E1=b.braces>0&&(Y1.type==="comma"||Y1.type==="brace"),d1=l.length&&(Y1.type==="pipe"||Y1.type==="paren");if(!w1&&Y1.type!=="paren"&&!E1&&!d1){C1({type:"star",value:s,output:""});continue}while(s1.slice(0,3)==="/**"){let h1=J[b.index+4];if(h1&&h1!=="/")break;s1=s1.slice(3),i("/**",3)}if(Y1.type==="bos"&&H1()){u.type="globstar",u.value+=s,u.output=y(Y),b.output=u.output,b.globstar=!0,i(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&!I1&&H1()){b.output=b.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=y(Y)+(Y.strictSlashes?")":"|$)"),u.value+=s,b.globstar=!0,b.output+=Y1.output+u.output,i(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&s1[0]==="/"){let h1=s1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=`${y(Y)}${U}|${U}${h1})`,u.value+=s,b.output+=Y1.output+u.output,b.globstar=!0,i(s+o()),C1({type:"slash",value:"/",output:""});continue}if(Y1.type==="bos"&&s1[0]==="/"){u.type="globstar",u.value+=s,u.output=`(?:^|${U}|${y(Y)}${U})`,b.output=u.output,b.globstar=!0,i(s+o()),C1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-u.output.length),u.type="globstar",u.output=y(Y),u.value+=s,b.output+=u.output,b.globstar=!0,i(s);continue}let U1={type:"star",value:s,output:p};if(Y.bash===!0){if(U1.output=".*?",u.type==="bos"||u.type==="slash")U1.output=x+U1.output;C1(U1);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&Y.regex===!0){U1.output=s,C1(U1);continue}if(b.index===b.start||u.type==="slash"||u.type==="dot"){if(u.type==="dot")b.output+=A,u.output+=A;else if(Y.dot===!0)b.output+=E,u.output+=E;else b.output+=x,u.output+=x;if(W1()!=="*")b.output+=N,u.output+=N}C1(U1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(QI("closing","]"));b.output=vV.escapeLast(b.output,"["),f1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(QI("closing",")"));b.output=vV.escapeLast(b.output,"("),f1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(QI("closing","}"));b.output=vV.escapeLast(b.output,"{"),f1("braces")}if(Y.strictSlashes!==!0&&(u.type==="star"||u.type==="bracket"))C1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let s1 of b.tokens)if(b.output+=s1.output!=null?s1.output:s1.value,s1.suffix)b.output+=s1.suffix}return b};g$1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(Ai,Y.maxLength):Ai,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=MB0[J]||J;let{DOT_LITERAL:Z,SLASH_LITERAL:q,ONE_CHAR:V,DOTS_SLASH:K,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:N}=Li.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?z:W,A=Y.capture?"":"?:",E={negated:!1,prefix:""},P=Y.bash===!0?".*?":U;if(Y.capture)P=`(${P})`;let I=(x)=>{if(x.noglobstar===!0)return P;return`(${A}(?:(?!${N}${x.dot?K:Z}).)*?)`},T=(x)=>{switch(x){case"*":return`${M}${V}${P}`;case".*":return`${Z}${V}${P}`;case"*.*":return`${M}${P}${Z}${V}${P}`;case"*/*":return`${M}${P}${q}${V}${L}${P}`;case"**":return M+I(Y);case"**/*":return`(?:${M}${I(Y)}${q})?${L}${V}${P}`;case"**/*.*":return`(?:${M}${I(Y)}${q})?${L}${P}${Z}${V}${P}`;case"**/.*":return`(?:${M}${I(Y)}${q})?${Z}${V}${P}`;default:{let g=/^(.*?)\.(\w+)$/.exec(x);if(!g)return;let p=T(g[1]);if(!p)return;return p+Z+g[2]}}},S=vV.removePrefix(J,E),y=T(S);if(y&&Y.strictSlashes!==!0)y+=`${q}?`;return y};LB0.exports=g$1});var hk=f((_d8,wB0)=>{var bZ4=DB0(),m$1=AB0(),OB0=vk(),gZ4=xk(),mZ4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),U2=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>U2(U,Q,Y));return(U)=>{for(let N of H){let M=N(U);if(M)return M}return!1}}let X=mZ4(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!X)throw TypeError("Expected pattern to be a non-empty string");let G=Q||{},Z=G.windows,q=X?U2.compileRe(J,Q):U2.makeRe(J,Q,!1,!0),V=q.state;delete q.state;let K=()=>!1;if(G.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};K=U2(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:N,output:M}=U2.test(H,q,Q,{glob:J,posix:Z}),L={glob:J,state:V,regex:q,posix:Z,input:H,output:M,match:N,isMatch:U};if(typeof G.onResult==="function")G.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof G.onMatch==="function")G.onMatch(L);return z?L:!0};if(Y)W.state=V;return W};U2.test=(J,Q,Y,{glob:X,posix:G}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let Z=Y||{},q=Z.format||(G?OB0.toPosixSlashes:null),V=J===X,K=V&&q?q(J):J;if(V===!1)K=q?q(J):J,V=K===X;if(V===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)V=U2.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};U2.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:U2.makeRe(Q,Y)).test(OB0.basename(J))};U2.isMatch=(J,Q,Y)=>U2(Q,Y)(J);U2.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>U2.parse(Y,Q));return m$1(J,{...Q,fastpaths:!1})};U2.scan=(J,Q)=>bZ4(J,Q);U2.compileRe=(J,Q,Y=!1,X=!1)=>{if(Y===!0)return J.output;let G=Q||{},Z=G.contains?"":"^",q=G.contains?"":"$",V=`${Z}(?:${J.output})${q}`;if(J&&J.negated===!0)V=`^(?!${V}).*$`;let K=U2.toRegex(V,Q);if(X===!0)K.state=J;return K};U2.makeRe=(J,Q={},Y=!1,X=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let G={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))G.output=m$1.fastpaths(J,Q);if(!G.output)G=m$1(J,Q);return U2.compileRe(G,Q,Y,X)};U2.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/$^/}};U2.constants=gZ4;wB0.exports=U2});var wM=f((kd8,PB0)=>{var EB0=hk(),uZ4=vk();function IB0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:uZ4.isWindows()};return EB0(J,Q,Y)}Object.assign(IB0,EB0);PB0.exports=IB0});var YI;var u$1=N1(()=>{YI={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","start:dev:debugger":"pnpm run -s build:dev:desktop && pnpm run -s ./src/autoedit/webview dev","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 && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger' 'pnpm run -s _build:web' 'pnpm run -s _build:tab:review'","build:production":"pnpm run -s _build:extension:production && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production' 'pnpm run -s _build:tab:review: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:debugger":"pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:debugger:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:tab:review":"pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","_build:tab:review:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","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 at Sourcegraph",email:"amp-devs@sourcegraph.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.setPromptFromRecentActions",title:"Create Prompt from Recent Actions",category:"Amp"},{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.toggleCostDisplay",title:"Toggle Cost Display",category:"Amp"},{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"},{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.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{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.toggleCostDisplay",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.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{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.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !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.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.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"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.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"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.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",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"}}},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":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"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:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3"},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 dZ4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function TB0(J){let Q=J.settings["tools.inactivityTimeout"],Y=J.settings["tools.stopTimeout"],X=Q;if(X===void 0&&Y!==void 0)X=Y;if(X===void 0)X=YI.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!dZ4(X))return null;return X*1000}function CB0(J){let Q=J.settings["tools.stopTimeout"],Y=YI.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var RB0;var Oi=N1(()=>{u$1();RB0=YI.contributes.configuration.properties});function qJ(J){let Q=V9[J];return`${Q.provider}/${Q.name}`}function iG(J){let[Q,Y]=J.split("/");for(let X of Object.values(V9))if(X.provider===Q&&X.name===Y)return X;switch(Q){case"anthropic":return V9.CLAUDE_SONNET_4_5;case"openai":return V9.GPT_5;case"xai":return V9.GROK_CODE_FAST_1;case"cerebras":return V9.Z_AI_GLM_4_6;case"fireworks":return V9.FIREWORKS_GLM_4P6;case"moonshotai":return V9.KIMI_K2_INSTRUCT;case"openrouter":return V9.SONOMA_SKY_ALPHA;case"groq":return V9.GPT_OSS_120B;case"vertexai":return V9.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Q}`)}}function nG(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function rW(J,Q){let Y=iG(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}var j9,V9,p$1;var x$=N1(()=>{j9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},V9={CLAUDE_SONNET_4:{provider:j9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:j9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:j9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:j9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:j9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:j9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:j9.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:j9.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_CODEX:{provider:j9.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:j9.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:j9.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:j9.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:j9.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:j9.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:j9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:j9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:j9.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:j9.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:j9.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},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:j9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:j9.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},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:j9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:j9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:j9.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:j9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:j9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:j9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0}},KIMI_K2_INSTRUCT:{provider:j9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:j9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:j9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:j9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:j9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:j9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};p$1={FINDER:"finder"}});function d$1(J,Q){let Y=fV(Q);if(!Y)return!1;if(cZ4.has(J)){let X=Y.finder??p$1.FINDER,G=lZ4[X];if(J!==G)return!1}if(Y.includeTools)return Y.includeTools.includes(J);return!0}function aG(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(XI).filter((X)=>{if(Y.includes(`!${X.key}`))return!1;if(Q===!1&&R5(X.key))return!1;let Z="visible"in X?X.visible:!1,q=Y.includes(X.key),V=X.key==="plan"&&J?.["experimental.planMode"]===!0,K=J?.["experimental.dojoMode"]===!0;if(X.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(X.key==="dojo")return K&&(Q===!1||Q===void 0);return Z||q||V}).map((X)=>({mode:X.key,description:"description"in X?X.description:void 0})).sort((X,G)=>X.mode.localeCompare(G.mode))}function fV(J){return Object.values(XI).find((Q)=>Q.key===J)}function bk(J){return fV(J)?.primaryModel??qJ("CLAUDE_SONNET_4_5")}function gk(J){let Q=fV(J);if(!Q)return!1;return iG(Q.primaryModel).capabilities?.vision??!1}function R5(J){return J==="free"||J.startsWith("free-")}function c$1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function wi(J,Q){let X=(Q.findIndex((Z)=>Z.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var cZ4,lZ4,SB0,_B0,iZ4,nZ4,jB0,aZ4,oZ4,XI,rZ4;var v$=N1(()=>{x$();cZ4=new Set(["finder"]),lZ4={finder:"finder"},SB0={r:0,g:55,b:0},_B0={r:0,g:255,b:136},iZ4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","find_thread","skill"],nZ4=["Read","Grep","glob","finder","Bash","InteractiveShell","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"],jB0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],aZ4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","web_search","read_web_page"],oZ4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at","edit_plan","read_plan","code_review"],XI={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:qJ("CLAUDE_OPUS_4_5"),includeTools:oZ4,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:qJ("CLAUDE_HAIKU_4_5"),includeTools:iZ4,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:qJ("CLAUDE_HAIKU_4_5"),includeTools:nZ4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:qJ("GPT_5_1_CODEX"),includeTools:aZ4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:qJ("CLAUDE_HAIKU_4_5"),includeTools:jB0,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:qJ("CLAUDE_SONNET_4_5"),includeTools:jB0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},rZ4=Object.values(XI).map((J)=>J.key)});function Ei(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let X="subagentType"in Q?Q.subagentType:void 0;if(X&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(X)}return!0}return Q.includeTools.includes(J)}var sZ4,tZ4,l$1,eZ4,J$4,Q$4,Y$4,X$4,g2,md8;var sW=N1(()=>{x$();sZ4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],tZ4=["Grep","glob","Read"],l$1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],eZ4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],J$4=["Read","glob","Grep","enqueue_file_edit","fastmod"],Q$4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],Y$4=["describe_workbook","execute_query"],X$4=["Read","Grep","glob","web_search","read_web_page","Bash"],g2={finder:{key:"finder",displayName:"Finder",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:tZ4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:qJ("GPT_5_1"),includeTools:l$1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:sZ4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:eZ4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:J$4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:Q$4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:qJ("CLAUDE_HAIKU_4_5"),includeTools:Y$4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:qJ("CLAUDE_SONNET_4_5"),includeTools:X$4,allowMcp:!1,allowToolbox:!1}},md8=Object.keys(g2)});function kB0(J,Q){return new X0((Y)=>{let X=setTimeout(G,Q);function G(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function Z(){if(X)clearTimeout(X);X=setTimeout(G,Q)}let q=J.subscribe({next:(V)=>{Z(),Y.next(V)},error:(V)=>{if(X)clearTimeout(X),X=null;Y.error(V)},complete:()=>{if(X)clearTimeout(X),X=null;Y.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var yB0=N1(()=>{a0()});function p7(J,Q){let Y={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},X=Q.modelCustomizations;if(X){for(let G of X)if(G.modelSelector.test(J))Y={...Y,name:G.name??Y.name,description:G.description??Y.description,inputSchema:G.inputSchema??Y.inputSchema,customizedForModel:!0}}return Y}function B2(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function fB0(J){return["done","error","cancelled"].includes(J.status)}function i$1(J){return typeof J==="object"&&"key"in J}function Ii(J){let Q=[],Y=new i4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0){let W=q.toLowerCase();K=Q.filter((H)=>H.spec.name.toLowerCase()===W)}for(let W of K)if(ZI(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return h.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let N={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))Q[W]=N;else Q.push(N);return Y.next(),{dispose:()=>{let L=Q.indexOf(N);if(L!==-1)Q.splice(L,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return G$4;return Z(q,V,K)},tools:p8(J.configService.config,Y.pipe(d8(void 0))).pipe(q6(([q])=>{return Q.map((V)=>({spec:V.spec,...ZI(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>Z$4.record(performance.now()-W,{toolName:q});if(q===a$1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){GI.add(1,{toolName:q,error:"invalid"});let N=n$1(V.args.invalid_tool_name);return new X0((M)=>{M.error(Error(N))})}let z=G(q,K.config);if(!z){let N=q.toLowerCase(),M=Q.filter((P)=>P.spec.name.toLowerCase()===N);if(M.length===0)return GI.add(1,{toolName:q,error:"not_found"}),new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} not found`))});let L=M[0],A=ZI(L.spec,K.config);GI.add(1,{toolName:q,error:"disabled"});let E=A.enabled?"unknown":A.disabledReason;return new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} is disabled: ${E}`))})}let U=K.subagentSpec??K.agentMode;if(U&&!this.isToolAllowed(q,U)){GI.add(1,{toolName:q,error:"disabled"});let N=i$1(U)?U.displayName??U.key:`${U} mode`;return new X0((M)=>{M.error(Error(`tool ${JSON.stringify(q)} is not allowed for ${N}`))})}if(K.thread.mainThreadID&&!K.subagentSpec&&!Ei(q,g2["task-subagent"]))return GI.add(1,{toolName:q,error:"disabled"}),new X0((N)=>{N.error(Error(`tool ${JSON.stringify(q)} is not allowed for subagents`))});return GI.add(1,{toolName:q}),r6(()=>z.fn).pipe(f4((N)=>{let M=N(V,K);if(z.spec.meta?.disableTimeout)return M;return kB0(M,CB0(K.config))}),R$(()=>H()))},preprocessArgs(q,V,K){let W=G(q,K.config);if(!W||!W.preprocessArgs)return;let H=W.preprocessArgs;try{return H(V,K)}catch(z){h.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},isToolAllowed(q,V){let K=Q.find((H)=>H.spec.name===q),W=K?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(i$1(V))return Ei(q,V,K?.spec.meta);return d$1(q,V)},getTools(q){return p8(J.configService.config,Y.pipe(d8(void 0))).pipe(q6(([V])=>{return Q.filter((K)=>{let W=K.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(i$1(q))return Ei(K.spec.name,q,K.spec.meta);return d$1(K.spec.name,q)}).map((K)=>({spec:K.spec,...ZI(K.spec,V)})).sort((K,W)=>K.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(q,V){if(V)return this.getTools(g2["task-subagent"]);return this.getTools(q)},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function mk(J,Q){for(let Y of Q){if(Y==="")continue;if(Y.length===1){if(Y==="*")return!0;if(Y===J)return!0;continue}if(J===Y)return!0;if(Y.includes("*")||Y.includes("?")||Y.includes("[")||Y.includes("{"))try{if(vB0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function ZI(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(mk(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=$$4(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(mk(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(mk(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&mk(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&mk(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===V7||J.name===xV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function n$1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${uk.toString()}. Try again with a valid tool name.`}function $$4(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function o$1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var xB0,vB0,G$4,a$1="invalid_tool",uk,hB0,GI,Z$4;var d7=N1(()=>{a0();L0();Oi();v$();sW();yB0();B4();xB0=B6(h6(),1),vB0=B6(wM(),1);G$4={dispose(){}};uk=/^[-a-zA-Z0-9_]{1,64}$/,hB0=xB0.metrics.getMeter("tool_service"),GI=hB0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),Z$4=hB0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var dB0=f((uB0)=>{Object.defineProperty(uB0,"__esModule",{value:!0});uB0.calcSlices=uB0.applyPatch=uB0.calcPatch=uB0.lcs=uB0.diff=uB0.diff_core=void 0;function q$4(J,Q){let{b:Y,eq:X,stack_base:G}=J,{i:Z,N:q,j:V,M:K,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(q>0&&K>0){Y.fill(0,0,2*W);let z=q-K,U=q+K,N=U&1,M=Z+q-1,L=V+K-1,A=(U+N)/2,E;Q:for(let P=0;P<=A;P++){let I=2*Math.max(0,P-K)-P,T=P-2*Math.max(0,P-q);for(let S=I;S<=T;S+=2){let y=Y[S-1-W*Math.floor((S-1)/W)],x=Y[S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,l=p;while(b<q&&l<K&&X(Z+b,V+l))b++,l++;if(Y[S-W*Math.floor(S/W)]=b,N===1&&(E=z-S)>=1-P&&E<P&&b+Y[W+E-W*Math.floor(E/W)]>=q)if(P>1||b!==g){G[H++]=Z+b,G[H++]=q-b,G[H++]=V+l,G[H++]=K-l,q=g,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let S=I;S<=T;S+=2){let y=Y[W+S-1-W*Math.floor((S-1)/W)],x=Y[W+S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,l=p;while(b<q&&l<K&&X(M-b,L-l))b++,l++;if(Y[W+S-W*Math.floor(S/W)]=b,N===0&&(E=z-S)>=-P&&E<=P&&b+Y[E-W*Math.floor(E/W)]>=q)if(P>0||b!==g){G[H++]=Z+q-g,G[H++]=g,G[H++]=V+K-p,G[H++]=p,q=q-b,K=K-l,W=2*(Math.min(q,K)+1);continue J}else break Q}}if(q===K)continue;if(K>q)Z+=q,V+=q,K-=q,q=0;else Z+=K,V+=K,q-=K,K=0;break}if(q+K!==0)if(J.pxe===Z||J.pye===V)J.pxe=Z+q,J.pye=V+K;else{let z=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=Z,J.pxe=Z+q,J.pys=V,J.pye=V+K,z>=0)return J.i=Z,J.N=q,J.j=V,J.M=K,J.Z=W,J.stack_top=H,1}}case 1:{if(H===0)return 2;K=G[--H],V=G[--H],q=G[--H],Z=G[--H],W=2*(Math.min(q,K)+1),Q=0}}}class bB0{constructor(J){this.state=J,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:J,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let Y=q$4(J,this.c);if(this.c=Y,Y===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function gB0(J,Q,Y,X,G){let Z=(Math.min(Q,X)+1)*2,q=Q+X,V=new(q<256?Uint8Array:q<65536?Uint16Array:Uint32Array)(2*Z);return new bB0({i:J,N:Q,j:Y,M:X,Z,b:V,eq:G,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}uB0.diff_core=gB0;function Pi(J,Q,Y){let[X,G,Z]=[0,J.length,Q.length];if(typeof Y==="function"){while(X<G&&X<Z&&Y(X,X))X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(Y(--G,--Z)&&G>X&&Z>X);}else{while(X<G&&X<Z&&J[X]===Q[X])X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(J[--G]===Q[--Z]&&G>X&&Z>X);Y=(q,V)=>J[q]===Q[V]}return gB0(X,G+1-X,X,Z+1-X,Y)}uB0.diff=Pi;class mB0{constructor(J,Q){this.diff=J,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let J=this.diff.next();if(J.done){let{i:V,j:K,N:W}=this;if(V<W)J.done=!1,J.value=[V,K,W-V],this.i=W;return J}let Q=J.value,Y=Q[0],X=Q[1],G=Q[3],{i:Z,j:q}=this;if(Z!==Y)Q.length--,Q[0]=Z,Q[1]=q,Q[2]=Y-Z;return this.i=X,this.j=G,J}}function V$4(J,Q,Y){return new mB0(Pi(J,Q,Y),J.length)}uB0.lcs=V$4;function*K$4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of Pi(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}uB0.calcPatch=K$4;function*W$4(J,Q){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,Z,q]of Q){if(Y<G)yield X.call(J,Y,G);if(q.length>0)yield q;Y=Z}if(Y<J.length)yield X.call(J,Y)}uB0.applyPatch=W$4;function*H$4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of Pi(J,Q,Y)){if(X<Z)yield[0,G.call(J,X,Z)];if(Z<q)yield[-1,G.call(J,Z,q)];if(V<K)yield[1,G.call(Q,V,K)];X=q}if(X<J.length)yield[0,J.slice(X)]}uB0.calcSlices=H$4});function $I(J,Q){let Y={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Y;if(J===Q)return Y;try{let X={added:0,deleted:0,changed:0};for(let[G,Z,q,V]of cB0.diff(J.split(`
49
49
  `),Q.split(`
50
50
  `)))X.deleted+=Z-G,X.added+=V-q,X.changed+=Math.min(Z-G,V-q);return X}catch{return Y}}function lB0(J){if(typeof J!=="string")return{added:0,deleted:0,changed:0};return{added:J.split(`
51
51
  `).length,deleted:0,changed:0}}function r$1(J){if(!J)return{totalFiles:0,createdFiles:0,totalAdded:0,totalRemoved:0,totalModified:0,revertedFiles:0,allReverted:!1};let Q=J.files.length,Y=J.files.filter((K)=>K.created).length,X=J.files.filter((K)=>K.reverted).length,G=X===Q&&Q>0,Z=0,q=0,V=0;for(let K of J.files){if(K.reverted)continue;Z+=K.diffStat.added,q+=K.diffStat.removed,V+=K.diffStat.modified}return{totalFiles:Q,createdFiles:Y,totalAdded:Z,totalRemoved:q,totalModified:V,revertedFiles:X,allReverted:G}}var cB0;var pk=N1(()=>{cB0=B6(dB0(),1)});function f$(){return`T-${crypto.randomUUID()}`}function h$(J){if(!J.startsWith("T-"))return!1;let Q=J.slice(2);return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(Q)}function EM(){return`toolu_${crypto.randomUUID()}`}function qI(J,Q,Y=EM()){return{type:"tool_use",complete:!0,id:Y,name:J,input:Q}}function m2(J){if("complete"in J)return J.complete;return!("inputPartialJSON"in J)}function iB0(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="info"){let X=Y.content[0];if(X?.type==="summary"&&X?.summary.type==="message")return}if(Y?.role==="assistant"&&Y.usage){if(Y.usage.totalInputTokens===0)continue;return Y.usage}}return J["~debug"]?.lastInferenceUsage}function LX(J,Q){for(let Y of J.messages){if(Y.role!=="assistant")continue;for(let X of Y.content)if(X.type==="tool_use"&&X.id===Q)return X}return}function VI(J,Q){for(let[Y,X]of J.messages.entries()){if(X.role!=="assistant")continue;for(let[G,Z]of X.content.entries())if(Z.type==="tool_use"&&Z.id===Q)return{message:X,messageIndex:Y,block:Z,blockIndex:G}}return null}function tW(J,Q){for(let Y of J.messages){if(Y.role!=="user")continue;for(let X of Y.content)if(X.type==="tool_result"&&X.toolUseID===Q)return X}return}function JQ(J){return J.messages.filter((Q)=>Q.role==="user").flatMap((Q)=>Q.content).filter((Q)=>Q.type==="tool_result").reduce((Q,Y)=>{return Q.set(Y.toolUseID,Y),Q},new Map)}function s$1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&h$(Q))return Q}return}function t$1(J){let Q=[],Y=new Map;for(let X of J)if(X.role==="assistant"){for(let G of X.content)if(G.type==="tool_use"&&G.name===$J)Y.set(G.id,G)}else if(X.role==="user"){for(let G of X.content)if(G.type==="tool_result"){let Z=Y.get(G.toolUseID);if(Z){let q=G.run,V=(q.status==="in-progress"||q.status==="cancelled"||q.status==="done"||q.status==="error")&&q.progress?s$1(q.progress):void 0;if(V)Q.push({toolUseID:G.toolUseID,threadID:V,toolUse:Z,toolResult:G})}}}return Q}function nB0(J,Q="Untitled"){if(J.title)return Zi(J.title,300);return Q}function aB0(J){if(!J)return!1;if(J.role==="assistant")return J.state?.type==="cancelled";if(J.role==="user")return J.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="cancelled");return!1}function oB0(J){if(!J)return!1;if(J.role==="user")return J.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="rejected-by-user");return!1}function e$1(J){if(!J)return!1;return J.role==="info"}function KI(J){return J.role==="info"&&J.content.some((Q)=>Q.type==="manual_bash_invocation")}function Ri(J){if(J.role!=="info")return;return J.content.find((Q)=>Q.type==="manual_bash_invocation")}function D$4(J){return J.replace(/u([0-9A-Fa-f]{4})(\s)/gi,(Q,Y,X)=>{try{return String.fromCodePoint(parseInt(Y,16))+X}catch{return`u${Y}${X}`}})}function WI(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="info"){if(Y.content.some((G)=>G.type==="summary"&&G.summary.type==="message"))break}if(Y?.role!=="assistant"||!Y.state||Y.state.type!=="complete"||Y.state.stopReason!=="tool_use")continue;for(let X of Y.content)if(X.type==="tool_use"&&X.name===V7&&X.input){let G=X.input.todos;if(Array.isArray(G))return G;let Z=X.input.content;if(typeof Z==="string")return D$4(Z)}}return}function u2(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
@@ -4157,15 +4157,15 @@ Actual: ${G}`)}async function RV8(J,Q,Y){let{execSync:X}=await import("node:ch
4157
4157
  ${N}`;if(G==="pnpm"&&N.includes("Unable to find the global bin directory"))M+=`
4158
4158
 
4159
4159
  Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
4160
- npm install -g @sourcegraph/amp`;V(Error(M))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}L0();L0();async function H41(J,Q){let X=Q||"https://registry.npmjs.org";try{let G=new AbortController,Z=setTimeout(()=>G.abort(),5000),q=await fetch(`${X}/@sourcegraph/amp`,{signal:G.signal});if(clearTimeout(Z),!q.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let V=await q.json(),K=V["dist-tags"]?.latest;if(!K)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=_V8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],M=V.time[K],L=Date.now();if(N)z=Math.floor((L-new Date(N).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return h.info("NPM version comparison",{currentVersion:J,latestVersion:K,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:K,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(G){return h.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function _V8(J,Q){let Y=(q)=>{let[V,K]=q.split("-");return{parts:V?.split(".").map(Number)||[],label:K}},X=Y(J),G=Y(Q),Z=Math.max(X.parts.length,G.parts.length);for(let q=0;q<Z;q++){let V=X.parts[q]||0,K=G.parts[q]||0;if(V<K)return-1;if(V>K)return 1}if(X.label===G.label)return 0;if(!X.label&&G.label)return 1;if(X.label&&!G.label)return-1;if(X.label&&G.label)return X.label<G.label?-1:1;return 0}a0();function z41(J,Q){let Y=new i4,X=Y.pipe(o8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new CV().scoped("update"),Z=X.subscribe({next:(q)=>{G.debug("emit new state",q)}});try{let q=process.env.AMP_TEST_UPDATE_STATUS;if(q){G.debug("using fake update status for testing",{status:q}),await cU(500),Y.next(q);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){G.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let V=await Q.get("updates.mode");if(V==="disabled"){G.debug("checking disabled");return}G.debug("checking",{currentVersion:J,mode:V});let K=YO(),W=await H41(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await W41();if(!V)V=z==="pnpm"?"warn":"auto",G.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:V});if(V==="warn"){if(!H())Y.next("update-available");return}if(!z){if(G.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}try{await rg(W.latestVersion,z);let U=await JN(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await cU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as uK}from"node:process";function j56(J){let Q=new pA().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(X)=>{await EC1(X.force||!1,X.verbose||!1,"0.0.1764417684-g51a9e4"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new pA("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(X)=>{await kV8(X.targetVersion)});J.addCommand(Y)}async function kV8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")uK.write(h4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
4160
+ npm install -g @sourcegraph/amp`;V(Error(M))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}L0();L0();async function H41(J,Q){let X=Q||"https://registry.npmjs.org";try{let G=new AbortController,Z=setTimeout(()=>G.abort(),5000),q=await fetch(`${X}/@sourcegraph/amp`,{signal:G.signal});if(clearTimeout(Z),!q.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let V=await q.json(),K=V["dist-tags"]?.latest;if(!K)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=_V8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],M=V.time[K],L=Date.now();if(N)z=Math.floor((L-new Date(N).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return h.info("NPM version comparison",{currentVersion:J,latestVersion:K,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:K,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(G){return h.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function _V8(J,Q){let Y=(q)=>{let[V,K]=q.split("-");return{parts:V?.split(".").map(Number)||[],label:K}},X=Y(J),G=Y(Q),Z=Math.max(X.parts.length,G.parts.length);for(let q=0;q<Z;q++){let V=X.parts[q]||0,K=G.parts[q]||0;if(V<K)return-1;if(V>K)return 1}if(X.label===G.label)return 0;if(!X.label&&G.label)return 1;if(X.label&&!G.label)return-1;if(X.label&&G.label)return X.label<G.label?-1:1;return 0}a0();function z41(J,Q){let Y=new i4,X=Y.pipe(o8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new CV().scoped("update"),Z=X.subscribe({next:(q)=>{G.debug("emit new state",q)}});try{let q=process.env.AMP_TEST_UPDATE_STATUS;if(q){G.debug("using fake update status for testing",{status:q}),await cU(500),Y.next(q);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){G.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let V=await Q.get("updates.mode");if(V==="disabled"){G.debug("checking disabled");return}G.debug("checking",{currentVersion:J,mode:V});let K=YO(),W=await H41(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await W41();if(!V)V=z==="pnpm"?"warn":"auto",G.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:V});if(V==="warn"){if(!H())Y.next("update-available");return}if(!z){if(G.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}try{await rg(W.latestVersion,z);let U=await JN(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await cU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as uK}from"node:process";function j56(J){let Q=new pA().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(X)=>{await EC1(X.force||!1,X.verbose||!1,"0.0.1764446481-g6c75f9"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new pA("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(X)=>{await kV8(X.targetVersion)});J.addCommand(Y)}async function kV8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")uK.write(h4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
4161
4161
 
4162
4162
  `));try{if(!J){uK.write(h4.blue(`Checking for updates...
4163
- `));let X=YO(),{hasUpdate:G,latestVersion:Z}=await H41("0.0.1764417684-g51a9e4",X);if(!G){uK.write(h4.green(`✓ Amp CLI is already up to date: ${"0.0.1764417684-g51a9e4"} (${"released"} ${"2025-11-29T12:06:44.365Z"})
4164
- `));let V=await JN("0.0.1764417684-g51a9e4");if(V.warning)uK.write(`
4163
+ `));let X=YO(),{hasUpdate:G,latestVersion:Z}=await H41("0.0.1764446481-g6c75f9",X);if(!G){uK.write(h4.green(`✓ Amp CLI is already up to date: ${"0.0.1764446481-g6c75f9"} (${"released"} ${"2025-11-29T20:06:46.719Z"})
4164
+ `));let V=await JN("0.0.1764446481-g6c75f9");if(V.warning)uK.write(`
4165
4165
  `+h4.yellow(V.warning)+`
4166
4166
  `);process.exit(0)}if(!Z)uK.write(h4.yellow("[WARN] could not find latest version")),process.exit(0);J=Z}uK.write(h4.blue(`Updating to version ${J}...
4167
4167
  `)),await rg(J,void 0,(X)=>{uK.write(h4.dim(`Running: ${X}
4168
- `))});let Q="released";uK.write(h4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-11-29T12:06:44.365Z"})
4168
+ `))});let Q="released";uK.write(h4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-11-29T20:06:46.719Z"})
4169
4169
  `));let Y=await JN(J);if(Y.warning)uK.write(`
4170
4170
  `+h4.yellow(Y.warning)+`
4171
4171
  `);process.exit(0)}catch(Q){let Y=Q instanceof Error?Q.message:String(Q);uK.write(h4.red.bold("Error: ")+Y+`
@@ -4781,7 +4781,7 @@ exit code: ${Z}`,new q1({color:X.foreground,dim:!0,italic:!0})));if(q)V.push(new
4781
4781
  `,N),...M])})];if(W.url){let S=W.url.replace(/^https?:\/\//,"");I.push(new Y7({uri:W.url,text:S,style:new q1({color:Y.secondary,underline:!0})}))}let T=new F0({width:40,child:new o0({crossAxisAlignment:"start",mainAxisSize:"min",children:I})});return F8.child(new s6({mainAxisAlignment:"center",crossAxisAlignment:"center",mainAxisSize:"min",children:[new pj1({width:GX6,height:ZX6,agentMode:this.widget.agentMode,glow:this._glow,t:L,fps:0,shockwaves:this._shockwaves,onShockwave:E,...q==="disabled"&&{seed:42}}),new F0({width:2}),T]}))}}L0();K9();B4();d7();K9();a0();function oM8(J,Q){return`${J}:${Q}`}class Lk1{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 X0((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.subthreadObservable=new X0((Q)=>{return this.emitSubthread=(Y)=>Q.next(Y),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new X0((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(IM()).subscribe((Z)=>{this.threadsMap.set(Q,Z);let q=this.subthreadsMap.get(Q)||[],V=this.workers.get(Q)||{state:"initial"};if(this.emitMainThread)this.emitMainThread({threadID:Q,mainThread:Z,subthreads:q,workerStatus:V})});this.mainThreadSubs.set(Q,Y);let X=J.status.subscribe((Z)=>{if(this.workers.set(Q,Z),this.emitWorkerStatus)this.emitWorkerStatus({threadID:Q,status:Z})});this.workerStatusSubs.set(Q,X);let G=J.subthreads.subscribe((Z)=>{this.subthreadsMap.set(Q,Z);for(let q of Z){let V=oM8(Q,q.toolUse.id);if(this.subthreadPatchSubs.has(V))continue;let K=this.threadService.observePatches(q.threadID).pipe(IM()).subscribe((W)=>{if(this.emitSubthread)this.emitSubthread({threadID:Q,thread:W,subthread:q})});this.subthreadPatchSubs.set(V,K)}});this.subthreadsSubs.set(Q,G)}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 X=this.subthreadsSubs.get(J);if(X)X.unsubscribe(),this.subthreadsSubs.delete(J);for(let[G,Z]of this.subthreadPatchSubs.entries())if(G.startsWith(`${J}:`))Z.unsubscribe(),this.subthreadPatchSubs.delete(G);this.workers.delete(J),this.threadsMap.delete(J),this.subthreadsMap.delete(J)}observeThread(J){return{mainThread:new X0((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),subthreads:new X0((Q)=>{return this.subthreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new X0((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 X=this.workers.get(Q);if(X)J[Q]=LA(Y,X)}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 rM8(J,Q){switch(Q.type){case"subthread-patch":{let{thread:Y,subthread:X}=Q,G=J.subagents[X.threadID];if(!G){if(G={subThreadID:Y.id,parentToolID:X.toolUse.id,taskDescription:X.toolUse.input.description||"Task",isCompleted:!1,agentState:{type:"idle"}},J.mainThread){let W=JQ(J.mainThread);G.isCompleted=qX6(W,X.toolUse.id)}}let Z=sM8(Y,G.agentState),q=G.agentState===Z?G:{...G,agentState:Z},V={...J.tools},K=pC(Y).items.filter((W)=>W.type==="toolResult");for(let W of K)V[W.id]={id:W.id,subthreadID:Y.id,toolRun:W.toolResult.run,toolUse:W.toolUse};return{subagents:{...J.subagents,[X.threadID]:q},tools:V,items:J.items,viewState:J.viewState,todosList:J.todosList,mainThread:J.mainThread}}case"main-thread-patch":{let{thread:Y,subthreads:X,workerStatus:G}=Q,Z=JQ(Y),q={...J.subagents};for(let z of X){let U=q[z.threadID];if(!U)continue;let N=qX6(Z,z.toolUse.id);q[z.threadID]={...U,isCompleted:N}}let{items:V}=pC(Y),K=LA(Y,G),W=WI({messages:Y.messages}),H=Array.isArray(W)?W:[];return{...J,subagents:q,items:V,viewState:K,todosList:H,mainThread:Y}}case"worker-status-change":{if(!J.mainThread)return J;let Y=LA(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function pC(J){let Q=[],Y=new Map,X=new Set;for(let[G,Z]of J.messages.entries()){let q=`${Z.role}-${G}`;switch(Z.role){case"assistant":{let V=Z.state.type==="streaming";for(let W of Z.content)if(W.type==="tool_use"){if(Y.set(W.id,W),V)X.add(W.id)}if(Z.content.some((W)=>W.type==="text"&&W.text.trim()||W.type==="thinking"))Q.push({type:"message",id:q,message:Z});for(let W of Z.content)if(W.type==="tool_use"){let H=!1;for(let z=G+1;z<J.messages.length;z++){let U=J.messages[z];if(U){for(let N of U.content)if(N.type==="tool_result"&&N.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:V?"in-progress":"queued"}}})}break}case"info":Q.push({type:"message",id:q,message:Z});break;case"user":{let V=Z.content.some((K)=>K.type==="text"&&K.text.trim()||K.type==="image");for(let K of Z.content)if(K.type==="tool_result"){let W=Y.get(K.toolUseID)??LX(J,K.toolUseID);if(!W)throw Error(`(bug) tool use ${K.toolUseID} not found`);Q.push({type:"toolResult",id:K.toolUseID,toolUse:W,toolResult:K})}if(V)Q.push({type:"message",id:q,message:Z});break}}}return{items:Q}}function qX6(J,Q){let Y=J.get(Q);return(Y&&B2(Y.run))??!1}function sM8(J,Q){let Y=J.messages.at(-1);if(Y?.content.some((G)=>G.type==="tool_result"&&G.run.status==="blocked-on-user"))return h.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(pC(J).items.some((G)=>G.type==="toolResult"&&G.toolResult.run.status==="in-progress")){let G=Q?.type==="running-tools"?Q.startTime:Date.now();return h.info("Subagent status: running-tools",{threadID:J.id,startTime:G,hasStartTime:!!G}),{type:"running-tools",startTime:G}}if(Y&&Y.role==="assistant"&&Y.state.type==="streaming")switch(Y.content.at(-1)?.type){case"text":return h.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return h.info("Subagent status: streaming-thinking",{threadID:J.id}),{type:"streaming-thinking"};case"tool_use":{let Z=Q?.type==="running-tools"?Q.startTime:Date.now();return h.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:Z,hasStartTime:!!Z}),{type:"running-tools",startTime:Z}}default:return h.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return h.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class Ak1 extends X6{props;constructor(J){super();this.props=J}createState(){return new VX6}}class VX6 extends Q6{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 Lk1(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((Z)=>{this.dispatch({type:"main-thread-patch",thread:Z.mainThread,subthreads:Z.subthreads,workerStatus:Z.workerStatus})});this.subscriptions.push(Y);let X=Q.subthreads.subscribe((Z)=>{this.dispatch({type:"subthread-patch",thread:Z.thread,subthread:Z.subthread})});this.subscriptions.push(X);let G=Q.workerStatus.subscribe((Z)=>{this.dispatch({type:"worker-status-change",workerStatus:Z.status})});this.subscriptions.push(G)}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=rM8(this.state,J)})}getThreadData(){let J=Object.values(this.state.tools).map((Z)=>({toolUse:Z.toolUse,toolRun:Z.toolRun,subthreadID:Z.subthreadID})),Q={};for(let Z of Object.values(this.state.subagents)){let q=J.filter((V)=>V.subthreadID===Z.subThreadID);Q[Z.parentToolID]=q}let Y=(Z)=>Z===s5||Z===q9||Z===MX,X=new Map;for(let Z of this.state.items)if(Z.type==="toolResult"&&Y(Z.toolUse.name))X.set(Z.toolUse.id,{toolUseId:Z.toolUse.id,toolName:Z.toolUse.name,toolRun:Z.toolResult.run});let G=Array.from(X.values());for(let{toolUseId:Z,toolRun:q}of G){let V=[],K;if(q.status==="in-progress"||q.status==="done"||q.status==="error"||q.status==="cancelled")K=q.progress;if(K){let W=0;for(let H of K)if(H.tool_uses)for(let z of H.tool_uses){let U=`${Z}:progress:${W++}`;V.push({toolUse:qI(z.tool_name,z.input,U),toolRun:{status:z.status}})}}Q[Z]=V}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 Ok1 extends X6{props;constructor(J){super({key:J.key});this.props=J}createState(){return new KX6}}class KX6 extends Q6{build(J){let Y=L6.of(J).colors,{todos:X,title:G="TODOs"}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new F0({width:0,height:0});let Z=X.map((q)=>this.buildTodoItem(q,Y));return new Y6({child:new p6({padding:_0.symmetric(1,0),child:new o0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new m1({text:new e(G,new q1({bold:!0,color:Y.foreground}))}),...Z]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),X=J.status==="completed",G=new q1({bold:J.status==="in-progress",color:Q.foreground,dim:X}),Z=new q1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:X});return new s6({crossAxisAlignment:"start",children:[new m1({text:new e(Y,G)}),new F0({width:1}),new N4({child:new m1({text:new e(J.content,Z)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class wk1 extends w6{ad;onDismiss;onButtonClick;constructor({key:J,ad:Q,onDismiss:Y,onButtonClick:X}){super({key:J});this.ad=Q,this.onDismiss=Y,this.onButtonClick=X}build(J){let Q=L6.of(J),Y=Q.colors.primary,X=Q.colors.foreground;return new Y6({decoration:new z8(void 0,new b4(new w4(Y,1,"rounded"),new w4(Y,1,"rounded"),void 0,new w4(Y,1,"rounded"))),child:new p6({padding:_0.horizontal(1),child:new o0({children:[new s6({crossAxisAlignment:"start",children:[new N4({child:new m1({text:new e(this.ad.content,new q1({color:X}))})}),new F0({width:4}),new Y7({uri:"https://ampcode.com/free",text:"Ad",style:new q1({color:X,dim:!0})})]}),new s6({crossAxisAlignment:"start",children:[new JS1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:_0.horizontal(1),color:Y,reverse:!0}),new F0({width:2}),new m1({text:new e(this.ad.destinationUrlHostname,new q1({color:X,dim:!0}))})]})]})})})}}class Ek1 extends X6{props;constructor(J){super();this.props=J}createState(){return new WX6(this.props.autofocus??!0)}}class WX6 extends Q6{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(V)=>{if(V.key==="Enter"&&this.widget.props.showCopyOption)return this.widget.props.onSelect("copy"),"handled";if(V.ctrlKey&&V.key==="c"||V.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"},Y=H8.sizeOf(J),X=Math.min(60,Y.width-4),G=Y.height-4,Z=[];if(this.widget.props.title)Z.push(new m1({text:new e(this.widget.props.title,new q1({bold:!0,color:A1.blue}))}),new F0({height:1}));if(this.widget.props.message)Z.push(new m1({text:new e(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)Z.push(new F0({height:1}));let q=[];if(this.widget.props.showCopyOption)q.push(new m1({text:new e("Enter to copy",new q1({dim:!0}))}));return q.push(new m1({text:new e("Escape to close",new q1({dim:!0}))})),Z.push(new s6({children:q.flatMap((V,K)=>K<q.length-1?[V,new F0({width:1}),new m1({text:new e("•",new q1({dim:!0}))}),new F0({width:1})]:[V]),mainAxisSize:"min"})),new F8({child:new Y6({constraints:new i6(X,X,0,G),decoration:new z8(A1.default(),new b4(new w4(A1.blue,1,"rounded"),new w4(A1.blue,1,"rounded"),new w4(A1.blue,1,"rounded"),new w4(A1.blue,1,"rounded"))),padding:new _0(2,2,2,2),child:new Y9({autofocus:this.autofocus,onKey:Q,child:new o0({children:Z,mainAxisSize:"min"})})})})}}class C91 extends Error{constructor(J="Command timed out"){super(J);this.name="CommandTimeoutError",Object.setPrototypeOf(this,C91.prototype)}}class j91 extends Error{constructor(J){let Q=`${J.noun}: ${J.verb} command cancelled`;super(Q);this.name="CommandCancelledError",Object.setPrototypeOf(this,j91.prototype)}}function Ik1(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})}UU();L0();import{spawn as tM8}from"node:child_process";import{promises as eM8}from"node:fs";function HX6(J){return J.kind==="executable"}function zX6(J){return J.kind==="markdown"}var _z=50000,FX6=300000;async function Pk1(J,Q,Y,X={}){let{timeoutMs:G=FX6,signal:Z,source:q}=X;try{let V=await Y.getCommand(J,q);if(!V)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Y.isCommandAvailable(J,q))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(h.debug("Executing command",{commandName:J,filePath:V.filePath,args:Q}),zX6(V))return await JL8(V,Q);else if(HX6(V))return await QL8(V,Q,G,Z);else return{success:!1,output:"",error:"Unsupported command type"}}catch(V){return h.error("Failed to execute command",{commandName:J,error:V}),{success:!1,output:"",error:V instanceof Error?V.message:"Unknown error occurred"}}}async function JL8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await eM8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>_z?Y.slice(0,_z)+`
4782
4782
  ... (output truncated at ${_z} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function QL8(J,Q,Y=FX6,X){return new Promise((G)=>{let[Z,q]=YL8(J,Q);h.debug("Spawning command",{spawnCommand:Z,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Y});let V=dw0(X),K=!1,W=setTimeout(()=>{K=!0,V.abort(),h.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=tM8(Z,q,{stdio:["pipe","pipe","pipe"],signal:V.signal,detached:!0}),z=[],U=[],N=0;H.stdout?.on("data",(M)=>{let L=M.toString();if(N+=L.length,N<=_z)z.push(L);else{let A=_z-(N-L.length);if(A>0)z.push(L.slice(0,A))}}),H.stderr?.on("data",(M)=>{let L=M.toString();if(N+=L.length,N<=_z)U.push(L);else{let A=_z-(N-L.length);if(A>0)U.push(L.slice(0,A))}}),H.on("close",(M)=>{if(clearTimeout(W),K){G({success:!1,output:z.join(""),error:`Command timed out after ${Y}ms`,exitCode:void 0});return}if(V.signal.aborted){G({success:!1,output:z.join(""),error:"The command was aborted",exitCode:M??void 0});return}let L=M===0||M===1,A=z.join(""),E=U.join(""),P=A;if(!L&&!A.trim()&&E.trim())P=E;else if(E.trim())P+=A?`
4783
4783
  ${E}`:E;if(N>_z)P+=`
4784
- ... (output truncated at ${_z} characters)`;G({success:L,output:P.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(K)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";G({success:!1,output:z.join(""),error:L})})})}function YL8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return GL8(Y,X?[...X]:null,G,Q);else return XL8(Y,X?[...X]:null,G,Q)}function XL8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function GL8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}L0();v$();x3();oW();kX();o$();zH();_H();K9();d7();Vk();a0();var jX6=B6(gP(),1);import{writeFile as RX6}from"fs/promises";import TX6 from"path";L0();kX();class Rk1{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.1764417684-g51a9e4"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await Ro(Q,this.configService)}catch(Q){h.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 Tk1 extends X6{props;constructor(J){super();this.props=J}createState(){return new UX6}}class UX6 extends Q6{_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 BX6 extends Q6{controller=new uZ;focusNode=new l8({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=L6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=b4.all(new w4(Y.foreground,1,"solid")),K=new BO({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let M=N.trim();if(G&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new s6({children:[new Y6({decoration:{color:A1.default()},child:new m1({text:new e(">",new q1({color:Y.foreground}))})}),new N4({child:K})]}),H=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e("",void 0,[new e("Command: ",new q1({color:Y.foreground})),new e(this.widget.props.commandName,new q1({color:A1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new e("Enter",new q1({color:X.keybind}))),z.push(new e(" to submit, ",new q1({color:Y.foreground,dim:!0})));z.push(new e("Esc",new q1({color:X.keybind}))),z.push(new e(" to cancel",new q1({color:Y.foreground,dim:!0})));let U=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e("",void 0,z)})});return new Y6({decoration:{border:V,color:A1.default()},padding:_0.all(1),child:new o0({children:[H,new F0({height:1}),W,new n5,U]})})}}class S91 extends X6{props;constructor(J){super();this.props=J}createState(){return new BX6}}zH();class NX6 extends Q6{controller=new uZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new l8({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>=BU)return!1;let Q=TC(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=L6.of(J),{colors:Y,app:X}=Q,Z=H8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new CO({controller:this.controller,triggers:[new LN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:I9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new Y9({focusNode:this.focusNode,child:V}),W=new Y6({constraints:new i6({maxHeight:q}),padding:_0.symmetric(1,0),child:K}),H=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e("",void 0,[new e("Command: ",new q1({color:Y.foreground})),new e(this.widget.props.commandName,new q1({color:A1.yellow,bold:!0}))])})}),z=new Y6({padding:_0.symmetric(1,0),child:new m1({text:this.isConfirmingClearInput?new e("",void 0,[new e("Esc",new q1({color:X.keybind})),new e(" again to clear input",new q1({color:Y.foreground,dim:!0}))]):new e("",void 0,[new e("Press ",new q1({color:Y.foreground,dim:!0})),new e("Enter",new q1({color:X.keybind})),new e(" to submit, ",new q1({color:Y.foreground,dim:!0})),new e("Esc",new q1({color:X.keybind})),new e(" to clear",new q1({color:Y.foreground,dim:!0}))])})}),U=[H,new F0({height:1}),new N4({child:W}),new F0({height:1}),z];return new Y6({decoration:{border:b4.all(new w4(Y.foreground,1,"solid")),color:A1.default()},padding:_0.all(1),child:new o0({children:U})})}}class dC extends X6{props;constructor(J){super();this.props=J}createState(){return new NX6}}import{isDeepStrictEqual as VL8}from"node:util";var ZL8=/[\\/_ +.#"@[({&]/,$L8=/[\\/_ +.#"@[({&]/g,qL8=/[\s-]/,DX6=/[\s-]/g;function k91(J,Q,Y,X,G,Z,q){if(Z===Q.length){if(G===J.length)return 1;return 0.99}let V=`${G},${Z}`;if(q[V]!==void 0)return q[V];let K=X.charAt(Z),W=Y.indexOf(K,G),H=0,z,U,N,M;while(W>=0){if(z=k91(J,Q,Y,X,W+1,Z+1,q),z>H){if(W===G)z*=1;else if(qL8.test(J.charAt(W-1))){if(z*=0.9,M=J.slice(G,W-1).match(DX6),M&&G>0)z*=Math.pow(0.999,M.length)}else if(ZL8.test(J.charAt(W-1))){if(z*=0.8,N=J.slice(G,W-1).match($L8),N&&G>0)z*=Math.pow(0.999,N.length)}else if(z*=0.3,G>0)z*=Math.pow(0.999,W-G);if(J.charAt(W)!==Q.charAt(Z))z*=0.9999}if(z<0.1&&(Y.charAt(W-1)===X.charAt(Z+1)||X.charAt(Z+1)===X.charAt(Z)&&Y.charAt(W-1)!==X.charAt(Z))){if(U=k91(J,Q,Y,X,W+1,Z+2,q),U*0.1>z)z=U*0.1}if(z>H)H=z;W=Y.indexOf(K,W+1)}return q[V]=H,H}function _91(J){return J.toLowerCase().replace(DX6," ")}function MX6(J,Q){let Y=k91(J,Q,_91(J),_91(Q),0,0,{}),X=Q.trim().split(/\s+/);if(X.length>1){let G=0,Z=0;for(let V of X){let K=k91(J,V,_91(J),_91(V),0,0,{});if(K===0)return Y;G+=K,Z+=V.length}let q=G/X.length*0.95;return Math.max(Y,q)}return Y}class cC{}class lC{}class y91{}class x91{}class LX6 extends X6{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new AX6}}class AX6 extends Q6{build(J){return this.widget.onContext(J),this.widget.child}}function KL8(J,Q){if(J==="")return{matches:!0,score:1};let Y=MX6(Q,J);return{matches:Y>0.15,score:Y}}class fq extends X6{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new OX6}}class OX6 extends Q6{controller=new uZ;focusNode;scrollController=new i3;selectedIndex=0;itemContexts=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new l8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),J9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!VL8(J.props.items,this.widget.props.items)){this.ensureSelectedItemVisible();let Q=this.getFilteredItems();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 cC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof lC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof y91){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 x91)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items.filter((Y)=>!this.widget.props.filterItem||this.widget.props.filterItem(Y,J)).map((Y)=>({item:Y,...KL8(J,this.widget.props.getLabel(Y))})).filter((Y)=>Y.matches).sort(this.widget.props.sortItems?(Y,X)=>this.widget.props.sortItems(Y,X,J):(Y,X)=>X.score-Y.score).map((Y)=>Y.item);if(this.widget.props.maxRenderItems)return Q.slice(0,this.widget.props.maxRenderItems);return Q}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,X=Q.size.height;_81(J,{top:Y,bottom:X},{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(),J9.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 X=Y[J],G=X?this.widget.props.isItemDisabled?.(X)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Y[this.selectedIndex]??null);else if(Q===2&&!G){if(X)this.widget.props.onAccept(X)}}};build(J){let Q=L6.of(J),{colors:Y}=Q,X=this.getFilteredItems(),G=b4.all(new w4(Y.foreground,1,"solid")),Z=this.widget.props.enabled??!0,q=new BO({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:Z,style:{textColor:Y.foreground,border:null},maxLines:1}),V=new kq({shortcuts:new Map([[new U4("ArrowDown"),new cC],[new U4("ArrowUp"),new lC],[new U4("Tab"),new cC],[new U4("Tab",{shift:!0}),new lC],[new U4("n",{ctrl:!0}),new cC],[new U4("p",{ctrl:!0}),new lC],[new U4("Enter"),new y91],[new U4("Escape"),new x91]]),focusNode:this.focusNode,child:q}),K=new aQ({actions:new Map([[cC,new Q9(this.invoke)],[lC,new Q9(this.invoke)],[y91,new Q9(this.invoke)],[x91,new Q9(this.invoke)]]),child:V}),W=new s6({children:[new Y6({decoration:{color:A1.default()},child:new m1({text:new e(">",new q1({color:Y.foreground}))})}),new N4({child:K})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new F0({height:10,child:new F8({child:new m1({text:new e(L,new q1({color:Y.foreground}))})})})}else if(X.length===0&&this.widget.props.emptyStateText)H=new N4({child:new F8({child:new m1({text:new e(this.widget.props.emptyStateText,new q1({color:Y.foreground,dim:!0}))})})});else{let L=X.map((A,E)=>{let P=E===this.selectedIndex,I=this.widget.props.isItemDisabled?.(A)??!1,T;if(this.widget.props.renderItem)T=this.widget.props.renderItem(A,P,I,J);else{let S=P?A1.yellow:void 0,y=P?A1.black:Y.foreground;T=new Y6({decoration:S?{color:S}:void 0,padding:_0.symmetric(2,0),child:new m1({text:new e(this.widget.props.getLabel(A),new q1({color:y,dim:I}))})})}return new LX6(new T8({onClick:(S)=>this.handleItemClick(E,S.clickCount),child:T}),(S)=>{this.itemContexts[E]=S})});H=new o0({children:L,crossAxisAlignment:"start"})}let z=new N4({child:new T8({onScroll:this.handleScroll,opaque:!1,child:new R2({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e(this.widget.props.title,new q1({color:A1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new F0({height:1}),z),this.controller.text!==""){let L=X.length>0?X[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new Y6({padding:_0.vertical(1),child:new F8({child:A})}));else U.push(new F0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new Y6({decoration:{border:G,color:A1.default()},padding:_0.symmetric(1,0),child:new o0({children:U})})}}class Ck1 extends X6{createState(){return new wX6}}class wX6 extends Q6{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 m1({text:new e("●",new q1({color:this.isGreen?A1.green:A1.index(8),bold:!0})),maxLines:1})}}function WL8(J){let Q=new Map,Y=new Map,X=new Map,G=[];for(let q of J)Q.set(q.id,q);for(let q of J){let V=q.parentRelationships.find((K)=>K.role==="child"&&Q.has(K.threadID));if(V){X.set(q.id,V.type);let K=V.threadID,W=Y.get(K)||[];W.push(q),Y.set(K,W)}else G.push(q)}return KG.flatten(G,(q)=>Y.get(q.id)).map((q)=>({...q.item,depth:q.depth,isLast:q.isLast,ancestorsAreLast:q.ancestorsAreLast,relationshipType:X.get(q.item.id)}))}function jk1(J,Q,Y){return new m1({text:new e(`${J}${Q}`,new q1({color:Y})),maxLines:1})}function HL8(J,Q,Y,X){return[jk1("+",J,X.success),n5.horizontal(1),jk1("~",Q,X.warning),n5.horizontal(1),jk1("-",Y,X.destructive)]}class v91 extends w6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((H)=>H.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((H)=>H.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],X=this.props.currentThreadID,G=[...Q].sort((H,z)=>{if(X){if(H.id===X)return-1;if(z.id===X)return 1}let U=Y.indexOf(H.id),N=Y.indexOf(z.id);if(U!==-1&&N!==-1)return U-N;if(U!==-1)return-1;if(N!==-1)return 1;return 0}),Z=WL8(G),q=Math.max(0,...Z.map((H)=>H.description.timeAgo.length)),V=L6.of(J),K=new p6({padding:_0.symmetric(0,1),child:new F8({child:new m1({text:new e("",new q1({color:V.colors.foreground,dim:!0}),[new e("Ctrl+T",new q1({color:A1.blue,dim:!0})),new e(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new q1({color:V.colors.foreground,dim:!0}))])})})});return new fq({items:Z,getLabel:(H)=>H.title,onAccept:(H)=>this.props.onSelect?.(H.id),onDismiss:this.props.onDismiss,onSelectionChange:(H)=>{if(this.props.previewController){if(H)this.props.previewController.select(H.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:1000,footer:this.props.isLoading?void 0:K,renderItem:(H,z,U,N)=>{let M=L6.of(N),{colors:L}=M,A=z?A1.yellow:void 0,E=z?A1.black:L.foreground,P=A1.index(8),I=(J1,n)=>new F0({width:n,child:s6.end([new m1({text:new e(J1,new q1({color:P}))})])}),T=this.props.threadViewStates[H.id],S=[],y=H.relationshipType==="handoff",x=new b81;if(H.depth>0){let J1=[],n=H.ancestorsAreLast.slice(1);for(let H1 of n)J1.push(new e(x.getAncestorPrefix(H1),new q1({color:x.connectorColor,dim:x.connectorDim})));let u=H.isLast?x.elbow:x.tee,s=x.getConnectorText(u);J1.push(new e(s,new q1({color:x.connectorColor,dim:x.connectorDim}))),S.push(new m1({text:new e("",void 0,J1)}))}let g=[],p=this.props.currentThreadID===H.id?new e("(current) ",new q1({color:A1.green})):(this.props.recentThreadIDs||[]).includes(H.id)?new e("(visited) ",new q1({color:L.foreground,dim:!0})):null;if(p)g.push(new m1({text:p}));if(T){if(T.state==="active"&&(T.interactionState==="tool-running"||T.interactionState===!1))g.push(new Ck1),g.push(new F0({width:1}))}let b=H.title;if(H.relationshipType==="fork"){let J1=b.match(/^Forked\((\d+)\): /);if(J1)b=b.slice(J1[0].length);else while(b.startsWith("Forked: "))b=b.slice(8);g.push(new m1({text:new e("[fork] ",new q1({color:A1.blue}))}))}else if(y)g.push(new m1({text:new e("[handoff] ",new q1({color:A1.index(208)}))}));if(g.push(new N4({child:new m1({text:new e(b,new q1({color:E})),overflow:"ellipsis",maxLines:1})})),g.push(new F0({width:2})),H.diffStats&&(H.diffStats.added>0||H.diffStats.changed>0||H.diffStats.deleted>0)){let J1=z?{success:P,warning:P,destructive:P}:L;g.push(...HL8(H.diffStats.added,H.diffStats.changed,H.diffStats.deleted,J1)),g.push(new F0({width:2}))}return g.push(I(H.description.timeAgo,q)),new Y6({decoration:A?{color:A}:void 0,padding:_0.symmetric(2,0),child:new s6({children:[...S,...g]})})}})}}function EX6(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/60000),G=Math.floor(Y/3600000),Z=Math.floor(Y/86400000);if(X<1)return"just now";if(X<60)return`${X}m ago`;if(G<24)return`${G}h ago`;if(Z<7)return`${Z}d ago`;return J.toLocaleDateString()}class Sk1 extends w6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((G,Z)=>Z.pubDate.getTime()-G.pubDate.getTime()),Y=Math.max(0,...Q.map((G)=>EX6(G.pubDate).length));return new fq({items:Q,getLabel:(G)=>G.title,onAccept:(G)=>this.props.onSelect?.(G),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(G,Z,q,V)=>{let K=L6.of(V),{colors:W}=K,H=Z?A1.yellow:void 0,z=Z?A1.black:W.foreground,U=A1.index(8),N=G.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new F0({width:A,child:s6.end([new m1({text:new e(L,new q1({color:U}))})])});return new Y6({decoration:H?{color:H}:void 0,padding:_0.symmetric(2,0),child:new s6({children:[new N4({child:new m1({text:new e(G.title,new q1({color:z})),overflow:"ellipsis",maxLines:1})}),new F0({width:2}),new m1({text:new e(N,new q1({color:U})),maxLines:1}),new F0({width:2}),M(EX6(G.pubDate),Y)]})})}})}}class _k1 extends w6{props;constructor(J){super();this.props=J}build(){return new F8({child:new m1({text:new e("",void 0,[new e(`Forked to new thread:
4784
+ ... (output truncated at ${_z} characters)`;G({success:L,output:P.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(K)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";G({success:!1,output:z.join(""),error:L})})})}function YL8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return GL8(Y,X?[...X]:null,G,Q);else return XL8(Y,X?[...X]:null,G,Q)}function XL8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function GL8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}L0();v$();x3();oW();kX();o$();zH();_H();K9();d7();Vk();a0();var jX6=B6(gP(),1);import{writeFile as RX6}from"fs/promises";import TX6 from"path";L0();kX();class Rk1{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.1764446481-g6c75f9"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await Ro(Q,this.configService)}catch(Q){h.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 Tk1 extends X6{props;constructor(J){super();this.props=J}createState(){return new UX6}}class UX6 extends Q6{_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 BX6 extends Q6{controller=new uZ;focusNode=new l8({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=L6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=b4.all(new w4(Y.foreground,1,"solid")),K=new BO({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let M=N.trim();if(G&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new s6({children:[new Y6({decoration:{color:A1.default()},child:new m1({text:new e(">",new q1({color:Y.foreground}))})}),new N4({child:K})]}),H=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e("",void 0,[new e("Command: ",new q1({color:Y.foreground})),new e(this.widget.props.commandName,new q1({color:A1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new e("Enter",new q1({color:X.keybind}))),z.push(new e(" to submit, ",new q1({color:Y.foreground,dim:!0})));z.push(new e("Esc",new q1({color:X.keybind}))),z.push(new e(" to cancel",new q1({color:Y.foreground,dim:!0})));let U=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e("",void 0,z)})});return new Y6({decoration:{border:V,color:A1.default()},padding:_0.all(1),child:new o0({children:[H,new F0({height:1}),W,new n5,U]})})}}class S91 extends X6{props;constructor(J){super();this.props=J}createState(){return new BX6}}zH();class NX6 extends Q6{controller=new uZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new l8({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>=BU)return!1;let Q=TC(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=L6.of(J),{colors:Y,app:X}=Q,Z=H8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new CO({controller:this.controller,triggers:[new LN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:I9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new Y9({focusNode:this.focusNode,child:V}),W=new Y6({constraints:new i6({maxHeight:q}),padding:_0.symmetric(1,0),child:K}),H=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e("",void 0,[new e("Command: ",new q1({color:Y.foreground})),new e(this.widget.props.commandName,new q1({color:A1.yellow,bold:!0}))])})}),z=new Y6({padding:_0.symmetric(1,0),child:new m1({text:this.isConfirmingClearInput?new e("",void 0,[new e("Esc",new q1({color:X.keybind})),new e(" again to clear input",new q1({color:Y.foreground,dim:!0}))]):new e("",void 0,[new e("Press ",new q1({color:Y.foreground,dim:!0})),new e("Enter",new q1({color:X.keybind})),new e(" to submit, ",new q1({color:Y.foreground,dim:!0})),new e("Esc",new q1({color:X.keybind})),new e(" to clear",new q1({color:Y.foreground,dim:!0}))])})}),U=[H,new F0({height:1}),new N4({child:W}),new F0({height:1}),z];return new Y6({decoration:{border:b4.all(new w4(Y.foreground,1,"solid")),color:A1.default()},padding:_0.all(1),child:new o0({children:U})})}}class dC extends X6{props;constructor(J){super();this.props=J}createState(){return new NX6}}import{isDeepStrictEqual as VL8}from"node:util";var ZL8=/[\\/_ +.#"@[({&]/,$L8=/[\\/_ +.#"@[({&]/g,qL8=/[\s-]/,DX6=/[\s-]/g;function k91(J,Q,Y,X,G,Z,q){if(Z===Q.length){if(G===J.length)return 1;return 0.99}let V=`${G},${Z}`;if(q[V]!==void 0)return q[V];let K=X.charAt(Z),W=Y.indexOf(K,G),H=0,z,U,N,M;while(W>=0){if(z=k91(J,Q,Y,X,W+1,Z+1,q),z>H){if(W===G)z*=1;else if(qL8.test(J.charAt(W-1))){if(z*=0.9,M=J.slice(G,W-1).match(DX6),M&&G>0)z*=Math.pow(0.999,M.length)}else if(ZL8.test(J.charAt(W-1))){if(z*=0.8,N=J.slice(G,W-1).match($L8),N&&G>0)z*=Math.pow(0.999,N.length)}else if(z*=0.3,G>0)z*=Math.pow(0.999,W-G);if(J.charAt(W)!==Q.charAt(Z))z*=0.9999}if(z<0.1&&(Y.charAt(W-1)===X.charAt(Z+1)||X.charAt(Z+1)===X.charAt(Z)&&Y.charAt(W-1)!==X.charAt(Z))){if(U=k91(J,Q,Y,X,W+1,Z+2,q),U*0.1>z)z=U*0.1}if(z>H)H=z;W=Y.indexOf(K,W+1)}return q[V]=H,H}function _91(J){return J.toLowerCase().replace(DX6," ")}function MX6(J,Q){let Y=k91(J,Q,_91(J),_91(Q),0,0,{}),X=Q.trim().split(/\s+/);if(X.length>1){let G=0,Z=0;for(let V of X){let K=k91(J,V,_91(J),_91(V),0,0,{});if(K===0)return Y;G+=K,Z+=V.length}let q=G/X.length*0.95;return Math.max(Y,q)}return Y}class cC{}class lC{}class y91{}class x91{}class LX6 extends X6{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new AX6}}class AX6 extends Q6{build(J){return this.widget.onContext(J),this.widget.child}}function KL8(J,Q){if(J==="")return{matches:!0,score:1};let Y=MX6(Q,J);return{matches:Y>0.15,score:Y}}class fq extends X6{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new OX6}}class OX6 extends Q6{controller=new uZ;focusNode;scrollController=new i3;selectedIndex=0;itemContexts=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new l8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),J9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!VL8(J.props.items,this.widget.props.items)){this.ensureSelectedItemVisible();let Q=this.getFilteredItems();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 cC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof lC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof y91){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 x91)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items.filter((Y)=>!this.widget.props.filterItem||this.widget.props.filterItem(Y,J)).map((Y)=>({item:Y,...KL8(J,this.widget.props.getLabel(Y))})).filter((Y)=>Y.matches).sort(this.widget.props.sortItems?(Y,X)=>this.widget.props.sortItems(Y,X,J):(Y,X)=>X.score-Y.score).map((Y)=>Y.item);if(this.widget.props.maxRenderItems)return Q.slice(0,this.widget.props.maxRenderItems);return Q}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,X=Q.size.height;_81(J,{top:Y,bottom:X},{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(),J9.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 X=Y[J],G=X?this.widget.props.isItemDisabled?.(X)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Y[this.selectedIndex]??null);else if(Q===2&&!G){if(X)this.widget.props.onAccept(X)}}};build(J){let Q=L6.of(J),{colors:Y}=Q,X=this.getFilteredItems(),G=b4.all(new w4(Y.foreground,1,"solid")),Z=this.widget.props.enabled??!0,q=new BO({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:Z,style:{textColor:Y.foreground,border:null},maxLines:1}),V=new kq({shortcuts:new Map([[new U4("ArrowDown"),new cC],[new U4("ArrowUp"),new lC],[new U4("Tab"),new cC],[new U4("Tab",{shift:!0}),new lC],[new U4("n",{ctrl:!0}),new cC],[new U4("p",{ctrl:!0}),new lC],[new U4("Enter"),new y91],[new U4("Escape"),new x91]]),focusNode:this.focusNode,child:q}),K=new aQ({actions:new Map([[cC,new Q9(this.invoke)],[lC,new Q9(this.invoke)],[y91,new Q9(this.invoke)],[x91,new Q9(this.invoke)]]),child:V}),W=new s6({children:[new Y6({decoration:{color:A1.default()},child:new m1({text:new e(">",new q1({color:Y.foreground}))})}),new N4({child:K})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new F0({height:10,child:new F8({child:new m1({text:new e(L,new q1({color:Y.foreground}))})})})}else if(X.length===0&&this.widget.props.emptyStateText)H=new N4({child:new F8({child:new m1({text:new e(this.widget.props.emptyStateText,new q1({color:Y.foreground,dim:!0}))})})});else{let L=X.map((A,E)=>{let P=E===this.selectedIndex,I=this.widget.props.isItemDisabled?.(A)??!1,T;if(this.widget.props.renderItem)T=this.widget.props.renderItem(A,P,I,J);else{let S=P?A1.yellow:void 0,y=P?A1.black:Y.foreground;T=new Y6({decoration:S?{color:S}:void 0,padding:_0.symmetric(2,0),child:new m1({text:new e(this.widget.props.getLabel(A),new q1({color:y,dim:I}))})})}return new LX6(new T8({onClick:(S)=>this.handleItemClick(E,S.clickCount),child:T}),(S)=>{this.itemContexts[E]=S})});H=new o0({children:L,crossAxisAlignment:"start"})}let z=new N4({child:new T8({onScroll:this.handleScroll,opaque:!1,child:new R2({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e(this.widget.props.title,new q1({color:A1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new F0({height:1}),z),this.controller.text!==""){let L=X.length>0?X[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new Y6({padding:_0.vertical(1),child:new F8({child:A})}));else U.push(new F0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new Y6({decoration:{border:G,color:A1.default()},padding:_0.symmetric(1,0),child:new o0({children:U})})}}class Ck1 extends X6{createState(){return new wX6}}class wX6 extends Q6{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 m1({text:new e("●",new q1({color:this.isGreen?A1.green:A1.index(8),bold:!0})),maxLines:1})}}function WL8(J){let Q=new Map,Y=new Map,X=new Map,G=[];for(let q of J)Q.set(q.id,q);for(let q of J){let V=q.parentRelationships.find((K)=>K.role==="child"&&Q.has(K.threadID));if(V){X.set(q.id,V.type);let K=V.threadID,W=Y.get(K)||[];W.push(q),Y.set(K,W)}else G.push(q)}return KG.flatten(G,(q)=>Y.get(q.id)).map((q)=>({...q.item,depth:q.depth,isLast:q.isLast,ancestorsAreLast:q.ancestorsAreLast,relationshipType:X.get(q.item.id)}))}function jk1(J,Q,Y){return new m1({text:new e(`${J}${Q}`,new q1({color:Y})),maxLines:1})}function HL8(J,Q,Y,X){return[jk1("+",J,X.success),n5.horizontal(1),jk1("~",Q,X.warning),n5.horizontal(1),jk1("-",Y,X.destructive)]}class v91 extends w6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((H)=>H.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((H)=>H.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],X=this.props.currentThreadID,G=[...Q].sort((H,z)=>{if(X){if(H.id===X)return-1;if(z.id===X)return 1}let U=Y.indexOf(H.id),N=Y.indexOf(z.id);if(U!==-1&&N!==-1)return U-N;if(U!==-1)return-1;if(N!==-1)return 1;return 0}),Z=WL8(G),q=Math.max(0,...Z.map((H)=>H.description.timeAgo.length)),V=L6.of(J),K=new p6({padding:_0.symmetric(0,1),child:new F8({child:new m1({text:new e("",new q1({color:V.colors.foreground,dim:!0}),[new e("Ctrl+T",new q1({color:A1.blue,dim:!0})),new e(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new q1({color:V.colors.foreground,dim:!0}))])})})});return new fq({items:Z,getLabel:(H)=>H.title,onAccept:(H)=>this.props.onSelect?.(H.id),onDismiss:this.props.onDismiss,onSelectionChange:(H)=>{if(this.props.previewController){if(H)this.props.previewController.select(H.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:1000,footer:this.props.isLoading?void 0:K,renderItem:(H,z,U,N)=>{let M=L6.of(N),{colors:L}=M,A=z?A1.yellow:void 0,E=z?A1.black:L.foreground,P=A1.index(8),I=(J1,n)=>new F0({width:n,child:s6.end([new m1({text:new e(J1,new q1({color:P}))})])}),T=this.props.threadViewStates[H.id],S=[],y=H.relationshipType==="handoff",x=new b81;if(H.depth>0){let J1=[],n=H.ancestorsAreLast.slice(1);for(let H1 of n)J1.push(new e(x.getAncestorPrefix(H1),new q1({color:x.connectorColor,dim:x.connectorDim})));let u=H.isLast?x.elbow:x.tee,s=x.getConnectorText(u);J1.push(new e(s,new q1({color:x.connectorColor,dim:x.connectorDim}))),S.push(new m1({text:new e("",void 0,J1)}))}let g=[],p=this.props.currentThreadID===H.id?new e("(current) ",new q1({color:A1.green})):(this.props.recentThreadIDs||[]).includes(H.id)?new e("(visited) ",new q1({color:L.foreground,dim:!0})):null;if(p)g.push(new m1({text:p}));if(T){if(T.state==="active"&&(T.interactionState==="tool-running"||T.interactionState===!1))g.push(new Ck1),g.push(new F0({width:1}))}let b=H.title;if(H.relationshipType==="fork"){let J1=b.match(/^Forked\((\d+)\): /);if(J1)b=b.slice(J1[0].length);else while(b.startsWith("Forked: "))b=b.slice(8);g.push(new m1({text:new e("[fork] ",new q1({color:A1.blue}))}))}else if(y)g.push(new m1({text:new e("[handoff] ",new q1({color:A1.index(208)}))}));if(g.push(new N4({child:new m1({text:new e(b,new q1({color:E})),overflow:"ellipsis",maxLines:1})})),g.push(new F0({width:2})),H.diffStats&&(H.diffStats.added>0||H.diffStats.changed>0||H.diffStats.deleted>0)){let J1=z?{success:P,warning:P,destructive:P}:L;g.push(...HL8(H.diffStats.added,H.diffStats.changed,H.diffStats.deleted,J1)),g.push(new F0({width:2}))}return g.push(I(H.description.timeAgo,q)),new Y6({decoration:A?{color:A}:void 0,padding:_0.symmetric(2,0),child:new s6({children:[...S,...g]})})}})}}function EX6(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/60000),G=Math.floor(Y/3600000),Z=Math.floor(Y/86400000);if(X<1)return"just now";if(X<60)return`${X}m ago`;if(G<24)return`${G}h ago`;if(Z<7)return`${Z}d ago`;return J.toLocaleDateString()}class Sk1 extends w6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((G,Z)=>Z.pubDate.getTime()-G.pubDate.getTime()),Y=Math.max(0,...Q.map((G)=>EX6(G.pubDate).length));return new fq({items:Q,getLabel:(G)=>G.title,onAccept:(G)=>this.props.onSelect?.(G),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(G,Z,q,V)=>{let K=L6.of(V),{colors:W}=K,H=Z?A1.yellow:void 0,z=Z?A1.black:W.foreground,U=A1.index(8),N=G.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new F0({width:A,child:s6.end([new m1({text:new e(L,new q1({color:U}))})])});return new Y6({decoration:H?{color:H}:void 0,padding:_0.symmetric(2,0),child:new s6({children:[new N4({child:new m1({text:new e(G.title,new q1({color:z})),overflow:"ellipsis",maxLines:1})}),new F0({width:2}),new m1({text:new e(N,new q1({color:U})),maxLines:1}),new F0({width:2}),M(EX6(G.pubDate),Y)]})})}})}}class _k1 extends w6{props;constructor(J){super();this.props=J}build(){return new F8({child:new m1({text:new e("",void 0,[new e(`Forked to new thread:
4785
4785
 
4786
4786
  `,new q1({color:A1.white,dim:!0})),new e(`"${this.props.newThreadTitle||"Untitled"}"`,new q1({color:A1.white}))]),textAlign:"center"})})}}class AN extends X6{props;constructor(J){super();this.props=J}createState(){return new IX6}}class IX6 extends Q6{_spinner=new rK;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=L6.of(J),{colors:Y}=Q,X=b4.all(new w4(Y.foreground,1,"solid")),G=this._spinner.toBraille(),Z=new m1({textAlign:"center",text:new e("",void 0,[new e(G,new q1({color:A1.yellow})),new e(" ",void 0),new e(this.widget.props.message,new q1({color:Y.foreground}))])}),V=[new N4({child:new o0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)V.push(new F0({height:2,child:new Y6({padding:_0.symmetric(2,0),child:new m1({text:new e("",new q1({dim:!0}),[new e("Press ",new q1({color:Y.foreground})),new e("Esc",new q1({color:Y.info})),new e(" to cancel",new q1({color:Y.foreground}))])})})}));let K=new Y6({decoration:new z8(A1.default(),X),child:new F0({width:60,height:7,child:new o0({mainAxisAlignment:"start",children:V})})});if(this.widget.props.onAbort)return new Y9({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:K});return K}}class kz extends X6{props;constructor(J){super();this.props=J}createState(){return new PX6}}class PX6 extends Q6{dispose(){super.dispose()}isWidgetMessage(J){return J instanceof iK}build(J){let Q=this.widget.props.message,Y=(()=>{if(this.isWidgetMessage(Q))return{title:Q.title,type:Q.type};if(Q instanceof Error&&Q.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:Q.message};if(Q instanceof Error&&Q.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:Q.message};let W=x81(Q);return{title:W.title,type:W.type,description:W.description}})(),X=Y.type==="error"?A1.red:A1.yellow,G=b4.all(new w4(A1.default(),1,"solid")),Z=new Y6({padding:_0.symmetric(1,0),child:new m1({text:new e(Y.title,new q1({color:X,bold:!0}))})}),q=this.isWidgetMessage(Q)?Q.widget:new m1({text:new e(Y.description,new q1({color:A1.default()})),selectable:!0}),V=new N4({child:new zO({child:new Y6({padding:_0.symmetric(1,0),child:q})})}),K=new Y6({padding:_0.symmetric(1,0),child:new m1({text:this.widget.props.onRetry?new e("",void 0,[new e("Press ",new q1({color:A1.default(),dim:!0})),new e("R",new q1({color:A1.yellow})),new e(" to retry, ",new q1({color:A1.default(),dim:!0})),new e("Esc",new q1({color:A1.yellow})),new e(" to cancel",new q1({color:A1.default(),dim:!0}))]):new e("Press any key to close",new q1({color:A1.default(),dim:!0,italic:!0}))})});return new Y9({onKey:(W)=>{if(this.widget.props.onRetry&&W.key==="r")return this.widget.props.onRetry(),"handled";if(W.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!0,child:new Y6({decoration:{border:G,color:A1.default()},padding:_0.all(1),child:new o0({mainAxisAlignment:"center",children:[Z,new F0({height:1}),V,K]})})})}}class kk1 extends w6{build(){return new F8({child:new m1({text:new e("",void 0,[new e(`✓ Thread Shared
4787
4787
 
@@ -4865,7 +4865,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
4865
4865
  `)?`${V}...`:G,W=new q1({color:A1.index(8)}),H=[new e(K,W)];if(q>0){let z=new q1({color:Y.success});for(let U=1;U<=q;U++)H.push(new e(" ")),H.push(new e(`[${U}]`,z))}return new p6({padding:_0.only({bottom:0}),child:new s6({crossAxisAlignment:"start",children:[new p6({padding:_0.only({right:1}),child:new m1({text:new e("•",new q1({color:A1.index(8)}))})}),new N4({child:new m1({text:new e("",void 0,H)})})]})})}}class Vy1 extends X6{createState(){return new OG6}}class OG6 extends Q6{_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 q1({color:A1.red}),Y=new q1({color:this._visible?A1.red:A1.transparent()});return new s6({children:[new m1({text:new e("⏺",Y)}),new F0({width:1}),new m1({text:new e("Replay",Q)})]})}}class Ky1 extends w6{entry;constructor({key:J,entry:Q}){super({key:J});this.entry=Q}build(J){let Q=L6.of(J),Y=Q.colors.secondary,X=Q.colors.foreground,G=this.entry.authors.map((Z)=>Z.name).join(", ");return new Y6({decoration:new z8(void 0,new b4(new w4(Y,1,"rounded"),new w4(Y,1,"rounded"),void 0,new w4(Y,1,"rounded"))),child:new p6({padding:_0.horizontal(1),child:new o0({children:[new s6({crossAxisAlignment:"start",children:[new N4({child:new m1({text:new e(this.entry.title,new q1({color:X,bold:!0}))})}),new F0({width:4}),new m1({text:new e(G||"Community",new q1({color:X,dim:!0}))})]}),new s6({crossAxisAlignment:"start",children:[new N4({child:new m1({text:new e(this.truncateDescription(this.entry.description),new q1({color:X,dim:!0}))})}),new F0({width:2}),new Y7({uri:this.entry.link,text:"View Thread",style:new q1({color:Y,underline:!0})})]})]})})})}truncateDescription(J){let Y=J.replace(/\s+/g," ").trim();if(Y.length<=80)return Y;return Y.slice(0,79)+"…"}}a0();function OA8(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/3600000),G=Math.floor(X/24),Z=Math.floor(G/7),q=Math.floor(G/30);if(X<1)return"Just now";if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;if(Z<=4)return`${Z}w ago`;return`${q}mo ago`}class Wy1{threadHistoryService;constructor(J){this.threadHistoryService=J}async fetchThreadSummaries(J=""){try{let Q=await new Promise((Y)=>{let X=this.threadHistoryService.observeThreadList().subscribe((G)=>{X.unsubscribe(),Y(G)})});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(q6((Q)=>this.formatThreadSummaries(Q,J)))}formatThreadSummaries(J,Q){return J.filter((X)=>{if(!Q.trim())return!0;let G=X.title?.toLowerCase()||"untitled",Z=X.id.toLowerCase(),q=Q.toLowerCase();return G.includes(q)||Z.includes(q)}).map((X)=>{let G=new Date(X.userLastInteractedAt),Z=OA8(G),q=X.id.slice(-8),V=X.env?.initial.trees?.[0]?.uri;return{id:X.id,title:X.title||"Untitled",updatedAt:new Date(X.userLastInteractedAt).toISOString(),description:{timeAgo:Z,title:X.title||"Untitled",shortThreadID:q},diffStats:X.summaryStats?.diffStats,workspaceURI:V,parentRelationships:X.parentRelationships}})}}L0();K9();class Hy1{currentId=null;current=null;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new i3;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){h.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)}dispose(){this.cancelTimerAndSubscription(),this.scrollController.dispose(),this.listeners=[]}subscribeLive(J){if(!this.threadService){h.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(IM()).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 wG6(J,Q){switch(J){case"update-available":return[new e("A newer Amp is available. Run ",new q1({color:Q.foreground,dim:!0})),new e("amp update",new q1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new e("Update complete, run ",new q1({color:Q.foreground,dim:!0})),new e("amp update",new q1({color:Q.warning})),new e(" to see warnings",new q1({color:Q.foreground,dim:!0}))];case"update-error":return[new e("Update failed, run ",new q1({color:Q.foreground,dim:!0})),new e("amp update",new q1({color:Q.warning})),new e(" to see warnings",new q1({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function RA8(J){return new Promise((Q)=>{EA8("git",["branch","--show-current"],{cwd:J},(Y,X)=>{if(Y){Q(null);return}let G=X.trim();Q(G||null)})})}class SG6 extends X6{dependencies;constructor(J){super();this.dependencies=J}createState(){return new _G6}}class _G6 extends Q6{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;connectedClientsStatusExpanded=!1;randomAd=null;adSubscription=null;threadLoadSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;cancelProcessingConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;paletteShowOptions=null;threadsForPicker=[];isLoadingThreads=!1;threadPreviewController=new Hy1;previewThread=null;planScrollController=(()=>{let J=new i3;return J.followMode=!1,J})();todoScrollController=(()=>{let J=new i3;return J.followMode=!1,J})();filterThreadPickerByWorkspace=!0;agentModePulseSeq=0;currentGitBranch=null;messageViewFocusNode=new l8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new l8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showingCannotToggleMessage=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;threadFeedReader=null;currentThreadFeedEntry=null;threadFeedEntries=[];threadFeedSubscription=null;threadFeedRotationTimer=null;threadFeedHidden=!1;threadFeedTickerQueue=[];hasSubmittedFirstMessage=!1;currentUserInfo=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;previousThreadIdForHint=null;pendingMCPServers=[];mcpTrustSubscription=null;agentModeSubscription=null;currentAgentMode="smart";inMemoryAgentModeOverride=null;cachedVisibleModes=aG();freeTierStatus=void 0;updateState="hidden";updateServiceSubscription=null;toastController=new VS1;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=null;async initThreadFeed(){let J=await N6(this.widget.dependencies.configService.config);if(J.settings["feed.enabled"]===!1)this.threadFeedHidden=!0;let Q=J.settings.url,Y=Q.includes("localhost")||Q.includes("127.0.0.1");try{let q=await this.widget.dependencies.internalAPIClient.getUserInfo({},{config:this.widget.dependencies.configService});if(q.ok){let V=q.result,K="user"in V?V.user:V;this.currentUserInfo={username:K.username??void 0,displayName:K.displayName??void 0};let W="ffe10a0c-6c42-41ce-a3a6-38990fd6caf8";if(!Y&&V.team?.id!==W)return}else return}catch(q){h.debug("Failed to fetch user info for thread feed filtering",q);return}let X="/threads.rss",G=async(q,V)=>{let K=q instanceof Request?q.url:q.toString();return HJ(K,V,this.widget.dependencies.configService)},Z=yl0();Z.get("entries").then((q)=>{if(q){let V=this.filterEntries(q);if(this.threadFeedEntries=V,V.length>0&&!this.currentThreadFeedEntry){let K=[...V].sort((H,z)=>z.pubDate.getTime()-H.pubDate.getTime());this.threadFeedTickerQueue=[...K,...this.threadFeedTickerQueue];let W=this.getNextFeedEntry();if(W)this.setState(()=>{this.currentThreadFeedEntry=W})}}}),this.threadFeedReader=new Ij1(Z,G,{url:X}),this.threadFeedSubscription=this.threadFeedReader.stream().subscribe({next:(q)=>{try{let V=this.filterEntries(q);if(V.length>0){this.threadFeedEntries=[...V,...this.threadFeedEntries];let K=[...V].sort((W,H)=>H.pubDate.getTime()-W.pubDate.getTime());if(this.threadFeedTickerQueue=[...K,...this.threadFeedTickerQueue],!this.currentThreadFeedEntry){let W=this.getNextFeedEntry();if(W)this.setState(()=>{this.currentThreadFeedEntry=W})}}}catch(V){h.error("Thread feed: error in next handler",V)}},error:(q)=>{h.error("Thread feed error:",q)}}),this.resetThreadFeedRotation()}filterEntries(J){if(!this.currentUserInfo)return J;let{username:Q,displayName:Y}=this.currentUserInfo;return J.filter((X)=>{return!X.authors.some((G)=>{let Z=G.name;if(!Z)return!1;return Q&&Z===Q||Y&&Z===Y||Q&&Z.includes(Q)})})}rotateThreadFeed(){if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);this.threadFeedRotationTimer=setInterval(()=>{let J=this.getNextFeedEntry();if(J)this.setState(()=>{this.currentThreadFeedEntry=J})},30000)}resetThreadFeedRotation(){this.rotateThreadFeed()}getNextFeedEntry(){if(this.threadFeedTickerQueue.length>0)return this.threadFeedTickerQueue.shift();return null}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})};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.isMessageViewInSelectionMode=!1,this.previousThreadIdForHint=J}),Q};async startReplay(){let J=this.widget.dependencies.replayMode;if(!J)return;let{thread:Q,typingEnabled:Y,baseWpm:X}=J,G=Q.messages;for(let Z=0;Z<G.length;Z++){if(this.replayAbortController.signal.aborted)break;let q=G[Z];if(!q)continue;if(Z>0)await this.replaySleep(J.messageDelayMs);if(q.role==="user"&&Y){let W=q.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
4866
4866
  `);if(W)await this.replayTypeMessage(W,X)}if(q.role==="assistant"){let W=q.content.some((U)=>U.type==="tool_use"),H=G[Z+1],z=H?.role==="user"&&H.content.some((U)=>U.type==="tool_result");if(W&&z){let U={...q,state:{type:"streaming"}};this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,U],this.textController.clear()});let N=J.thread.id;this.getMessageScrollController(N).scrollToBottom(),await this.replaySleep(J.toolProgressDelayMs),this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages.slice(0,-1),q]});continue}}this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,q],this.textController.clear()});let V=J.thread.id;this.getMessageScrollController(V).scrollToBottom()}await this.replaySleep(J.exitDelayMs),I9.instance.stop()}async replayTypeMessage(J,Q){this.textController.clear();let Y=J.split(/(?<=\s)/),X=60000/Q;for(let G of Y){if(this.replayAbortController.signal.aborted)break;let Z=X/G.length;for(let q of G){this.textController.text=this.textController.text+q,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{});let V=0.8+Math.random()*0.4,K=Z*V;await this.replaySleep(K)}}}replaySleep(J){return new Promise((Q)=>{this.replayTypingTimer=setTimeout(Q,J)})}getEffectiveAgentMode(){return W81(this.widget.dependencies.worker.thread,this.inMemoryAgentModeOverride?{agentMode:this.inMemoryAgentModeOverride}:null,this.freeTierStatus,{"experimental.agentMode":this.currentAgentMode})}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((Z)=>Z.type==="toolResult").filter((Z)=>Z.toolResult.run.status==="in-progress"||Z.toolResult.run.status==="queued"),X=J.subagentActiveTools.filter((Z)=>Z.toolRun.status==="in-progress"||Z.toolRun.status==="queued");return[...Y,...X].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 e(this.submitDisabledHint,new q1({color:J.foreground,dim:!0}));if(this.isExiting)return new e("Exiting...",new q1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new e("",void 0,[new e("Ctrl+C",new q1({color:Q.keybind})),new e(" again to exit",new q1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new e("",void 0,[new e("Esc",new q1({color:Q.keybind})),new e(" again to clear input",new q1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new e("",void 0,[new e("Escape",new q1({color:Q.keybind})),new e(" to close help",new q1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let G=this.getEffectiveAgentMode(),Z=Dy1(G);return new e("",void 0,[new e("Images aren't supported in ",new q1({color:J.warning,dim:!1})),new e(G,new q1({color:Z})),new e(" mode.",new q1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new e("",void 0,[new e("Esc",new q1({color:Q.keybind})),new e(" again to cancel",new q1({color:J.foreground,dim:!0}))]);return new e("",void 0,[new e("Esc",new q1({color:Q.keybind})),new e(" to cancel",new q1({color:J.foreground,dim:!0}))])}if(this.showingCannotToggleMessage)return new e(this.showingCannotToggleMessage,new q1({color:J.warning,dim:!1}));let Y=wG6(this.updateState,J);if(Y)return new e("",void 0,Y);let X=this.widget.dependencies.worker.thread;if(X.agentMode==="plan"&&ZO(X))return new e("",void 0,[new e("Ctrl+O",new q1({color:Q.keybind})),new e(" → Execute Plan",new q1({color:J.foreground,dim:!0}))]);return null}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 G=Q.mainThread?.messages.findIndex((Z)=>Z===J);if(G===void 0||G===-1)return;try{this.cancelBashInvocations(),await Y.cancel(),await Y.handle({type:"thread:truncate",fromIndex:G}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(Z){h.error("Failed to edit message:",Z)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Y,threadSyncService:X}=this.widget.dependencies,G=Q.mainThread?.id;if(!G)return;let Z=Q.mainThread?.messages.findIndex((q)=>q===J);if(Z===void 0||Z<=0)return;try{let q=await A3.getOrCreateForThread(Y,G),V=await AT(q,X,Z-1);await this.switchToExistingThread(V)}catch(q){h.error("Failed to fork thread:",q),this.showErrorMessage(`Failed to fork thread: ${q}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Y,worker:X}=this.widget.dependencies,G=Y.mainThread;if(!G)return;let Z=G.messages.findIndex((q)=>q.messageId!==void 0&&q.messageId===J.messageId);if(Z===-1)return;try{this.cancelBashInvocations(),await X.cancel(),this.widget.dependencies.history.add(Q);let q=zN(Q);if(q)await X.handle({type:"thread:truncate",fromIndex:Z}),this.invokeBashCommand(q.cmd,{visibility:q.visibility});else{let V=[{type:"text",text:Q}];if(this.imageAttachments.length>0)V.push(...this.imageAttachments);let K={content:V,agentMode:G.agentMode},W=Z===0;if(G.agentMode&&!W&&K.agentMode!==G.agentMode){h.error(`Cannot edit message: This thread uses ${G.agentMode} mode. To change mode, create a new thread.`);return}await X.handle({type:"user:message",message:K,index:Z})}this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(q){h.error("Failed to edit message:",q)}};getAffectedFiles=async(J)=>{let{worker:Q}=this.widget.dependencies;try{return(await Q.getFilesAffectedByTruncation(J)).map(GJ)}catch(Y){return h.error("Failed to get affected files:",Y),[]}};textController=new uZ;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new i3);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 X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let G=this.searchElementTreeByKey(X,Q);if(G)return G}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||"","~"),X=Q?`amp - ${Q} - ${Y}`:"";process.stdout.write(bC1(X))}}_handleTextCopy(J){if(J&&J.length>0)this.toastController.show("Selection copied to clipboard","success",2000)}textFieldKey=new s7("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;paletteCommands;paletteConfig;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Y=zN(J)?.visibility;if(Y!==this.currentShellModeStatus)this.currentShellModeStatus=Y,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}),J9.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 X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})}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}),J9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette)this.autocompleteFocusNode.requestFocus()})},onCancel:()=>{this.exitApplication()}})};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(J){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 xk1(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 hk1(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 X=i0.file(process.cwd()),G=A6(X);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,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let Z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),Z},setImageAttachments:(Z)=>{this.setState(()=>{this.imageAttachments=Z})},editorDispatch:(Z)=>{switch(Z.type){case"set-input":this.textController.clear(),this.textController.insertText(Z.input);break;case"insert-text":this.textController.insertText(Z.text);break;case"clear":this.textController.clear();break}},submitMessage:(Z)=>{return this.proceedWithUserMessage(Z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,mcpService:this.widget.dependencies.mcpService,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??!1,switchToThread:async(Z)=>{return await this.switchToExistingThread(Z),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(Z,q,V)=>{let K=this.widget.dependencies.threadState.mainThread?.id;if(!K)throw Error("No active thread");let W=setTimeout(()=>{V.throwIfAborted()},60000);try{let H=await this.widget.dependencies.threadService.generateHandoffPrompt(K,Z,q,this.widget.dependencies.configService,V);return clearTimeout(W),H}catch(H){throw clearTimeout(W),H}},handleHandoff:async(Z,q)=>{let{goal:V,generatedPrompt:K,images:W}=q;if(!V&&!K)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 z=setTimeout(()=>Z.abort(new C91("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let U=await this.widget.dependencies.threadService.createHandoffThread(H,{goal:V,generatedPrompt:K,images:W},this.widget.dependencies.configService,Z.signal);return clearTimeout(z),await this.switchToExistingThread(U),{ok:!0}}catch(U){if(clearTimeout(z),U instanceof Error&&(U.name==="AbortError"||U.message.includes("aborted")))throw Z.signal.reason;throw U}}catch(H){return h.error("Failed to create handoff thread",H),{ok:!1,error:H instanceof Error?H:Error(String(H))}}},getGuidanceFiles:async(Z)=>{if(!Q.mainThread)return[];return(await rr({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,Z)).map((V)=>({uri:V.uri,type:V.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(Z)=>{this.setState(()=>{this.inMemoryAgentModeOverride=Z})},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,handleExecutePlan:async()=>{try{let Z=Q.mainThread?.id;if(!Z){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let q=await this.widget.dependencies.threadService.createPlanExecutionThread(Z,"smart");await this.switchToExistingThread(q)}catch(Z){h.error("Failed to execute plan",Z),this.setState(()=>{this.displayMessage=Error(`Failed to execute plan: ${Z instanceof Error?Z.message:String(Z)}`)})}},planFileManager:this.widget.dependencies.planFileManager,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:G,threadViewStates:this.widget.dependencies.workerController.threadViewStates,currentThreadFeedEntry:this.currentThreadFeedEntry,threadFeedEntries:this.threadFeedEntries,threadFeedHidden:this.threadFeedHidden,setThreadFeedHidden:(Z)=>{this.setState(()=>{this.threadFeedHidden=Z})}}};loadThreadsForPicker(){if(this.threadLoadSubscription)return;this.setState(()=>{this.isLoadingThreads=!0});let J=new Wy1(this.widget.dependencies.threadHistoryService);this.threadLoadSubscription=J.observeThreadSummaries("").subscribe({next:(Q)=>{this.setState(()=>{this.threadsForPicker=Q,this.isLoadingThreads=!1})},error:()=>{this.setState(()=>{this.isLoadingThreads=!1})}})}updateGitBranch=async()=>{let J=await RA8(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(),X=`bash-${Y}-${Math.random().toString(36).substring(7)}`,G={cmd:J},Z=new AbortController;this.widget.dependencies.worker.invokeBashTool(G,Z.signal,Q===HN).subscribe({next:(q)=>{this.setState(()=>{if(this.bashInvocations.find((K)=>K.id===X))this.bashInvocations=this.bashInvocations.map((K)=>K.id===X?{...K,toolRun:q}:K);else{let K={id:X,args:G,toolRun:q,startTime:Y,abortController:Z,hidden:Q===HN};this.bashInvocations=[...this.bashInvocations,K]}})},error:()=>this.removeBashInvocation(X),complete:()=>this.removeBashInvocation(X)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};toggleConnectedClientsStatus=()=>{this.setState(()=>{this.connectedClientsStatusExpanded=!this.connectedClientsStatusExpanded})};toggleAgentMode=()=>{let J=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker;if(b$(J.thread)>0)return;if(this.freeTierStatus?.canUseAmpFree){let X=this.getEffectiveAgentMode(),G=wi(X,this.cachedVisibleModes);if(G!==X)this.setState(()=>{this.inMemoryAgentModeOverride=G,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1});return}let Q=this.getEffectiveAgentMode(),Y=wi(Q,this.cachedVisibleModes);if(Y===Q)return;if(this.setState(()=>{this.inMemoryAgentModeOverride=Y,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1}),R5(Y))this.checkAndShowFreeModeModal()};checkAndShowFreeModeModal=()=>{if(this.freeTierStatus?.canUseAmpFree)return;if(this.freeTierStatus){if(!this.freeTierStatus.eligible){this.setState(()=>{this.showingCannotToggleMessage="Amp Free is unavailable. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}else if(!this.freeTierStatus.workspaceAllowsAmpFree){this.setState(()=>{this.showingCannotToggleMessage="Your workspace does not allow Amp Free. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}}};isInRestrictedFreeMode(){if(this.getEffectiveAgentMode()!=="free")return!1;if(this.freeTierStatus?.canUseAmpFree)return!1;return!0}handleInsertImage=(J)=>{let Q=this.getEffectiveAgentMode();if(!gk(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>=BU)return!1;let Y=TC(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)})};openInEditor=async(J)=>{let{mkdtemp:Q,readFile:Y,unlink:X,rmdir:G,writeFile:Z}=await import("node:fs/promises"),{tmpdir:q}=await import("node:os"),V=await import("node:path");try{let K=await Q(V.join(q(),"amp-edit-")),W=V.join(K,"message.amp.md");await Z(W,J,"utf-8"),await Iz(W);try{let H=await Y(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")h.error("Failed to read temporary file",H)}try{await X(W),await G(K)}catch(H){h.warn("Failed to clean up temporary file",H)}}catch(K){h.error("Error opening editor:",K)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=zN(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)};initState(){if(YG.getInstance().interceptConsole(),this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();I9.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),I9.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),I9.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Y)=>{J9.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Y.hasFocus})})}),this.freeTierStatus=this.widget.dependencies.freeTierStatus,N6(this.widget.dependencies.configService.config).then((Y)=>{this.paletteConfig=Y;let X=W81(this.widget.dependencies.worker.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,Y.settings);if(h.info(`[initState] Resolved agentMode: ${X}`),this.widget.dependencies.sessionState?.agentMode)this.setState(()=>{this.inMemoryAgentModeOverride=X})}),this.updateGitBranch(),this.adSubscription=Gj1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{return(this.inMemoryAgentModeOverride&&R5(this.inMemoryAgentModeOverride)||this.randomAd===null)&&Xj1(this.lastUserInteractionTime)}).subscribe({next:(Y)=>{if(Y){let X=IA8(16).toString("hex");this.lastAdImpressionId=X,Promise.resolve().then(() => (J51(),e91)).then(({recordAdEvent:G})=>{let Z=this.widget.dependencies.worker.thread,q=Z.messages[Z.messages.length-1];G("viewed",{adId:Y.id,advertiserId:Y.advertiserId,threadId:Z.id,messageId:q?.messageId,impressionId:X,placement:"tui",matchType:Y.metadata?.matchType,matchedPatterns:Y.metadata?.matchedPatterns,candidateAdPoolCount:Y.metadata?.candidateAdPoolCount,clientRegion:Y.metadata?.clientRegion})})}this.setState(()=>{this.randomAd=Y}),J9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}});let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((Y)=>{this.setState(()=>{this.pendingMCPServers=Y})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Y)=>{this.setState(()=>{this.ideStatus=Y})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Y)=>{let X=this.widget.dependencies.getCurrentWorker();if(!X){h.warn("No active thread worker found to handle IDE message");return}await new Promise((G)=>setTimeout(G,50)),await X.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}}),h.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),h.debug("Appended text to CLI prompt from IDE",{text:Y.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Y)=>{this.setState(()=>{this.connectedClientsStatus=Y})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Y)=>{this.setState(()=>{this.updateState=Y})}),this.agentModeSubscription=this.widget.dependencies.configService.config.subscribe((Y)=>{let X=aG(Y.settings,this.freeTierStatus?.canUseAmpFree);this.setState(()=>{this.cachedVisibleModes=X})}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Y)=>{let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller();if(this.widget.dependencies.replayMode)setTimeout(()=>this.startReplay(),100);this.initThreadFeed()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}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.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeSubscription)this.agentModeSubscription.unsubscribe();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.mcpTrustSubscription)this.mcpTrustSubscription.unsubscribe();if(this.threadLoadSubscription)this.threadLoadSubscription.unsubscribe();if(this.threadFeedSubscription)this.threadFeedSubscription.unsubscribe();if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);if(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(bC1("")),this.shouldUseProgressBar())process.stdout.write(M76())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,X=[...J.items.filter((V)=>V.type==="toolResult").map((V)=>({toolUse:V.toolUse,toolRun:V.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((V)=>V.toolRun.status==="blocked-on-user");if(X.length===0)return null;let G=X[0],Z=G.toolRun.status==="blocked-on-user"?G.toolRun.toAllow??[]:[],q=G.toolRun.status==="blocked-on-user"?G.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:G.toolUse,toAllow:Z}],subthreadID:G.subthreadID,reason:q}}shouldUseProgressBar(){return!1}updateProgressBar(){}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){h.error("No current tool confirmation found");return}let Y=Q.tools[0]?.useBlock;if(!Y){h.error("No tool use block found in confirmation");return}if(J==="allow-all-session")C$("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0,"global")}catch(G){if(G&&G instanceof Error)this.setState(()=>{this.displayMessage=G});else h.error("Failed to write dangerouslyAllowAll setting:",G);return}if(J==="always-guarded"){let G=Q.tools[0]?.toAllow??[],Z=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],q=[...G,...Z];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",q,"global")}if(J==="connect-github"){let G=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();await iY(this.context,G);return}if(J==="disable-librarian"){let G=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!G.includes(MX))await this.widget.dependencies.settingsStorage.set("tools.disable",[...G,MX],"global")}let X=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let G={type:"user:tool-input",toolUse:Y.id,value:{accepted:X}};if(Q.subthreadID)await(await A3.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(G);else await this.widget.dependencies.worker.handle(G)}catch(G){h.error("Failed to send tool confirmation:",G)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Y=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Y)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Y=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Y.retry();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break;case"new-thread":{this.setState(()=>{this.dismissedEphemeralErrorKey=null}),await this.startAndSwitchToNewThread();break}case"new-smart-thread":{this.setState(()=>{this.inMemoryAgentModeOverride="smart",this.dismissedEphemeralErrorKey=null}),D41({agentMode:"smart"}),await this.startAndSwitchToNewThread();break}case"handoff":{if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);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 Iz(Q.getSettingsFilePath())}catch(Y){let X=Y instanceof Error?Y.message:String(Y);await this.showErrorMessage(`Failed to open settings: ${X}`)}};cancelStreamingMessage=async()=>{await A3.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 X=this.widget.dependencies.worker.thread.id;if(X!==J)this.recordNavigation(X)}try{h.info(`[switchToExistingThread] Switching to thread: ${J}`);let X=await this.widget.dependencies.switchToThread(J);h.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${X.thread.agentMode}`);let G=await this.widget.dependencies.configService.getLatest(),Z=W81(X.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,G.settings);if(h.info(`[switchToExistingThread] Thread ${J} resolved agentMode: ${Z}`),this.widget.dependencies.worker=X,this.widget.dependencies.threadID=X.thread.id,this.widget.dependencies.switchWorker(X),this.setState(()=>{h.info("[switchToExistingThread] Clearing inMemoryAgentModeOverride"),this.inMemoryAgentModeOverride=null}),X.thread.draft)if(h.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),typeof X.thread.draft==="string")this.textController.insertText(X.thread.draft);else{let q=X.thread.draft.filter((W)=>W.type==="text"),V=X.thread.draft.filter((W)=>W.type==="image"),K=q.map((W)=>W.text).join(`
4867
4867
  `);if(K)this.textController.insertText(K);if(V.length>0)this.setState(()=>{this.imageAttachments=V})}}catch(X){throw h.error("Failed to switch to thread:",J,X),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,Y=b$(Q.thread)===0,X=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Y&&X!==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 G=[{type:"text",text:J}];if(this.imageAttachments.length>0)G.push(...this.imageAttachments);if(await Q.handle({type:"user:message",message:{content:G,agentMode:X}}),Y)D41({agentMode:X});this.scrollMessageViewToBottom(),this.setState(()=>{if(this.imageAttachments=[],!this.hasSubmittedFirstMessage)this.hasSubmittedFirstMessage=!0}),J9.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((X)=>X.type==="handoff"&&X.role==="child"))await this.widget.dependencies.threadService.discardHandoffThread(J.id).catch(()=>{})}let Q=this.getEffectiveAgentMode();D41({agentMode:Q}).catch((Y)=>{h.warn("Failed to save session state on exit:",Y)}).finally(()=>{I9.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=PA8();if(J===Q)return"~";if(J.startsWith(Q+am.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(am.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(am.sep),"…",Q.slice(-2).join(am.sep)].join(am.sep)}build(J){let Q=H8.of(J),Y=L6.of(J),X=Y.base;this.themeColors=X;let{colors:G,app:Z}=Y;this.themeApp=Z;let q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,V=q.thread.agentMode&&R5(q.thread.agentMode),K=V&&this.randomAd!==null,W=!V&&this.currentThreadFeedEntry!==null&&!this.threadFeedHidden&&this.hasSubmittedFirstMessage,H=K||W,{threadState:z}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),N=this.widget.dependencies.replayMode,M=Boolean(N),L=z.items,A=z.mainThread||void 0,E=z.subagentToolsByParentID,P=z.todosList;if(M){let J4={...N.thread,messages:this.replayDisplayedMessages};L=pC(J4).items,A=J4,E={};let a4=WI({messages:this.replayDisplayedMessages});P=Array.isArray(a4)?a4:[]}let I=A?.id,T=A,S=M?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),y=(J4)=>new P91({key:new s7(`preview-message-view-${J4.id}`),items:pC(J4).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:J4,focusNode:new l8({debugLabel:"PreviewFocus"})}),x=this.previewThread,g=x?x.messages.length>2000?new o0({mainAxisSize:"max",children:[new N4({child:new F0}),new p6({padding:_0.all(2),child:new F8({child:new m1({text:new e("Thread too long for preview",new q1({color:G.mutedForeground,dim:!0}))})})})]}):y(x):S?new T91({agentMode:this.getEffectiveAgentMode()}):new P91({key:I?new s7(`message-view-${I}`):void 0,items:L,subagentToolsByParentID:E,controller:I?this.getMessageScrollController(I):new i3,autofocus:!1,onCopy:M?void 0:this._handleTextCopy.bind(this),thread:T,onMessageEditSubmit:M?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:M?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:M?void 0:this.forkMessage,getAffectedFiles:M?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),p=Math.max(Math.floor(Q.size.height*0.4),12),b=this.getCurrentEphemeralError(),l=this.buildBottomWidget(b,U,G,Y,z,P,p,H,M),J1=Q.size.width<40,n=z.mainThread?iB0(z.mainThread):void 0,u=new m81({threadViewState:z.viewState,threadTokenUsage:n,threadID:I??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:J1,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!U,showingEphemeralError:Boolean(z.viewState.state==="active"&&z.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),s=new g81({bashInvocations:this.bashInvocations}),H1=[],W1=this.getEffectiveAgentMode(),o=this.currentShellModeStatus,r=Dy1(W1),i=!o?W1.length+1:0,F1=Q.capabilities.animationSupport,y1=F1==="disabled"?0:F1==="slow"?30:60,t=fV(W1)?.uiHints?.fasterAnimation?3:1,f1=y1>0&&this.agentModePulseSeq>0?new W5({children:[l,new R7({top:0,left:1,right:1,height:1,child:new Zy1({color:r,trigger:this.agentModePulseSeq,fps:y1,speed:t,leftOffset:i})})]}):l;H1.push(new N4({child:g}),s);let C1=new W5({children:[new o0({mainAxisSize:"min",children:[K?new wk1({ad:this.randomAd,onButtonClick:async()=>{let J4=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (J51(),e91)).then(({recordAdEvent:Z8})=>{let y4=this.widget.dependencies.worker.thread,M4=y4.messages[y4.messages.length-1];Z8("clicked",{adId:J4.id,advertiserId:J4.advertiserId,threadId:y4.id,messageId:M4?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:J4.metadata?.matchType,matchedPatterns:J4.metadata?.matchedPatterns,candidateAdPoolCount:J4.metadata?.candidateAdPoolCount,clientRegion:J4.metadata?.clientRegion})});if(!await iY(this.context,J4.shortDestinationUrl)){let y4=I9.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:y4,url:J4.shortDestinationUrl}})}}}):W?new Ky1({entry:this.currentThreadFeedEntry}):new F0({height:0}),new Y6({constraints:new i6(0,Q.size.width,0,p),child:f1})]}),H?new R7({top:0,left:0,right:0,child:new xG6({userHeight:this.bottomGridUserHeight,maxHeight:p,onInitializeHeight:(J4)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(J4,p)})},onDrag:(J4)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(J4.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let a4=Math.floor(J4.localPosition.y)-this.bottomGridDragStartY,Z8=Math.max(4,this.bottomGridDragStartHeight-a4),y4=Math.min(Z8,p),M4=Math.floor(y4);if(this.bottomGridUserHeight!==M4)this.setState(()=>{this.bottomGridUserHeight=M4})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new F0({height:0})]});H1.push(C1,new F0({height:1,child:new p6({padding:_0.horizontal(1),child:u})}));let w0=new o0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:H1}),s1=M&&N?.showIndicator!==!1?new W5({children:[w0,new R7({top:0,left:0,child:new Vy1})]}):w0,U1=new Q9(()=>{if(this.isShowingPalette)return this.dismissPalette(),"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.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!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.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.isConfirmingCancelProcessing){if(this.bashInvocations.length>0)this.cancelBashInvocations();if(this.isProcessing())this.markLastUserMessageAsInterrupted().catch((a4)=>{h.error("Failed to mark message as interrupted:",a4)}),this.cancelStreamingMessage().catch((a4)=>{h.error("Failed to cancel streaming message:",a4)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return h.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.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"}),Y1=new Q9(()=>{return this.onExitPressed(),"handled"}),O1=new Q9(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),w1=new Q9(()=>{return RJ.instance.toggleAll(),"handled"}),I1=new Q9(()=>{return this.widget.dependencies.configService.getLatest().then((J4)=>{C$("internal.showCost",!(J4.settings["internal.showCost"]??!0))}),"handled"}),E1=new Q9(()=>{return I9.instance.toggleFrameStatsOverlay(),"handled"}),d1=new Q9(()=>{return I9.instance.tuiInstance.getScreen().markForRefresh(),J9.instance.requestFrame(),"handled"}),h1=new Q9(()=>{return this.toggleAgentMode(),"handled"}),r1=new Q9(()=>{let a4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,y4=Z8.mainThread?.id;return y4?this.getMessageScrollController(y4):null})();if(a4){let Z8=Math.max(Math.floor(Q.size.height*0.4),10),y4=Q.size.height-Z8;a4.animatePageUp(y4,100)}return"handled"}),$0=new Q9(()=>{let a4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,y4=Z8.mainThread?.id;return y4?this.getMessageScrollController(y4):null})();if(a4){let Z8=Math.max(Math.floor(Q.size.height*0.4),10),y4=Q.size.height-Z8;a4.animatePageDown(y4,100)}return"handled"}),G0=new Q9(()=>{let a4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,y4=Z8.mainThread?.id;return y4?this.getMessageScrollController(y4):null})();if(a4)a4.animateTo(0,100);return"handled"}),T0=new Q9(()=>{let a4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:Z8}=this.widget.dependencies,y4=Z8.mainThread?.id;return y4?this.getMessageScrollController(y4):null})();if(a4)a4.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),F6=new Q9(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:J4}=this.widget.dependencies;if(!J4.mainThread?.messages.some((Z8)=>Z8.role==="user"||KI(Z8)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),M6=new Q9((J4)=>{if(J4.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),E4=new Q9(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return y81().then(async(J4)=>{if(J4)try{this.handleInsertImage(J4)}finally{try{let{unlink:a4}=await import("node:fs/promises");await a4(J4)}catch{}}}),"handled"}),m4=new Map([[U4.ctrl("c"),new wm],[U4.ctrl("l"),new Tm],[U4.ctrl("o"),new j81],[U4.ctrl("v"),new Am],[U4.alt("s"),new SC],[U4.ctrl("s"),new SC],[U4.alt("p"),new Rm],[U4.ctrl("r"),new Im],[U4.alt("d"),new Pm],[U4.ctrl("t"),new Cm],[U4.key("PageUp"),new P81],[U4.key("PageDown"),new R81],[U4.key("Home"),new T81],[U4.key("End"),new C81],[U4.key("Escape"),new Om],[U4.ctrl("p"),new _C("previous")],[U4.ctrl("n"),new _C("next")],[U4.key("Tab"),new jm]]);if(!r2())m4.set(U4.key("ArrowUp"),new jm);if(!1)m4.set(U4.alt("c"),new Em);let I0=new Q9(()=>{if(this.isShowingStandalonePalette())return"handled";return this.showCommandPalette(),"handled"}),u0=new Q9(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),o6=new Map([[Om,U1],[Tm,d1],[SC,h1],[j81,I0],[Am,E4],[Em,O1],[Im,w1],[Pm,I1],[Rm,E1],[Cm,u0],[wm,Y1],[P81,r1],[R81,$0],[T81,G0],[C81,T0],[jm,F6],[_C,M6]]),P4=[s1];if(this.isShowingConsoleOverlay)P4.push(new mk1);if(this.isShowingHelp&&this.paletteConfig)P4.push(new dk1({commands:this.getPaletteCommands().getAllCommands()}));if(this.adActionModal)P4.push(new Ek1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(J4)=>{let a4=this.adActionModal.url;if(J4==="copy")try{await I9.instance.tuiInstance.clipboard.writeText(a4),this.setState(()=>{this.displayMessage=new VG("Link copied to clipboard")})}catch(Z8){h.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:J4}=this.widget.dependencies;P4.push(new $y1({servers:this.pendingMCPServers,onAlwaysTrust:J4.trustAlways.bind(J4),onTrustOnce:J4.trustOnce.bind(J4),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:J4.deny.bind(J4)}))}if(this.isShowingFileChangesOverlay)P4.push(new ES1({threadData:z}));if(this.isShowingCostBreakdownOverlay&&z.mainThread)P4.push(new uk1({thread:z.mainThread}));if(this.isShowingConfirmationOverlay)P4.push(new bk1({details:this.confirmationOverlayContent}));let j8=this.getCommandPaletteContext(J);if(j8&&this.isShowingPalette&&this.paletteConfig)P4.push(new F8({child:new Y6({constraints:i6.loose(80,20),child:new fk1({commandContext:j8,mainThread:z.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,showOptions:this.paletteShowOptions??void 0})})}));if(this.isShowingIdePicker)P4.push(new lk1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));let M5=new W5({children:P4});if(this.isShowingJetBrainsInstaller)return new UO({child:new aQ({actions:o6,child:new kq({shortcuts:m4,debugLabel:"jetbrains-installer-shortcuts",child:new Gy1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new Rz({controller:this.toastController,child:new UO({child:new KS1({controller:this.toastController,child:new aQ({actions:o6,child:new kq({shortcuts:m4,debugLabel:"main-app-shortcuts",child:M5})})})})})}buildScrollableTodoList(J,Q,Y){return new kG6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Y})}buildBottomWidget(J,Q,Y,X,G,Z,q,V,K){if(J)return new pk1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new gk1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new qy1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let W=h81(X),H=this.isInRestrictedFreeMode(),z=new CO({key:this.textFieldKey,controller:this.textController,triggers:K?[]:[new LN],completionBuilder:K?void 0:this.getCompletionBuilder(),ampURL:this.widget.dependencies.ampURL,onSubmitted:K?void 0:this.onTextSubmitted,theme:Y,placeholder:K?"Press Ctrl+C to exit":H?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!H&&!this.isShowingStandalonePalette(),shellPromptRules:W,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandalonePalette()&&!this.isShowingIdePicker,clipboard:I9.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage,previousThreadId:this.previousThreadIdForHint&&(G.mainThread?.messages.length??0)===0?this.previousThreadIdForHint:void 0,onPreviousThreadHintAccepted:()=>{let p=this.previousThreadIdForHint;if(p)this.setState(()=>{this.previousThreadIdForHint=null}),this.textController.text=`following: @${p} `},onDoubleAtTrigger:K?void 0:()=>{let p=this.textController.text,b=this.textController.cursorPosition,J1=p.slice(0,b).lastIndexOf("@@");this.showCommandPalette({type:"standalone",commandId:"mention-thread",onBeforeExecute:()=>{if(J1!==-1){let n=this.textController.text,u=n.slice(0,J1)+n.slice(J1+2);this.textController.text=u,this.textController.cursorPosition=J1}},onSubmit:()=>{this.dismissPalette()},onCancel:()=>{this.dismissPalette()}})}}),U=G.mainThread?.queuedMessages??[],N=Array.isArray(Z)&&Z.length>0,M=Array.isArray(U)&&U.length>0,L=G.mainThread?.agentMode==="plan"&&ZO(G.mainThread),A,E;if(L){if(A=new aj1(new R91({thread:G.mainThread,onExecute:async()=>{let p=this.getCommandPaletteContext();if(p)await this.getPaletteCommands().execute("execute-plan",p,void 0,new AbortController)},onEdit:async()=>{try{let p=process.env.EDITOR||process.env.VISUAL||"nano",{filePath:b}=await this.widget.dependencies.planFileManager.ensureSync(G.mainThread.id);I9.instance.tuiInstance.suspend();let{execSync:l}=await import("child_process");l(`${p} "${b}"`,{stdio:"inherit"}),I9.instance.tuiInstance.resume()}catch(p){h.error("Failed to edit plan",p),this.setState(()=>{this.displayMessage=Error("Failed to edit plan")})}},controller:this.planScrollController,appTheme:X}),{clipBehavior:"antiAlias"}),M)E=new t91({queuedMessages:U});else if(N)E=this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!H,X)}else A=M?new t91({queuedMessages:U}):void 0,E=N?this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!H,X):void 0;let P=[],I=this.currentShellModeStatus;if(I)P.push({child:new m1({text:new e(I==="hidden"?"shell mode (incognito)":"shell mode",new q1({color:I==="hidden"?X.app.shellModeHidden:X.app.shellMode}))}),position:"top-left"});if(!I&&this.cachedVisibleModes.length>1){let p=this.previewThread,b=p?p.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),l=Dy1(b);if(p)P.push({child:new m1({text:new e(b,new q1({color:l}))}),position:"top-left"});else{let J1=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,n=b$(J1.thread)===0,u=new m1({text:new e(b,new q1({color:l}))});P.push({child:n?new T8({child:u,onClick:this.toggleAgentMode,cursor:"pointer"}):u,position:"top-left"})}}if(this.connectedClientsStatus&&this.connectedClientsStatus.enabled){let p=this.connectedClientsStatus,b=p.mode||"disconnected",l=!!p.errorMessage,J1=p.clientID||"unknown",n,u;if(l)n="●",u=A1.red;else if(b==="presence")n="○",u=A1.yellow;else if(b==="connected"&&p.connected)n="●",u=A1.green;else n="○",u=A1.yellow;let s=this.connectedClientsStatusExpanded?`${J1} ${n}`:n;P.push({child:new T8({child:new m1({text:new e(s,new q1({color:u}))}),onClick:this.toggleConnectedClientsStatus,cursor:"pointer"}),position:"top-right",offsetX:-2})}let T=K?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:G.mainThread?.env?.initial.trees?.[0]?.uri,S;if(T)S=i0.parse(T).fsPath;else S=process.cwd();let y=this.toHomeRelative(S),x=this.shorten(y),g=!K&&this.currentGitBranch?`${x} (${this.currentGitBranch})`:x;return P.push({child:new m1({text:new e(g,new q1({color:Y.foreground,dim:!0}))}),position:"bottom-right"}),new US1({leftChild:new N4({child:z}),rightChild1:A,rightChild2:E,maxHeight:q,overlayTexts:P,borderColor:H||!this.isTextfieldAndAutocompleteFocused?A1.index(8):void 0,hasBanner:V,userHeight:this.bottomGridUserHeight,onInitializeHeight:(p)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(p,q)})},onDrag:(p)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(p.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let b=Math.floor(p.localPosition.y)-this.bottomGridDragStartY,l=Math.max(4,this.bottomGridDragStartHeight-b),J1=Math.min(l,q),n=Math.floor(J1);if(this.bottomGridUserHeight!==n)this.setState(()=>{this.bottomGridUserHeight=n})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:!V})}}async function My1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)I9.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let X=()=>null,Z=!1,q=new Mz(Z,1000,J.inspectorPort),V=J.features?.find((A)=>A.name==="amp-connect")?.enabled??!1,K=new Ak1({threadService:J.threadService,worker:J.worker,builder:(A,E,P,I,T,S)=>{if(X=T,J.threadDependencies&&V)Cj1(J.threadDependencies,J.configService,T,I,J.connectedClientsService,J.startNewThread,J.switchToThread,J.clientId).catch((g)=>{h.error("Failed to start automatic presence:",g)});let y=T(),x={...J,worker:y,threadID:y.thread.id};return new SG6({...x,threadState:E,workerController:P,switchWorker:I,getCurrentWorker:T,recentThreadIDs:S})}}),W=new LS1({configService:J.configService,child:K}),H=new NS1({configService:J.configService,child:W}),z=new QS1(H),U=new L6({data:kC.fromBaseTheme(mZ.default()),child:z});try{await eC1(U,{onRootElementMounted:(A)=>{if(h.info("TUI input ready for user interaction"),Z)q.start(A)}})}finally{if(Z)q.stop();if(J.threadDependencies&&V){let{stopGlobalSession:A}=await Promise.resolve().then(() => (jj1(),D36));A()}}let M=X()?.thread.id||J.threadID,L=await J.threadService.get(M);if(L&&L.messages.length>0){let A=`${J.ampURL.replace(/\/$/,"")}/threads/${M}`;b36(L,A,J.stdout)}}function Dy1(J){let Y=fV(J)?.uiHints?.secondaryColor;if(Y)return A1.rgb(Y.r,Y.g,Y.b);return TA8(J)}class kG6 extends X6{props;constructor(J){super();this.props=J}createState(){return new yG6}}class yG6 extends Q6{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:X}=this.widget.props;return new s6({crossAxisAlignment:"stretch",children:[new N4({child:new R2({controller:Y,autofocus:!1,child:new Ok1({todos:Q})})}),new HG({controller:Y,thumbColor:X.app.scrollbarThumb,trackColor:X.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:G,offset:Z}=Y,q=this.viewportHeight,V=G+q;return{totalContentHeight:Math.max(V,0),viewportHeight:Math.max(q,1),scrollOffset:Math.max(Z,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=(X,G=0)=>{if(X&&"size"in X&&"children"in X){let Z=X.children||[];for(let q of Z){if(q&&"size"in q){let K=q.size;if(typeof K?.height==="number"&&K.height>0)return K.height}let V=Q(q,G+1);if(V>0)return V}}return 0},Y=Q(J);if(Y>0)return Y;if("size"in J){let X=J.size;if(typeof X?.height==="number"&&X.height>0)return X.height}return this.viewportHeight}}class xG6 extends w6{props;constructor(J){super();this.props=J}build(J){return new T8({child:new F0({height:1}),cursor:i9.NS_RESIZE,onDrag:(Q)=>{if(this.props.userHeight===void 0){let X=J.findRenderObject()?.size.height??0;if(X>0){this.props.onInitializeHeight(X);return}}this.props.onDrag(Q)},onRelease:this.props.onRelease})}}function TA8(J){let Q=0;for(let G=0;G<J.length;G++){let Z=J.charCodeAt(G);Q=(Q<<5)-Q+Z,Q=Q&Q}let Y=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Y.length;return A1.index(Y[X])}tC1();try{if(process.platform==="win32")await Promise.resolve().then(() => B6(Wj(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){rZ.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
4868
- `)}var nx1=ix1.join(EF0||ix1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function aI8(J){process.emitWarning=function(Q,Y,X,G){let Z=typeof Q==="string"?Q:Q.message||String(Q),q=Y||"Warning",V=!1;J.warn(Z,{name:q,code:X})}}function mq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")C$("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")C$("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")C$("model.sonnet",Q.useSonnet)}async function ox1(J){try{await lI8(ix1.dirname(nx1),{recursive:!0}),await iI8(nx1,J,"utf-8")}catch(Q){h.debug("Failed to save last thread ID",Q)}}async function oI8(){try{return(await $V6(nx1,"utf-8")).trim()}catch(J){return null}}var XV6=[{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??xZ,description:`Custom settings file path (overrides the default location ${xZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(h).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${XC1})`},{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:r2(),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:XI.SMART.key,description:`Set the agent mode (${aG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:aG().map((J)=>J.mode)}],GV6=(J)=>("deprecated"in J)&&J.deprecated===!0,rI8=(J)=>("hidden"in J)&&J.hidden===!0,sI8=(J)=>("default"in J),tI8=(J)=>("default"in J)?J.default:void 0;function eI8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new _8(yZ.unknownCommand(Y),1,q)}}var qV6=null;function ML5(){return qV6}function Du(J){return{...J,getThreadEnvironment:i61,vfs:nI0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new bx(J.fileSystem),generateThreadTitle:ml0,deleteThread:(Q)=>J.threadService.delete(Q)}}var rx1=i0.file(nI8.homedir()),VV6=process.env.XDG_CONFIG_HOME?i0.file(process.env.XDG_CONFIG_HOME):s0.joinPath(rx1,".config");async function uq(J,Q){XN0("0.0.1764417684-g51a9e4");let Y=Gq1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:X0.of([i0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:rx1,userConfigDir:VV6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (J51(),e91));X(Y);let G=await Y.getLatest();h.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let{toolService:Z,dispose:q}=V16({configService:Y}),V=new Map,K=()=>V.clear(),W=new ZU1(Y,J.settings.getWorkspaceRootPath()),H=JI0({configService:Y,trustStore:W,createOAuthProvider:async(n)=>{let u=V.get(n);if(u)return h.debug("Reusing existing OAuth provider for server",{serverName:n}),u;h.debug("Creating OAuth provider for server",{serverName:n});let s=(async()=>{let H1=new dM(J.secrets),W1=await H1.getClientInfo(n),o=new TF1({storage:H1,serverName:n,clientId:W1?.clientId,clientSecret:W1?.clientSecret,scopes:W1?.scopes});return h.debug("OAuth provider created",{serverName:n,hasManualClientId:!!W1?.clientId,willUseDCR:!W1?.clientId}),o})();return V.set(n,s),s}}),z=l01({configService:Y,filesystem:B5,spawn:yA}),{initializeToolProviders:U}=await Promise.resolve().then(() => (YV6(),QV6)),{registrations:N,initErrors:M}=await U({toolService:Z,providers:[H,z],initialTimeout:J.executeMode?15000:5000});for(let[n,u]of M)h.warn(`${n} provider initialization slow or failed:`,u);if(Q.jetbrains)zI("JetBrains");else if(Q.ide&&z56())zI("VS Code");else if(Q.ide&&F56())zI("Neovim");if(J.executeMode)GN0(!0);let L,A=N2.status.pipe(q6((n)=>Boolean(n.connected&&n.authenticated)),v4()).subscribe((n)=>{if(n){if(!L)L=Z.registerTool(ns0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new X41(process.cwd(),{},!0);else E=new class extends X41{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(h5.write(`No API key found. Starting login flow...
4868
+ `)}var nx1=ix1.join(EF0||ix1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function aI8(J){process.emitWarning=function(Q,Y,X,G){let Z=typeof Q==="string"?Q:Q.message||String(Q),q=Y||"Warning",V=!1;J.warn(Z,{name:q,code:X})}}function mq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")C$("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")C$("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")C$("model.sonnet",Q.useSonnet)}async function ox1(J){try{await lI8(ix1.dirname(nx1),{recursive:!0}),await iI8(nx1,J,"utf-8")}catch(Q){h.debug("Failed to save last thread ID",Q)}}async function oI8(){try{return(await $V6(nx1,"utf-8")).trim()}catch(J){return null}}var XV6=[{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??xZ,description:`Custom settings file path (overrides the default location ${xZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(h).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${XC1})`},{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:r2(),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:XI.SMART.key,description:`Set the agent mode (${aG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:aG().map((J)=>J.mode)}],GV6=(J)=>("deprecated"in J)&&J.deprecated===!0,rI8=(J)=>("hidden"in J)&&J.hidden===!0,sI8=(J)=>("default"in J),tI8=(J)=>("default"in J)?J.default:void 0;function eI8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new _8(yZ.unknownCommand(Y),1,q)}}var qV6=null;function ML5(){return qV6}function Du(J){return{...J,getThreadEnvironment:i61,vfs:nI0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new bx(J.fileSystem),generateThreadTitle:ml0,deleteThread:(Q)=>J.threadService.delete(Q)}}var rx1=i0.file(nI8.homedir()),VV6=process.env.XDG_CONFIG_HOME?i0.file(process.env.XDG_CONFIG_HOME):s0.joinPath(rx1,".config");async function uq(J,Q){XN0("0.0.1764446481-g6c75f9");let Y=Gq1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:X0.of([i0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:rx1,userConfigDir:VV6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (J51(),e91));X(Y);let G=await Y.getLatest();h.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let{toolService:Z,dispose:q}=V16({configService:Y}),V=new Map,K=()=>V.clear(),W=new ZU1(Y,J.settings.getWorkspaceRootPath()),H=JI0({configService:Y,trustStore:W,createOAuthProvider:async(n)=>{let u=V.get(n);if(u)return h.debug("Reusing existing OAuth provider for server",{serverName:n}),u;h.debug("Creating OAuth provider for server",{serverName:n});let s=(async()=>{let H1=new dM(J.secrets),W1=await H1.getClientInfo(n),o=new TF1({storage:H1,serverName:n,clientId:W1?.clientId,clientSecret:W1?.clientSecret,scopes:W1?.scopes});return h.debug("OAuth provider created",{serverName:n,hasManualClientId:!!W1?.clientId,willUseDCR:!W1?.clientId}),o})();return V.set(n,s),s}}),z=l01({configService:Y,filesystem:B5,spawn:yA}),{initializeToolProviders:U}=await Promise.resolve().then(() => (YV6(),QV6)),{registrations:N,initErrors:M}=await U({toolService:Z,providers:[H,z],initialTimeout:J.executeMode?15000:5000});for(let[n,u]of M)h.warn(`${n} provider initialization slow or failed:`,u);if(Q.jetbrains)zI("JetBrains");else if(Q.ide&&z56())zI("VS Code");else if(Q.ide&&F56())zI("Neovim");if(J.executeMode)GN0(!0);let L,A=N2.status.pipe(q6((n)=>Boolean(n.connected&&n.authenticated)),v4()).subscribe((n)=>{if(n){if(!L)L=Z.registerTool(ns0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new X41(process.cwd(),{},!0);else E=new class extends X41{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(h5.write(`No API key found. Starting login flow...
4869
4869
  `),!await JP8(J))await JO(),process.exit(1)}let P=await IR0({isDevelopment:!1}),I=new qI1(P,Y),T=new YI1(P,{lazy:!0}),S=new BU1(I,(n,u)=>{let s=A3.get(n);if(s)s.handle(u).catch((H1)=>{h.error("Failed to apply artifact delta",H1)})}),y=Q.notifications!==void 0?Q.notifications:!J.executeMode,x=W16({playNotificationSound:async(n)=>{if(y){K16(n);let u=rC1(),s=sC1();if((!u||s)&&G.settings["notifications.system.enabled"]!==!1){if(n==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(n==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:I,configService:Y});h.info("Starting Amp background services");let g=pl0({threadService:I,threadHistoryService:T,configService:Y,isExtensionDevelopment:!1}),p;N2.status.subscribe((n)=>{p=n});let b=new pZ1({workspaceRoots:[i0.file(process.cwd())],getCurrentFile:()=>{if(!p?.openFile)return;try{return i0.parse(p.openFile)}catch(n){h.warn("Failed to parse current file URI",{uri:p.openFile,error:n});return}},getOpenFiles:()=>{if(!p?.visibleFiles?.length)return[];let n=p.openFile;return p.visibleFiles.filter((u)=>u!==n).map((u)=>{try{return i0.parse(u)}catch(s){return h.warn("Failed to parse visible file URI",{uri:u,error:s}),null}}).filter((u)=>u!==null)}}),l=new Jj1,J1={codebaseContextService:b,configService:Y,toolService:Z,mcpService:H,trustStore:W,threadService:I,threadHistoryService:T,threadSyncService:g,planFileManager:S,threadStorage:P,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:E,notificationService:x,fileSystem:Q.jetbrains||Q.ide?cI0:B5,terminal:l};return{...J1,async asyncDispose(){if(J1.mcpService.hasAuthenticatingClients())h.info("Waiting for OAuth authentication to complete before exit..."),await J1.mcpService.waitForAuthentication();for(let n of N.values())n.dispose();await J1.mcpService.dispose(),K(),await J1.threadService.asyncDispose(),J1.configService.unsubscribe(),q(),J1.fuzzyServer.dispose(),J1.threadSyncService.dispose(),J1.settingsStorage[Symbol.dispose](),A.unsubscribe(),L?.dispose()}}}async function JP8(J){if(!J.executeMode){if(!await CC1("Would you like to log in to Amp? [(y)es, (n)o]: "))return h5.write(`Login cancelled. Run the command again to retry.
4870
4870
  `),!1}return await KV6(J)}async function KV6(J){let Q=cI8(32).toString("hex"),Y=await TC1(J.ampURL,Q),X=new AbortController;try{await SE(Y,X.signal)}catch(Z){h.error("Error opening browser",{error:Z})}let G=await TC1(J.ampURL,Q,!1);h5.write(`If your browser does not open automatically, visit:
4871
4871
 
@@ -4875,7 +4875,7 @@ ${h4.blue.bold(G)}
4875
4875
  Login successful! You can now use the Amp CLI.
4876
4876
  `),!0}catch(Z){return h.error("Login failed",{error:Z}),rZ.write(`
4877
4877
  Login failed: ${Z instanceof Error?Z.message:String(Z)}
4878
- `),!1}}function QP8(){let J=new pA().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)tT(),process.exit(0);let z=H.originalError??H;$96(z)}),J.option("-V, --version","Print the version number and exit",()=>{h5.write(`0.0.1764417684-g51a9e4 (released 2025-11-29T12:06:44.365Z)
4878
+ `),!1}}function QP8(){let J=new pA().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)tT(),process.exit(0);let z=H.originalError??H;$96(z)}),J.option("-V, --version","Print the version number and exit",()=>{h5.write(`0.0.1764446481-g6c75f9 (released 2025-11-29T20:06:46.719Z)
4879
4879
  `),process.exit(0)}),J.addHelpText("after",K56()),J.configureHelp({formatHelp:W56}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await QY(U);await ZP8(N)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await QY(U);await GP8(N,await NC1(U,N.settings))});let Q=async(H,z,U)=>{Gq1({storage:z.settings,secretStorage:z.secrets,workspaceRoots:X0.of([i0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:rx1,userConfigDir:VV6});let N={...z,executeMode:!1};await ax1(N,{...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,z)=>{let U=z.optsWithGlobals(),N=await QY(U);await ZV6(U,N,z)});Y.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await QY(U);await zP8(U,N,z)}),Y.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await QY(N);if(z.pick)rZ.write(`${h4.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
4880
4880
  `);if(z.last||H||M.executeMode)await HP8(N,M,H,U);else await Q(N,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,z,U)=>{let N=U.optsWithGlobals(),M=await QY(N);await WP8(N,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,z)=>{let U=z.optsWithGlobals(),N=await QY(U);await ZV6(U,N,z)}),Y.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, unlisted, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await QY(N);await KP8(N,M,H,U,z.support)}),Y.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(H,z,U,N)=>{let M=N.optsWithGlobals(),L=await QY(M);await $P8(M,L,H,z,N)}),Y.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await QY(N);await qP8(N,M,H,U)}),Y.command("replay <threadId>").alias("p").summary("Replay a thread").description("Replay a thread by downloading it and playing through all interactions. User messages are simulated with variable typing speed.").option("--wpm <wpm>","Typing speed in words per minute (default: 120)","120").option("--no-typing","Disable typing simulation and display messages instantly").option("--message-delay <ms>","Delay between messages in milliseconds (default: 1000)","1000").option("--tool-progress-delay <ms>","Delay to show tool in-progress state in milliseconds (default: 800)","800").option("--exit-delay <seconds>","Delay in seconds before exiting after replay completes (default: 3)","3").option("--no-indicator","Hide the replay progress indicator").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await QY(N);await VP8(N,M,H,z,U)}),Z26(J,async(H,z)=>{let U=await QY(z);mq(H,z);let N=await uq(U,z);return{context:U,mcpService:N.mcpService,toolService:N.toolService,toolServices:N.toolService,configService:N.configService,cleanupTerminal:tT,asyncDispose:N.asyncDispose.bind(N)}}),n56(J,async(H)=>{let z=H.optsWithGlobals();return await QY(z)}),h56(J,async(H)=>{let z=await QY(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(U)=>{mq(U,H);let N=await uq(z,H);return{mcpService:N.mcpService,settings:z.settings,asyncDispose:N.asyncDispose.bind(N)}}}});function G(H,z,U){let M=typeof H.description==="string"?H.description:U===void 0?H.description(!0):H.description(U),L=new lB(z,M),A=tI8(H);if(A)L.default(A);if(L.hidden=rI8(H)||GV6(H),"choices"in H)L.choices([...H.choices]);return L}for(let H of XV6)switch(H.type){case"flag":{J.addOption(G(H,`--${H.long}`)),J.addOption(G(H,`--no-${H.long}`,!1));break}case"switch":{J.addOption(G(H,`--${H.long}`,!0));break}default:{J.addOption(G(H,`${"short"in H?`-${H.short}, `:""}--${H.long} <value>`));break}}let Z=new lB("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(Z);let q=new lB("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let V=new lB("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);J.addOption(V);let K=new lB("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(K);let W=new lB("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(W),process.env.AMP_CONNECT==="1"){let H=new lB("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(H)}return J.action(async(H,z)=>{let U=H,N=await QY(U);if(z.getOptionValueSourceWithGlobals("tryOpus")==="cli")h5.write(h4.yellow(`Opus 4.5 is now the default in Amp's smart mode. Rerun without --try-opus.
4881
4881
  `)),process.exit(0);if(Object.keys(U).forEach((M)=>{let L=XV6.find((A)=>A.name===M);if(L&&GV6(L)&&!sI8(L))rZ.write(h4.yellow(`Warning: '--${M}' flag is deprecated
@@ -4883,8 +4883,8 @@ Login failed: ${Z instanceof Error?Z.message:String(Z)}
4883
4883
  Or pipe via stdin: echo "your message" | amp --execute`);mq(Y,Q);let q=await uq(J,Q);qV6=q;let V=Du(q),K=async(l)=>{let J1=await $V6(l,"utf-8"),n=JSON.parse(J1);if(!h$(n.id))throw new _8(yZ.invalidThreadId);return p51(q,{visibility:X,agentMode:Q.mode,thread:n})},W=async(l)=>{if(!h$(l))throw new _8(yZ.invalidThreadId);try{let[n,u]=await Promise.all([T5.getThreadLinkInfo({thread:l},{config:q.configService}),T5.getUserInfo({},{config:q.configService})]);if(n.ok&&u.ok){let s=n.result.creatorUserID,H1=u.result.id;if(s&&s!==H1&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new _8(`Cannot resume thread created by another user.
4884
4884
 
4885
4885
  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(n){if(n instanceof _8)throw n;h.warn("Failed to validate thread ownership in CLI, allowing to open",{error:n})}let J1=await q.threadService.get(l)??void 0;return h.info(`[fetchAndStartThread] Loaded thread ${l}, agentMode: ${J1?.agentMode??"undefined"}`),p51(q,{visibility:X,agentMode:J1?void 0:Q.mode,thread:J1})},H=async()=>{try{if(Q.threadId)return W(Q.threadId);else return p51(q,{visibility:X})}catch(l){if(l instanceof _8)throw l;throw await bg(l,Q.threadId),Error("handleError should have called process.exit()")}},z=async()=>{return p51(q,{visibility:X})};if(Q.format==="jsonl")rZ.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
4886
- `),await JO(),process.exit(1);if(J.executeMode&&Q.remote)await a56(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)m56(q.mcpService,J.settings),await O96(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,M=!1;if(Q.jetbrains||Q.ide){await OM0();let l=CI({jetbrainsOnly:Q.jetbrains});if(l.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(l.length===1){let J1=l[0];if(J1)N2.selectConfig(J1)}else N=!0}let L=z41("0.0.1764417684-g51a9e4",q.settingsStorage),A=new b11(q.threadStorage),E=X0.of([i0.file(process.cwd())]),P=eZ1(void 0,E),I=new F41(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let T=(async()=>{try{let l=await T5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(l.ok)return h.info("User free tier status:",l),l.result}catch(l){h.error("Failed to fetch free tier status:",l)}})(),S=(async()=>{try{let l=await T5.getUserInfo({},{config:q.configService});if(l.ok)return l.result}catch(l){h.debug("Failed to fetch user workspace info:",l)}})(),[y,x]=await Promise.all([T,S]),g=x?.email,p=g&&(g.endsWith("@sourcegraph.com")||g.endsWith("@ampcode.com")||g==="auth-bypass-user@example.com");if(p)q.toolService.registerTool(rs0);let b=await t56();h.info("Loaded session state:",b),await My1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new r61,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:T5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:N2,connectedClientsService:new _i,commandRegistry:P,mcpService:q.mcpService,mcpTrustHandler:I,showJetBrainsInstaller:M,showIdePicker:N,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:b,freeTierStatus:y,workspace:x?.team??null,features:x?.features??[],isDogfooding:p||!1,threadDependencies:q}),await q.asyncDispose(),process.exit(0)}async function QY(J){if(J.interactive)rZ.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
4887
- `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await n96({...J,workspaceTrust:{current:!0,changes:Wk},getHook:process.env.AMP_URL?(Z,q)=>{if(Z==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let Z=await b56(J.mcpConfig);X=g56(X,Z)}let G=await X.get("url","global");if(!G)G=BY;if(!dF(G))h.info("Targeting custom Amp server",{ampURL:G});return X=wU0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:o56(await NC1(J,X))}}function YP8(J){let Q={};for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X?.startsWith("--")){let Z=X.slice(2).replace(/-([a-z])/g,(V,K)=>K.toUpperCase()),q=J[Y+1];if(q&&!q.startsWith("--"))Q[Z]=q,Y++}}return Q}async function XP8(){let J=YP8(process.argv);if(s86({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),aI8(h),h.info("Starting Amp CLI.",{version:"0.0.1764417684-g51a9e4",buildTimestamp:"2025-11-29T12:06:44.365Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new _8(yZ.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await QP8().parseAsync(process.argv)}sE1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await XP8().catch(bg)});async function GP8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),h5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
4886
+ `),await JO(),process.exit(1);if(J.executeMode&&Q.remote)await a56(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)m56(q.mcpService,J.settings),await O96(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,M=!1;if(Q.jetbrains||Q.ide){await OM0();let l=CI({jetbrainsOnly:Q.jetbrains});if(l.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(l.length===1){let J1=l[0];if(J1)N2.selectConfig(J1)}else N=!0}let L=z41("0.0.1764446481-g6c75f9",q.settingsStorage),A=new b11(q.threadStorage),E=X0.of([i0.file(process.cwd())]),P=eZ1(void 0,E),I=new F41(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let T=(async()=>{try{let l=await T5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(l.ok)return h.info("User free tier status:",l),l.result}catch(l){h.error("Failed to fetch free tier status:",l)}})(),S=(async()=>{try{let l=await T5.getUserInfo({},{config:q.configService});if(l.ok)return l.result}catch(l){h.debug("Failed to fetch user workspace info:",l)}})(),[y,x]=await Promise.all([T,S]),g=x?.email,p=g&&(g.endsWith("@sourcegraph.com")||g.endsWith("@ampcode.com")||g==="auth-bypass-user@example.com");if(p)q.toolService.registerTool(rs0);let b=await t56();h.info("Loaded session state:",b),await My1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new r61,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:T5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:N2,connectedClientsService:new _i,commandRegistry:P,mcpService:q.mcpService,mcpTrustHandler:I,showJetBrainsInstaller:M,showIdePicker:N,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:b,freeTierStatus:y,workspace:x?.team??null,features:x?.features??[],isDogfooding:p||!1,threadDependencies:q}),await q.asyncDispose(),process.exit(0)}async function QY(J){if(J.interactive)rZ.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
4887
+ `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await n96({...J,workspaceTrust:{current:!0,changes:Wk},getHook:process.env.AMP_URL?(Z,q)=>{if(Z==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let Z=await b56(J.mcpConfig);X=g56(X,Z)}let G=await X.get("url","global");if(!G)G=BY;if(!dF(G))h.info("Targeting custom Amp server",{ampURL:G});return X=wU0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:o56(await NC1(J,X))}}function YP8(J){let Q={};for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X?.startsWith("--")){let Z=X.slice(2).replace(/-([a-z])/g,(V,K)=>K.toUpperCase()),q=J[Y+1];if(q&&!q.startsWith("--"))Q[Z]=q,Y++}}return Q}async function XP8(){let J=YP8(process.argv);if(s86({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),aI8(h),h.info("Starting Amp CLI.",{version:"0.0.1764446481-g6c75f9",buildTimestamp:"2025-11-29T20:06:46.719Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new _8(yZ.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await QP8().parseAsync(process.argv)}sE1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await XP8().catch(bg)});async function GP8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),h5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
4888
4888
  `);else if(!dF(J.ampURL))h5.write(`Logging in to ${new URL(J.ampURL).hostname}
4889
4889
  `);let Y=process.env.AMP_API_KEY;if(Y)h5.write(`API key found in environment variable, storing...
4890
4890
  `),await Q.set("apiKey",Y,J.ampURL),h5.write(`API key successfully stored.
@@ -4897,7 +4897,7 @@ This thread belongs to a different user and cannot be continued for security rea
4897
4897
  `);else h5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
4898
4898
  `);process.exit(0)}async function $P8(J,Q,Y,X,G){mq(G,J);let Z=await uq(Q,J);try{let q=d51(Y);if(!q)c51(Y);let V=q,K=X.trim();if(K.length===0)oZ("Thread name cannot be empty");if(K.length>256)oZ("Thread name cannot exceed 256 characters");if(!(await Hj(V,Z)).messages.length)oZ("Cannot rename an empty thread.");let H=Du(Z);await(await A3.getOrCreateForThread(H,V)).handle({type:"title",value:K}),h.info("GOT HERE"),await Z.threadSyncService.sync(),h.info("GOT THERE"),h5.write(h4.green(`✓ Thread ${V} renamed to "${K}"
4899
4899
  `)),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose();let V=`Failed to rename thread: ${q instanceof Error?q.message:String(q)}`;oZ(V)}}async function qP8(J,Q,Y,X){mq(X,J);let G=await uq(Q,J);try{let Z=d51(Y);if(!Z)c51(Y);let V=await Hj(Z,G),K=LT(V);h5.write(K+`
4900
- `),await G.asyncDispose(),process.exit(0)}catch(Z){await G.asyncDispose();let q=`Failed to render thread as markdown: ${Z instanceof Error?Z.message:String(Z)}`;oZ(q)}}async function VP8(J,Q,Y,X,G){mq(G,J);let Z=await uq(Q,J);try{let q=await sx1(Y),V=await Hj(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,M=Du(Z),L=V.id;await Z.threadStorage.set(L,V);let A=await A3.getOrCreateForThread(M,L);await A.resume();let E=h11.fromWorker(A),P=new b11(Z.threadStorage),I=X0.of([i0.file(process.cwd())]),T=eZ1(void 0,I),S=new F41(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=z41("0.0.1764417684-g51a9e4",Z.settingsStorage);await My1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new r61,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:L,threadFuzzyIndexer:P,worker:E,workerDeps:M,configService:Z.configService,internalAPIClient:T5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:N2,connectedClientsService:new _i,commandRegistry:T,mcpService:Z.mcpService,mcpTrustHandler:S,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:N}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await bg(q,Y)}}async function KP8(J,Q,Y,X,G){mq(X,J);let Z=await uq(Q,J);try{let q=d51(Y);if(!q)c51(Y);let V=q,K=await T5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=U41(J,W);if(!H&&!G)oZ("Must specify either --visibility or --support");if(H&&G)oZ("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)oZ(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,B41(H)),h5.write(h4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
4900
+ `),await G.asyncDispose(),process.exit(0)}catch(Z){await G.asyncDispose();let q=`Failed to render thread as markdown: ${Z instanceof Error?Z.message:String(Z)}`;oZ(q)}}async function VP8(J,Q,Y,X,G){mq(G,J);let Z=await uq(Q,J);try{let q=await sx1(Y),V=await Hj(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,M=Du(Z),L=V.id;await Z.threadStorage.set(L,V);let A=await A3.getOrCreateForThread(M,L);await A.resume();let E=h11.fromWorker(A),P=new b11(Z.threadStorage),I=X0.of([i0.file(process.cwd())]),T=eZ1(void 0,I),S=new F41(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=z41("0.0.1764446481-g6c75f9",Z.settingsStorage);await My1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new r61,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:L,threadFuzzyIndexer:P,worker:E,workerDeps:M,configService:Z.configService,internalAPIClient:T5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:N2,connectedClientsService:new _i,commandRegistry:T,mcpService:Z.mcpService,mcpTrustHandler:S,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:N}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await bg(q,Y)}}async function KP8(J,Q,Y,X,G){mq(X,J);let Z=await uq(Q,J);try{let q=d51(Y);if(!q)c51(Y);let V=q,K=await T5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=U41(J,W);if(!H&&!G)oZ("Must specify either --visibility or --support");if(H&&G)oZ("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)oZ(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,B41(H)),h5.write(h4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
4901
4901
  `);if(G){await Hj(V,Z);let z=typeof G==="string"?G:void 0;await MR0(Z.threadService,V,Z.configService,z),h5.write(h4.green("✓ ")+`Thread ${V} has been shared with Amp support. These thread reports will be aggregated and analysed.
4902
4902
  `)}await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),oZ(`Failed to update thread: ${q instanceof Error?q.message:String(q)}`)}}async function WP8(J,Q,Y,X){mq(X,J);let G=await uq(Q,J),Z=Du(G);try{let q=await sx1(Y),K=(await Hj(q,G)).messages.length-1,W=await A3.getOrCreateForThread(Z,q),H=await AT(W,G.threadSyncService,K);await Promise.all([G.threadSyncService.uploadThread(q),G.threadSyncService.uploadThread(H)]),await ox1(H),h5.write(`${H}
4903
4903
  `),await G.asyncDispose(),process.exit(0)}catch(q){rZ.write(`Error forking thread: ${q instanceof Error?q.message:String(q)}