@sourcegraph/amp 0.0.1763913676-g4c6d64 → 0.0.1763928079-g29218b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +10 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -45,7 +45,7 @@ ${q}`.trim()}_serializeSingularDataPoint(J,Q,Y){let X="";J=wX1(J,Q);let{value:G,
|
|
|
45
45
|
${X}
|
|
46
46
|
${G}
|
|
47
47
|
`}}gW0.PrometheusSerializer=uW0});var cW0=f((pW0)=>{Object.defineProperty(pW0,"__esModule",{value:!0});pW0.PrometheusExporter=void 0;var __=j6(),f34=Q8(),PX1=ND(),h34=S1("http"),b34=IX1(),u34=S1("url");class jW extends PX1.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:PX1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(G)=>PX1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||jW.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||jW.DEFAULT_OPTIONS.port,this._prefix=J.prefix||jW.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:jW.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||jW.DEFAULT_OPTIONS.withResourceConstantLabels,X=J.withoutTargetInfo||jW.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,h34.createServer)(this._requestHandler).unref(),this._serializer=new b34.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,X),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||jW.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(G)=>{__.diag.error(G),Q(G)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return __.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)__.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,f34.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},()=>{__.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 u34.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)__.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()}}pW0.PrometheusExporter=jW});var lW0=f((ac)=>{Object.defineProperty(ac,"__esModule",{value:!0});ac.PrometheusSerializer=ac.PrometheusExporter=void 0;var g34=cW0();Object.defineProperty(ac,"PrometheusExporter",{enumerable:!0,get:function(){return g34.PrometheusExporter}});var m34=IX1();Object.defineProperty(ac,"PrometheusSerializer",{enumerable:!0,get:function(){return m34.PrometheusSerializer}})});var oW0=f((aW0)=>{Object.defineProperty(aW0,"__esModule",{value:!0});aW0.OTLPTraceExporter=void 0;var d34=sq(),c34=XZ(),iW0=LW();class nW0 extends d34.OTLPExporterBase{constructor(J={}){super((0,iW0.createOtlpHttpExportDelegate)((0,iW0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),c34.ProtobufTraceSerializer))}}aW0.OTLPTraceExporter=nW0});var sW0=f((TX1)=>{Object.defineProperty(TX1,"__esModule",{value:!0});TX1.OTLPTraceExporter=void 0;var l34=oW0();Object.defineProperty(TX1,"OTLPTraceExporter",{enumerable:!0,get:function(){return l34.OTLPTraceExporter}})});var tW0=f((RX1)=>{Object.defineProperty(RX1,"__esModule",{value:!0});RX1.OTLPTraceExporter=void 0;var n34=sW0();Object.defineProperty(RX1,"OTLPTraceExporter",{enumerable:!0,get:function(){return n34.OTLPTraceExporter}})});var eW0=f((CX1)=>{Object.defineProperty(CX1,"__esModule",{value:!0});CX1.OTLPTraceExporter=void 0;var r34=tW0();Object.defineProperty(CX1,"OTLPTraceExporter",{enumerable:!0,get:function(){return r34.OTLPTraceExporter}})});var XH0=f((YH0)=>{Object.defineProperty(YH0,"__esModule",{value:!0});YH0.OTLPTraceExporter=void 0;var s34=sq(),t34=XZ(),JH0=LW();class QH0 extends s34.OTLPExporterBase{constructor(J={}){super((0,JH0.createOtlpHttpExportDelegate)((0,JH0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),t34.JsonTraceSerializer))}}YH0.OTLPTraceExporter=QH0});var GH0=f((SX1)=>{Object.defineProperty(SX1,"__esModule",{value:!0});SX1.OTLPTraceExporter=void 0;var e34=XH0();Object.defineProperty(SX1,"OTLPTraceExporter",{enumerable:!0,get:function(){return e34.OTLPTraceExporter}})});var ZH0=f((jX1)=>{Object.defineProperty(jX1,"__esModule",{value:!0});jX1.OTLPTraceExporter=void 0;var QJ4=GH0();Object.defineProperty(jX1,"OTLPTraceExporter",{enumerable:!0,get:function(){return QJ4.OTLPTraceExporter}})});var qH0=f((_X1)=>{Object.defineProperty(_X1,"__esModule",{value:!0});_X1.OTLPTraceExporter=void 0;var $J4=ZH0();Object.defineProperty(_X1,"OTLPTraceExporter",{enumerable:!0,get:function(){return $J4.OTLPTraceExporter}})});var zH0=f((WH0)=>{Object.defineProperty(WH0,"__esModule",{value:!0});WH0.OTLPTraceExporter=void 0;var VH0=pc(),GJ4=XZ(),ZJ4=sq();class KH0 extends ZJ4.OTLPExporterBase{constructor(J={}){super((0,VH0.createOtlpGrpcExportDelegate)((0,VH0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),GJ4.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}WH0.OTLPTraceExporter=KH0});var FH0=f((kX1)=>{Object.defineProperty(kX1,"__esModule",{value:!0});kX1.OTLPTraceExporter=void 0;var qJ4=zH0();Object.defineProperty(kX1,"OTLPTraceExporter",{enumerable:!0,get:function(){return qJ4.OTLPTraceExporter}})});var NH0=f((UH0)=>{Object.defineProperty(UH0,"__esModule",{value:!0});UH0.prepareSend=void 0;var yX1=j6(),rc=Q8(),KJ4=S1("http"),WJ4=S1("https");function HJ4(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 yX1.diag.debug("Zipkin send with empty spans"),q({code:rc.ExportResultCode.SUCCESS});let{request:V}=Y.protocol==="http:"?KJ4:WJ4,K=V(Y,X,(H)=>{let z="";H.on("data",(U)=>{z+=U}),H.on("end",()=>{let U=H.statusCode||0;if(yX1.diag.debug(`Zipkin response status code: ${U}, body: ${z}`),U<400)return q({code:rc.ExportResultCode.SUCCESS});else return q({code:rc.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${U}`)})})});K.on("error",(H)=>{return q({code:rc.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(Z);yX1.diag.debug(`Zipkin request payload: ${W}`),K.write(W,"utf8"),K.end()}}UH0.prepareSend=HJ4});var DH0=f((vX1)=>{Object.defineProperty(vX1,"__esModule",{value:!0});vX1.prepareSend=void 0;var zJ4=NH0();Object.defineProperty(vX1,"prepareSend",{enumerable:!0,get:function(){return zJ4.prepareSend}})});var fX1=f((xX1)=>{Object.defineProperty(xX1,"__esModule",{value:!0});xX1.prepareSend=void 0;var UJ4=DH0();Object.defineProperty(xX1,"prepareSend",{enumerable:!0,get:function(){return UJ4.prepareSend}})});var MH0=f((OH0)=>{Object.defineProperty(OH0,"__esModule",{value:!0});OH0.SpanKind=void 0;var NJ4;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(NJ4=OH0.SpanKind||(OH0.SpanKind={}))});var IH0=f((wH0)=>{Object.defineProperty(wH0,"__esModule",{value:!0});wH0._toZipkinAnnotations=wH0._toZipkinTags=wH0.toZipkinSpan=wH0.defaultStatusErrorTagName=wH0.defaultStatusCodeTagName=void 0;var BF=j6(),bX1=Q8(),oc=MH0(),DJ4={[BF.SpanKind.CLIENT]:oc.SpanKind.CLIENT,[BF.SpanKind.SERVER]:oc.SpanKind.SERVER,[BF.SpanKind.CONSUMER]:oc.SpanKind.CONSUMER,[BF.SpanKind.PRODUCER]:oc.SpanKind.PRODUCER,[BF.SpanKind.INTERNAL]:void 0};wH0.defaultStatusCodeTagName="otel.status_code";wH0.defaultStatusErrorTagName="error";function OJ4(J,Q,Y,X){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:DJ4[J.kind],timestamp:(0,bX1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,bX1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:LH0(J,Y,X),annotations:J.events.length?AH0(J.events):void 0}}wH0.toZipkinSpan=OJ4;function LH0({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!==BF.SpanStatusCode.UNSET)K[q]=String(BF.SpanStatusCode[Y.code]);if(Y.code===BF.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}wH0._toZipkinTags=LH0;function AH0(J){return J.map((Q)=>({timestamp:Math.round((0,bX1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}wH0._toZipkinAnnotations=AH0});var RH0=f((PH0)=>{Object.defineProperty(PH0,"__esModule",{value:!0});PH0.prepareGetHeaders=void 0;function EJ4(J){return function(){return J()}}PH0.prepareGetHeaders=EJ4});var vH0=f((kH0)=>{Object.defineProperty(kH0,"__esModule",{value:!0});kH0.ZipkinExporter=void 0;var CH0=j6(),SH0=Q8(),jH0=fX1(),uX1=IH0(),gX1=nz(),IJ4=RH0();class _H0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,SH0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,jH0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||uX1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||uX1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,IJ4.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[gX1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(CH0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:SH0.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 CH0.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,jH0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let X=J.map((G)=>(0,uX1.toZipkinSpan)(G,String(G.attributes[gX1.ATTR_SERVICE_NAME]||G.resource.attributes[gX1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(X,(G)=>{if(Y)return Y(G)})}}kH0.ZipkinExporter=_H0});var xH0=f((sc)=>{Object.defineProperty(sc,"__esModule",{value:!0});sc.ZipkinExporter=sc.prepareSend=void 0;var PJ4=fX1();Object.defineProperty(sc,"prepareSend",{enumerable:!0,get:function(){return PJ4.prepareSend}});var TJ4=vH0();Object.defineProperty(sc,"ZipkinExporter",{enumerable:!0,get:function(){return TJ4.ZipkinExporter}})});var mX1=f((fH0)=>{Object.defineProperty(fH0,"__esModule",{value:!0});fH0.B3_DEBUG_FLAG_KEY=void 0;var CJ4=j6();fH0.B3_DEBUG_FLAG_KEY=(0,CJ4.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var k_=f((bH0)=>{Object.defineProperty(bH0,"__esModule",{value:!0});bH0.X_B3_FLAGS=bH0.X_B3_PARENT_SPAN_ID=bH0.X_B3_SAMPLED=bH0.X_B3_SPAN_ID=bH0.X_B3_TRACE_ID=bH0.B3_CONTEXT_HEADER=void 0;bH0.B3_CONTEXT_HEADER="b3";bH0.X_B3_TRACE_ID="x-b3-traceid";bH0.X_B3_SPAN_ID="x-b3-spanid";bH0.X_B3_SAMPLED="x-b3-sampled";bH0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";bH0.X_B3_FLAGS="x-b3-flags"});var lH0=f((dH0)=>{Object.defineProperty(dH0,"__esModule",{value:!0});dH0.B3MultiPropagator=void 0;var FZ=j6(),vJ4=Q8(),gH0=mX1(),Z$=k_(),xJ4=new Set([!0,"true","True","1",1]),fJ4=new Set([!1,"false","False","0",0]);function hJ4(J){return J===FZ.TraceFlags.SAMPLED||J===FZ.TraceFlags.NONE}function bJ4(J){return Array.isArray(J)?J[0]:J}function tc(J,Q,Y){let X=Q.get(J,Y);return bJ4(X)}function uJ4(J,Q){let Y=tc(J,Q,Z$.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function gJ4(J,Q){let Y=tc(J,Q,Z$.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function mH0(J,Q){return tc(J,Q,Z$.X_B3_FLAGS)==="1"?"1":void 0}function mJ4(J,Q){let Y=tc(J,Q,Z$.X_B3_SAMPLED);if(mH0(J,Q)==="1"||xJ4.has(Y))return FZ.TraceFlags.SAMPLED;if(Y===void 0||fJ4.has(Y))return FZ.TraceFlags.NONE;return}class pH0{inject(J,Q,Y){let X=FZ.trace.getSpanContext(J);if(!X||!(0,FZ.isSpanContextValid)(X)||(0,vJ4.isTracingSuppressed)(J))return;let G=J.getValue(gH0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,Z$.X_B3_TRACE_ID,X.traceId),Y.set(Q,Z$.X_B3_SPAN_ID,X.spanId),G==="1")Y.set(Q,Z$.X_B3_FLAGS,G);else if(X.traceFlags!==void 0)Y.set(Q,Z$.X_B3_SAMPLED,(FZ.TraceFlags.SAMPLED&X.traceFlags)===FZ.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let X=uJ4(Q,Y),G=gJ4(Q,Y),Z=mJ4(Q,Y),q=mH0(Q,Y);if((0,FZ.isValidTraceId)(X)&&(0,FZ.isValidSpanId)(G)&&hJ4(Z))return J=J.setValue(gH0.B3_DEBUG_FLAG_KEY,q),FZ.trace.setSpanContext(J,{traceId:X,spanId:G,isRemote:!0,traceFlags:Z});return J}fields(){return[Z$.X_B3_TRACE_ID,Z$.X_B3_SPAN_ID,Z$.X_B3_FLAGS,Z$.X_B3_SAMPLED,Z$.X_B3_PARENT_SPAN_ID]}}dH0.B3MultiPropagator=pH0});var oH0=f((aH0)=>{Object.defineProperty(aH0,"__esModule",{value:!0});aH0.B3SinglePropagator=void 0;var hD=j6(),pJ4=Q8(),iH0=mX1(),pX1=k_(),dJ4=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,cJ4="0".repeat(16),lJ4=new Set(["d","1"]),iJ4="d";function nJ4(J){return J.length===32?J:`${cJ4}${J}`}function aJ4(J){if(J&&lJ4.has(J))return hD.TraceFlags.SAMPLED;return hD.TraceFlags.NONE}class nH0{inject(J,Q,Y){let X=hD.trace.getSpanContext(J);if(!X||!(0,hD.isSpanContextValid)(X)||(0,pJ4.isTracingSuppressed)(J))return;let G=J.getValue(iH0.B3_DEBUG_FLAG_KEY)||X.traceFlags&1,Z=`${X.traceId}-${X.spanId}-${G}`;Y.set(Q,pX1.B3_CONTEXT_HEADER,Z)}extract(J,Q,Y){let X=Y.get(Q,pX1.B3_CONTEXT_HEADER),G=Array.isArray(X)?X[0]:X;if(typeof G!=="string")return J;let Z=G.match(dJ4);if(!Z)return J;let[,q,V,K]=Z,W=nJ4(q);if(!(0,hD.isValidTraceId)(W)||!(0,hD.isValidSpanId)(V))return J;let H=aJ4(K);if(K===iJ4)J=J.setValue(iH0.B3_DEBUG_FLAG_KEY,K);return hD.trace.setSpanContext(J,{traceId:W,spanId:V,isRemote:!0,traceFlags:H})}fields(){return[pX1.B3_CONTEXT_HEADER]}}aH0.B3SinglePropagator=nH0});var cX1=f((sH0)=>{Object.defineProperty(sH0,"__esModule",{value:!0});sH0.B3InjectEncoding=void 0;var rJ4;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(rJ4=sH0.B3InjectEncoding||(sH0.B3InjectEncoding={}))});var Qz0=f((eH0)=>{Object.defineProperty(eH0,"__esModule",{value:!0});eH0.B3Propagator=void 0;var oJ4=Q8(),sJ4=lH0(),tJ4=oH0(),eJ4=k_(),JQ4=cX1();class tH0{_b3MultiPropagator=new sJ4.B3MultiPropagator;_b3SinglePropagator=new tJ4.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===JQ4.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,oJ4.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let X=Y.get(Q,eJ4.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}}eH0.B3Propagator=tH0});var Yz0=f((zV)=>{Object.defineProperty(zV,"__esModule",{value:!0});zV.B3InjectEncoding=zV.X_B3_TRACE_ID=zV.X_B3_SPAN_ID=zV.X_B3_SAMPLED=zV.X_B3_PARENT_SPAN_ID=zV.X_B3_FLAGS=zV.B3_CONTEXT_HEADER=zV.B3Propagator=void 0;var QQ4=Qz0();Object.defineProperty(zV,"B3Propagator",{enumerable:!0,get:function(){return QQ4.B3Propagator}});var WE=k_();Object.defineProperty(zV,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return WE.B3_CONTEXT_HEADER}});Object.defineProperty(zV,"X_B3_FLAGS",{enumerable:!0,get:function(){return WE.X_B3_FLAGS}});Object.defineProperty(zV,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return WE.X_B3_PARENT_SPAN_ID}});Object.defineProperty(zV,"X_B3_SAMPLED",{enumerable:!0,get:function(){return WE.X_B3_SAMPLED}});Object.defineProperty(zV,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return WE.X_B3_SPAN_ID}});Object.defineProperty(zV,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return WE.X_B3_TRACE_ID}});var YQ4=cX1();Object.defineProperty(zV,"B3InjectEncoding",{enumerable:!0,get:function(){return YQ4.B3InjectEncoding}})});var qz0=f((Xz0)=>{Object.defineProperty(Xz0,"__esModule",{value:!0});Xz0.JaegerPropagator=Xz0.UBER_BAGGAGE_HEADER_PREFIX=Xz0.UBER_TRACE_ID_HEADER=void 0;var bD=j6(),XQ4=Q8();Xz0.UBER_TRACE_ID_HEADER="uber-trace-id";Xz0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class $z0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=Xz0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||Xz0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||Xz0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let X=bD.trace.getSpanContext(J),G=bD.propagation.getBaggage(J);if(X&&(0,XQ4.isTracingSuppressed)(J)===!1){let Z=`0${(X.traceFlags||bD.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=ZQ4(G);if(K)q=bD.trace.setSpanContext(q,K)}if(Z.length===0)return q;let V=bD.propagation.getBaggage(J)??bD.propagation.createBaggage();for(let K of Z){if(K.value===void 0)continue;V=V.setEntry(K.key,{value:decodeURIComponent(K.value)})}return q=bD.propagation.setBaggage(q,V),q}fields(){return[this._jaegerTraceHeader]}}Xz0.JaegerPropagator=$z0;var GQ4=/^[0-9a-f]{1,2}$/i;function ZQ4(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=GQ4.test(G)?parseInt(G,16)&1:1;return{traceId:Z,spanId:q,isRemote:!0,traceFlags:V}}});var Vz0=f((y_)=>{Object.defineProperty(y_,"__esModule",{value:!0});y_.UBER_TRACE_ID_HEADER=y_.UBER_BAGGAGE_HEADER_PREFIX=y_.JaegerPropagator=void 0;var iX1=qz0();Object.defineProperty(y_,"JaegerPropagator",{enumerable:!0,get:function(){return iX1.JaegerPropagator}});Object.defineProperty(y_,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return iX1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(y_,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return iX1.UBER_TRACE_ID_HEADER}})});var Uz0=f((zz0)=>{Object.defineProperty(zz0,"__esModule",{value:!0});zz0.setupPropagator=zz0.setupContextManager=zz0.getPropagatorFromEnv=zz0.getSpanProcessorsFromEnv=zz0.getOtlpProtocolFromEnv=zz0.filterBlanksAndNulls=zz0.getResourceDetectorsFromEnv=void 0;var fX=j6(),UZ=Q8(),Kz0=eW0(),VQ4=qH0(),KQ4=FH0(),WQ4=xH0(),v_=zD(),ec=MD(),nX1=Yz0(),HQ4=Vz0(),zQ4=pm(),FQ4="env",UQ4="host",BQ4="os",NQ4="process",DQ4="serviceinstance";function OQ4(){let J=new Map([[FQ4,v_.envDetector],[UQ4,v_.hostDetector],[BQ4,v_.osDetector],[DQ4,v_.serviceInstanceIdDetector],[NQ4,v_.processDetector]]),Q=(0,UZ.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)fX.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return X||[]})}zz0.getResourceDetectorsFromEnv=OQ4;function Wz0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}zz0.filterBlanksAndNulls=Wz0;function Hz0(){return(0,UZ.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,UZ.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}zz0.getOtlpProtocolFromEnv=Hz0;function MQ4(){let J=Hz0();switch(J){case"grpc":return new KQ4.OTLPTraceExporter;case"http/json":return new VQ4.OTLPTraceExporter;case"http/protobuf":return new Kz0.OTLPTraceExporter;default:return fX.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new Kz0.OTLPTraceExporter}}function LQ4(){let J=new Map([["otlp",()=>MQ4()],["zipkin",()=>new WQ4.ZipkinExporter],["console",()=>new ec.ConsoleSpanExporter]]),Q=[],Y=[],X=Wz0(Array.from(new Set((0,UZ.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(X[0]==="none")return fX.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(X.length===0)fX.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),X=["otlp"];else if(X.length>1&&X.includes("none"))fX.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 fX.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${G}.`)}for(let G of Q)if(G instanceof ec.ConsoleSpanExporter)Y.push(new ec.SimpleSpanProcessor(G));else Y.push(new ec.BatchSpanProcessor(G));if(Q.length===0)fX.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}zz0.getSpanProcessorsFromEnv=LQ4;function AQ4(){let J=(0,UZ.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new UZ.W3CTraceContextPropagator],["baggage",()=>new UZ.W3CBaggagePropagator],["b3",()=>new nX1.B3Propagator],["b3multi",()=>new nX1.B3Propagator({injectEncoding:nX1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new HQ4.JaegerPropagator]]),Y=Array.from(new Set(J)),G=Y.map((Z)=>{let q=Q.get(Z)?.();if(!q){fX.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 UZ.CompositePropagator({propagators:G})}zz0.getPropagatorFromEnv=AQ4;function wQ4(J){if(J===null)return;if(J===void 0){let Q=new zQ4.AsyncLocalStorageContextManager;Q.enable(),fX.context.setGlobalContextManager(Q);return}J.enable(),fX.context.setGlobalContextManager(J)}zz0.setupContextManager=wQ4;function EQ4(J){if(J===null)return;if(J===void 0){fX.propagation.setGlobalPropagator(new UZ.CompositePropagator({propagators:[new UZ.W3CTraceContextPropagator,new UZ.W3CBaggagePropagator]}));return}fX.propagation.setGlobalPropagator(J)}zz0.setupPropagator=EQ4});var Lz0=f((Oz0)=>{Object.defineProperty(Oz0,"__esModule",{value:!0});Oz0.NodeSDK=void 0;var pJ=j6(),jQ4=kj(),_Q4=cJ0(),HE=zD(),x_=bJ1(),kQ4=OY0(),yQ4=YW0(),aX1=WW0(),vQ4=CW0(),Bz0=fW0(),xQ4=lc(),fQ4=lW0(),uD=ND(),hQ4=MD(),bQ4=oJ1(),uQ4=nz(),NF=Q8(),f_=Uz0();function Nz0(J,Q){return parseInt(process.env[J]||"")||Q}function gQ4(){let J=[],Q=(0,NF.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)pJ.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return pJ.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=Nz0("OTEL_METRIC_EXPORT_INTERVAL",60000),Z=Nz0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(X){case"grpc":J.push(new uD.PeriodicExportingMetricReader({exporter:new vQ4.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/json":J.push(new uD.PeriodicExportingMetricReader({exporter:new xQ4.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/protobuf":J.push(new uD.PeriodicExportingMetricReader({exporter:new Bz0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;default:pJ.diag.warn(`Unsupported OTLP metrics protocol: "${X}". Using http/protobuf.`),J.push(new uD.PeriodicExportingMetricReader({exporter:new Bz0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}))}}else if(Y==="console")J.push(new uD.PeriodicExportingMetricReader({exporter:new uD.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new fQ4.PrometheusExporter);else pJ.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class Dz0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,NF.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,NF.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)pJ.diag.setLogger(new pJ.DiagConsoleLogger,{logLevel:(0,NF.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,HE.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,NF.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,f_.getResourceDetectorsFromEnv)();else this._resourceDetectors=[HE.envDetector,HE.processDetector,HE.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)pJ.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let X=J.spanProcessor??new hQ4.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]},pJ.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],pJ.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,_Q4.registerInstrumentations)({instrumentations:this._instrumentations}),(0,f_.setupContextManager)(this._configuration?.contextManager),(0,f_.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,f_.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,HE.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,HE.resourceFromAttributes)({[uQ4.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,f_.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new bQ4.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),pJ.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new x_.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,jQ4.logs.setGlobalLoggerProvider(Y)}let Q=gQ4();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 uD.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=X,pJ.metrics.setGlobalMeterProvider(X);for(let G of this._instrumentations)G.setMeterProvider(pJ.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,NF.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)pJ.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){pJ.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,NF.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,NF.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(X){case"grpc":Q.push(new yQ4.OTLPLogExporter);break;case"http/json":Q.push(new kQ4.OTLPLogExporter);break;case"http/protobuf":Q.push(new aX1.OTLPLogExporter);break;case void 0:case"":Q.push(new aX1.OTLPLogExporter);break;default:pJ.diag.warn(`Unsupported OTLP logs protocol: "${X}". Using http/protobuf.`),Q.push(new aX1.OTLPLogExporter)}}else if(Y==="console")Q.push(new x_.ConsoleLogRecordExporter);else pJ.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 x_.ConsoleLogRecordExporter)return new x_.SimpleLogRecordProcessor(Y);else return new x_.BatchLogRecordProcessor(Y)})}}}Oz0.NodeSDK=Dz0});var Az0=f((rX1)=>{Object.defineProperty(rX1,"__esModule",{value:!0});rX1.NodeSDK=rX1.tracing=rX1.resources=rX1.node=rX1.metrics=rX1.logs=rX1.core=rX1.contextBase=rX1.api=void 0;rX1.api=j6();rX1.contextBase=j6();rX1.core=Q8();rX1.logs=bJ1();rX1.metrics=ND();rX1.node=oJ1();rX1.resources=zD();rX1.tracing=MD();var mQ4=Lz0();Object.defineProperty(rX1,"NodeSDK",{enumerable:!0,get:function(){return mQ4.NodeSDK}})});import sQ4 from"os";import Jl from"path";var DF,gD,OF,MF,wz0,Eb8,Ib8,tQ4,eQ4;var zE=G1(()=>{DF=sQ4.homedir(),{env:gD}=process,OF=gD.XDG_DATA_HOME||(DF?Jl.join(DF,".local","share"):void 0),MF=gD.XDG_CONFIG_HOME||(DF?Jl.join(DF,".config"):void 0),wz0=gD.XDG_STATE_HOME||(DF?Jl.join(DF,".local","state"):void 0),Eb8=gD.XDG_CACHE_HOME||(DF?Jl.join(DF,".cache"):void 0),Ib8=gD.XDG_RUNTIME_DIR||void 0,tQ4=(gD.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(OF)tQ4.unshift(OF);eQ4=(gD.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(MF)eQ4.unshift(MF)});import{homedir as Ql}from"node:os";import mD from"node:path";var Ez0,JY4,Iz0,QY4,Yl,YY4,FE,FV,Sb8;var _W=G1(()=>{zE();Ez0=mD.join(Ql(),".local/share"),JY4=process.platform==="win32"||process.platform==="darwin"?Ez0:OF??Ez0,Iz0=mD.join(Ql(),".config"),QY4=process.platform==="win32"||process.platform==="darwin"?Iz0:MF??Iz0,Yl=mD.join(JY4,"amp"),YY4=mD.join(QY4,"amp"),FE=mD.join(YY4,"tools"),FV=mD.join(Ql(),".cache","amp"),Sb8=mD.join(Ql(),".cache","amp","http-debug-logs")});function XY4(){return $Y4}function Pz0(J){let Q=pD;return pD=J,Q}class UV{baseLogger;scope;context={};constructor(J=Tz0){this.baseLogger=J}with(J){let Q=new UV(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new UV(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=oX1.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 oX1,$Y4=!1,GY4,pD,Tz0,x;var H0=G1(()=>{oX1=U6(j6(),1);GY4={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(XY4())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=oX1.trace.getActiveSpan();if(X){let G=X.spanContext();if(G.traceId)Y.traceId=G.traceId,Y.spanId=G.spanId}console.info(J,Y)}},pD=GY4;Tz0={error:(J,...Q)=>pD.error(J,...Q),warn:(J,...Q)=>pD.warn(J,...Q),info:(J,...Q)=>pD.info(J,...Q),debug:(J,...Q)=>pD.debug(J,...Q),audit:(J,...Q)=>pD.audit(J,...Q)};x=Tz0});function yz0(){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 vz0(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&&!FY4.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!UY4.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(BY4.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 NY4(J,Q){if(!J&&!Q)return"file";return J}function DY4(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=BZ;else if(Q[0]!==BZ)Q=BZ+Q;break}return Q}class p0{static isUri(J){if(J instanceof p0)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||v5,this.authority=J.authority||v5,this.path=J.path||v5,this.query=J.query||v5,this.fragment=J.fragment||v5,this.platform=J.platform;else this.scheme=NY4(J,Z),this.authority=Q||v5,this.path=DY4(this.scheme,Y||v5),this.query=X||v5,this.fragment=G||v5,this.platform=q,vz0(this,Z)}get fsPath(){return uz0(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=v5;if(Y===void 0)Y=this.authority;else if(Y===null)Y=v5;if(X===void 0)X=this.path;else if(X===null)X=v5;if(G===void 0)G=this.query;else if(G===null)G=v5;if(Z===void 0)Z=this.fragment;else if(Z===null)Z=v5;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 dD(Q,Y,X,G,Z,!1,q)}static parse(J,Q=!1){let Y=OY4.exec(J);if(!Y)return new dD(v5,v5,v5,v5,v5);return new dD(Y[2]||v5,Xl(Y[4]||v5),Xl(Y[5]||v5),Xl(Y[7]||v5),Xl(Y[9]||v5),Q)}static file(J,Q=yz0()){let Y=v5;if(Q==="windows")J=J.replace(/\\/g,BZ);if(J[0]===BZ&&J[1]===BZ){let X=J.indexOf(BZ,2);if(X===-1)Y=J.substring(2),J=BZ;else Y=J.substring(2,X),J=J.substring(X)||BZ}return new dD("file",Y,J,v5,v5,!1,Q)}static from(J){let Q=new dD(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return vz0(Q,!0),Q}toString(J=!1){return tX1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof p0)return J;let Q=new dD(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===hz0(Q.platform)?Y.fsPath:null,Q}}function hz0(J){return J==="windows"?1:void 0}function xz0(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=bz0[Z];if(q!==void 0)X+=q;else X+=encodeURIComponent(J.charAt(G))}}return X!==void 0?X:J}function MY4(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+=bz0[X]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function uz0(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 tX1(J,Q){let Y=!Q?xz0:MY4,X="",{scheme:G,authority:Z,path:q,query:V,fragment:K}=J;if(G)X+=G,X+=":";if(Z||G==="file")X+=BZ,X+=BZ;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?xz0(K,!1,!1):K;return X}function gz0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+gz0(J.substring(3));else return J}}function Xl(J){if(!J.match(fz0))return J;return J.replace(fz0,(Q)=>gz0(Q))}function LF(J){return J.scheme==="file"}function dJ(J){return p0.parse(J)}function z6(J){return J.toString()}function d4(J){if(typeof J==="string"||J instanceof URL)return p0.parse(J.toString());return J}function b_(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var FY4,UY4,BY4,v5="",BZ="/",OY4,dD,bz0,fz0;var u_=G1(()=>{FY4=/^\w[\w\d+.-]*$/,UY4=/^\//,BY4=/^\/\//;OY4=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;dD=class dD extends p0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=uz0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=tX1(this,!1);return this._formatted}return tX1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=hz0(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}};bz0={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"};fz0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function eX1(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 cD(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function BE(...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 mz0(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 Gl(J){let Q=cD(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function o3(J){try{if(J=d4(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var NE=G1(()=>{u_()});function LY4(J,...Q){return J=d4(J),J.with({path:BE(J.path,...Q)})}function AY4(J,...Q){let Y=J.path,X=!1;if(Y[0]!==Zl)Y=Zl+Y,X=!0;let G=Y;for(let Z of Q)if(Z.startsWith("/"))G=BE(Z);else G=BE(G,Z);if(G!=="/"&&G.endsWith("/"))G=G.replace(/\/+$/,"");if(X&&G[0]===Zl&&!J.authority)G=G.substring(1);return J.with({path:G})}function wY4(J){if(J=d4(J),J.path.length===0||J.path===Zl)return J;let Q=eX1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function EY4(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 IY4(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 mz0(J.path,Q.path,Y,Y)}function PY4(J,Q){let Y=z6(J),X=z6(Q);if(Y.startsWith("file:///")&&X.startsWith("file:///"))return pz0(Y)===pz0(X);return Y===X}function pz0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Zl="/",t0;var ql=G1(()=>{NE();u_();t0={joinPath:LY4,resolvePath:AY4,dirname:wY4,basename:(J)=>cD(d4(J).path),extname:(J)=>Gl(d4(J).path),hasPrefix:EY4,relativePath:IY4,equalURIs:PY4}});function Vl(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function dz0(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 YG1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function RY4(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(cz0(J,Y.type,Y.value),J._state==="closed")break}function cz0(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(YG1(J),X&&typeof X.error==="function")X.error(Y);else throw Y;break;case"complete":if(YG1(J),X&&typeof X.complete==="function")X.complete();break}}catch(G){console.error("notifySubscription",G)}if(J._state==="closed")dz0(J);else if(J._state==="running")J._state="ready"}function QG1(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(()=>RY4(J));return}cz0(J,Q,Y)}class lz0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new iz0(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")YG1(this),dz0(this)}}class iz0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){QG1(this._subscription,"next",J)}error(J){QG1(this._subscription,"error",J)}complete(){QG1(this._subscription,"complete")}}function x5(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class DE{_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 $G1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function XG1(J){if($G1(J))return J;return t1.of(J)}var t1;var OE=G1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");t1=class t1{_subscriber;constructor(J){if(!(this instanceof t1))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 lz0(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:t1;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 t1)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:t1)((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 u4,f5;var Kl=G1(()=>{OE();u4=class u4 extends t1{_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()}};f5=class f5 extends u4{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 GG1,g_;var nz0=G1(()=>{OE();Kl();GG1=class GG1 extends Set{subject=new f5(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 t1.from(this.subject)}dispose(){this.subject.complete()}};g_=class g_ extends Map{subject=new f5(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 t1.from(this.subject)}dispose(){this.subject.complete()}}});function Wl(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)=>Wl(Z,Q[q]));let G=new Set([...Object.keys(J),...Object.keys(Q)]);for(let Z of G)if(!Wl(J[Z],Q[Z]))return!1;return!0}function ZG1(J){return{dispose:J.unsubscribe.bind(J)}}function rz0(...J){return new t1((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}async function W6(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 AF(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 oz0(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 E3(J){return new t1((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function f6(J){return new t1((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 o0(J){return(Q)=>{return new t1((Y)=>{let X=new DE(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()=>x5(Z)})}}function Hl(J){return new t1((Q)=>{let Y=0,X=setInterval(()=>{Q.next(Y++)},J);return()=>clearInterval(X)})}function kW(...J){return new t1((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()=>{sz0(X)}})}function T8(...J){if(J.length===0)return m_;return new t1((Q)=>{let Y=Array(J.length),X=Array(J.length).fill(0),G=Array(J.length).fill(!1),Z=0,q=[],V=new DE(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()=>{sz0(q)}})}function p8(J){let Y=J?.shouldCountRefs??!0,X=CY4++,G=(Z,...q)=>{};return(Z)=>{let q=new u4,V=null,K=!1,W,H=0;return new t1((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:(B)=>{K=!0,W=B,q.next(B)},error:(B)=>q.error(B),complete:()=>q.complete()});let U=q.subscribe(z);return()=>{if(H--,U.unsubscribe(),Y&&H===0){if(V)x5(V),V=null;K=!1}}})}}function sz0(J){for(let Q of J)if(Q)x5(Q)}function wF(J){return(Q)=>{return new t1((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 AQ(J){return(Q)=>{return new t1((Y)=>{let X,G=Q.subscribe({next(Z){X=Z,Y.next(Z)},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{x5(G),J(X)}})}}function P4(J=Wl){return(Q)=>{return new t1((Y)=>{let X=az0,G=new DE(Y),Z=Q.subscribe({complete(){G.complete()},error(q){G.error(q)},next(q){G.schedule(async(V)=>{if(X===az0||!J(X,q))X=q,V(q)})}});return()=>x5(Z)})}}function q$(J){return SY4(typeof J==="function"?{next:J}:J)}function SY4(J){return(Q)=>new t1((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()=>x5(G)})}function EF(J){return(Q)=>{return new t1((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 zl(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(Z),G.unsubscribe()}})}}function g9(J){return(Q)=>new t1((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)x5(X)}})}function ME(J){return(Q)=>new t1((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X<J){if(Y.next(Z),X++,X===J)Y.complete(),x5(G)}},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{x5(G)}})}function tz0(J){return(Q)=>new t1((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()=>{x5(G)}})}function qG1(J){return(Q)=>{return new t1((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()=>{x5(V);for(let K of G)if(K)x5(K)}})}}function v4(J){return(Q)=>{return new t1((Y)=>{let X=0,G=null,Z=!1,q=()=>{if(Z&&!G)Y.complete()},V=Q.subscribe({next(K){if(G)x5(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(x5(V),G)x5(G)}})}}function ez0(J){let Q={last:void 0,isSet:!1},Y=J.subscribe((X)=>{Object.assign(Q,{last:X,isSet:!0})});return{value:Q,observable:J,subscription:Y}}function NZ(J){return(Q)=>new t1((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(x5(q),X!==null)clearTimeout(X)}})}function VG1(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Y)=>new t1((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(x5(K),Z!==null)clearTimeout(Z)}})}function lD(...J){return new t1((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)x5(X)}})}function V$(J){return(Q)=>new t1((Y)=>{let X=0,G=!1,Z=null,q=Q.subscribe({next(V){try{let K=J(V,X++);if(Z)x5(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(x5(q),Z)x5(Z)}})}function p_({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new t1((X)=>{J?.();let G=Y.subscribe(X);return()=>{x5(G),Q?.()}})}function IF(J){return(Q)=>t1.from(Q).pipe(v4((Y)=>f6((X)=>J(Y,X))))}function o7(J){return(Q)=>new t1((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(x5(G),X)x5(X)}})}function P2(J){return(Q)=>{return new t1((Y)=>{let X=Q.subscribe({next(G){if(J(G))Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>x5(X)})}}function JF0(J,Q){return(Y)=>{return new t1((X)=>{let G,Z=0,q=new DE(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()=>x5(V)})}}var m_,hX,Xu8,CY4=0,az0,zl;var KG1=G1(()=>{OE();Kl();m_=new t1((J)=>{J.complete()}),hX=new t1(()=>{});Xu8=Symbol("noInitialValue");az0={};zl=class zl extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function iD(J,Q){return(Y)=>{return t1.from(Y).pipe(v4((X)=>X===s3?t1.of(s3):J(X).pipe(o7((G)=>t1.of(G instanceof Error?G:Error(G))),g9(s3))),p8(Q))}}function jY4(){return(J)=>t1.from(J).pipe(P2((Q)=>Q!==s3))}async function d_(J,Q){let Y=await W6(t1.from(J).pipe(jY4()),Q);if(Y instanceof Error)throw Y;return Y}var s3;var QF0=G1(()=>{OE();KG1();s3=Symbol.for("@@pendingOperation")});var u0=G1(()=>{nz0();OE();QF0();KG1();Kl()});var J4=G1(()=>{u_();ql();NE()});import{promises as _Y4}from"node:fs";import*as nD from"node:path";async function YF0(J){try{let Q=await _Y4.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 $F0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=nD.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function XF0(J){return nD.extname(J).toLowerCase()===".md"}function GF0(J){let Q=J.replace(/\\/g,"/"),Y=nD.basename(Q);return nD.basename(Y,nD.extname(Y))}function ZF0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var qF0=()=>{};var HF0={};v8(HF0,{CommandDiscovery:()=>WF0});import*as KF0 from"node:fs";import{promises as Fl}from"node:fs";import{homedir as VF0}from"node:os";import*as K$ from"node:path";function HG1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class WF0{config;workspaceRoots;watchFactory;debounceMs;changes=new u4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??kY4,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(x.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return x.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=t0.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=p0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await HG1(Fl.access(Y),WG1,"directory access")}catch{return[]}let G=(await HG1(Fl.readdir(Y,{withFileTypes:!0}),WG1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=K$.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return x.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return x.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 Fl.stat(J),X=K$.basename(J);if(this.ignoreCommandName(X))return null;let G=GF0(X);if(!ZF0(G))return x.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(XF0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return x.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:K$.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=K$.basename(J),Z=$F0(Q.mode,G),q=await YF0(J),V=K$.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return x.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:K$.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 K$.join(VF0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=MF||K$.join(VF0(),".config");return K$.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=t0.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 HG1(Fl.access(J),WG1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{x.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{x.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),x.debug("Started watching command directory",{directory:J})}catch(Q){x.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){x.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());x.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){x.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),x.debug("Stopped watching command directory",{directory:J})}catch(Y){x.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){x.warn("Error during command discovery cleanup",{error:J})}}}var WG1=5000,kY4=(J,Q)=>KF0.watch(J,Q);var zF0=G1(()=>{J4();u0();zE();H0();qF0()});function J5(J,Q,Y=Q+"s"){return J===1?Q:Y}function PF(J){let Q=typeof J==="string"?J:J.toString();return Q===KY||Q===KY.slice(0,-1)}function wE(J){return PF(J)?KY:J}var sY4,KY,tY4,Vg8;var TF=G1(()=>{sY4=new URL("https://ampcode.com/"),KY=sY4.toString(),tY4=new URL("https://api.anthropic.com/"),Vg8=tY4.toString()});var q9,wG1,P6,BV=(J)=>{switch(typeof J){case"undefined":return P6.undefined;case"string":return P6.string;case"number":return Number.isNaN(J)?P6.nan:P6.number;case"boolean":return P6.boolean;case"function":return P6.function;case"bigint":return P6.bigint;case"symbol":return P6.symbol;case"object":if(Array.isArray(J))return P6.array;if(J===null)return P6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return P6.promise;if(typeof Map<"u"&&J instanceof Map)return P6.map;if(typeof Set<"u"&&J instanceof Set)return P6.set;if(typeof Date<"u"&&J instanceof Date)return P6.date;return P6.object;default:return P6.unknown}};var a_=G1(()=>{(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}})(q9||(q9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(wG1||(wG1={}));P6=q9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var q6,eY4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},WY;var Ol=G1(()=>{a_();q6=q9.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"]);WY=class WY 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 WY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q9.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()}};WY.create=(J)=>{return new WY(J)}});var J$4=(J,Q)=>{let Y;switch(J.code){case q6.invalid_type:if(J.received===P6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case q6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,q9.jsonStringifyReplacer)}`;break;case q6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${q9.joinValues(J.keys,", ")}`;break;case q6.invalid_union:Y="Invalid input";break;case q6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${q9.joinValues(J.options)}`;break;case q6.invalid_enum_value:Y=`Invalid enum value. Expected ${q9.joinValues(J.options)}, received '${J.received}'`;break;case q6.invalid_arguments:Y="Invalid function arguments";break;case q6.invalid_return_type:Y="Invalid function return type";break;case q6.invalid_date:Y="Invalid date";break;case q6.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 q9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case q6.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 q6.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 q6.custom:Y="Invalid input";break;case q6.invalid_intersection_types:Y="Intersection results could not be merged";break;case q6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case q6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,q9.assertNever(J)}return{message:Y}},yW;var EG1=G1(()=>{Ol();a_();yW=J$4});function Q$4(J){wF0=J}function EE(){return wF0}var wF0;var Ml=G1(()=>{EG1();wF0=yW});function p6(J,Q){let Y=EE(),X=r_({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===yW?void 0:yW].filter((G)=>!!G)});J.common.issues.push(X)}class t3{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 c4;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 t3.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 c4;if(Z.status==="aborted")return c4;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 r_=(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}},Y$4,c4,rD=(J)=>({status:"dirty",value:J}),lJ=(J)=>({status:"valid",value:J}),Ll=(J)=>J.status==="aborted",Al=(J)=>J.status==="dirty",RF=(J)=>J.status==="valid",IE=(J)=>typeof Promise<"u"&&J instanceof Promise;var IG1=G1(()=>{Ml();EG1();Y$4=[];c4=Object.freeze({status:"aborted"})});var EF0=()=>{};var z4;var IF0=G1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(z4||(z4={}))});class AZ{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 w8(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 d8{get description(){return this._def.description}_getType(J){return BV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:BV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new t3,ctx:{common:J.parent.common,data:J.data,parsedType:BV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(IE(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:BV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return PF0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:BV(J)};if(!this["~standard"].async)try{let Y=this._parseSync({data:J,path:[],parent:Q});return RF(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)=>RF(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:BV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(IE(X)?X:Promise.resolve(X));return PF0(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:q6.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 wZ({schema:this,typeName:J8.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 LZ.create(this,this._def)}nullable(){return xW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return MZ.create(this)}promise(){return eD.create(this,this._def)}or(J){return jE.create([this,J],this._def)}and(J){return _E.create(this,J,this._def)}transform(J){return new wZ({...w8(this._def),schema:this,typeName:J8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new xE({...w8(this._def),innerType:this,defaultValue:Q,typeName:J8.ZodDefault})}brand(){return new El({typeName:J8.ZodBranded,type:this,...w8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new fE({...w8(this._def),innerType:this,catchValue:Q,typeName:J8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return Qk.create(this,J)}readonly(){return hE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function CF0(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 M$4(J){return new RegExp(`^${CF0(J)}$`)}function SF0(J){let Q=`${RF0}T${CF0(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 L$4(J,Q){if((Q==="v4"||!Q)&&z$4.test(J))return!0;if((Q==="v6"||!Q)&&U$4.test(J))return!0;return!1}function A$4(J,Q){if(!V$4.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 w$4(J,Q){if((Q==="v4"||!Q)&&F$4.test(J))return!0;if((Q==="v6"||!Q)&&B$4.test(J))return!0;return!1}function E$4(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 PE(J){if(J instanceof T2){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=LZ.create(PE(X))}return new T2({...J._def,shape:()=>Q})}else if(J instanceof MZ)return new MZ({...J._def,type:PE(J.element)});else if(J instanceof LZ)return LZ.create(PE(J.unwrap()));else if(J instanceof xW)return xW.create(PE(J.unwrap()));else if(J instanceof DV)return DV.create(J.items.map((Q)=>PE(Q)));else return J}function TG1(J,Q){let Y=BV(J),X=BV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===P6.object&&X===P6.object){let G=q9.objectKeys(Q),Z=q9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=TG1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===P6.array&&X===P6.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=TG1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===P6.date&&X===P6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function jF0(J,Q){return new _F({values:J,typeName:J8.ZodEnum,...w8(Q)})}function TF0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function _F0(J,Q={},Y){if(J)return sD.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=TF0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=TF0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return sD.create()}var PF0=(J,Q)=>{if(RF(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 WY(J.common.issues);return this._error=Y,this._error}}}},$$4,X$4,G$4,Z$4,q$4,V$4,K$4,W$4,H$4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",PG1,z$4,F$4,U$4,B$4,N$4,D$4,RF0="((\\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])))",O$4,OZ,SF,jF,RE,oD,o_,CE,SE,sD,CF,NV,s_,MZ,T2,jE,vW=(J)=>{if(J instanceof kE)return vW(J.schema);else if(J instanceof wZ)return vW(J.innerType());else if(J instanceof yE)return[J.value];else if(J instanceof _F)return J.options;else if(J instanceof vE)return q9.objectValues(J.enum);else if(J instanceof xE)return vW(J._def.innerType);else if(J instanceof CE)return[void 0];else if(J instanceof SE)return[null];else if(J instanceof LZ)return[void 0,...vW(J.unwrap())];else if(J instanceof xW)return[null,...vW(J.unwrap())];else if(J instanceof El)return vW(J.unwrap());else if(J instanceof hE)return vW(J.unwrap());else if(J instanceof fE)return vW(J._def.innerType);else return[]},wl,_E,DV,t_,e_,tD,TE,kE,yE,_F,vE,eD,wZ,LZ,xW,xE,fE,Jk,I$4,El,Qk,hE,P$4,J8,T$4=(J,Q={message:`Input not instance of ${J.name}`})=>_F0((Y)=>Y instanceof J,Q),kF0,yF0,R$4,C$4,vF0,S$4,j$4,_$4,k$4,y$4,v$4,x$4,f$4,h$4,b$4,u$4,g$4,m$4,p$4,d$4,c$4,l$4,i$4,n$4,a$4,r$4,o$4,s$4,t$4,e$4,JX4,QX4,YX4,$X4,XX4=()=>kF0().optional(),GX4=()=>yF0().optional(),ZX4=()=>vF0().optional(),qX4,VX4;var xF0=G1(()=>{Ol();Ml();IF0();IG1();a_();$$4=/^c[^\s-]{8,}$/i,X$4=/^[0-9a-z]+$/,G$4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Z$4=/^[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,q$4=/^[a-z0-9_-]{21}$/i,V$4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,K$4=/^[-+]?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)?)??$/,W$4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z$4=/^(?:(?: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])$/,F$4=/^(?:(?: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])$/,U$4=/^(([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]))$/,B$4=/^(([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])$/,N$4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D$4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,O$4=new RegExp(`^${RF0}$`);OZ=class OZ extends d8{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==P6.string){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_type,expected:P6.string,received:G.parsedType}),c4}let Y=new t3,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),p6(X,{code:q6.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),p6(X,{code:q6.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)p6(X,{code:q6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)p6(X,{code:q6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!W$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"email",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!PG1)PG1=new RegExp(H$4,"u");if(!PG1.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"emoji",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!Z$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"uuid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!q$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"nanoid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!$$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"cuid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!X$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"cuid2",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!G$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"ulid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),p6(X,{validation:"url",code:q6.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),p6(X,{validation:"regex",code:q6.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),p6(X,{code:q6.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),p6(X,{code:q6.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),p6(X,{code:q6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!SF0(G).test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{code:q6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!O$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{code:q6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!M$4(G).test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{code:q6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!K$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"duration",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!L$4(J.data,G.version))X=this._getOrReturnCtx(J,X),p6(X,{validation:"ip",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!A$4(J.data,G.alg))X=this._getOrReturnCtx(J,X),p6(X,{validation:"jwt",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!w$4(J.data,G.version))X=this._getOrReturnCtx(J,X),p6(X,{validation:"cidr",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!N$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"base64",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!D$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"base64url",code:q6.invalid_string,message:G.message}),Y.dirty()}else q9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:q6.invalid_string,...z4.errToObj(Y)})}_addCheck(J){return new OZ({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...z4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...z4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...z4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...z4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...z4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...z4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...z4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...z4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...z4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...z4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...z4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...z4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...z4.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,...z4.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,...z4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...z4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...z4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...z4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...z4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...z4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...z4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...z4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...z4.errToObj(Q)})}nonempty(J){return this.min(1,z4.errToObj(J))}trim(){return new OZ({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new OZ({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new OZ({...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}};OZ.create=(J)=>{return new OZ({checks:[],typeName:J8.ZodString,coerce:J?.coerce??!1,...w8(J)})};SF=class SF extends d8{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)!==P6.number){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_type,expected:P6.number,received:G.parsedType}),c4}let Y=void 0,X=new t3;for(let G of this._def.checks)if(G.kind==="int"){if(!q9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),p6(Y,{code:q6.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),p6(Y,{code:q6.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),p6(Y,{code:q6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(E$4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),p6(Y,{code:q6.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),p6(Y,{code:q6.not_finite,message:G.message}),X.dirty()}else q9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,z4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,z4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,z4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,z4.toString(Q))}setLimit(J,Q,Y,X){return new SF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:z4.toString(X)}]})}_addCheck(J){return new SF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:z4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:z4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:z4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z4.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"&&q9.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)}};SF.create=(J)=>{return new SF({checks:[],typeName:J8.ZodNumber,coerce:J?.coerce||!1,...w8(J)})};jF=class jF extends d8{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)!==P6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new t3;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),p6(Y,{code:q6.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),p6(Y,{code:q6.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),p6(Y,{code:q6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else q9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return p6(Q,{code:q6.invalid_type,expected:P6.bigint,received:Q.parsedType}),c4}gte(J,Q){return this.setLimit("min",J,!0,z4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,z4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,z4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,z4.toString(Q))}setLimit(J,Q,Y,X){return new jF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:z4.toString(X)}]})}_addCheck(J){return new jF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:z4.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}};jF.create=(J)=>{return new jF({checks:[],typeName:J8.ZodBigInt,coerce:J?.coerce??!1,...w8(J)})};RE=class RE extends d8{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==P6.boolean){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.boolean,received:Y.parsedType}),c4}return lJ(J.data)}};RE.create=(J)=>{return new RE({typeName:J8.ZodBoolean,coerce:J?.coerce||!1,...w8(J)})};oD=class oD extends d8{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==P6.date){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_type,expected:P6.date,received:G.parsedType}),c4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_date}),c4}let Y=new t3,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),p6(X,{code:q6.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),p6(X,{code:q6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else q9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new oD({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:z4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:z4.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}};oD.create=(J)=>{return new oD({checks:[],coerce:J?.coerce||!1,typeName:J8.ZodDate,...w8(J)})};o_=class o_ extends d8{_parse(J){if(this._getType(J)!==P6.symbol){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.symbol,received:Y.parsedType}),c4}return lJ(J.data)}};o_.create=(J)=>{return new o_({typeName:J8.ZodSymbol,...w8(J)})};CE=class CE extends d8{_parse(J){if(this._getType(J)!==P6.undefined){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.undefined,received:Y.parsedType}),c4}return lJ(J.data)}};CE.create=(J)=>{return new CE({typeName:J8.ZodUndefined,...w8(J)})};SE=class SE extends d8{_parse(J){if(this._getType(J)!==P6.null){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.null,received:Y.parsedType}),c4}return lJ(J.data)}};SE.create=(J)=>{return new SE({typeName:J8.ZodNull,...w8(J)})};sD=class sD extends d8{constructor(){super(...arguments);this._any=!0}_parse(J){return lJ(J.data)}};sD.create=(J)=>{return new sD({typeName:J8.ZodAny,...w8(J)})};CF=class CF extends d8{constructor(){super(...arguments);this._unknown=!0}_parse(J){return lJ(J.data)}};CF.create=(J)=>{return new CF({typeName:J8.ZodUnknown,...w8(J)})};NV=class NV extends d8{_parse(J){let Q=this._getOrReturnCtx(J);return p6(Q,{code:q6.invalid_type,expected:P6.never,received:Q.parsedType}),c4}};NV.create=(J)=>{return new NV({typeName:J8.ZodNever,...w8(J)})};s_=class s_ extends d8{_parse(J){if(this._getType(J)!==P6.undefined){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.void,received:Y.parsedType}),c4}return lJ(J.data)}};s_.create=(J)=>{return new s_({typeName:J8.ZodVoid,...w8(J)})};MZ=class MZ extends d8{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==P6.array)return p6(Q,{code:q6.invalid_type,expected:P6.array,received:Q.parsedType}),c4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)p6(Q,{code:Z?q6.too_big:q6.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)p6(Q,{code:q6.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)p6(Q,{code:q6.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 AZ(Q,Z,Q.path,q))})).then((Z)=>{return t3.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new AZ(Q,Z,Q.path,q))});return t3.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new MZ({...this._def,minLength:{value:J,message:z4.toString(Q)}})}max(J,Q){return new MZ({...this._def,maxLength:{value:J,message:z4.toString(Q)}})}length(J,Q){return new MZ({...this._def,exactLength:{value:J,message:z4.toString(Q)}})}nonempty(J){return this.min(1,J)}};MZ.create=(J,Q)=>{return new MZ({type:J,minLength:null,maxLength:null,exactLength:null,typeName:J8.ZodArray,...w8(Q)})};T2=class T2 extends d8{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=q9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==P6.object){let K=this._getOrReturnCtx(J);return p6(K,{code:q6.invalid_type,expected:P6.object,received:K.parsedType}),c4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof NV&&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 AZ(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof NV){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)p6(X,{code:q6.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 AZ(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 t3.mergeObjectSync(Y,K)});else return t3.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return z4.errToObj,new T2({...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:z4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new T2({...this._def,unknownKeys:"strip"})}passthrough(){return new T2({...this._def,unknownKeys:"passthrough"})}extend(J){return new T2({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new T2({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:J8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new T2({...this._def,catchall:J})}pick(J){let Q={};for(let Y of q9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new T2({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of q9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new T2({...this._def,shape:()=>Q})}deepPartial(){return PE(this)}partial(J){let Q={};for(let Y of q9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new T2({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of q9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof LZ)G=G._def.innerType;Q[Y]=G}return new T2({...this._def,shape:()=>Q})}keyof(){return jF0(q9.objectKeys(this.shape))}};T2.create=(J,Q)=>{return new T2({shape:()=>J,unknownKeys:"strip",catchall:NV.create(),typeName:J8.ZodObject,...w8(Q)})};T2.strictCreate=(J,Q)=>{return new T2({shape:()=>J,unknownKeys:"strict",catchall:NV.create(),typeName:J8.ZodObject,...w8(Q)})};T2.lazycreate=(J,Q)=>{return new T2({shape:J,unknownKeys:"strip",catchall:NV.create(),typeName:J8.ZodObject,...w8(Q)})};jE=class jE extends d8{_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 WY(q.ctx.common.issues));return p6(Q,{code:q6.invalid_union,unionErrors:Z}),c4}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 WY(V));return p6(Q,{code:q6.invalid_union,unionErrors:q}),c4}}get options(){return this._def.options}};jE.create=(J,Q)=>{return new jE({options:J,typeName:J8.ZodUnion,...w8(Q)})};wl=class wl extends d8{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==P6.object)return p6(Q,{code:q6.invalid_type,expected:P6.object,received:Q.parsedType}),c4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return p6(Q,{code:q6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),c4;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=vW(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 wl({typeName:J8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...w8(Y)})}};_E=class _E extends d8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(Ll(G)||Ll(Z))return c4;let q=TG1(G.value,Z.value);if(!q.valid)return p6(Y,{code:q6.invalid_intersection_types}),c4;if(Al(G)||Al(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}))}};_E.create=(J,Q,Y)=>{return new _E({left:J,right:Q,typeName:J8.ZodIntersection,...w8(Y)})};DV=class DV extends d8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==P6.array)return p6(Y,{code:q6.invalid_type,expected:P6.array,received:Y.parsedType}),c4;if(Y.data.length<this._def.items.length)return p6(Y,{code:q6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c4;if(!this._def.rest&&Y.data.length>this._def.items.length)p6(Y,{code:q6.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 AZ(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return t3.mergeArray(Q,Z)});else return t3.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new DV({...this._def,rest:J})}};DV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new DV({items:J,typeName:J8.ZodTuple,rest:null,...w8(Q)})};t_=class t_ extends d8{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!==P6.object)return p6(Y,{code:q6.invalid_type,expected:P6.object,received:Y.parsedType}),c4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new AZ(Y,q,Y.path,q)),value:Z._parse(new AZ(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return t3.mergeObjectAsync(Q,X);else return t3.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof d8)return new t_({keyType:J,valueType:Q,typeName:J8.ZodRecord,...w8(Y)});return new t_({keyType:OZ.create(),valueType:J,typeName:J8.ZodRecord,...w8(Q)})}};e_=class e_ extends d8{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!==P6.map)return p6(Y,{code:q6.invalid_type,expected:P6.map,received:Y.parsedType}),c4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new AZ(Y,q,Y.path,[K,"key"])),value:G._parse(new AZ(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 c4;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 c4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};e_.create=(J,Q,Y)=>{return new e_({valueType:Q,keyType:J,typeName:J8.ZodMap,...w8(Y)})};tD=class tD extends d8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==P6.set)return p6(Y,{code:q6.invalid_type,expected:P6.set,received:Y.parsedType}),c4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)p6(Y,{code:q6.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)p6(Y,{code:q6.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 c4;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 AZ(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 tD({...this._def,minSize:{value:J,message:z4.toString(Q)}})}max(J,Q){return new tD({...this._def,maxSize:{value:J,message:z4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};tD.create=(J,Q)=>{return new tD({valueType:J,minSize:null,maxSize:null,typeName:J8.ZodSet,...w8(Q)})};TE=class TE extends d8{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==P6.function)return p6(Q,{code:q6.invalid_type,expected:P6.function,received:Q.parsedType}),c4;function Y(q,V){return r_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,EE(),yW].filter((K)=>!!K),issueData:{code:q6.invalid_arguments,argumentsError:V}})}function X(q,V){return r_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,EE(),yW].filter((K)=>!!K),issueData:{code:q6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof eD){let q=this;return lJ(async function(...V){let K=new WY([]),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 lJ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new WY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new WY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new TE({...this._def,args:DV.create(J).rest(CF.create())})}returns(J){return new TE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new TE({args:J?J:DV.create([]).rest(CF.create()),returns:Q||CF.create(),typeName:J8.ZodFunction,...w8(Y)})}};kE=class kE extends d8{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})}};kE.create=(J,Q)=>{return new kE({getter:J,typeName:J8.ZodLazy,...w8(Q)})};yE=class yE extends d8{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return p6(Q,{received:Q.data,code:q6.invalid_literal,expected:this._def.value}),c4}return{status:"valid",value:J.data}}get value(){return this._def.value}};yE.create=(J,Q)=>{return new yE({value:J,typeName:J8.ZodLiteral,...w8(Q)})};_F=class _F extends d8{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return p6(Q,{expected:q9.joinValues(Y),received:Q.parsedType,code:q6.invalid_type}),c4}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 p6(Q,{received:Q.data,code:q6.invalid_enum_value,options:Y}),c4}return lJ(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 _F.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return _F.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};_F.create=jF0;vE=class vE extends d8{_parse(J){let Q=q9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==P6.string&&Y.parsedType!==P6.number){let X=q9.objectValues(Q);return p6(Y,{expected:q9.joinValues(X),received:Y.parsedType,code:q6.invalid_type}),c4}if(!this._cache)this._cache=new Set(q9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=q9.objectValues(Q);return p6(Y,{received:Y.data,code:q6.invalid_enum_value,options:X}),c4}return lJ(J.data)}get enum(){return this._def.values}};vE.create=(J,Q)=>{return new vE({values:J,typeName:J8.ZodNativeEnum,...w8(Q)})};eD=class eD extends d8{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==P6.promise&&Q.common.async===!1)return p6(Q,{code:q6.invalid_type,expected:P6.promise,received:Q.parsedType}),c4;let Y=Q.parsedType===P6.promise?Q.data:Promise.resolve(Q.data);return lJ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};eD.create=(J,Q)=>{return new eD({type:J,typeName:J8.ZodPromise,...w8(Q)})};wZ=class wZ extends d8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J8.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(p6(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 c4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return c4;if(V.status==="dirty")return rD(V.value);if(Q.value==="dirty")return rD(V.value);return V});else{if(Q.value==="aborted")return c4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return c4;if(q.status==="dirty")return rD(q.value);if(Q.value==="dirty")return rD(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 c4;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 c4;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(!RF(Z))return c4;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(!RF(Z))return c4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});q9.assertNever(X)}};wZ.create=(J,Q,Y)=>{return new wZ({schema:J,typeName:J8.ZodEffects,effect:Q,...w8(Y)})};wZ.createWithPreprocess=(J,Q,Y)=>{return new wZ({schema:Q,effect:{type:"preprocess",transform:J},typeName:J8.ZodEffects,...w8(Y)})};LZ=class LZ extends d8{_parse(J){if(this._getType(J)===P6.undefined)return lJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};LZ.create=(J,Q)=>{return new LZ({innerType:J,typeName:J8.ZodOptional,...w8(Q)})};xW=class xW extends d8{_parse(J){if(this._getType(J)===P6.null)return lJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};xW.create=(J,Q)=>{return new xW({innerType:J,typeName:J8.ZodNullable,...w8(Q)})};xE=class xE extends d8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===P6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};xE.create=(J,Q)=>{return new xE({innerType:J,typeName:J8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...w8(Q)})};fE=class fE extends d8{_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(IE(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};fE.create=(J,Q)=>{return new fE({innerType:J,typeName:J8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...w8(Q)})};Jk=class Jk extends d8{_parse(J){if(this._getType(J)!==P6.nan){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.nan,received:Y.parsedType}),c4}return{status:"valid",value:J.data}}};Jk.create=(J)=>{return new Jk({typeName:J8.ZodNaN,...w8(J)})};I$4=Symbol("zod_brand");El=class El extends d8{_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}};Qk=class Qk extends d8{_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 c4;if(G.status==="dirty")return Q.dirty(),rD(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 c4;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 Qk({in:J,out:Q,typeName:J8.ZodPipeline})}};hE=class hE extends d8{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(RF(X))X.value=Object.freeze(X.value);return X};return IE(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};hE.create=(J,Q)=>{return new hE({innerType:J,typeName:J8.ZodReadonly,...w8(Q)})};P$4={object:T2.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"})(J8||(J8={}));kF0=OZ.create,yF0=SF.create,R$4=Jk.create,C$4=jF.create,vF0=RE.create,S$4=oD.create,j$4=o_.create,_$4=CE.create,k$4=SE.create,y$4=sD.create,v$4=CF.create,x$4=NV.create,f$4=s_.create,h$4=MZ.create,b$4=T2.create,u$4=T2.strictCreate,g$4=jE.create,m$4=wl.create,p$4=_E.create,d$4=DV.create,c$4=t_.create,l$4=e_.create,i$4=tD.create,n$4=TE.create,a$4=kE.create,r$4=yE.create,o$4=_F.create,s$4=vE.create,t$4=eD.create,e$4=wZ.create,JX4=LZ.create,QX4=xW.create,YX4=wZ.createWithPreprocess,$X4=Qk.create,qX4={string:(J)=>OZ.create({...J,coerce:!0}),number:(J)=>SF.create({...J,coerce:!0}),boolean:(J)=>RE.create({...J,coerce:!0}),bigint:(J)=>jF.create({...J,coerce:!0}),date:(J)=>oD.create({...J,coerce:!0})},VX4=c4});var J1={};v8(J1,{void:()=>f$4,util:()=>q9,unknown:()=>v$4,union:()=>g$4,undefined:()=>_$4,tuple:()=>d$4,transformer:()=>e$4,symbol:()=>j$4,string:()=>kF0,strictObject:()=>u$4,setErrorMap:()=>Q$4,set:()=>i$4,record:()=>c$4,quotelessJson:()=>eY4,promise:()=>t$4,preprocess:()=>YX4,pipeline:()=>$X4,ostring:()=>XX4,optional:()=>JX4,onumber:()=>GX4,oboolean:()=>ZX4,objectUtil:()=>wG1,object:()=>b$4,number:()=>yF0,nullable:()=>QX4,null:()=>k$4,never:()=>x$4,nativeEnum:()=>s$4,nan:()=>R$4,map:()=>l$4,makeIssue:()=>r_,literal:()=>r$4,lazy:()=>a$4,late:()=>P$4,isValid:()=>RF,isDirty:()=>Al,isAsync:()=>IE,isAborted:()=>Ll,intersection:()=>p$4,instanceof:()=>T$4,getParsedType:()=>BV,getErrorMap:()=>EE,function:()=>n$4,enum:()=>o$4,effect:()=>e$4,discriminatedUnion:()=>m$4,defaultErrorMap:()=>yW,datetimeRegex:()=>SF0,date:()=>S$4,custom:()=>_F0,coerce:()=>qX4,boolean:()=>vF0,bigint:()=>C$4,array:()=>h$4,any:()=>y$4,addIssueToContext:()=>p6,ZodVoid:()=>s_,ZodUnknown:()=>CF,ZodUnion:()=>jE,ZodUndefined:()=>CE,ZodType:()=>d8,ZodTuple:()=>DV,ZodTransformer:()=>wZ,ZodSymbol:()=>o_,ZodString:()=>OZ,ZodSet:()=>tD,ZodSchema:()=>d8,ZodRecord:()=>t_,ZodReadonly:()=>hE,ZodPromise:()=>eD,ZodPipeline:()=>Qk,ZodParsedType:()=>P6,ZodOptional:()=>LZ,ZodObject:()=>T2,ZodNumber:()=>SF,ZodNullable:()=>xW,ZodNull:()=>SE,ZodNever:()=>NV,ZodNativeEnum:()=>vE,ZodNaN:()=>Jk,ZodMap:()=>e_,ZodLiteral:()=>yE,ZodLazy:()=>kE,ZodIssueCode:()=>q6,ZodIntersection:()=>_E,ZodFunction:()=>TE,ZodFirstPartyTypeKind:()=>J8,ZodError:()=>WY,ZodEnum:()=>_F,ZodEffects:()=>wZ,ZodDiscriminatedUnion:()=>wl,ZodDefault:()=>xE,ZodDate:()=>oD,ZodCatch:()=>fE,ZodBranded:()=>El,ZodBoolean:()=>RE,ZodBigInt:()=>jF,ZodArray:()=>MZ,ZodAny:()=>sD,Schema:()=>d8,ParseStatus:()=>t3,OK:()=>lJ,NEVER:()=>VX4,INVALID:()=>c4,EMPTY_PATH:()=>Y$4,DIRTY:()=>rD,BRAND:()=>I$4});var RG1=G1(()=>{Ml();IG1();EF0();a_();xF0();Ol()});var JO=G1(()=>{RG1();RG1()});function WX4(J){return fF0.safeParse(J)}function kF(J){return KX4.safeParse(J)}function bE(J){if(!J||!Array.isArray(J))return[];let Q=[];for(let[Y,X]of J.entries()){let G=WX4(X);if(G.success)Q.push(G.data);else{let Z=typeof X==="object"&&X!==null&&"tool"in X?String(X.tool):`entry at index ${Y}`;x.warn(`Permission entry for tool "${Z}" is invalid: ${G.error.errors.map((q)=>`${q.path.join(".")}: ${q.message}`).join(", ")}`)}}return Q}var CG1,fF0,KX4;var QO=G1(()=>{JO();H0();CG1=J1.lazy(()=>J1.union([J1.string().describe('Pattern match where "*" matches any number of any characters'),J1.array(CG1).min(1).describe("OR match of each entry"),J1.boolean().describe("A literal boolean match"),J1.number().describe("A literal number match"),J1.null().describe("A literal null match"),J1.undefined().describe("A literal undefined match"),J1.record(J1.string(),CG1).describe("Matching individual keys of an object")])),fF0=J1.object({tool:J1.string().min(1).describe("The name of the tool to which this entry applies"),matches:J1.record(J1.string(),CG1).optional().describe("Maps tool inputs to conditions"),action:J1.enum(["allow","reject","ask","delegate"]).describe("How Amp should proceed in case of a match"),context:J1.enum(["thread","subagent"]).optional().describe("Only apply this entry in this context"),to:J1.string().min(1).optional().describe('Command to delegate to when action is "delegate"')}).superRefine((J,Q)=>{if(J.action==="delegate"&&!J.to)Q.addIssue({code:J1.ZodIssueCode.custom,message:'delegate action requires "to" field',path:["to"]});if(J.action!=="delegate"&&J.to)Q.addIssue({code:J1.ZodIssueCode.custom,message:'"to" field only allowed with delegate action',path:["to"]})}),KX4=J1.array(fF0).describe("Entries checked in sequence to configure tool permissions")});function iJ(J,Q){let Y=HX4(J,Q);return typeof Y==="string"?Y:Y.toString()}function HX4(J,Q,Y=!0){if(!Q)Q=zX4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?p0.parse(J):p0.from(J);if(X)for(let V of X){let K=d4(V);if(t0.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?cD(K.path)+(G?"\\":"/"):"";return SG1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=d4(Z);if(t0.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return SG1("~"+(G?"\\":"/")+W,G,q.scheme)}}return SG1(q.fsPath,G,q.scheme)}return q}function SG1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function Pl(J){let Q=Il;return Il=J,Q}function zX4(){if(Il)return Il;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Il=null;var fW=G1(()=>{J4();NE();ql()});var FX4=(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},uE=(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),uE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),uE(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),uE(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),uE(J);break;case"delimiter":return J=J.slice(0,J.length-1),uE(J);break}return J},UX4=(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},BX4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},bX=(J)=>JSON.parse(BX4(UX4(uE(FX4(J)))));var YO=()=>{};function nJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function GO(J){return!!J&&!!J[H$]}function yF(J){if(!J)return!1;return mF0(J)||Array.isArray(J)||!!J[Yk]||!!J.constructor?.[Yk]||qk(J)||Vk(J)}function mF0(J){if(!J||typeof J!=="object")return!1;let Q=XO(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)===NX4}function $k(J,Q){if(ZO(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function ZO(J){let Q=J[H$];return Q?Q.type_:Array.isArray(J)?1:qk(J)?2:Vk(J)?3:0}function Xk(J,Q){return ZO(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function jG1(J,Q){return ZO(J)===2?J.get(Q):J[Q]}function pF0(J,Q,Y){let X=ZO(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function DX4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function qk(J){return J instanceof Map}function Vk(J){return J instanceof Set}function $O(J){return J.copy_||J.base_}function yG1(J,Q){if(qk(J))return new Map(J);if(Vk(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=mF0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[H$];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(XO(J),X)}else{let X=XO(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function F$(J,Q=!1){if(Cl(J)||GO(J)||!yF(J))return J;if(ZO(J)>1)J.set=J.add=J.clear=J.delete=OX4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>F$(X,!0));return J}function OX4(){nJ(2)}function Cl(J){return Object.isFrozen(J)}function qO(J){let Q=vG1[J];if(!Q)nJ(0,J);return Q}function MX4(J,Q){if(!vG1[J])vG1[J]=Q}function dF0(){return Gk}function LX4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function hF0(J,Q){if(Q)qO("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function xG1(J){fG1(J),J.drafts_.forEach(AX4),J.drafts_=null}function fG1(J){if(J===Gk)Gk=J.parent_}function bF0(J){return Gk=LX4(Gk,J)}function AX4(J){let Q=J[H$];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function uF0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[H$].modified_)xG1(Q),nJ(4);if(yF(J)){if(J=Tl(Q,J),!Q.parent_)Rl(Q,J)}if(Q.patches_)qO("Patches").generateReplacementPatches_(Y[H$].base_,J,Q.patches_,Q.inversePatches_)}else J=Tl(Q,Y,[]);if(xG1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==uG1?J:void 0}function Tl(J,Q,Y){if(Cl(Q))return Q;let X=Q[H$];if(!X)return $k(Q,(G,Z)=>gF0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Rl(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($k(Z,(V,K)=>gF0(J,X,G,V,K,Y,q)),Rl(J,G,!1),Y&&J.patches_)qO("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function gF0(J,Q,Y,X,G,Z,q){if(GO(G)){let V=Z&&Q&&Q.type_!==3&&!Xk(Q.assigned_,X)?Z.concat(X):void 0,K=Tl(J,G,V);if(pF0(Y,X,K),GO(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(yF(G)&&!Cl(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Tl(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))Rl(J,G)}}function Rl(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)F$(Q,Y)}function wX4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:dF0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=gG1;if(Y)G=[X],Z=Zk;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function _G1(J,Q){let Y=J[H$];return(Y?$O(Y):J)[Q]}function EX4(J,Q,Y){let X=cF0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function cF0(J,Q){if(!(Q in J))return;let Y=XO(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=XO(Y)}return}function hG1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)hG1(J.parent_)}}function kG1(J){if(!J.copy_)J.copy_=yG1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function bG1(J,Q){let Y=qk(J)?qO("MapSet").proxyMap_(J,Q):Vk(J)?qO("MapSet").proxySet_(J,Q):wX4(J,Q);return(Q?Q.scope_:dF0()).drafts_.push(Y),Y}function PX4(J){if(!GO(J))nJ(10,J);return lF0(J)}function lF0(J){if(!yF(J)||Cl(J))return J;let Q=J[H$],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=yG1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=yG1(J,!0);if($k(Y,(X,G)=>{pF0(Y,X,lF0(G))}),Q)Q.finalized_=!1;return Y}function Sl(){let Q="replace",Y="add",X="remove";function G(U,B,O,M){switch(U.type_){case 0:case 2:return q(U,B,O,M);case 1:return Z(U,B,O,M);case 3:return V(U,B,O,M)}}function Z(U,B,O,M){let{base_:L,assigned_:E}=U,I=U.copy_;if(I.length<L.length)[L,I]=[I,L],[O,M]=[M,O];for(let P=0;P<L.length;P++)if(E[P]&&I[P]!==L[P]){let R=B.concat([P]);O.push({op:Q,path:R,value:z(I[P])}),M.push({op:Q,path:R,value:z(L[P])})}for(let P=L.length;P<I.length;P++){let R=B.concat([P]);O.push({op:Y,path:R,value:z(I[P])})}for(let P=I.length-1;L.length<=P;--P){let R=B.concat([P]);M.push({op:X,path:R})}}function q(U,B,O,M){let{base_:L,copy_:E}=U;$k(U.assigned_,(I,P)=>{let R=jG1(L,I),j=jG1(E,I),y=!P?X:Xk(L,I)?Q:Y;if(R===j&&y===Q)return;let h=B.concat(I);O.push(y===X?{op:y,path:h}:{op:y,path:h,value:j}),M.push(y===Y?{op:X,path:h}:y===X?{op:Y,path:h,value:z(R)}:{op:Q,path:h,value:z(R)})})}function V(U,B,O,M){let{base_:L,copy_:E}=U,I=0;L.forEach((P)=>{if(!E.has(P)){let R=B.concat([I]);O.push({op:X,path:R,value:P}),M.unshift({op:Y,path:R,value:P})}I++}),I=0,E.forEach((P)=>{if(!L.has(P)){let R=B.concat([I]);O.push({op:Y,path:R,value:P}),M.unshift({op:X,path:R,value:P})}I++})}function K(U,B,O,M){O.push({op:Q,path:[],value:B===uG1?void 0:B}),M.push({op:Q,path:[],value:U})}function W(U,B){return B.forEach((O)=>{let{path:M,op:L}=O,E=U;for(let j=0;j<M.length-1;j++){let y=ZO(E),h=M[j];if(typeof h!=="string"&&typeof h!=="number")h=""+h;if((y===0||y===1)&&(h==="__proto__"||h==="constructor"))nJ(19);if(typeof E==="function"&&h==="prototype")nJ(19);if(E=jG1(E,h),typeof E!=="object")nJ(18,M.join("/"))}let I=ZO(E),P=H(O.value),R=M[M.length-1];switch(L){case Q:switch(I){case 2:return E.set(R,P);case 3:nJ(16);default:return E[R]=P}case Y:switch(I){case 1:return R==="-"?E.push(P):E.splice(R,0,P);case 2:return E.set(R,P);case 3:return E.add(P);default:return E[R]=P}case X:switch(I){case 1:return E.splice(R,1);case 2:return E.delete(R);case 3:return E.delete(O.value);default:return delete E[R]}default:nJ(17,L)}}),U}function H(U){if(!yF(U))return U;if(Array.isArray(U))return U.map(H);if(qk(U))return new Map(Array.from(U.entries()).map(([O,M])=>[O,H(M)]));if(Vk(U))return new Set(Array.from(U).map(H));let B=Object.create(XO(U));for(let O in U)B[O]=H(U[O]);if(Xk(U,Yk))B[Yk]=U[Yk];return B}function z(U){if(GO(U))return H(U);else return U}MX4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function f8(J){return J}var uG1,Yk,H$,XO,NX4,vG1,Gk,gG1,Zk,IX4=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")nJ(6);if(X!==void 0&&typeof X!=="function")nJ(7);let G;if(yF(Q)){let Z=bF0(this),q=bG1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)xG1(Z);else fG1(Z)}return hF0(Z,X),uF0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===uG1)G=void 0;if(this.autoFreeze_)F$(G,!0);if(X){let Z=[],q=[];qO("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else nJ(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(!yF(J))nJ(8);if(GO(J))J=PX4(J);let Q=bF0(this),Y=bG1(J,void 0);return Y[H$].isManual_=!0,fG1(Q),Y}finishDraft(J,Q){let Y=J&&J[H$];if(!Y||!Y.isManual_)nJ(9);let{scope_:X}=Y;return hF0(X,Q),uF0(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=qO("Patches").applyPatches_;if(GO(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},z$,vF,VO,ig8,ng8,iF0,ag8,rg8;var HY=G1(()=>{uG1=Symbol.for("immer-nothing"),Yk=Symbol.for("immer-draftable"),H$=Symbol.for("immer-state");XO=Object.getPrototypeOf;NX4=Object.prototype.constructor.toString();vG1={};gG1={get(J,Q){if(Q===H$)return J;let Y=$O(J);if(!Xk(Y,Q))return EX4(J,Y,Q);let X=Y[Q];if(J.finalized_||!yF(X))return X;if(X===_G1(J.base_,Q))return kG1(J),J.copy_[Q]=bG1(X,J);return X},has(J,Q){return Q in $O(J)},ownKeys(J){return Reflect.ownKeys($O(J))},set(J,Q,Y){let X=cF0($O(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=_G1($O(J),Q),Z=G?.[H$];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(DX4(Y,G)&&(Y!==void 0||Xk(J.base_,Q)))return!0;kG1(J),hG1(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(_G1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,kG1(J),hG1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=$O(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(){nJ(11)},getPrototypeOf(J){return XO(J.base_)},setPrototypeOf(){nJ(12)}},Zk={};$k(gG1,(J,Q)=>{Zk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});Zk.deleteProperty=function(J,Q){return Zk.set.call(this,J,Q,void 0)};Zk.set=function(J,Q,Y){return gG1.set.call(this,J[0],Q,Y,J[0])};z$=new IX4,vF=z$.produce,VO=z$.produceWithPatches.bind(z$),ig8=z$.setAutoFreeze.bind(z$),ng8=z$.setUseStrictShallowCopy.bind(z$),iF0=z$.applyPatches.bind(z$),ag8=z$.createDraft.bind(z$),rg8=z$.finishDraft.bind(z$)});function mG1({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 gE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(TX4,"")}var TX4;var jl=G1(()=>{TX4=mG1()});var aF0=f((Qm8,pG1)=>{var xF={};if(typeof pG1>"u")window.eastasianwidth=xF;else pG1.exports=xF;xF.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"};xF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function nF0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}xF.length=function(J){var Q=nF0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};xF.slice=function(J,Q,Y){if(textLen=xF.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=nF0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=xF.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var dG1=f((Ym8,rF0)=>{rF0.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 RX4,CX4;var oF0=G1(()=>{jl();RX4=U6(aF0(),1),CX4=U6(dG1(),1)});function _l(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var cG1=G1(()=>{oF0()});var sF0="run_terminal_command",tF0="read_file",e3="Task",eF0="chat_llm",t8="finder",mE="fast_finder",fF="xai_finder",hF="kimiK2_finder",pE="gossip_finder",dE="sonoma_finder",zY="get_diagnostics",o9="Bash",kl="InteractiveShell",a5="oracle",OV="mermaid",MV="todo_read",G2="todo_write",G7="read_web_page",yl="read_thread",r5="create_file",Z7="glob",JU0="Glob",vl="undo_edit",xl="read_mcp_resource",b6="Read",v2="edit_file",cE="format_file",I3="web_search",E8="Grep",KO="Check",U$="librarian",fl="kraken",QU0="read_artifact",YU0="edit_artifact",hl="read_plan",lE="edit_plan",bl="read_github",ul="search_github",gl="commit_search",ml="list_directory_github",pl="list_repositories",dl="glob_github",cl="diff",$U0="bookkeeper",XU0="describe_workbook",GU0="execute_query",Kk="skill",ZU0;var q4=G1(()=>{ZU0=["Task","chat_llm","finder","fast_finder","xai_finder","kimiK2_finder","gossip_finder","sonoma_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","librarian","bookkeeper","read_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var Wk=f((Km8,VU0)=>{var qU0={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:"/"},SX4={...qU0,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:"\\"},jX4={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"};VU0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:jX4,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?SX4:qU0}}});var Hk=f((xX4)=>{var{REGEX_BACKSLASH:_X4,REGEX_REMOVE_BACKSLASH:kX4,REGEX_SPECIAL_CHARS:yX4,REGEX_SPECIAL_CHARS_GLOBAL:vX4}=Wk();xX4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);xX4.hasRegexChars=(J)=>yX4.test(J);xX4.isRegexChar=(J)=>J.length===1&&xX4.hasRegexChars(J);xX4.escapeRegex=(J)=>J.replace(vX4,"\\$1");xX4.toPosixSlashes=(J)=>J.replace(_X4,"/");xX4.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};xX4.removeBackslashes=(J)=>{return J.replace(kX4,(Q)=>{return Q==="\\"?"":Q})};xX4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return xX4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};xX4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};xX4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};xX4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var OU0=f((Hm8,DU0)=>{var HU0=Hk(),{CHAR_ASTERISK:lG1,CHAR_AT:lX4,CHAR_BACKWARD_SLASH:zk,CHAR_COMMA:iX4,CHAR_DOT:iG1,CHAR_EXCLAMATION_MARK:nG1,CHAR_FORWARD_SLASH:NU0,CHAR_LEFT_CURLY_BRACE:aG1,CHAR_LEFT_PARENTHESES:rG1,CHAR_LEFT_SQUARE_BRACKET:nX4,CHAR_PLUS:aX4,CHAR_QUESTION_MARK:zU0,CHAR_RIGHT_CURLY_BRACE:rX4,CHAR_RIGHT_PARENTHESES:FU0,CHAR_RIGHT_SQUARE_BRACKET:oX4}=Wk(),UU0=(J)=>{return J===NU0||J===zk},BU0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},sX4=(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,B=!1,O=!1,M=!1,L=!1,E=!1,I=!1,P=!1,R=!1,j=!1,y=0,h,g,p={value:"",depth:0,isGlob:!1},b=()=>W>=X,i=()=>K.charCodeAt(W+1),t=()=>{return h=g,K.charCodeAt(++W)};while(W<X){g=t();let H1;if(g===zk){if(I=p.backslashes=!0,g=t(),g===aG1)E=!0;continue}if(E===!0||g===aG1){y++;while(b()!==!0&&(g=t())){if(g===zk){I=p.backslashes=!0,t();continue}if(g===aG1){y++;continue}if(E!==!0&&g===iG1&&(g=t())===iG1){if(U=p.isBrace=!0,O=p.isGlob=!0,j=!0,G===!0)continue;break}if(E!==!0&&g===iX4){if(U=p.isBrace=!0,O=p.isGlob=!0,j=!0,G===!0)continue;break}if(g===rX4){if(y--,y===0){E=!1,U=p.isBrace=!0,j=!0;break}}}if(G===!0)continue;break}if(g===NU0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},j===!0)continue;if(h===iG1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((g===aX4||g===lX4||g===lG1||g===zU0||g===nG1)===!0&&i()===rG1){if(O=p.isGlob=!0,M=p.isExtglob=!0,j=!0,g===nG1&&W===H)R=!0;if(G===!0){while(b()!==!0&&(g=t())){if(g===zk){I=p.backslashes=!0,g=t();continue}if(g===FU0){O=p.isGlob=!0,j=!0;break}}continue}break}}if(g===lG1){if(h===lG1)L=p.isGlobstar=!0;if(O=p.isGlob=!0,j=!0,G===!0)continue;break}if(g===zU0){if(O=p.isGlob=!0,j=!0,G===!0)continue;break}if(g===nX4){while(b()!==!0&&(H1=t())){if(H1===zk){I=p.backslashes=!0,t();continue}if(H1===oX4){B=p.isBracket=!0,O=p.isGlob=!0,j=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&g===nG1&&W===H){P=p.negated=!0,H++;continue}if(Y.noparen!==!0&&g===rG1){if(O=p.isGlob=!0,G===!0){while(b()!==!0&&(g=t())){if(g===rG1){I=p.backslashes=!0,g=t();continue}if(g===FU0){j=!0;break}}continue}break}if(O===!0){if(j=!0,G===!0)continue;break}}if(Y.noext===!0)M=!1,O=!1;let r=K,m="",s="";if(H>0)m=K.slice(0,H),K=K.slice(H),z-=H;if(r&&O===!0&&z>0)r=K.slice(0,z),s=K.slice(z);else if(O===!0)r="",s=K;else r=K;if(r&&r!==""&&r!=="/"&&r!==K){if(UU0(r.charCodeAt(r.length-1)))r=r.slice(0,-1)}if(Y.unescape===!0){if(s)s=HU0.removeBackslashes(s);if(r&&I===!0)r=HU0.removeBackslashes(r)}let q1={prefix:m,input:J,start:H,base:r,glob:s,isBrace:U,isBracket:B,isGlob:O,isExtglob:M,isGlobstar:L,negated:P,negatedExtglob:R};if(Y.tokens===!0){if(q1.maxDepth=0,!UU0(g))q.push(p);q1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let H1;for(let a=0;a<Z.length;a++){let o=H1?H1+1:H,l=Z[a],z1=J.slice(o,l);if(Y.tokens){if(a===0&&H!==0)q[a].isPrefix=!0,q[a].value=m;else q[a].value=z1;BU0(q[a]),q1.maxDepth+=q[a].depth}if(a!==0||z1!=="")V.push(z1);H1=l}if(H1&&H1+1<J.length){let a=J.slice(H1+1);if(V.push(a),Y.tokens)q[q.length-1].value=a,BU0(q[q.length-1]),q1.maxDepth+=q[q.length-1].depth}q1.slashes=Z,q1.parts=V}return q1};DU0.exports=sX4});var AU0=f((zm8,LU0)=>{var ll=Wk(),LV=Hk(),{MAX_LENGTH:il,POSIX_REGEX_SOURCE:tX4,REGEX_NON_SPECIAL_CHARS:eX4,REGEX_SPECIAL_CHARS_BACKREF:JG4,REPLACEMENTS:MU0}=ll,QG4=(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)=>LV.escapeRegex(G)).join("..")}return Y},iE=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},oG1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=MU0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(il,Y.maxLength):il,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=ll.globChars(Y.windows),W=ll.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:B,DOTS_SLASH:O,NO_DOT:M,NO_DOT_SLASH:L,NO_DOTS_SLASH:E,QMARK:I,QMARK_NO_DOT:P,STAR:R,START_ANCHOR:j}=K,y=(a1)=>{return`(${V}(?:(?!${j}${a1.dot?O:H}).)*?)`},h=Y.dot?"":M,g=Y.dot?I:P,p=Y.bash===!0?y(Y):R;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=LV.removePrefix(J,b),G=J.length;let i=[],t=[],r=[],m=Z,s,q1=()=>b.index===G-1,H1=b.peek=(a1=1)=>J[b.index+a1],a=b.advance=()=>J[++b.index]||"",o=()=>J.slice(b.index+1),l=(a1="",F1=0)=>{b.consumed+=a1,b.index+=F1},z1=(a1)=>{b.output+=a1.output!=null?a1.output:a1.value,l(a1.value)},j1=()=>{let a1=1;while(H1()==="!"&&(H1(2)!=="("||H1(3)==="?"))a(),b.start++,a1++;if(a1%2===0)return!1;return b.negated=!0,b.start++,!0},e=(a1)=>{b[a1]++,r.push(a1)},y1=(a1)=>{b[a1]--,r.pop()},R1=(a1)=>{if(m.type==="globstar"){let F1=b.braces>0&&(a1.type==="comma"||a1.type==="brace"),Q1=a1.extglob===!0||i.length&&(a1.type==="pipe"||a1.type==="paren");if(a1.type!=="slash"&&a1.type!=="paren"&&!F1&&!Q1)b.output=b.output.slice(0,-m.output.length),m.type="star",m.value="*",m.output=p,b.output+=m.output}if(i.length&&a1.type!=="paren")i[i.length-1].inner+=a1.value;if(a1.value||a1.output)z1(a1);if(m&&m.type==="text"&&a1.type==="text"){m.output=(m.output||m.value)+a1.value,m.value+=a1.value;return}a1.prev=m,q.push(a1),m=a1},D0=(a1,F1)=>{let Q1={...W[F1],conditions:1,inner:""};Q1.prev=m,Q1.parens=b.parens,Q1.output=b.output;let O1=(Y.capture?"(":"")+Q1.open;e("parens"),R1({type:a1,value:F1,output:b.output?"":B}),R1({type:"paren",extglob:!0,value:a(),output:O1}),i.push(Q1)},T1=(a1)=>{let F1=a1.close+(Y.capture?")":""),Q1;if(a1.type==="negate"){let O1=p;if(a1.inner&&a1.inner.length>1&&a1.inner.includes("/"))O1=y(Y);if(O1!==p||q1()||/^\)+$/.test(o()))F1=a1.close=`)$))${O1}`;if(a1.inner.includes("*")&&(Q1=o())&&/^\.[^\\/.]+$/.test(Q1)){let L1=oG1(Q1,{...Q,fastpaths:!1}).output;F1=a1.close=`)${L1})${O1})`}if(a1.prev.type==="bos")b.negatedExtglob=!0}R1({type:"paren",extglob:!0,value:s,output:F1}),y1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let a1=!1,F1=J.replace(JG4,(Q1,O1,L1,w1,A1,u1)=>{if(w1==="\\")return a1=!0,Q1;if(w1==="?"){if(O1)return O1+w1+(A1?I.repeat(A1.length):"");if(u1===0)return g+(A1?I.repeat(A1.length):"");return I.repeat(L1.length)}if(w1===".")return H.repeat(L1.length);if(w1==="*"){if(O1)return O1+w1+(A1?p:"");return p}return O1?Q1:`\\${Q1}`});if(a1===!0)if(Y.unescape===!0)F1=F1.replace(/\\/g,"");else F1=F1.replace(/\\+/g,(Q1)=>{return Q1.length%2===0?"\\\\":Q1?"\\":""});if(F1===J&&Y.contains===!0)return b.output=J,b;return b.output=LV.wrapOutput(F1,b,Q),b}while(!q1()){if(s=a(),s==="\x00")continue;if(s==="\\"){let Q1=H1();if(Q1==="/"&&Y.bash!==!0)continue;if(Q1==="."||Q1===";")continue;if(!Q1){s+="\\",R1({type:"text",value:s});continue}let O1=/^\\+/.exec(o()),L1=0;if(O1&&O1[0].length>2){if(L1=O1[0].length,b.index+=L1,L1%2!==0)s+="\\"}if(Y.unescape===!0)s=a();else s+=a();if(b.brackets===0){R1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||m.value==="["||m.value==="[^")){if(Y.posix!==!1&&s===":"){let Q1=m.value.slice(1);if(Q1.includes("[")){if(m.posix=!0,Q1.includes(":")){let O1=m.value.lastIndexOf("["),L1=m.value.slice(0,O1),w1=m.value.slice(O1+2),A1=tX4[w1];if(A1){if(m.value=L1+A1,b.backtrack=!0,a(),!Z.output&&q.indexOf(m)===1)Z.output=B;continue}}}}if(s==="["&&H1()!==":"||s==="-"&&H1()==="]")s=`\\${s}`;if(s==="]"&&(m.value==="["||m.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&m.value==="[")s="^";m.value+=s,z1({value:s});continue}if(b.quotes===1&&s!=='"'){s=LV.escapeRegex(s),m.value+=s,z1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)R1({type:"text",value:s});continue}if(s==="("){e("parens"),R1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError(iE("opening","("));let Q1=i[i.length-1];if(Q1&&b.parens===Q1.parens+1){T1(i.pop());continue}R1({type:"paren",value:s,output:b.parens?")":"\\)"}),y1("parens");continue}if(s==="["){if(Y.nobracket===!0||!o().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(iE("closing","]"));s=`\\${s}`}else e("brackets");R1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||m&&m.type==="bracket"&&m.value.length===1){R1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(iE("opening","["));R1({type:"text",value:s,output:`\\${s}`});continue}y1("brackets");let Q1=m.value.slice(1);if(m.posix!==!0&&Q1[0]==="^"&&!Q1.includes("/"))s=`/${s}`;if(m.value+=s,z1({value:s}),Y.literalBrackets===!1||LV.hasRegexChars(Q1))continue;let O1=LV.escapeRegex(m.value);if(b.output=b.output.slice(0,-m.value.length),Y.literalBrackets===!0){b.output+=O1,m.value=O1;continue}m.value=`(${V}${O1}|${m.value})`,b.output+=m.value;continue}if(s==="{"&&Y.nobrace!==!0){e("braces");let Q1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};t.push(Q1),R1(Q1);continue}if(s==="}"){let Q1=t[t.length-1];if(Y.nobrace===!0||!Q1){R1({type:"text",value:s,output:s});continue}let O1=")";if(Q1.dots===!0){let L1=q.slice(),w1=[];for(let A1=L1.length-1;A1>=0;A1--){if(q.pop(),L1[A1].type==="brace")break;if(L1[A1].type!=="dots")w1.unshift(L1[A1].value)}O1=QG4(w1,Y),b.backtrack=!0}if(Q1.comma!==!0&&Q1.dots!==!0){let L1=b.output.slice(0,Q1.outputIndex),w1=b.tokens.slice(Q1.tokensIndex);Q1.value=Q1.output="\\{",s=O1="\\}",b.output=L1;for(let A1 of w1)b.output+=A1.output||A1.value}R1({type:"brace",value:s,output:O1}),y1("braces"),t.pop();continue}if(s==="|"){if(i.length>0)i[i.length-1].conditions++;R1({type:"text",value:s});continue}if(s===","){let Q1=s,O1=t[t.length-1];if(O1&&r[r.length-1]==="braces")O1.comma=!0,Q1="|";R1({type:"comma",value:s,output:Q1});continue}if(s==="/"){if(m.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",q.pop(),m=Z;continue}R1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&m.type==="dot"){if(m.value===".")m.output=H;let Q1=t[t.length-1];m.type="dots",m.output+=s,m.value+=s,Q1.dots=!0;continue}if(b.braces+b.parens===0&&m.type!=="bos"&&m.type!=="slash"){R1({type:"text",value:s,output:H});continue}R1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(m&&m.value==="(")&&Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){D0("qmark",s);continue}if(m&&m.type==="paren"){let O1=H1(),L1=s;if(m.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(o()))L1=`\\${s}`;R1({type:"text",value:s,output:L1});continue}if(Y.dot!==!0&&(m.type==="slash"||m.type==="bos")){R1({type:"qmark",value:s,output:P});continue}R1({type:"qmark",value:s,output:I});continue}if(s==="!"){if(Y.noextglob!==!0&&H1()==="("){if(H1(2)!=="?"||!/[!=<:]/.test(H1(3))){D0("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){j1();continue}}if(s==="+"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){D0("plus",s);continue}if(m&&m.value==="("||Y.regex===!1){R1({type:"plus",value:s,output:z});continue}if(m&&(m.type==="bracket"||m.type==="paren"||m.type==="brace")||b.parens>0){R1({type:"plus",value:s});continue}R1({type:"plus",value:z});continue}if(s==="@"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){R1({type:"at",extglob:!0,value:s,output:""});continue}R1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let Q1=eX4.exec(o());if(Q1)s+=Q1[0],b.index+=Q1[0].length;R1({type:"text",value:s});continue}if(m&&(m.type==="globstar"||m.star===!0)){m.type="star",m.star=!0,m.value+=s,m.output=p,b.backtrack=!0,b.globstar=!0,l(s);continue}let a1=o();if(Y.noextglob!==!0&&/^\([^?]/.test(a1)){D0("star",s);continue}if(m.type==="star"){if(Y.noglobstar===!0){l(s);continue}let Q1=m.prev,O1=Q1.prev,L1=Q1.type==="slash"||Q1.type==="bos",w1=O1&&(O1.type==="star"||O1.type==="globstar");if(Y.bash===!0&&(!L1||a1[0]&&a1[0]!=="/")){R1({type:"star",value:s,output:""});continue}let A1=b.braces>0&&(Q1.type==="comma"||Q1.type==="brace"),u1=i.length&&(Q1.type==="pipe"||Q1.type==="paren");if(!L1&&Q1.type!=="paren"&&!A1&&!u1){R1({type:"star",value:s,output:""});continue}while(a1.slice(0,3)==="/**"){let v1=J[b.index+4];if(v1&&v1!=="/")break;a1=a1.slice(3),l("/**",3)}if(Q1.type==="bos"&&q1()){m.type="globstar",m.value+=s,m.output=y(Y),b.output=m.output,b.globstar=!0,l(s);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&!w1&&q1()){b.output=b.output.slice(0,-(Q1.output+m.output).length),Q1.output=`(?:${Q1.output}`,m.type="globstar",m.output=y(Y)+(Y.strictSlashes?")":"|$)"),m.value+=s,b.globstar=!0,b.output+=Q1.output+m.output,l(s);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&a1[0]==="/"){let v1=a1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(Q1.output+m.output).length),Q1.output=`(?:${Q1.output}`,m.type="globstar",m.output=`${y(Y)}${U}|${U}${v1})`,m.value+=s,b.output+=Q1.output+m.output,b.globstar=!0,l(s+a()),R1({type:"slash",value:"/",output:""});continue}if(Q1.type==="bos"&&a1[0]==="/"){m.type="globstar",m.value+=s,m.output=`(?:^|${U}|${y(Y)}${U})`,b.output=m.output,b.globstar=!0,l(s+a()),R1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-m.output.length),m.type="globstar",m.output=y(Y),m.value+=s,b.output+=m.output,b.globstar=!0,l(s);continue}let F1={type:"star",value:s,output:p};if(Y.bash===!0){if(F1.output=".*?",m.type==="bos"||m.type==="slash")F1.output=h+F1.output;R1(F1);continue}if(m&&(m.type==="bracket"||m.type==="paren")&&Y.regex===!0){F1.output=s,R1(F1);continue}if(b.index===b.start||m.type==="slash"||m.type==="dot"){if(m.type==="dot")b.output+=L,m.output+=L;else if(Y.dot===!0)b.output+=E,m.output+=E;else b.output+=h,m.output+=h;if(H1()!=="*")b.output+=B,m.output+=B}R1(F1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(iE("closing","]"));b.output=LV.escapeLast(b.output,"["),y1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(iE("closing",")"));b.output=LV.escapeLast(b.output,"("),y1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(iE("closing","}"));b.output=LV.escapeLast(b.output,"{"),y1("braces")}if(Y.strictSlashes!==!0&&(m.type==="star"||m.type==="bracket"))R1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let a1 of b.tokens)if(b.output+=a1.output!=null?a1.output:a1.value,a1.suffix)b.output+=a1.suffix}return b};oG1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(il,Y.maxLength):il,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=MU0[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:B}=ll.globChars(Y.windows),O=Y.dot?H:W,M=Y.dot?z:W,L=Y.capture?"":"?:",E={negated:!1,prefix:""},I=Y.bash===!0?".*?":U;if(Y.capture)I=`(${I})`;let P=(h)=>{if(h.noglobstar===!0)return I;return`(${L}(?:(?!${B}${h.dot?K:Z}).)*?)`},R=(h)=>{switch(h){case"*":return`${O}${V}${I}`;case".*":return`${Z}${V}${I}`;case"*.*":return`${O}${I}${Z}${V}${I}`;case"*/*":return`${O}${I}${q}${V}${M}${I}`;case"**":return O+P(Y);case"**/*":return`(?:${O}${P(Y)}${q})?${M}${V}${I}`;case"**/*.*":return`(?:${O}${P(Y)}${q})?${M}${I}${Z}${V}${I}`;case"**/.*":return`(?:${O}${P(Y)}${q})?${Z}${V}${I}`;default:{let g=/^(.*?)\.(\w+)$/.exec(h);if(!g)return;let p=R(g[1]);if(!p)return;return p+Z+g[2]}}},j=LV.removePrefix(J,E),y=R(j);if(y&&Y.strictSlashes!==!0)y+=`${q}?`;return y};LU0.exports=oG1});var Fk=f((Fm8,EU0)=>{var YG4=OU0(),sG1=AU0(),wU0=Hk(),$G4=Wk(),XG4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),q7=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>q7(U,Q,Y));return(U)=>{for(let B of H){let O=B(U);if(O)return O}return!1}}let X=XG4(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?q7.compileRe(J,Q):q7.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=q7(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:B,output:O}=q7.test(H,q,Q,{glob:J,posix:Z}),M={glob:J,state:V,regex:q,posix:Z,input:H,output:O,match:B,isMatch:U};if(typeof G.onResult==="function")G.onResult(M);if(U===!1)return M.isMatch=!1,z?M:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(M);return M.isMatch=!1,z?M:!1}if(typeof G.onMatch==="function")G.onMatch(M);return z?M:!0};if(Y)W.state=V;return W};q7.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?wU0.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=q7.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};q7.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:q7.makeRe(Q,Y)).test(wU0.basename(J))};q7.isMatch=(J,Q,Y)=>q7(Q,Y)(J);q7.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>q7.parse(Y,Q));return sG1(J,{...Q,fastpaths:!1})};q7.scan=(J,Q)=>YG4(J,Q);q7.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=q7.toRegex(V,Q);if(X===!0)K.state=J;return K};q7.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=sG1.fastpaths(J,Q);if(!G.output)G=sG1(J,Q);return q7.compileRe(G,Q,Y,X)};q7.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/$^/}};q7.constants=$G4;EU0.exports=q7});var WO=f((Um8,TU0)=>{var IU0=Fk(),GG4=Hk();function PU0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:GG4.isWindows()};return IU0(J,Q,Y)}Object.assign(PU0,IU0);TU0.exports=PU0});var nE;var tG1=G1(()=>{nE={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.promptAutocompleteMode":{type:"string",enum:["disabled","word-based","tab"],enumDescriptions:["Disabled - no prompt autocomplete","Offline word completion from workspace and thread context","AI-powered suggestions via Amp Tab"],default:"disabled",markdownDescription:"**Experimental:** Prompt autocomplete suggestions while typing.",scope:"application"},"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: chat_llm",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 Gemini 3",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.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","@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 qG4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function CU0(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=nE.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!qG4(X))return null;return X*1000}function SU0(J){let Q=J.settings["tools.stopTimeout"],Y=nE.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var RU0;var nl=G1(()=>{tG1();RU0=nE.contributes.configuration.properties});function al(J,Q){return new t1((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 eG1=G1(()=>{u0()});function x2(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 V7(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function kU0(J){return["done","error","cancelled"].includes(J.status)}function bF(J){let Q=[],Y=new u4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0&&q==="Glob")K=Q.filter((W)=>W.spec.name==="glob");for(let W of K)if(Bk(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((M)=>M.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return x.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let B={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))x.debug("Replacing existing tool registration (idempotent)",{toolName:q.name,source:q.source}),Q[W]=B;else Q.push(B);return Y.next(),{dispose:()=>{let M=Q.indexOf(B);if(M!==-1)Q.splice(M,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return VG4;return Z(q,V,K)},tools:T8(J.configService.config,Y.pipe(g9(void 0))).pipe(o0(([q])=>{return Q.map((V)=>({spec:V.spec,...Bk(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>KG4.record(performance.now()-W,{toolName:q});if(q===QZ1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){rl.add(1,{toolName:q,error:"invalid"});let U=JZ1(V.args.invalid_tool_name);return new t1((B)=>{B.error(Error(U))})}let z=G(q,K.config);if(!z){let U=Q.filter((L)=>L.spec.name===q);if(U.length===0)return rl.add(1,{toolName:q,error:"not_found"}),new t1((L)=>{L.error(Error(`tool ${JSON.stringify(q)} not found`))});let B=U[0],O=Bk(B.spec,K.config);rl.add(1,{toolName:q,error:"disabled"});let M=O.enabled?"unknown":O.disabledReason;return new t1((L)=>{L.error(Error(`tool ${JSON.stringify(q)} is disabled: ${M}`))})}return rl.add(1,{toolName:q}),f6(()=>z.fn).pipe(v4((U)=>{let B=U(V,K);if(z.spec.meta?.disableTimeout)return B;return al(B,SU0(K.config))}),AQ(()=>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){x.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function Uk(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(_U0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function Bk(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(Uk(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=vU0(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(Uk(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(Uk(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Uk(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Uk(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===G2||J.name===MV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function JZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Nk.toString()}. Try again with a valid tool name.`}function vU0(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function YZ1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}function P3(J,Q,Y=!0,X=!0,G){let Z=new Set(Q.map((V)=>V.spec.name));function q(V,K){if(Z.has(V))return!0;if(V==="Glob"&&Z.has("glob"))return!0;if(Y&&vU0(V))return!0;if(X&&V.startsWith("tb__")){if(G){if(!K?.meta?.subagentTypes)return!1;let W=K.meta.subagentTypes;return W.includes("all")||W.includes(G)}return!0}return!1}return{registerTool(V){throw Error("Tools should not be registered in a filtered tool service")},invokeTool(V,K,W){if(!q(V))return new t1((H)=>{H.error(Error(`tool ${JSON.stringify(V)} not allowed in filtered service`))});return J.invokeTool(V,K,W)},preprocessArgs(V,K,W){if(!q(V))return;return J.preprocessArgs?.(V,K,W)},tools:J.tools.pipe(o0((V)=>V.filter((K)=>q(K.spec.name,K.spec)))),getExecutionProfile(V){if(!q(V))return;return J.getExecutionProfile(V)},dispose(){}}}var jU0,_U0,VG4,QZ1="invalid_tool",Nk,yU0,rl,KG4;var K5=G1(()=>{u0();H0();nl();eG1();q4();jU0=U6(j6(),1),_U0=U6(WO(),1);VG4={dispose(){}};Nk=/^[-a-zA-Z0-9_]{1,64}$/,yU0=jU0.metrics.getMeter("tool_service"),rl=yU0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),KG4=yU0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var gU0=f((bU0)=>{Object.defineProperty(bU0,"__esModule",{value:!0});bU0.calcSlices=bU0.applyPatch=bU0.calcPatch=bU0.lcs=bU0.diff=bU0.diff_core=void 0;function WG4(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,B=U&1,O=Z+q-1,M=V+K-1,L=(U+B)/2,E;Q:for(let I=0;I<=L;I++){let P=2*Math.max(0,I-K)-I,R=I-2*Math.max(0,I-q);for(let j=P;j<=R;j+=2){let y=Y[j-1-W*Math.floor((j-1)/W)],h=Y[j+1-W*Math.floor((j+1)/W)],g=j===-I||j!==I&&y<h?h:y+1,p=g-j,b=g,i=p;while(b<q&&i<K&&X(Z+b,V+i))b++,i++;if(Y[j-W*Math.floor(j/W)]=b,B===1&&(E=z-j)>=1-I&&E<I&&b+Y[W+E-W*Math.floor(E/W)]>=q)if(I>1||b!==g){G[H++]=Z+b,G[H++]=q-b,G[H++]=V+i,G[H++]=K-i,q=g,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let j=P;j<=R;j+=2){let y=Y[W+j-1-W*Math.floor((j-1)/W)],h=Y[W+j+1-W*Math.floor((j+1)/W)],g=j===-I||j!==I&&y<h?h:y+1,p=g-j,b=g,i=p;while(b<q&&i<K&&X(O-b,M-i))b++,i++;if(Y[W+j-W*Math.floor(j/W)]=b,B===0&&(E=z-j)>=-I&&E<=I&&b+Y[E-W*Math.floor(E/W)]>=q)if(I>0||b!==g){G[H++]=Z+q-g,G[H++]=g,G[H++]=V+K-p,G[H++]=p,q=q-b,K=K-i,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 xU0{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=WG4(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 fU0(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 xU0({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:[]})}bU0.diff_core=fU0;function ol(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 fU0(X,G+1-X,X,Z+1-X,Y)}bU0.diff=ol;class hU0{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 HG4(J,Q,Y){return new hU0(ol(J,Q,Y),J.length)}bU0.lcs=HG4;function*zG4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of ol(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}bU0.calcPatch=zG4;function*FG4(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)}bU0.applyPatch=FG4;function*UG4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of ol(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)]}bU0.calcSlices=UG4});function aE(J,Q){if(J===void 0||Q===void 0||J===Q)return{added:0,deleted:0,changed:0};let Y={added:0,deleted:0,changed:0};for(let[X,G,Z,q]of mU0.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 $F0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=nD.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function XF0(J){return nD.extname(J).toLowerCase()===".md"}function GF0(J){let Q=J.replace(/\\/g,"/"),Y=nD.basename(Q);return nD.basename(Y,nD.extname(Y))}function ZF0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var qF0=()=>{};var HF0={};v8(HF0,{CommandDiscovery:()=>WF0});import*as KF0 from"node:fs";import{promises as Fl}from"node:fs";import{homedir as VF0}from"node:os";import*as K$ from"node:path";function HG1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class WF0{config;workspaceRoots;watchFactory;debounceMs;changes=new u4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??kY4,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(x.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return x.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=t0.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=p0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await HG1(Fl.access(Y),WG1,"directory access")}catch{return[]}let G=(await HG1(Fl.readdir(Y,{withFileTypes:!0}),WG1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=K$.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return x.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return x.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 Fl.stat(J),X=K$.basename(J);if(this.ignoreCommandName(X))return null;let G=GF0(X);if(!ZF0(G))return x.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(XF0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return x.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:K$.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=K$.basename(J),Z=$F0(Q.mode,G),q=await YF0(J),V=K$.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return x.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:K$.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 K$.join(VF0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=MF||K$.join(VF0(),".config");return K$.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=t0.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 HG1(Fl.access(J),WG1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{x.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{x.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),x.debug("Started watching command directory",{directory:J})}catch(Q){x.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){x.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());x.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){x.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),x.debug("Stopped watching command directory",{directory:J})}catch(Y){x.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){x.warn("Error during command discovery cleanup",{error:J})}}}var WG1=5000,kY4=(J,Q)=>KF0.watch(J,Q);var zF0=G1(()=>{J4();u0();zE();H0();qF0()});function J5(J,Q,Y=Q+"s"){return J===1?Q:Y}function PF(J){let Q=typeof J==="string"?J:J.toString();return Q===KY||Q===KY.slice(0,-1)}function wE(J){return PF(J)?KY:J}var sY4,KY,tY4,Vg8;var TF=G1(()=>{sY4=new URL("https://ampcode.com/"),KY=sY4.toString(),tY4=new URL("https://api.anthropic.com/"),Vg8=tY4.toString()});var q9,wG1,P6,BV=(J)=>{switch(typeof J){case"undefined":return P6.undefined;case"string":return P6.string;case"number":return Number.isNaN(J)?P6.nan:P6.number;case"boolean":return P6.boolean;case"function":return P6.function;case"bigint":return P6.bigint;case"symbol":return P6.symbol;case"object":if(Array.isArray(J))return P6.array;if(J===null)return P6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return P6.promise;if(typeof Map<"u"&&J instanceof Map)return P6.map;if(typeof Set<"u"&&J instanceof Set)return P6.set;if(typeof Date<"u"&&J instanceof Date)return P6.date;return P6.object;default:return P6.unknown}};var a_=G1(()=>{(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}})(q9||(q9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(wG1||(wG1={}));P6=q9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var q6,eY4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},WY;var Ol=G1(()=>{a_();q6=q9.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"]);WY=class WY 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 WY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q9.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()}};WY.create=(J)=>{return new WY(J)}});var J$4=(J,Q)=>{let Y;switch(J.code){case q6.invalid_type:if(J.received===P6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case q6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,q9.jsonStringifyReplacer)}`;break;case q6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${q9.joinValues(J.keys,", ")}`;break;case q6.invalid_union:Y="Invalid input";break;case q6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${q9.joinValues(J.options)}`;break;case q6.invalid_enum_value:Y=`Invalid enum value. Expected ${q9.joinValues(J.options)}, received '${J.received}'`;break;case q6.invalid_arguments:Y="Invalid function arguments";break;case q6.invalid_return_type:Y="Invalid function return type";break;case q6.invalid_date:Y="Invalid date";break;case q6.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 q9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case q6.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 q6.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 q6.custom:Y="Invalid input";break;case q6.invalid_intersection_types:Y="Intersection results could not be merged";break;case q6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case q6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,q9.assertNever(J)}return{message:Y}},yW;var EG1=G1(()=>{Ol();a_();yW=J$4});function Q$4(J){wF0=J}function EE(){return wF0}var wF0;var Ml=G1(()=>{EG1();wF0=yW});function p6(J,Q){let Y=EE(),X=r_({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===yW?void 0:yW].filter((G)=>!!G)});J.common.issues.push(X)}class t3{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 c4;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 t3.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 c4;if(Z.status==="aborted")return c4;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 r_=(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}},Y$4,c4,rD=(J)=>({status:"dirty",value:J}),lJ=(J)=>({status:"valid",value:J}),Ll=(J)=>J.status==="aborted",Al=(J)=>J.status==="dirty",RF=(J)=>J.status==="valid",IE=(J)=>typeof Promise<"u"&&J instanceof Promise;var IG1=G1(()=>{Ml();EG1();Y$4=[];c4=Object.freeze({status:"aborted"})});var EF0=()=>{};var z4;var IF0=G1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(z4||(z4={}))});class AZ{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 w8(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 d8{get description(){return this._def.description}_getType(J){return BV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:BV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new t3,ctx:{common:J.parent.common,data:J.data,parsedType:BV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(IE(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:BV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return PF0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:BV(J)};if(!this["~standard"].async)try{let Y=this._parseSync({data:J,path:[],parent:Q});return RF(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)=>RF(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:BV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(IE(X)?X:Promise.resolve(X));return PF0(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:q6.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 wZ({schema:this,typeName:J8.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 LZ.create(this,this._def)}nullable(){return xW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return MZ.create(this)}promise(){return eD.create(this,this._def)}or(J){return jE.create([this,J],this._def)}and(J){return _E.create(this,J,this._def)}transform(J){return new wZ({...w8(this._def),schema:this,typeName:J8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new xE({...w8(this._def),innerType:this,defaultValue:Q,typeName:J8.ZodDefault})}brand(){return new El({typeName:J8.ZodBranded,type:this,...w8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new fE({...w8(this._def),innerType:this,catchValue:Q,typeName:J8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return Qk.create(this,J)}readonly(){return hE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function CF0(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 M$4(J){return new RegExp(`^${CF0(J)}$`)}function SF0(J){let Q=`${RF0}T${CF0(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 L$4(J,Q){if((Q==="v4"||!Q)&&z$4.test(J))return!0;if((Q==="v6"||!Q)&&U$4.test(J))return!0;return!1}function A$4(J,Q){if(!V$4.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 w$4(J,Q){if((Q==="v4"||!Q)&&F$4.test(J))return!0;if((Q==="v6"||!Q)&&B$4.test(J))return!0;return!1}function E$4(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 PE(J){if(J instanceof T2){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=LZ.create(PE(X))}return new T2({...J._def,shape:()=>Q})}else if(J instanceof MZ)return new MZ({...J._def,type:PE(J.element)});else if(J instanceof LZ)return LZ.create(PE(J.unwrap()));else if(J instanceof xW)return xW.create(PE(J.unwrap()));else if(J instanceof DV)return DV.create(J.items.map((Q)=>PE(Q)));else return J}function TG1(J,Q){let Y=BV(J),X=BV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===P6.object&&X===P6.object){let G=q9.objectKeys(Q),Z=q9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=TG1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===P6.array&&X===P6.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=TG1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===P6.date&&X===P6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function jF0(J,Q){return new _F({values:J,typeName:J8.ZodEnum,...w8(Q)})}function TF0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function _F0(J,Q={},Y){if(J)return sD.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=TF0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=TF0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return sD.create()}var PF0=(J,Q)=>{if(RF(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 WY(J.common.issues);return this._error=Y,this._error}}}},$$4,X$4,G$4,Z$4,q$4,V$4,K$4,W$4,H$4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",PG1,z$4,F$4,U$4,B$4,N$4,D$4,RF0="((\\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])))",O$4,OZ,SF,jF,RE,oD,o_,CE,SE,sD,CF,NV,s_,MZ,T2,jE,vW=(J)=>{if(J instanceof kE)return vW(J.schema);else if(J instanceof wZ)return vW(J.innerType());else if(J instanceof yE)return[J.value];else if(J instanceof _F)return J.options;else if(J instanceof vE)return q9.objectValues(J.enum);else if(J instanceof xE)return vW(J._def.innerType);else if(J instanceof CE)return[void 0];else if(J instanceof SE)return[null];else if(J instanceof LZ)return[void 0,...vW(J.unwrap())];else if(J instanceof xW)return[null,...vW(J.unwrap())];else if(J instanceof El)return vW(J.unwrap());else if(J instanceof hE)return vW(J.unwrap());else if(J instanceof fE)return vW(J._def.innerType);else return[]},wl,_E,DV,t_,e_,tD,TE,kE,yE,_F,vE,eD,wZ,LZ,xW,xE,fE,Jk,I$4,El,Qk,hE,P$4,J8,T$4=(J,Q={message:`Input not instance of ${J.name}`})=>_F0((Y)=>Y instanceof J,Q),kF0,yF0,R$4,C$4,vF0,S$4,j$4,_$4,k$4,y$4,v$4,x$4,f$4,h$4,b$4,u$4,g$4,m$4,p$4,d$4,c$4,l$4,i$4,n$4,a$4,r$4,o$4,s$4,t$4,e$4,JX4,QX4,YX4,$X4,XX4=()=>kF0().optional(),GX4=()=>yF0().optional(),ZX4=()=>vF0().optional(),qX4,VX4;var xF0=G1(()=>{Ol();Ml();IF0();IG1();a_();$$4=/^c[^\s-]{8,}$/i,X$4=/^[0-9a-z]+$/,G$4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Z$4=/^[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,q$4=/^[a-z0-9_-]{21}$/i,V$4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,K$4=/^[-+]?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)?)??$/,W$4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z$4=/^(?:(?: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])$/,F$4=/^(?:(?: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])$/,U$4=/^(([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]))$/,B$4=/^(([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])$/,N$4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D$4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,O$4=new RegExp(`^${RF0}$`);OZ=class OZ extends d8{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==P6.string){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_type,expected:P6.string,received:G.parsedType}),c4}let Y=new t3,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),p6(X,{code:q6.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),p6(X,{code:q6.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)p6(X,{code:q6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)p6(X,{code:q6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!W$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"email",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!PG1)PG1=new RegExp(H$4,"u");if(!PG1.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"emoji",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!Z$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"uuid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!q$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"nanoid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!$$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"cuid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!X$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"cuid2",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!G$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"ulid",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),p6(X,{validation:"url",code:q6.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),p6(X,{validation:"regex",code:q6.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),p6(X,{code:q6.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),p6(X,{code:q6.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),p6(X,{code:q6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!SF0(G).test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{code:q6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!O$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{code:q6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!M$4(G).test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{code:q6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!K$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"duration",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!L$4(J.data,G.version))X=this._getOrReturnCtx(J,X),p6(X,{validation:"ip",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!A$4(J.data,G.alg))X=this._getOrReturnCtx(J,X),p6(X,{validation:"jwt",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!w$4(J.data,G.version))X=this._getOrReturnCtx(J,X),p6(X,{validation:"cidr",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!N$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"base64",code:q6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!D$4.test(J.data))X=this._getOrReturnCtx(J,X),p6(X,{validation:"base64url",code:q6.invalid_string,message:G.message}),Y.dirty()}else q9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:q6.invalid_string,...z4.errToObj(Y)})}_addCheck(J){return new OZ({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...z4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...z4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...z4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...z4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...z4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...z4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...z4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...z4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...z4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...z4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...z4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...z4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...z4.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,...z4.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,...z4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...z4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...z4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...z4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...z4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...z4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...z4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...z4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...z4.errToObj(Q)})}nonempty(J){return this.min(1,z4.errToObj(J))}trim(){return new OZ({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new OZ({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new OZ({...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}};OZ.create=(J)=>{return new OZ({checks:[],typeName:J8.ZodString,coerce:J?.coerce??!1,...w8(J)})};SF=class SF extends d8{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)!==P6.number){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_type,expected:P6.number,received:G.parsedType}),c4}let Y=void 0,X=new t3;for(let G of this._def.checks)if(G.kind==="int"){if(!q9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),p6(Y,{code:q6.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),p6(Y,{code:q6.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),p6(Y,{code:q6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(E$4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),p6(Y,{code:q6.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),p6(Y,{code:q6.not_finite,message:G.message}),X.dirty()}else q9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,z4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,z4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,z4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,z4.toString(Q))}setLimit(J,Q,Y,X){return new SF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:z4.toString(X)}]})}_addCheck(J){return new SF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:z4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:z4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:z4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z4.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"&&q9.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)}};SF.create=(J)=>{return new SF({checks:[],typeName:J8.ZodNumber,coerce:J?.coerce||!1,...w8(J)})};jF=class jF extends d8{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)!==P6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new t3;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),p6(Y,{code:q6.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),p6(Y,{code:q6.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),p6(Y,{code:q6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else q9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return p6(Q,{code:q6.invalid_type,expected:P6.bigint,received:Q.parsedType}),c4}gte(J,Q){return this.setLimit("min",J,!0,z4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,z4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,z4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,z4.toString(Q))}setLimit(J,Q,Y,X){return new jF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:z4.toString(X)}]})}_addCheck(J){return new jF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:z4.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}};jF.create=(J)=>{return new jF({checks:[],typeName:J8.ZodBigInt,coerce:J?.coerce??!1,...w8(J)})};RE=class RE extends d8{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==P6.boolean){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.boolean,received:Y.parsedType}),c4}return lJ(J.data)}};RE.create=(J)=>{return new RE({typeName:J8.ZodBoolean,coerce:J?.coerce||!1,...w8(J)})};oD=class oD extends d8{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==P6.date){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_type,expected:P6.date,received:G.parsedType}),c4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return p6(G,{code:q6.invalid_date}),c4}let Y=new t3,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),p6(X,{code:q6.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),p6(X,{code:q6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else q9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new oD({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:z4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:z4.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}};oD.create=(J)=>{return new oD({checks:[],coerce:J?.coerce||!1,typeName:J8.ZodDate,...w8(J)})};o_=class o_ extends d8{_parse(J){if(this._getType(J)!==P6.symbol){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.symbol,received:Y.parsedType}),c4}return lJ(J.data)}};o_.create=(J)=>{return new o_({typeName:J8.ZodSymbol,...w8(J)})};CE=class CE extends d8{_parse(J){if(this._getType(J)!==P6.undefined){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.undefined,received:Y.parsedType}),c4}return lJ(J.data)}};CE.create=(J)=>{return new CE({typeName:J8.ZodUndefined,...w8(J)})};SE=class SE extends d8{_parse(J){if(this._getType(J)!==P6.null){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.null,received:Y.parsedType}),c4}return lJ(J.data)}};SE.create=(J)=>{return new SE({typeName:J8.ZodNull,...w8(J)})};sD=class sD extends d8{constructor(){super(...arguments);this._any=!0}_parse(J){return lJ(J.data)}};sD.create=(J)=>{return new sD({typeName:J8.ZodAny,...w8(J)})};CF=class CF extends d8{constructor(){super(...arguments);this._unknown=!0}_parse(J){return lJ(J.data)}};CF.create=(J)=>{return new CF({typeName:J8.ZodUnknown,...w8(J)})};NV=class NV extends d8{_parse(J){let Q=this._getOrReturnCtx(J);return p6(Q,{code:q6.invalid_type,expected:P6.never,received:Q.parsedType}),c4}};NV.create=(J)=>{return new NV({typeName:J8.ZodNever,...w8(J)})};s_=class s_ extends d8{_parse(J){if(this._getType(J)!==P6.undefined){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.void,received:Y.parsedType}),c4}return lJ(J.data)}};s_.create=(J)=>{return new s_({typeName:J8.ZodVoid,...w8(J)})};MZ=class MZ extends d8{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==P6.array)return p6(Q,{code:q6.invalid_type,expected:P6.array,received:Q.parsedType}),c4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)p6(Q,{code:Z?q6.too_big:q6.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)p6(Q,{code:q6.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)p6(Q,{code:q6.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 AZ(Q,Z,Q.path,q))})).then((Z)=>{return t3.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new AZ(Q,Z,Q.path,q))});return t3.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new MZ({...this._def,minLength:{value:J,message:z4.toString(Q)}})}max(J,Q){return new MZ({...this._def,maxLength:{value:J,message:z4.toString(Q)}})}length(J,Q){return new MZ({...this._def,exactLength:{value:J,message:z4.toString(Q)}})}nonempty(J){return this.min(1,J)}};MZ.create=(J,Q)=>{return new MZ({type:J,minLength:null,maxLength:null,exactLength:null,typeName:J8.ZodArray,...w8(Q)})};T2=class T2 extends d8{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=q9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==P6.object){let K=this._getOrReturnCtx(J);return p6(K,{code:q6.invalid_type,expected:P6.object,received:K.parsedType}),c4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof NV&&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 AZ(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof NV){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)p6(X,{code:q6.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 AZ(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 t3.mergeObjectSync(Y,K)});else return t3.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return z4.errToObj,new T2({...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:z4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new T2({...this._def,unknownKeys:"strip"})}passthrough(){return new T2({...this._def,unknownKeys:"passthrough"})}extend(J){return new T2({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new T2({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:J8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new T2({...this._def,catchall:J})}pick(J){let Q={};for(let Y of q9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new T2({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of q9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new T2({...this._def,shape:()=>Q})}deepPartial(){return PE(this)}partial(J){let Q={};for(let Y of q9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new T2({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of q9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof LZ)G=G._def.innerType;Q[Y]=G}return new T2({...this._def,shape:()=>Q})}keyof(){return jF0(q9.objectKeys(this.shape))}};T2.create=(J,Q)=>{return new T2({shape:()=>J,unknownKeys:"strip",catchall:NV.create(),typeName:J8.ZodObject,...w8(Q)})};T2.strictCreate=(J,Q)=>{return new T2({shape:()=>J,unknownKeys:"strict",catchall:NV.create(),typeName:J8.ZodObject,...w8(Q)})};T2.lazycreate=(J,Q)=>{return new T2({shape:J,unknownKeys:"strip",catchall:NV.create(),typeName:J8.ZodObject,...w8(Q)})};jE=class jE extends d8{_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 WY(q.ctx.common.issues));return p6(Q,{code:q6.invalid_union,unionErrors:Z}),c4}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 WY(V));return p6(Q,{code:q6.invalid_union,unionErrors:q}),c4}}get options(){return this._def.options}};jE.create=(J,Q)=>{return new jE({options:J,typeName:J8.ZodUnion,...w8(Q)})};wl=class wl extends d8{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==P6.object)return p6(Q,{code:q6.invalid_type,expected:P6.object,received:Q.parsedType}),c4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return p6(Q,{code:q6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),c4;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=vW(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 wl({typeName:J8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...w8(Y)})}};_E=class _E extends d8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(Ll(G)||Ll(Z))return c4;let q=TG1(G.value,Z.value);if(!q.valid)return p6(Y,{code:q6.invalid_intersection_types}),c4;if(Al(G)||Al(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}))}};_E.create=(J,Q,Y)=>{return new _E({left:J,right:Q,typeName:J8.ZodIntersection,...w8(Y)})};DV=class DV extends d8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==P6.array)return p6(Y,{code:q6.invalid_type,expected:P6.array,received:Y.parsedType}),c4;if(Y.data.length<this._def.items.length)return p6(Y,{code:q6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c4;if(!this._def.rest&&Y.data.length>this._def.items.length)p6(Y,{code:q6.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 AZ(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return t3.mergeArray(Q,Z)});else return t3.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new DV({...this._def,rest:J})}};DV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new DV({items:J,typeName:J8.ZodTuple,rest:null,...w8(Q)})};t_=class t_ extends d8{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!==P6.object)return p6(Y,{code:q6.invalid_type,expected:P6.object,received:Y.parsedType}),c4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new AZ(Y,q,Y.path,q)),value:Z._parse(new AZ(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return t3.mergeObjectAsync(Q,X);else return t3.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof d8)return new t_({keyType:J,valueType:Q,typeName:J8.ZodRecord,...w8(Y)});return new t_({keyType:OZ.create(),valueType:J,typeName:J8.ZodRecord,...w8(Q)})}};e_=class e_ extends d8{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!==P6.map)return p6(Y,{code:q6.invalid_type,expected:P6.map,received:Y.parsedType}),c4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new AZ(Y,q,Y.path,[K,"key"])),value:G._parse(new AZ(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 c4;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 c4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};e_.create=(J,Q,Y)=>{return new e_({valueType:Q,keyType:J,typeName:J8.ZodMap,...w8(Y)})};tD=class tD extends d8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==P6.set)return p6(Y,{code:q6.invalid_type,expected:P6.set,received:Y.parsedType}),c4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)p6(Y,{code:q6.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)p6(Y,{code:q6.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 c4;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 AZ(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 tD({...this._def,minSize:{value:J,message:z4.toString(Q)}})}max(J,Q){return new tD({...this._def,maxSize:{value:J,message:z4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};tD.create=(J,Q)=>{return new tD({valueType:J,minSize:null,maxSize:null,typeName:J8.ZodSet,...w8(Q)})};TE=class TE extends d8{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==P6.function)return p6(Q,{code:q6.invalid_type,expected:P6.function,received:Q.parsedType}),c4;function Y(q,V){return r_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,EE(),yW].filter((K)=>!!K),issueData:{code:q6.invalid_arguments,argumentsError:V}})}function X(q,V){return r_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,EE(),yW].filter((K)=>!!K),issueData:{code:q6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof eD){let q=this;return lJ(async function(...V){let K=new WY([]),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 lJ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new WY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new WY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new TE({...this._def,args:DV.create(J).rest(CF.create())})}returns(J){return new TE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new TE({args:J?J:DV.create([]).rest(CF.create()),returns:Q||CF.create(),typeName:J8.ZodFunction,...w8(Y)})}};kE=class kE extends d8{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})}};kE.create=(J,Q)=>{return new kE({getter:J,typeName:J8.ZodLazy,...w8(Q)})};yE=class yE extends d8{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return p6(Q,{received:Q.data,code:q6.invalid_literal,expected:this._def.value}),c4}return{status:"valid",value:J.data}}get value(){return this._def.value}};yE.create=(J,Q)=>{return new yE({value:J,typeName:J8.ZodLiteral,...w8(Q)})};_F=class _F extends d8{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return p6(Q,{expected:q9.joinValues(Y),received:Q.parsedType,code:q6.invalid_type}),c4}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 p6(Q,{received:Q.data,code:q6.invalid_enum_value,options:Y}),c4}return lJ(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 _F.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return _F.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};_F.create=jF0;vE=class vE extends d8{_parse(J){let Q=q9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==P6.string&&Y.parsedType!==P6.number){let X=q9.objectValues(Q);return p6(Y,{expected:q9.joinValues(X),received:Y.parsedType,code:q6.invalid_type}),c4}if(!this._cache)this._cache=new Set(q9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=q9.objectValues(Q);return p6(Y,{received:Y.data,code:q6.invalid_enum_value,options:X}),c4}return lJ(J.data)}get enum(){return this._def.values}};vE.create=(J,Q)=>{return new vE({values:J,typeName:J8.ZodNativeEnum,...w8(Q)})};eD=class eD extends d8{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==P6.promise&&Q.common.async===!1)return p6(Q,{code:q6.invalid_type,expected:P6.promise,received:Q.parsedType}),c4;let Y=Q.parsedType===P6.promise?Q.data:Promise.resolve(Q.data);return lJ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};eD.create=(J,Q)=>{return new eD({type:J,typeName:J8.ZodPromise,...w8(Q)})};wZ=class wZ extends d8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J8.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(p6(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 c4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return c4;if(V.status==="dirty")return rD(V.value);if(Q.value==="dirty")return rD(V.value);return V});else{if(Q.value==="aborted")return c4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return c4;if(q.status==="dirty")return rD(q.value);if(Q.value==="dirty")return rD(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 c4;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 c4;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(!RF(Z))return c4;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(!RF(Z))return c4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});q9.assertNever(X)}};wZ.create=(J,Q,Y)=>{return new wZ({schema:J,typeName:J8.ZodEffects,effect:Q,...w8(Y)})};wZ.createWithPreprocess=(J,Q,Y)=>{return new wZ({schema:Q,effect:{type:"preprocess",transform:J},typeName:J8.ZodEffects,...w8(Y)})};LZ=class LZ extends d8{_parse(J){if(this._getType(J)===P6.undefined)return lJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};LZ.create=(J,Q)=>{return new LZ({innerType:J,typeName:J8.ZodOptional,...w8(Q)})};xW=class xW extends d8{_parse(J){if(this._getType(J)===P6.null)return lJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};xW.create=(J,Q)=>{return new xW({innerType:J,typeName:J8.ZodNullable,...w8(Q)})};xE=class xE extends d8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===P6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};xE.create=(J,Q)=>{return new xE({innerType:J,typeName:J8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...w8(Q)})};fE=class fE extends d8{_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(IE(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};fE.create=(J,Q)=>{return new fE({innerType:J,typeName:J8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...w8(Q)})};Jk=class Jk extends d8{_parse(J){if(this._getType(J)!==P6.nan){let Y=this._getOrReturnCtx(J);return p6(Y,{code:q6.invalid_type,expected:P6.nan,received:Y.parsedType}),c4}return{status:"valid",value:J.data}}};Jk.create=(J)=>{return new Jk({typeName:J8.ZodNaN,...w8(J)})};I$4=Symbol("zod_brand");El=class El extends d8{_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}};Qk=class Qk extends d8{_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 c4;if(G.status==="dirty")return Q.dirty(),rD(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 c4;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 Qk({in:J,out:Q,typeName:J8.ZodPipeline})}};hE=class hE extends d8{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(RF(X))X.value=Object.freeze(X.value);return X};return IE(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};hE.create=(J,Q)=>{return new hE({innerType:J,typeName:J8.ZodReadonly,...w8(Q)})};P$4={object:T2.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"})(J8||(J8={}));kF0=OZ.create,yF0=SF.create,R$4=Jk.create,C$4=jF.create,vF0=RE.create,S$4=oD.create,j$4=o_.create,_$4=CE.create,k$4=SE.create,y$4=sD.create,v$4=CF.create,x$4=NV.create,f$4=s_.create,h$4=MZ.create,b$4=T2.create,u$4=T2.strictCreate,g$4=jE.create,m$4=wl.create,p$4=_E.create,d$4=DV.create,c$4=t_.create,l$4=e_.create,i$4=tD.create,n$4=TE.create,a$4=kE.create,r$4=yE.create,o$4=_F.create,s$4=vE.create,t$4=eD.create,e$4=wZ.create,JX4=LZ.create,QX4=xW.create,YX4=wZ.createWithPreprocess,$X4=Qk.create,qX4={string:(J)=>OZ.create({...J,coerce:!0}),number:(J)=>SF.create({...J,coerce:!0}),boolean:(J)=>RE.create({...J,coerce:!0}),bigint:(J)=>jF.create({...J,coerce:!0}),date:(J)=>oD.create({...J,coerce:!0})},VX4=c4});var J1={};v8(J1,{void:()=>f$4,util:()=>q9,unknown:()=>v$4,union:()=>g$4,undefined:()=>_$4,tuple:()=>d$4,transformer:()=>e$4,symbol:()=>j$4,string:()=>kF0,strictObject:()=>u$4,setErrorMap:()=>Q$4,set:()=>i$4,record:()=>c$4,quotelessJson:()=>eY4,promise:()=>t$4,preprocess:()=>YX4,pipeline:()=>$X4,ostring:()=>XX4,optional:()=>JX4,onumber:()=>GX4,oboolean:()=>ZX4,objectUtil:()=>wG1,object:()=>b$4,number:()=>yF0,nullable:()=>QX4,null:()=>k$4,never:()=>x$4,nativeEnum:()=>s$4,nan:()=>R$4,map:()=>l$4,makeIssue:()=>r_,literal:()=>r$4,lazy:()=>a$4,late:()=>P$4,isValid:()=>RF,isDirty:()=>Al,isAsync:()=>IE,isAborted:()=>Ll,intersection:()=>p$4,instanceof:()=>T$4,getParsedType:()=>BV,getErrorMap:()=>EE,function:()=>n$4,enum:()=>o$4,effect:()=>e$4,discriminatedUnion:()=>m$4,defaultErrorMap:()=>yW,datetimeRegex:()=>SF0,date:()=>S$4,custom:()=>_F0,coerce:()=>qX4,boolean:()=>vF0,bigint:()=>C$4,array:()=>h$4,any:()=>y$4,addIssueToContext:()=>p6,ZodVoid:()=>s_,ZodUnknown:()=>CF,ZodUnion:()=>jE,ZodUndefined:()=>CE,ZodType:()=>d8,ZodTuple:()=>DV,ZodTransformer:()=>wZ,ZodSymbol:()=>o_,ZodString:()=>OZ,ZodSet:()=>tD,ZodSchema:()=>d8,ZodRecord:()=>t_,ZodReadonly:()=>hE,ZodPromise:()=>eD,ZodPipeline:()=>Qk,ZodParsedType:()=>P6,ZodOptional:()=>LZ,ZodObject:()=>T2,ZodNumber:()=>SF,ZodNullable:()=>xW,ZodNull:()=>SE,ZodNever:()=>NV,ZodNativeEnum:()=>vE,ZodNaN:()=>Jk,ZodMap:()=>e_,ZodLiteral:()=>yE,ZodLazy:()=>kE,ZodIssueCode:()=>q6,ZodIntersection:()=>_E,ZodFunction:()=>TE,ZodFirstPartyTypeKind:()=>J8,ZodError:()=>WY,ZodEnum:()=>_F,ZodEffects:()=>wZ,ZodDiscriminatedUnion:()=>wl,ZodDefault:()=>xE,ZodDate:()=>oD,ZodCatch:()=>fE,ZodBranded:()=>El,ZodBoolean:()=>RE,ZodBigInt:()=>jF,ZodArray:()=>MZ,ZodAny:()=>sD,Schema:()=>d8,ParseStatus:()=>t3,OK:()=>lJ,NEVER:()=>VX4,INVALID:()=>c4,EMPTY_PATH:()=>Y$4,DIRTY:()=>rD,BRAND:()=>I$4});var RG1=G1(()=>{Ml();IG1();EF0();a_();xF0();Ol()});var JO=G1(()=>{RG1();RG1()});function WX4(J){return fF0.safeParse(J)}function kF(J){return KX4.safeParse(J)}function bE(J){if(!J||!Array.isArray(J))return[];let Q=[];for(let[Y,X]of J.entries()){let G=WX4(X);if(G.success)Q.push(G.data);else{let Z=typeof X==="object"&&X!==null&&"tool"in X?String(X.tool):`entry at index ${Y}`;x.warn(`Permission entry for tool "${Z}" is invalid: ${G.error.errors.map((q)=>`${q.path.join(".")}: ${q.message}`).join(", ")}`)}}return Q}var CG1,fF0,KX4;var QO=G1(()=>{JO();H0();CG1=J1.lazy(()=>J1.union([J1.string().describe('Pattern match where "*" matches any number of any characters'),J1.array(CG1).min(1).describe("OR match of each entry"),J1.boolean().describe("A literal boolean match"),J1.number().describe("A literal number match"),J1.null().describe("A literal null match"),J1.undefined().describe("A literal undefined match"),J1.record(J1.string(),CG1).describe("Matching individual keys of an object")])),fF0=J1.object({tool:J1.string().min(1).describe("The name of the tool to which this entry applies"),matches:J1.record(J1.string(),CG1).optional().describe("Maps tool inputs to conditions"),action:J1.enum(["allow","reject","ask","delegate"]).describe("How Amp should proceed in case of a match"),context:J1.enum(["thread","subagent"]).optional().describe("Only apply this entry in this context"),to:J1.string().min(1).optional().describe('Command to delegate to when action is "delegate"')}).superRefine((J,Q)=>{if(J.action==="delegate"&&!J.to)Q.addIssue({code:J1.ZodIssueCode.custom,message:'delegate action requires "to" field',path:["to"]});if(J.action!=="delegate"&&J.to)Q.addIssue({code:J1.ZodIssueCode.custom,message:'"to" field only allowed with delegate action',path:["to"]})}),KX4=J1.array(fF0).describe("Entries checked in sequence to configure tool permissions")});function iJ(J,Q){let Y=HX4(J,Q);return typeof Y==="string"?Y:Y.toString()}function HX4(J,Q,Y=!0){if(!Q)Q=zX4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?p0.parse(J):p0.from(J);if(X)for(let V of X){let K=d4(V);if(t0.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?cD(K.path)+(G?"\\":"/"):"";return SG1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=d4(Z);if(t0.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return SG1("~"+(G?"\\":"/")+W,G,q.scheme)}}return SG1(q.fsPath,G,q.scheme)}return q}function SG1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function Pl(J){let Q=Il;return Il=J,Q}function zX4(){if(Il)return Il;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Il=null;var fW=G1(()=>{J4();NE();ql()});var FX4=(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},uE=(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),uE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),uE(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),uE(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),uE(J);break;case"delimiter":return J=J.slice(0,J.length-1),uE(J);break}return J},UX4=(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},BX4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},bX=(J)=>JSON.parse(BX4(UX4(uE(FX4(J)))));var YO=()=>{};function nJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function GO(J){return!!J&&!!J[H$]}function yF(J){if(!J)return!1;return mF0(J)||Array.isArray(J)||!!J[Yk]||!!J.constructor?.[Yk]||qk(J)||Vk(J)}function mF0(J){if(!J||typeof J!=="object")return!1;let Q=XO(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)===NX4}function $k(J,Q){if(ZO(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function ZO(J){let Q=J[H$];return Q?Q.type_:Array.isArray(J)?1:qk(J)?2:Vk(J)?3:0}function Xk(J,Q){return ZO(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function jG1(J,Q){return ZO(J)===2?J.get(Q):J[Q]}function pF0(J,Q,Y){let X=ZO(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function DX4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function qk(J){return J instanceof Map}function Vk(J){return J instanceof Set}function $O(J){return J.copy_||J.base_}function yG1(J,Q){if(qk(J))return new Map(J);if(Vk(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=mF0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[H$];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(XO(J),X)}else{let X=XO(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function F$(J,Q=!1){if(Cl(J)||GO(J)||!yF(J))return J;if(ZO(J)>1)J.set=J.add=J.clear=J.delete=OX4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>F$(X,!0));return J}function OX4(){nJ(2)}function Cl(J){return Object.isFrozen(J)}function qO(J){let Q=vG1[J];if(!Q)nJ(0,J);return Q}function MX4(J,Q){if(!vG1[J])vG1[J]=Q}function dF0(){return Gk}function LX4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function hF0(J,Q){if(Q)qO("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function xG1(J){fG1(J),J.drafts_.forEach(AX4),J.drafts_=null}function fG1(J){if(J===Gk)Gk=J.parent_}function bF0(J){return Gk=LX4(Gk,J)}function AX4(J){let Q=J[H$];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function uF0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[H$].modified_)xG1(Q),nJ(4);if(yF(J)){if(J=Tl(Q,J),!Q.parent_)Rl(Q,J)}if(Q.patches_)qO("Patches").generateReplacementPatches_(Y[H$].base_,J,Q.patches_,Q.inversePatches_)}else J=Tl(Q,Y,[]);if(xG1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==uG1?J:void 0}function Tl(J,Q,Y){if(Cl(Q))return Q;let X=Q[H$];if(!X)return $k(Q,(G,Z)=>gF0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Rl(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($k(Z,(V,K)=>gF0(J,X,G,V,K,Y,q)),Rl(J,G,!1),Y&&J.patches_)qO("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function gF0(J,Q,Y,X,G,Z,q){if(GO(G)){let V=Z&&Q&&Q.type_!==3&&!Xk(Q.assigned_,X)?Z.concat(X):void 0,K=Tl(J,G,V);if(pF0(Y,X,K),GO(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(yF(G)&&!Cl(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Tl(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))Rl(J,G)}}function Rl(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)F$(Q,Y)}function wX4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:dF0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=gG1;if(Y)G=[X],Z=Zk;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function _G1(J,Q){let Y=J[H$];return(Y?$O(Y):J)[Q]}function EX4(J,Q,Y){let X=cF0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function cF0(J,Q){if(!(Q in J))return;let Y=XO(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=XO(Y)}return}function hG1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)hG1(J.parent_)}}function kG1(J){if(!J.copy_)J.copy_=yG1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function bG1(J,Q){let Y=qk(J)?qO("MapSet").proxyMap_(J,Q):Vk(J)?qO("MapSet").proxySet_(J,Q):wX4(J,Q);return(Q?Q.scope_:dF0()).drafts_.push(Y),Y}function PX4(J){if(!GO(J))nJ(10,J);return lF0(J)}function lF0(J){if(!yF(J)||Cl(J))return J;let Q=J[H$],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=yG1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=yG1(J,!0);if($k(Y,(X,G)=>{pF0(Y,X,lF0(G))}),Q)Q.finalized_=!1;return Y}function Sl(){let Q="replace",Y="add",X="remove";function G(U,B,O,M){switch(U.type_){case 0:case 2:return q(U,B,O,M);case 1:return Z(U,B,O,M);case 3:return V(U,B,O,M)}}function Z(U,B,O,M){let{base_:L,assigned_:E}=U,I=U.copy_;if(I.length<L.length)[L,I]=[I,L],[O,M]=[M,O];for(let P=0;P<L.length;P++)if(E[P]&&I[P]!==L[P]){let R=B.concat([P]);O.push({op:Q,path:R,value:z(I[P])}),M.push({op:Q,path:R,value:z(L[P])})}for(let P=L.length;P<I.length;P++){let R=B.concat([P]);O.push({op:Y,path:R,value:z(I[P])})}for(let P=I.length-1;L.length<=P;--P){let R=B.concat([P]);M.push({op:X,path:R})}}function q(U,B,O,M){let{base_:L,copy_:E}=U;$k(U.assigned_,(I,P)=>{let R=jG1(L,I),j=jG1(E,I),y=!P?X:Xk(L,I)?Q:Y;if(R===j&&y===Q)return;let h=B.concat(I);O.push(y===X?{op:y,path:h}:{op:y,path:h,value:j}),M.push(y===Y?{op:X,path:h}:y===X?{op:Y,path:h,value:z(R)}:{op:Q,path:h,value:z(R)})})}function V(U,B,O,M){let{base_:L,copy_:E}=U,I=0;L.forEach((P)=>{if(!E.has(P)){let R=B.concat([I]);O.push({op:X,path:R,value:P}),M.unshift({op:Y,path:R,value:P})}I++}),I=0,E.forEach((P)=>{if(!L.has(P)){let R=B.concat([I]);O.push({op:Y,path:R,value:P}),M.unshift({op:X,path:R,value:P})}I++})}function K(U,B,O,M){O.push({op:Q,path:[],value:B===uG1?void 0:B}),M.push({op:Q,path:[],value:U})}function W(U,B){return B.forEach((O)=>{let{path:M,op:L}=O,E=U;for(let j=0;j<M.length-1;j++){let y=ZO(E),h=M[j];if(typeof h!=="string"&&typeof h!=="number")h=""+h;if((y===0||y===1)&&(h==="__proto__"||h==="constructor"))nJ(19);if(typeof E==="function"&&h==="prototype")nJ(19);if(E=jG1(E,h),typeof E!=="object")nJ(18,M.join("/"))}let I=ZO(E),P=H(O.value),R=M[M.length-1];switch(L){case Q:switch(I){case 2:return E.set(R,P);case 3:nJ(16);default:return E[R]=P}case Y:switch(I){case 1:return R==="-"?E.push(P):E.splice(R,0,P);case 2:return E.set(R,P);case 3:return E.add(P);default:return E[R]=P}case X:switch(I){case 1:return E.splice(R,1);case 2:return E.delete(R);case 3:return E.delete(O.value);default:return delete E[R]}default:nJ(17,L)}}),U}function H(U){if(!yF(U))return U;if(Array.isArray(U))return U.map(H);if(qk(U))return new Map(Array.from(U.entries()).map(([O,M])=>[O,H(M)]));if(Vk(U))return new Set(Array.from(U).map(H));let B=Object.create(XO(U));for(let O in U)B[O]=H(U[O]);if(Xk(U,Yk))B[Yk]=U[Yk];return B}function z(U){if(GO(U))return H(U);else return U}MX4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function f8(J){return J}var uG1,Yk,H$,XO,NX4,vG1,Gk,gG1,Zk,IX4=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")nJ(6);if(X!==void 0&&typeof X!=="function")nJ(7);let G;if(yF(Q)){let Z=bF0(this),q=bG1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)xG1(Z);else fG1(Z)}return hF0(Z,X),uF0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===uG1)G=void 0;if(this.autoFreeze_)F$(G,!0);if(X){let Z=[],q=[];qO("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else nJ(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(!yF(J))nJ(8);if(GO(J))J=PX4(J);let Q=bF0(this),Y=bG1(J,void 0);return Y[H$].isManual_=!0,fG1(Q),Y}finishDraft(J,Q){let Y=J&&J[H$];if(!Y||!Y.isManual_)nJ(9);let{scope_:X}=Y;return hF0(X,Q),uF0(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=qO("Patches").applyPatches_;if(GO(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},z$,vF,VO,ig8,ng8,iF0,ag8,rg8;var HY=G1(()=>{uG1=Symbol.for("immer-nothing"),Yk=Symbol.for("immer-draftable"),H$=Symbol.for("immer-state");XO=Object.getPrototypeOf;NX4=Object.prototype.constructor.toString();vG1={};gG1={get(J,Q){if(Q===H$)return J;let Y=$O(J);if(!Xk(Y,Q))return EX4(J,Y,Q);let X=Y[Q];if(J.finalized_||!yF(X))return X;if(X===_G1(J.base_,Q))return kG1(J),J.copy_[Q]=bG1(X,J);return X},has(J,Q){return Q in $O(J)},ownKeys(J){return Reflect.ownKeys($O(J))},set(J,Q,Y){let X=cF0($O(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=_G1($O(J),Q),Z=G?.[H$];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(DX4(Y,G)&&(Y!==void 0||Xk(J.base_,Q)))return!0;kG1(J),hG1(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(_G1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,kG1(J),hG1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=$O(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(){nJ(11)},getPrototypeOf(J){return XO(J.base_)},setPrototypeOf(){nJ(12)}},Zk={};$k(gG1,(J,Q)=>{Zk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});Zk.deleteProperty=function(J,Q){return Zk.set.call(this,J,Q,void 0)};Zk.set=function(J,Q,Y){return gG1.set.call(this,J[0],Q,Y,J[0])};z$=new IX4,vF=z$.produce,VO=z$.produceWithPatches.bind(z$),ig8=z$.setAutoFreeze.bind(z$),ng8=z$.setUseStrictShallowCopy.bind(z$),iF0=z$.applyPatches.bind(z$),ag8=z$.createDraft.bind(z$),rg8=z$.finishDraft.bind(z$)});function mG1({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 gE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(TX4,"")}var TX4;var jl=G1(()=>{TX4=mG1()});var aF0=f((Qm8,pG1)=>{var xF={};if(typeof pG1>"u")window.eastasianwidth=xF;else pG1.exports=xF;xF.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"};xF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function nF0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}xF.length=function(J){var Q=nF0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};xF.slice=function(J,Q,Y){if(textLen=xF.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=nF0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=xF.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var dG1=f((Ym8,rF0)=>{rF0.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 RX4,CX4;var oF0=G1(()=>{jl();RX4=U6(aF0(),1),CX4=U6(dG1(),1)});function _l(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var cG1=G1(()=>{oF0()});var sF0="run_terminal_command",tF0="read_file",e3="Task",eF0="chat_llm",t8="finder",mE="fast_finder",fF="xai_finder",hF="kimiK2_finder",pE="gossip_finder",dE="sonoma_finder",zY="get_diagnostics",o9="Bash",kl="InteractiveShell",a5="oracle",OV="mermaid",MV="todo_read",G2="todo_write",G7="read_web_page",yl="read_thread",r5="create_file",Z7="glob",JU0="Glob",vl="undo_edit",xl="read_mcp_resource",b6="Read",v2="edit_file",cE="format_file",I3="web_search",E8="Grep",KO="Check",U$="librarian",fl="kraken",QU0="read_artifact",YU0="edit_artifact",hl="read_plan",lE="edit_plan",bl="read_github",ul="search_github",gl="commit_search",ml="list_directory_github",pl="list_repositories",dl="glob_github",cl="diff",$U0="bookkeeper",XU0="describe_workbook",GU0="execute_query",Kk="skill",ZU0;var q4=G1(()=>{ZU0=["Task","chat_llm","finder","fast_finder","xai_finder","kimiK2_finder","gossip_finder","sonoma_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","librarian","bookkeeper","read_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var Wk=f((Km8,VU0)=>{var qU0={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:"/"},SX4={...qU0,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:"\\"},jX4={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"};VU0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:jX4,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?SX4:qU0}}});var Hk=f((xX4)=>{var{REGEX_BACKSLASH:_X4,REGEX_REMOVE_BACKSLASH:kX4,REGEX_SPECIAL_CHARS:yX4,REGEX_SPECIAL_CHARS_GLOBAL:vX4}=Wk();xX4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);xX4.hasRegexChars=(J)=>yX4.test(J);xX4.isRegexChar=(J)=>J.length===1&&xX4.hasRegexChars(J);xX4.escapeRegex=(J)=>J.replace(vX4,"\\$1");xX4.toPosixSlashes=(J)=>J.replace(_X4,"/");xX4.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};xX4.removeBackslashes=(J)=>{return J.replace(kX4,(Q)=>{return Q==="\\"?"":Q})};xX4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return xX4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};xX4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};xX4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};xX4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var OU0=f((Hm8,DU0)=>{var HU0=Hk(),{CHAR_ASTERISK:lG1,CHAR_AT:lX4,CHAR_BACKWARD_SLASH:zk,CHAR_COMMA:iX4,CHAR_DOT:iG1,CHAR_EXCLAMATION_MARK:nG1,CHAR_FORWARD_SLASH:NU0,CHAR_LEFT_CURLY_BRACE:aG1,CHAR_LEFT_PARENTHESES:rG1,CHAR_LEFT_SQUARE_BRACKET:nX4,CHAR_PLUS:aX4,CHAR_QUESTION_MARK:zU0,CHAR_RIGHT_CURLY_BRACE:rX4,CHAR_RIGHT_PARENTHESES:FU0,CHAR_RIGHT_SQUARE_BRACKET:oX4}=Wk(),UU0=(J)=>{return J===NU0||J===zk},BU0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},sX4=(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,B=!1,O=!1,M=!1,L=!1,E=!1,I=!1,P=!1,R=!1,j=!1,y=0,h,g,p={value:"",depth:0,isGlob:!1},b=()=>W>=X,i=()=>K.charCodeAt(W+1),t=()=>{return h=g,K.charCodeAt(++W)};while(W<X){g=t();let H1;if(g===zk){if(I=p.backslashes=!0,g=t(),g===aG1)E=!0;continue}if(E===!0||g===aG1){y++;while(b()!==!0&&(g=t())){if(g===zk){I=p.backslashes=!0,t();continue}if(g===aG1){y++;continue}if(E!==!0&&g===iG1&&(g=t())===iG1){if(U=p.isBrace=!0,O=p.isGlob=!0,j=!0,G===!0)continue;break}if(E!==!0&&g===iX4){if(U=p.isBrace=!0,O=p.isGlob=!0,j=!0,G===!0)continue;break}if(g===rX4){if(y--,y===0){E=!1,U=p.isBrace=!0,j=!0;break}}}if(G===!0)continue;break}if(g===NU0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},j===!0)continue;if(h===iG1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((g===aX4||g===lX4||g===lG1||g===zU0||g===nG1)===!0&&i()===rG1){if(O=p.isGlob=!0,M=p.isExtglob=!0,j=!0,g===nG1&&W===H)R=!0;if(G===!0){while(b()!==!0&&(g=t())){if(g===zk){I=p.backslashes=!0,g=t();continue}if(g===FU0){O=p.isGlob=!0,j=!0;break}}continue}break}}if(g===lG1){if(h===lG1)L=p.isGlobstar=!0;if(O=p.isGlob=!0,j=!0,G===!0)continue;break}if(g===zU0){if(O=p.isGlob=!0,j=!0,G===!0)continue;break}if(g===nX4){while(b()!==!0&&(H1=t())){if(H1===zk){I=p.backslashes=!0,t();continue}if(H1===oX4){B=p.isBracket=!0,O=p.isGlob=!0,j=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&g===nG1&&W===H){P=p.negated=!0,H++;continue}if(Y.noparen!==!0&&g===rG1){if(O=p.isGlob=!0,G===!0){while(b()!==!0&&(g=t())){if(g===rG1){I=p.backslashes=!0,g=t();continue}if(g===FU0){j=!0;break}}continue}break}if(O===!0){if(j=!0,G===!0)continue;break}}if(Y.noext===!0)M=!1,O=!1;let r=K,m="",s="";if(H>0)m=K.slice(0,H),K=K.slice(H),z-=H;if(r&&O===!0&&z>0)r=K.slice(0,z),s=K.slice(z);else if(O===!0)r="",s=K;else r=K;if(r&&r!==""&&r!=="/"&&r!==K){if(UU0(r.charCodeAt(r.length-1)))r=r.slice(0,-1)}if(Y.unescape===!0){if(s)s=HU0.removeBackslashes(s);if(r&&I===!0)r=HU0.removeBackslashes(r)}let q1={prefix:m,input:J,start:H,base:r,glob:s,isBrace:U,isBracket:B,isGlob:O,isExtglob:M,isGlobstar:L,negated:P,negatedExtglob:R};if(Y.tokens===!0){if(q1.maxDepth=0,!UU0(g))q.push(p);q1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let H1;for(let a=0;a<Z.length;a++){let o=H1?H1+1:H,l=Z[a],z1=J.slice(o,l);if(Y.tokens){if(a===0&&H!==0)q[a].isPrefix=!0,q[a].value=m;else q[a].value=z1;BU0(q[a]),q1.maxDepth+=q[a].depth}if(a!==0||z1!=="")V.push(z1);H1=l}if(H1&&H1+1<J.length){let a=J.slice(H1+1);if(V.push(a),Y.tokens)q[q.length-1].value=a,BU0(q[q.length-1]),q1.maxDepth+=q[q.length-1].depth}q1.slashes=Z,q1.parts=V}return q1};DU0.exports=sX4});var AU0=f((zm8,LU0)=>{var ll=Wk(),LV=Hk(),{MAX_LENGTH:il,POSIX_REGEX_SOURCE:tX4,REGEX_NON_SPECIAL_CHARS:eX4,REGEX_SPECIAL_CHARS_BACKREF:JG4,REPLACEMENTS:MU0}=ll,QG4=(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)=>LV.escapeRegex(G)).join("..")}return Y},iE=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},oG1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=MU0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(il,Y.maxLength):il,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=ll.globChars(Y.windows),W=ll.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:B,DOTS_SLASH:O,NO_DOT:M,NO_DOT_SLASH:L,NO_DOTS_SLASH:E,QMARK:I,QMARK_NO_DOT:P,STAR:R,START_ANCHOR:j}=K,y=(a1)=>{return`(${V}(?:(?!${j}${a1.dot?O:H}).)*?)`},h=Y.dot?"":M,g=Y.dot?I:P,p=Y.bash===!0?y(Y):R;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=LV.removePrefix(J,b),G=J.length;let i=[],t=[],r=[],m=Z,s,q1=()=>b.index===G-1,H1=b.peek=(a1=1)=>J[b.index+a1],a=b.advance=()=>J[++b.index]||"",o=()=>J.slice(b.index+1),l=(a1="",F1=0)=>{b.consumed+=a1,b.index+=F1},z1=(a1)=>{b.output+=a1.output!=null?a1.output:a1.value,l(a1.value)},j1=()=>{let a1=1;while(H1()==="!"&&(H1(2)!=="("||H1(3)==="?"))a(),b.start++,a1++;if(a1%2===0)return!1;return b.negated=!0,b.start++,!0},e=(a1)=>{b[a1]++,r.push(a1)},y1=(a1)=>{b[a1]--,r.pop()},R1=(a1)=>{if(m.type==="globstar"){let F1=b.braces>0&&(a1.type==="comma"||a1.type==="brace"),Q1=a1.extglob===!0||i.length&&(a1.type==="pipe"||a1.type==="paren");if(a1.type!=="slash"&&a1.type!=="paren"&&!F1&&!Q1)b.output=b.output.slice(0,-m.output.length),m.type="star",m.value="*",m.output=p,b.output+=m.output}if(i.length&&a1.type!=="paren")i[i.length-1].inner+=a1.value;if(a1.value||a1.output)z1(a1);if(m&&m.type==="text"&&a1.type==="text"){m.output=(m.output||m.value)+a1.value,m.value+=a1.value;return}a1.prev=m,q.push(a1),m=a1},D0=(a1,F1)=>{let Q1={...W[F1],conditions:1,inner:""};Q1.prev=m,Q1.parens=b.parens,Q1.output=b.output;let O1=(Y.capture?"(":"")+Q1.open;e("parens"),R1({type:a1,value:F1,output:b.output?"":B}),R1({type:"paren",extglob:!0,value:a(),output:O1}),i.push(Q1)},T1=(a1)=>{let F1=a1.close+(Y.capture?")":""),Q1;if(a1.type==="negate"){let O1=p;if(a1.inner&&a1.inner.length>1&&a1.inner.includes("/"))O1=y(Y);if(O1!==p||q1()||/^\)+$/.test(o()))F1=a1.close=`)$))${O1}`;if(a1.inner.includes("*")&&(Q1=o())&&/^\.[^\\/.]+$/.test(Q1)){let L1=oG1(Q1,{...Q,fastpaths:!1}).output;F1=a1.close=`)${L1})${O1})`}if(a1.prev.type==="bos")b.negatedExtglob=!0}R1({type:"paren",extglob:!0,value:s,output:F1}),y1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let a1=!1,F1=J.replace(JG4,(Q1,O1,L1,w1,A1,u1)=>{if(w1==="\\")return a1=!0,Q1;if(w1==="?"){if(O1)return O1+w1+(A1?I.repeat(A1.length):"");if(u1===0)return g+(A1?I.repeat(A1.length):"");return I.repeat(L1.length)}if(w1===".")return H.repeat(L1.length);if(w1==="*"){if(O1)return O1+w1+(A1?p:"");return p}return O1?Q1:`\\${Q1}`});if(a1===!0)if(Y.unescape===!0)F1=F1.replace(/\\/g,"");else F1=F1.replace(/\\+/g,(Q1)=>{return Q1.length%2===0?"\\\\":Q1?"\\":""});if(F1===J&&Y.contains===!0)return b.output=J,b;return b.output=LV.wrapOutput(F1,b,Q),b}while(!q1()){if(s=a(),s==="\x00")continue;if(s==="\\"){let Q1=H1();if(Q1==="/"&&Y.bash!==!0)continue;if(Q1==="."||Q1===";")continue;if(!Q1){s+="\\",R1({type:"text",value:s});continue}let O1=/^\\+/.exec(o()),L1=0;if(O1&&O1[0].length>2){if(L1=O1[0].length,b.index+=L1,L1%2!==0)s+="\\"}if(Y.unescape===!0)s=a();else s+=a();if(b.brackets===0){R1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||m.value==="["||m.value==="[^")){if(Y.posix!==!1&&s===":"){let Q1=m.value.slice(1);if(Q1.includes("[")){if(m.posix=!0,Q1.includes(":")){let O1=m.value.lastIndexOf("["),L1=m.value.slice(0,O1),w1=m.value.slice(O1+2),A1=tX4[w1];if(A1){if(m.value=L1+A1,b.backtrack=!0,a(),!Z.output&&q.indexOf(m)===1)Z.output=B;continue}}}}if(s==="["&&H1()!==":"||s==="-"&&H1()==="]")s=`\\${s}`;if(s==="]"&&(m.value==="["||m.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&m.value==="[")s="^";m.value+=s,z1({value:s});continue}if(b.quotes===1&&s!=='"'){s=LV.escapeRegex(s),m.value+=s,z1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)R1({type:"text",value:s});continue}if(s==="("){e("parens"),R1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError(iE("opening","("));let Q1=i[i.length-1];if(Q1&&b.parens===Q1.parens+1){T1(i.pop());continue}R1({type:"paren",value:s,output:b.parens?")":"\\)"}),y1("parens");continue}if(s==="["){if(Y.nobracket===!0||!o().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(iE("closing","]"));s=`\\${s}`}else e("brackets");R1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||m&&m.type==="bracket"&&m.value.length===1){R1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(iE("opening","["));R1({type:"text",value:s,output:`\\${s}`});continue}y1("brackets");let Q1=m.value.slice(1);if(m.posix!==!0&&Q1[0]==="^"&&!Q1.includes("/"))s=`/${s}`;if(m.value+=s,z1({value:s}),Y.literalBrackets===!1||LV.hasRegexChars(Q1))continue;let O1=LV.escapeRegex(m.value);if(b.output=b.output.slice(0,-m.value.length),Y.literalBrackets===!0){b.output+=O1,m.value=O1;continue}m.value=`(${V}${O1}|${m.value})`,b.output+=m.value;continue}if(s==="{"&&Y.nobrace!==!0){e("braces");let Q1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};t.push(Q1),R1(Q1);continue}if(s==="}"){let Q1=t[t.length-1];if(Y.nobrace===!0||!Q1){R1({type:"text",value:s,output:s});continue}let O1=")";if(Q1.dots===!0){let L1=q.slice(),w1=[];for(let A1=L1.length-1;A1>=0;A1--){if(q.pop(),L1[A1].type==="brace")break;if(L1[A1].type!=="dots")w1.unshift(L1[A1].value)}O1=QG4(w1,Y),b.backtrack=!0}if(Q1.comma!==!0&&Q1.dots!==!0){let L1=b.output.slice(0,Q1.outputIndex),w1=b.tokens.slice(Q1.tokensIndex);Q1.value=Q1.output="\\{",s=O1="\\}",b.output=L1;for(let A1 of w1)b.output+=A1.output||A1.value}R1({type:"brace",value:s,output:O1}),y1("braces"),t.pop();continue}if(s==="|"){if(i.length>0)i[i.length-1].conditions++;R1({type:"text",value:s});continue}if(s===","){let Q1=s,O1=t[t.length-1];if(O1&&r[r.length-1]==="braces")O1.comma=!0,Q1="|";R1({type:"comma",value:s,output:Q1});continue}if(s==="/"){if(m.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",q.pop(),m=Z;continue}R1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&m.type==="dot"){if(m.value===".")m.output=H;let Q1=t[t.length-1];m.type="dots",m.output+=s,m.value+=s,Q1.dots=!0;continue}if(b.braces+b.parens===0&&m.type!=="bos"&&m.type!=="slash"){R1({type:"text",value:s,output:H});continue}R1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(m&&m.value==="(")&&Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){D0("qmark",s);continue}if(m&&m.type==="paren"){let O1=H1(),L1=s;if(m.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(o()))L1=`\\${s}`;R1({type:"text",value:s,output:L1});continue}if(Y.dot!==!0&&(m.type==="slash"||m.type==="bos")){R1({type:"qmark",value:s,output:P});continue}R1({type:"qmark",value:s,output:I});continue}if(s==="!"){if(Y.noextglob!==!0&&H1()==="("){if(H1(2)!=="?"||!/[!=<:]/.test(H1(3))){D0("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){j1();continue}}if(s==="+"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){D0("plus",s);continue}if(m&&m.value==="("||Y.regex===!1){R1({type:"plus",value:s,output:z});continue}if(m&&(m.type==="bracket"||m.type==="paren"||m.type==="brace")||b.parens>0){R1({type:"plus",value:s});continue}R1({type:"plus",value:z});continue}if(s==="@"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){R1({type:"at",extglob:!0,value:s,output:""});continue}R1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let Q1=eX4.exec(o());if(Q1)s+=Q1[0],b.index+=Q1[0].length;R1({type:"text",value:s});continue}if(m&&(m.type==="globstar"||m.star===!0)){m.type="star",m.star=!0,m.value+=s,m.output=p,b.backtrack=!0,b.globstar=!0,l(s);continue}let a1=o();if(Y.noextglob!==!0&&/^\([^?]/.test(a1)){D0("star",s);continue}if(m.type==="star"){if(Y.noglobstar===!0){l(s);continue}let Q1=m.prev,O1=Q1.prev,L1=Q1.type==="slash"||Q1.type==="bos",w1=O1&&(O1.type==="star"||O1.type==="globstar");if(Y.bash===!0&&(!L1||a1[0]&&a1[0]!=="/")){R1({type:"star",value:s,output:""});continue}let A1=b.braces>0&&(Q1.type==="comma"||Q1.type==="brace"),u1=i.length&&(Q1.type==="pipe"||Q1.type==="paren");if(!L1&&Q1.type!=="paren"&&!A1&&!u1){R1({type:"star",value:s,output:""});continue}while(a1.slice(0,3)==="/**"){let v1=J[b.index+4];if(v1&&v1!=="/")break;a1=a1.slice(3),l("/**",3)}if(Q1.type==="bos"&&q1()){m.type="globstar",m.value+=s,m.output=y(Y),b.output=m.output,b.globstar=!0,l(s);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&!w1&&q1()){b.output=b.output.slice(0,-(Q1.output+m.output).length),Q1.output=`(?:${Q1.output}`,m.type="globstar",m.output=y(Y)+(Y.strictSlashes?")":"|$)"),m.value+=s,b.globstar=!0,b.output+=Q1.output+m.output,l(s);continue}if(Q1.type==="slash"&&Q1.prev.type!=="bos"&&a1[0]==="/"){let v1=a1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(Q1.output+m.output).length),Q1.output=`(?:${Q1.output}`,m.type="globstar",m.output=`${y(Y)}${U}|${U}${v1})`,m.value+=s,b.output+=Q1.output+m.output,b.globstar=!0,l(s+a()),R1({type:"slash",value:"/",output:""});continue}if(Q1.type==="bos"&&a1[0]==="/"){m.type="globstar",m.value+=s,m.output=`(?:^|${U}|${y(Y)}${U})`,b.output=m.output,b.globstar=!0,l(s+a()),R1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-m.output.length),m.type="globstar",m.output=y(Y),m.value+=s,b.output+=m.output,b.globstar=!0,l(s);continue}let F1={type:"star",value:s,output:p};if(Y.bash===!0){if(F1.output=".*?",m.type==="bos"||m.type==="slash")F1.output=h+F1.output;R1(F1);continue}if(m&&(m.type==="bracket"||m.type==="paren")&&Y.regex===!0){F1.output=s,R1(F1);continue}if(b.index===b.start||m.type==="slash"||m.type==="dot"){if(m.type==="dot")b.output+=L,m.output+=L;else if(Y.dot===!0)b.output+=E,m.output+=E;else b.output+=h,m.output+=h;if(H1()!=="*")b.output+=B,m.output+=B}R1(F1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(iE("closing","]"));b.output=LV.escapeLast(b.output,"["),y1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(iE("closing",")"));b.output=LV.escapeLast(b.output,"("),y1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(iE("closing","}"));b.output=LV.escapeLast(b.output,"{"),y1("braces")}if(Y.strictSlashes!==!0&&(m.type==="star"||m.type==="bracket"))R1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let a1 of b.tokens)if(b.output+=a1.output!=null?a1.output:a1.value,a1.suffix)b.output+=a1.suffix}return b};oG1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(il,Y.maxLength):il,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=MU0[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:B}=ll.globChars(Y.windows),O=Y.dot?H:W,M=Y.dot?z:W,L=Y.capture?"":"?:",E={negated:!1,prefix:""},I=Y.bash===!0?".*?":U;if(Y.capture)I=`(${I})`;let P=(h)=>{if(h.noglobstar===!0)return I;return`(${L}(?:(?!${B}${h.dot?K:Z}).)*?)`},R=(h)=>{switch(h){case"*":return`${O}${V}${I}`;case".*":return`${Z}${V}${I}`;case"*.*":return`${O}${I}${Z}${V}${I}`;case"*/*":return`${O}${I}${q}${V}${M}${I}`;case"**":return O+P(Y);case"**/*":return`(?:${O}${P(Y)}${q})?${M}${V}${I}`;case"**/*.*":return`(?:${O}${P(Y)}${q})?${M}${I}${Z}${V}${I}`;case"**/.*":return`(?:${O}${P(Y)}${q})?${Z}${V}${I}`;default:{let g=/^(.*?)\.(\w+)$/.exec(h);if(!g)return;let p=R(g[1]);if(!p)return;return p+Z+g[2]}}},j=LV.removePrefix(J,E),y=R(j);if(y&&Y.strictSlashes!==!0)y+=`${q}?`;return y};LU0.exports=oG1});var Fk=f((Fm8,EU0)=>{var YG4=OU0(),sG1=AU0(),wU0=Hk(),$G4=Wk(),XG4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),q7=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>q7(U,Q,Y));return(U)=>{for(let B of H){let O=B(U);if(O)return O}return!1}}let X=XG4(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?q7.compileRe(J,Q):q7.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=q7(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:B,output:O}=q7.test(H,q,Q,{glob:J,posix:Z}),M={glob:J,state:V,regex:q,posix:Z,input:H,output:O,match:B,isMatch:U};if(typeof G.onResult==="function")G.onResult(M);if(U===!1)return M.isMatch=!1,z?M:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(M);return M.isMatch=!1,z?M:!1}if(typeof G.onMatch==="function")G.onMatch(M);return z?M:!0};if(Y)W.state=V;return W};q7.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?wU0.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=q7.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};q7.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:q7.makeRe(Q,Y)).test(wU0.basename(J))};q7.isMatch=(J,Q,Y)=>q7(Q,Y)(J);q7.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>q7.parse(Y,Q));return sG1(J,{...Q,fastpaths:!1})};q7.scan=(J,Q)=>YG4(J,Q);q7.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=q7.toRegex(V,Q);if(X===!0)K.state=J;return K};q7.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=sG1.fastpaths(J,Q);if(!G.output)G=sG1(J,Q);return q7.compileRe(G,Q,Y,X)};q7.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/$^/}};q7.constants=$G4;EU0.exports=q7});var WO=f((Um8,TU0)=>{var IU0=Fk(),GG4=Hk();function PU0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:GG4.isWindows()};return IU0(J,Q,Y)}Object.assign(PU0,IU0);TU0.exports=PU0});var nE;var tG1=G1(()=>{nE={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.promptAutocompleteMode":{type:"string",enum:["disabled","word-based","tab"],enumDescriptions:["Disabled - no prompt autocomplete","Offline word completion from workspace and thread context","AI-powered suggestions via Amp Tab"],default:"disabled",markdownDescription:"**Experimental:** Prompt autocomplete suggestions while typing.",scope:"application"},"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: chat_llm",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 Gemini 3",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.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","@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 qG4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function CU0(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=nE.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!qG4(X))return null;return X*1000}function SU0(J){let Q=J.settings["tools.stopTimeout"],Y=nE.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var RU0;var nl=G1(()=>{tG1();RU0=nE.contributes.configuration.properties});function al(J,Q){return new t1((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 eG1=G1(()=>{u0()});function x2(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 V7(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function kU0(J){return["done","error","cancelled"].includes(J.status)}function bF(J){let Q=[],Y=new u4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0&&q==="Glob")K=Q.filter((W)=>W.spec.name==="glob");for(let W of K)if(Bk(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((M)=>M.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return x.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let B={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))x.debug("Replacing existing tool registration (idempotent)",{toolName:q.name,source:q.source}),Q[W]=B;else Q.push(B);return Y.next(),{dispose:()=>{let M=Q.indexOf(B);if(M!==-1)Q.splice(M,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return VG4;return Z(q,V,K)},tools:T8(J.configService.config,Y.pipe(g9(void 0))).pipe(o0(([q])=>{return Q.map((V)=>({spec:V.spec,...Bk(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>KG4.record(performance.now()-W,{toolName:q});if(q===QZ1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){rl.add(1,{toolName:q,error:"invalid"});let U=JZ1(V.args.invalid_tool_name);return new t1((B)=>{B.error(Error(U))})}let z=G(q,K.config);if(!z){let U=Q.filter((L)=>L.spec.name===q);if(U.length===0)return rl.add(1,{toolName:q,error:"not_found"}),new t1((L)=>{L.error(Error(`tool ${JSON.stringify(q)} not found`))});let B=U[0],O=Bk(B.spec,K.config);rl.add(1,{toolName:q,error:"disabled"});let M=O.enabled?"unknown":O.disabledReason;return new t1((L)=>{L.error(Error(`tool ${JSON.stringify(q)} is disabled: ${M}`))})}return rl.add(1,{toolName:q}),f6(()=>z.fn).pipe(v4((U)=>{let B=U(V,K);if(z.spec.meta?.disableTimeout)return B;return al(B,SU0(K.config))}),AQ(()=>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){x.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function Uk(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(_U0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function Bk(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(Uk(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=vU0(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(Uk(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(Uk(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Uk(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Uk(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===G2||J.name===MV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function JZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Nk.toString()}. Try again with a valid tool name.`}function vU0(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function YZ1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}function P3(J,Q,Y=!0,X=!0,G){let Z=new Set(Q.map((V)=>V.spec.name));function q(V,K){if(Z.has(V))return!0;if(V==="Glob"&&Z.has("glob"))return!0;if(Y&&vU0(V))return!0;if(X&&V.startsWith("tb__")){if(G){if(!K?.meta?.subagentTypes)return!1;let W=K.meta.subagentTypes;return W.includes("all")||W.includes(G)}return!0}return!1}return{registerTool(V){throw Error("Tools should not be registered in a filtered tool service")},invokeTool(V,K,W){if(!q(V))return new t1((H)=>{H.error(Error(`tool ${JSON.stringify(V)} not allowed in filtered service`))});return J.invokeTool(V,K,W)},preprocessArgs(V,K,W){if(!q(V))return;return J.preprocessArgs?.(V,K,W)},tools:J.tools.pipe(o0((V)=>V.filter((K)=>q(K.spec.name,K.spec)))),getExecutionProfile(V){if(!q(V))return;return J.getExecutionProfile(V)},dispose(){}}}var jU0,_U0,VG4,QZ1="invalid_tool",Nk,yU0,rl,KG4;var K5=G1(()=>{u0();H0();nl();eG1();q4();jU0=U6(j6(),1),_U0=U6(WO(),1);VG4={dispose(){}};Nk=/^[-a-zA-Z0-9_]{1,64}$/,yU0=jU0.metrics.getMeter("tool_service"),rl=yU0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),KG4=yU0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var gU0=f((bU0)=>{Object.defineProperty(bU0,"__esModule",{value:!0});bU0.calcSlices=bU0.applyPatch=bU0.calcPatch=bU0.lcs=bU0.diff=bU0.diff_core=void 0;function WG4(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,B=U&1,O=Z+q-1,M=V+K-1,L=(U+B)/2,E;Q:for(let I=0;I<=L;I++){let P=2*Math.max(0,I-K)-I,R=I-2*Math.max(0,I-q);for(let j=P;j<=R;j+=2){let y=Y[j-1-W*Math.floor((j-1)/W)],h=Y[j+1-W*Math.floor((j+1)/W)],g=j===-I||j!==I&&y<h?h:y+1,p=g-j,b=g,i=p;while(b<q&&i<K&&X(Z+b,V+i))b++,i++;if(Y[j-W*Math.floor(j/W)]=b,B===1&&(E=z-j)>=1-I&&E<I&&b+Y[W+E-W*Math.floor(E/W)]>=q)if(I>1||b!==g){G[H++]=Z+b,G[H++]=q-b,G[H++]=V+i,G[H++]=K-i,q=g,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let j=P;j<=R;j+=2){let y=Y[W+j-1-W*Math.floor((j-1)/W)],h=Y[W+j+1-W*Math.floor((j+1)/W)],g=j===-I||j!==I&&y<h?h:y+1,p=g-j,b=g,i=p;while(b<q&&i<K&&X(O-b,M-i))b++,i++;if(Y[W+j-W*Math.floor(j/W)]=b,B===0&&(E=z-j)>=-I&&E<=I&&b+Y[E-W*Math.floor(E/W)]>=q)if(I>0||b!==g){G[H++]=Z+q-g,G[H++]=g,G[H++]=V+K-p,G[H++]=p,q=q-b,K=K-i,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 xU0{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=WG4(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 fU0(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 xU0({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:[]})}bU0.diff_core=fU0;function ol(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 fU0(X,G+1-X,X,Z+1-X,Y)}bU0.diff=ol;class hU0{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 HG4(J,Q,Y){return new hU0(ol(J,Q,Y),J.length)}bU0.lcs=HG4;function*zG4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of ol(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}bU0.calcPatch=zG4;function*FG4(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)}bU0.applyPatch=FG4;function*UG4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of ol(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)]}bU0.calcSlices=UG4});function aE(J,Q){if(J===void 0||Q===void 0||J===Q)return{added:0,deleted:0,changed:0};let Y={added:0,deleted:0,changed:0};for(let[X,G,Z,q]of mU0.diff(J.split(`
|
|
49
49
|
`),Q.split(`
|
|
50
50
|
`)))Y.deleted+=G-X,Y.added+=q-Z,Y.changed+=Math.min(G-X,q-Z);return Y}function pU0(J){return{added:J?.split(`
|
|
51
51
|
`).length??0,deleted:0,changed:0}}function $Z1(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 mU0;var Dk=G1(()=>{mU0=U6(gU0(),1)});function EZ(){return`T-${crypto.randomUUID()}`}function IZ(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 HO(){return`toolu_${crypto.randomUUID()}`}function rE(J,Q,Y=HO()){return{type:"tool_use",complete:!0,id:Y,name:J,input:Q}}function T3(J){if("complete"in J)return J.complete;return!("inputPartialJSON"in J)}function dU0(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 B$(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 oE(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 uF(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 aJ(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 XZ1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&IZ(Q))return Q}return}function GZ1(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===e3)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?XZ1(q.progress):void 0;if(V)Q.push({toolUseID:G.toolUseID,threadID:V,toolUse:Z,toolResult:G})}}}return Q}function cU0(J,Q="Untitled"){if(J.title)return _l(J.title,300);return Q}function lU0(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 iU0(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 ZZ1(J){if(!J)return!1;return J.role==="info"}function sE(J){return J.role==="info"&&J.content.some((Q)=>Q.type==="manual_bash_invocation")}function sl(J){if(J.role!=="info")return;return J.content.find((Q)=>Q.type==="manual_bash_invocation")}function LG4(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 tE(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===G2&&X.input){let G=X.input.todos;if(Array.isArray(G))return G;let Z=X.input.content;if(typeof Z==="string")return LG4(Z)}}return}function _7(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
|
|
@@ -4410,11 +4410,11 @@ Actual: ${G}`)}async function XK8(J,Q,Y){let{execSync:X}=await import("node:ch
|
|
|
4410
4410
|
${B}`;if(G==="pnpm"&&B.includes("Unable to find the global bin directory"))O+=`
|
|
4411
4411
|
|
|
4412
4412
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
4413
|
-
npm install -g @sourcegraph/amp`;V(Error(O))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}H0();H0();async function Y41(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=KK8(J,K),H=W<0,z,U;if(V.time){let B=V.time[J],O=V.time[K],M=Date.now();if(B)z=Math.floor((M-new Date(B).getTime())/3600000);if(O)U=Math.floor((M-new Date(O).getTime())/3600000)}return x.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 x.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function KK8(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}u0();function $41(J,Q){let Y=new u4,X=Y.pipe(p8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new UV().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 _U(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=lL(),W=await Y41(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,B=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 Q41();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 Ru(W.latestVersion,z);let U=await dB(W.latestVersion),B={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",B),Y.next("updated");else G.warn("success with warning",B),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await _U(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as CK}from"node:process";function U26(J){let Q=new _L().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 tR1(X.force||!1,X.verbose||!1,"0.0.
|
|
4413
|
+
npm install -g @sourcegraph/amp`;V(Error(O))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}H0();H0();async function Y41(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=KK8(J,K),H=W<0,z,U;if(V.time){let B=V.time[J],O=V.time[K],M=Date.now();if(B)z=Math.floor((M-new Date(B).getTime())/3600000);if(O)U=Math.floor((M-new Date(O).getTime())/3600000)}return x.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 x.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function KK8(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}u0();function $41(J,Q){let Y=new u4,X=Y.pipe(p8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new UV().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 _U(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=lL(),W=await Y41(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,B=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 Q41();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 Ru(W.latestVersion,z);let U=await dB(W.latestVersion),B={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",B),Y.next("updated");else G.warn("success with warning",B),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await _U(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as CK}from"node:process";function U26(J){let Q=new _L().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 tR1(X.force||!1,X.verbose||!1,"0.0.1763928079-g29218b"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new _L("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("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await WK8(X.version)});J.addCommand(Y)}async function WK8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")CK.write(S4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
4414
4414
|
|
|
4415
4415
|
`));try{if(!J){CK.write(S4.blue(`Checking for updates...
|
|
4416
|
-
`));let Y=lL(),{hasUpdate:X,latestVersion:G}=await Y41("0.0.
|
|
4417
|
-
`));let Z=await dB("0.0.
|
|
4416
|
+
`));let Y=lL(),{hasUpdate:X,latestVersion:G}=await Y41("0.0.1763928079-g29218b",Y);if(!X){CK.write(S4.green(`✓ Amp CLI is already up to date.
|
|
4417
|
+
`));let Z=await dB("0.0.1763928079-g29218b");if(Z.warning)CK.write(`
|
|
4418
4418
|
`+S4.yellow(Z.warning)+`
|
|
4419
4419
|
`);process.exit(0)}if(!G)CK.write(S4.yellow("[WARN] could not find latest version")),process.exit(0);J=G}CK.write(S4.blue(`Updating to version ${J}...
|
|
4420
4420
|
`)),await Ru(J,void 0,(Y)=>{CK.write(S4.dim(`Running: ${Y}
|
|
@@ -5036,7 +5036,7 @@ exit code: ${Z}`,new U1({color:X.foreground,dim:!0,italic:!0})));if(q)V.push(new
|
|
|
5036
5036
|
`,U),...B],M=new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new l1({text:new Y1("",void 0,O)})]});return X8.child(new e0({constraints:new d6(40,120,0,1/0),child:new G4({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[new F4({flex:1,child:new oC1({width:40,height:40,agentMode:this.agentMode,fps:q==="fast"?60:q==="slow"?15:0,...q==="disabled"&&{seed:42,t:3}})}),new N0({width:1}),new F4({flex:2,child:M})]})}))}}H0();V9();q4();K5();V9();u0();function hN8(J,Q){return`${J}:${Q}`}class I_1{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 t1((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.subthreadObservable=new t1((Q)=>{return this.emitSubthread=(Y)=>Q.next(Y),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new t1((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(zO()).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=hN8(Q,q.toolUse.id);if(this.subthreadPatchSubs.has(V))continue;let K=this.threadService.observePatches(q.threadID).pipe(zO()).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 t1((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),subthreads:new t1((Q)=>{return this.subthreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new t1((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]=FL(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 bN8(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=aJ(J.mainThread);G.isCompleted=fY6(W,X.toolUse.id)}}let Z=uN8(Y,G.agentState),q=G.agentState===Z?G:{...G,agentState:Z},V={...J.tools},K=EC(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=aJ(Y),q={...J.subagents};for(let z of X){let U=q[z.threadID];if(!U)continue;let B=fY6(Z,z.toolUse.id);q[z.threadID]={...U,isCompleted:B}}let{items:V}=EC(Y),K=FL(Y,G),W=tE({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=FL(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function EC(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 B of U.content)if(B.type==="tool_result"&&B.toolUseID===W.id){H=!0;break}}if(H)break}if(!H)Q.push({type:"toolResult",id:W.id,toolUse:W,toolResult:{type:"tool_result",toolUseID:W.id,run:{status:V?"in-progress":"queued"}}})}break}case"info":Q.push({type:"message",id:q,message:Z});break;case"user":{if(Z.content.some((K)=>K.type==="text"&&K.text.trim()||K.type==="image"))Q.push({type:"message",id:q,message:Z});for(let K of Z.content)if(K.type==="tool_result"){let W=Y.get(K.toolUseID)??B$(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})}break}}}return{items:Q}}function fY6(J,Q){let Y=J.get(Q);return(Y&&V7(Y.run))??!1}function uN8(J,Q){let Y=J.messages.at(-1);if(Y?.content.some((G)=>G.type==="tool_result"&&G.run.status==="blocked-on-user"))return x.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(EC(J).items.some((G)=>G.type==="toolResult"&&G.toolResult.run.status==="in-progress")){let G=Q?.type==="running-tools"?Q.startTime:Date.now();return x.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 x.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return x.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 x.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:Z,hasStartTime:!!Z}),{type:"running-tools",startTime:Z}}default:return x.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return x.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class P_1 extends Q6{props;constructor(J){super();this.props=J}createState(){return new hY6}}class hY6 extends J6{state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null};workerController;subscriptions=[];currentWorker;constructor(){super();this.workerController=null,this.currentWorker=null}initState(){let{threadService:J,worker:Q}=this.widget.props;this.workerController=new I_1(J),this.currentWorker=Q,this.setupSubscriptions(Q)}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)}dispatch(J){this.setState(()=>{this.state=bN8(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===a5||Z===t8||Z===mE||Z===fF||Z===hF||Z===pE||Z===dE||Z===U$,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:rE(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)}}class T_1 extends Q6{props;constructor(J){super({key:J.key});this.props=J}createState(){return new bY6}}class bY6 extends J6{build(J){let Y=x6.of(J).colors,{todos:X,title:G="TODOs"}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new N0({width:0,height:0});let Z=X.map((q)=>this.buildTodoItem(q,Y));return new e0({child:new g6({padding:_0.symmetric(1,0),child:new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new l1({text:new Y1(G,new U1({bold:!0,color:Y.foreground}))}),...Z]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),X=J.status==="completed",G=new U1({bold:J.status==="in-progress",color:Q.foreground,dim:X}),Z=new U1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:X});return new G4({crossAxisAlignment:"start",children:[new l1({text:new Y1(Y,G)}),new N0({width:1}),new F4({child:new l1({text:new Y1(J.content,Z)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class R_1 extends T6{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=x6.of(J),Y=Q.colors.primary,X=Q.colors.foreground;return new e0({decoration:new P8(void 0,new n4(new j4(Y,1,"rounded"),new j4(Y,1,"rounded"),void 0,new j4(Y,1,"rounded"))),child:new g6({padding:_0.horizontal(1),child:new l0({children:[new G4({crossAxisAlignment:"start",children:[new F4({child:new l1({text:new Y1(this.ad.content,new U1({color:X}))})}),new N0({width:4}),new qQ({uri:"https://ampcode.com/free",text:"Ad",style:new U1({color:X,dim:!0}),onError:(G)=>{}})]}),new G4({crossAxisAlignment:"start",children:[new VS1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:_0.horizontal(1),color:Y,reverse:!0}),new N0({width:2}),new l1({text:new Y1(this.ad.destinationUrlHostname,new U1({color:X,dim:!0}))})]})]})})})}}class C_1 extends Q6{props;constructor(J){super();this.props=J}createState(){return new uY6(this.props.autofocus??!0)}}class uY6 extends J6{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=q8.sizeOf(J),X=Math.min(60,Y.width-4),G=Y.height-4,Z=[];if(this.widget.props.title)Z.push(new l1({text:new Y1(this.widget.props.title,new U1({bold:!0,color:M1.blue}))}),new N0({height:1}));if(this.widget.props.message)Z.push(new l1({text:new Y1(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)Z.push(new N0({height:1}));let q=[];if(this.widget.props.showCopyOption)q.push(new l1({text:new Y1("Enter to copy",new U1({dim:!0}))}));return q.push(new l1({text:new Y1("Escape to close",new U1({dim:!0}))})),Z.push(new G4({children:q.flatMap((V,K)=>K<q.length-1?[V,new N0({width:1}),new l1({text:new Y1("•",new U1({dim:!0}))}),new N0({width:1})]:[V]),mainAxisSize:"min"})),new X8({child:new e0({constraints:new d6(X,X,0,G),decoration:new P8(M1.default(),new n4(new j4(M1.blue,1,"rounded"),new j4(M1.blue,1,"rounded"),new j4(M1.blue,1,"rounded"),new j4(M1.blue,1,"rounded"))),padding:new _0(2,2,2,2),child:new a8({autofocus:this.autofocus,onKey:Q,child:new l0({children:Z,mainAxisSize:"min"})})})})}}class l81 extends Error{constructor(J="Command timed out"){super(J);this.name="CommandTimeoutError",Object.setPrototypeOf(this,l81.prototype)}}class i81 extends Error{constructor(J){let Q=`${J.noun}: ${J.verb} command cancelled`;super(Q);this.name="CommandCancelledError",Object.setPrototypeOf(this,i81.prototype)}}function S_1(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})}dF();H0();import{spawn as gN8}from"node:child_process";import{promises as mN8}from"node:fs";function gY6(J){return J.kind==="executable"}function mY6(J){return J.kind==="markdown"}var Fz=50000,pY6=300000;async function j_1(J,Q,Y,X={}){let{timeoutMs:G=pY6,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(x.debug("Executing command",{commandName:J,filePath:V.filePath,args:Q}),mY6(V))return await pN8(V,Q);else if(gY6(V))return await dN8(V,Q,G,Z);else return{success:!1,output:"",error:"Unsupported command type"}}catch(V){return x.error("Failed to execute command",{commandName:J,error:V}),{success:!1,output:"",error:V instanceof Error?V.message:"Unknown error occurred"}}}async function pN8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await mN8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>Fz?Y.slice(0,Fz)+`
|
|
5037
5037
|
... (output truncated at ${Fz} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function dN8(J,Q,Y=pY6,X){return new Promise((G)=>{let[Z,q]=cN8(J,Q);x.debug("Spawning command",{spawnCommand:Z,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Y});let V=ND0(X),K=!1,W=setTimeout(()=>{K=!0,V.abort(),x.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=gN8(Z,q,{stdio:["pipe","pipe","pipe"],signal:V.signal,detached:!0}),z=[],U=[],B=0;H.stdout?.on("data",(O)=>{let M=O.toString();if(B+=M.length,B<=Fz)z.push(M);else{let L=Fz-(B-M.length);if(L>0)z.push(M.slice(0,L))}}),H.stderr?.on("data",(O)=>{let M=O.toString();if(B+=M.length,B<=Fz)U.push(M);else{let L=Fz-(B-M.length);if(L>0)U.push(M.slice(0,L))}}),H.on("close",(O)=>{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:O??void 0});return}let M=O===0||O===1,L=z.join(""),E=U.join(""),I=L;if(!M&&!L.trim()&&E.trim())I=E;else if(E.trim())I+=L?`
|
|
5038
5038
|
${E}`:E;if(B>Fz)I+=`
|
|
5039
|
-
... (output truncated at ${Fz} characters)`;G({success:M,output:I.trim(),error:!M?E.trim()||"Command failed":void 0,exitCode:O??void 0})}),H.on("error",(O)=>{clearTimeout(W);let M=O.message;if(K)M=`Command timed out after ${Y}ms`;else if(O.message.includes("operation was aborted")||O.name==="AbortError")M="The command was aborted";G({success:!1,output:z.join(""),error:M})})})}function cN8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return iN8(Y,X?[...X]:null,G,Q);else return lN8(Y,X?[...X]:null,G,Q)}function lN8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function iN8(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]}}H0();rZ();C5();fW();aZ();nZ();TV();AH();fe();K5();u_();u0();qP();import{writeFile as aY6}from"fs/promises";import rY6 from"path";H0();aZ();class __1{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.
|
|
5039
|
+
... (output truncated at ${Fz} characters)`;G({success:M,output:I.trim(),error:!M?E.trim()||"Command failed":void 0,exitCode:O??void 0})}),H.on("error",(O)=>{clearTimeout(W);let M=O.message;if(K)M=`Command timed out after ${Y}ms`;else if(O.message.includes("operation was aborted")||O.name==="AbortError")M="The command was aborted";G({success:!1,output:z.join(""),error:M})})})}function cN8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return iN8(Y,X?[...X]:null,G,Q);else return lN8(Y,X?[...X]:null,G,Q)}function lN8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function iN8(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]}}H0();rZ();C5();fW();aZ();nZ();TV();AH();fe();K5();u_();u0();qP();import{writeFile as aY6}from"fs/promises";import rY6 from"path";H0();aZ();class __1{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.1763928079-g29218b"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await so(Q,this.configService)}catch(Q){x.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 k_1 extends Q6{props;constructor(J){super();this.props=J}createState(){return new dY6}}class dY6 extends J6{_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 cY6 extends J6{controller=new _G;focusNode=new u8({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=x6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=n4.all(new j4(Y.foreground,1,"solid")),K=new QA({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(B)=>{let O=B.trim();if(G&&O.length===0)return;this.widget.props.onSubmit(O)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new G4({children:[new e0({decoration:{color:M1.default()},child:new l1({text:new Y1(">",new U1({color:Y.foreground}))})}),new F4({child:K})]}),H=new e0({padding:_0.symmetric(1,0),child:new l1({text:new Y1("",void 0,[new Y1("Command: ",new U1({color:Y.foreground})),new Y1(this.widget.props.commandName,new U1({color:M1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new Y1("Enter",new U1({color:X.keybind}))),z.push(new Y1(" to submit, ",new U1({color:Y.foreground,dim:!0})));z.push(new Y1("Esc",new U1({color:X.keybind}))),z.push(new Y1(" to cancel",new U1({color:Y.foreground,dim:!0})));let U=new e0({padding:_0.symmetric(1,0),child:new l1({text:new Y1("",void 0,z)})});return new e0({decoration:{border:V,color:M1.default()},padding:_0.all(1),child:new l0({children:[H,new N0({height:1}),W,new m5,U]})})}}class n81 extends Q6{props;constructor(J){super();this.props=J}createState(){return new cY6}}TV();class lY6 extends J6{controller=new _G;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new u8({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>=lF)return!1;let Q=ZC(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=x6.of(J),{colors:Y,app:X}=Q,Z=q8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new NA({controller:this.controller,triggers:[new GN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(B)=>{this.widget.props.onSubmit(B.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:N9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new a8({focusNode:this.focusNode,child:V}),W=new e0({constraints:new d6({maxHeight:q}),padding:_0.symmetric(1,0),child:K}),H=new e0({padding:_0.symmetric(1,0),child:new l1({text:new Y1("",void 0,[new Y1("Command: ",new U1({color:Y.foreground})),new Y1(this.widget.props.commandName,new U1({color:M1.yellow,bold:!0}))])})}),z=new e0({padding:_0.symmetric(1,0),child:new l1({text:this.isConfirmingClearInput?new Y1("",void 0,[new Y1("Esc",new U1({color:X.keybind})),new Y1(" again to clear input",new U1({color:Y.foreground,dim:!0}))]):new Y1("",void 0,[new Y1("Press ",new U1({color:Y.foreground,dim:!0})),new Y1("Enter",new U1({color:X.keybind})),new Y1(" to submit, ",new U1({color:Y.foreground,dim:!0})),new Y1("Esc",new U1({color:X.keybind})),new Y1(" to clear",new U1({color:Y.foreground,dim:!0}))])})}),U=[H,new N0({height:1}),new F4({child:W}),new N0({height:1}),z];return new e0({decoration:{border:n4.all(new j4(Y.foreground,1,"solid")),color:M1.default()},padding:_0.all(1),child:new l0({children:U})})}}class DA extends Q6{props;constructor(J){super();this.props=J}createState(){return new lY6}}class y_1 extends T6{props;constructor(J){super();this.props=J}build(){return new X8({child:new l1({text:new Y1("",void 0,[new Y1(`Forked to new thread:
|
|
5040
5040
|
|
|
5041
5041
|
`,new U1({color:M1.white,dim:!0})),new Y1(`"${this.props.newThreadTitle||"Untitled"}"`,new U1({color:M1.white}))]),textAlign:"center"})})}}class Uz extends Q6{props;constructor(J){super();this.props=J}createState(){return new iY6}}class iY6 extends J6{_spinner=new hK;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=x6.of(J),{colors:Y}=Q,X=n4.all(new j4(Y.foreground,1,"solid")),G=this._spinner.toBraille(),Z=new l1({textAlign:"center",text:new Y1("",void 0,[new Y1(G,new U1({color:M1.yellow})),new Y1(" ",void 0),new Y1(this.widget.props.message,new U1({color:Y.foreground}))])}),V=[new F4({child:new l0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)V.push(new N0({height:2,child:new e0({padding:_0.symmetric(2,0),child:new l1({text:new Y1("",new U1({dim:!0}),[new Y1("Press ",new U1({color:Y.foreground})),new Y1("Esc",new U1({color:Y.info})),new Y1(" to cancel",new U1({color:Y.foreground}))])})})}));let K=new e0({decoration:new P8(M1.default(),X),child:new N0({width:60,height:7,child:new l0({mainAxisAlignment:"start",children:V})})});if(this.widget.props.onAbort)return new a8({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:K});return K}}class Bz extends Q6{props;constructor(J){super();this.props=J}createState(){return new nY6}}class nY6 extends J6{dispose(){super.dispose()}isWidgetMessage(J){return J instanceof yK}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=e41(Q);return{title:W.title,type:W.type,description:W.description}})(),X=Y.type==="error"?M1.red:M1.yellow,G=n4.all(new j4(M1.default(),1,"solid")),Z=new e0({padding:_0.symmetric(1,0),child:new l1({text:new Y1(Y.title,new U1({color:X,bold:!0}))})}),q=this.isWidgetMessage(Q)?Q.widget:new l1({text:new Y1(Y.description,new U1({color:M1.default()})),selectable:!0}),V=new F4({child:new tL({child:new e0({padding:_0.symmetric(1,0),child:q})})}),K=new e0({padding:_0.symmetric(1,0),child:new l1({text:this.widget.props.onRetry?new Y1("",void 0,[new Y1("Press ",new U1({color:M1.default(),dim:!0})),new Y1("R",new U1({color:M1.yellow})),new Y1(" to retry, ",new U1({color:M1.default(),dim:!0})),new Y1("Esc",new U1({color:M1.yellow})),new Y1(" to cancel",new U1({color:M1.default(),dim:!0}))]):new Y1("Press any key to close",new U1({color:M1.default(),dim:!0,italic:!0}))})});return new a8({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 e0({decoration:{border:G,color:M1.default()},padding:_0.all(1),child:new l0({mainAxisAlignment:"center",children:[Z,new N0({height:1}),V,K]})})})}}class v_1 extends T6{build(){return new X8({child:new l1({text:new Y1("",void 0,[new Y1(`✓ Thread Shared
|
|
5042
5042
|
|
|
@@ -5122,7 +5122,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
|
|
|
5122
5122
|
`)?`${V}...`:G,W=new U1({color:M1.index(8)}),H=[new Y1(K,W)];if(q>0){let z=new U1({color:Y.success});for(let U=1;U<=q;U++)H.push(new Y1(" ")),H.push(new Y1(`[${U}]`,z))}return new g6({padding:_0.only({bottom:0}),child:new G4({crossAxisAlignment:"start",children:[new g6({padding:_0.only({right:1}),child:new l1({text:new Y1("•",new U1({color:M1.index(8)}))})}),new F4({child:new l1({text:new Y1("",void 0,H)})})]})})}}class Wk1 extends Q6{createState(){return new p$6}}class p$6 extends J6{_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 U1({color:M1.red}),Y=new U1({color:this._visible?M1.red:M1.transparent()});return new G4({children:[new l1({text:new Y1("⏺",Y)}),new N0({width:1}),new l1({text:new Y1("Replay",Q)})]})}}u0();function YO8(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`}function d$6(J){return J.map((Q)=>{let Y=new Date(Q.userLastInteractedAt),X=YO8(Y),G=Q.id.slice(-8),Z=Q.env?.initial.trees?.[0]?.uri;return{id:Q.id,title:Q.title||"Untitled",updatedAt:new Date(Q.userLastInteractedAt).toISOString(),description:{timeAgo:X,title:Q.title||"Untitled",shortThreadID:G},diffStats:Q.summaryStats?.diffStats,workspaceURI:Z,parentRelationships:Q.parentRelationships}})}class Hk1{threadHistoryService;constructor(J){this.threadHistoryService=J}observeThreadSummaries(J=""){return new t1((Q)=>{let Y=this.threadHistoryService.observeThreadList().subscribe({next:(X)=>{let G=X.filter((Z)=>{if(!J.trim())return!0;let q=Z.title?.toLowerCase()||"untitled",V=Z.id.toLowerCase(),K=J.toLowerCase();return q.includes(K)||V.includes(K)});Q.next(d$6(G))},error:(X)=>Q.error(X),complete:()=>Q.complete()});return()=>Y.unsubscribe()})}async fetchThreadSummaries(J=""){try{let Y=(await new Promise((X,G)=>{let Z=!1,q=setTimeout(()=>{if(!Z)V.unsubscribe(),X([])},5000),V=this.threadHistoryService.observeThreadList().subscribe({next:(K)=>{if(Z=!0,K.length>0)clearTimeout(q),V.unsubscribe(),X(K);else setTimeout(()=>{if(!V.closed)clearTimeout(q),V.unsubscribe(),X(K)},500)},error:(K)=>{clearTimeout(q),G(K)}})})).filter((X)=>{if(!J.trim())return!0;let G=X.title?.toLowerCase()||"untitled",Z=X.id.toLowerCase(),q=J.toLowerCase();return G.includes(q)||Z.includes(q)});return{ok:!0,threads:d$6(Y)}}catch(Q){return{ok:!1,errorMsg:Q instanceof Error?Q.message:"An unexpected error occurred"}}}}H0();V9();class zk1{currentId=null;current=null;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new b3;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){x.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){x.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(zO()).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 c$6(J,Q){switch(J){case"update-available":return[new Y1("A newer Amp is available. Run ",new U1({color:Q.foreground,dim:!0})),new Y1("amp update",new U1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new Y1("Update complete, run ",new U1({color:Q.foreground,dim:!0})),new Y1("amp update",new U1({color:Q.warning})),new Y1(" to see warnings",new U1({color:Q.foreground,dim:!0}))];case"update-error":return[new Y1("Update failed, run ",new U1({color:Q.foreground,dim:!0})),new Y1("amp update",new U1({color:Q.warning})),new Y1(" to see warnings",new U1({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function qO8(J){return new Promise((Q)=>{XO8("git",["branch","--show-current"],{cwd:J},(Y,X)=>{if(Y){Q(null);return}let G=X.trim();Q(G||null)})})}class a$6 extends Q6{dependencies;constructor(J){super();this.dependencies=J}createState(){return new r$6}}class r$6 extends J6{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;connectedClientsStatusExpanded=!1;randomAd=null;adSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;copyMessageTimer=null;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;threadsForPicker=[];isLoadingThreads=!0;threadListSubscription=null;threadPreviewController=new zk1;previewThread=null;planScrollController=(()=>{let J=new b3;return J.followMode=!1,J})();todoScrollController=(()=>{let J=new b3;return J.followMode=!1,J})();showingSelectionCopiedHint=!1;isShowingStandaloneThreadPicker=!1;filterThreadPickerByWorkspace=!0;agentModePulseSeq=0;currentGitBranch=null;messageViewFocusNode=new u8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new u8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showingCannotToggleMessage=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;pendingMCPServers=[];mcpTrustSubscription=null;agentModeSubscription=null;currentAgentMode="smart";hasToggledAgentMode=!1;inMemoryAgentModeOverride=null;cachedVisibleModes=BG();freeTierStatus=void 0;updateState="hidden";updateServiceSubscription=null;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=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}),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(`
|
|
5123
5123
|
`);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 B=J.thread.id;this.getMessageScrollController(B).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),N9.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 P41(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 Y1(this.submitDisabledHint,new U1({color:J.foreground,dim:!0}));if(this.isExiting)return new Y1("Exiting...",new U1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new Y1("",void 0,[new Y1("Ctrl+C",new U1({color:Q.keybind})),new Y1(" again to exit",new U1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new Y1("",void 0,[new Y1("Esc",new U1({color:Q.keybind})),new Y1(" again to clear input",new U1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new Y1("",void 0,[new Y1("Escape",new U1({color:Q.keybind})),new Y1(" to close help",new U1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let G=this.getEffectiveAgentMode(),Z=Nk1(G);return new Y1("",void 0,[new Y1("Images aren't supported in ",new U1({color:J.warning,dim:!1})),new Y1(G,new U1({color:Z})),new Y1(" mode.",new U1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new Y1("",void 0,[new Y1("Esc",new U1({color:Q.keybind})),new Y1(" again to cancel",new U1({color:J.foreground,dim:!0}))]);return new Y1("",void 0,[new Y1("Esc",new U1({color:Q.keybind})),new Y1(" to cancel",new U1({color:J.foreground,dim:!0}))])}if(this.showingSelectionCopiedHint)return new Y1("Selection copied to clipboard",new U1({color:J.foreground,dim:!0}));if(this.showingCannotToggleMessage)return new Y1(this.showingCannotToggleMessage,new U1({color:J.warning,dim:!1}));let Y=c$6(this.updateState,J);if(Y)return new Y1("",void 0,Y);let X=this.widget.dependencies.worker.thread;if(X.agentMode==="plan"&&aL(X))return new Y1("",void 0,[new Y1("Ctrl+O",new U1({color:Q.keybind})),new Y1(" → Execute Plan",new U1({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){x.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 V3.getOrCreateForThread(Y,G),V=await jR(q,X,Z-1);await this.switchToExistingThread(V)}catch(q){x.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=sB(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){x.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){x.error("Failed to edit message:",q)}};getAffectedFiles=async(J)=>{let{worker:Q}=this.widget.dependencies;try{return(await Q.getFilesAffectedByTruncation(J)).map(o3)}catch(Y){return x.error("Failed to get affected files:",Y),[]}};textController=new _G;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new b3);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=()=>{if(this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},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(FC1(X))}}_handleTextCopy(J){if(J&&J.length>0){if(this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}textFieldKey=new c2("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;paletteCommands=null;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Y=sB(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}),B9.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.setState(()=>{this.isShowingStandaloneThreadPicker=!0})};dismissStandaloneThreadPicker=()=>{this.exitApplication()};handleStandaloneThreadSelect=async(J)=>{try{await this.switchToExistingThread(J,{recordInNavigationHistory:!1}),this.threadPreviewController.clear(),this.setState(()=>{this.isShowingStandaloneThreadPicker=!1}),B9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker)this.autocompleteFocusNode.requestFocus()})}catch(Q){x.error("Failed to switch thread:",Q),this.showErrorMessage(`Failed to switch thread: ${Q}`)}};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(){this.setState(()=>{this.isShowingPalette=!this.isShowingPalette})}getPaletteCommands(){if(!this.paletteCommands)this.paletteCommands=new f_1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})},this.widget.dependencies.isDogfooding);return this.paletteCommands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new u_1(this.widget.dependencies.fuzzyServer,this.widget.dependencies.threadFuzzyIndexer);return this.completionBuilder}dismissPalette=()=>{this.setState(()=>{this.isShowingPalette=!1})};getCommandPaletteContext=()=>{let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return null;let Q=p0.file(process.cwd()),Y=z6(Q);return{worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:J.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let X=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),X},setImageAttachments:(X)=>{this.setState(()=>{this.imageAttachments=X})},editorDispatch:(X)=>{switch(X.type){case"set-input":this.textController.clear(),this.textController.insertText(X.input);break;case"insert-text":this.textController.insertText(X.text);break;case"clear":this.textController.clear();break}},submitMessage:(X)=>{return this.proceedWithUserMessage(X)},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(X)=>{return await this.switchToExistingThread(X),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(X,G,Z)=>{let q=this.widget.dependencies.threadState.mainThread?.id;if(!q)throw Error("No active thread");let V=setTimeout(()=>{Z.throwIfAborted()},60000);try{let K=await this.widget.dependencies.threadService.generateHandoffPrompt(q,X,G,this.widget.dependencies.configService,Z);return clearTimeout(V),K}catch(K){throw clearTimeout(V),K}},handleHandoff:async(X,G)=>{let{goal:Z,generatedPrompt:q,images:V}=G;if(!Z&&!q)return{ok:!1,error:Error("Either goal or generatedPrompt required")};try{let K=this.widget.dependencies.threadState.mainThread?.id;if(!K)return{ok:!1,error:Error("No active thread")};let W=setTimeout(()=>X.abort(new l81("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let H=await this.widget.dependencies.threadService.createHandoffThread(K,{goal:Z,generatedPrompt:q,images:V},this.widget.dependencies.configService,X.signal);return clearTimeout(W),await this.switchToExistingThread(H),{ok:!0}}catch(H){if(clearTimeout(W),H instanceof Error&&(H.name==="AbortError"||H.message.includes("aborted")))throw X.signal.reason;throw H}}catch(K){return x.error("Failed to create handoff thread",K),{ok:!1,error:K instanceof Error?K:Error(String(K))}}},getGuidanceFiles:async(X)=>{if(!J.mainThread)return[];return(await Zo({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},J.mainThread,X)).map((Z)=>({uri:Z.uri,type:Z.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(X)=>{this.setState(()=>{this.inMemoryAgentModeOverride=X,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,handleExecutePlan:async()=>{try{let X=J.mainThread?.id;if(!X){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let G=await this.widget.dependencies.threadService.createPlanExecutionThread(X,"smart");await this.switchToExistingThread(G)}catch(X){x.error("Failed to execute plan",X),this.setState(()=>{this.displayMessage=Error(`Failed to execute plan: ${X instanceof Error?X.message:String(X)}`)})}},planFileManager:this.widget.dependencies.planFileManager,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:Y,threadViewStates:this.widget.dependencies.workerController.threadViewStates}};updateGitBranch=async()=>{let J=await qO8(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===oB).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===oB};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(PZ(J.thread)>0)return;if(this.freeTierStatus?.canUseAmpFree){let X=this.getEffectiveAgentMode(),G=Ib(X,this.cachedVisibleModes);if(G!==X)this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=G,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1});return}let Q=this.getEffectiveAgentMode(),Y=Ib(Q,this.cachedVisibleModes);if(Y===Q)return;if(this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Y,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1}),W5(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(!oh(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>=lF)return!1;let Y=ZC(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 Zz(W);try{let H=await Y(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")x.error("Failed to read temporary file",H)}try{await X(W),await G(K)}catch(H){x.warn("Failed to clean up temporary file",H)}}catch(K){x.error("Error opening editor:",K)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=sB(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(s$.getInstance().interceptConsole(),this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();N9.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),N9.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),N9.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((X)=>{B9.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=X.hasFocus})})}),this.freeTierStatus=this.widget.dependencies.freeTierStatus,W6(this.widget.dependencies.configService.config).then((X)=>{let G=P41(this.widget.dependencies.worker.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,X.settings);if(x.info(`[initState] Resolved agentMode: ${G}`),this.widget.dependencies.sessionState?.agentMode)this.setState(()=>{this.inMemoryAgentModeOverride=G})}),this.updateGitBranch(),this.adSubscription=yC1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{return(this.inMemoryAgentModeOverride&&W5(this.inMemoryAgentModeOverride)||this.randomAd===null)&&kC1(this.lastUserInteractionTime)}).subscribe({next:(X)=>{if(X){let G=GO8(16).toString("hex");this.lastAdImpressionId=G,Promise.resolve().then(() => (z91(),H91)).then(({recordAdEvent:Z})=>{let q=this.widget.dependencies.worker.thread,V=q.messages[q.messages.length-1];Z("viewed",{adId:X.id,advertiserId:X.advertiserId,threadId:q.id,messageId:V?.messageId,impressionId:G,placement:"tui",matchType:X.metadata?.matchType,matchedPatterns:X.metadata?.matchedPatterns,candidateAdPoolCount:X.metadata?.candidateAdPoolCount,clientRegion:X.metadata?.clientRegion})})}this.setState(()=>{this.randomAd=X}),B9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}});let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((X)=>{this.setState(()=>{this.pendingMCPServers=X})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((X)=>{this.setState(()=>{this.ideStatus=X})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(X)=>{let G=this.widget.dependencies.getCurrentWorker();if(!G){x.warn("No active thread worker found to handle IDE message");return}await new Promise((Z)=>setTimeout(Z,50)),await G.handle({type:"user:message",message:{content:[{type:"text",text:X}]}}),x.debug("Message sent from IDE to agent",{message:X.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((X)=>{this.textController.insertText(X),x.debug("Appended text to CLI prompt from IDE",{text:X.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((X)=>{this.setState(()=>{this.connectedClientsStatus=X})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((X)=>{this.setState(()=>{this.updateState=X})}),this.agentModeSubscription=this.widget.dependencies.configService.config.subscribe((X)=>{let G=BG(X.settings,this.freeTierStatus?.canUseAmpFree);this.setState(()=>{this.cachedVisibleModes=G})});let Q=new Hk1(this.widget.dependencies.threadHistoryService);this.threadListSubscription=Q.observeThreadSummaries().subscribe({next:(X)=>{this.setState(()=>{this.threadsForPicker=X,this.isLoadingThreads=!1})}}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Y=this.widget.dependencies.ideClient.getSelectedConfig();if(Y)this.connectToSelectedIde(Y,"auto-startup").catch((X)=>{let G=X instanceof Error?X.message:String(X);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${G}`)})});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)}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.threadListSubscription)this.threadListSubscription.unsubscribe();if(this.threadPreviewController.removeListener(this.previewControllerListener),this.threadPreviewController.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(FC1("")),this.shouldUseProgressBar())process.stdout.write($76())}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"){x.error("No current tool confirmation found");return}let Y=Q.tools[0]?.useBlock;if(!Y){x.error("No tool use block found in confirmation");return}if(J==="allow-all-session")DZ("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 x.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();try{await cJ(G)}catch(Z){x.error("Failed to open settings page:",Z),await this.showErrorMessage(`Cannot open browser. Please go to ${G} to connect to GitHub`)}return}if(J==="disable-librarian"){let G=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!G.includes(U$))await this.widget.dependencies.settingsStorage.set("tools.disable",[...G,U$],"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 V3.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(G);else await this.widget.dependencies.worker.handle(G)}catch(G){x.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}),V41({agentMode:"smart"}),await this.startAndSwitchToNewThread();break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};handleMCPTrustOpenSettings=async()=>{let{mcpTrustHandler:J,settingsStorage:Q}=this.widget.dependencies;await J.deny();try{await Zz(Q.getSettingsFilePath())}catch(Y){let X=Y instanceof Error?Y.message:String(Y);await this.showErrorMessage(`Failed to open settings: ${X}`)}};cancelStreamingMessage=async()=>{await V3.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{x.info(`[switchToExistingThread] Switching to thread: ${J}`);let X=await this.widget.dependencies.switchToThread(J);x.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${X.thread.agentMode}`);let G=await this.widget.dependencies.configService.getLatest(),Z=P41(X.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,G.settings);if(x.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(()=>{x.info("[switchToExistingThread] Clearing inMemoryAgentModeOverride"),this.inMemoryAgentModeOverride=null}),X.thread.draft)if(x.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(`
|
|
5124
5124
|
`);if(K)this.textController.insertText(K);if(V.length>0)this.setState(()=>{this.imageAttachments=V})}}catch(X){throw x.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=PZ(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)V41({agentMode:X});this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]}),B9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker&&!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();V41({agentMode:Q}).catch((Y)=>{x.warn("Failed to save session state on exit:",Y)}).finally(()=>{N9.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=ZO8();if(J===Q)return"~";if(J.startsWith(Q+Lg.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(Lg.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(Lg.sep),"…",Q.slice(-2).join(Lg.sep)].join(Lg.sep)}build(J){let Q=q8.of(J),Y=x6.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&&W5(q.thread.agentMode)&&this.randomAd!==null,{threadState:K}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let W=this.getCurrentConfirmation(),H=this.widget.dependencies.replayMode,z=Boolean(H),U=K.items,B=K.mainThread||void 0,O=K.subagentToolsByParentID,M=K.todosList;if(z){let G6={...H.thread,messages:this.replayDisplayedMessages};U=EC(G6).items,B=G6,O={};let o6=tE({messages:this.replayDisplayedMessages});M=Array.isArray(o6)?o6:[]}let L=B?.id,E=B,I=z?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),P=(G6)=>new p81({key:new c2(`preview-message-view-${G6.id}`),items:EC(G6).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:G6,focusNode:new u8({debugLabel:"PreviewFocus"})}),R=this.previewThread,j=R?R.messages.length>2000?new l0({mainAxisSize:"max",children:[new F4({child:new N0}),new g6({padding:_0.all(2),child:new X8({child:new l1({text:new Y1("Thread too long for preview",new U1({color:G.mutedForeground,dim:!0}))})})})]}):P(R):I?new c81({agentMode:this.getEffectiveAgentMode()}):new p81({key:L?new c2(`message-view-${L}`):void 0,items:U,subagentToolsByParentID:O,controller:L?this.getMessageScrollController(L):new b3,autofocus:!1,onCopy:z?void 0:this._handleTextCopy.bind(this),thread:E,onMessageEditSubmit:z?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:z?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:z?void 0:this.forkMessage,getAffectedFiles:z?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),y=Math.max(Math.floor(Q.size.height*0.4),12),h=this.getCurrentEphemeralError(),g=this.buildBottomWidget(h,W,G,Y,K,M,y,V?this.randomAd:null,z),p=Q.size.width<40,b=K.mainThread?dU0(K.mainThread):void 0,i=new X81({threadViewState:K.viewState,threadTokenUsage:b,threadID:L??null,thread:K.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:p,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!W,showingEphemeralError:Boolean(K.viewState.state==="active"&&K.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),t=new $81({bashInvocations:this.bashInvocations}),r=[],m=this.getEffectiveAgentMode(),s=this.currentShellModeStatus,q1=Nk1(m),H1=!s?m.length+1:0,a=Q.capabilities.animationSupport,o=a==="disabled"?0:a==="slow"?30:60,l=DK(m)?.uiHints?.fasterAnimation?3:1,z1=o>0&&this.agentModePulseSeq>0?new e5({children:[g,new h3({top:0,left:1,right:1,height:1,child:new qk1({color:q1,trigger:this.agentModePulseSeq,fps:o,speed:l,leftOffset:H1})})]}):g;r.push(new F4({child:j}),t);let j1=new e5({children:[new l0({mainAxisSize:"min",children:[V?new R_1({ad:this.randomAd,onButtonClick:async()=>{let G6=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (z91(),H91)).then(({recordAdEvent:o6})=>{let b4=this.widget.dependencies.worker.thread,t4=b4.messages[b4.messages.length-1];o6("clicked",{adId:G6.id,advertiserId:G6.advertiserId,threadId:b4.id,messageId:t4?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:G6.metadata?.matchType,matchedPatterns:G6.metadata?.matchedPatterns,candidateAdPoolCount:G6.metadata?.candidateAdPoolCount,clientRegion:G6.metadata?.clientRegion})});try{await cJ(G6.shortDestinationUrl)}catch(o6){let t4=N9.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:t4,url:G6.shortDestinationUrl}})}}}):new N0({height:0}),new e0({constraints:new d6(0,Q.size.width,0,y),child:z1})]}),V?new h3({top:0,left:0,right:0,child:new t$6({userHeight:this.bottomGridUserHeight,maxHeight:y,onInitializeHeight:(G6)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(G6,y)})},onDrag:(G6)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(G6.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let o6=Math.floor(G6.localPosition.y)-this.bottomGridDragStartY,b4=Math.max(4,this.bottomGridDragStartHeight-o6),t4=Math.min(b4,y),c5=Math.floor(t4);if(this.bottomGridUserHeight!==c5)this.setState(()=>{this.bottomGridUserHeight=c5})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new N0({height:0})]});r.push(j1,new N0({height:1,child:new g6({padding:_0.horizontal(1),child:i})}));let e=new l0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:r}),y1=z?new e5({children:[e,new h3({top:0,left:0,child:new Wk1})]}):e,R1=new n8(()=>{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((o6)=>{x.error("Failed to mark message as interrupted:",o6)}),this.cancelStreamingMessage().catch((o6)=>{x.error("Failed to cancel streaming message:",o6)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return x.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"}),D0=new n8(()=>{return this.onExitPressed(),"handled"}),T1=new n8(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),a1=new n8(()=>{return MJ.instance.toggleAll(),"handled"}),F1=new n8(()=>{return this.widget.dependencies.configService.getLatest().then((G6)=>{DZ("internal.showCost",!(G6.settings["internal.showCost"]??!0))}),"handled"}),Q1=new n8(()=>{return N9.instance.toggleFrameStatsOverlay(),"handled"}),O1=new n8(()=>{return N9.instance.tuiInstance.getScreen().markForRefresh(),B9.instance.requestFrame(),"handled"}),L1=new n8(()=>{return this.toggleAgentMode(),"handled"}),w1=new n8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:b4}=this.widget.dependencies,t4=b4.mainThread?.id;return t4?this.getMessageScrollController(t4):null})();if(o6){let b4=Math.max(Math.floor(Q.size.height*0.4),10),t4=Q.size.height-b4;o6.animatePageUp(t4,100)}return"handled"}),A1=new n8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:b4}=this.widget.dependencies,t4=b4.mainThread?.id;return t4?this.getMessageScrollController(t4):null})();if(o6){let b4=Math.max(Math.floor(Q.size.height*0.4),10),t4=Q.size.height-b4;o6.animatePageDown(t4,100)}return"handled"}),u1=new n8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:b4}=this.widget.dependencies,t4=b4.mainThread?.id;return t4?this.getMessageScrollController(t4):null})();if(o6)o6.animateTo(0,100);return"handled"}),v1=new n8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:b4}=this.widget.dependencies,t4=b4.mainThread?.id;return t4?this.getMessageScrollController(t4):null})();if(o6)o6.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),n1=new n8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:G6}=this.widget.dependencies;if(!G6.mainThread?.messages.some((b4)=>b4.role==="user"||sE(b4)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),$0=new n8((G6)=>{if(G6.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),Q0=new n8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return t41().then(async(G6)=>{if(G6)try{this.handleInsertImage(G6)}finally{try{let{unlink:o6}=await import("node:fs/promises");await o6(G6)}catch{}}}),"handled"}),A0=new Map([[K4.ctrl("c"),new au],[K4.ctrl("l"),new eu],[K4.ctrl("o"),new p41],[K4.ctrl("v"),new iu],[K4.alt("s"),new VC],[K4.ctrl("s"),new VC],[K4.alt("p"),new tu],[K4.ctrl("r"),new ou],[K4.alt("d"),new su],[K4.ctrl("t"),new Jg],[K4.key("PageUp"),new b41],[K4.key("PageDown"),new u41],[K4.key("Home"),new g41],[K4.key("End"),new m41],[K4.key("Escape"),new nu],[K4.ctrl("p"),new KC("previous")],[K4.ctrl("n"),new KC("next")],[K4.key("Tab"),new Qg]]);if(!g7())A0.set(K4.key("ArrowUp"),new Qg);if(!1)A0.set(K4.alt("c"),new ru);let F6=new n8(()=>{if(this.isShowingStandaloneThreadPicker)return"handled";return this.showCommandPalette(),"handled"}),B4=new n8(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),h4=new Map([[nu,R1],[eu,O1],[VC,L1],[p41,F6],[iu,Q0],[ru,T1],[ou,a1],[su,F1],[tu,Q1],[Jg,B4],[au,D0],[b41,w1],[u41,A1],[g41,u1],[m41,v1],[Qg,n1],[KC,$0]]),V8=[y1];if(this.isShowingConsoleOverlay)V8.push(new p_1);if(this.isShowingHelp){let G6=this.getPaletteCommands().getAllCommands();V8.push(new l_1({commands:G6}))}if(this.adActionModal)V8.push(new C_1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(G6)=>{let o6=this.adActionModal.url;if(G6==="copy")try{await N9.instance.tuiInstance.clipboard.writeText(o6),this.setState(()=>{this.displayMessage=new YX("Link copied to clipboard")})}catch(b4){x.error("Failed to copy to clipboard",{error:b4}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.pendingMCPServers.length>0){let{mcpTrustHandler:G6}=this.widget.dependencies;V8.push(new Vk1({servers:this.pendingMCPServers,onAlwaysTrust:G6.trustAlways.bind(G6),onTrustOnce:G6.trustOnce.bind(G6),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:G6.deny.bind(G6)}))}if(this.isShowingFileChangesOverlay)V8.push(new SS1({threadData:K}));if(this.isShowingCostBreakdownOverlay&&K.mainThread)V8.push(new d_1({thread:K.mainThread}));if(this.isShowingConfirmationOverlay)V8.push(new g_1({details:this.confirmationOverlayContent}));let M0=this.getCommandPaletteContext();if(M0&&this.isShowingPalette)V8.push(new X8({child:new e0({constraints:d6.loose(80,20),child:new b_1({commandContext:M0,mainThread:K.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette})})}));if(this.isShowingIdePicker)V8.push(new n_1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));if(this.isShowingStandaloneThreadPicker){let G6=p0.file(process.cwd()),o6=z6(G6);V8.push(new X8({child:new e0({constraints:d6.loose(80,20),child:new UC({threads:this.threadsForPicker,title:"Continue Thread",onSelect:this.handleStandaloneThreadSelect,onDismiss:this.dismissStandaloneThreadPicker,previewController:this.threadPreviewController,isLoading:this.isLoadingThreads,currentWorkspaceURI:o6,filterByWorkspace:this.filterThreadPickerByWorkspace,threadViewStates:this.widget.dependencies.workerController.threadViewStates})})}))}let x0=new e5({children:V8});if(this.isShowingJetBrainsInstaller)return new JA({child:new mQ({actions:h4,child:new Lq({shortcuts:A0,debugLabel:"jetbrains-installer-shortcuts",child:new Zk1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});let c6=new tB({onError:(G6)=>{this.showErrorMessage(G6.message)},child:x0});return new JA({child:new mQ({actions:h4,child:new Lq({shortcuts:A0,debugLabel:"main-app-shortcuts",child:c6})})})}buildScrollableTodoList(J,Q,Y){return new o$6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Y})}buildBottomWidget(J,Q,Y,X,G,Z,q,V,K){if(J)return new c_1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new m_1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new Kk1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let W=X.app,H=Y81(X),z=this.isInRestrictedFreeMode(),U=new NA({key:this.textFieldKey,controller:this.textController,triggers:K?[]:[new GN],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":z?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!z&&!this.isShowingStandaloneThreadPicker,shellPromptRules:H,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker,clipboard:N9.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage}),B=G.mainThread?.queuedMessages??[],O=Array.isArray(Z)&&Z.length>0,M=Array.isArray(B)&&B.length>0,L=G.mainThread?.agentMode==="plan"&&aL(G.mainThread),E,I;if(L){if(E=new tC1(new d81({thread:G.mainThread,onExecute:async()=>{let b=this.getCommandPaletteContext();if(b)await this.getPaletteCommands().execute("execute-plan",b,void 0,new AbortController)},onEdit:async()=>{try{let b=process.env.EDITOR||process.env.VISUAL||"nano",{filePath:i}=await this.widget.dependencies.planFileManager.ensureSync(G.mainThread.id);N9.instance.tuiInstance.suspend();let{execSync:t}=await import("child_process");t(`${b} "${i}"`,{stdio:"inherit"}),N9.instance.tuiInstance.resume()}catch(b){x.error("Failed to edit plan",b),this.setState(()=>{this.displayMessage=Error("Failed to edit plan")})}},controller:this.planScrollController,appTheme:X}),{clipBehavior:"antiAlias"}),M)I=new W91({queuedMessages:B});else if(O)I=this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!z,X)}else E=M?new W91({queuedMessages:B}):void 0,I=O?this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!z,X):void 0;let P=[],R=this.currentShellModeStatus;if(R)P.push({text:new Y1(R==="hidden"?"shell mode (incognito)":"shell mode",new U1({color:R==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left"});if(!R&&this.cachedVisibleModes.length>1){let b=this.previewThread,i=b?b.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),t=Nk1(i);if(b)P.push({text:new Y1(i,new U1({color:t})),position:"top-left",offsetY:0});else{let m=Ib(i,this.cachedVisibleModes)!==i,s=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,q1=PZ(s.thread)===0,a=z||!this.hasToggledAgentMode&&m&&q1?new Y1("",void 0,[new Y1(i,new U1({color:t})),new Y1(" (click or ",new U1({color:Y.foreground,dim:!0})),new Y1("Ctrl+S",new U1({color:W.keybind})),new Y1(" to switch)",new U1({color:Y.foreground,dim:!0}))]):new Y1(i,new U1({color:t}));P.push({text:a,position:"top-left",offsetY:0,onClick:q1?this.toggleAgentMode:void 0})}}if(this.connectedClientsStatus&&this.connectedClientsStatus.enabled){let b=this.connectedClientsStatus,i=b.mode||"disconnected",t=!!b.errorMessage,r=b.clientID||"unknown",m,s;if(t)m="●",s=M1.red;else if(i==="presence")m="○",s=M1.yellow;else if(i==="connected"&&b.connected)m="●",s=M1.green;else m="○",s=M1.yellow;let q1=this.connectedClientsStatusExpanded?`${r} ${m}`:m;P.push({text:new Y1(q1,new U1({color:s})),position:"top-right",offsetX:-2,offsetY:0,onClick:this.toggleConnectedClientsStatus})}let j=K?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:G.mainThread?.env?.initial.trees?.[0]?.uri,y;if(j)y=p0.parse(j).fsPath;else y=process.cwd();let h=this.toHomeRelative(y),g=this.shorten(h),p=!K&&this.currentGitBranch?`${g} (${this.currentGitBranch})`:g;return P.push({text:new Y1(p,new U1({color:Y.foreground,dim:!0})),position:"bottom-right"}),new LS1({leftChild:new F4({child:U}),rightChild1:E,rightChild2:I,maxHeight:q,overlayTexts:P,borderColor:z||!this.isTextfieldAndAutocompleteFocused?M1.index(8):void 0,hasBanner:V!==null,userHeight:this.bottomGridUserHeight,onInitializeHeight:(b)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(b,q)})},onDrag:(b)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(b.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let i=Math.floor(b.localPosition.y)-this.bottomGridDragStartY,t=Math.max(4,this.bottomGridDragStartHeight-i),r=Math.min(t,q),m=Math.floor(r);if(this.bottomGridUserHeight!==m)this.setState(()=>{this.bottomGridUserHeight=m})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:V===null})}}async function Dk1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)N9.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let X=()=>null,Z=!1,q=new Xz(Z,1000,J.inspectorPort),V=J.features?.find((L)=>L.name==="amp-connect")?.enabled??!1,K=new P_1({threadService:J.threadService,worker:J.worker,builder:(L,E,I,P,R)=>{if(X=R,J.threadDependencies&&V)hC1(J.threadDependencies,J.configService,R,P,J.connectedClientsService,J.startNewThread,J.switchToThread,J.clientId).catch((g)=>{x.error("Failed to start automatic presence:",g)});let j=R(),y=j.thread.id,h={...J,worker:j,threadID:y};return new a$6({...h,threadState:E,workerController:I,switchWorker:P,getCurrentWorker:R})}}),W=new PS1({configService:J.configService,child:K}),H=new wS1({configService:J.configService,child:W}),z=new KS1(H),U=new x6({data:HC.fromBaseTheme(jG.default()),child:z});try{await CC1(U,{onRootElementMounted:(L)=>{if(x.info("TUI input ready for user interaction"),Z)q.start(L)}})}finally{if(Z)q.stop();if(J.threadDependencies&&V){let{stopGlobalSession:L}=await Promise.resolve().then(() => (bC1(),r76));L()}}let O=X()?.thread.id||J.threadID,M=await J.threadService.get(O);if(M&&M.messages.length>0){let L=`${J.ampURL.replace(/\/$/,"")}/threads/${O}`;D36(M,L,J.stdout)}}function Nk1(J){return J==="smart"?M1.rgb(145,119,199):J==="rush"?M1.rgb(228,180,2):W5(J)?M1.rgb(0,184,255):J==="plan"?M1.rgb(153,102,255):VO8(J)}class o$6 extends Q6{props;constructor(J){super();this.props=J}createState(){return new s$6}}class s$6 extends J6{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 G4({crossAxisAlignment:"stretch",children:[new F4({child:new O7({controller:Y,autofocus:!1,child:new T_1({todos:Q})})}),new XX({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 t$6 extends T6{props;constructor(J){super();this.props=J}build(J){return new I8({child:new N0({height:1}),cursor:f9.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 VO8(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 M1.index(Y[X])}RC1();try{if(process.platform==="win32")await Promise.resolve().then(() => U6(pC(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){gG.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
5125
|
-
`)}var iy1=ly1.join(wz0||ly1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function _w8(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 Tq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")DZ("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")DZ("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")DZ("model.sonnet",Q.useSonnet)}async function ay1(J){try{await Cw8(ly1.dirname(iy1),{recursive:!0}),await Sw8(iy1,J,"utf-8")}catch(Q){x.debug("Failed to save last thread ID",Q)}}async function kw8(){try{return(await Iq6(iy1,"utf-8")).trim()}catch(J){return null}}var Aq6=[{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??PG,description:`Custom settings file path (overrides the default location ${PG})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(x).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${kR1})`},{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:g7(),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 Gemini 3":"Use default model (Gemini 3)"},{name:"mode",long:"mode",short:"m",type:"option",default:zR.SMART.key,description:`Set the agent mode (${BG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:BG().map((J)=>J.mode)}],wq6=(J)=>("deprecated"in J)&&J.deprecated===!0,yw8=(J)=>("hidden"in J)&&J.hidden===!0,vw8=(J)=>("default"in J),xw8=(J)=>("default"in J)?J.default:void 0;function fw8(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 A8(IG.unknownCommand(Y),1,q)}}var Pq6=null;function Kz5(){return Pq6}function dg(J){return{...J,getThreadEnvironment:h61,vfs:bD0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new lh(J.fileSystem),generateThreadTitle:p16,deleteThread:(Q)=>J.threadService.delete(Q)}}var ry1=p0.file(jw8.homedir()),Tq6=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):t0.joinPath(ry1,".config");async function Rq(J,Q){QB0("0.0.
|
|
5125
|
+
`)}var iy1=ly1.join(wz0||ly1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function _w8(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 Tq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")DZ("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")DZ("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")DZ("model.sonnet",Q.useSonnet)}async function ay1(J){try{await Cw8(ly1.dirname(iy1),{recursive:!0}),await Sw8(iy1,J,"utf-8")}catch(Q){x.debug("Failed to save last thread ID",Q)}}async function kw8(){try{return(await Iq6(iy1,"utf-8")).trim()}catch(J){return null}}var Aq6=[{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??PG,description:`Custom settings file path (overrides the default location ${PG})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(x).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${kR1})`},{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:g7(),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 Gemini 3":"Use default model (Gemini 3)"},{name:"mode",long:"mode",short:"m",type:"option",default:zR.SMART.key,description:`Set the agent mode (${BG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:BG().map((J)=>J.mode)}],wq6=(J)=>("deprecated"in J)&&J.deprecated===!0,yw8=(J)=>("hidden"in J)&&J.hidden===!0,vw8=(J)=>("default"in J),xw8=(J)=>("default"in J)?J.default:void 0;function fw8(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 A8(IG.unknownCommand(Y),1,q)}}var Pq6=null;function Kz5(){return Pq6}function dg(J){return{...J,getThreadEnvironment:h61,vfs:bD0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new lh(J.fileSystem),generateThreadTitle:p16,deleteThread:(Q)=>J.threadService.delete(Q)}}var ry1=p0.file(jw8.homedir()),Tq6=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):t0.joinPath(ry1,".config");async function Rq(J,Q){QB0("0.0.1763928079-g29218b");let Y=eE1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:t1.of([p0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:ry1,userConfigDir:Tq6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (z91(),H91));X(Y);let G=await Y.getLatest();x.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let Z=new zL({configService:Y}),q=new Map,V=()=>q.clear(),K=new RP1(Y,J.settings.getWorkspaceRootPath()),W=O16({configService:Y,trustStore:K,createOAuthProvider:async(t)=>{let r=q.get(t);if(r)return x.debug("Reusing existing OAuth provider for server",{serverName:t}),r;x.debug("Creating OAuth provider for server",{serverName:t});let m=(async()=>{let s=new SL(J.secrets),q1=await s.getClientInfo(t),H1=new HP1({storage:s,serverName:t,clientId:q1?.clientId,clientSecret:q1?.clientSecret,scopes:q1?.scopes});return x.debug("OAuth provider created",{serverName:t,hasManualClientId:!!q1?.clientId,willUseDCR:!q1?.clientId}),H1})();return q.set(t,m),m}}),H=o11({configService:Y,filesystem:H5,spawn:IL}),{initializeToolProviders:z}=await Promise.resolve().then(() => (Lq6(),Mq6)),{registrations:U,initErrors:B}=await z({toolServices:Z,providers:[W,H],initialTimeout:J.executeMode?15000:5000});for(let[t,r]of B)x.warn(`${t} provider initialization slow or failed:`,r);if(Q.jetbrains)JI("JetBrains");else if(Q.ide&&s56())JI("VS Code");else if(Q.ide&&t56())JI("Neovim");if(J.executeMode)YB0(!0);let O,M=F7.status.pipe(o0((t)=>Boolean(t.connected&&t.authenticated)),P4()).subscribe((t)=>{if(t){if(!O)O=Z.registerTool(MT)}else O?.dispose(),O=void 0}),L;if(!J.executeMode)L=new a61(process.cwd(),{},!0);else L=new class extends a61{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(d5.write(`No API key found. Starting login flow...
|
|
5126
5126
|
`),!await hw8(J))await dL(),process.exit(1)}let E=await y16({isDevelopment:!1}),I=new yP1(E,Y),P=new jP1(E,{lazy:!0}),R=new CP1(I,(t,r)=>{let m=V3.get(t);if(m)m.handle(r).catch((s)=>{x.error("Failed to apply artifact delta",s)})}),j=Q.notifications!==void 0?Q.notifications:!J.executeMode,y=r16({playNotificationSound:async(t)=>{if(j){a16(t);let r=PC1(),m=TC1();if((!r||m)&&G.settings["notifications.system.enabled"]!==!1){if(t==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(t==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:I,configService:Y});x.info("Starting Amp background services");let h=c16({threadService:I,threadHistoryService:P,configService:Y,isExtensionDevelopment:!1}),g;F7.status.subscribe((t)=>{g=t});let p=new JG1({workspaceRoots:[p0.file(process.cwd())],getCurrentFile:()=>{if(!g?.openFile)return;try{return p0.parse(g.openFile)}catch(t){x.warn("Failed to parse current file URI",{uri:g.openFile,error:t});return}},getOpenFiles:()=>{if(!g?.visibleFiles?.length)return[];let t=g.openFile;return g.visibleFiles.filter((r)=>r!==t).map((r)=>{try{return p0.parse(r)}catch(m){return x.warn("Failed to parse visible file URI",{uri:r,error:m}),null}}).filter((r)=>r!==null)}}),b=new SC1,i={codebaseContextService:p,configService:Y,toolServices:Z,mcpService:W,trustStore:K,threadService:I,threadHistoryService:P,threadSyncService:h,planFileManager:R,threadStorage:E,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:L,notificationService:y,fileSystem:Q.jetbrains||Q.ide?R16:H5,terminal:b};return{...i,async asyncDispose(){for(let t of U.values())t.dispose();await i.mcpService.dispose(),V(),await i.threadService.asyncDispose(),i.configService.unsubscribe(),i.toolServices.dispose(),i.fuzzyServer.dispose(),i.threadSyncService.dispose(),i.settingsStorage[Symbol.dispose](),M.unsubscribe(),O?.dispose()}}}async function hw8(J){if(!J.executeMode){if(!await $C1("Would you like to log in to Amp? [(y)es, (n)o]: "))return d5.write(`Login cancelled. Run the command again to retry.
|
|
5127
5127
|
`),!1}return await Rq6(J)}async function Rq6(J){let Q=Rw8(32).toString("hex"),Y=await YC1(J.ampURL,Q),X=new AbortController;try{await cJ(Y,X.signal)}catch(Z){x.error("Error opening browser",{error:Z})}let G=await YC1(J.ampURL,Q,!1);d5.write(`If your browser does not open automatically, visit:
|
|
5128
5128
|
|
|
@@ -5132,15 +5132,15 @@ ${S4.blue.bold(G)}
|
|
|
5132
5132
|
Login successful! You can now use the Amp CLI.
|
|
5133
5133
|
`),!0}catch(Z){return x.error("Login failed",{error:Z}),gG.write(`
|
|
5134
5134
|
Login failed: ${Z instanceof Error?Z.message:String(Z)}
|
|
5135
|
-
`),!1}}function bw8(){let J=new _L().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)cR(),process.exit(0);let z=H.originalError??H;l96(z)}),J.option("-V, --version","Print the version number and exit",()=>{d5.write(`0.0.
|
|
5135
|
+
`),!1}}function bw8(){let J=new _L().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)cR(),process.exit(0);let z=H.originalError??H;l96(z)}),J.option("-V, --version","Print the version number and exit",()=>{d5.write(`0.0.1763928079-g29218b (released 2025-11-23T20:06:26.206Z)
|
|
5136
5136
|
`),process.exit(0)}),J.addHelpText("after",a56()),J.configureHelp({formatHelp:r56}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let U=z.optsWithGlobals(),B=await rQ(U);await pw8(B)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let U=z.optsWithGlobals(),B=await rQ(U);await mw8(B,await lR1(U,B.settings))});let Q=async(H,z,U)=>{eE1({storage:z.settings,secretStorage:z.secrets,workspaceRoots:t1.of([p0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:ry1,userConfigDir:Tq6});let B={...z,executeMode:!1};await ny1(B,{...H,openThreadSwitcher:!0},U)},Y=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(H,z)=>{let U=z.optsWithGlobals(),B=await rQ(U);await Eq6(U,B,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(),B=await rQ(U);await rw8(U,B,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 B=U.optsWithGlobals(),O=await rQ(B);if(z.pick)gG.write(`${S4.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
5137
5137
|
`);if(z.last||H||O.executeMode)await aw8(B,O,H,U);else await Q(B,O,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 B=U.optsWithGlobals(),O=await rQ(B);await nw8(B,O,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(),B=await rQ(U);await Eq6(U,B,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 B=U.optsWithGlobals(),O=await rQ(B);await iw8(B,O,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,B)=>{let O=B.optsWithGlobals(),M=await rQ(O);await dw8(O,M,H,z,B)}),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 B=U.optsWithGlobals(),O=await rQ(B);await cw8(B,O,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 B=U.optsWithGlobals(),O=await rQ(B);await lw8(B,O,H,z,U)}),c76(J,async(H,z)=>{let U=await rQ(z);Tq(H,z);let B=await Rq(U,z);return{context:U,mcpService:B.mcpService,toolService:B.toolServices,toolServices:B.toolServices,configService:B.configService,cleanupTerminal:cR,asyncDispose:B.asyncDispose.bind(B)}}),k26(J,async(H)=>{let z=H.optsWithGlobals();return await rQ(z)}),w26(J,async(H)=>{let z=await rQ(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(U)=>{Tq(U,H);let B=await Rq(z,H);return{mcpService:B.mcpService,settings:z.settings,asyncDispose:B.asyncDispose.bind(B)}}}});function G(H,z,U){let O=typeof H.description==="string"?H.description:U===void 0?H.description(!0):H.description(U),M=new vB(z,O),L=xw8(H);if(L)M.default(L);if(M.hidden=yw8(H)||wq6(H),"choices"in H)M.choices([...H.choices]);return M}for(let H of Aq6)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 vB("-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 vB("-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 vB("--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 vB("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(K);let W=new vB("--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 vB("--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,B=await rQ(U);if(Object.keys(U).forEach((O)=>{let M=Aq6.find((L)=>L.name===O);if(M&&wq6(M)&&!vw8(M))gG.write(S4.yellow(`Warning: '--${O}' flag is deprecated
|
|
5138
5138
|
`))}),z.args.length>0)fw8(B,z);await ny1(B,U,z)}),U26(J),J}async function J51(J,Q){let{thread:Y,visibility:X}=Q,G=Y?.id??EZ(),Z=dg(J);if(Y)await J.threadStorage.set(G,Y);let q=await V3.getOrCreateForThread(Z,G),V=await J.threadStorage.get(G);if(Q.agentMode&&!V?.agentMode&&PZ(q.thread)===0)await q.handle({type:"agent-mode",mode:Q.agentMode});if(X)await J.threadSyncService.updateThreadMeta(G,Z41(X));let K=J.threadService.observe(G).subscribe(async(W)=>{if(JJ(W,"assistant"))await ay1(G),K.unsubscribe()});return await q.resume(),q}async function ny1(J,Q,Y){let X=G41(Q);if(X instanceof Error)uG(X.message);let G,Z=null;if(Q.streamJsonInput)G="";else if(typeof Q.execute==="string"){G=Q.execute;let i=(await XC1()).trimEnd();if(i)Z=i}else G=(await XC1()).trimEnd();if(Q.remote&&!J.executeMode)throw new A8("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new A8("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new A8("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new A8("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if((J.executeMode||Q.streamJson)&&W5(Q.mode))throw new A8(`Execute mode is not permitted with --mode '${Q.mode}'`,1);if(Q.stats&&!J.executeMode)throw new A8("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new A8("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&G===""&&!Q.streamJsonInput)throw new A8("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
|
|
5139
5139
|
Or pipe via stdin: echo "your message" | amp --execute`);Tq(Y,Q);let q=await Rq(J,Q);Pq6=q;let V=dg(q),K=async(i)=>{let t=await Iq6(i,"utf-8"),r=JSON.parse(t);if(!IZ(r.id))throw new A8(IG.invalidThreadId);return J51(q,{visibility:X,agentMode:Q.mode,thread:r})},W=async(i)=>{if(!IZ(i))throw new A8(IG.invalidThreadId);try{let[r,m]=await Promise.all([M5.getThreadLinkInfo({thread:i},{config:q.configService}),M5.getUserInfo({},{config:q.configService})]);if(r.ok&&m.ok){let s=r.result.creatorUserID,q1=m.result.id;if(s&&s!==q1&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new A8(`Cannot resume thread created by another user.
|
|
5140
5140
|
|
|
5141
5141
|
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(r){if(r instanceof A8)throw r;x.warn("Failed to validate thread ownership in CLI, allowing to open",{error:r})}let t=await q.threadService.get(i)??void 0;return x.info(`[fetchAndStartThread] Loaded thread ${i}, agentMode: ${t?.agentMode??"undefined"}`),J51(q,{visibility:X,agentMode:t?void 0:Q.mode,thread:t})},H=async()=>{try{if(Q.threadId)return W(Q.threadId);else return J51(q,{visibility:X})}catch(i){if(i instanceof A8)throw i;throw await Bu(i,Q.threadId),Error("handleError should have called process.exit()")}},z=async()=>{return J51(q,{visibility:X})};if(Q.format==="jsonl")gG.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
5142
|
-
`),await dL(),process.exit(1);if(J.executeMode&&Q.remote)await y26(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)P26(q.mcpService,J.settings),await Z56(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,O=!1;if(Q.jetbrains||Q.ide){await qh0();let i=OT({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)O=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let t=i[0];if(t)F7.selectConfig(t)}else B=!0}let M=$41("0.0.
|
|
5143
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await k56({...J,workspaceTrust:{current:!0,changes:m_},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 E26(J.mcpConfig);X=I26(X,Z)}let G=await X.get("url","global");if(!G)G=KY;if(!PF(G))x.info("Targeting custom Amp server",{ampURL:G});return X=AF0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:v26(await lR1(J,X))}}function uw8(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 gw8(){let J=uw8(process.argv);if(f96({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),_w8(x),x.info("Starting Amp CLI.",{version:"0.0.
|
|
5142
|
+
`),await dL(),process.exit(1);if(J.executeMode&&Q.remote)await y26(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)P26(q.mcpService,J.settings),await Z56(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,O=!1;if(Q.jetbrains||Q.ide){await qh0();let i=OT({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)O=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let t=i[0];if(t)F7.selectConfig(t)}else B=!0}let M=$41("0.0.1763928079-g29218b",q.settingsStorage),L=new $61(q.threadStorage),E=t1.of([p0.file(process.cwd())]),I=zG1(void 0,E),P=new X41(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let R=(async()=>{try{let i=await M5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(i.ok)return x.info("User free tier status:",i),i.result}catch(i){x.error("Failed to fetch free tier status:",i)}})(),j=(async()=>{try{let i=await M5.getUserInfo({},{config:q.configService});if(i.ok)return i.result}catch(i){x.debug("Failed to fetch user workspace info:",i)}})(),[y,h]=await Promise.all([R,j]),g=h?.email,p=g&&(g.endsWith("@sourcegraph.com")||g.endsWith("@ampcode.com")||g==="auth-bypass-user@example.com");if(p)q.toolServices.registerTool(n16);let b=await h26();x.info("Loaded session state:",b),await Dk1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new m61,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:L,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:M5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:F7,connectedClientsService:new Y01,commandRegistry:I,mcpService:q.mcpService,mcpTrustHandler:P,showJetBrainsInstaller:O,showIdePicker:B,openThreadSwitcher:Q.openThreadSwitcher,updateService:M,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:b,freeTierStatus:y,workspace:h?.team??null,features:h?.features??[],isDogfooding:p||!1,threadDependencies:q}),await q.asyncDispose(),process.exit(0)}async function rQ(J){if(J.interactive)gG.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
5143
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await k56({...J,workspaceTrust:{current:!0,changes:m_},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 E26(J.mcpConfig);X=I26(X,Z)}let G=await X.get("url","global");if(!G)G=KY;if(!PF(G))x.info("Targeting custom Amp server",{ampURL:G});return X=AF0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:v26(await lR1(J,X))}}function uw8(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 gw8(){let J=uw8(process.argv);if(f96({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),_w8(x),x.info("Starting Amp CLI.",{version:"0.0.1763928079-g29218b",buildTimestamp:"2025-11-23T20:06:26.206Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new A8(IG.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await bw8().parseAsync(process.argv)}Rw1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await gw8().catch(Bu)});async function mw8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),d5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
5144
5144
|
`);else if(!PF(J.ampURL))d5.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
5145
5145
|
`);let Y=process.env.AMP_API_KEY;if(Y)d5.write(`API key found in environment variable, storing...
|
|
5146
5146
|
`),await Q.set("apiKey",Y,J.ampURL),d5.write(`API key successfully stored.
|
|
@@ -5153,7 +5153,7 @@ This thread belongs to a different user and cannot be continued for security rea
|
|
|
5153
5153
|
`);else d5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
|
|
5154
5154
|
`);process.exit(0)}async function dw8(J,Q,Y,X,G){Tq(G,J);let Z=await Rq(Q,J);try{let q=Q51(Y);if(!q)Y51(Y);let V=q,K=X.trim();if(K.length===0)uG("Thread name cannot be empty");if(K.length>256)uG("Thread name cannot exceed 256 characters");if(!(await dC(V,Z)).messages.length)uG("Cannot rename an empty thread.");let H=dg(Z);await(await V3.getOrCreateForThread(H,V)).handle({type:"title",value:K}),x.info("GOT HERE"),await Z.threadSyncService.sync(),x.info("GOT THERE"),d5.write(S4.green(`✓ Thread ${V} renamed to "${K}"
|
|
5155
5155
|
`)),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose();let V=`Failed to rename thread: ${q instanceof Error?q.message:String(q)}`;uG(V)}}async function cw8(J,Q,Y,X){Tq(X,J);let G=await Rq(Q,J);try{let Z=Q51(Y);if(!Z)Y51(Y);let V=await dC(Z,G),K=dT(V);d5.write(K+`
|
|
5156
|
-
`),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)}`;uG(q)}}async function lw8(J,Q,Y,X,G){Tq(G,J);let Z=await Rq(Q,J);try{let q=await oy1(Y),V=await dC(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,B=X.indicator!==!1,O=dg(Z),M=V.id;await Z.threadStorage.set(M,V);let L=await V3.getOrCreateForThread(O,M);await L.resume();let E=Y61.fromWorker(L),I=new $61(Z.threadStorage),P=t1.of([p0.file(process.cwd())]),R=zG1(void 0,P),j=new X41(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=$41("0.0.
|
|
5156
|
+
`),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)}`;uG(q)}}async function lw8(J,Q,Y,X,G){Tq(G,J);let Z=await Rq(Q,J);try{let q=await oy1(Y),V=await dC(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,B=X.indicator!==!1,O=dg(Z),M=V.id;await Z.threadStorage.set(M,V);let L=await V3.getOrCreateForThread(O,M);await L.resume();let E=Y61.fromWorker(L),I=new $61(Z.threadStorage),P=t1.of([p0.file(process.cwd())]),R=zG1(void 0,P),j=new X41(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=$41("0.0.1763928079-g29218b",Z.settingsStorage);await Dk1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new m61,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:M,threadFuzzyIndexer:I,worker:E,workerDeps:O,configService:Z.configService,internalAPIClient:M5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:F7,connectedClientsService:new Y01,commandRegistry:R,mcpService:Z.mcpService,mcpTrustHandler:j,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:B}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await Bu(q,Y)}}async function iw8(J,Q,Y,X,G){Tq(X,J);let Z=await Rq(Q,J);try{let q=Q51(Y);if(!q)Y51(Y);let V=q,K=await M5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=G41(J,W);if(!H&&!G)uG("Must specify either --visibility or --support");if(H&&G)uG("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)uG(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,Z41(H)),d5.write(S4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
|
|
5157
5157
|
`);if(G){await dC(V,Z);let z=typeof G==="string"?G:void 0;await Vv0(Z.threadService,V,Z.configService,z),d5.write(S4.green("✓ ")+`Thread ${V} has been shared with Amp support. These thread reports will be aggregated and analysed.
|
|
5158
5158
|
`)}await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),uG(`Failed to update thread: ${q instanceof Error?q.message:String(q)}`)}}async function nw8(J,Q,Y,X){Tq(X,J);let G=await Rq(Q,J),Z=dg(G);try{let q=await oy1(Y),K=(await dC(q,G)).messages.length-1,W=await V3.getOrCreateForThread(Z,q),H=await jR(W,G.threadSyncService,K);await Promise.all([G.threadSyncService.uploadThread(q),G.threadSyncService.uploadThread(H)]),await ay1(H),d5.write(`${H}
|
|
5159
5159
|
`),await G.asyncDispose(),process.exit(0)}catch(q){gG.write(`Error forking thread: ${q instanceof Error?q.message:String(q)}
|