@sourcegraph/amp 0.0.1764705684-g95eb77 → 0.0.1764720103-g0db7ac
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 +11 -11
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -45,7 +45,7 @@ ${q}`.trim()}_serializeSingularDataPoint(J,Q,Y){let X="";J=OZ1(J,Q);let{value:G,
|
|
|
45
45
|
${X}
|
|
46
46
|
${G}
|
|
47
47
|
`}}Gz0.PrometheusSerializer=Xz0});var Vz0=h(($z0)=>{Object.defineProperty($z0,"__esModule",{value:!0});$z0.PrometheusExporter=void 0;var Dk=m6(),XQ4=K8(),IZ1=gD(),GQ4=y1("http"),ZQ4=EZ1(),$Q4=y1("url");class tW extends IZ1.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:IZ1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(G)=>IZ1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||tW.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||tW.DEFAULT_OPTIONS.port,this._prefix=J.prefix||tW.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:tW.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||tW.DEFAULT_OPTIONS.withResourceConstantLabels,X=J.withoutTargetInfo||tW.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,GQ4.createServer)(this._requestHandler).unref(),this._serializer=new ZQ4.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,X),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||tW.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(G)=>{Dk.diag.error(G),Q(G)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return Dk.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)Dk.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,XQ4.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},()=>{Dk.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 $Q4.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)Dk.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()}}$z0.PrometheusExporter=tW});var Kz0=h((ul)=>{Object.defineProperty(ul,"__esModule",{value:!0});ul.PrometheusSerializer=ul.PrometheusExporter=void 0;var qQ4=Vz0();Object.defineProperty(ul,"PrometheusExporter",{enumerable:!0,get:function(){return qQ4.PrometheusExporter}});var VQ4=EZ1();Object.defineProperty(ul,"PrometheusSerializer",{enumerable:!0,get:function(){return VQ4.PrometheusSerializer}})});var Uz0=h((zz0)=>{Object.defineProperty(zz0,"__esModule",{value:!0});zz0.OTLPTraceExporter=void 0;var WQ4=BV(),HQ4=I$(),Wz0=pW();class Hz0 extends WQ4.OTLPExporterBase{constructor(J={}){super((0,Wz0.createOtlpHttpExportDelegate)((0,Wz0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),HQ4.ProtobufTraceSerializer))}}zz0.OTLPTraceExporter=Hz0});var Bz0=h((PZ1)=>{Object.defineProperty(PZ1,"__esModule",{value:!0});PZ1.OTLPTraceExporter=void 0;var zQ4=Uz0();Object.defineProperty(PZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return zQ4.OTLPTraceExporter}})});var Nz0=h((RZ1)=>{Object.defineProperty(RZ1,"__esModule",{value:!0});RZ1.OTLPTraceExporter=void 0;var UQ4=Bz0();Object.defineProperty(RZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return UQ4.OTLPTraceExporter}})});var Dz0=h((TZ1)=>{Object.defineProperty(TZ1,"__esModule",{value:!0});TZ1.OTLPTraceExporter=void 0;var NQ4=Nz0();Object.defineProperty(TZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return NQ4.OTLPTraceExporter}})});var wz0=h((Az0)=>{Object.defineProperty(Az0,"__esModule",{value:!0});Az0.OTLPTraceExporter=void 0;var MQ4=BV(),LQ4=I$(),Mz0=pW();class Lz0 extends MQ4.OTLPExporterBase{constructor(J={}){super((0,Mz0.createOtlpHttpExportDelegate)((0,Mz0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),LQ4.JsonTraceSerializer))}}Az0.OTLPTraceExporter=Lz0});var Ez0=h((CZ1)=>{Object.defineProperty(CZ1,"__esModule",{value:!0});CZ1.OTLPTraceExporter=void 0;var AQ4=wz0();Object.defineProperty(CZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return AQ4.OTLPTraceExporter}})});var Iz0=h((jZ1)=>{Object.defineProperty(jZ1,"__esModule",{value:!0});jZ1.OTLPTraceExporter=void 0;var wQ4=Ez0();Object.defineProperty(jZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return wQ4.OTLPTraceExporter}})});var Pz0=h((SZ1)=>{Object.defineProperty(SZ1,"__esModule",{value:!0});SZ1.OTLPTraceExporter=void 0;var IQ4=Iz0();Object.defineProperty(SZ1,"OTLPTraceExporter",{enumerable:!0,get:function(){return IQ4.OTLPTraceExporter}})});var Sz0=h((Cz0)=>{Object.defineProperty(Cz0,"__esModule",{value:!0});Cz0.OTLPTraceExporter=void 0;var Rz0=vl(),RQ4=I$(),TQ4=BV();class Tz0 extends TQ4.OTLPExporterBase{constructor(J={}){super((0,Rz0.createOtlpGrpcExportDelegate)((0,Rz0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),RQ4.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}Cz0.OTLPTraceExporter=Tz0});var _z0=h((_Z1)=>{Object.defineProperty(_Z1,"__esModule",{value:!0});_Z1.OTLPTraceExporter=void 0;var CQ4=Sz0();Object.defineProperty(_Z1,"OTLPTraceExporter",{enumerable:!0,get:function(){return CQ4.OTLPTraceExporter}})});var xz0=h((kz0)=>{Object.defineProperty(kz0,"__esModule",{value:!0});kz0.prepareSend=void 0;var kZ1=m6(),pl=K8(),SQ4=y1("http"),_Q4=y1("https");function kQ4(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 kZ1.diag.debug("Zipkin send with empty spans"),q({code:pl.ExportResultCode.SUCCESS});let{request:V}=Y.protocol==="http:"?SQ4:_Q4,K=V(Y,X,(H)=>{let z="";H.on("data",(U)=>{z+=U}),H.on("end",()=>{let U=H.statusCode||0;if(kZ1.diag.debug(`Zipkin response status code: ${U}, body: ${z}`),U<400)return q({code:pl.ExportResultCode.SUCCESS});else return q({code:pl.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${U}`)})})});K.on("error",(H)=>{return q({code:pl.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(Z);kZ1.diag.debug(`Zipkin request payload: ${W}`),K.write(W,"utf8"),K.end()}}kz0.prepareSend=kQ4});var vz0=h((yZ1)=>{Object.defineProperty(yZ1,"__esModule",{value:!0});yZ1.prepareSend=void 0;var yQ4=xz0();Object.defineProperty(yZ1,"prepareSend",{enumerable:!0,get:function(){return yQ4.prepareSend}})});var vZ1=h((xZ1)=>{Object.defineProperty(xZ1,"__esModule",{value:!0});xZ1.prepareSend=void 0;var vQ4=vz0();Object.defineProperty(xZ1,"prepareSend",{enumerable:!0,get:function(){return vQ4.prepareSend}})});var hz0=h((fz0)=>{Object.defineProperty(fz0,"__esModule",{value:!0});fz0.SpanKind=void 0;var hQ4;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(hQ4=fz0.SpanKind||(fz0.SpanKind={}))});var pz0=h((mz0)=>{Object.defineProperty(mz0,"__esModule",{value:!0});mz0._toZipkinAnnotations=mz0._toZipkinTags=mz0.toZipkinSpan=mz0.defaultStatusErrorTagName=mz0.defaultStatusCodeTagName=void 0;var bF=m6(),hZ1=K8(),dl=hz0(),bQ4={[bF.SpanKind.CLIENT]:dl.SpanKind.CLIENT,[bF.SpanKind.SERVER]:dl.SpanKind.SERVER,[bF.SpanKind.CONSUMER]:dl.SpanKind.CONSUMER,[bF.SpanKind.PRODUCER]:dl.SpanKind.PRODUCER,[bF.SpanKind.INTERNAL]:void 0};mz0.defaultStatusCodeTagName="otel.status_code";mz0.defaultStatusErrorTagName="error";function gQ4(J,Q,Y,X){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:bQ4[J.kind],timestamp:(0,hZ1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,hZ1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:bz0(J,Y,X),annotations:J.events.length?gz0(J.events):void 0}}mz0.toZipkinSpan=gQ4;function bz0({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}mz0._toZipkinTags=bz0;function gz0(J){return J.map((Q)=>({timestamp:Math.round((0,hZ1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}mz0._toZipkinAnnotations=gz0});var lz0=h((dz0)=>{Object.defineProperty(dz0,"__esModule",{value:!0});dz0.prepareGetHeaders=void 0;function cQ4(J){return function(){return J()}}dz0.prepareGetHeaders=cQ4});var tz0=h((rz0)=>{Object.defineProperty(rz0,"__esModule",{value:!0});rz0.ZipkinExporter=void 0;var iz0=m6(),nz0=K8(),az0=vZ1(),bZ1=pz0(),gZ1=NF(),lQ4=lz0();class oz0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,nz0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,az0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||bZ1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||bZ1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,lQ4.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[gZ1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(iz0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:nz0.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 iz0.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,az0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let X=J.map((G)=>(0,bZ1.toZipkinSpan)(G,String(G.attributes[gZ1.ATTR_SERVICE_NAME]||G.resource.attributes[gZ1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(X,(G)=>{if(Y)return Y(G)})}}rz0.ZipkinExporter=oz0});var ez0=h((cl)=>{Object.defineProperty(cl,"__esModule",{value:!0});cl.ZipkinExporter=cl.prepareSend=void 0;var iQ4=vZ1();Object.defineProperty(cl,"prepareSend",{enumerable:!0,get:function(){return iQ4.prepareSend}});var nQ4=tz0();Object.defineProperty(cl,"ZipkinExporter",{enumerable:!0,get:function(){return nQ4.ZipkinExporter}})});var mZ1=h((JF0)=>{Object.defineProperty(JF0,"__esModule",{value:!0});JF0.B3_DEBUG_FLAG_KEY=void 0;var oQ4=m6();JF0.B3_DEBUG_FLAG_KEY=(0,oQ4.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Mk=h((YF0)=>{Object.defineProperty(YF0,"__esModule",{value:!0});YF0.X_B3_FLAGS=YF0.X_B3_PARENT_SPAN_ID=YF0.X_B3_SAMPLED=YF0.X_B3_SPAN_ID=YF0.X_B3_TRACE_ID=YF0.B3_CONTEXT_HEADER=void 0;YF0.B3_CONTEXT_HEADER="b3";YF0.X_B3_TRACE_ID="x-b3-traceid";YF0.X_B3_SPAN_ID="x-b3-spanid";YF0.X_B3_SAMPLED="x-b3-sampled";YF0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";YF0.X_B3_FLAGS="x-b3-flags"});var KF0=h((qF0)=>{Object.defineProperty(qF0,"__esModule",{value:!0});qF0.B3MultiPropagator=void 0;var y$=m6(),QY4=K8(),GF0=mZ1(),LX=Mk(),YY4=new Set([!0,"true","True","1",1]),XY4=new Set([!1,"false","False","0",0]);function GY4(J){return J===y$.TraceFlags.SAMPLED||J===y$.TraceFlags.NONE}function ZY4(J){return Array.isArray(J)?J[0]:J}function ll(J,Q,Y){let X=Q.get(J,Y);return ZY4(X)}function $Y4(J,Q){let Y=ll(J,Q,LX.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function qY4(J,Q){let Y=ll(J,Q,LX.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function ZF0(J,Q){return ll(J,Q,LX.X_B3_FLAGS)==="1"?"1":void 0}function VY4(J,Q){let Y=ll(J,Q,LX.X_B3_SAMPLED);if(ZF0(J,Q)==="1"||YY4.has(Y))return y$.TraceFlags.SAMPLED;if(Y===void 0||XY4.has(Y))return y$.TraceFlags.NONE;return}class $F0{inject(J,Q,Y){let X=y$.trace.getSpanContext(J);if(!X||!(0,y$.isSpanContextValid)(X)||(0,QY4.isTracingSuppressed)(J))return;let G=J.getValue(GF0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,LX.X_B3_TRACE_ID,X.traceId),Y.set(Q,LX.X_B3_SPAN_ID,X.spanId),G==="1")Y.set(Q,LX.X_B3_FLAGS,G);else if(X.traceFlags!==void 0)Y.set(Q,LX.X_B3_SAMPLED,(y$.TraceFlags.SAMPLED&X.traceFlags)===y$.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let X=$Y4(Q,Y),G=qY4(Q,Y),Z=VY4(Q,Y),q=ZF0(Q,Y);if((0,y$.isValidTraceId)(X)&&(0,y$.isValidSpanId)(G)&&GY4(Z))return J=J.setValue(GF0.B3_DEBUG_FLAG_KEY,q),y$.trace.setSpanContext(J,{traceId:X,spanId:G,isRemote:!0,traceFlags:Z});return J}fields(){return[LX.X_B3_TRACE_ID,LX.X_B3_SPAN_ID,LX.X_B3_FLAGS,LX.X_B3_SAMPLED,LX.X_B3_PARENT_SPAN_ID]}}qF0.B3MultiPropagator=$F0});var UF0=h((zF0)=>{Object.defineProperty(zF0,"__esModule",{value:!0});zF0.B3SinglePropagator=void 0;var $M=m6(),KY4=K8(),WF0=mZ1(),uZ1=Mk(),WY4=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,HY4="0".repeat(16),zY4=new Set(["d","1"]),FY4="d";function UY4(J){return J.length===32?J:`${HY4}${J}`}function BY4(J){if(J&&zY4.has(J))return $M.TraceFlags.SAMPLED;return $M.TraceFlags.NONE}class HF0{inject(J,Q,Y){let X=$M.trace.getSpanContext(J);if(!X||!(0,$M.isSpanContextValid)(X)||(0,KY4.isTracingSuppressed)(J))return;let G=J.getValue(WF0.B3_DEBUG_FLAG_KEY)||X.traceFlags&1,Z=`${X.traceId}-${X.spanId}-${G}`;Y.set(Q,uZ1.B3_CONTEXT_HEADER,Z)}extract(J,Q,Y){let X=Y.get(Q,uZ1.B3_CONTEXT_HEADER),G=Array.isArray(X)?X[0]:X;if(typeof G!=="string")return J;let Z=G.match(WY4);if(!Z)return J;let[,q,V,K]=Z,W=UY4(q);if(!(0,$M.isValidTraceId)(W)||!(0,$M.isValidSpanId)(V))return J;let H=BY4(K);if(K===FY4)J=J.setValue(WF0.B3_DEBUG_FLAG_KEY,K);return $M.trace.setSpanContext(J,{traceId:W,spanId:V,isRemote:!0,traceFlags:H})}fields(){return[uZ1.B3_CONTEXT_HEADER]}}zF0.B3SinglePropagator=HF0});var dZ1=h((BF0)=>{Object.defineProperty(BF0,"__esModule",{value:!0});BF0.B3InjectEncoding=void 0;var NY4;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(NY4=BF0.B3InjectEncoding||(BF0.B3InjectEncoding={}))});var LF0=h((DF0)=>{Object.defineProperty(DF0,"__esModule",{value:!0});DF0.B3Propagator=void 0;var DY4=K8(),MY4=KF0(),LY4=UF0(),AY4=Mk(),OY4=dZ1();class NF0{_b3MultiPropagator=new MY4.B3MultiPropagator;_b3SinglePropagator=new LY4.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===OY4.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,DY4.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let X=Y.get(Q,AY4.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}}DF0.B3Propagator=NF0});var AF0=h((SV)=>{Object.defineProperty(SV,"__esModule",{value:!0});SV.B3InjectEncoding=SV.X_B3_TRACE_ID=SV.X_B3_SPAN_ID=SV.X_B3_SAMPLED=SV.X_B3_PARENT_SPAN_ID=SV.X_B3_FLAGS=SV.B3_CONTEXT_HEADER=SV.B3Propagator=void 0;var wY4=LF0();Object.defineProperty(SV,"B3Propagator",{enumerable:!0,get:function(){return wY4.B3Propagator}});var SE=Mk();Object.defineProperty(SV,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return SE.B3_CONTEXT_HEADER}});Object.defineProperty(SV,"X_B3_FLAGS",{enumerable:!0,get:function(){return SE.X_B3_FLAGS}});Object.defineProperty(SV,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return SE.X_B3_PARENT_SPAN_ID}});Object.defineProperty(SV,"X_B3_SAMPLED",{enumerable:!0,get:function(){return SE.X_B3_SAMPLED}});Object.defineProperty(SV,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return SE.X_B3_SPAN_ID}});Object.defineProperty(SV,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return SE.X_B3_TRACE_ID}});var EY4=dZ1();Object.defineProperty(SV,"B3InjectEncoding",{enumerable:!0,get:function(){return EY4.B3InjectEncoding}})});var PF0=h((wF0)=>{Object.defineProperty(wF0,"__esModule",{value:!0});wF0.JaegerPropagator=wF0.UBER_BAGGAGE_HEADER_PREFIX=wF0.UBER_TRACE_ID_HEADER=void 0;var qM=m6(),PY4=K8();wF0.UBER_TRACE_ID_HEADER="uber-trace-id";wF0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class OF0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=wF0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||wF0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||wF0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let X=qM.trace.getSpanContext(J),G=qM.propagation.getBaggage(J);if(X&&(0,PY4.isTracingSuppressed)(J)===!1){let Z=`0${(X.traceFlags||qM.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=TY4(G);if(K)q=qM.trace.setSpanContext(q,K)}if(Z.length===0)return q;let V=qM.propagation.getBaggage(J)??qM.propagation.createBaggage();for(let K of Z){if(K.value===void 0)continue;V=V.setEntry(K.key,{value:decodeURIComponent(K.value)})}return q=qM.propagation.setBaggage(q,V),q}fields(){return[this._jaegerTraceHeader]}}wF0.JaegerPropagator=OF0;var RY4=/^[0-9a-f]{1,2}$/i;function TY4(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=RY4.test(G)?parseInt(G,16)&1:1;return{traceId:Z,spanId:q,isRemote:!0,traceFlags:V}}});var RF0=h((Lk)=>{Object.defineProperty(Lk,"__esModule",{value:!0});Lk.UBER_TRACE_ID_HEADER=Lk.UBER_BAGGAGE_HEADER_PREFIX=Lk.JaegerPropagator=void 0;var lZ1=PF0();Object.defineProperty(Lk,"JaegerPropagator",{enumerable:!0,get:function(){return lZ1.JaegerPropagator}});Object.defineProperty(Lk,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return lZ1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(Lk,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return lZ1.UBER_TRACE_ID_HEADER}})});var kF0=h((SF0)=>{Object.defineProperty(SF0,"__esModule",{value:!0});SF0.setupPropagator=SF0.setupContextManager=SF0.getPropagatorFromEnv=SF0.getSpanProcessorsFromEnv=SF0.getOtlpProtocolFromEnv=SF0.filterBlanksAndNulls=SF0.getResourceDetectorsFromEnv=void 0;var rG=m6(),x$=K8(),TF0=Dz0(),jY4=Pz0(),SY4=_z0(),_Y4=ez0(),Ak=vD(),il=pD(),iZ1=AF0(),kY4=RF0(),yY4=fp(),xY4="env",vY4="host",fY4="os",hY4="process",bY4="serviceinstance";function gY4(){let J=new Map([[xY4,Ak.envDetector],[vY4,Ak.hostDetector],[fY4,Ak.osDetector],[bY4,Ak.serviceInstanceIdDetector],[hY4,Ak.processDetector]]),Q=(0,x$.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)rG.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return X||[]})}SF0.getResourceDetectorsFromEnv=gY4;function CF0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}SF0.filterBlanksAndNulls=CF0;function jF0(){return(0,x$.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,x$.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}SF0.getOtlpProtocolFromEnv=jF0;function mY4(){let J=jF0();switch(J){case"grpc":return new SY4.OTLPTraceExporter;case"http/json":return new jY4.OTLPTraceExporter;case"http/protobuf":return new TF0.OTLPTraceExporter;default:return rG.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new TF0.OTLPTraceExporter}}function uY4(){let J=new Map([["otlp",()=>mY4()],["zipkin",()=>new _Y4.ZipkinExporter],["console",()=>new il.ConsoleSpanExporter]]),Q=[],Y=[],X=CF0(Array.from(new Set((0,x$.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(X[0]==="none")return rG.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(X.length===0)rG.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),X=["otlp"];else if(X.length>1&&X.includes("none"))rG.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 rG.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${G}.`)}for(let G of Q)if(G instanceof il.ConsoleSpanExporter)Y.push(new il.SimpleSpanProcessor(G));else Y.push(new il.BatchSpanProcessor(G));if(Q.length===0)rG.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}SF0.getSpanProcessorsFromEnv=uY4;function pY4(){let J=(0,x$.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new x$.W3CTraceContextPropagator],["baggage",()=>new x$.W3CBaggagePropagator],["b3",()=>new iZ1.B3Propagator],["b3multi",()=>new iZ1.B3Propagator({injectEncoding:iZ1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new kY4.JaegerPropagator]]),Y=Array.from(new Set(J)),G=Y.map((Z)=>{let q=Q.get(Z)?.();if(!q){rG.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 x$.CompositePropagator({propagators:G})}SF0.getPropagatorFromEnv=pY4;function dY4(J){if(J===null)return;if(J===void 0){let Q=new yY4.AsyncLocalStorageContextManager;Q.enable(),rG.context.setGlobalContextManager(Q);return}J.enable(),rG.context.setGlobalContextManager(J)}SF0.setupContextManager=dY4;function cY4(J){if(J===null)return;if(J===void 0){rG.propagation.setGlobalPropagator(new x$.CompositePropagator({propagators:[new x$.W3CTraceContextPropagator,new x$.W3CBaggagePropagator]}));return}rG.propagation.setGlobalPropagator(J)}SF0.setupPropagator=cY4});var bF0=h((fF0)=>{Object.defineProperty(fF0,"__esModule",{value:!0});fF0.NodeSDK=void 0;var eJ=m6(),sY4=M_(),tY4=VY0(),_E=vD(),Ok=hQ1(),eY4=fX0(),JX4=AH0(),nZ1=CH0(),QX4=iH0(),yF0=Jz0(),YX4=bl(),XX4=Kz0(),VM=gD(),GX4=pD(),ZX4=oQ1(),$X4=NF(),gF=K8(),wk=kF0();function xF0(J,Q){return parseInt(process.env[J]||"")||Q}function qX4(){let J=[],Q=(0,gF.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)eJ.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return eJ.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=xF0("OTEL_METRIC_EXPORT_INTERVAL",60000),Z=xF0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(X){case"grpc":J.push(new VM.PeriodicExportingMetricReader({exporter:new QX4.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/json":J.push(new VM.PeriodicExportingMetricReader({exporter:new YX4.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/protobuf":J.push(new VM.PeriodicExportingMetricReader({exporter:new yF0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;default:eJ.diag.warn(`Unsupported OTLP metrics protocol: "${X}". Using http/protobuf.`),J.push(new VM.PeriodicExportingMetricReader({exporter:new yF0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}))}}else if(Y==="console")J.push(new VM.PeriodicExportingMetricReader({exporter:new VM.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new XX4.PrometheusExporter);else eJ.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class vF0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,gF.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,gF.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)eJ.diag.setLogger(new eJ.DiagConsoleLogger,{logLevel:(0,gF.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,_E.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,gF.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,wk.getResourceDetectorsFromEnv)();else this._resourceDetectors=[_E.envDetector,_E.processDetector,_E.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)eJ.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let X=J.spanProcessor??new GX4.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]},eJ.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],eJ.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,tY4.registerInstrumentations)({instrumentations:this._instrumentations}),(0,wk.setupContextManager)(this._configuration?.contextManager),(0,wk.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,wk.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,_E.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,_E.resourceFromAttributes)({[$X4.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,wk.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new ZX4.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),eJ.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new Ok.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,sY4.logs.setGlobalLoggerProvider(Y)}let Q=qX4();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 VM.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=X,eJ.metrics.setGlobalMeterProvider(X);for(let G of this._instrumentations)G.setMeterProvider(eJ.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,gF.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)eJ.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){eJ.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,gF.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,gF.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(X){case"grpc":Q.push(new JX4.OTLPLogExporter);break;case"http/json":Q.push(new eY4.OTLPLogExporter);break;case"http/protobuf":Q.push(new nZ1.OTLPLogExporter);break;case void 0:case"":Q.push(new nZ1.OTLPLogExporter);break;default:eJ.diag.warn(`Unsupported OTLP logs protocol: "${X}". Using http/protobuf.`),Q.push(new nZ1.OTLPLogExporter)}}else if(Y==="console")Q.push(new Ok.ConsoleLogRecordExporter);else eJ.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 Ok.ConsoleLogRecordExporter)return new Ok.SimpleLogRecordProcessor(Y);else return new Ok.BatchLogRecordProcessor(Y)})}}}fF0.NodeSDK=vF0});var gF0=h((aZ1)=>{Object.defineProperty(aZ1,"__esModule",{value:!0});aZ1.NodeSDK=aZ1.tracing=aZ1.resources=aZ1.node=aZ1.metrics=aZ1.logs=aZ1.core=aZ1.contextBase=aZ1.api=void 0;aZ1.api=m6();aZ1.contextBase=m6();aZ1.core=K8();aZ1.logs=hQ1();aZ1.metrics=gD();aZ1.node=oQ1();aZ1.resources=vD();aZ1.tracing=pD();var VX4=bF0();Object.defineProperty(aZ1,"NodeSDK",{enumerable:!0,get:function(){return VX4.NodeSDK}})});import MX4 from"os";import nl from"path";var mF,KM,uF,pF,mF0,fp8,hp8,LX4,AX4;var kE=N1(()=>{mF=MX4.homedir(),{env:KM}=process,uF=KM.XDG_DATA_HOME||(mF?nl.join(mF,".local","share"):void 0),pF=KM.XDG_CONFIG_HOME||(mF?nl.join(mF,".config"):void 0),mF0=KM.XDG_STATE_HOME||(mF?nl.join(mF,".local","state"):void 0),fp8=KM.XDG_CACHE_HOME||(mF?nl.join(mF,".cache"):void 0),hp8=KM.XDG_RUNTIME_DIR||void 0,LX4=(KM.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(uF)LX4.unshift(uF);AX4=(KM.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(pF)AX4.unshift(pF)});import{homedir as al}from"node:os";import WM from"node:path";var uF0,OX4,pF0,wX4,ol,EX4,yE,_V,pp8;var eW=N1(()=>{kE();uF0=WM.join(al(),".local/share"),OX4=process.platform==="win32"||process.platform==="darwin"?uF0:uF??uF0,pF0=WM.join(al(),".config"),wX4=process.platform==="win32"||process.platform==="darwin"?pF0:pF??pF0,ol=WM.join(OX4,"amp"),EX4=WM.join(wX4,"amp"),yE=WM.join(EX4,"tools"),_V=WM.join(al(),".cache","amp"),pp8=WM.join(al(),".cache","amp","http-debug-logs")});function PX4(){return IX4}function dF0(J){let Q=HM;return HM=J,Q}class kV{baseLogger;scope;context={};constructor(J=cF0){this.baseLogger=J}with(J){let Q=new kV(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new kV(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=oZ1.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 oZ1,IX4=!1,RX4,HM,cF0,v;var N0=N1(()=>{oZ1=D6(m6(),1);RX4={error:(J,...Q)=>console.error(J,...Q),warn:(J,...Q)=>console.warn(J,...Q),info:(J,...Q)=>console.info(J,...Q),debug:(J,...Q)=>{if(PX4())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=oZ1.trace.getActiveSpan();if(X){let G=X.spanContext();if(G.traceId)Y.traceId=G.traceId,Y.spanId=G.spanId}console.info(J,Y)}},HM=RX4;cF0={error:(J,...Q)=>HM.error(J,...Q),warn:(J,...Q)=>HM.warn(J,...Q),info:(J,...Q)=>HM.info(J,...Q),debug:(J,...Q)=>HM.debug(J,...Q),audit:(J,...Q)=>HM.audit(J,...Q)};v=cF0});function sF0(){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 tF0(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&&!xX4.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!vX4.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(fX4.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 hX4(J,Q){if(!J&&!Q)return"file";return J}function bX4(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=v$;else if(Q[0]!==v$)Q=v$+Q;break}return Q}class u0{static isUri(J){if(J instanceof u0)return!0;if(!J)return!1;let Q=J;return typeof Q.authority==="string"&&typeof Q.fragment==="string"&&typeof Q.path==="string"&&typeof Q.query==="string"&&typeof Q.scheme==="string"&&typeof Q.fsPath==="string"&&typeof Q.with==="function"&&typeof Q.toString==="function"}scheme;authority;path;query;fragment;platform;constructor(J,Q,Y,X,G,Z=!1,q){if(typeof J==="object")this.scheme=J.scheme||p5,this.authority=J.authority||p5,this.path=J.path||p5,this.query=J.query||p5,this.fragment=J.fragment||p5,this.platform=J.platform;else this.scheme=hX4(J,Z),this.authority=Q||p5,this.path=bX4(this.scheme,Y||p5),this.query=X||p5,this.fragment=G||p5,this.platform=q,tF0(this,Z)}get fsPath(){return XU0(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=p5;if(Y===void 0)Y=this.authority;else if(Y===null)Y=p5;if(X===void 0)X=this.path;else if(X===null)X=p5;if(G===void 0)G=this.query;else if(G===null)G=p5;if(Z===void 0)Z=this.fragment;else if(Z===null)Z=p5;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 zM(Q,Y,X,G,Z,!1,q)}static parse(J,Q=!1){let Y=gX4.exec(J);if(!Y)return new zM(p5,p5,p5,p5,p5);return new zM(Y[2]||p5,sl(Y[4]||p5),sl(Y[5]||p5),sl(Y[7]||p5),sl(Y[9]||p5),Q)}static file(J,Q=sF0()){let Y=p5;if(Q==="windows")J=J.replace(/\\/g,v$);if(J[0]===v$&&J[1]===v$){let X=J.indexOf(v$,2);if(X===-1)Y=J.substring(2),J=v$;else Y=J.substring(2,X),J=J.substring(X)||v$}return new zM("file",Y,J,p5,p5,!1,Q)}static from(J){let Q=new zM(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return tF0(Q,!0),Q}toString(J=!1){return sZ1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof u0)return J;let Q=new zM(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===QU0(Q.platform)?Y.fsPath:null,Q}}function QU0(J){return J==="windows"?1:void 0}function eF0(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=YU0[Z];if(q!==void 0)X+=q;else X+=encodeURIComponent(J.charAt(G))}}return X!==void 0?X:J}function mX4(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+=YU0[X]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function XU0(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 sZ1(J,Q){let Y=!Q?eF0:mX4,X="",{scheme:G,authority:Z,path:q,query:V,fragment:K}=J;if(G)X+=G,X+=":";if(Z||G==="file")X+=v$,X+=v$;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?eF0(K,!1,!1):K;return X}function GU0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+GU0(J.substring(3));else return J}}function sl(J){if(!J.match(JU0))return J;return J.replace(JU0,(Q)=>GU0(Q))}function dF(J){return J.scheme==="file"}function JQ(J){return u0.parse(J)}function T6(J){return J.toString()}function d4(J){if(typeof J==="string"||J instanceof URL)return u0.parse(J.toString());return J}function Ik(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var xX4,vX4,fX4,p5="",v$="/",gX4,zM,YU0,JU0;var Pk=N1(()=>{xX4=/^\w[\w\d+.-]*$/,vX4=/^\//,fX4=/^\/\//;gX4=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;zM=class zM extends u0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=XU0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=sZ1(this,!1);return this._formatted}return sZ1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=QU0(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}};YU0={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"};JU0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function tZ1(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 FM(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function vE(...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 ZU0(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 tl(J){let Q=FM(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function VJ(J){try{if(J=d4(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var fE=N1(()=>{Pk()});function uX4(J,...Q){return J=d4(J),J.with({path:vE(J.path,...Q)})}function pX4(J,...Q){let Y=J.path,X=!1;if(Y[0]!==el)Y=el+Y,X=!0;let G=Y;for(let Z of Q)if(Z.startsWith("/"))G=vE(Z);else G=vE(G,Z);if(G!=="/"&&G.endsWith("/"))G=G.replace(/\/+$/,"");if(X&&G[0]===el&&!J.authority)G=G.substring(1);return J.with({path:G})}function dX4(J){if(J=d4(J),J.path.length===0||J.path===el)return J;let Q=tZ1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function cX4(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 lX4(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 ZU0(J.path,Q.path,Y,Y)}function iX4(J,Q){let Y=T6(J),X=T6(Q);if(Y.startsWith("file:///")&&X.startsWith("file:///"))return $U0(Y)===$U0(X);return Y===X}function $U0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var el="/",o0;var Ji=N1(()=>{fE();Pk();o0={joinPath:uX4,resolvePath:pX4,dirname:dX4,basename:(J)=>FM(d4(J).path),extname:(J)=>tl(d4(J).path),hasPrefix:cX4,relativePath:lX4,equalURIs:iX4}});function Qi(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function qU0(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 Q$1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function aX4(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(VU0(J,Y.type,Y.value),J._state==="closed")break}function VU0(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(Q$1(J),X&&typeof X.error==="function")X.error(Y);else throw Y;break;case"complete":if(Q$1(J),X&&typeof X.complete==="function")X.complete();break}}catch(G){console.error("notifySubscription",G)}if(J._state==="closed")qU0(J);else if(J._state==="running")J._state="ready"}function J$1(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}],Qi(()=>aX4(J));return}VU0(J,Q,Y)}class KU0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new WU0(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")Q$1(this),qU0(this)}}class WU0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){J$1(this._subscription,"next",J)}error(J){J$1(this._subscription,"error",J)}complete(){J$1(this._subscription,"complete")}}function d5(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class hE{_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 Y$1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function X$1(J){if(Y$1(J))return J;return X0.of(J)}var X0;var bE=N1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");X0=class X0{_subscriber;constructor(J){if(!(this instanceof X0))throw TypeError("Observable cannot be called as a function");if(typeof J!=="function")throw TypeError("Observable initializer must be a function");this._subscriber=J}subscribe(J,Q,Y){if(typeof J!=="object"||J===null)J={next:J,error:Q,complete:Y};return new KU0(J,this._subscriber)}pipe(J,...Q){let Y=this;for(let X of[J,...Q])Y=X(Y);return Y}[Symbol.observable](){return this}static from(J){let Q=typeof this==="function"?this:X0;if(J==null)throw TypeError(J+" is not an object");let Y=J[Symbol.observable];if(typeof Y==="function"){let G=Y.call(J);if(Object(G)!==G)throw TypeError(G+" is not an object");if(G instanceof X0)return G;return new Q((Z)=>G.subscribe(Z))}let X=J[Symbol.iterator];if(typeof X==="function")return new Q((G)=>{Qi(()=>{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)=>{Qi(()=>{if(G.closed)return;for(let Z of J)if(G.next(Z),G.closed)return;G.complete()})});throw TypeError(J+" is not observable")}static of(...J){return new(typeof this==="function"?this:X0)((Y)=>{Qi(()=>{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 c4,M5;var Yi=N1(()=>{bE();c4=class c4 extends X0{_observers=new Set;constructor(){super((J)=>{return this._observers.add(J),()=>this._observers.delete(J)})}next(J){for(let Q of this._observers)Q.next(J)}error(J){for(let Q of this._observers)Q.error(J)}complete(){for(let J of this._observers)J.complete()}};M5=class M5 extends c4{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 G$1,Rk;var HU0=N1(()=>{bE();Yi();G$1=class G$1 extends Set{subject=new M5(this);add(J){return super.add(J),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return X0.from(this.subject)}dispose(){this.subject.complete()}};Rk=class Rk extends Map{subject=new M5(this);set(J,Q){return super.set(J,Q),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return X0.from(this.subject)}dispose(){this.subject.complete()}}});function Xi(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)=>Xi(Z,Q[q]));let G=new Set([...Object.keys(J),...Object.keys(Q)]);for(let Z of G)if(!Xi(J[Z],Q[Z]))return!1;return!0}function Z$1(J){return{dispose:J.unsubscribe.bind(J)}}function FU0(...J){return new X0((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}async function N6(J,Q){return new Promise((Y,X)=>{let G=void 0,Z=()=>{G?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",Z,{once:!0}),G=J.subscribe({next:(q)=>{G?.unsubscribe(),Q?.removeEventListener("abort",Z),Y(q)},error:(q)=>{Q?.removeEventListener("abort",Z),X(q)},complete:()=>{Q?.removeEventListener("abort",Z),X("Observable completed without emitting a value")}})})}async function yV(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 UU0(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 i2(J){return new X0((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function s6(J){return new X0((Q)=>{let Y=!1,X=new AbortController,G=X.signal;return(async()=>{try{G?.throwIfAborted();let q=await J(G);if(G?.throwIfAborted(),!Y)Q.next(q),Q.complete()}catch(q){if(!Y)if(G.aborted)Q.complete();else Q.error(q)}})(),()=>{Y=!0,X.abort()}})}function q6(J){return(Q)=>{return new X0((Y)=>{let X=new hE(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()=>d5(Z)})}}function Gi(J){return new X0((Q)=>{let Y=0,X=setInterval(()=>{Q.next(Y++)},J);return()=>clearInterval(X)})}function JH(...J){return new X0((Q)=>{let Y=0,X=J.map((G)=>G.subscribe({next:(Z)=>Q.next(Z),error:(Z)=>Q.error(Z),complete:()=>{if(Y++,Y===J.length)Q.complete()}}));return()=>{BU0(X)}})}function c8(...J){if(J.length===0)return Tk;return new X0((Q)=>{let Y=Array(J.length),X=Array(J.length).fill(0),G=Array(J.length).fill(!1),Z=0,q=[],V=new hE(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()=>{BU0(q)}})}function S8(J){let Y=J?.shouldCountRefs??!0,X=oX4++,G=(Z,...q)=>{};return(Z)=>{let q=new c4,V=null,K=!1,W,H=0;return new X0((z)=>{if(H++,K)G("new subscriber, emitting buffered value",W),z.next(W);else G("new subscriber, no buffered value to emit");if(!V)V=Z.subscribe({next:(N)=>{K=!0,W=N,q.next(N)},error:(N)=>q.error(N),complete:()=>q.complete()});let U=q.subscribe(z);return()=>{if(H--,U.unsubscribe(),Y&&H===0){if(V)d5(V),V=null;K=!1}}})}}function BU0(J){for(let Q of J)if(Q)d5(Q)}function cF(J){return(Q)=>{return new X0((Y)=>{let X=Q.subscribe({next:(Z)=>Y.next(Z),error:(Z)=>Y.error(Z),complete:()=>Y.complete()}),G=J.subscribe({next:()=>{Y.complete(),X.unsubscribe(),G.unsubscribe()},error:(Z)=>{Y.error(Z),X.unsubscribe()}});return()=>{X.unsubscribe(),G.unsubscribe()}})}}function f$(J){return(Q)=>{return new X0((Y)=>{let X,G=Q.subscribe({next(Z){X=Z,Y.next(Z)},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{d5(G),J(X)}})}}function j4(J=Xi){return(Q)=>{return new X0((Y)=>{let X=zU0,G=new hE(Y),Z=Q.subscribe({complete(){G.complete()},error(q){G.error(q)},next(q){G.schedule(async(V)=>{if(X===zU0||!J(X,q))X=q,V(q)})}});return()=>d5(Z)})}}function AX(J){return rX4(typeof J==="function"?{next:J}:J)}function rX4(J){return(Q)=>new X0((Y)=>{let X=typeof J==="function"?J():J,G=Q.subscribe({next(Z){if(X.next)try{X.next(Z)}catch(q){Y.error(q);return}Y.next(Z)},error(Z){if(X.error)try{X.error(Z)}catch(q){Y.error(q);return}Y.error(Z)},complete(){if(X.complete)try{X.complete()}catch(Z){Y.error(Z);return}Y.complete()}});return()=>d5(G)})}function lF(J){return(Q)=>{return new X0((Y)=>{let X=!1,G=Q.subscribe({next:(q)=>{X=!0,clearTimeout(Z),Y.next(q)},error:(q)=>{clearTimeout(Z),Y.error(q)},complete:()=>{clearTimeout(Z),Y.complete()}}),Z=setTimeout(()=>{if(!X)G.unsubscribe(),Y.error(new Zi(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(Z),G.unsubscribe()}})}}function l8(J){return(Q)=>new X0((Y)=>{let X;try{Y.next(J),X=Q.subscribe({next(G){Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}})}catch(G){Y.error(G)}return()=>{if(X)d5(X)}})}function iF(J){return(Q)=>new X0((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X<J){if(Y.next(Z),X++,X===J)Y.complete(),d5(G)}},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{d5(G)}})}function NU0(J){return(Q)=>new X0((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X>=J)Y.next(Z);else X++},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{d5(G)}})}function $$1(J){return(Q)=>{return new X0((Y)=>{let X=0,G=new Set,Z=!1,q=()=>{if(Z&&G.size===0)Y.complete()},V=Q.subscribe({next(K){let H=J(K,X++).subscribe({next(z){Y.next(z)},error(z){Y.error(z)},complete(){G.delete(H),q()}});G.add(H)},error(K){Y.error(K)},complete(){Z=!0,q()}});return()=>{d5(V);for(let K of G)if(K)d5(K)}})}}function y4(J){return(Q)=>{return new X0((Y)=>{let X=0,G=null,Z=!1,q=()=>{if(Z&&!G)Y.complete()},V=Q.subscribe({next(K){if(G)d5(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(d5(V),G)d5(G)}})}}function h$(J){return(Q)=>new X0((Y)=>{let X=null,G=null,Z=!1,q=Q.subscribe({next:(V)=>{if(G=V,Z=!0,X===null)X=setTimeout(()=>{if(Z)Y.next(G),Z=!1;X=null},J)},error:(V)=>Y.error(V),complete:()=>{if(X!==null)clearTimeout(X);if(Z)Y.next(G);Y.complete()}});return()=>{if(d5(q),X!==null)clearTimeout(X)}})}function Ck(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Y)=>new X0((X)=>{let G=0,Z=null,q=null,V=!1,K=Y.subscribe({next:(W)=>{let H=Date.now();if(q=W,V=!0,H-G>=J)X.next(W),G=H,V=!1;else if(Z===null)Z=setTimeout(()=>{if(V)X.next(q),G=Date.now(),V=!1;Z=null},J-(H-G));if(G===0)X.next(W),G=H,V=!1},error:(W)=>X.error(W),complete:()=>{if(Z!==null)clearTimeout(Z);if(V)X.next(q);X.complete()}});return()=>{if(d5(K),Z!==null)clearTimeout(Z)}})}function UM(...J){return new X0((Q)=>{let Y=0,X=null;function G(){if(Y>=J.length){Q.complete();return}X=J[Y].subscribe({next:(q)=>Q.next(q),error:(q)=>Q.error(q),complete:()=>{Y++,G()}})}return G(),()=>{if(X)d5(X)}})}function OX(J){return(Q)=>new X0((Y)=>{let X=0,G=!1,Z=null,q=Q.subscribe({next(V){try{let K=J(V,X++);if(Z)d5(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(d5(q),Z)d5(Z)}})}function jk({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new X0((X)=>{J?.();let G=Y.subscribe(X);return()=>{d5(G),Q?.()}})}function nF(J){return(Q)=>X0.from(Q).pipe(y4((Y)=>s6((X)=>J(Y,X))))}function a7(J){return(Q)=>new X0((Y)=>{let X,G=Q.subscribe({next(Z){Y.next(Z)},error(Z){try{X=J(Z).subscribe({next(V){Y.next(V)},error(V){Y.error(V)},complete(){Y.complete()}})}catch(q){Y.error(q)}},complete(){Y.complete()}});return()=>{if(d5(G),X)d5(X)}})}function A7(J){return(Q)=>{return new X0((Y)=>{let X=Q.subscribe({next(G){if(J(G))Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>d5(X)})}}function DU0(J,Q){return(Y)=>{return new X0((X)=>{let G,Z=0,q=new hE(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()=>d5(V)})}}var Tk,sG,Dd8,oX4=0,zU0,Zi;var q$1=N1(()=>{bE();Yi();Tk=new X0((J)=>{J.complete()}),sG=new X0(()=>{});Dd8=Symbol("noInitialValue");zU0={};Zi=class Zi extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function $i(J,Q){return(Y)=>{return X0.from(Y).pipe(y4((X)=>X===xV?X0.of(xV):J(X).pipe(a7((G)=>X0.of(G instanceof Error?G:Error(G))),l8(xV))),S8(Q))}}function sX4(){return(J)=>X0.from(J).pipe(A7((Q)=>Q!==xV))}async function MU0(J,Q){let Y=await N6(X0.from(J).pipe(sX4()),Q);if(Y instanceof Error)throw Y;return Y}var xV;var LU0=N1(()=>{bE();q$1();xV=Symbol.for("@@pendingOperation")});var s0=N1(()=>{HU0();bE();LU0();q$1();Yi()});var Q4=N1(()=>{Pk();Ji();fE()});import{promises as tX4}from"node:fs";import*as BM from"node:path";async function AU0(J){try{let Q=await tX4.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 OU0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=BM.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function wU0(J){return BM.extname(J).toLowerCase()===".md"}function EU0(J){let Q=J.replace(/\\/g,"/"),Y=BM.basename(Q);return BM.basename(Y,BM.extname(Y))}function IU0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var PU0=()=>{};var jU0={};J9(jU0,{CommandDiscovery:()=>CU0});import*as TU0 from"node:fs";import{promises as qi}from"node:fs";import{homedir as RU0}from"node:os";import*as wX from"node:path";function K$1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class CU0{config;workspaceRoots;watchFactory;debounceMs;changes=new c4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??eX4,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(v.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return v.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=o0.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=u0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await K$1(qi.access(Y),V$1,"directory access")}catch{return[]}let G=(await K$1(qi.readdir(Y,{withFileTypes:!0}),V$1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=wX.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return v.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return v.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 qi.stat(J),X=wX.basename(J);if(this.ignoreCommandName(X))return null;let G=EU0(X);if(!IU0(G))return v.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(wU0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return v.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:wX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=wX.basename(J),Z=OU0(Q.mode,G),q=await AU0(J),V=wX.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return v.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:wX.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 wX.join(RU0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=pF||wX.join(RU0(),".config");return wX.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=o0.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 K$1(qi.access(J),V$1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{v.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{v.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),v.debug("Started watching command directory",{directory:J})}catch(Q){v.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){v.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());v.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){v.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),v.debug("Stopped watching command directory",{directory:J})}catch(Y){v.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){v.warn("Error during command discovery cleanup",{error:J})}}}var V$1=5000,eX4=(J,Q)=>TU0.watch(J,Q);var SU0=N1(()=>{Q4();s0();kE();N0();PU0()});function c9(J,Q,Y=Q+"s"){return J===1?Q:Y}function aF(J){let Q=typeof J==="string"?J:J.toString();return Q===RY||Q===RY.slice(0,-1)}function uE(J){return aF(J)?RY:J}var MG4,RY,LG4,wc8;var oF=N1(()=>{MG4=new URL("https://ampcode.com/"),RY=MG4.toString(),LG4=new URL("https://api.anthropic.com/"),wc8=LG4.toString()});var M9,O$1,x6,vV=(J)=>{switch(typeof J){case"undefined":return x6.undefined;case"string":return x6.string;case"number":return Number.isNaN(J)?x6.nan:x6.number;case"boolean":return x6.boolean;case"function":return x6.function;case"bigint":return x6.bigint;case"symbol":return x6.symbol;case"object":if(Array.isArray(J))return x6.array;if(J===null)return x6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return x6.promise;if(typeof Map<"u"&&J instanceof Map)return x6.map;if(typeof Set<"u"&&J instanceof Set)return x6.set;if(typeof Date<"u"&&J instanceof Date)return x6.date;return x6.object;default:return x6.unknown}};var xk=N1(()=>{(function(J){J.assertEqual=(G)=>{};function Q(G){}J.assertIs=Q;function Y(G){throw Error()}J.assertNever=Y,J.arrayToEnum=(G)=>{let Z={};for(let q of G)Z[q]=q;return Z},J.getValidEnumValues=(G)=>{let Z=J.objectKeys(G).filter((V)=>typeof G[G[V]]!=="number"),q={};for(let V of Z)q[V]=G[V];return J.objectValues(q)},J.objectValues=(G)=>{return J.objectKeys(G).map(function(Z){return G[Z]})},J.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let Z=[];for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q))Z.push(q);return Z},J.find=(G,Z)=>{for(let q of G)if(Z(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function X(G,Z=" | "){return G.map((q)=>typeof q==="string"?`'${q}'`:q).join(Z)}J.joinValues=X,J.jsonStringifyReplacer=(G,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(M9||(M9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(O$1||(O$1={}));x6=M9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var F6,AG4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},TY;var zi=N1(()=>{xk();F6=M9.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"]);TY=class TY 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 TY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M9.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()}};TY.create=(J)=>{return new TY(J)}});var OG4=(J,Q)=>{let Y;switch(J.code){case F6.invalid_type:if(J.received===x6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case F6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,M9.jsonStringifyReplacer)}`;break;case F6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${M9.joinValues(J.keys,", ")}`;break;case F6.invalid_union:Y="Invalid input";break;case F6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${M9.joinValues(J.options)}`;break;case F6.invalid_enum_value:Y=`Invalid enum value. Expected ${M9.joinValues(J.options)}, received '${J.received}'`;break;case F6.invalid_arguments:Y="Invalid function arguments";break;case F6.invalid_return_type:Y="Invalid function return type";break;case F6.invalid_date:Y="Invalid date";break;case F6.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 M9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case F6.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 F6.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 F6.custom:Y="Invalid input";break;case F6.invalid_intersection_types:Y="Intersection results could not be merged";break;case F6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case F6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,M9.assertNever(J)}return{message:Y}},YH;var w$1=N1(()=>{zi();xk();YH=OG4});function wG4(J){mU0=J}function pE(){return mU0}var mU0;var Fi=N1(()=>{w$1();mU0=YH});function r6(J,Q){let Y=pE(),X=vk({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===YH?void 0:YH].filter((G)=>!!G)});J.common.issues.push(X)}class KJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Y=[];for(let X of Q){if(X.status==="aborted")return t4;if(X.status==="dirty")J.dirty();Y.push(X.value)}return{status:J.value,value:Y}}static async mergeObjectAsync(J,Q){let Y=[];for(let X of Q){let G=await X.key,Z=await X.value;Y.push({key:G,value:Z})}return KJ.mergeObjectSync(J,Y)}static mergeObjectSync(J,Q){let Y={};for(let X of Q){let{key:G,value:Z}=X;if(G.status==="aborted")return t4;if(Z.status==="aborted")return t4;if(G.status==="dirty")J.dirty();if(Z.status==="dirty")J.dirty();if(G.value!=="__proto__"&&(typeof Z.value<"u"||X.alwaysSet))Y[G.value]=Z.value}return{status:J.value,value:Y}}}var vk=(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}},EG4,t4,DM=(J)=>({status:"dirty",value:J}),QQ=(J)=>({status:"valid",value:J}),Ui=(J)=>J.status==="aborted",Bi=(J)=>J.status==="dirty",rF=(J)=>J.status==="valid",dE=(J)=>typeof Promise<"u"&&J instanceof Promise;var E$1=N1(()=>{Fi();w$1();EG4=[];t4=Object.freeze({status:"aborted"})});var uU0=()=>{};var A4;var pU0=N1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(A4||(A4={}))});class p${constructor(J,Q,Y,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Y,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function k8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Y,required_error:X,description:G}=J;if(Q&&(Y||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(q,V)=>{let{message:K}=J;if(q.code==="invalid_enum_value")return{message:K??V.defaultError};if(typeof V.data>"u")return{message:K??X??V.defaultError};if(q.code!=="invalid_type")return{message:V.defaultError};return{message:K??Y??V.defaultError}},description:G}}class Q9{get description(){return this._def.description}_getType(J){return vV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:vV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new KJ,ctx:{common:J.parent.common,data:J.data,parsedType:vV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(dE(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:vV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return dU0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:vV(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:vV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(dE(X)?X:Promise.resolve(X));return dU0(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:F6.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 d$({schema:this,typeName:V8.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 u$.create(this,this._def)}nullable(){return GH.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return m$.create(this)}promise(){return OM.create(this,this._def)}or(J){return oE.create([this,J],this._def)}and(J){return rE.create(this,J,this._def)}transform(J){return new d$({...k8(this._def),schema:this,typeName:V8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new JI({...k8(this._def),innerType:this,defaultValue:Q,typeName:V8.ZodDefault})}brand(){return new Di({typeName:V8.ZodBranded,type:this,...k8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new QI({...k8(this._def),innerType:this,catchValue:Q,typeName:V8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return uk.create(this,J)}readonly(){return YI.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function iU0(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 mG4(J){return new RegExp(`^${iU0(J)}$`)}function nU0(J){let Q=`${lU0}T${iU0(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 uG4(J,Q){if((Q==="v4"||!Q)&&yG4.test(J))return!0;if((Q==="v6"||!Q)&&vG4.test(J))return!0;return!1}function pG4(J,Q){if(!jG4.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 dG4(J,Q){if((Q==="v4"||!Q)&&xG4.test(J))return!0;if((Q==="v6"||!Q)&&fG4.test(J))return!0;return!1}function cG4(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 cE(J){if(J instanceof f7){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=u$.create(cE(X))}return new f7({...J._def,shape:()=>Q})}else if(J instanceof m$)return new m$({...J._def,type:cE(J.element)});else if(J instanceof u$)return u$.create(cE(J.unwrap()));else if(J instanceof GH)return GH.create(cE(J.unwrap()));else if(J instanceof hV)return hV.create(J.items.map((Q)=>cE(Q)));else return J}function P$1(J,Q){let Y=vV(J),X=vV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===x6.object&&X===x6.object){let G=M9.objectKeys(Q),Z=M9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=P$1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===x6.array&&X===x6.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=P$1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===x6.date&&X===x6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function aU0(J,Q){return new JU({values:J,typeName:V8.ZodEnum,...k8(Q)})}function cU0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function oU0(J,Q={},Y){if(J)return LM.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=cU0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=cU0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return LM.create()}var dU0=(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 TY(J.common.issues);return this._error=Y,this._error}}}},IG4,PG4,RG4,TG4,CG4,jG4,SG4,_G4,kG4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",I$1,yG4,xG4,vG4,fG4,hG4,bG4,lU0="((\\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])))",gG4,g$,tF,eF,iE,MM,fk,nE,aE,LM,sF,fV,hk,m$,f7,oE,XH=(J)=>{if(J instanceof sE)return XH(J.schema);else if(J instanceof d$)return XH(J.innerType());else if(J instanceof tE)return[J.value];else if(J instanceof JU)return J.options;else if(J instanceof eE)return M9.objectValues(J.enum);else if(J instanceof JI)return XH(J._def.innerType);else if(J instanceof nE)return[void 0];else if(J instanceof aE)return[null];else if(J instanceof u$)return[void 0,...XH(J.unwrap())];else if(J instanceof GH)return[null,...XH(J.unwrap())];else if(J instanceof Di)return XH(J.unwrap());else if(J instanceof YI)return XH(J.unwrap());else if(J instanceof QI)return XH(J._def.innerType);else return[]},Ni,rE,hV,bk,gk,AM,lE,sE,tE,JU,eE,OM,d$,u$,GH,JI,QI,mk,lG4,Di,uk,YI,iG4,V8,nG4=(J,Q={message:`Input not instance of ${J.name}`})=>oU0((Y)=>Y instanceof J,Q),rU0,sU0,aG4,oG4,tU0,rG4,sG4,tG4,eG4,JZ4,QZ4,YZ4,XZ4,GZ4,ZZ4,$Z4,qZ4,VZ4,KZ4,WZ4,HZ4,zZ4,FZ4,UZ4,BZ4,NZ4,DZ4,MZ4,LZ4,AZ4,OZ4,wZ4,EZ4,IZ4,PZ4=()=>rU0().optional(),RZ4=()=>sU0().optional(),TZ4=()=>tU0().optional(),CZ4,jZ4;var eU0=N1(()=>{zi();Fi();pU0();E$1();xk();IG4=/^c[^\s-]{8,}$/i,PG4=/^[0-9a-z]+$/,RG4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TG4=/^[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,CG4=/^[a-z0-9_-]{21}$/i,jG4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,SG4=/^[-+]?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)?)??$/,_G4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yG4=/^(?:(?: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])$/,xG4=/^(?:(?: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])$/,vG4=/^(([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]))$/,fG4=/^(([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])$/,hG4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bG4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gG4=new RegExp(`^${lU0}$`);g$=class g$ extends Q9{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==x6.string){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_type,expected:x6.string,received:G.parsedType}),t4}let Y=new KJ,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),r6(X,{code:F6.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),r6(X,{code:F6.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)r6(X,{code:F6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)r6(X,{code:F6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!_G4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"email",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!I$1)I$1=new RegExp(kG4,"u");if(!I$1.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"emoji",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!TG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"uuid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!CG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"nanoid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!IG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!PG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid2",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!RG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ulid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),r6(X,{validation:"url",code:F6.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),r6(X,{validation:"regex",code:F6.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),r6(X,{code:F6.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),r6(X,{code:F6.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),r6(X,{code:F6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!nU0(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:F6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!gG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:F6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!mG4(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:F6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!SG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"duration",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!uG4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ip",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!pG4(J.data,G.alg))X=this._getOrReturnCtx(J,X),r6(X,{validation:"jwt",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!dG4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cidr",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!hG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!bG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64url",code:F6.invalid_string,message:G.message}),Y.dirty()}else M9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:F6.invalid_string,...A4.errToObj(Y)})}_addCheck(J){return new g$({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...A4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...A4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...A4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...A4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...A4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...A4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...A4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...A4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...A4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...A4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...A4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...A4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...A4.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,...A4.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,...A4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...A4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...A4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...A4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...A4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...A4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...A4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...A4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...A4.errToObj(Q)})}nonempty(J){return this.min(1,A4.errToObj(J))}trim(){return new g$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new g$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new g$({...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}};g$.create=(J)=>{return new g$({checks:[],typeName:V8.ZodString,coerce:J?.coerce??!1,...k8(J)})};tF=class tF extends Q9{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)!==x6.number){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_type,expected:x6.number,received:G.parsedType}),t4}let Y=void 0,X=new KJ;for(let G of this._def.checks)if(G.kind==="int"){if(!M9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:F6.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),r6(Y,{code:F6.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),r6(Y,{code:F6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(cG4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:F6.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),r6(Y,{code:F6.not_finite,message:G.message}),X.dirty()}else M9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,A4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,A4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,A4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,A4.toString(Q))}setLimit(J,Q,Y,X){return new tF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:A4.toString(X)}]})}_addCheck(J){return new tF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:A4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:A4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:A4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A4.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"&&M9.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)}};tF.create=(J)=>{return new tF({checks:[],typeName:V8.ZodNumber,coerce:J?.coerce||!1,...k8(J)})};eF=class eF extends Q9{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)!==x6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new KJ;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),r6(Y,{code:F6.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),r6(Y,{code:F6.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),r6(Y,{code:F6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else M9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:F6.invalid_type,expected:x6.bigint,received:Q.parsedType}),t4}gte(J,Q){return this.setLimit("min",J,!0,A4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,A4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,A4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,A4.toString(Q))}setLimit(J,Q,Y,X){return new eF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:A4.toString(X)}]})}_addCheck(J){return new eF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:A4.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}};eF.create=(J)=>{return new eF({checks:[],typeName:V8.ZodBigInt,coerce:J?.coerce??!1,...k8(J)})};iE=class iE extends Q9{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==x6.boolean){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.boolean,received:Y.parsedType}),t4}return QQ(J.data)}};iE.create=(J)=>{return new iE({typeName:V8.ZodBoolean,coerce:J?.coerce||!1,...k8(J)})};MM=class MM extends Q9{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==x6.date){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_type,expected:x6.date,received:G.parsedType}),t4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_date}),t4}let Y=new KJ,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),r6(X,{code:F6.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),r6(X,{code:F6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else M9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new MM({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:A4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:A4.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}};MM.create=(J)=>{return new MM({checks:[],coerce:J?.coerce||!1,typeName:V8.ZodDate,...k8(J)})};fk=class fk extends Q9{_parse(J){if(this._getType(J)!==x6.symbol){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.symbol,received:Y.parsedType}),t4}return QQ(J.data)}};fk.create=(J)=>{return new fk({typeName:V8.ZodSymbol,...k8(J)})};nE=class nE extends Q9{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.undefined,received:Y.parsedType}),t4}return QQ(J.data)}};nE.create=(J)=>{return new nE({typeName:V8.ZodUndefined,...k8(J)})};aE=class aE extends Q9{_parse(J){if(this._getType(J)!==x6.null){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.null,received:Y.parsedType}),t4}return QQ(J.data)}};aE.create=(J)=>{return new aE({typeName:V8.ZodNull,...k8(J)})};LM=class LM extends Q9{constructor(){super(...arguments);this._any=!0}_parse(J){return QQ(J.data)}};LM.create=(J)=>{return new LM({typeName:V8.ZodAny,...k8(J)})};sF=class sF extends Q9{constructor(){super(...arguments);this._unknown=!0}_parse(J){return QQ(J.data)}};sF.create=(J)=>{return new sF({typeName:V8.ZodUnknown,...k8(J)})};fV=class fV extends Q9{_parse(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:F6.invalid_type,expected:x6.never,received:Q.parsedType}),t4}};fV.create=(J)=>{return new fV({typeName:V8.ZodNever,...k8(J)})};hk=class hk extends Q9{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.void,received:Y.parsedType}),t4}return QQ(J.data)}};hk.create=(J)=>{return new hk({typeName:V8.ZodVoid,...k8(J)})};m$=class m$ extends Q9{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==x6.array)return r6(Q,{code:F6.invalid_type,expected:x6.array,received:Q.parsedType}),t4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)r6(Q,{code:Z?F6.too_big:F6.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)r6(Q,{code:F6.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)r6(Q,{code:F6.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 p$(Q,Z,Q.path,q))})).then((Z)=>{return KJ.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new p$(Q,Z,Q.path,q))});return KJ.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new m$({...this._def,minLength:{value:J,message:A4.toString(Q)}})}max(J,Q){return new m$({...this._def,maxLength:{value:J,message:A4.toString(Q)}})}length(J,Q){return new m$({...this._def,exactLength:{value:J,message:A4.toString(Q)}})}nonempty(J){return this.min(1,J)}};m$.create=(J,Q)=>{return new m$({type:J,minLength:null,maxLength:null,exactLength:null,typeName:V8.ZodArray,...k8(Q)})};f7=class f7 extends Q9{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=M9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==x6.object){let K=this._getOrReturnCtx(J);return r6(K,{code:F6.invalid_type,expected:x6.object,received:K.parsedType}),t4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof fV&&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 p$(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof fV){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)r6(X,{code:F6.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 p$(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 KJ.mergeObjectSync(Y,K)});else return KJ.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return A4.errToObj,new f7({...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:A4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new f7({...this._def,unknownKeys:"strip"})}passthrough(){return new f7({...this._def,unknownKeys:"passthrough"})}extend(J){return new f7({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new f7({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:V8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new f7({...this._def,catchall:J})}pick(J){let Q={};for(let Y of M9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new f7({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of M9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new f7({...this._def,shape:()=>Q})}deepPartial(){return cE(this)}partial(J){let Q={};for(let Y of M9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new f7({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of M9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof u$)G=G._def.innerType;Q[Y]=G}return new f7({...this._def,shape:()=>Q})}keyof(){return aU0(M9.objectKeys(this.shape))}};f7.create=(J,Q)=>{return new f7({shape:()=>J,unknownKeys:"strip",catchall:fV.create(),typeName:V8.ZodObject,...k8(Q)})};f7.strictCreate=(J,Q)=>{return new f7({shape:()=>J,unknownKeys:"strict",catchall:fV.create(),typeName:V8.ZodObject,...k8(Q)})};f7.lazycreate=(J,Q)=>{return new f7({shape:J,unknownKeys:"strip",catchall:fV.create(),typeName:V8.ZodObject,...k8(Q)})};oE=class oE extends Q9{_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 TY(q.ctx.common.issues));return r6(Q,{code:F6.invalid_union,unionErrors:Z}),t4}if(Q.common.async)return Promise.all(Y.map(async(G)=>{let Z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:Z}),ctx:Z}})).then(X);else{let G=void 0,Z=[];for(let V of Y){let K={...Q,common:{...Q.common,issues:[]},parent:null},W=V._parseSync({data:Q.data,path:Q.path,parent:K});if(W.status==="valid")return W;else if(W.status==="dirty"&&!G)G={result:W,ctx:K};if(K.common.issues.length)Z.push(K.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let q=Z.map((V)=>new TY(V));return r6(Q,{code:F6.invalid_union,unionErrors:q}),t4}}get options(){return this._def.options}};oE.create=(J,Q)=>{return new oE({options:J,typeName:V8.ZodUnion,...k8(Q)})};Ni=class Ni extends Q9{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.object)return r6(Q,{code:F6.invalid_type,expected:x6.object,received:Q.parsedType}),t4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return r6(Q,{code:F6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),t4;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Y){let X=new Map;for(let G of Q){let Z=XH(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 Ni({typeName:V8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...k8(Y)})}};rE=class rE extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(Ui(G)||Ui(Z))return t4;let q=P$1(G.value,Z.value);if(!q.valid)return r6(Y,{code:F6.invalid_intersection_types}),t4;if(Bi(G)||Bi(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}))}};rE.create=(J,Q,Y)=>{return new rE({left:J,right:Q,typeName:V8.ZodIntersection,...k8(Y)})};hV=class hV extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.array)return r6(Y,{code:F6.invalid_type,expected:x6.array,received:Y.parsedType}),t4;if(Y.data.length<this._def.items.length)return r6(Y,{code:F6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t4;if(!this._def.rest&&Y.data.length>this._def.items.length)r6(Y,{code:F6.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 p$(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return KJ.mergeArray(Q,Z)});else return KJ.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new hV({...this._def,rest:J})}};hV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new hV({items:J,typeName:V8.ZodTuple,rest:null,...k8(Q)})};bk=class bk extends Q9{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!==x6.object)return r6(Y,{code:F6.invalid_type,expected:x6.object,received:Y.parsedType}),t4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new p$(Y,q,Y.path,q)),value:Z._parse(new p$(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return KJ.mergeObjectAsync(Q,X);else return KJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof Q9)return new bk({keyType:J,valueType:Q,typeName:V8.ZodRecord,...k8(Y)});return new bk({keyType:g$.create(),valueType:J,typeName:V8.ZodRecord,...k8(Q)})}};gk=class gk extends Q9{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!==x6.map)return r6(Y,{code:F6.invalid_type,expected:x6.map,received:Y.parsedType}),t4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new p$(Y,q,Y.path,[K,"key"])),value:G._parse(new p$(Y,V,Y.path,[K,"value"]))}});if(Y.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let V of Z){let K=await V.key,W=await V.value;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let V of Z){let{key:K,value:W}=V;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};gk.create=(J,Q,Y)=>{return new gk({valueType:Q,keyType:J,typeName:V8.ZodMap,...k8(Y)})};AM=class AM extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.set)return r6(Y,{code:F6.invalid_type,expected:x6.set,received:Y.parsedType}),t4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)r6(Y,{code:F6.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)r6(Y,{code:F6.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let G=this._def.valueType;function Z(V){let K=new Set;for(let W of V){if(W.status==="aborted")return t4;if(W.status==="dirty")Q.dirty();K.add(W.value)}return{status:Q.value,value:K}}let q=[...Y.data.values()].map((V,K)=>G._parse(new p$(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 AM({...this._def,minSize:{value:J,message:A4.toString(Q)}})}max(J,Q){return new AM({...this._def,maxSize:{value:J,message:A4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};AM.create=(J,Q)=>{return new AM({valueType:J,minSize:null,maxSize:null,typeName:V8.ZodSet,...k8(Q)})};lE=class lE extends Q9{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.function)return r6(Q,{code:F6.invalid_type,expected:x6.function,received:Q.parsedType}),t4;function Y(q,V){return vk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,pE(),YH].filter((K)=>!!K),issueData:{code:F6.invalid_arguments,argumentsError:V}})}function X(q,V){return vk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,pE(),YH].filter((K)=>!!K),issueData:{code:F6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof OM){let q=this;return QQ(async function(...V){let K=new TY([]),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 QQ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new TY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new TY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new lE({...this._def,args:hV.create(J).rest(sF.create())})}returns(J){return new lE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new lE({args:J?J:hV.create([]).rest(sF.create()),returns:Q||sF.create(),typeName:V8.ZodFunction,...k8(Y)})}};sE=class sE extends Q9{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})}};sE.create=(J,Q)=>{return new sE({getter:J,typeName:V8.ZodLazy,...k8(Q)})};tE=class tE extends Q9{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return r6(Q,{received:Q.data,code:F6.invalid_literal,expected:this._def.value}),t4}return{status:"valid",value:J.data}}get value(){return this._def.value}};tE.create=(J,Q)=>{return new tE({value:J,typeName:V8.ZodLiteral,...k8(Q)})};JU=class JU extends Q9{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{expected:M9.joinValues(Y),received:Q.parsedType,code:F6.invalid_type}),t4}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{received:Q.data,code:F6.invalid_enum_value,options:Y}),t4}return QQ(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 JU.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return JU.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};JU.create=aU0;eE=class eE extends Q9{_parse(J){let Q=M9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==x6.string&&Y.parsedType!==x6.number){let X=M9.objectValues(Q);return r6(Y,{expected:M9.joinValues(X),received:Y.parsedType,code:F6.invalid_type}),t4}if(!this._cache)this._cache=new Set(M9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=M9.objectValues(Q);return r6(Y,{received:Y.data,code:F6.invalid_enum_value,options:X}),t4}return QQ(J.data)}get enum(){return this._def.values}};eE.create=(J,Q)=>{return new eE({values:J,typeName:V8.ZodNativeEnum,...k8(Q)})};OM=class OM extends Q9{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.promise&&Q.common.async===!1)return r6(Q,{code:F6.invalid_type,expected:x6.promise,received:Q.parsedType}),t4;let Y=Q.parsedType===x6.promise?Q.data:Promise.resolve(Q.data);return QQ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};OM.create=(J,Q)=>{return new OM({type:J,typeName:V8.ZodPromise,...k8(Q)})};d$=class d$ extends Q9{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V8.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(r6(Y,Z),Z.fatal)Q.abort();else Q.dirty()},get path(){return Y.path}};if(G.addIssue=G.addIssue.bind(G),X.type==="preprocess"){let Z=X.transform(Y.data,G);if(Y.common.async)return Promise.resolve(Z).then(async(q)=>{if(Q.value==="aborted")return t4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return t4;if(V.status==="dirty")return DM(V.value);if(Q.value==="dirty")return DM(V.value);return V});else{if(Q.value==="aborted")return t4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")return DM(q.value);if(Q.value==="dirty")return DM(q.value);return q}}if(X.type==="refinement"){let Z=(q)=>{let V=X.refinement(q,G);if(Y.common.async)return Promise.resolve(V);if(V instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Y.common.async===!1){let q=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((q)=>{if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Y.common.async===!1){let Z=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!rF(Z))return t4;let q=X.transform(Z.value,G);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((Z)=>{if(!rF(Z))return t4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});M9.assertNever(X)}};d$.create=(J,Q,Y)=>{return new d$({schema:J,typeName:V8.ZodEffects,effect:Q,...k8(Y)})};d$.createWithPreprocess=(J,Q,Y)=>{return new d$({schema:Q,effect:{type:"preprocess",transform:J},typeName:V8.ZodEffects,...k8(Y)})};u$=class u$ extends Q9{_parse(J){if(this._getType(J)===x6.undefined)return QQ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};u$.create=(J,Q)=>{return new u$({innerType:J,typeName:V8.ZodOptional,...k8(Q)})};GH=class GH extends Q9{_parse(J){if(this._getType(J)===x6.null)return QQ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};GH.create=(J,Q)=>{return new GH({innerType:J,typeName:V8.ZodNullable,...k8(Q)})};JI=class JI extends Q9{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===x6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};JI.create=(J,Q)=>{return new JI({innerType:J,typeName:V8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...k8(Q)})};QI=class QI extends Q9{_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(dE(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new TY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new TY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};QI.create=(J,Q)=>{return new QI({innerType:J,typeName:V8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...k8(Q)})};mk=class mk extends Q9{_parse(J){if(this._getType(J)!==x6.nan){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.nan,received:Y.parsedType}),t4}return{status:"valid",value:J.data}}};mk.create=(J)=>{return new mk({typeName:V8.ZodNaN,...k8(J)})};lG4=Symbol("zod_brand");Di=class Di extends Q9{_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}};uk=class uk extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return t4;if(G.status==="dirty")return Q.dirty(),DM(G.value);else return this._def.out._parseAsync({data:G.value,path:Y.path,parent:Y})})();else{let X=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(X.status==="aborted")return t4;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Y.path,parent:Y})}}static create(J,Q){return new uk({in:J,out:Q,typeName:V8.ZodPipeline})}};YI=class YI extends Q9{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(rF(X))X.value=Object.freeze(X.value);return X};return dE(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};YI.create=(J,Q)=>{return new YI({innerType:J,typeName:V8.ZodReadonly,...k8(Q)})};iG4={object:f7.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"})(V8||(V8={}));rU0=g$.create,sU0=tF.create,aG4=mk.create,oG4=eF.create,tU0=iE.create,rG4=MM.create,sG4=fk.create,tG4=nE.create,eG4=aE.create,JZ4=LM.create,QZ4=sF.create,YZ4=fV.create,XZ4=hk.create,GZ4=m$.create,ZZ4=f7.create,$Z4=f7.strictCreate,qZ4=oE.create,VZ4=Ni.create,KZ4=rE.create,WZ4=hV.create,HZ4=bk.create,zZ4=gk.create,FZ4=AM.create,UZ4=lE.create,BZ4=sE.create,NZ4=tE.create,DZ4=JU.create,MZ4=eE.create,LZ4=OM.create,AZ4=d$.create,OZ4=u$.create,wZ4=GH.create,EZ4=d$.createWithPreprocess,IZ4=uk.create,CZ4={string:(J)=>g$.create({...J,coerce:!0}),number:(J)=>tF.create({...J,coerce:!0}),boolean:(J)=>iE.create({...J,coerce:!0}),bigint:(J)=>eF.create({...J,coerce:!0}),date:(J)=>MM.create({...J,coerce:!0})},jZ4=t4});var n={};J9(n,{void:()=>XZ4,util:()=>M9,unknown:()=>QZ4,union:()=>qZ4,undefined:()=>tG4,tuple:()=>WZ4,transformer:()=>AZ4,symbol:()=>sG4,string:()=>rU0,strictObject:()=>$Z4,setErrorMap:()=>wG4,set:()=>FZ4,record:()=>HZ4,quotelessJson:()=>AG4,promise:()=>LZ4,preprocess:()=>EZ4,pipeline:()=>IZ4,ostring:()=>PZ4,optional:()=>OZ4,onumber:()=>RZ4,oboolean:()=>TZ4,objectUtil:()=>O$1,object:()=>ZZ4,number:()=>sU0,nullable:()=>wZ4,null:()=>eG4,never:()=>YZ4,nativeEnum:()=>MZ4,nan:()=>aG4,map:()=>zZ4,makeIssue:()=>vk,literal:()=>NZ4,lazy:()=>BZ4,late:()=>iG4,isValid:()=>rF,isDirty:()=>Bi,isAsync:()=>dE,isAborted:()=>Ui,intersection:()=>KZ4,instanceof:()=>nG4,getParsedType:()=>vV,getErrorMap:()=>pE,function:()=>UZ4,enum:()=>DZ4,effect:()=>AZ4,discriminatedUnion:()=>VZ4,defaultErrorMap:()=>YH,datetimeRegex:()=>nU0,date:()=>rG4,custom:()=>oU0,coerce:()=>CZ4,boolean:()=>tU0,bigint:()=>oG4,array:()=>GZ4,any:()=>JZ4,addIssueToContext:()=>r6,ZodVoid:()=>hk,ZodUnknown:()=>sF,ZodUnion:()=>oE,ZodUndefined:()=>nE,ZodType:()=>Q9,ZodTuple:()=>hV,ZodTransformer:()=>d$,ZodSymbol:()=>fk,ZodString:()=>g$,ZodSet:()=>AM,ZodSchema:()=>Q9,ZodRecord:()=>bk,ZodReadonly:()=>YI,ZodPromise:()=>OM,ZodPipeline:()=>uk,ZodParsedType:()=>x6,ZodOptional:()=>u$,ZodObject:()=>f7,ZodNumber:()=>tF,ZodNullable:()=>GH,ZodNull:()=>aE,ZodNever:()=>fV,ZodNativeEnum:()=>eE,ZodNaN:()=>mk,ZodMap:()=>gk,ZodLiteral:()=>tE,ZodLazy:()=>sE,ZodIssueCode:()=>F6,ZodIntersection:()=>rE,ZodFunction:()=>lE,ZodFirstPartyTypeKind:()=>V8,ZodError:()=>TY,ZodEnum:()=>JU,ZodEffects:()=>d$,ZodDiscriminatedUnion:()=>Ni,ZodDefault:()=>JI,ZodDate:()=>MM,ZodCatch:()=>QI,ZodBranded:()=>Di,ZodBoolean:()=>iE,ZodBigInt:()=>eF,ZodArray:()=>m$,ZodAny:()=>LM,Schema:()=>Q9,ParseStatus:()=>KJ,OK:()=>QQ,NEVER:()=>jZ4,INVALID:()=>t4,EMPTY_PATH:()=>EG4,DIRTY:()=>DM,BRAND:()=>lG4});var R$1=N1(()=>{Fi();E$1();uU0();xk();eU0();zi()});var XI=N1(()=>{R$1();R$1()});function YQ(J,Q){let Y=kZ4(J,Q);return typeof Y==="string"?Y:Y.toString()}function kZ4(J,Q,Y=!0){if(!Q)Q=yZ4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?u0.parse(J):u0.from(J);if(X)for(let V of X){let K=d4(V);if(o0.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?FM(K.path)+(G?"\\":"/"):"";return C$1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=d4(Z);if(o0.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return C$1("~"+(G?"\\":"/")+W,G,q.scheme)}}return C$1(q.fsPath,G,q.scheme)}return q}function C$1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function Li(J){let Q=Mi;return Mi=J,Q}function yZ4(){if(Mi)return Mi;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Mi=null;var ZH=N1(()=>{Q4();fE();Ji()});var xZ4=(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},ZI=(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),ZI(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),ZI(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),ZI(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),ZI(J);break;case"delimiter":return J=J.slice(0,J.length-1),ZI(J);break}return J},vZ4=(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},fZ4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},tG=(J)=>JSON.parse(fZ4(vZ4(ZI(xZ4(J)))));var wM=()=>{};function XQ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function PM(J){return!!J&&!!J[IX]}function YU(J){if(!J)return!1;return ZB0(J)||Array.isArray(J)||!!J[pk]||!!J.constructor?.[pk]||nk(J)||ak(J)}function ZB0(J){if(!J||typeof J!=="object")return!1;let Q=IM(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)===hZ4}function dk(J,Q){if(RM(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function RM(J){let Q=J[IX];return Q?Q.type_:Array.isArray(J)?1:nk(J)?2:ak(J)?3:0}function ck(J,Q){return RM(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function j$1(J,Q){return RM(J)===2?J.get(Q):J[Q]}function $B0(J,Q,Y){let X=RM(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function bZ4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function nk(J){return J instanceof Map}function ak(J){return J instanceof Set}function EM(J){return J.copy_||J.base_}function k$1(J,Q){if(nk(J))return new Map(J);if(ak(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=ZB0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[IX];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(IM(J),X)}else{let X=IM(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function RX(J,Q=!1){if(wi(J)||PM(J)||!YU(J))return J;if(RM(J)>1)J.set=J.add=J.clear=J.delete=gZ4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>RX(X,!0));return J}function gZ4(){XQ(2)}function wi(J){return Object.isFrozen(J)}function TM(J){let Q=y$1[J];if(!Q)XQ(0,J);return Q}function mZ4(J,Q){if(!y$1[J])y$1[J]=Q}function qB0(){return lk}function uZ4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function QB0(J,Q){if(Q)TM("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function x$1(J){v$1(J),J.drafts_.forEach(pZ4),J.drafts_=null}function v$1(J){if(J===lk)lk=J.parent_}function YB0(J){return lk=uZ4(lk,J)}function pZ4(J){let Q=J[IX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function XB0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[IX].modified_)x$1(Q),XQ(4);if(YU(J)){if(J=Ai(Q,J),!Q.parent_)Oi(Q,J)}if(Q.patches_)TM("Patches").generateReplacementPatches_(Y[IX].base_,J,Q.patches_,Q.inversePatches_)}else J=Ai(Q,Y,[]);if(x$1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==b$1?J:void 0}function Ai(J,Q,Y){if(wi(Q))return Q;let X=Q[IX];if(!X)return dk(Q,(G,Z)=>GB0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Oi(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(dk(Z,(V,K)=>GB0(J,X,G,V,K,Y,q)),Oi(J,G,!1),Y&&J.patches_)TM("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function GB0(J,Q,Y,X,G,Z,q){if(PM(G)){let V=Z&&Q&&Q.type_!==3&&!ck(Q.assigned_,X)?Z.concat(X):void 0,K=Ai(J,G,V);if($B0(Y,X,K),PM(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(YU(G)&&!wi(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Ai(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))Oi(J,G)}}function Oi(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)RX(Q,Y)}function dZ4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:qB0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=g$1;if(Y)G=[X],Z=ik;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function S$1(J,Q){let Y=J[IX];return(Y?EM(Y):J)[Q]}function cZ4(J,Q,Y){let X=VB0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function VB0(J,Q){if(!(Q in J))return;let Y=IM(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=IM(Y)}return}function f$1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)f$1(J.parent_)}}function _$1(J){if(!J.copy_)J.copy_=k$1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function h$1(J,Q){let Y=nk(J)?TM("MapSet").proxyMap_(J,Q):ak(J)?TM("MapSet").proxySet_(J,Q):dZ4(J,Q);return(Q?Q.scope_:qB0()).drafts_.push(Y),Y}function iZ4(J){if(!PM(J))XQ(10,J);return KB0(J)}function KB0(J){if(!YU(J)||wi(J))return J;let Q=J[IX],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=k$1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=k$1(J,!0);if(dk(Y,(X,G)=>{$B0(Y,X,KB0(G))}),Q)Q.finalized_=!1;return Y}function Ei(){let Q="replace",Y="add",X="remove";function G(U,N,M,L){switch(U.type_){case 0:case 2:return q(U,N,M,L);case 1:return Z(U,N,M,L);case 3:return V(U,N,M,L)}}function Z(U,N,M,L){let{base_:A,assigned_:E}=U,P=U.copy_;if(P.length<A.length)[A,P]=[P,A],[M,L]=[L,M];for(let I=0;I<A.length;I++)if(E[I]&&P[I]!==A[I]){let T=N.concat([I]);M.push({op:Q,path:T,value:z(P[I])}),L.push({op:Q,path:T,value:z(A[I])})}for(let I=A.length;I<P.length;I++){let T=N.concat([I]);M.push({op:Y,path:T,value:z(P[I])})}for(let I=P.length-1;A.length<=I;--I){let T=N.concat([I]);L.push({op:X,path:T})}}function q(U,N,M,L){let{base_:A,copy_:E}=U;dk(U.assigned_,(P,I)=>{let T=j$1(A,P),S=j$1(E,P),k=!I?X:ck(A,P)?Q:Y;if(T===S&&k===Q)return;let x=N.concat(P);M.push(k===X?{op:k,path:x}:{op:k,path:x,value:S}),L.push(k===Y?{op:X,path:x}:k===X?{op:Y,path:x,value:z(T)}:{op:Q,path:x,value:z(T)})})}function V(U,N,M,L){let{base_:A,copy_:E}=U,P=0;A.forEach((I)=>{if(!E.has(I)){let T=N.concat([P]);M.push({op:X,path:T,value:I}),L.unshift({op:Y,path:T,value:I})}P++}),P=0,E.forEach((I)=>{if(!A.has(I)){let T=N.concat([P]);M.push({op:Y,path:T,value:I}),L.unshift({op:X,path:T,value:I})}P++})}function K(U,N,M,L){M.push({op:Q,path:[],value:N===b$1?void 0:N}),L.push({op:Q,path:[],value:U})}function W(U,N){return N.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let S=0;S<L.length-1;S++){let k=RM(E),x=L[S];if(typeof x!=="string"&&typeof x!=="number")x=""+x;if((k===0||k===1)&&(x==="__proto__"||x==="constructor"))XQ(19);if(typeof E==="function"&&x==="prototype")XQ(19);if(E=j$1(E,x),typeof E!=="object")XQ(18,L.join("/"))}let P=RM(E),I=H(M.value),T=L[L.length-1];switch(A){case Q:switch(P){case 2:return E.set(T,I);case 3:XQ(16);default:return E[T]=I}case Y:switch(P){case 1:return T==="-"?E.push(I):E.splice(T,0,I);case 2:return E.set(T,I);case 3:return E.add(I);default:return E[T]=I}case X:switch(P){case 1:return E.splice(T,1);case 2:return E.delete(T);case 3:return E.delete(M.value);default:return delete E[T]}default:XQ(17,A)}}),U}function H(U){if(!YU(U))return U;if(Array.isArray(U))return U.map(H);if(nk(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(ak(U))return new Set(Array.from(U).map(H));let N=Object.create(IM(U));for(let M in U)N[M]=H(U[M]);if(ck(U,pk))N[pk]=U[pk];return N}function z(U){if(PM(U))return H(U);else return U}mZ4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function i8(J){return J}var b$1,pk,IX,IM,hZ4,y$1,lk,g$1,ik,lZ4=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")XQ(6);if(X!==void 0&&typeof X!=="function")XQ(7);let G;if(YU(Q)){let Z=YB0(this),q=h$1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)x$1(Z);else v$1(Z)}return QB0(Z,X),XB0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===b$1)G=void 0;if(this.autoFreeze_)RX(G,!0);if(X){let Z=[],q=[];TM("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else XQ(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(!YU(J))XQ(8);if(PM(J))J=iZ4(J);let Q=YB0(this),Y=h$1(J,void 0);return Y[IX].isManual_=!0,v$1(Q),Y}finishDraft(J,Q){let Y=J&&J[IX];if(!Y||!Y.isManual_)XQ(9);let{scope_:X}=Y;return QB0(X,Q),XB0(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=TM("Patches").applyPatches_;if(PM(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},PX,XU,CM,$l8,ql8,WB0,Vl8,Kl8;var fQ=N1(()=>{b$1=Symbol.for("immer-nothing"),pk=Symbol.for("immer-draftable"),IX=Symbol.for("immer-state");IM=Object.getPrototypeOf;hZ4=Object.prototype.constructor.toString();y$1={};g$1={get(J,Q){if(Q===IX)return J;let Y=EM(J);if(!ck(Y,Q))return cZ4(J,Y,Q);let X=Y[Q];if(J.finalized_||!YU(X))return X;if(X===S$1(J.base_,Q))return _$1(J),J.copy_[Q]=h$1(X,J);return X},has(J,Q){return Q in EM(J)},ownKeys(J){return Reflect.ownKeys(EM(J))},set(J,Q,Y){let X=VB0(EM(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=S$1(EM(J),Q),Z=G?.[IX];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(bZ4(Y,G)&&(Y!==void 0||ck(J.base_,Q)))return!0;_$1(J),f$1(J)}if(J.copy_[Q]===Y&&(Y!==void 0||(Q in J.copy_))||Number.isNaN(Y)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Y,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(S$1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,_$1(J),f$1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=EM(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(){XQ(11)},getPrototypeOf(J){return IM(J.base_)},setPrototypeOf(){XQ(12)}},ik={};dk(g$1,(J,Q)=>{ik[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});ik.deleteProperty=function(J,Q){return ik.set.call(this,J,Q,void 0)};ik.set=function(J,Q,Y){return g$1.set.call(this,J[0],Q,Y,J[0])};PX=new lZ4,XU=PX.produce,CM=PX.produceWithPatches.bind(PX),$l8=PX.setAutoFreeze.bind(PX),ql8=PX.setUseStrictShallowCopy.bind(PX),WB0=PX.applyPatches.bind(PX),Vl8=PX.createDraft.bind(PX),Kl8=PX.finishDraft.bind(PX)});function m$1({onlyFirst:J=!1}={}){let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Y,J?void 0:"g")}function $I(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(nZ4,"")}var nZ4;var Ii=N1(()=>{nZ4=m$1()});var zB0=h((Bl8,u$1)=>{var GU={};if(typeof u$1>"u")window.eastasianwidth=GU;else u$1.exports=GU;GU.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"};GU.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function HB0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}GU.length=function(J){var Q=HB0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};GU.slice=function(J,Q,Y){if(textLen=GU.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=HB0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=GU.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var p$1=h((Nl8,FB0)=>{FB0.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 aZ4,oZ4;var UB0=N1(()=>{Ii();aZ4=D6(zB0(),1),oZ4=D6(p$1(),1)});function Pi(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var d$1=N1(()=>{UB0()});var BB0="run_terminal_command",c$1="read_file",WJ="Task",W9="finder",CY="get_diagnostics",l9="Bash",s5="oracle",bV="mermaid",gV="todo_read",K7="todo_write",A2="read_web_page",qI="read_thread",VI="find_thread",L5="create_file",z3="glob",Ri="undo_edit",Ti="read_mcp_resource",i6="Read",O7="edit_file",KI="format_file",b3="web_search",y8="Grep",jM="Check",TX="librarian",Ci="kraken",NB0="look_at",DB0="read_artifact",MB0="edit_artifact",ji="read_plan",WI="edit_plan",Si="read_github",_i="search_github",ki="commit_search",yi="list_directory_github",xi="list_repositories",vi="glob_github",fi="diff",LB0="bookkeeper",AB0="describe_workbook",OB0="execute_query",ok="skill",wB0;var L4=N1(()=>{wB0=["Task","finder","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","look_at","librarian","bookkeeper","read_thread","find_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var rk=h((El8,IB0)=>{var EB0={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:"/"},rZ4={...EB0,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:"\\"},sZ4={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"};IB0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:sZ4,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?rZ4:EB0}}});var sk=h((Y$4)=>{var{REGEX_BACKSLASH:tZ4,REGEX_REMOVE_BACKSLASH:eZ4,REGEX_SPECIAL_CHARS:J$4,REGEX_SPECIAL_CHARS_GLOBAL:Q$4}=rk();Y$4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);Y$4.hasRegexChars=(J)=>J$4.test(J);Y$4.isRegexChar=(J)=>J.length===1&&Y$4.hasRegexChars(J);Y$4.escapeRegex=(J)=>J.replace(Q$4,"\\$1");Y$4.toPosixSlashes=(J)=>J.replace(tZ4,"/");Y$4.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};Y$4.removeBackslashes=(J)=>{return J.replace(eZ4,(Q)=>{return Q==="\\"?"":Q})};Y$4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return Y$4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};Y$4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};Y$4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};Y$4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var xB0=h((Pl8,yB0)=>{var TB0=sk(),{CHAR_ASTERISK:l$1,CHAR_AT:z$4,CHAR_BACKWARD_SLASH:tk,CHAR_COMMA:F$4,CHAR_DOT:i$1,CHAR_EXCLAMATION_MARK:n$1,CHAR_FORWARD_SLASH:kB0,CHAR_LEFT_CURLY_BRACE:a$1,CHAR_LEFT_PARENTHESES:o$1,CHAR_LEFT_SQUARE_BRACKET:U$4,CHAR_PLUS:B$4,CHAR_QUESTION_MARK:CB0,CHAR_RIGHT_CURLY_BRACE:N$4,CHAR_RIGHT_PARENTHESES:jB0,CHAR_RIGHT_SQUARE_BRACKET:D$4}=rk(),SB0=(J)=>{return J===kB0||J===tk},_B0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},M$4=(J,Q)=>{let Y=Q||{},X=J.length-1,G=Y.parts===!0||Y.scanToEnd===!0,Z=[],q=[],V=[],K=J,W=-1,H=0,z=0,U=!1,N=!1,M=!1,L=!1,A=!1,E=!1,P=!1,I=!1,T=!1,S=!1,k=0,x,b,p={value:"",depth:0,isGlob:!1},g=()=>W>=X,i=()=>K.charCodeAt(W+1),Q1=()=>{return x=b,K.charCodeAt(++W)};while(W<X){b=Q1();let H1;if(b===tk){if(P=p.backslashes=!0,b=Q1(),b===a$1)E=!0;continue}if(E===!0||b===a$1){k++;while(g()!==!0&&(b=Q1())){if(b===tk){P=p.backslashes=!0,Q1();continue}if(b===a$1){k++;continue}if(E!==!0&&b===i$1&&(b=Q1())===i$1){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(E!==!0&&b===F$4){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(b===N$4){if(k--,k===0){E=!1,U=p.isBrace=!0,S=!0;break}}}if(G===!0)continue;break}if(b===kB0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},S===!0)continue;if(x===i$1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((b===B$4||b===z$4||b===l$1||b===CB0||b===n$1)===!0&&i()===o$1){if(M=p.isGlob=!0,L=p.isExtglob=!0,S=!0,b===n$1&&W===H)T=!0;if(G===!0){while(g()!==!0&&(b=Q1())){if(b===tk){P=p.backslashes=!0,b=Q1();continue}if(b===jB0){M=p.isGlob=!0,S=!0;break}}continue}break}}if(b===l$1){if(x===l$1)A=p.isGlobstar=!0;if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(b===CB0){if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(b===U$4){while(g()!==!0&&(H1=Q1())){if(H1===tk){P=p.backslashes=!0,Q1();continue}if(H1===D$4){N=p.isBracket=!0,M=p.isGlob=!0,S=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&b===n$1&&W===H){I=p.negated=!0,H++;continue}if(Y.noparen!==!0&&b===o$1){if(M=p.isGlob=!0,G===!0){while(g()!==!0&&(b=Q1())){if(b===o$1){P=p.backslashes=!0,b=Q1();continue}if(b===jB0){S=!0;break}}continue}break}if(M===!0){if(S=!0,G===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let o=K,u="",e="";if(H>0)u=K.slice(0,H),K=K.slice(H),z-=H;if(o&&M===!0&&z>0)o=K.slice(0,z),e=K.slice(z);else if(M===!0)o="",e=K;else o=K;if(o&&o!==""&&o!=="/"&&o!==K){if(SB0(o.charCodeAt(o.length-1)))o=o.slice(0,-1)}if(Y.unescape===!0){if(e)e=TB0.removeBackslashes(e);if(o&&P===!0)o=TB0.removeBackslashes(o)}let V1={prefix:u,input:J,start:H,base:o,glob:e,isBrace:U,isBracket:N,isGlob:M,isExtglob:L,isGlobstar:A,negated:I,negatedExtglob:T};if(Y.tokens===!0){if(V1.maxDepth=0,!SB0(b))q.push(p);V1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let H1;for(let a=0;a<Z.length;a++){let s=H1?H1+1:H,l=Z[a],K1=J.slice(s,l);if(Y.tokens){if(a===0&&H!==0)q[a].isPrefix=!0,q[a].value=u;else q[a].value=K1;_B0(q[a]),V1.maxDepth+=q[a].depth}if(a!==0||K1!=="")V.push(K1);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,_B0(q[q.length-1]),V1.maxDepth+=q[q.length-1].depth}V1.slashes=Z,V1.parts=V}return V1};yB0.exports=M$4});var hB0=h((Rl8,fB0)=>{var hi=rk(),mV=sk(),{MAX_LENGTH:bi,POSIX_REGEX_SOURCE:L$4,REGEX_NON_SPECIAL_CHARS:A$4,REGEX_SPECIAL_CHARS_BACKREF:O$4,REPLACEMENTS:vB0}=hi,w$4=(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)=>mV.escapeRegex(G)).join("..")}return Y},HI=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},r$1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=vB0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(bi,Y.maxLength):bi,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=hi.globChars(Y.windows),W=hi.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:P,QMARK_NO_DOT:I,STAR:T,START_ANCHOR:S}=K,k=(t1)=>{return`(${V}(?:(?!${S}${t1.dot?M:H}).)*?)`},x=Y.dot?"":L,b=Y.dot?P:I,p=Y.bash===!0?k(Y):T;if(Y.capture)p=`(${p})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let g={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=mV.removePrefix(J,g),G=J.length;let i=[],Q1=[],o=[],u=Z,e,V1=()=>g.index===G-1,H1=g.peek=(t1=1)=>J[g.index+t1],a=g.advance=()=>J[++g.index]||"",s=()=>J.slice(g.index+1),l=(t1="",U1=0)=>{g.consumed+=t1,g.index+=U1},K1=(t1)=>{g.output+=t1.output!=null?t1.output:t1.value,l(t1.value)},k1=()=>{let t1=1;while(H1()==="!"&&(H1(2)!=="("||H1(3)==="?"))a(),g.start++,t1++;if(t1%2===0)return!1;return g.negated=!0,g.start++,!0},J1=(t1)=>{g[t1]++,o.push(t1)},v1=(t1)=>{g[t1]--,o.pop()},I1=(t1)=>{if(u.type==="globstar"){let U1=g.braces>0&&(t1.type==="comma"||t1.type==="brace"),Y1=t1.extglob===!0||i.length&&(t1.type==="pipe"||t1.type==="paren");if(t1.type!=="slash"&&t1.type!=="paren"&&!U1&&!Y1)g.output=g.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=p,g.output+=u.output}if(i.length&&t1.type!=="paren")i[i.length-1].inner+=t1.value;if(t1.value||t1.output)K1(t1);if(u&&u.type==="text"&&t1.type==="text"){u.output=(u.output||u.value)+t1.value,u.value+=t1.value;return}t1.prev=u,q.push(t1),u=t1},A0=(t1,U1)=>{let Y1={...W[U1],conditions:1,inner:""};Y1.prev=u,Y1.parens=g.parens,Y1.output=g.output;let O1=(Y.capture?"(":"")+Y1.open;J1("parens"),I1({type:t1,value:U1,output:g.output?"":N}),I1({type:"paren",extglob:!0,value:a(),output:O1}),i.push(Y1)},T1=(t1)=>{let U1=t1.close+(Y.capture?")":""),Y1;if(t1.type==="negate"){let O1=p;if(t1.inner&&t1.inner.length>1&&t1.inner.includes("/"))O1=k(Y);if(O1!==p||V1()||/^\)+$/.test(s()))U1=t1.close=`)$))${O1}`;if(t1.inner.includes("*")&&(Y1=s())&&/^\.[^\\/.]+$/.test(Y1)){let w1=r$1(Y1,{...Q,fastpaths:!1}).output;U1=t1.close=`)${w1})${O1})`}if(t1.prev.type==="bos")g.negatedExtglob=!0}I1({type:"paren",extglob:!0,value:e,output:U1}),v1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let t1=!1,U1=J.replace(O$4,(Y1,O1,w1,P1,E1,d1)=>{if(P1==="\\")return t1=!0,Y1;if(P1==="?"){if(O1)return O1+P1+(E1?P.repeat(E1.length):"");if(d1===0)return b+(E1?P.repeat(E1.length):"");return P.repeat(w1.length)}if(P1===".")return H.repeat(w1.length);if(P1==="*"){if(O1)return O1+P1+(E1?p:"");return p}return O1?Y1:`\\${Y1}`});if(t1===!0)if(Y.unescape===!0)U1=U1.replace(/\\/g,"");else U1=U1.replace(/\\+/g,(Y1)=>{return Y1.length%2===0?"\\\\":Y1?"\\":""});if(U1===J&&Y.contains===!0)return g.output=J,g;return g.output=mV.wrapOutput(U1,g,Q),g}while(!V1()){if(e=a(),e==="\x00")continue;if(e==="\\"){let Y1=H1();if(Y1==="/"&&Y.bash!==!0)continue;if(Y1==="."||Y1===";")continue;if(!Y1){e+="\\",I1({type:"text",value:e});continue}let O1=/^\\+/.exec(s()),w1=0;if(O1&&O1[0].length>2){if(w1=O1[0].length,g.index+=w1,w1%2!==0)e+="\\"}if(Y.unescape===!0)e=a();else e+=a();if(g.brackets===0){I1({type:"text",value:e});continue}}if(g.brackets>0&&(e!=="]"||u.value==="["||u.value==="[^")){if(Y.posix!==!1&&e===":"){let Y1=u.value.slice(1);if(Y1.includes("[")){if(u.posix=!0,Y1.includes(":")){let O1=u.value.lastIndexOf("["),w1=u.value.slice(0,O1),P1=u.value.slice(O1+2),E1=L$4[P1];if(E1){if(u.value=w1+E1,g.backtrack=!0,a(),!Z.output&&q.indexOf(u)===1)Z.output=N;continue}}}}if(e==="["&&H1()!==":"||e==="-"&&H1()==="]")e=`\\${e}`;if(e==="]"&&(u.value==="["||u.value==="[^"))e=`\\${e}`;if(Y.posix===!0&&e==="!"&&u.value==="[")e="^";u.value+=e,K1({value:e});continue}if(g.quotes===1&&e!=='"'){e=mV.escapeRegex(e),u.value+=e,K1({value:e});continue}if(e==='"'){if(g.quotes=g.quotes===1?0:1,Y.keepQuotes===!0)I1({type:"text",value:e});continue}if(e==="("){J1("parens"),I1({type:"paren",value:e});continue}if(e===")"){if(g.parens===0&&Y.strictBrackets===!0)throw SyntaxError(HI("opening","("));let Y1=i[i.length-1];if(Y1&&g.parens===Y1.parens+1){T1(i.pop());continue}I1({type:"paren",value:e,output:g.parens?")":"\\)"}),v1("parens");continue}if(e==="["){if(Y.nobracket===!0||!s().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(HI("closing","]"));e=`\\${e}`}else J1("brackets");I1({type:"bracket",value:e});continue}if(e==="]"){if(Y.nobracket===!0||u&&u.type==="bracket"&&u.value.length===1){I1({type:"text",value:e,output:`\\${e}`});continue}if(g.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(HI("opening","["));I1({type:"text",value:e,output:`\\${e}`});continue}v1("brackets");let Y1=u.value.slice(1);if(u.posix!==!0&&Y1[0]==="^"&&!Y1.includes("/"))e=`/${e}`;if(u.value+=e,K1({value:e}),Y.literalBrackets===!1||mV.hasRegexChars(Y1))continue;let O1=mV.escapeRegex(u.value);if(g.output=g.output.slice(0,-u.value.length),Y.literalBrackets===!0){g.output+=O1,u.value=O1;continue}u.value=`(${V}${O1}|${u.value})`,g.output+=u.value;continue}if(e==="{"&&Y.nobrace!==!0){J1("braces");let Y1={type:"brace",value:e,output:"(",outputIndex:g.output.length,tokensIndex:g.tokens.length};Q1.push(Y1),I1(Y1);continue}if(e==="}"){let Y1=Q1[Q1.length-1];if(Y.nobrace===!0||!Y1){I1({type:"text",value:e,output:e});continue}let O1=")";if(Y1.dots===!0){let w1=q.slice(),P1=[];for(let E1=w1.length-1;E1>=0;E1--){if(q.pop(),w1[E1].type==="brace")break;if(w1[E1].type!=="dots")P1.unshift(w1[E1].value)}O1=w$4(P1,Y),g.backtrack=!0}if(Y1.comma!==!0&&Y1.dots!==!0){let w1=g.output.slice(0,Y1.outputIndex),P1=g.tokens.slice(Y1.tokensIndex);Y1.value=Y1.output="\\{",e=O1="\\}",g.output=w1;for(let E1 of P1)g.output+=E1.output||E1.value}I1({type:"brace",value:e,output:O1}),v1("braces"),Q1.pop();continue}if(e==="|"){if(i.length>0)i[i.length-1].conditions++;I1({type:"text",value:e});continue}if(e===","){let Y1=e,O1=Q1[Q1.length-1];if(O1&&o[o.length-1]==="braces")O1.comma=!0,Y1="|";I1({type:"comma",value:e,output:Y1});continue}if(e==="/"){if(u.type==="dot"&&g.index===g.start+1){g.start=g.index+1,g.consumed="",g.output="",q.pop(),u=Z;continue}I1({type:"slash",value:e,output:U});continue}if(e==="."){if(g.braces>0&&u.type==="dot"){if(u.value===".")u.output=H;let Y1=Q1[Q1.length-1];u.type="dots",u.output+=e,u.value+=e,Y1.dots=!0;continue}if(g.braces+g.parens===0&&u.type!=="bos"&&u.type!=="slash"){I1({type:"text",value:e,output:H});continue}I1({type:"dot",value:e,output:H});continue}if(e==="?"){if(!(u&&u.value==="(")&&Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){A0("qmark",e);continue}if(u&&u.type==="paren"){let O1=H1(),w1=e;if(u.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(s()))w1=`\\${e}`;I1({type:"text",value:e,output:w1});continue}if(Y.dot!==!0&&(u.type==="slash"||u.type==="bos")){I1({type:"qmark",value:e,output:I});continue}I1({type:"qmark",value:e,output:P});continue}if(e==="!"){if(Y.noextglob!==!0&&H1()==="("){if(H1(2)!=="?"||!/[!=<:]/.test(H1(3))){A0("negate",e);continue}}if(Y.nonegate!==!0&&g.index===0){k1();continue}}if(e==="+"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){A0("plus",e);continue}if(u&&u.value==="("||Y.regex===!1){I1({type:"plus",value:e,output:z});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||g.parens>0){I1({type:"plus",value:e});continue}I1({type:"plus",value:z});continue}if(e==="@"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){I1({type:"at",extglob:!0,value:e,output:""});continue}I1({type:"text",value:e});continue}if(e!=="*"){if(e==="$"||e==="^")e=`\\${e}`;let Y1=A$4.exec(s());if(Y1)e+=Y1[0],g.index+=Y1[0].length;I1({type:"text",value:e});continue}if(u&&(u.type==="globstar"||u.star===!0)){u.type="star",u.star=!0,u.value+=e,u.output=p,g.backtrack=!0,g.globstar=!0,l(e);continue}let t1=s();if(Y.noextglob!==!0&&/^\([^?]/.test(t1)){A0("star",e);continue}if(u.type==="star"){if(Y.noglobstar===!0){l(e);continue}let Y1=u.prev,O1=Y1.prev,w1=Y1.type==="slash"||Y1.type==="bos",P1=O1&&(O1.type==="star"||O1.type==="globstar");if(Y.bash===!0&&(!w1||t1[0]&&t1[0]!=="/")){I1({type:"star",value:e,output:""});continue}let E1=g.braces>0&&(Y1.type==="comma"||Y1.type==="brace"),d1=i.length&&(Y1.type==="pipe"||Y1.type==="paren");if(!w1&&Y1.type!=="paren"&&!E1&&!d1){I1({type:"star",value:e,output:""});continue}while(t1.slice(0,3)==="/**"){let b1=J[g.index+4];if(b1&&b1!=="/")break;t1=t1.slice(3),l("/**",3)}if(Y1.type==="bos"&&V1()){u.type="globstar",u.value+=e,u.output=k(Y),g.output=u.output,g.globstar=!0,l(e);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&!P1&&V1()){g.output=g.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=k(Y)+(Y.strictSlashes?")":"|$)"),u.value+=e,g.globstar=!0,g.output+=Y1.output+u.output,l(e);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&t1[0]==="/"){let b1=t1[1]!==void 0?"|$":"";g.output=g.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=`${k(Y)}${U}|${U}${b1})`,u.value+=e,g.output+=Y1.output+u.output,g.globstar=!0,l(e+a()),I1({type:"slash",value:"/",output:""});continue}if(Y1.type==="bos"&&t1[0]==="/"){u.type="globstar",u.value+=e,u.output=`(?:^|${U}|${k(Y)}${U})`,g.output=u.output,g.globstar=!0,l(e+a()),I1({type:"slash",value:"/",output:""});continue}g.output=g.output.slice(0,-u.output.length),u.type="globstar",u.output=k(Y),u.value+=e,g.output+=u.output,g.globstar=!0,l(e);continue}let U1={type:"star",value:e,output:p};if(Y.bash===!0){if(U1.output=".*?",u.type==="bos"||u.type==="slash")U1.output=x+U1.output;I1(U1);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&Y.regex===!0){U1.output=e,I1(U1);continue}if(g.index===g.start||u.type==="slash"||u.type==="dot"){if(u.type==="dot")g.output+=A,u.output+=A;else if(Y.dot===!0)g.output+=E,u.output+=E;else g.output+=x,u.output+=x;if(H1()!=="*")g.output+=N,u.output+=N}I1(U1)}while(g.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(HI("closing","]"));g.output=mV.escapeLast(g.output,"["),v1("brackets")}while(g.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(HI("closing",")"));g.output=mV.escapeLast(g.output,"("),v1("parens")}while(g.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(HI("closing","}"));g.output=mV.escapeLast(g.output,"{"),v1("braces")}if(Y.strictSlashes!==!0&&(u.type==="star"||u.type==="bracket"))I1({type:"maybe_slash",value:"",output:`${U}?`});if(g.backtrack===!0){g.output="";for(let t1 of g.tokens)if(g.output+=t1.output!=null?t1.output:t1.value,t1.suffix)g.output+=t1.suffix}return g};r$1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(bi,Y.maxLength):bi,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=vB0[J]||J;let{DOT_LITERAL:Z,SLASH_LITERAL:q,ONE_CHAR:V,DOTS_SLASH:K,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:N}=hi.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?z:W,A=Y.capture?"":"?:",E={negated:!1,prefix:""},P=Y.bash===!0?".*?":U;if(Y.capture)P=`(${P})`;let I=(x)=>{if(x.noglobstar===!0)return P;return`(${A}(?:(?!${N}${x.dot?K:Z}).)*?)`},T=(x)=>{switch(x){case"*":return`${M}${V}${P}`;case".*":return`${Z}${V}${P}`;case"*.*":return`${M}${P}${Z}${V}${P}`;case"*/*":return`${M}${P}${q}${V}${L}${P}`;case"**":return M+I(Y);case"**/*":return`(?:${M}${I(Y)}${q})?${L}${V}${P}`;case"**/*.*":return`(?:${M}${I(Y)}${q})?${L}${P}${Z}${V}${P}`;case"**/.*":return`(?:${M}${I(Y)}${q})?${Z}${V}${P}`;default:{let b=/^(.*?)\.(\w+)$/.exec(x);if(!b)return;let p=T(b[1]);if(!p)return;return p+Z+b[2]}}},S=mV.removePrefix(J,E),k=T(S);if(k&&Y.strictSlashes!==!0)k+=`${q}?`;return k};fB0.exports=r$1});var ek=h((Tl8,gB0)=>{var E$4=xB0(),s$1=hB0(),bB0=sk(),I$4=rk(),P$4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),O2=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>O2(U,Q,Y));return(U)=>{for(let N of H){let M=N(U);if(M)return M}return!1}}let X=P$4(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?O2.compileRe(J,Q):O2.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=O2(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:N,output:M}=O2.test(H,q,Q,{glob:J,posix:Z}),L={glob:J,state:V,regex:q,posix:Z,input:H,output:M,match:N,isMatch:U};if(typeof G.onResult==="function")G.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof G.onMatch==="function")G.onMatch(L);return z?L:!0};if(Y)W.state=V;return W};O2.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?bB0.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=O2.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};O2.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:O2.makeRe(Q,Y)).test(bB0.basename(J))};O2.isMatch=(J,Q,Y)=>O2(Q,Y)(J);O2.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>O2.parse(Y,Q));return s$1(J,{...Q,fastpaths:!1})};O2.scan=(J,Q)=>E$4(J,Q);O2.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=O2.toRegex(V,Q);if(X===!0)K.state=J;return K};O2.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=s$1.fastpaths(J,Q);if(!G.output)G=s$1(J,Q);return O2.compileRe(G,Q,Y,X)};O2.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/$^/}};O2.constants=I$4;gB0.exports=O2});var SM=h((Cl8,pB0)=>{var mB0=ek(),R$4=sk();function uB0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:R$4.isWindows()};return mB0(J,Q,Y)}Object.assign(uB0,mB0);pB0.exports=uB0});var zI;var t$1=N1(()=>{zI={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@ampcode.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.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",enablement:"amp.isSourcegraphTeammate"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.guidanceFilesInContext":{type:"boolean",default:!1,markdownDescription:"Deliver AGENTS.md guidance files in message context instead of system prompt for improved cache efficiency.",scope:"window"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debug.logReview":{type:"boolean",default:!1,description:"Enable debug logging for review git operations",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"amp.experimental.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",scope:"window"},"amp.experimental.courseCorrection.enabled":{type:"boolean",default:!1,description:"Enable course correction agent that monitors the thread and provides guidance when the model goes off track",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function C$4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function cB0(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=zI.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!C$4(X))return null;return X*1000}function lB0(J){let Q=J.settings["tools.stopTimeout"],Y=zI.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var dB0;var gi=N1(()=>{t$1();dB0=zI.contributes.configuration.properties});function F3(J){let Q=x8[J];return`${Q.provider}/${Q.name}`}function jY(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);let Y=J.slice(0,Q),X=J.slice(Q+1);for(let G of Object.values(x8))if(G.provider===Y&&G.name===X)return G;switch(Y){case"anthropic":return x8.CLAUDE_SONNET_4_5;case"openai":return x8.GPT_5;case"xai":return x8.GROK_CODE_FAST_1;case"cerebras":return x8.Z_AI_GLM_4_6;case"fireworks":return x8.FIREWORKS_GLM_4P6;case"moonshotai":return x8.KIMI_K2_INSTRUCT;case"openrouter":return x8.SONOMA_SKY_ALPHA;case"groq":return x8.GPT_OSS_120B;case"vertexai":return x8.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Y}`)}}function iB0(J){for(let Q of Object.values(x8))if(Q.name===J)return Q;return}function hQ(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function c$(J,Q){let Y=jY(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}function nB0(J,Q){if(!Q?.pricing?.cached||!Q.pricing.cacheWrite)return 0;let Y=Q.pricing.cacheWrite/1e6,X=Q.pricing.cached/1e6;return J*(Y-X)}function aB0(J){return J?.pricing?.cacheTTL??300}var S9,x8,e$1;var CX=N1(()=>{S9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},x8={CLAUDE_SONNET_4:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:S9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:S9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:S9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,pricing:{input:5,output:25,cached:0.5,cacheWrite:6.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:S9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,pricing:{input:1,output:5,cached:0.1,cacheWrite:1.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:S9.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:S9.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:S9.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:S9.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:S9.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:S9.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:S9.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:S9.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:S9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:S9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:S9.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:S9.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:S9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:S9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,freeTierEligible:!0,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:S9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:S9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:S9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:S9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:S9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:S9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};e$1={FINDER:"finder"}});function Jq1(J,Q){let Y=uV(Q);if(!Y)return!1;if(j$4.has(J)){let X=Y.finder??e$1.FINDER,G=S$4[X];if(J!==G)return!1}if(Y.includeTools)return Y.includeTools.includes(J);return!0}function eG(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(FI).filter((X)=>{if(Y.includes(`!${X.key}`))return!1;if(Q===!1&&q5(X.key))return!1;let Z="visible"in X?X.visible:!1,q=Y.includes(X.key),V=X.key==="plan"&&J?.["experimental.planMode"]===!0,K=J?.["experimental.dojoMode"]===!0;if(X.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(X.key==="dojo")return K&&(Q===!1||Q===void 0);return Z||q||V}).map((X)=>({mode:X.key,description:"description"in X?X.description:void 0})).sort((X,G)=>X.mode.localeCompare(G.mode))}function uV(J){return Object.values(FI).find((Q)=>Q.key===J)}function _M(J){return uV(J)?.primaryModel??F3("CLAUDE_SONNET_4_5")}function Jy(J){let Q=uV(J);if(!Q)return!1;return jY(Q.primaryModel).capabilities?.vision??!1}function q5(J){return J==="free"||J.startsWith("free-")}function Qq1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function Yq1(J,Q){let X=(Q.findIndex((Z)=>Z.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var j$4,S$4,rB0,sB0,_$4,k$4,oB0,y$4,x$4,FI,v$4;var l$=N1(()=>{CX();j$4=new Set(["finder"]),S$4={finder:"finder"},rB0={r:0,g:55,b:0},sB0={r:0,g:255,b:136},_$4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","find_thread","skill"],k$4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at"],oB0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],y$4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","web_search","read_web_page"],x$4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at","code_review"],FI={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:F3("CLAUDE_OPUS_4_5"),includeTools:x$4,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:F3("CLAUDE_HAIKU_4_5"),includeTools:_$4,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:F3("CLAUDE_HAIKU_4_5"),includeTools:k$4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:F3("GPT_5_1_CODEX"),includeTools:y$4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:F3("CLAUDE_HAIKU_4_5"),includeTools:oB0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:F3("CLAUDE_SONNET_4_5"),includeTools:oB0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},v$4=Object.values(FI).map((J)=>J.key)});function mi(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let X="subagentType"in Q?Q.subagentType:void 0;if(X&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(X)}return!0}return Q.includeTools.includes(J)}var f$4,h$4,Xq1,b$4,g$4,m$4,u$4,p$4,o7,fl8;var pV=N1(()=>{CX();f$4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],h$4=["Grep","glob","Read"],Xq1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],b$4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],g$4=["Read","glob","Grep","enqueue_file_edit","fastmod"],m$4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],u$4=["describe_workbook","execute_query"],p$4=["Read","Grep","glob","web_search","read_web_page","Bash"],o7={finder:{key:"finder",displayName:"Finder",model:F3("CLAUDE_HAIKU_4_5"),includeTools:h$4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:F3("GPT_5_1"),includeTools:Xq1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:F3("CLAUDE_HAIKU_4_5"),includeTools:f$4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:b$4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:F3("CLAUDE_HAIKU_4_5"),includeTools:g$4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:F3("CLAUDE_HAIKU_4_5"),includeTools:m$4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:F3("CLAUDE_HAIKU_4_5"),includeTools:u$4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:F3("CLAUDE_SONNET_4_5"),includeTools:p$4,allowMcp:!1,allowToolbox:!1}},fl8=Object.keys(o7)});function tB0(J,Q){return new X0((Y)=>{let X=setTimeout(G,Q);function G(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function Z(){if(X)clearTimeout(X);X=setTimeout(G,Q)}let q=J.subscribe({next:(V)=>{Z(),Y.next(V)},error:(V)=>{if(X)clearTimeout(X),X=null;Y.error(V)},complete:()=>{if(X)clearTimeout(X),X=null;Y.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var eB0=N1(()=>{s0()});function w7(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 w2(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function YN0(J){return["done","error","cancelled"].includes(J.status)}function Gq1(J){return typeof J==="object"&&"key"in J}function ui(J){let Q=[],Y=new c4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0){let W=q.toLowerCase();K=Q.filter((H)=>H.spec.name.toLowerCase()===W)}for(let W of K)if(BI(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return v.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let N={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))Q[W]=N;else Q.push(N);return Y.next(),{dispose:()=>{let L=Q.indexOf(N);if(L!==-1)Q.splice(L,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return d$4;return Z(q,V,K)},tools:c8(J.configService.config,Y.pipe(l8(void 0))).pipe(q6(([q])=>{return Q.map((V)=>({spec:V.spec,...BI(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>c$4.record(performance.now()-W,{toolName:q});if(q===$q1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){UI.add(1,{toolName:q,error:"invalid"});let N=Zq1(V.args.invalid_tool_name);return new X0((M)=>{M.error(Error(N))})}let z=G(q,K.config);if(!z){let N=q.toLowerCase(),M=Q.filter((P)=>P.spec.name.toLowerCase()===N);if(M.length===0)return UI.add(1,{toolName:q,error:"not_found"}),new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} not found`))});let L=M[0],A=BI(L.spec,K.config);UI.add(1,{toolName:q,error:"disabled"});let E=A.enabled?"unknown":A.disabledReason;return new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} is disabled: ${E}`))})}let U=K.subagentSpec??K.agentMode;if(U&&!this.isToolAllowed(q,U)){UI.add(1,{toolName:q,error:"disabled"});let N=Gq1(U)?U.displayName??U.key:`${U} mode`;return new X0((M)=>{M.error(Error(`tool ${JSON.stringify(q)} is not allowed for ${N}`))})}if(K.thread.mainThreadID&&!K.subagentSpec&&!mi(q,o7["task-subagent"]))return UI.add(1,{toolName:q,error:"disabled"}),new X0((N)=>{N.error(Error(`tool ${JSON.stringify(q)} is not allowed for subagents`))});return UI.add(1,{toolName:q}),s6(()=>z.fn).pipe(y4((N)=>{let M=N(V,K);if(z.spec.meta?.disableTimeout)return M;return tB0(M,lB0(K.config))}),f$(()=>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){v.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},isToolAllowed(q,V){let K=Q.find((H)=>H.spec.name===q),W=K?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(Gq1(V))return mi(q,V,K?.spec.meta);return Jq1(q,V)},getTools(q){return c8(J.configService.config,Y.pipe(l8(void 0))).pipe(q6(([V])=>{return Q.filter((K)=>{let W=K.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(Gq1(q))return mi(K.spec.name,q,K.spec.meta);return Jq1(K.spec.name,q)}).map((K)=>({spec:K.spec,...BI(K.spec,V)})).sort((K,W)=>K.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(q,V){if(V)return this.getTools(o7["task-subagent"]);return this.getTools(q)},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function Qy(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(QN0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function BI(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(Qy(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=l$4(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(Qy(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(Qy(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Qy(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Qy(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===K7||J.name===gV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function Zq1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Yy.toString()}. Try again with a valid tool name.`}function l$4(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function qq1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var JN0,QN0,d$4,$q1="invalid_tool",Yy,XN0,UI,c$4;var h7=N1(()=>{s0();N0();gi();l$();pV();eB0();L4();JN0=D6(m6(),1),QN0=D6(SM(),1);d$4={dispose(){}};Yy=/^[-a-zA-Z0-9_]{1,64}$/,XN0=JN0.metrics.getMeter("tool_service"),UI=XN0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),c$4=XN0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var KN0=h((qN0)=>{Object.defineProperty(qN0,"__esModule",{value:!0});qN0.calcSlices=qN0.applyPatch=qN0.calcPatch=qN0.lcs=qN0.diff=qN0.diff_core=void 0;function i$4(J,Q){let{b:Y,eq:X,stack_base:G}=J,{i:Z,N:q,j:V,M:K,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(q>0&&K>0){Y.fill(0,0,2*W);let z=q-K,U=q+K,N=U&1,M=Z+q-1,L=V+K-1,A=(U+N)/2,E;Q:for(let P=0;P<=A;P++){let I=2*Math.max(0,P-K)-P,T=P-2*Math.max(0,P-q);for(let S=I;S<=T;S+=2){let k=Y[S-1-W*Math.floor((S-1)/W)],x=Y[S+1-W*Math.floor((S+1)/W)],b=S===-P||S!==P&&k<x?x:k+1,p=b-S,g=b,i=p;while(g<q&&i<K&&X(Z+g,V+i))g++,i++;if(Y[S-W*Math.floor(S/W)]=g,N===1&&(E=z-S)>=1-P&&E<P&&g+Y[W+E-W*Math.floor(E/W)]>=q)if(P>1||g!==b){G[H++]=Z+g,G[H++]=q-g,G[H++]=V+i,G[H++]=K-i,q=b,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let S=I;S<=T;S+=2){let k=Y[W+S-1-W*Math.floor((S-1)/W)],x=Y[W+S+1-W*Math.floor((S+1)/W)],b=S===-P||S!==P&&k<x?x:k+1,p=b-S,g=b,i=p;while(g<q&&i<K&&X(M-g,L-i))g++,i++;if(Y[W+S-W*Math.floor(S/W)]=g,N===0&&(E=z-S)>=-P&&E<=P&&g+Y[E-W*Math.floor(E/W)]>=q)if(P>0||g!==b){G[H++]=Z+q-b,G[H++]=b,G[H++]=V+K-p,G[H++]=p,q=q-g,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 GN0{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=i$4(J,this.c);if(this.c=Y,Y===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function ZN0(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 GN0({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:[]})}qN0.diff_core=ZN0;function pi(J,Q,Y){let[X,G,Z]=[0,J.length,Q.length];if(typeof Y==="function"){while(X<G&&X<Z&&Y(X,X))X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(Y(--G,--Z)&&G>X&&Z>X);}else{while(X<G&&X<Z&&J[X]===Q[X])X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(J[--G]===Q[--Z]&&G>X&&Z>X);Y=(q,V)=>J[q]===Q[V]}return ZN0(X,G+1-X,X,Z+1-X,Y)}qN0.diff=pi;class $N0{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 n$4(J,Q,Y){return new $N0(pi(J,Q,Y),J.length)}qN0.lcs=n$4;function*a$4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of pi(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}qN0.calcPatch=a$4;function*o$4(J,Q){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,Z,q]of Q){if(Y<G)yield X.call(J,Y,G);if(q.length>0)yield q;Y=Z}if(Y<J.length)yield X.call(J,Y)}qN0.applyPatch=o$4;function*r$4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of pi(J,Q,Y)){if(X<Z)yield[0,G.call(J,X,Z)];if(Z<q)yield[-1,G.call(J,Z,q)];if(V<K)yield[1,G.call(Q,V,K)];X=q}if(X<J.length)yield[0,J.slice(X)]}qN0.calcSlices=r$4});function NI(J,Q){let Y={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Y;if(J===Q)return Y;try{let X={added:0,deleted:0,changed:0};for(let[G,Z,q,V]of WN0.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 OU0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=BM.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function wU0(J){return BM.extname(J).toLowerCase()===".md"}function EU0(J){let Q=J.replace(/\\/g,"/"),Y=BM.basename(Q);return BM.basename(Y,BM.extname(Y))}function IU0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var PU0=()=>{};var jU0={};J9(jU0,{CommandDiscovery:()=>CU0});import*as TU0 from"node:fs";import{promises as qi}from"node:fs";import{homedir as RU0}from"node:os";import*as wX from"node:path";function K$1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class CU0{config;workspaceRoots;watchFactory;debounceMs;changes=new c4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??eX4,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(v.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return v.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=o0.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=u0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await K$1(qi.access(Y),V$1,"directory access")}catch{return[]}let G=(await K$1(qi.readdir(Y,{withFileTypes:!0}),V$1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=wX.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return v.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return v.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 qi.stat(J),X=wX.basename(J);if(this.ignoreCommandName(X))return null;let G=EU0(X);if(!IU0(G))return v.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(wU0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return v.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:wX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=wX.basename(J),Z=OU0(Q.mode,G),q=await AU0(J),V=wX.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return v.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:wX.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 wX.join(RU0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=pF||wX.join(RU0(),".config");return wX.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=o0.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 K$1(qi.access(J),V$1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{v.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{v.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),v.debug("Started watching command directory",{directory:J})}catch(Q){v.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){v.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());v.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){v.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),v.debug("Stopped watching command directory",{directory:J})}catch(Y){v.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){v.warn("Error during command discovery cleanup",{error:J})}}}var V$1=5000,eX4=(J,Q)=>TU0.watch(J,Q);var SU0=N1(()=>{Q4();s0();kE();N0();PU0()});function c9(J,Q,Y=Q+"s"){return J===1?Q:Y}function aF(J){let Q=typeof J==="string"?J:J.toString();return Q===RY||Q===RY.slice(0,-1)}function uE(J){return aF(J)?RY:J}var MG4,RY,LG4,wc8;var oF=N1(()=>{MG4=new URL("https://ampcode.com/"),RY=MG4.toString(),LG4=new URL("https://api.anthropic.com/"),wc8=LG4.toString()});var M9,O$1,x6,vV=(J)=>{switch(typeof J){case"undefined":return x6.undefined;case"string":return x6.string;case"number":return Number.isNaN(J)?x6.nan:x6.number;case"boolean":return x6.boolean;case"function":return x6.function;case"bigint":return x6.bigint;case"symbol":return x6.symbol;case"object":if(Array.isArray(J))return x6.array;if(J===null)return x6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return x6.promise;if(typeof Map<"u"&&J instanceof Map)return x6.map;if(typeof Set<"u"&&J instanceof Set)return x6.set;if(typeof Date<"u"&&J instanceof Date)return x6.date;return x6.object;default:return x6.unknown}};var xk=N1(()=>{(function(J){J.assertEqual=(G)=>{};function Q(G){}J.assertIs=Q;function Y(G){throw Error()}J.assertNever=Y,J.arrayToEnum=(G)=>{let Z={};for(let q of G)Z[q]=q;return Z},J.getValidEnumValues=(G)=>{let Z=J.objectKeys(G).filter((V)=>typeof G[G[V]]!=="number"),q={};for(let V of Z)q[V]=G[V];return J.objectValues(q)},J.objectValues=(G)=>{return J.objectKeys(G).map(function(Z){return G[Z]})},J.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let Z=[];for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q))Z.push(q);return Z},J.find=(G,Z)=>{for(let q of G)if(Z(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function X(G,Z=" | "){return G.map((q)=>typeof q==="string"?`'${q}'`:q).join(Z)}J.joinValues=X,J.jsonStringifyReplacer=(G,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(M9||(M9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(O$1||(O$1={}));x6=M9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var F6,AG4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},TY;var zi=N1(()=>{xk();F6=M9.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"]);TY=class TY 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 TY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M9.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()}};TY.create=(J)=>{return new TY(J)}});var OG4=(J,Q)=>{let Y;switch(J.code){case F6.invalid_type:if(J.received===x6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case F6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,M9.jsonStringifyReplacer)}`;break;case F6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${M9.joinValues(J.keys,", ")}`;break;case F6.invalid_union:Y="Invalid input";break;case F6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${M9.joinValues(J.options)}`;break;case F6.invalid_enum_value:Y=`Invalid enum value. Expected ${M9.joinValues(J.options)}, received '${J.received}'`;break;case F6.invalid_arguments:Y="Invalid function arguments";break;case F6.invalid_return_type:Y="Invalid function return type";break;case F6.invalid_date:Y="Invalid date";break;case F6.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 M9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case F6.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 F6.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 F6.custom:Y="Invalid input";break;case F6.invalid_intersection_types:Y="Intersection results could not be merged";break;case F6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case F6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,M9.assertNever(J)}return{message:Y}},YH;var w$1=N1(()=>{zi();xk();YH=OG4});function wG4(J){mU0=J}function pE(){return mU0}var mU0;var Fi=N1(()=>{w$1();mU0=YH});function r6(J,Q){let Y=pE(),X=vk({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===YH?void 0:YH].filter((G)=>!!G)});J.common.issues.push(X)}class KJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Y=[];for(let X of Q){if(X.status==="aborted")return t4;if(X.status==="dirty")J.dirty();Y.push(X.value)}return{status:J.value,value:Y}}static async mergeObjectAsync(J,Q){let Y=[];for(let X of Q){let G=await X.key,Z=await X.value;Y.push({key:G,value:Z})}return KJ.mergeObjectSync(J,Y)}static mergeObjectSync(J,Q){let Y={};for(let X of Q){let{key:G,value:Z}=X;if(G.status==="aborted")return t4;if(Z.status==="aborted")return t4;if(G.status==="dirty")J.dirty();if(Z.status==="dirty")J.dirty();if(G.value!=="__proto__"&&(typeof Z.value<"u"||X.alwaysSet))Y[G.value]=Z.value}return{status:J.value,value:Y}}}var vk=(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}},EG4,t4,DM=(J)=>({status:"dirty",value:J}),QQ=(J)=>({status:"valid",value:J}),Ui=(J)=>J.status==="aborted",Bi=(J)=>J.status==="dirty",rF=(J)=>J.status==="valid",dE=(J)=>typeof Promise<"u"&&J instanceof Promise;var E$1=N1(()=>{Fi();w$1();EG4=[];t4=Object.freeze({status:"aborted"})});var uU0=()=>{};var A4;var pU0=N1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(A4||(A4={}))});class p${constructor(J,Q,Y,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Y,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function k8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Y,required_error:X,description:G}=J;if(Q&&(Y||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(q,V)=>{let{message:K}=J;if(q.code==="invalid_enum_value")return{message:K??V.defaultError};if(typeof V.data>"u")return{message:K??X??V.defaultError};if(q.code!=="invalid_type")return{message:V.defaultError};return{message:K??Y??V.defaultError}},description:G}}class Q9{get description(){return this._def.description}_getType(J){return vV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:vV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new KJ,ctx:{common:J.parent.common,data:J.data,parsedType:vV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(dE(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:vV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return dU0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:vV(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:vV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(dE(X)?X:Promise.resolve(X));return dU0(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:F6.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 d$({schema:this,typeName:V8.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 u$.create(this,this._def)}nullable(){return GH.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return m$.create(this)}promise(){return OM.create(this,this._def)}or(J){return oE.create([this,J],this._def)}and(J){return rE.create(this,J,this._def)}transform(J){return new d$({...k8(this._def),schema:this,typeName:V8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new JI({...k8(this._def),innerType:this,defaultValue:Q,typeName:V8.ZodDefault})}brand(){return new Di({typeName:V8.ZodBranded,type:this,...k8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new QI({...k8(this._def),innerType:this,catchValue:Q,typeName:V8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return uk.create(this,J)}readonly(){return YI.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function iU0(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 mG4(J){return new RegExp(`^${iU0(J)}$`)}function nU0(J){let Q=`${lU0}T${iU0(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 uG4(J,Q){if((Q==="v4"||!Q)&&yG4.test(J))return!0;if((Q==="v6"||!Q)&&vG4.test(J))return!0;return!1}function pG4(J,Q){if(!jG4.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 dG4(J,Q){if((Q==="v4"||!Q)&&xG4.test(J))return!0;if((Q==="v6"||!Q)&&fG4.test(J))return!0;return!1}function cG4(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 cE(J){if(J instanceof f7){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=u$.create(cE(X))}return new f7({...J._def,shape:()=>Q})}else if(J instanceof m$)return new m$({...J._def,type:cE(J.element)});else if(J instanceof u$)return u$.create(cE(J.unwrap()));else if(J instanceof GH)return GH.create(cE(J.unwrap()));else if(J instanceof hV)return hV.create(J.items.map((Q)=>cE(Q)));else return J}function P$1(J,Q){let Y=vV(J),X=vV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===x6.object&&X===x6.object){let G=M9.objectKeys(Q),Z=M9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=P$1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===x6.array&&X===x6.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=P$1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===x6.date&&X===x6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function aU0(J,Q){return new JU({values:J,typeName:V8.ZodEnum,...k8(Q)})}function cU0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function oU0(J,Q={},Y){if(J)return LM.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=cU0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=cU0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return LM.create()}var dU0=(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 TY(J.common.issues);return this._error=Y,this._error}}}},IG4,PG4,RG4,TG4,CG4,jG4,SG4,_G4,kG4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",I$1,yG4,xG4,vG4,fG4,hG4,bG4,lU0="((\\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])))",gG4,g$,tF,eF,iE,MM,fk,nE,aE,LM,sF,fV,hk,m$,f7,oE,XH=(J)=>{if(J instanceof sE)return XH(J.schema);else if(J instanceof d$)return XH(J.innerType());else if(J instanceof tE)return[J.value];else if(J instanceof JU)return J.options;else if(J instanceof eE)return M9.objectValues(J.enum);else if(J instanceof JI)return XH(J._def.innerType);else if(J instanceof nE)return[void 0];else if(J instanceof aE)return[null];else if(J instanceof u$)return[void 0,...XH(J.unwrap())];else if(J instanceof GH)return[null,...XH(J.unwrap())];else if(J instanceof Di)return XH(J.unwrap());else if(J instanceof YI)return XH(J.unwrap());else if(J instanceof QI)return XH(J._def.innerType);else return[]},Ni,rE,hV,bk,gk,AM,lE,sE,tE,JU,eE,OM,d$,u$,GH,JI,QI,mk,lG4,Di,uk,YI,iG4,V8,nG4=(J,Q={message:`Input not instance of ${J.name}`})=>oU0((Y)=>Y instanceof J,Q),rU0,sU0,aG4,oG4,tU0,rG4,sG4,tG4,eG4,JZ4,QZ4,YZ4,XZ4,GZ4,ZZ4,$Z4,qZ4,VZ4,KZ4,WZ4,HZ4,zZ4,FZ4,UZ4,BZ4,NZ4,DZ4,MZ4,LZ4,AZ4,OZ4,wZ4,EZ4,IZ4,PZ4=()=>rU0().optional(),RZ4=()=>sU0().optional(),TZ4=()=>tU0().optional(),CZ4,jZ4;var eU0=N1(()=>{zi();Fi();pU0();E$1();xk();IG4=/^c[^\s-]{8,}$/i,PG4=/^[0-9a-z]+$/,RG4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TG4=/^[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,CG4=/^[a-z0-9_-]{21}$/i,jG4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,SG4=/^[-+]?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)?)??$/,_G4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yG4=/^(?:(?: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])$/,xG4=/^(?:(?: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])$/,vG4=/^(([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]))$/,fG4=/^(([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])$/,hG4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bG4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gG4=new RegExp(`^${lU0}$`);g$=class g$ extends Q9{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==x6.string){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_type,expected:x6.string,received:G.parsedType}),t4}let Y=new KJ,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),r6(X,{code:F6.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),r6(X,{code:F6.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)r6(X,{code:F6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)r6(X,{code:F6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!_G4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"email",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!I$1)I$1=new RegExp(kG4,"u");if(!I$1.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"emoji",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!TG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"uuid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!CG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"nanoid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!IG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!PG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid2",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!RG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ulid",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),r6(X,{validation:"url",code:F6.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),r6(X,{validation:"regex",code:F6.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),r6(X,{code:F6.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),r6(X,{code:F6.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),r6(X,{code:F6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!nU0(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:F6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!gG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:F6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!mG4(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:F6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!SG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"duration",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!uG4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ip",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!pG4(J.data,G.alg))X=this._getOrReturnCtx(J,X),r6(X,{validation:"jwt",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!dG4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cidr",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!hG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64",code:F6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!bG4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64url",code:F6.invalid_string,message:G.message}),Y.dirty()}else M9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:F6.invalid_string,...A4.errToObj(Y)})}_addCheck(J){return new g$({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...A4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...A4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...A4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...A4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...A4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...A4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...A4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...A4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...A4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...A4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...A4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...A4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...A4.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,...A4.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,...A4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...A4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...A4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...A4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...A4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...A4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...A4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...A4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...A4.errToObj(Q)})}nonempty(J){return this.min(1,A4.errToObj(J))}trim(){return new g$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new g$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new g$({...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}};g$.create=(J)=>{return new g$({checks:[],typeName:V8.ZodString,coerce:J?.coerce??!1,...k8(J)})};tF=class tF extends Q9{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)!==x6.number){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_type,expected:x6.number,received:G.parsedType}),t4}let Y=void 0,X=new KJ;for(let G of this._def.checks)if(G.kind==="int"){if(!M9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:F6.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),r6(Y,{code:F6.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),r6(Y,{code:F6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(cG4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:F6.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),r6(Y,{code:F6.not_finite,message:G.message}),X.dirty()}else M9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,A4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,A4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,A4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,A4.toString(Q))}setLimit(J,Q,Y,X){return new tF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:A4.toString(X)}]})}_addCheck(J){return new tF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:A4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:A4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:A4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A4.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"&&M9.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)}};tF.create=(J)=>{return new tF({checks:[],typeName:V8.ZodNumber,coerce:J?.coerce||!1,...k8(J)})};eF=class eF extends Q9{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)!==x6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new KJ;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),r6(Y,{code:F6.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),r6(Y,{code:F6.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),r6(Y,{code:F6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else M9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:F6.invalid_type,expected:x6.bigint,received:Q.parsedType}),t4}gte(J,Q){return this.setLimit("min",J,!0,A4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,A4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,A4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,A4.toString(Q))}setLimit(J,Q,Y,X){return new eF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:A4.toString(X)}]})}_addCheck(J){return new eF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:A4.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}};eF.create=(J)=>{return new eF({checks:[],typeName:V8.ZodBigInt,coerce:J?.coerce??!1,...k8(J)})};iE=class iE extends Q9{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==x6.boolean){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.boolean,received:Y.parsedType}),t4}return QQ(J.data)}};iE.create=(J)=>{return new iE({typeName:V8.ZodBoolean,coerce:J?.coerce||!1,...k8(J)})};MM=class MM extends Q9{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==x6.date){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_type,expected:x6.date,received:G.parsedType}),t4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return r6(G,{code:F6.invalid_date}),t4}let Y=new KJ,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),r6(X,{code:F6.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),r6(X,{code:F6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else M9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new MM({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:A4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:A4.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}};MM.create=(J)=>{return new MM({checks:[],coerce:J?.coerce||!1,typeName:V8.ZodDate,...k8(J)})};fk=class fk extends Q9{_parse(J){if(this._getType(J)!==x6.symbol){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.symbol,received:Y.parsedType}),t4}return QQ(J.data)}};fk.create=(J)=>{return new fk({typeName:V8.ZodSymbol,...k8(J)})};nE=class nE extends Q9{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.undefined,received:Y.parsedType}),t4}return QQ(J.data)}};nE.create=(J)=>{return new nE({typeName:V8.ZodUndefined,...k8(J)})};aE=class aE extends Q9{_parse(J){if(this._getType(J)!==x6.null){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.null,received:Y.parsedType}),t4}return QQ(J.data)}};aE.create=(J)=>{return new aE({typeName:V8.ZodNull,...k8(J)})};LM=class LM extends Q9{constructor(){super(...arguments);this._any=!0}_parse(J){return QQ(J.data)}};LM.create=(J)=>{return new LM({typeName:V8.ZodAny,...k8(J)})};sF=class sF extends Q9{constructor(){super(...arguments);this._unknown=!0}_parse(J){return QQ(J.data)}};sF.create=(J)=>{return new sF({typeName:V8.ZodUnknown,...k8(J)})};fV=class fV extends Q9{_parse(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:F6.invalid_type,expected:x6.never,received:Q.parsedType}),t4}};fV.create=(J)=>{return new fV({typeName:V8.ZodNever,...k8(J)})};hk=class hk extends Q9{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.void,received:Y.parsedType}),t4}return QQ(J.data)}};hk.create=(J)=>{return new hk({typeName:V8.ZodVoid,...k8(J)})};m$=class m$ extends Q9{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==x6.array)return r6(Q,{code:F6.invalid_type,expected:x6.array,received:Q.parsedType}),t4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)r6(Q,{code:Z?F6.too_big:F6.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)r6(Q,{code:F6.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)r6(Q,{code:F6.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 p$(Q,Z,Q.path,q))})).then((Z)=>{return KJ.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new p$(Q,Z,Q.path,q))});return KJ.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new m$({...this._def,minLength:{value:J,message:A4.toString(Q)}})}max(J,Q){return new m$({...this._def,maxLength:{value:J,message:A4.toString(Q)}})}length(J,Q){return new m$({...this._def,exactLength:{value:J,message:A4.toString(Q)}})}nonempty(J){return this.min(1,J)}};m$.create=(J,Q)=>{return new m$({type:J,minLength:null,maxLength:null,exactLength:null,typeName:V8.ZodArray,...k8(Q)})};f7=class f7 extends Q9{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=M9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==x6.object){let K=this._getOrReturnCtx(J);return r6(K,{code:F6.invalid_type,expected:x6.object,received:K.parsedType}),t4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof fV&&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 p$(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof fV){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)r6(X,{code:F6.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 p$(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 KJ.mergeObjectSync(Y,K)});else return KJ.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return A4.errToObj,new f7({...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:A4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new f7({...this._def,unknownKeys:"strip"})}passthrough(){return new f7({...this._def,unknownKeys:"passthrough"})}extend(J){return new f7({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new f7({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:V8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new f7({...this._def,catchall:J})}pick(J){let Q={};for(let Y of M9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new f7({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of M9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new f7({...this._def,shape:()=>Q})}deepPartial(){return cE(this)}partial(J){let Q={};for(let Y of M9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new f7({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of M9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof u$)G=G._def.innerType;Q[Y]=G}return new f7({...this._def,shape:()=>Q})}keyof(){return aU0(M9.objectKeys(this.shape))}};f7.create=(J,Q)=>{return new f7({shape:()=>J,unknownKeys:"strip",catchall:fV.create(),typeName:V8.ZodObject,...k8(Q)})};f7.strictCreate=(J,Q)=>{return new f7({shape:()=>J,unknownKeys:"strict",catchall:fV.create(),typeName:V8.ZodObject,...k8(Q)})};f7.lazycreate=(J,Q)=>{return new f7({shape:J,unknownKeys:"strip",catchall:fV.create(),typeName:V8.ZodObject,...k8(Q)})};oE=class oE extends Q9{_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 TY(q.ctx.common.issues));return r6(Q,{code:F6.invalid_union,unionErrors:Z}),t4}if(Q.common.async)return Promise.all(Y.map(async(G)=>{let Z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:Z}),ctx:Z}})).then(X);else{let G=void 0,Z=[];for(let V of Y){let K={...Q,common:{...Q.common,issues:[]},parent:null},W=V._parseSync({data:Q.data,path:Q.path,parent:K});if(W.status==="valid")return W;else if(W.status==="dirty"&&!G)G={result:W,ctx:K};if(K.common.issues.length)Z.push(K.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let q=Z.map((V)=>new TY(V));return r6(Q,{code:F6.invalid_union,unionErrors:q}),t4}}get options(){return this._def.options}};oE.create=(J,Q)=>{return new oE({options:J,typeName:V8.ZodUnion,...k8(Q)})};Ni=class Ni extends Q9{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.object)return r6(Q,{code:F6.invalid_type,expected:x6.object,received:Q.parsedType}),t4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return r6(Q,{code:F6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),t4;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Y){let X=new Map;for(let G of Q){let Z=XH(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 Ni({typeName:V8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...k8(Y)})}};rE=class rE extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(Ui(G)||Ui(Z))return t4;let q=P$1(G.value,Z.value);if(!q.valid)return r6(Y,{code:F6.invalid_intersection_types}),t4;if(Bi(G)||Bi(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}))}};rE.create=(J,Q,Y)=>{return new rE({left:J,right:Q,typeName:V8.ZodIntersection,...k8(Y)})};hV=class hV extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.array)return r6(Y,{code:F6.invalid_type,expected:x6.array,received:Y.parsedType}),t4;if(Y.data.length<this._def.items.length)return r6(Y,{code:F6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t4;if(!this._def.rest&&Y.data.length>this._def.items.length)r6(Y,{code:F6.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 p$(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return KJ.mergeArray(Q,Z)});else return KJ.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new hV({...this._def,rest:J})}};hV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new hV({items:J,typeName:V8.ZodTuple,rest:null,...k8(Q)})};bk=class bk extends Q9{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!==x6.object)return r6(Y,{code:F6.invalid_type,expected:x6.object,received:Y.parsedType}),t4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new p$(Y,q,Y.path,q)),value:Z._parse(new p$(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return KJ.mergeObjectAsync(Q,X);else return KJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof Q9)return new bk({keyType:J,valueType:Q,typeName:V8.ZodRecord,...k8(Y)});return new bk({keyType:g$.create(),valueType:J,typeName:V8.ZodRecord,...k8(Q)})}};gk=class gk extends Q9{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!==x6.map)return r6(Y,{code:F6.invalid_type,expected:x6.map,received:Y.parsedType}),t4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new p$(Y,q,Y.path,[K,"key"])),value:G._parse(new p$(Y,V,Y.path,[K,"value"]))}});if(Y.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let V of Z){let K=await V.key,W=await V.value;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let V of Z){let{key:K,value:W}=V;if(K.status==="aborted"||W.status==="aborted")return t4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};gk.create=(J,Q,Y)=>{return new gk({valueType:Q,keyType:J,typeName:V8.ZodMap,...k8(Y)})};AM=class AM extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.set)return r6(Y,{code:F6.invalid_type,expected:x6.set,received:Y.parsedType}),t4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)r6(Y,{code:F6.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)r6(Y,{code:F6.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let G=this._def.valueType;function Z(V){let K=new Set;for(let W of V){if(W.status==="aborted")return t4;if(W.status==="dirty")Q.dirty();K.add(W.value)}return{status:Q.value,value:K}}let q=[...Y.data.values()].map((V,K)=>G._parse(new p$(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 AM({...this._def,minSize:{value:J,message:A4.toString(Q)}})}max(J,Q){return new AM({...this._def,maxSize:{value:J,message:A4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};AM.create=(J,Q)=>{return new AM({valueType:J,minSize:null,maxSize:null,typeName:V8.ZodSet,...k8(Q)})};lE=class lE extends Q9{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.function)return r6(Q,{code:F6.invalid_type,expected:x6.function,received:Q.parsedType}),t4;function Y(q,V){return vk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,pE(),YH].filter((K)=>!!K),issueData:{code:F6.invalid_arguments,argumentsError:V}})}function X(q,V){return vk({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,pE(),YH].filter((K)=>!!K),issueData:{code:F6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof OM){let q=this;return QQ(async function(...V){let K=new TY([]),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 QQ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new TY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new TY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new lE({...this._def,args:hV.create(J).rest(sF.create())})}returns(J){return new lE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new lE({args:J?J:hV.create([]).rest(sF.create()),returns:Q||sF.create(),typeName:V8.ZodFunction,...k8(Y)})}};sE=class sE extends Q9{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})}};sE.create=(J,Q)=>{return new sE({getter:J,typeName:V8.ZodLazy,...k8(Q)})};tE=class tE extends Q9{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return r6(Q,{received:Q.data,code:F6.invalid_literal,expected:this._def.value}),t4}return{status:"valid",value:J.data}}get value(){return this._def.value}};tE.create=(J,Q)=>{return new tE({value:J,typeName:V8.ZodLiteral,...k8(Q)})};JU=class JU extends Q9{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{expected:M9.joinValues(Y),received:Q.parsedType,code:F6.invalid_type}),t4}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{received:Q.data,code:F6.invalid_enum_value,options:Y}),t4}return QQ(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 JU.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return JU.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};JU.create=aU0;eE=class eE extends Q9{_parse(J){let Q=M9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==x6.string&&Y.parsedType!==x6.number){let X=M9.objectValues(Q);return r6(Y,{expected:M9.joinValues(X),received:Y.parsedType,code:F6.invalid_type}),t4}if(!this._cache)this._cache=new Set(M9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=M9.objectValues(Q);return r6(Y,{received:Y.data,code:F6.invalid_enum_value,options:X}),t4}return QQ(J.data)}get enum(){return this._def.values}};eE.create=(J,Q)=>{return new eE({values:J,typeName:V8.ZodNativeEnum,...k8(Q)})};OM=class OM extends Q9{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.promise&&Q.common.async===!1)return r6(Q,{code:F6.invalid_type,expected:x6.promise,received:Q.parsedType}),t4;let Y=Q.parsedType===x6.promise?Q.data:Promise.resolve(Q.data);return QQ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};OM.create=(J,Q)=>{return new OM({type:J,typeName:V8.ZodPromise,...k8(Q)})};d$=class d$ extends Q9{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V8.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(r6(Y,Z),Z.fatal)Q.abort();else Q.dirty()},get path(){return Y.path}};if(G.addIssue=G.addIssue.bind(G),X.type==="preprocess"){let Z=X.transform(Y.data,G);if(Y.common.async)return Promise.resolve(Z).then(async(q)=>{if(Q.value==="aborted")return t4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return t4;if(V.status==="dirty")return DM(V.value);if(Q.value==="dirty")return DM(V.value);return V});else{if(Q.value==="aborted")return t4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")return DM(q.value);if(Q.value==="dirty")return DM(q.value);return q}}if(X.type==="refinement"){let Z=(q)=>{let V=X.refinement(q,G);if(Y.common.async)return Promise.resolve(V);if(V instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Y.common.async===!1){let q=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((q)=>{if(q.status==="aborted")return t4;if(q.status==="dirty")Q.dirty();return Z(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Y.common.async===!1){let Z=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!rF(Z))return t4;let q=X.transform(Z.value,G);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((Z)=>{if(!rF(Z))return t4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});M9.assertNever(X)}};d$.create=(J,Q,Y)=>{return new d$({schema:J,typeName:V8.ZodEffects,effect:Q,...k8(Y)})};d$.createWithPreprocess=(J,Q,Y)=>{return new d$({schema:Q,effect:{type:"preprocess",transform:J},typeName:V8.ZodEffects,...k8(Y)})};u$=class u$ extends Q9{_parse(J){if(this._getType(J)===x6.undefined)return QQ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};u$.create=(J,Q)=>{return new u$({innerType:J,typeName:V8.ZodOptional,...k8(Q)})};GH=class GH extends Q9{_parse(J){if(this._getType(J)===x6.null)return QQ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};GH.create=(J,Q)=>{return new GH({innerType:J,typeName:V8.ZodNullable,...k8(Q)})};JI=class JI extends Q9{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===x6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};JI.create=(J,Q)=>{return new JI({innerType:J,typeName:V8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...k8(Q)})};QI=class QI extends Q9{_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(dE(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new TY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new TY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};QI.create=(J,Q)=>{return new QI({innerType:J,typeName:V8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...k8(Q)})};mk=class mk extends Q9{_parse(J){if(this._getType(J)!==x6.nan){let Y=this._getOrReturnCtx(J);return r6(Y,{code:F6.invalid_type,expected:x6.nan,received:Y.parsedType}),t4}return{status:"valid",value:J.data}}};mk.create=(J)=>{return new mk({typeName:V8.ZodNaN,...k8(J)})};lG4=Symbol("zod_brand");Di=class Di extends Q9{_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}};uk=class uk extends Q9{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return t4;if(G.status==="dirty")return Q.dirty(),DM(G.value);else return this._def.out._parseAsync({data:G.value,path:Y.path,parent:Y})})();else{let X=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(X.status==="aborted")return t4;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Y.path,parent:Y})}}static create(J,Q){return new uk({in:J,out:Q,typeName:V8.ZodPipeline})}};YI=class YI extends Q9{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(rF(X))X.value=Object.freeze(X.value);return X};return dE(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};YI.create=(J,Q)=>{return new YI({innerType:J,typeName:V8.ZodReadonly,...k8(Q)})};iG4={object:f7.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"})(V8||(V8={}));rU0=g$.create,sU0=tF.create,aG4=mk.create,oG4=eF.create,tU0=iE.create,rG4=MM.create,sG4=fk.create,tG4=nE.create,eG4=aE.create,JZ4=LM.create,QZ4=sF.create,YZ4=fV.create,XZ4=hk.create,GZ4=m$.create,ZZ4=f7.create,$Z4=f7.strictCreate,qZ4=oE.create,VZ4=Ni.create,KZ4=rE.create,WZ4=hV.create,HZ4=bk.create,zZ4=gk.create,FZ4=AM.create,UZ4=lE.create,BZ4=sE.create,NZ4=tE.create,DZ4=JU.create,MZ4=eE.create,LZ4=OM.create,AZ4=d$.create,OZ4=u$.create,wZ4=GH.create,EZ4=d$.createWithPreprocess,IZ4=uk.create,CZ4={string:(J)=>g$.create({...J,coerce:!0}),number:(J)=>tF.create({...J,coerce:!0}),boolean:(J)=>iE.create({...J,coerce:!0}),bigint:(J)=>eF.create({...J,coerce:!0}),date:(J)=>MM.create({...J,coerce:!0})},jZ4=t4});var n={};J9(n,{void:()=>XZ4,util:()=>M9,unknown:()=>QZ4,union:()=>qZ4,undefined:()=>tG4,tuple:()=>WZ4,transformer:()=>AZ4,symbol:()=>sG4,string:()=>rU0,strictObject:()=>$Z4,setErrorMap:()=>wG4,set:()=>FZ4,record:()=>HZ4,quotelessJson:()=>AG4,promise:()=>LZ4,preprocess:()=>EZ4,pipeline:()=>IZ4,ostring:()=>PZ4,optional:()=>OZ4,onumber:()=>RZ4,oboolean:()=>TZ4,objectUtil:()=>O$1,object:()=>ZZ4,number:()=>sU0,nullable:()=>wZ4,null:()=>eG4,never:()=>YZ4,nativeEnum:()=>MZ4,nan:()=>aG4,map:()=>zZ4,makeIssue:()=>vk,literal:()=>NZ4,lazy:()=>BZ4,late:()=>iG4,isValid:()=>rF,isDirty:()=>Bi,isAsync:()=>dE,isAborted:()=>Ui,intersection:()=>KZ4,instanceof:()=>nG4,getParsedType:()=>vV,getErrorMap:()=>pE,function:()=>UZ4,enum:()=>DZ4,effect:()=>AZ4,discriminatedUnion:()=>VZ4,defaultErrorMap:()=>YH,datetimeRegex:()=>nU0,date:()=>rG4,custom:()=>oU0,coerce:()=>CZ4,boolean:()=>tU0,bigint:()=>oG4,array:()=>GZ4,any:()=>JZ4,addIssueToContext:()=>r6,ZodVoid:()=>hk,ZodUnknown:()=>sF,ZodUnion:()=>oE,ZodUndefined:()=>nE,ZodType:()=>Q9,ZodTuple:()=>hV,ZodTransformer:()=>d$,ZodSymbol:()=>fk,ZodString:()=>g$,ZodSet:()=>AM,ZodSchema:()=>Q9,ZodRecord:()=>bk,ZodReadonly:()=>YI,ZodPromise:()=>OM,ZodPipeline:()=>uk,ZodParsedType:()=>x6,ZodOptional:()=>u$,ZodObject:()=>f7,ZodNumber:()=>tF,ZodNullable:()=>GH,ZodNull:()=>aE,ZodNever:()=>fV,ZodNativeEnum:()=>eE,ZodNaN:()=>mk,ZodMap:()=>gk,ZodLiteral:()=>tE,ZodLazy:()=>sE,ZodIssueCode:()=>F6,ZodIntersection:()=>rE,ZodFunction:()=>lE,ZodFirstPartyTypeKind:()=>V8,ZodError:()=>TY,ZodEnum:()=>JU,ZodEffects:()=>d$,ZodDiscriminatedUnion:()=>Ni,ZodDefault:()=>JI,ZodDate:()=>MM,ZodCatch:()=>QI,ZodBranded:()=>Di,ZodBoolean:()=>iE,ZodBigInt:()=>eF,ZodArray:()=>m$,ZodAny:()=>LM,Schema:()=>Q9,ParseStatus:()=>KJ,OK:()=>QQ,NEVER:()=>jZ4,INVALID:()=>t4,EMPTY_PATH:()=>EG4,DIRTY:()=>DM,BRAND:()=>lG4});var R$1=N1(()=>{Fi();E$1();uU0();xk();eU0();zi()});var XI=N1(()=>{R$1();R$1()});function YQ(J,Q){let Y=kZ4(J,Q);return typeof Y==="string"?Y:Y.toString()}function kZ4(J,Q,Y=!0){if(!Q)Q=yZ4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?u0.parse(J):u0.from(J);if(X)for(let V of X){let K=d4(V);if(o0.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?FM(K.path)+(G?"\\":"/"):"";return C$1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=d4(Z);if(o0.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return C$1("~"+(G?"\\":"/")+W,G,q.scheme)}}return C$1(q.fsPath,G,q.scheme)}return q}function C$1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function Li(J){let Q=Mi;return Mi=J,Q}function yZ4(){if(Mi)return Mi;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Mi=null;var ZH=N1(()=>{Q4();fE();Ji()});var xZ4=(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},ZI=(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),ZI(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),ZI(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),ZI(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),ZI(J);break;case"delimiter":return J=J.slice(0,J.length-1),ZI(J);break}return J},vZ4=(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},fZ4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},tG=(J)=>JSON.parse(fZ4(vZ4(ZI(xZ4(J)))));var wM=()=>{};function XQ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function PM(J){return!!J&&!!J[IX]}function YU(J){if(!J)return!1;return ZB0(J)||Array.isArray(J)||!!J[pk]||!!J.constructor?.[pk]||nk(J)||ak(J)}function ZB0(J){if(!J||typeof J!=="object")return!1;let Q=IM(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)===hZ4}function dk(J,Q){if(RM(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function RM(J){let Q=J[IX];return Q?Q.type_:Array.isArray(J)?1:nk(J)?2:ak(J)?3:0}function ck(J,Q){return RM(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function j$1(J,Q){return RM(J)===2?J.get(Q):J[Q]}function $B0(J,Q,Y){let X=RM(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function bZ4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function nk(J){return J instanceof Map}function ak(J){return J instanceof Set}function EM(J){return J.copy_||J.base_}function k$1(J,Q){if(nk(J))return new Map(J);if(ak(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=ZB0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[IX];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(IM(J),X)}else{let X=IM(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function RX(J,Q=!1){if(wi(J)||PM(J)||!YU(J))return J;if(RM(J)>1)J.set=J.add=J.clear=J.delete=gZ4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>RX(X,!0));return J}function gZ4(){XQ(2)}function wi(J){return Object.isFrozen(J)}function TM(J){let Q=y$1[J];if(!Q)XQ(0,J);return Q}function mZ4(J,Q){if(!y$1[J])y$1[J]=Q}function qB0(){return lk}function uZ4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function QB0(J,Q){if(Q)TM("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function x$1(J){v$1(J),J.drafts_.forEach(pZ4),J.drafts_=null}function v$1(J){if(J===lk)lk=J.parent_}function YB0(J){return lk=uZ4(lk,J)}function pZ4(J){let Q=J[IX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function XB0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[IX].modified_)x$1(Q),XQ(4);if(YU(J)){if(J=Ai(Q,J),!Q.parent_)Oi(Q,J)}if(Q.patches_)TM("Patches").generateReplacementPatches_(Y[IX].base_,J,Q.patches_,Q.inversePatches_)}else J=Ai(Q,Y,[]);if(x$1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==b$1?J:void 0}function Ai(J,Q,Y){if(wi(Q))return Q;let X=Q[IX];if(!X)return dk(Q,(G,Z)=>GB0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Oi(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(dk(Z,(V,K)=>GB0(J,X,G,V,K,Y,q)),Oi(J,G,!1),Y&&J.patches_)TM("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function GB0(J,Q,Y,X,G,Z,q){if(PM(G)){let V=Z&&Q&&Q.type_!==3&&!ck(Q.assigned_,X)?Z.concat(X):void 0,K=Ai(J,G,V);if($B0(Y,X,K),PM(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(YU(G)&&!wi(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Ai(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))Oi(J,G)}}function Oi(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)RX(Q,Y)}function dZ4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:qB0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=g$1;if(Y)G=[X],Z=ik;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function S$1(J,Q){let Y=J[IX];return(Y?EM(Y):J)[Q]}function cZ4(J,Q,Y){let X=VB0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function VB0(J,Q){if(!(Q in J))return;let Y=IM(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=IM(Y)}return}function f$1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)f$1(J.parent_)}}function _$1(J){if(!J.copy_)J.copy_=k$1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function h$1(J,Q){let Y=nk(J)?TM("MapSet").proxyMap_(J,Q):ak(J)?TM("MapSet").proxySet_(J,Q):dZ4(J,Q);return(Q?Q.scope_:qB0()).drafts_.push(Y),Y}function iZ4(J){if(!PM(J))XQ(10,J);return KB0(J)}function KB0(J){if(!YU(J)||wi(J))return J;let Q=J[IX],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=k$1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=k$1(J,!0);if(dk(Y,(X,G)=>{$B0(Y,X,KB0(G))}),Q)Q.finalized_=!1;return Y}function Ei(){let Q="replace",Y="add",X="remove";function G(U,N,M,L){switch(U.type_){case 0:case 2:return q(U,N,M,L);case 1:return Z(U,N,M,L);case 3:return V(U,N,M,L)}}function Z(U,N,M,L){let{base_:A,assigned_:E}=U,P=U.copy_;if(P.length<A.length)[A,P]=[P,A],[M,L]=[L,M];for(let I=0;I<A.length;I++)if(E[I]&&P[I]!==A[I]){let T=N.concat([I]);M.push({op:Q,path:T,value:z(P[I])}),L.push({op:Q,path:T,value:z(A[I])})}for(let I=A.length;I<P.length;I++){let T=N.concat([I]);M.push({op:Y,path:T,value:z(P[I])})}for(let I=P.length-1;A.length<=I;--I){let T=N.concat([I]);L.push({op:X,path:T})}}function q(U,N,M,L){let{base_:A,copy_:E}=U;dk(U.assigned_,(P,I)=>{let T=j$1(A,P),S=j$1(E,P),k=!I?X:ck(A,P)?Q:Y;if(T===S&&k===Q)return;let x=N.concat(P);M.push(k===X?{op:k,path:x}:{op:k,path:x,value:S}),L.push(k===Y?{op:X,path:x}:k===X?{op:Y,path:x,value:z(T)}:{op:Q,path:x,value:z(T)})})}function V(U,N,M,L){let{base_:A,copy_:E}=U,P=0;A.forEach((I)=>{if(!E.has(I)){let T=N.concat([P]);M.push({op:X,path:T,value:I}),L.unshift({op:Y,path:T,value:I})}P++}),P=0,E.forEach((I)=>{if(!A.has(I)){let T=N.concat([P]);M.push({op:Y,path:T,value:I}),L.unshift({op:X,path:T,value:I})}P++})}function K(U,N,M,L){M.push({op:Q,path:[],value:N===b$1?void 0:N}),L.push({op:Q,path:[],value:U})}function W(U,N){return N.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let S=0;S<L.length-1;S++){let k=RM(E),x=L[S];if(typeof x!=="string"&&typeof x!=="number")x=""+x;if((k===0||k===1)&&(x==="__proto__"||x==="constructor"))XQ(19);if(typeof E==="function"&&x==="prototype")XQ(19);if(E=j$1(E,x),typeof E!=="object")XQ(18,L.join("/"))}let P=RM(E),I=H(M.value),T=L[L.length-1];switch(A){case Q:switch(P){case 2:return E.set(T,I);case 3:XQ(16);default:return E[T]=I}case Y:switch(P){case 1:return T==="-"?E.push(I):E.splice(T,0,I);case 2:return E.set(T,I);case 3:return E.add(I);default:return E[T]=I}case X:switch(P){case 1:return E.splice(T,1);case 2:return E.delete(T);case 3:return E.delete(M.value);default:return delete E[T]}default:XQ(17,A)}}),U}function H(U){if(!YU(U))return U;if(Array.isArray(U))return U.map(H);if(nk(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(ak(U))return new Set(Array.from(U).map(H));let N=Object.create(IM(U));for(let M in U)N[M]=H(U[M]);if(ck(U,pk))N[pk]=U[pk];return N}function z(U){if(PM(U))return H(U);else return U}mZ4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function i8(J){return J}var b$1,pk,IX,IM,hZ4,y$1,lk,g$1,ik,lZ4=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")XQ(6);if(X!==void 0&&typeof X!=="function")XQ(7);let G;if(YU(Q)){let Z=YB0(this),q=h$1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)x$1(Z);else v$1(Z)}return QB0(Z,X),XB0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===b$1)G=void 0;if(this.autoFreeze_)RX(G,!0);if(X){let Z=[],q=[];TM("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else XQ(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(!YU(J))XQ(8);if(PM(J))J=iZ4(J);let Q=YB0(this),Y=h$1(J,void 0);return Y[IX].isManual_=!0,v$1(Q),Y}finishDraft(J,Q){let Y=J&&J[IX];if(!Y||!Y.isManual_)XQ(9);let{scope_:X}=Y;return QB0(X,Q),XB0(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=TM("Patches").applyPatches_;if(PM(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},PX,XU,CM,$l8,ql8,WB0,Vl8,Kl8;var fQ=N1(()=>{b$1=Symbol.for("immer-nothing"),pk=Symbol.for("immer-draftable"),IX=Symbol.for("immer-state");IM=Object.getPrototypeOf;hZ4=Object.prototype.constructor.toString();y$1={};g$1={get(J,Q){if(Q===IX)return J;let Y=EM(J);if(!ck(Y,Q))return cZ4(J,Y,Q);let X=Y[Q];if(J.finalized_||!YU(X))return X;if(X===S$1(J.base_,Q))return _$1(J),J.copy_[Q]=h$1(X,J);return X},has(J,Q){return Q in EM(J)},ownKeys(J){return Reflect.ownKeys(EM(J))},set(J,Q,Y){let X=VB0(EM(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=S$1(EM(J),Q),Z=G?.[IX];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(bZ4(Y,G)&&(Y!==void 0||ck(J.base_,Q)))return!0;_$1(J),f$1(J)}if(J.copy_[Q]===Y&&(Y!==void 0||(Q in J.copy_))||Number.isNaN(Y)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Y,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(S$1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,_$1(J),f$1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=EM(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(){XQ(11)},getPrototypeOf(J){return IM(J.base_)},setPrototypeOf(){XQ(12)}},ik={};dk(g$1,(J,Q)=>{ik[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});ik.deleteProperty=function(J,Q){return ik.set.call(this,J,Q,void 0)};ik.set=function(J,Q,Y){return g$1.set.call(this,J[0],Q,Y,J[0])};PX=new lZ4,XU=PX.produce,CM=PX.produceWithPatches.bind(PX),$l8=PX.setAutoFreeze.bind(PX),ql8=PX.setUseStrictShallowCopy.bind(PX),WB0=PX.applyPatches.bind(PX),Vl8=PX.createDraft.bind(PX),Kl8=PX.finishDraft.bind(PX)});function m$1({onlyFirst:J=!1}={}){let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Y,J?void 0:"g")}function $I(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(nZ4,"")}var nZ4;var Ii=N1(()=>{nZ4=m$1()});var zB0=h((Bl8,u$1)=>{var GU={};if(typeof u$1>"u")window.eastasianwidth=GU;else u$1.exports=GU;GU.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"};GU.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function HB0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}GU.length=function(J){var Q=HB0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};GU.slice=function(J,Q,Y){if(textLen=GU.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=HB0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=GU.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var p$1=h((Nl8,FB0)=>{FB0.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 aZ4,oZ4;var UB0=N1(()=>{Ii();aZ4=D6(zB0(),1),oZ4=D6(p$1(),1)});function Pi(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var d$1=N1(()=>{UB0()});var BB0="run_terminal_command",c$1="read_file",WJ="Task",W9="finder",CY="get_diagnostics",l9="Bash",s5="oracle",bV="mermaid",gV="todo_read",K7="todo_write",A2="read_web_page",qI="read_thread",VI="find_thread",L5="create_file",z3="glob",Ri="undo_edit",Ti="read_mcp_resource",i6="Read",O7="edit_file",KI="format_file",b3="web_search",y8="Grep",jM="Check",TX="librarian",Ci="kraken",NB0="look_at",DB0="read_artifact",MB0="edit_artifact",ji="read_plan",WI="edit_plan",Si="read_github",_i="search_github",ki="commit_search",yi="list_directory_github",xi="list_repositories",vi="glob_github",fi="diff",LB0="bookkeeper",AB0="describe_workbook",OB0="execute_query",ok="skill",wB0;var L4=N1(()=>{wB0=["Task","finder","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","look_at","librarian","bookkeeper","read_thread","find_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var rk=h((El8,IB0)=>{var EB0={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:"/"},rZ4={...EB0,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:"\\"},sZ4={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"};IB0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:sZ4,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?rZ4:EB0}}});var sk=h((Y$4)=>{var{REGEX_BACKSLASH:tZ4,REGEX_REMOVE_BACKSLASH:eZ4,REGEX_SPECIAL_CHARS:J$4,REGEX_SPECIAL_CHARS_GLOBAL:Q$4}=rk();Y$4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);Y$4.hasRegexChars=(J)=>J$4.test(J);Y$4.isRegexChar=(J)=>J.length===1&&Y$4.hasRegexChars(J);Y$4.escapeRegex=(J)=>J.replace(Q$4,"\\$1");Y$4.toPosixSlashes=(J)=>J.replace(tZ4,"/");Y$4.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};Y$4.removeBackslashes=(J)=>{return J.replace(eZ4,(Q)=>{return Q==="\\"?"":Q})};Y$4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return Y$4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};Y$4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};Y$4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};Y$4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var xB0=h((Pl8,yB0)=>{var TB0=sk(),{CHAR_ASTERISK:l$1,CHAR_AT:z$4,CHAR_BACKWARD_SLASH:tk,CHAR_COMMA:F$4,CHAR_DOT:i$1,CHAR_EXCLAMATION_MARK:n$1,CHAR_FORWARD_SLASH:kB0,CHAR_LEFT_CURLY_BRACE:a$1,CHAR_LEFT_PARENTHESES:o$1,CHAR_LEFT_SQUARE_BRACKET:U$4,CHAR_PLUS:B$4,CHAR_QUESTION_MARK:CB0,CHAR_RIGHT_CURLY_BRACE:N$4,CHAR_RIGHT_PARENTHESES:jB0,CHAR_RIGHT_SQUARE_BRACKET:D$4}=rk(),SB0=(J)=>{return J===kB0||J===tk},_B0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},M$4=(J,Q)=>{let Y=Q||{},X=J.length-1,G=Y.parts===!0||Y.scanToEnd===!0,Z=[],q=[],V=[],K=J,W=-1,H=0,z=0,U=!1,N=!1,M=!1,L=!1,A=!1,E=!1,P=!1,I=!1,T=!1,S=!1,k=0,x,b,p={value:"",depth:0,isGlob:!1},g=()=>W>=X,i=()=>K.charCodeAt(W+1),Q1=()=>{return x=b,K.charCodeAt(++W)};while(W<X){b=Q1();let H1;if(b===tk){if(P=p.backslashes=!0,b=Q1(),b===a$1)E=!0;continue}if(E===!0||b===a$1){k++;while(g()!==!0&&(b=Q1())){if(b===tk){P=p.backslashes=!0,Q1();continue}if(b===a$1){k++;continue}if(E!==!0&&b===i$1&&(b=Q1())===i$1){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(E!==!0&&b===F$4){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(b===N$4){if(k--,k===0){E=!1,U=p.isBrace=!0,S=!0;break}}}if(G===!0)continue;break}if(b===kB0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},S===!0)continue;if(x===i$1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((b===B$4||b===z$4||b===l$1||b===CB0||b===n$1)===!0&&i()===o$1){if(M=p.isGlob=!0,L=p.isExtglob=!0,S=!0,b===n$1&&W===H)T=!0;if(G===!0){while(g()!==!0&&(b=Q1())){if(b===tk){P=p.backslashes=!0,b=Q1();continue}if(b===jB0){M=p.isGlob=!0,S=!0;break}}continue}break}}if(b===l$1){if(x===l$1)A=p.isGlobstar=!0;if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(b===CB0){if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(b===U$4){while(g()!==!0&&(H1=Q1())){if(H1===tk){P=p.backslashes=!0,Q1();continue}if(H1===D$4){N=p.isBracket=!0,M=p.isGlob=!0,S=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&b===n$1&&W===H){I=p.negated=!0,H++;continue}if(Y.noparen!==!0&&b===o$1){if(M=p.isGlob=!0,G===!0){while(g()!==!0&&(b=Q1())){if(b===o$1){P=p.backslashes=!0,b=Q1();continue}if(b===jB0){S=!0;break}}continue}break}if(M===!0){if(S=!0,G===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let o=K,u="",e="";if(H>0)u=K.slice(0,H),K=K.slice(H),z-=H;if(o&&M===!0&&z>0)o=K.slice(0,z),e=K.slice(z);else if(M===!0)o="",e=K;else o=K;if(o&&o!==""&&o!=="/"&&o!==K){if(SB0(o.charCodeAt(o.length-1)))o=o.slice(0,-1)}if(Y.unescape===!0){if(e)e=TB0.removeBackslashes(e);if(o&&P===!0)o=TB0.removeBackslashes(o)}let V1={prefix:u,input:J,start:H,base:o,glob:e,isBrace:U,isBracket:N,isGlob:M,isExtglob:L,isGlobstar:A,negated:I,negatedExtglob:T};if(Y.tokens===!0){if(V1.maxDepth=0,!SB0(b))q.push(p);V1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let H1;for(let a=0;a<Z.length;a++){let s=H1?H1+1:H,l=Z[a],K1=J.slice(s,l);if(Y.tokens){if(a===0&&H!==0)q[a].isPrefix=!0,q[a].value=u;else q[a].value=K1;_B0(q[a]),V1.maxDepth+=q[a].depth}if(a!==0||K1!=="")V.push(K1);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,_B0(q[q.length-1]),V1.maxDepth+=q[q.length-1].depth}V1.slashes=Z,V1.parts=V}return V1};yB0.exports=M$4});var hB0=h((Rl8,fB0)=>{var hi=rk(),mV=sk(),{MAX_LENGTH:bi,POSIX_REGEX_SOURCE:L$4,REGEX_NON_SPECIAL_CHARS:A$4,REGEX_SPECIAL_CHARS_BACKREF:O$4,REPLACEMENTS:vB0}=hi,w$4=(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)=>mV.escapeRegex(G)).join("..")}return Y},HI=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},r$1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=vB0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(bi,Y.maxLength):bi,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=hi.globChars(Y.windows),W=hi.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:P,QMARK_NO_DOT:I,STAR:T,START_ANCHOR:S}=K,k=(t1)=>{return`(${V}(?:(?!${S}${t1.dot?M:H}).)*?)`},x=Y.dot?"":L,b=Y.dot?P:I,p=Y.bash===!0?k(Y):T;if(Y.capture)p=`(${p})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let g={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=mV.removePrefix(J,g),G=J.length;let i=[],Q1=[],o=[],u=Z,e,V1=()=>g.index===G-1,H1=g.peek=(t1=1)=>J[g.index+t1],a=g.advance=()=>J[++g.index]||"",s=()=>J.slice(g.index+1),l=(t1="",U1=0)=>{g.consumed+=t1,g.index+=U1},K1=(t1)=>{g.output+=t1.output!=null?t1.output:t1.value,l(t1.value)},k1=()=>{let t1=1;while(H1()==="!"&&(H1(2)!=="("||H1(3)==="?"))a(),g.start++,t1++;if(t1%2===0)return!1;return g.negated=!0,g.start++,!0},J1=(t1)=>{g[t1]++,o.push(t1)},v1=(t1)=>{g[t1]--,o.pop()},I1=(t1)=>{if(u.type==="globstar"){let U1=g.braces>0&&(t1.type==="comma"||t1.type==="brace"),Y1=t1.extglob===!0||i.length&&(t1.type==="pipe"||t1.type==="paren");if(t1.type!=="slash"&&t1.type!=="paren"&&!U1&&!Y1)g.output=g.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=p,g.output+=u.output}if(i.length&&t1.type!=="paren")i[i.length-1].inner+=t1.value;if(t1.value||t1.output)K1(t1);if(u&&u.type==="text"&&t1.type==="text"){u.output=(u.output||u.value)+t1.value,u.value+=t1.value;return}t1.prev=u,q.push(t1),u=t1},A0=(t1,U1)=>{let Y1={...W[U1],conditions:1,inner:""};Y1.prev=u,Y1.parens=g.parens,Y1.output=g.output;let O1=(Y.capture?"(":"")+Y1.open;J1("parens"),I1({type:t1,value:U1,output:g.output?"":N}),I1({type:"paren",extglob:!0,value:a(),output:O1}),i.push(Y1)},T1=(t1)=>{let U1=t1.close+(Y.capture?")":""),Y1;if(t1.type==="negate"){let O1=p;if(t1.inner&&t1.inner.length>1&&t1.inner.includes("/"))O1=k(Y);if(O1!==p||V1()||/^\)+$/.test(s()))U1=t1.close=`)$))${O1}`;if(t1.inner.includes("*")&&(Y1=s())&&/^\.[^\\/.]+$/.test(Y1)){let w1=r$1(Y1,{...Q,fastpaths:!1}).output;U1=t1.close=`)${w1})${O1})`}if(t1.prev.type==="bos")g.negatedExtglob=!0}I1({type:"paren",extglob:!0,value:e,output:U1}),v1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let t1=!1,U1=J.replace(O$4,(Y1,O1,w1,P1,E1,d1)=>{if(P1==="\\")return t1=!0,Y1;if(P1==="?"){if(O1)return O1+P1+(E1?P.repeat(E1.length):"");if(d1===0)return b+(E1?P.repeat(E1.length):"");return P.repeat(w1.length)}if(P1===".")return H.repeat(w1.length);if(P1==="*"){if(O1)return O1+P1+(E1?p:"");return p}return O1?Y1:`\\${Y1}`});if(t1===!0)if(Y.unescape===!0)U1=U1.replace(/\\/g,"");else U1=U1.replace(/\\+/g,(Y1)=>{return Y1.length%2===0?"\\\\":Y1?"\\":""});if(U1===J&&Y.contains===!0)return g.output=J,g;return g.output=mV.wrapOutput(U1,g,Q),g}while(!V1()){if(e=a(),e==="\x00")continue;if(e==="\\"){let Y1=H1();if(Y1==="/"&&Y.bash!==!0)continue;if(Y1==="."||Y1===";")continue;if(!Y1){e+="\\",I1({type:"text",value:e});continue}let O1=/^\\+/.exec(s()),w1=0;if(O1&&O1[0].length>2){if(w1=O1[0].length,g.index+=w1,w1%2!==0)e+="\\"}if(Y.unescape===!0)e=a();else e+=a();if(g.brackets===0){I1({type:"text",value:e});continue}}if(g.brackets>0&&(e!=="]"||u.value==="["||u.value==="[^")){if(Y.posix!==!1&&e===":"){let Y1=u.value.slice(1);if(Y1.includes("[")){if(u.posix=!0,Y1.includes(":")){let O1=u.value.lastIndexOf("["),w1=u.value.slice(0,O1),P1=u.value.slice(O1+2),E1=L$4[P1];if(E1){if(u.value=w1+E1,g.backtrack=!0,a(),!Z.output&&q.indexOf(u)===1)Z.output=N;continue}}}}if(e==="["&&H1()!==":"||e==="-"&&H1()==="]")e=`\\${e}`;if(e==="]"&&(u.value==="["||u.value==="[^"))e=`\\${e}`;if(Y.posix===!0&&e==="!"&&u.value==="[")e="^";u.value+=e,K1({value:e});continue}if(g.quotes===1&&e!=='"'){e=mV.escapeRegex(e),u.value+=e,K1({value:e});continue}if(e==='"'){if(g.quotes=g.quotes===1?0:1,Y.keepQuotes===!0)I1({type:"text",value:e});continue}if(e==="("){J1("parens"),I1({type:"paren",value:e});continue}if(e===")"){if(g.parens===0&&Y.strictBrackets===!0)throw SyntaxError(HI("opening","("));let Y1=i[i.length-1];if(Y1&&g.parens===Y1.parens+1){T1(i.pop());continue}I1({type:"paren",value:e,output:g.parens?")":"\\)"}),v1("parens");continue}if(e==="["){if(Y.nobracket===!0||!s().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(HI("closing","]"));e=`\\${e}`}else J1("brackets");I1({type:"bracket",value:e});continue}if(e==="]"){if(Y.nobracket===!0||u&&u.type==="bracket"&&u.value.length===1){I1({type:"text",value:e,output:`\\${e}`});continue}if(g.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(HI("opening","["));I1({type:"text",value:e,output:`\\${e}`});continue}v1("brackets");let Y1=u.value.slice(1);if(u.posix!==!0&&Y1[0]==="^"&&!Y1.includes("/"))e=`/${e}`;if(u.value+=e,K1({value:e}),Y.literalBrackets===!1||mV.hasRegexChars(Y1))continue;let O1=mV.escapeRegex(u.value);if(g.output=g.output.slice(0,-u.value.length),Y.literalBrackets===!0){g.output+=O1,u.value=O1;continue}u.value=`(${V}${O1}|${u.value})`,g.output+=u.value;continue}if(e==="{"&&Y.nobrace!==!0){J1("braces");let Y1={type:"brace",value:e,output:"(",outputIndex:g.output.length,tokensIndex:g.tokens.length};Q1.push(Y1),I1(Y1);continue}if(e==="}"){let Y1=Q1[Q1.length-1];if(Y.nobrace===!0||!Y1){I1({type:"text",value:e,output:e});continue}let O1=")";if(Y1.dots===!0){let w1=q.slice(),P1=[];for(let E1=w1.length-1;E1>=0;E1--){if(q.pop(),w1[E1].type==="brace")break;if(w1[E1].type!=="dots")P1.unshift(w1[E1].value)}O1=w$4(P1,Y),g.backtrack=!0}if(Y1.comma!==!0&&Y1.dots!==!0){let w1=g.output.slice(0,Y1.outputIndex),P1=g.tokens.slice(Y1.tokensIndex);Y1.value=Y1.output="\\{",e=O1="\\}",g.output=w1;for(let E1 of P1)g.output+=E1.output||E1.value}I1({type:"brace",value:e,output:O1}),v1("braces"),Q1.pop();continue}if(e==="|"){if(i.length>0)i[i.length-1].conditions++;I1({type:"text",value:e});continue}if(e===","){let Y1=e,O1=Q1[Q1.length-1];if(O1&&o[o.length-1]==="braces")O1.comma=!0,Y1="|";I1({type:"comma",value:e,output:Y1});continue}if(e==="/"){if(u.type==="dot"&&g.index===g.start+1){g.start=g.index+1,g.consumed="",g.output="",q.pop(),u=Z;continue}I1({type:"slash",value:e,output:U});continue}if(e==="."){if(g.braces>0&&u.type==="dot"){if(u.value===".")u.output=H;let Y1=Q1[Q1.length-1];u.type="dots",u.output+=e,u.value+=e,Y1.dots=!0;continue}if(g.braces+g.parens===0&&u.type!=="bos"&&u.type!=="slash"){I1({type:"text",value:e,output:H});continue}I1({type:"dot",value:e,output:H});continue}if(e==="?"){if(!(u&&u.value==="(")&&Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){A0("qmark",e);continue}if(u&&u.type==="paren"){let O1=H1(),w1=e;if(u.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(s()))w1=`\\${e}`;I1({type:"text",value:e,output:w1});continue}if(Y.dot!==!0&&(u.type==="slash"||u.type==="bos")){I1({type:"qmark",value:e,output:I});continue}I1({type:"qmark",value:e,output:P});continue}if(e==="!"){if(Y.noextglob!==!0&&H1()==="("){if(H1(2)!=="?"||!/[!=<:]/.test(H1(3))){A0("negate",e);continue}}if(Y.nonegate!==!0&&g.index===0){k1();continue}}if(e==="+"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){A0("plus",e);continue}if(u&&u.value==="("||Y.regex===!1){I1({type:"plus",value:e,output:z});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||g.parens>0){I1({type:"plus",value:e});continue}I1({type:"plus",value:z});continue}if(e==="@"){if(Y.noextglob!==!0&&H1()==="("&&H1(2)!=="?"){I1({type:"at",extglob:!0,value:e,output:""});continue}I1({type:"text",value:e});continue}if(e!=="*"){if(e==="$"||e==="^")e=`\\${e}`;let Y1=A$4.exec(s());if(Y1)e+=Y1[0],g.index+=Y1[0].length;I1({type:"text",value:e});continue}if(u&&(u.type==="globstar"||u.star===!0)){u.type="star",u.star=!0,u.value+=e,u.output=p,g.backtrack=!0,g.globstar=!0,l(e);continue}let t1=s();if(Y.noextglob!==!0&&/^\([^?]/.test(t1)){A0("star",e);continue}if(u.type==="star"){if(Y.noglobstar===!0){l(e);continue}let Y1=u.prev,O1=Y1.prev,w1=Y1.type==="slash"||Y1.type==="bos",P1=O1&&(O1.type==="star"||O1.type==="globstar");if(Y.bash===!0&&(!w1||t1[0]&&t1[0]!=="/")){I1({type:"star",value:e,output:""});continue}let E1=g.braces>0&&(Y1.type==="comma"||Y1.type==="brace"),d1=i.length&&(Y1.type==="pipe"||Y1.type==="paren");if(!w1&&Y1.type!=="paren"&&!E1&&!d1){I1({type:"star",value:e,output:""});continue}while(t1.slice(0,3)==="/**"){let b1=J[g.index+4];if(b1&&b1!=="/")break;t1=t1.slice(3),l("/**",3)}if(Y1.type==="bos"&&V1()){u.type="globstar",u.value+=e,u.output=k(Y),g.output=u.output,g.globstar=!0,l(e);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&!P1&&V1()){g.output=g.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=k(Y)+(Y.strictSlashes?")":"|$)"),u.value+=e,g.globstar=!0,g.output+=Y1.output+u.output,l(e);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&t1[0]==="/"){let b1=t1[1]!==void 0?"|$":"";g.output=g.output.slice(0,-(Y1.output+u.output).length),Y1.output=`(?:${Y1.output}`,u.type="globstar",u.output=`${k(Y)}${U}|${U}${b1})`,u.value+=e,g.output+=Y1.output+u.output,g.globstar=!0,l(e+a()),I1({type:"slash",value:"/",output:""});continue}if(Y1.type==="bos"&&t1[0]==="/"){u.type="globstar",u.value+=e,u.output=`(?:^|${U}|${k(Y)}${U})`,g.output=u.output,g.globstar=!0,l(e+a()),I1({type:"slash",value:"/",output:""});continue}g.output=g.output.slice(0,-u.output.length),u.type="globstar",u.output=k(Y),u.value+=e,g.output+=u.output,g.globstar=!0,l(e);continue}let U1={type:"star",value:e,output:p};if(Y.bash===!0){if(U1.output=".*?",u.type==="bos"||u.type==="slash")U1.output=x+U1.output;I1(U1);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&Y.regex===!0){U1.output=e,I1(U1);continue}if(g.index===g.start||u.type==="slash"||u.type==="dot"){if(u.type==="dot")g.output+=A,u.output+=A;else if(Y.dot===!0)g.output+=E,u.output+=E;else g.output+=x,u.output+=x;if(H1()!=="*")g.output+=N,u.output+=N}I1(U1)}while(g.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(HI("closing","]"));g.output=mV.escapeLast(g.output,"["),v1("brackets")}while(g.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(HI("closing",")"));g.output=mV.escapeLast(g.output,"("),v1("parens")}while(g.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(HI("closing","}"));g.output=mV.escapeLast(g.output,"{"),v1("braces")}if(Y.strictSlashes!==!0&&(u.type==="star"||u.type==="bracket"))I1({type:"maybe_slash",value:"",output:`${U}?`});if(g.backtrack===!0){g.output="";for(let t1 of g.tokens)if(g.output+=t1.output!=null?t1.output:t1.value,t1.suffix)g.output+=t1.suffix}return g};r$1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(bi,Y.maxLength):bi,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=vB0[J]||J;let{DOT_LITERAL:Z,SLASH_LITERAL:q,ONE_CHAR:V,DOTS_SLASH:K,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:N}=hi.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?z:W,A=Y.capture?"":"?:",E={negated:!1,prefix:""},P=Y.bash===!0?".*?":U;if(Y.capture)P=`(${P})`;let I=(x)=>{if(x.noglobstar===!0)return P;return`(${A}(?:(?!${N}${x.dot?K:Z}).)*?)`},T=(x)=>{switch(x){case"*":return`${M}${V}${P}`;case".*":return`${Z}${V}${P}`;case"*.*":return`${M}${P}${Z}${V}${P}`;case"*/*":return`${M}${P}${q}${V}${L}${P}`;case"**":return M+I(Y);case"**/*":return`(?:${M}${I(Y)}${q})?${L}${V}${P}`;case"**/*.*":return`(?:${M}${I(Y)}${q})?${L}${P}${Z}${V}${P}`;case"**/.*":return`(?:${M}${I(Y)}${q})?${Z}${V}${P}`;default:{let b=/^(.*?)\.(\w+)$/.exec(x);if(!b)return;let p=T(b[1]);if(!p)return;return p+Z+b[2]}}},S=mV.removePrefix(J,E),k=T(S);if(k&&Y.strictSlashes!==!0)k+=`${q}?`;return k};fB0.exports=r$1});var ek=h((Tl8,gB0)=>{var E$4=xB0(),s$1=hB0(),bB0=sk(),I$4=rk(),P$4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),O2=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>O2(U,Q,Y));return(U)=>{for(let N of H){let M=N(U);if(M)return M}return!1}}let X=P$4(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?O2.compileRe(J,Q):O2.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=O2(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:N,output:M}=O2.test(H,q,Q,{glob:J,posix:Z}),L={glob:J,state:V,regex:q,posix:Z,input:H,output:M,match:N,isMatch:U};if(typeof G.onResult==="function")G.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof G.onMatch==="function")G.onMatch(L);return z?L:!0};if(Y)W.state=V;return W};O2.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?bB0.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=O2.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};O2.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:O2.makeRe(Q,Y)).test(bB0.basename(J))};O2.isMatch=(J,Q,Y)=>O2(Q,Y)(J);O2.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>O2.parse(Y,Q));return s$1(J,{...Q,fastpaths:!1})};O2.scan=(J,Q)=>E$4(J,Q);O2.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=O2.toRegex(V,Q);if(X===!0)K.state=J;return K};O2.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=s$1.fastpaths(J,Q);if(!G.output)G=s$1(J,Q);return O2.compileRe(G,Q,Y,X)};O2.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/$^/}};O2.constants=I$4;gB0.exports=O2});var SM=h((Cl8,pB0)=>{var mB0=ek(),R$4=sk();function uB0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:R$4.isWindows()};return mB0(J,Q,Y)}Object.assign(uB0,mB0);pB0.exports=uB0});var zI;var t$1=N1(()=>{zI={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@ampcode.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.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",enablement:"amp.isSourcegraphTeammate"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.guidanceFilesInContext":{type:"boolean",default:!1,markdownDescription:"Deliver AGENTS.md guidance files in message context instead of system prompt for improved cache efficiency.",scope:"window"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debug.logReview":{type:"boolean",default:!1,description:"Enable debug logging for review git operations",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"amp.experimental.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",scope:"window"},"amp.experimental.courseCorrection.enabled":{type:"boolean",default:!1,description:"Enable course correction agent that monitors the thread and provides guidance when the model goes off track",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"}}},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",zod:"catalog:"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function C$4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function cB0(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=zI.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!C$4(X))return null;return X*1000}function lB0(J){let Q=J.settings["tools.stopTimeout"],Y=zI.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var dB0;var gi=N1(()=>{t$1();dB0=zI.contributes.configuration.properties});function F3(J){let Q=x8[J];return`${Q.provider}/${Q.name}`}function jY(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);let Y=J.slice(0,Q),X=J.slice(Q+1);for(let G of Object.values(x8))if(G.provider===Y&&G.name===X)return G;switch(Y){case"anthropic":return x8.CLAUDE_SONNET_4_5;case"openai":return x8.GPT_5;case"xai":return x8.GROK_CODE_FAST_1;case"cerebras":return x8.Z_AI_GLM_4_6;case"fireworks":return x8.FIREWORKS_GLM_4P6;case"moonshotai":return x8.KIMI_K2_INSTRUCT;case"openrouter":return x8.SONOMA_SKY_ALPHA;case"groq":return x8.GPT_OSS_120B;case"vertexai":return x8.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Y}`)}}function iB0(J){for(let Q of Object.values(x8))if(Q.name===J)return Q;return}function hQ(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function c$(J,Q){let Y=jY(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}function nB0(J,Q){if(!Q?.pricing?.cached||!Q.pricing.cacheWrite)return 0;let Y=Q.pricing.cacheWrite/1e6,X=Q.pricing.cached/1e6;return J*(Y-X)}function aB0(J){return J?.pricing?.cacheTTL??300}var S9,x8,e$1;var CX=N1(()=>{S9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},x8={CLAUDE_SONNET_4:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:S9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:S9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:S9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,pricing:{input:5,output:25,cached:0.5,cacheWrite:6.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:S9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,pricing:{input:1,output:5,cached:0.1,cacheWrite:1.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:S9.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:S9.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:S9.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:S9.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:S9.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:S9.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:S9.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:S9.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:S9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:S9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:S9.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:S9.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:S9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:S9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,freeTierEligible:!0,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:S9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:S9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:S9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:S9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:S9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:S9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};e$1={FINDER:"finder"}});function Jq1(J,Q){let Y=uV(Q);if(!Y)return!1;if(j$4.has(J)){let X=Y.finder??e$1.FINDER,G=S$4[X];if(J!==G)return!1}if(Y.includeTools)return Y.includeTools.includes(J);return!0}function eG(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(FI).filter((X)=>{if(Y.includes(`!${X.key}`))return!1;if(Q===!1&&q5(X.key))return!1;let Z="visible"in X?X.visible:!1,q=Y.includes(X.key),V=X.key==="plan"&&J?.["experimental.planMode"]===!0,K=J?.["experimental.dojoMode"]===!0;if(X.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(X.key==="dojo")return K&&(Q===!1||Q===void 0);return Z||q||V}).map((X)=>({mode:X.key,description:"description"in X?X.description:void 0})).sort((X,G)=>X.mode.localeCompare(G.mode))}function uV(J){return Object.values(FI).find((Q)=>Q.key===J)}function _M(J){return uV(J)?.primaryModel??F3("CLAUDE_SONNET_4_5")}function Jy(J){let Q=uV(J);if(!Q)return!1;return jY(Q.primaryModel).capabilities?.vision??!1}function q5(J){return J==="free"||J.startsWith("free-")}function Qq1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function Yq1(J,Q){let X=(Q.findIndex((Z)=>Z.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var j$4,S$4,rB0,sB0,_$4,k$4,oB0,y$4,x$4,FI,v$4;var l$=N1(()=>{CX();j$4=new Set(["finder"]),S$4={finder:"finder"},rB0={r:0,g:55,b:0},sB0={r:0,g:255,b:136},_$4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","find_thread","skill"],k$4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at"],oB0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],y$4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","web_search","read_web_page"],x$4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at","code_review"],FI={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:F3("CLAUDE_OPUS_4_5"),includeTools:x$4,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:F3("CLAUDE_HAIKU_4_5"),includeTools:_$4,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:F3("CLAUDE_HAIKU_4_5"),includeTools:k$4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:F3("GPT_5_1_CODEX"),includeTools:y$4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:F3("CLAUDE_HAIKU_4_5"),includeTools:oB0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:F3("CLAUDE_SONNET_4_5"),includeTools:oB0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},v$4=Object.values(FI).map((J)=>J.key)});function mi(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let X="subagentType"in Q?Q.subagentType:void 0;if(X&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(X)}return!0}return Q.includeTools.includes(J)}var f$4,h$4,Xq1,b$4,g$4,m$4,u$4,p$4,o7,fl8;var pV=N1(()=>{CX();f$4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],h$4=["Grep","glob","Read"],Xq1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],b$4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],g$4=["Read","glob","Grep","enqueue_file_edit","fastmod"],m$4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],u$4=["describe_workbook","execute_query"],p$4=["Read","Grep","glob","web_search","read_web_page","Bash"],o7={finder:{key:"finder",displayName:"Finder",model:F3("CLAUDE_HAIKU_4_5"),includeTools:h$4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:F3("GPT_5_1"),includeTools:Xq1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:F3("CLAUDE_HAIKU_4_5"),includeTools:f$4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:b$4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:F3("CLAUDE_HAIKU_4_5"),includeTools:g$4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:F3("CLAUDE_HAIKU_4_5"),includeTools:m$4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:F3("CLAUDE_HAIKU_4_5"),includeTools:u$4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:F3("CLAUDE_SONNET_4_5"),includeTools:p$4,allowMcp:!1,allowToolbox:!1}},fl8=Object.keys(o7)});function tB0(J,Q){return new X0((Y)=>{let X=setTimeout(G,Q);function G(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function Z(){if(X)clearTimeout(X);X=setTimeout(G,Q)}let q=J.subscribe({next:(V)=>{Z(),Y.next(V)},error:(V)=>{if(X)clearTimeout(X),X=null;Y.error(V)},complete:()=>{if(X)clearTimeout(X),X=null;Y.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var eB0=N1(()=>{s0()});function w7(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 w2(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function YN0(J){return["done","error","cancelled"].includes(J.status)}function Gq1(J){return typeof J==="object"&&"key"in J}function ui(J){let Q=[],Y=new c4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0){let W=q.toLowerCase();K=Q.filter((H)=>H.spec.name.toLowerCase()===W)}for(let W of K)if(BI(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return v.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let N={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))Q[W]=N;else Q.push(N);return Y.next(),{dispose:()=>{let L=Q.indexOf(N);if(L!==-1)Q.splice(L,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return d$4;return Z(q,V,K)},tools:c8(J.configService.config,Y.pipe(l8(void 0))).pipe(q6(([q])=>{return Q.map((V)=>({spec:V.spec,...BI(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>c$4.record(performance.now()-W,{toolName:q});if(q===$q1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){UI.add(1,{toolName:q,error:"invalid"});let N=Zq1(V.args.invalid_tool_name);return new X0((M)=>{M.error(Error(N))})}let z=G(q,K.config);if(!z){let N=q.toLowerCase(),M=Q.filter((P)=>P.spec.name.toLowerCase()===N);if(M.length===0)return UI.add(1,{toolName:q,error:"not_found"}),new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} not found`))});let L=M[0],A=BI(L.spec,K.config);UI.add(1,{toolName:q,error:"disabled"});let E=A.enabled?"unknown":A.disabledReason;return new X0((P)=>{P.error(Error(`tool ${JSON.stringify(q)} is disabled: ${E}`))})}let U=K.subagentSpec??K.agentMode;if(U&&!this.isToolAllowed(q,U)){UI.add(1,{toolName:q,error:"disabled"});let N=Gq1(U)?U.displayName??U.key:`${U} mode`;return new X0((M)=>{M.error(Error(`tool ${JSON.stringify(q)} is not allowed for ${N}`))})}if(K.thread.mainThreadID&&!K.subagentSpec&&!mi(q,o7["task-subagent"]))return UI.add(1,{toolName:q,error:"disabled"}),new X0((N)=>{N.error(Error(`tool ${JSON.stringify(q)} is not allowed for subagents`))});return UI.add(1,{toolName:q}),s6(()=>z.fn).pipe(y4((N)=>{let M=N(V,K);if(z.spec.meta?.disableTimeout)return M;return tB0(M,lB0(K.config))}),f$(()=>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){v.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},isToolAllowed(q,V){let K=Q.find((H)=>H.spec.name===q),W=K?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(Gq1(V))return mi(q,V,K?.spec.meta);return Jq1(q,V)},getTools(q){return c8(J.configService.config,Y.pipe(l8(void 0))).pipe(q6(([V])=>{return Q.filter((K)=>{let W=K.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(Gq1(q))return mi(K.spec.name,q,K.spec.meta);return Jq1(K.spec.name,q)}).map((K)=>({spec:K.spec,...BI(K.spec,V)})).sort((K,W)=>K.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(q,V){if(V)return this.getTools(o7["task-subagent"]);return this.getTools(q)},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function Qy(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(QN0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function BI(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(Qy(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=l$4(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(Qy(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(Qy(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Qy(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Qy(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===K7||J.name===gV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function Zq1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Yy.toString()}. Try again with a valid tool name.`}function l$4(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function qq1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var JN0,QN0,d$4,$q1="invalid_tool",Yy,XN0,UI,c$4;var h7=N1(()=>{s0();N0();gi();l$();pV();eB0();L4();JN0=D6(m6(),1),QN0=D6(SM(),1);d$4={dispose(){}};Yy=/^[-a-zA-Z0-9_]{1,64}$/,XN0=JN0.metrics.getMeter("tool_service"),UI=XN0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),c$4=XN0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var KN0=h((qN0)=>{Object.defineProperty(qN0,"__esModule",{value:!0});qN0.calcSlices=qN0.applyPatch=qN0.calcPatch=qN0.lcs=qN0.diff=qN0.diff_core=void 0;function i$4(J,Q){let{b:Y,eq:X,stack_base:G}=J,{i:Z,N:q,j:V,M:K,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(q>0&&K>0){Y.fill(0,0,2*W);let z=q-K,U=q+K,N=U&1,M=Z+q-1,L=V+K-1,A=(U+N)/2,E;Q:for(let P=0;P<=A;P++){let I=2*Math.max(0,P-K)-P,T=P-2*Math.max(0,P-q);for(let S=I;S<=T;S+=2){let k=Y[S-1-W*Math.floor((S-1)/W)],x=Y[S+1-W*Math.floor((S+1)/W)],b=S===-P||S!==P&&k<x?x:k+1,p=b-S,g=b,i=p;while(g<q&&i<K&&X(Z+g,V+i))g++,i++;if(Y[S-W*Math.floor(S/W)]=g,N===1&&(E=z-S)>=1-P&&E<P&&g+Y[W+E-W*Math.floor(E/W)]>=q)if(P>1||g!==b){G[H++]=Z+g,G[H++]=q-g,G[H++]=V+i,G[H++]=K-i,q=b,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let S=I;S<=T;S+=2){let k=Y[W+S-1-W*Math.floor((S-1)/W)],x=Y[W+S+1-W*Math.floor((S+1)/W)],b=S===-P||S!==P&&k<x?x:k+1,p=b-S,g=b,i=p;while(g<q&&i<K&&X(M-g,L-i))g++,i++;if(Y[W+S-W*Math.floor(S/W)]=g,N===0&&(E=z-S)>=-P&&E<=P&&g+Y[E-W*Math.floor(E/W)]>=q)if(P>0||g!==b){G[H++]=Z+q-b,G[H++]=b,G[H++]=V+K-p,G[H++]=p,q=q-g,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 GN0{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=i$4(J,this.c);if(this.c=Y,Y===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function ZN0(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 GN0({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:[]})}qN0.diff_core=ZN0;function pi(J,Q,Y){let[X,G,Z]=[0,J.length,Q.length];if(typeof Y==="function"){while(X<G&&X<Z&&Y(X,X))X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(Y(--G,--Z)&&G>X&&Z>X);}else{while(X<G&&X<Z&&J[X]===Q[X])X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(J[--G]===Q[--Z]&&G>X&&Z>X);Y=(q,V)=>J[q]===Q[V]}return ZN0(X,G+1-X,X,Z+1-X,Y)}qN0.diff=pi;class $N0{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 n$4(J,Q,Y){return new $N0(pi(J,Q,Y),J.length)}qN0.lcs=n$4;function*a$4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of pi(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}qN0.calcPatch=a$4;function*o$4(J,Q){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,Z,q]of Q){if(Y<G)yield X.call(J,Y,G);if(q.length>0)yield q;Y=Z}if(Y<J.length)yield X.call(J,Y)}qN0.applyPatch=o$4;function*r$4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of pi(J,Q,Y)){if(X<Z)yield[0,G.call(J,X,Z)];if(Z<q)yield[-1,G.call(J,Z,q)];if(V<K)yield[1,G.call(Q,V,K)];X=q}if(X<J.length)yield[0,J.slice(X)]}qN0.calcSlices=r$4});function NI(J,Q){let Y={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Y;if(J===Q)return Y;try{let X={added:0,deleted:0,changed:0};for(let[G,Z,q,V]of WN0.diff(J.split(`
|
|
49
49
|
`),Q.split(`
|
|
50
50
|
`)))X.deleted+=Z-G,X.added+=V-q,X.changed+=Math.min(Z-G,V-q);return X}catch{return Y}}function HN0(J){if(typeof J!=="string")return{added:0,deleted:0,changed:0};return{added:J.split(`
|
|
51
51
|
`).length,deleted:0,changed:0}}function Vq1(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 WN0;var Xy=N1(()=>{WN0=D6(KN0(),1)});function i$(){return`T-${crypto.randomUUID()}`}function n$(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 kM(){return`toolu_${crypto.randomUUID()}`}function DI(J,Q,Y=kM()){return{type:"tool_use",complete:!0,id:Y,name:J,input:Q}}function n2(J){if("complete"in J)return J.complete;return!("inputPartialJSON"in J)}function Kq1(J){return J.role==="user"&&J.source?.type==="course-correction"}function zN0(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 jX(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 MI(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 $H(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 GQ(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 Wq1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&n$(Q))return Q}return}function Hq1(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===WJ)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?Wq1(q.progress):void 0;if(V)Q.push({toolUseID:G.toolUseID,threadID:V,toolUse:Z,toolResult:G})}}}return Q}function FN0(J,Q="Untitled"){if(J.title)return Pi(J.title,300);return Q}function UN0(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 BN0(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 zq1(J){if(!J)return!1;return J.role==="info"}function LI(J){return J.role==="info"&&J.content.some((Q)=>Q.type==="manual_bash_invocation")}function di(J){if(J.role!=="info")return;return J.content.find((Q)=>Q.type==="manual_bash_invocation")}function Yq4(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 AI(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===K7&&X.input){let G=X.input.todos;if(Array.isArray(G))return G;let Z=X.input.content;if(typeof Z==="string")return Yq4(Z)}}return}function E2(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
|
|
@@ -4262,15 +4262,15 @@ Actual: ${G}`)}async function fK8(J,Q,Y){let{execSync:X}=await import("node:ch
|
|
|
4262
4262
|
${N}`;if(G==="pnpm"&&N.includes("Unable to find the global bin directory"))M+=`
|
|
4263
4263
|
|
|
4264
4264
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
4265
|
-
npm install -g @sourcegraph/amp`;V(Error(M))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}N0();N0();async function w41(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=uK8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],M=V.time[K],L=Date.now();if(N)z=Math.floor((L-new Date(N).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return v.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 v.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function uK8(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}s0();function E41(J,Q){let Y=new c4,X=Y.pipe(S8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new kV().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 sU(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=HO(),W=await w41(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await O41();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 Bm(W.latestVersion,z);let U=await VN(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await sU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as oK}from"node:process";function o56(J){let Q=new sA().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 vC1(X.force||!1,X.verbose||!1,"0.0.
|
|
4265
|
+
npm install -g @sourcegraph/amp`;V(Error(M))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}N0();N0();async function w41(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=uK8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],M=V.time[K],L=Date.now();if(N)z=Math.floor((L-new Date(N).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return v.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 v.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function uK8(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}s0();function E41(J,Q){let Y=new c4,X=Y.pipe(S8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new kV().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 sU(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=HO(),W=await w41(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await O41();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 Bm(W.latestVersion,z);let U=await VN(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await sU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as oK}from"node:process";function o56(J){let Q=new sA().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 vC1(X.force||!1,X.verbose||!1,"0.0.1764720103-g0db7ac"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new sA("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await pK8(X.targetVersion)});J.addCommand(Y)}async function pK8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")oK.write(b4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
4266
4266
|
|
|
4267
4267
|
`));try{if(!J){oK.write(b4.blue(`Checking for updates...
|
|
4268
|
-
`));let X=HO(),{hasUpdate:G,latestVersion:Z}=await w41("0.0.
|
|
4269
|
-
`));let V=await VN("0.0.
|
|
4268
|
+
`));let X=HO(),{hasUpdate:G,latestVersion:Z}=await w41("0.0.1764720103-g0db7ac",X);if(!G){oK.write(b4.green(`✓ Amp CLI is already up to date: ${"0.0.1764720103-g0db7ac"} (${"released"} ${"2025-12-03T00:07:10.941Z"})
|
|
4269
|
+
`));let V=await VN("0.0.1764720103-g0db7ac");if(V.warning)oK.write(`
|
|
4270
4270
|
`+b4.yellow(V.warning)+`
|
|
4271
4271
|
`);process.exit(0)}if(!Z)oK.write(b4.yellow("[WARN] could not find latest version")),process.exit(0);J=Z}oK.write(b4.blue(`Updating to version ${J}...
|
|
4272
4272
|
`)),await Bm(J,void 0,(X)=>{oK.write(b4.dim(`Running: ${X}
|
|
4273
|
-
`))});let Q="released";oK.write(b4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-12-
|
|
4273
|
+
`))});let Q="released";oK.write(b4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-12-03T00:07:10.941Z"})
|
|
4274
4274
|
`));let Y=await VN(J);if(Y.warning)oK.write(`
|
|
4275
4275
|
`+b4.yellow(Y.warning)+`
|
|
4276
4276
|
`);process.exit(0)}catch(Q){let Y=Q instanceof Error?Q.message:String(Q);oK.write(b4.red.bold("Error: ")+Y+`
|
|
@@ -4902,7 +4902,7 @@ exit code: ${Z}`,new X1({color:X.foreground,dim:!0,italic:!0})));if(q)V.push(new
|
|
|
4902
4902
|
`,N),...M])})];if(W.url){let S=W.url.replace(/^https?:\/\//,"");I.push(new Y7({uri:W.url,text:S,style:new X1({color:Y.secondary,underline:!0})}))}let T=new W0({width:40,child:new c0({crossAxisAlignment:"start",mainAxisSize:"min",children:I})});return n4.child(new g6({mainAxisAlignment:"center",crossAxisAlignment:"center",mainAxisSize:"min",children:[new GS1({width:mX6,height:uX6,agentMode:this.widget.agentMode,glow:this._glow,t:L,fps:0,shockwaves:this._shockwaves,onShockwave:E,...q==="disabled"&&{seed:42}}),new W0({width:2}),T]}))}}N0();n8();L4();h7();n8();s0();function pA8(J,Q){return`${J}:${Q}`}class vk1{threadService;workers=new Map;threadsMap=new Map;subthreadsMap=new Map;mainThreadSubs=new Map;subthreadsSubs=new Map;workerStatusSubs=new Map;subthreadPatchSubs=new Map;mainThreadObservable;subthreadObservable;workerStatusObservable;emitMainThread=null;emitSubthread=null;emitWorkerStatus=null;constructor(J){this.threadService=J;this.mainThreadObservable=new X0((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.subthreadObservable=new X0((Q)=>{return this.emitSubthread=(Y)=>Q.next(Y),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new X0((Q)=>{return this.emitWorkerStatus=(Y)=>Q.next(Y),()=>{this.emitWorkerStatus=null}})}registerWorker(J){let Q=J.thread.id;if(this.workers.has(Q))this.unregisterWorker(Q);this.threadsMap.set(Q,J.thread),this.subthreadsMap.set(Q,[]),this.workers.set(Q,{state:"initial"});let Y=this.threadService.observePatches(Q).pipe(yM()).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=pA8(Q,q.toolUse.id);if(this.subthreadPatchSubs.has(V))continue;let K=this.threadService.observePatches(q.threadID).pipe(yM()).subscribe((W)=>{if(this.emitSubthread)this.emitSubthread({threadID:Q,thread:W,subthread:q})});this.subthreadPatchSubs.set(V,K)}});this.subthreadsSubs.set(Q,G)}unregisterWorker(J){let Q=this.mainThreadSubs.get(J);if(Q)Q.unsubscribe(),this.mainThreadSubs.delete(J);let Y=this.workerStatusSubs.get(J);if(Y)Y.unsubscribe(),this.workerStatusSubs.delete(J);let X=this.subthreadsSubs.get(J);if(X)X.unsubscribe(),this.subthreadsSubs.delete(J);for(let[G,Z]of this.subthreadPatchSubs.entries())if(G.startsWith(`${J}:`))Z.unsubscribe(),this.subthreadPatchSubs.delete(G);this.workers.delete(J),this.threadsMap.delete(J),this.subthreadsMap.delete(J)}observeThread(J){return{mainThread:new X0((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),subthreads:new X0((Q)=>{return this.subthreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new X0((Q)=>{return this.workerStatusObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})})}}get threadViewStates(){let J={};for(let[Q,Y]of this.threadsMap){let X=this.workers.get(Q);if(X)J[Q]=jA(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 dA8(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=GQ(J.mainThread);G.isCompleted=dX6(W,X.toolUse.id)}}let Z=cA8(Y,G.agentState),q=G.agentState===Z?G:{...G,agentState:Z},V={...J.tools},K=Zj(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=GQ(Y),q={...J.subagents};for(let z of X){let U=q[z.threadID];if(!U)continue;let N=dX6(Z,z.toolUse.id);q[z.threadID]={...U,isCompleted:N}}let{items:V}=Zj(Y),K=jA(Y,G),W=AI({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=jA(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function Zj(J){let Q=[],Y=new Map,X=new Set;for(let[G,Z]of J.messages.entries()){let q=`${Z.role}-${G}`;switch(Z.role){case"assistant":{let V=Z.state.type==="streaming";for(let W of Z.content)if(W.type==="tool_use"){if(Y.set(W.id,W),V)X.add(W.id)}if(Z.content.some((W)=>W.type==="text"&&W.text.trim()||W.type==="thinking"))Q.push({type:"message",id:q,message:Z});for(let W of Z.content)if(W.type==="tool_use"){let H=!1;for(let z=G+1;z<J.messages.length;z++){let U=J.messages[z];if(U){for(let N of U.content)if(N.type==="tool_result"&&N.toolUseID===W.id){H=!0;break}}if(H)break}if(!H)Q.push({type:"toolResult",id:W.id,toolUse:W,toolResult:{type:"tool_result",toolUseID:W.id,run:{status:V?"in-progress":"queued"}}})}break}case"info":Q.push({type:"message",id:q,message:Z});break;case"user":{let V=Z.content.some((K)=>K.type==="text"&&K.text.trim()||K.type==="image");for(let K of Z.content)if(K.type==="tool_result"){let W=Y.get(K.toolUseID)??jX(J,K.toolUseID);if(!W)throw Error(`(bug) tool use ${K.toolUseID} not found`);Q.push({type:"toolResult",id:K.toolUseID,toolUse:W,toolResult:K})}if(V)Q.push({type:"message",id:q,message:Z});break}}}return{items:Q}}function dX6(J,Q){let Y=J.get(Q);return(Y&&w2(Y.run))??!1}function cA8(J,Q){let Y=J.messages.at(-1);if(Y?.content.some((G)=>G.type==="tool_result"&&G.run.status==="blocked-on-user"))return v.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(Zj(J).items.some((G)=>G.type==="toolResult"&&G.toolResult.run.status==="in-progress")){let G=Q?.type==="running-tools"?Q.startTime:Date.now();return v.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 v.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return v.info("Subagent status: streaming-thinking",{threadID:J.id}),{type:"streaming-thinking"};case"tool_use":{let Z=Q?.type==="running-tools"?Q.startTime:Date.now();return v.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:Z,hasStartTime:!!Z}),{type:"running-tools",startTime:Z}}default:return v.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return v.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class fk1 extends t0{props;constructor(J){super();this.props=J}createState(){return new cX6}}class cX6 extends r0{state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null};workerController;subscriptions=[];recentThreadIDs=[];currentWorker;constructor(){super();this.workerController=null,this.currentWorker=null}addToRecentThreads(J){this.setState(()=>{let Q=this.recentThreadIDs.indexOf(J);if(Q!==-1)this.recentThreadIDs.splice(Q,1);if(this.recentThreadIDs.unshift(J),this.recentThreadIDs.length>50)this.recentThreadIDs.pop()})}initState(){let{threadService:J,worker:Q}=this.widget.props;this.workerController=new vk1(J),this.currentWorker=Q,this.setupSubscriptions(Q),this.addToRecentThreads(Q.thread.id)}dispose(){this.cleanup()}didUpdateWidget(J){if(J.props.threadService!==this.widget.props.threadService||J.props.worker!==this.widget.props.worker)this.cleanup(),this.setupSubscriptions(this.widget.props.worker)}setupSubscriptions(J){this.workerController.registerWorker(J);let Q=this.workerController.observeThread(J.thread.id),Y=Q.mainThread.subscribe((Z)=>{this.dispatch({type:"main-thread-patch",thread:Z.mainThread,subthreads:Z.subthreads,workerStatus:Z.workerStatus})});this.subscriptions.push(Y);let X=Q.subthreads.subscribe((Z)=>{this.dispatch({type:"subthread-patch",thread:Z.thread,subthread:Z.subthread})});this.subscriptions.push(X);let G=Q.workerStatus.subscribe((Z)=>{this.dispatch({type:"worker-status-change",workerStatus:Z.status})});this.subscriptions.push(G)}cleanup(){this.subscriptions.forEach((J)=>J.unsubscribe()),this.subscriptions=[]}switchWorker(J){this.cleanup(),this.setState(()=>{this.currentWorker=J}),this.setState(()=>{this.state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null}}),this.setupSubscriptions(J),this.addToRecentThreads(J.thread.id)}dispatch(J){this.setState(()=>{this.state=dA8(this.state,J)})}getThreadData(){let J=Object.values(this.state.tools).map((Z)=>({toolUse:Z.toolUse,toolRun:Z.toolRun,subthreadID:Z.subthreadID})),Q={};for(let Z of Object.values(this.state.subagents)){let q=J.filter((V)=>V.subthreadID===Z.subThreadID);Q[Z.parentToolID]=q}let Y=(Z)=>Z===s5||Z===W9||Z===TX,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:DI(z.tool_name,z.input,U),toolRun:{status:z.status}})}}Q[Z]=V}return{...this.state,subagents:Object.values(this.state.subagents),subagentActiveTools:J,subagentToolsByParentID:Q}}build(J){let Q=this.getThreadData();return this.widget.props.builder(J,Q,this.workerController,(Y)=>this.switchWorker(Y),()=>this.currentWorker,this.recentThreadIDs)}}class hk1 extends t0{props;constructor(J){super({key:J.key});this.props=J}createState(){return new lX6}}class lX6 extends r0{build(J){let Y=H6.of(J).colors,{todos:X,title:G="TODOs"}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new W0({width:0,height:0});let Z=X.map((q)=>this.buildTodoItem(q,Y));return new e0({child:new A6({padding:P0.symmetric(1,0),child:new c0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new f1({text:new t(G,new X1({bold:!0,color:Y.foreground}))}),...Z]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),X=J.status==="completed",G=new X1({bold:J.status==="in-progress",color:Q.foreground,dim:X}),Z=new X1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:X});return new g6({crossAxisAlignment:"start",children:[new f1({text:new t(Y,G)}),new W0({width:1}),new F4({child:new f1({text:new t(J.content,Z)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class bk1 extends C6{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=H6.of(J),Y=Q.colors.primary,X=Q.colors.foreground;return new e0({decoration:new G8(void 0,new I4(new N4(Y,1,"rounded"),new N4(Y,1,"rounded"),void 0,new N4(Y,1,"rounded"))),child:new A6({padding:P0.horizontal(1),child:new c0({children:[new g6({crossAxisAlignment:"start",children:[new F4({child:new f1({text:new t(this.ad.content,new X1({color:X}))})}),new W0({width:4}),new Y7({uri:"https://ampcode.com/free",text:"Ad",style:new X1({color:X,dim:!0})})]}),new g6({crossAxisAlignment:"start",children:[new NS1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:P0.horizontal(1),color:Y,reverse:!0}),new W0({width:2}),new f1({text:new t(this.ad.destinationUrlHostname,new X1({color:X,dim:!0}))})]})]})})})}}class gk1 extends t0{props;constructor(J){super();this.props=J}createState(){return new iX6(this.props.autofocus??!0)}}class iX6 extends r0{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=X8.sizeOf(J),X=Math.min(60,Y.width-4),G=Y.height-4,Z=[];if(this.widget.props.title)Z.push(new f1({text:new t(this.widget.props.title,new X1({bold:!0,color:M1.blue}))}),new W0({height:1}));if(this.widget.props.message)Z.push(new f1({text:new t(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)Z.push(new W0({height:1}));let q=[];if(this.widget.props.showCopyOption)q.push(new f1({text:new t("Enter to copy",new X1({dim:!0}))}));return q.push(new f1({text:new t("Escape to close",new X1({dim:!0}))})),Z.push(new g6({children:q.flatMap((V,K)=>K<q.length-1?[V,new W0({width:1}),new f1({text:new t("•",new X1({dim:!0}))}),new W0({width:1})]:[V]),mainAxisSize:"min"})),new n4({child:new e0({constraints:new v6(X,X,0,G),decoration:new G8(M1.default(),new I4(new N4(M1.blue,1,"rounded"),new N4(M1.blue,1,"rounded"),new N4(M1.blue,1,"rounded"),new N4(M1.blue,1,"rounded"))),padding:new P0(2,2,2,2),child:new f8({autofocus:this.autofocus,onKey:Q,child:new c0({children:Z,mainAxisSize:"min"})})})})}}function lA8(J){let Q=Math.floor(J/60),Y=J%60;if(Q===0)return`${Y}s`;return`${Q}:${Y.toString().padStart(2,"0")}`}function iA8(J){if(J<0.01)return"<$0.01";return`$${J.toFixed(2)}`}function nX6(J,Q={}){if(J.secondsRemaining===null)return null;if(J.secondsRemaining===0)return{text:"cache expired",urgency:"expired"};let Y=lA8(J.secondsRemaining),X=iA8(J.potentialSavingsUSD),G=J.secondsRemaining<=60;if(Q.isNarrow)return{text:Y,urgency:G?"warning":"normal"};if(Q.prominent&&G)return{text:`${Y} left - respond now to save up to ${X}`,urgency:"warning"};return{text:`${Y} (save up to ${X})`,urgency:G?"warning":"normal"}}class b91 extends Error{constructor(J="Command timed out"){super(J);this.name="CommandTimeoutError",Object.setPrototypeOf(this,b91.prototype)}}class g91 extends Error{constructor(J){let Q=`${J.noun}: ${J.verb} command cancelled`;super(Q);this.name="CommandCancelledError",Object.setPrototypeOf(this,g91.prototype)}}function mk1(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})}AH();N0();import{spawn as nA8}from"node:child_process";import{promises as aA8}from"node:fs";function aX6(J){return J.kind==="executable"}function oX6(J){return J.kind==="markdown"}var hz=50000,rX6=300000;async function uk1(J,Q,Y,X={}){let{timeoutMs:G=rX6,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(v.debug("Executing command",{commandName:J,filePath:V.filePath,args:Q}),oX6(V))return await oA8(V,Q);else if(aX6(V))return await rA8(V,Q,G,Z);else return{success:!1,output:"",error:"Unsupported command type"}}catch(V){return v.error("Failed to execute command",{commandName:J,error:V}),{success:!1,output:"",error:V instanceof Error?V.message:"Unknown error occurred"}}}async function oA8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await aA8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>hz?Y.slice(0,hz)+`
|
|
4903
4903
|
... (output truncated at ${hz} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function rA8(J,Q,Y=rX6,X){return new Promise((G)=>{let[Z,q]=sA8(J,Q);v.debug("Spawning command",{spawnCommand:Z,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Y});let V=KE0(X),K=!1,W=setTimeout(()=>{K=!0,V.abort(),v.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=nA8(Z,q,{stdio:["pipe","pipe","pipe"],signal:V.signal,detached:!0}),z=[],U=[],N=0;H.stdout?.on("data",(M)=>{let L=M.toString();if(N+=L.length,N<=hz)z.push(L);else{let A=hz-(N-L.length);if(A>0)z.push(L.slice(0,A))}}),H.stderr?.on("data",(M)=>{let L=M.toString();if(N+=L.length,N<=hz)U.push(L);else{let A=hz-(N-L.length);if(A>0)U.push(L.slice(0,A))}}),H.on("close",(M)=>{if(clearTimeout(W),K){G({success:!1,output:z.join(""),error:`Command timed out after ${Y}ms`,exitCode:void 0});return}if(V.signal.aborted){G({success:!1,output:z.join(""),error:"The command was aborted",exitCode:M??void 0});return}let L=M===0||M===1,A=z.join(""),E=U.join(""),P=A;if(!L&&!A.trim()&&E.trim())P=E;else if(E.trim())P+=A?`
|
|
4904
4904
|
${E}`:E;if(N>hz)P+=`
|
|
4905
|
-
... (output truncated at ${hz} characters)`;G({success:L,output:P.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(K)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";G({success:!1,output:z.join(""),error:L})})})}function sA8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return eA8(Y,X?[...X]:null,G,Q);else return tA8(Y,X?[...X]:null,G,Q)}function tA8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function eA8(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]}}N0();l$();r7();ZH();mX();Xq();OH();VK();n8();h7();Pk();s0();var zG6=D6(nP(),1);import{writeFile as KG6}from"fs/promises";import WG6 from"path";N0();mX();class pk1{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.1764705684-g95eb77"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await uo(Q,this.configService)}catch(Q){v.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class dk1 extends t0{props;constructor(J){super();this.props=J}createState(){return new sX6}}class sX6 extends r0{_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 tX6 extends r0{controller=new aZ;focusNode=new o8({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=H6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=I4.all(new N4(Y.foreground,1,"solid")),K=new IO({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let M=N.trim();if(G&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new g6({children:[new e0({decoration:{color:M1.default()},child:new f1({text:new t(">",new X1({color:Y.foreground}))})}),new F4({child:K})]}),H=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t("",void 0,[new t("Command: ",new X1({color:Y.foreground})),new t(this.widget.props.commandName,new X1({color:M1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new t("Enter",new X1({color:X.keybind}))),z.push(new t(" to submit, ",new X1({color:Y.foreground,dim:!0})));z.push(new t("Esc",new X1({color:X.keybind}))),z.push(new t(" to cancel",new X1({color:Y.foreground,dim:!0})));let U=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t("",void 0,z)})});return new e0({decoration:{border:V,color:M1.default()},padding:P0.all(1),child:new c0({children:[H,new W0({height:1}),W,new A5,U]})})}}class m91 extends t0{props;constructor(J){super();this.props=J}createState(){return new tX6}}OH();class eX6 extends r0{controller=new aZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new o8({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>=wU)return!1;let Q=pC(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=H6.of(J),{colors:Y,app:X}=Q,Z=X8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new hO({controller:this.controller,triggers:[new TN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:P9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new f8({focusNode:this.focusNode,child:V}),W=new e0({constraints:new v6({maxHeight:q}),padding:P0.symmetric(1,0),child:K}),H=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t("",void 0,[new t("Command: ",new X1({color:Y.foreground})),new t(this.widget.props.commandName,new X1({color:M1.yellow,bold:!0}))])})}),z=new e0({padding:P0.symmetric(1,0),child:new f1({text:this.isConfirmingClearInput?new t("",void 0,[new t("Esc",new X1({color:X.keybind})),new t(" again to clear input",new X1({color:Y.foreground,dim:!0}))]):new t("",void 0,[new t("Press ",new X1({color:Y.foreground,dim:!0})),new t("Enter",new X1({color:X.keybind})),new t(" to submit, ",new X1({color:Y.foreground,dim:!0})),new t("Esc",new X1({color:X.keybind})),new t(" to clear",new X1({color:Y.foreground,dim:!0}))])})}),U=[H,new W0({height:1}),new F4({child:W}),new W0({height:1}),z];return new e0({decoration:{border:I4.all(new N4(Y.foreground,1,"solid")),color:M1.default()},padding:P0.all(1),child:new c0({children:U})})}}class $j extends t0{props;constructor(J){super();this.props=J}createState(){return new eX6}}import{isDeepStrictEqual as XO8}from"node:util";var JO8=/[\\/_ +.#"@[({&]/,QO8=/[\\/_ +.#"@[({&]/g,YO8=/[\s-]/,JG6=/[\s-]/g;function p91(J,Q,Y,X,G,Z,q){if(Z===Q.length){if(G===J.length)return 1;return 0.99}let V=`${G},${Z}`;if(q[V]!==void 0)return q[V];let K=X.charAt(Z),W=Y.indexOf(K,G),H=0,z,U,N,M;while(W>=0){if(z=p91(J,Q,Y,X,W+1,Z+1,q),z>H){if(W===G)z*=1;else if(YO8.test(J.charAt(W-1))){if(z*=0.9,M=J.slice(G,W-1).match(JG6),M&&G>0)z*=Math.pow(0.999,M.length)}else if(JO8.test(J.charAt(W-1))){if(z*=0.8,N=J.slice(G,W-1).match(QO8),N&&G>0)z*=Math.pow(0.999,N.length)}else if(z*=0.3,G>0)z*=Math.pow(0.999,W-G);if(J.charAt(W)!==Q.charAt(Z))z*=0.9999}if(z<0.1&&(Y.charAt(W-1)===X.charAt(Z+1)||X.charAt(Z+1)===X.charAt(Z)&&Y.charAt(W-1)!==X.charAt(Z))){if(U=p91(J,Q,Y,X,W+1,Z+2,q),U*0.1>z)z=U*0.1}if(z>H)H=z;W=Y.indexOf(K,W+1)}return q[V]=H,H}function u91(J){return J.toLowerCase().replace(JG6," ")}function QG6(J,Q){let Y=p91(J,Q,u91(J),u91(Q),0,0,{}),X=Q.trim().split(/\s+/);if(X.length>1){let G=0,Z=0;for(let V of X){let K=p91(J,V,u91(J),u91(V),0,0,{});if(K===0)return Y;G+=K,Z+=V.length}let q=G/X.length*0.95;return Math.max(Y,q)}return Y}class qj{}class Vj{}class d91{}class c91{}class YG6 extends t0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new XG6}}class XG6 extends r0{build(J){return this.widget.onContext(J),this.widget.child}}function GO8(J,Q){if(J==="")return{matches:!0,score:1};let Y=QG6(Q,J);return{matches:Y>0.15,score:Y}}class pq extends t0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new GG6}}class GG6 extends r0{controller=new aZ;focusNode;scrollController=new $2;selectedIndex=0;itemContexts=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new o8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),Z9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!XO8(J.props.items,this.widget.props.items)){this.ensureSelectedItemVisible();let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)}}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof qj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof Vj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof d91){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Y=Q[this.selectedIndex];if(Y){if(!(this.widget.props.isItemDisabled?.(Y)??!1))this.widget.props.onAccept(Y)}}return"handled"}if(J instanceof c91)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items.filter((Y)=>!this.widget.props.filterItem||this.widget.props.filterItem(Y,J)).map((Y)=>({item:Y,...GO8(J,this.widget.props.getLabel(Y))})).filter((Y)=>Y.matches).sort(this.widget.props.sortItems?(Y,X)=>this.widget.props.sortItems(Y,X,J):(Y,X)=>X.score-Y.score).map((Y)=>Y.item);if(this.widget.props.maxRenderItems)return Q.slice(0,this.widget.props.maxRenderItems);return Q}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,X=Q.size.height;m81(J,{top:Y,bottom:X},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),Z9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Y=this.getFilteredItems();if(J>=0&&J<Y.length){let X=Y[J],G=X?this.widget.props.isItemDisabled?.(X)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Y[this.selectedIndex]??null);else if(Q===2&&!G){if(X)this.widget.props.onAccept(X)}}};build(J){let Q=H6.of(J),{colors:Y}=Q,X=this.getFilteredItems(),G=I4.all(new N4(Y.foreground,1,"solid")),Z=this.widget.props.enabled??!0,q=new IO({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:Z,style:{textColor:Y.foreground,border:null},maxLines:1}),V=new mq({shortcuts:new Map([[new U4("ArrowDown"),new qj],[new U4("ArrowUp"),new Vj],[new U4("Tab"),new qj],[new U4("Tab",{shift:!0}),new Vj],[new U4("n",{ctrl:!0}),new qj],[new U4("p",{ctrl:!0}),new Vj],[new U4("Enter"),new d91],[new U4("Escape"),new c91]]),focusNode:this.focusNode,child:q}),K=new ZY({actions:new Map([[qj,new s8(this.invoke)],[Vj,new s8(this.invoke)],[d91,new s8(this.invoke)],[c91,new s8(this.invoke)]]),child:V}),W=new g6({children:[new e0({decoration:{color:M1.default()},child:new f1({text:new t(">",new X1({color:Y.foreground}))})}),new F4({child:K})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new W0({height:10,child:new n4({child:new f1({text:new t(L,new X1({color:Y.foreground}))})})})}else if(X.length===0&&this.widget.props.emptyStateText)H=new F4({child:new n4({child:new f1({text:new t(this.widget.props.emptyStateText,new X1({color:Y.foreground,dim:!0}))})})});else{let L=X.map((A,E)=>{let P=E===this.selectedIndex,I=this.widget.props.isItemDisabled?.(A)??!1,T;if(this.widget.props.renderItem)T=this.widget.props.renderItem(A,P,I,J);else{let S=P?M1.yellow:void 0,k=P?M1.black:Y.foreground;T=new e0({decoration:S?{color:S}:void 0,padding:P0.symmetric(2,0),child:new f1({text:new t(this.widget.props.getLabel(A),new X1({color:k,dim:I}))})})}return new YG6(new U8({onClick:(S)=>this.handleItemClick(E,S.clickCount),child:T}),(S)=>{this.itemContexts[E]=S})});H=new c0({children:L,crossAxisAlignment:"start"})}let z=new F4({child:new U8({onScroll:this.handleScroll,opaque:!1,child:new B7({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t(this.widget.props.title,new X1({color:M1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new W0({height:1}),z),this.controller.text!==""){let L=X.length>0?X[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new e0({padding:P0.vertical(1),child:new n4({child:A})}));else U.push(new W0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new e0({decoration:{border:G,color:M1.default()},padding:P0.symmetric(1,0),child:new c0({children:U})})}}class ck1 extends t0{createState(){return new ZG6}}class ZG6 extends r0{isGreen=!0;timer;initState(){this.timer=setInterval(()=>{this.isGreen=!this.isGreen,this.setState()},700)}dispose(){if(this.timer)clearInterval(this.timer);super.dispose()}build(J){return new f1({text:new t("●",new X1({color:this.isGreen?M1.green:M1.index(8),bold:!0})),maxLines:1})}}function ZO8(J){let Q=new Map,Y=new Map,X=new Map,G=[];for(let q of J)Q.set(q.id,q);for(let q of J){let V=q.parentRelationships.find((K)=>K.role==="child"&&Q.has(K.threadID));if(V){X.set(q.id,V.type);let K=V.threadID,W=Y.get(K)||[];W.push(q),Y.set(K,W)}else G.push(q)}return DG.flatten(G,(q)=>Y.get(q.id)).map((q)=>({...q.item,depth:q.depth,isLast:q.isLast,ancestorsAreLast:q.ancestorsAreLast,relationshipType:X.get(q.item.id)}))}function lk1(J,Q,Y){return new f1({text:new t(`${J}${Q}`,new X1({color:Y})),maxLines:1})}function $O8(J,Q,Y,X){return[lk1("+",J,X.success),A5.horizontal(1),lk1("~",Q,X.warning),A5.horizontal(1),lk1("-",Y,X.destructive)]}class l91 extends C6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((H)=>H.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((H)=>H.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],X=this.props.currentThreadID,G=[...Q].sort((H,z)=>{if(X){if(H.id===X)return-1;if(z.id===X)return 1}let U=Y.indexOf(H.id),N=Y.indexOf(z.id);if(U!==-1&&N!==-1)return U-N;if(U!==-1)return-1;if(N!==-1)return 1;return 0}),Z=ZO8(G),q=Math.max(0,...Z.map((H)=>H.description.timeAgo.length)),V=H6.of(J),K=new A6({padding:P0.symmetric(0,1),child:new n4({child:new f1({text:new t("",new X1({color:V.colors.foreground,dim:!0}),[new t("Ctrl+T",new X1({color:M1.blue,dim:!0})),new t(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new X1({color:V.colors.foreground,dim:!0}))])})})});return new pq({items:Z,getLabel:(H)=>H.title,onAccept:(H)=>this.props.onSelect?.(H.id),onDismiss:this.props.onDismiss,onSelectionChange:(H)=>{if(this.props.previewController){if(H)this.props.previewController.select(H.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:1000,footer:this.props.isLoading?void 0:K,renderItem:(H,z,U,N)=>{let M=H6.of(N),{colors:L}=M,A=z?M1.yellow:void 0,E=z?M1.black:L.foreground,P=M1.index(8),I=(Q1,o)=>new W0({width:o,child:g6.end([new f1({text:new t(Q1,new X1({color:P}))})])}),T=this.props.threadViewStates[H.id],S=[],k=H.relationshipType==="handoff",x=new n81;if(H.depth>0){let Q1=[],o=H.ancestorsAreLast.slice(1);for(let V1 of o)Q1.push(new t(x.getAncestorPrefix(V1),new X1({color:x.connectorColor,dim:x.connectorDim})));let u=H.isLast?x.elbow:x.tee,e=x.getConnectorText(u);Q1.push(new t(e,new X1({color:x.connectorColor,dim:x.connectorDim}))),S.push(new f1({text:new t("",void 0,Q1)}))}let b=[],p=this.props.currentThreadID===H.id?new t("(current) ",new X1({color:M1.green})):(this.props.recentThreadIDs||[]).includes(H.id)?new t("(visited) ",new X1({color:L.foreground,dim:!0})):null;if(p)b.push(new f1({text:p}));if(T){if(T.state==="active"&&(T.interactionState==="tool-running"||T.interactionState===!1))b.push(new ck1),b.push(new W0({width:1}))}let g=H.title;if(H.relationshipType==="fork"){let Q1=g.match(/^Forked\((\d+)\): /);if(Q1)g=g.slice(Q1[0].length);else while(g.startsWith("Forked: "))g=g.slice(8);b.push(new f1({text:new t("[fork] ",new X1({color:M1.blue}))}))}else if(k)b.push(new f1({text:new t("[handoff] ",new X1({color:M1.index(208)}))}));if(b.push(new F4({child:new f1({text:new t(g,new X1({color:E})),overflow:"ellipsis",maxLines:1})})),b.push(new W0({width:2})),H.diffStats&&(H.diffStats.added>0||H.diffStats.changed>0||H.diffStats.deleted>0)){let Q1=z?{success:P,warning:P,destructive:P}:L;b.push(...$O8(H.diffStats.added,H.diffStats.changed,H.diffStats.deleted,Q1)),b.push(new W0({width:2}))}return b.push(I(H.description.timeAgo,q)),new e0({decoration:A?{color:A}:void 0,padding:P0.symmetric(2,0),child:new g6({children:[...S,...b]})})}})}}function $G6(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/60000),G=Math.floor(Y/3600000),Z=Math.floor(Y/86400000);if(X<1)return"just now";if(X<60)return`${X}m ago`;if(G<24)return`${G}h ago`;if(Z<7)return`${Z}d ago`;return J.toLocaleDateString()}class ik1 extends C6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((G,Z)=>Z.pubDate.getTime()-G.pubDate.getTime()),Y=Math.max(0,...Q.map((G)=>$G6(G.pubDate).length));return new pq({items:Q,getLabel:(G)=>G.title,onAccept:(G)=>this.props.onSelect?.(G),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(G,Z,q,V)=>{let K=H6.of(V),{colors:W}=K,H=Z?M1.yellow:void 0,z=Z?M1.black:W.foreground,U=M1.index(8),N=G.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new W0({width:A,child:g6.end([new f1({text:new t(L,new X1({color:U}))})])});return new e0({decoration:H?{color:H}:void 0,padding:P0.symmetric(2,0),child:new g6({children:[new F4({child:new f1({text:new t(G.title,new X1({color:z})),overflow:"ellipsis",maxLines:1})}),new W0({width:2}),new f1({text:new t(N,new X1({color:U})),maxLines:1}),new W0({width:2}),M($G6(G.pubDate),Y)]})})}})}}class nk1 extends C6{props;constructor(J){super();this.props=J}build(){return new n4({child:new f1({text:new t("",void 0,[new t(`Forked to new thread:
|
|
4905
|
+
... (output truncated at ${hz} characters)`;G({success:L,output:P.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(K)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";G({success:!1,output:z.join(""),error:L})})})}function sA8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return eA8(Y,X?[...X]:null,G,Q);else return tA8(Y,X?[...X]:null,G,Q)}function tA8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function eA8(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]}}N0();l$();r7();ZH();mX();Xq();OH();VK();n8();h7();Pk();s0();var zG6=D6(nP(),1);import{writeFile as KG6}from"fs/promises";import WG6 from"path";N0();mX();class pk1{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.1764720103-g0db7ac"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await uo(Q,this.configService)}catch(Q){v.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class dk1 extends t0{props;constructor(J){super();this.props=J}createState(){return new sX6}}class sX6 extends r0{_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 tX6 extends r0{controller=new aZ;focusNode=new o8({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=H6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=I4.all(new N4(Y.foreground,1,"solid")),K=new IO({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let M=N.trim();if(G&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new g6({children:[new e0({decoration:{color:M1.default()},child:new f1({text:new t(">",new X1({color:Y.foreground}))})}),new F4({child:K})]}),H=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t("",void 0,[new t("Command: ",new X1({color:Y.foreground})),new t(this.widget.props.commandName,new X1({color:M1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new t("Enter",new X1({color:X.keybind}))),z.push(new t(" to submit, ",new X1({color:Y.foreground,dim:!0})));z.push(new t("Esc",new X1({color:X.keybind}))),z.push(new t(" to cancel",new X1({color:Y.foreground,dim:!0})));let U=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t("",void 0,z)})});return new e0({decoration:{border:V,color:M1.default()},padding:P0.all(1),child:new c0({children:[H,new W0({height:1}),W,new A5,U]})})}}class m91 extends t0{props;constructor(J){super();this.props=J}createState(){return new tX6}}OH();class eX6 extends r0{controller=new aZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new o8({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>=wU)return!1;let Q=pC(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=H6.of(J),{colors:Y,app:X}=Q,Z=X8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new hO({controller:this.controller,triggers:[new TN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:P9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new f8({focusNode:this.focusNode,child:V}),W=new e0({constraints:new v6({maxHeight:q}),padding:P0.symmetric(1,0),child:K}),H=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t("",void 0,[new t("Command: ",new X1({color:Y.foreground})),new t(this.widget.props.commandName,new X1({color:M1.yellow,bold:!0}))])})}),z=new e0({padding:P0.symmetric(1,0),child:new f1({text:this.isConfirmingClearInput?new t("",void 0,[new t("Esc",new X1({color:X.keybind})),new t(" again to clear input",new X1({color:Y.foreground,dim:!0}))]):new t("",void 0,[new t("Press ",new X1({color:Y.foreground,dim:!0})),new t("Enter",new X1({color:X.keybind})),new t(" to submit, ",new X1({color:Y.foreground,dim:!0})),new t("Esc",new X1({color:X.keybind})),new t(" to clear",new X1({color:Y.foreground,dim:!0}))])})}),U=[H,new W0({height:1}),new F4({child:W}),new W0({height:1}),z];return new e0({decoration:{border:I4.all(new N4(Y.foreground,1,"solid")),color:M1.default()},padding:P0.all(1),child:new c0({children:U})})}}class $j extends t0{props;constructor(J){super();this.props=J}createState(){return new eX6}}import{isDeepStrictEqual as XO8}from"node:util";var JO8=/[\\/_ +.#"@[({&]/,QO8=/[\\/_ +.#"@[({&]/g,YO8=/[\s-]/,JG6=/[\s-]/g;function p91(J,Q,Y,X,G,Z,q){if(Z===Q.length){if(G===J.length)return 1;return 0.99}let V=`${G},${Z}`;if(q[V]!==void 0)return q[V];let K=X.charAt(Z),W=Y.indexOf(K,G),H=0,z,U,N,M;while(W>=0){if(z=p91(J,Q,Y,X,W+1,Z+1,q),z>H){if(W===G)z*=1;else if(YO8.test(J.charAt(W-1))){if(z*=0.9,M=J.slice(G,W-1).match(JG6),M&&G>0)z*=Math.pow(0.999,M.length)}else if(JO8.test(J.charAt(W-1))){if(z*=0.8,N=J.slice(G,W-1).match(QO8),N&&G>0)z*=Math.pow(0.999,N.length)}else if(z*=0.3,G>0)z*=Math.pow(0.999,W-G);if(J.charAt(W)!==Q.charAt(Z))z*=0.9999}if(z<0.1&&(Y.charAt(W-1)===X.charAt(Z+1)||X.charAt(Z+1)===X.charAt(Z)&&Y.charAt(W-1)!==X.charAt(Z))){if(U=p91(J,Q,Y,X,W+1,Z+2,q),U*0.1>z)z=U*0.1}if(z>H)H=z;W=Y.indexOf(K,W+1)}return q[V]=H,H}function u91(J){return J.toLowerCase().replace(JG6," ")}function QG6(J,Q){let Y=p91(J,Q,u91(J),u91(Q),0,0,{}),X=Q.trim().split(/\s+/);if(X.length>1){let G=0,Z=0;for(let V of X){let K=p91(J,V,u91(J),u91(V),0,0,{});if(K===0)return Y;G+=K,Z+=V.length}let q=G/X.length*0.95;return Math.max(Y,q)}return Y}class qj{}class Vj{}class d91{}class c91{}class YG6 extends t0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new XG6}}class XG6 extends r0{build(J){return this.widget.onContext(J),this.widget.child}}function GO8(J,Q){if(J==="")return{matches:!0,score:1};let Y=QG6(Q,J);return{matches:Y>0.15,score:Y}}class pq extends t0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new GG6}}class GG6 extends r0{controller=new aZ;focusNode;scrollController=new $2;selectedIndex=0;itemContexts=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new o8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),Z9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!XO8(J.props.items,this.widget.props.items)){this.ensureSelectedItemVisible();let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)}}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof qj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof Vj){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof d91){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Y=Q[this.selectedIndex];if(Y){if(!(this.widget.props.isItemDisabled?.(Y)??!1))this.widget.props.onAccept(Y)}}return"handled"}if(J instanceof c91)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items.filter((Y)=>!this.widget.props.filterItem||this.widget.props.filterItem(Y,J)).map((Y)=>({item:Y,...GO8(J,this.widget.props.getLabel(Y))})).filter((Y)=>Y.matches).sort(this.widget.props.sortItems?(Y,X)=>this.widget.props.sortItems(Y,X,J):(Y,X)=>X.score-Y.score).map((Y)=>Y.item);if(this.widget.props.maxRenderItems)return Q.slice(0,this.widget.props.maxRenderItems);return Q}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Y=0,X=Q.size.height;m81(J,{top:Y,bottom:X},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),Z9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Y=this.getFilteredItems();if(J>=0&&J<Y.length){let X=Y[J],G=X?this.widget.props.isItemDisabled?.(X)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Y[this.selectedIndex]??null);else if(Q===2&&!G){if(X)this.widget.props.onAccept(X)}}};build(J){let Q=H6.of(J),{colors:Y}=Q,X=this.getFilteredItems(),G=I4.all(new N4(Y.foreground,1,"solid")),Z=this.widget.props.enabled??!0,q=new IO({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:Z,style:{textColor:Y.foreground,border:null},maxLines:1}),V=new mq({shortcuts:new Map([[new U4("ArrowDown"),new qj],[new U4("ArrowUp"),new Vj],[new U4("Tab"),new qj],[new U4("Tab",{shift:!0}),new Vj],[new U4("n",{ctrl:!0}),new qj],[new U4("p",{ctrl:!0}),new Vj],[new U4("Enter"),new d91],[new U4("Escape"),new c91]]),focusNode:this.focusNode,child:q}),K=new ZY({actions:new Map([[qj,new s8(this.invoke)],[Vj,new s8(this.invoke)],[d91,new s8(this.invoke)],[c91,new s8(this.invoke)]]),child:V}),W=new g6({children:[new e0({decoration:{color:M1.default()},child:new f1({text:new t(">",new X1({color:Y.foreground}))})}),new F4({child:K})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new W0({height:10,child:new n4({child:new f1({text:new t(L,new X1({color:Y.foreground}))})})})}else if(X.length===0&&this.widget.props.emptyStateText)H=new F4({child:new n4({child:new f1({text:new t(this.widget.props.emptyStateText,new X1({color:Y.foreground,dim:!0}))})})});else{let L=X.map((A,E)=>{let P=E===this.selectedIndex,I=this.widget.props.isItemDisabled?.(A)??!1,T;if(this.widget.props.renderItem)T=this.widget.props.renderItem(A,P,I,J);else{let S=P?M1.yellow:void 0,k=P?M1.black:Y.foreground;T=new e0({decoration:S?{color:S}:void 0,padding:P0.symmetric(2,0),child:new f1({text:new t(this.widget.props.getLabel(A),new X1({color:k,dim:I}))})})}return new YG6(new U8({onClick:(S)=>this.handleItemClick(E,S.clickCount),child:T}),(S)=>{this.itemContexts[E]=S})});H=new c0({children:L,crossAxisAlignment:"start"})}let z=new F4({child:new U8({onScroll:this.handleScroll,opaque:!1,child:new B7({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t(this.widget.props.title,new X1({color:M1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new W0({height:1}),z),this.controller.text!==""){let L=X.length>0?X[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new e0({padding:P0.vertical(1),child:new n4({child:A})}));else U.push(new W0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new e0({decoration:{border:G,color:M1.default()},padding:P0.symmetric(1,0),child:new c0({children:U})})}}class ck1 extends t0{createState(){return new ZG6}}class ZG6 extends r0{isGreen=!0;timer;initState(){this.timer=setInterval(()=>{this.isGreen=!this.isGreen,this.setState()},700)}dispose(){if(this.timer)clearInterval(this.timer);super.dispose()}build(J){return new f1({text:new t("●",new X1({color:this.isGreen?M1.green:M1.index(8),bold:!0})),maxLines:1})}}function ZO8(J){let Q=new Map,Y=new Map,X=new Map,G=[];for(let q of J)Q.set(q.id,q);for(let q of J){let V=q.parentRelationships.find((K)=>K.role==="child"&&Q.has(K.threadID));if(V){X.set(q.id,V.type);let K=V.threadID,W=Y.get(K)||[];W.push(q),Y.set(K,W)}else G.push(q)}return DG.flatten(G,(q)=>Y.get(q.id)).map((q)=>({...q.item,depth:q.depth,isLast:q.isLast,ancestorsAreLast:q.ancestorsAreLast,relationshipType:X.get(q.item.id)}))}function lk1(J,Q,Y){return new f1({text:new t(`${J}${Q}`,new X1({color:Y})),maxLines:1})}function $O8(J,Q,Y,X){return[lk1("+",J,X.success),A5.horizontal(1),lk1("~",Q,X.warning),A5.horizontal(1),lk1("-",Y,X.destructive)]}class l91 extends C6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((H)=>H.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((H)=>H.id!==this.props.currentThreadID);let Y=this.props.recentThreadIDs||[],X=this.props.currentThreadID,G=[...Q].sort((H,z)=>{if(X){if(H.id===X)return-1;if(z.id===X)return 1}let U=Y.indexOf(H.id),N=Y.indexOf(z.id);if(U!==-1&&N!==-1)return U-N;if(U!==-1)return-1;if(N!==-1)return 1;return 0}),Z=ZO8(G),q=Math.max(0,...Z.map((H)=>H.description.timeAgo.length)),V=H6.of(J),K=new A6({padding:P0.symmetric(0,1),child:new n4({child:new f1({text:new t("",new X1({color:V.colors.foreground,dim:!0}),[new t("Ctrl+T",new X1({color:M1.blue,dim:!0})),new t(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new X1({color:V.colors.foreground,dim:!0}))])})})});return new pq({items:Z,getLabel:(H)=>H.title,onAccept:(H)=>this.props.onSelect?.(H.id),onDismiss:this.props.onDismiss,onSelectionChange:(H)=>{if(this.props.previewController){if(H)this.props.previewController.select(H.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:1000,footer:this.props.isLoading?void 0:K,renderItem:(H,z,U,N)=>{let M=H6.of(N),{colors:L}=M,A=z?M1.yellow:void 0,E=z?M1.black:L.foreground,P=M1.index(8),I=(Q1,o)=>new W0({width:o,child:g6.end([new f1({text:new t(Q1,new X1({color:P}))})])}),T=this.props.threadViewStates[H.id],S=[],k=H.relationshipType==="handoff",x=new n81;if(H.depth>0){let Q1=[],o=H.ancestorsAreLast.slice(1);for(let V1 of o)Q1.push(new t(x.getAncestorPrefix(V1),new X1({color:x.connectorColor,dim:x.connectorDim})));let u=H.isLast?x.elbow:x.tee,e=x.getConnectorText(u);Q1.push(new t(e,new X1({color:x.connectorColor,dim:x.connectorDim}))),S.push(new f1({text:new t("",void 0,Q1)}))}let b=[],p=this.props.currentThreadID===H.id?new t("(current) ",new X1({color:M1.green})):(this.props.recentThreadIDs||[]).includes(H.id)?new t("(visited) ",new X1({color:L.foreground,dim:!0})):null;if(p)b.push(new f1({text:p}));if(T){if(T.state==="active"&&(T.interactionState==="tool-running"||T.interactionState===!1))b.push(new ck1),b.push(new W0({width:1}))}let g=H.title;if(H.relationshipType==="fork"){let Q1=g.match(/^Forked\((\d+)\): /);if(Q1)g=g.slice(Q1[0].length);else while(g.startsWith("Forked: "))g=g.slice(8);b.push(new f1({text:new t("[fork] ",new X1({color:M1.blue}))}))}else if(k)b.push(new f1({text:new t("[handoff] ",new X1({color:M1.index(208)}))}));if(b.push(new F4({child:new f1({text:new t(g,new X1({color:E})),overflow:"ellipsis",maxLines:1})})),b.push(new W0({width:2})),H.diffStats&&(H.diffStats.added>0||H.diffStats.changed>0||H.diffStats.deleted>0)){let Q1=z?{success:P,warning:P,destructive:P}:L;b.push(...$O8(H.diffStats.added,H.diffStats.changed,H.diffStats.deleted,Q1)),b.push(new W0({width:2}))}return b.push(I(H.description.timeAgo,q)),new e0({decoration:A?{color:A}:void 0,padding:P0.symmetric(2,0),child:new g6({children:[...S,...b]})})}})}}function $G6(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/60000),G=Math.floor(Y/3600000),Z=Math.floor(Y/86400000);if(X<1)return"just now";if(X<60)return`${X}m ago`;if(G<24)return`${G}h ago`;if(Z<7)return`${Z}d ago`;return J.toLocaleDateString()}class ik1 extends C6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((G,Z)=>Z.pubDate.getTime()-G.pubDate.getTime()),Y=Math.max(0,...Q.map((G)=>$G6(G.pubDate).length));return new pq({items:Q,getLabel:(G)=>G.title,onAccept:(G)=>this.props.onSelect?.(G),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(G,Z,q,V)=>{let K=H6.of(V),{colors:W}=K,H=Z?M1.yellow:void 0,z=Z?M1.black:W.foreground,U=M1.index(8),N=G.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new W0({width:A,child:g6.end([new f1({text:new t(L,new X1({color:U}))})])});return new e0({decoration:H?{color:H}:void 0,padding:P0.symmetric(2,0),child:new g6({children:[new F4({child:new f1({text:new t(G.title,new X1({color:z})),overflow:"ellipsis",maxLines:1})}),new W0({width:2}),new f1({text:new t(N,new X1({color:U})),maxLines:1}),new W0({width:2}),M($G6(G.pubDate),Y)]})})}})}}class nk1 extends C6{props;constructor(J){super();this.props=J}build(){return new n4({child:new f1({text:new t("",void 0,[new t(`Forked to new thread:
|
|
4906
4906
|
|
|
4907
4907
|
`,new X1({color:M1.white,dim:!0})),new t(`"${this.props.newThreadTitle||"Untitled"}"`,new X1({color:M1.white}))]),textAlign:"center"})})}}class CN extends t0{props;constructor(J){super();this.props=J}createState(){return new qG6}}class qG6 extends r0{_spinner=new oZ;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=H6.of(J),{colors:Y}=Q,X=I4.all(new N4(Y.foreground,1,"solid")),G=this._spinner.toBraille(),Z=new f1({textAlign:"center",text:new t("",void 0,[new t(G,new X1({color:M1.yellow})),new t(" ",void 0),new t(this.widget.props.message,new X1({color:Y.foreground}))])}),V=[new F4({child:new c0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)V.push(new W0({height:2,child:new e0({padding:P0.symmetric(2,0),child:new f1({text:new t("",new X1({dim:!0}),[new t("Press ",new X1({color:Y.foreground})),new t("Esc",new X1({color:Y.info})),new t(" to cancel",new X1({color:Y.foreground}))])})})}));let K=new e0({decoration:new G8(M1.default(),X),child:new W0({width:60,height:7,child:new c0({mainAxisAlignment:"start",children:V})})});if(this.widget.props.onAbort)return new f8({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 t0{props;constructor(J){super();this.props=J}createState(){return new VG6}}class VG6 extends r0{dispose(){super.dispose()}isWidgetMessage(J){return J instanceof YW}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=d81(Q);return{title:W.title,type:W.type,description:W.description}})(),X=Y.type==="error"?M1.red:M1.yellow,G=I4.all(new N4(M1.default(),1,"solid")),Z=new e0({padding:P0.symmetric(1,0),child:new f1({text:new t(Y.title,new X1({color:X,bold:!0}))})}),q=this.isWidgetMessage(Q)?Q.widget:new f1({text:new t(Y.description,new X1({color:M1.default()})),selectable:!0}),V=new F4({child:new OO({child:new e0({padding:P0.symmetric(1,0),child:q})})}),K=new e0({padding:P0.symmetric(1,0),child:new f1({text:this.widget.props.onRetry?new t("",void 0,[new t("Press ",new X1({color:M1.default(),dim:!0})),new t("R",new X1({color:M1.yellow})),new t(" to retry, ",new X1({color:M1.default(),dim:!0})),new t("Esc",new X1({color:M1.yellow})),new t(" to cancel",new X1({color:M1.default(),dim:!0}))]):new t("Press any key to close",new X1({color:M1.default(),dim:!0,italic:!0}))})});return new f8({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:P0.all(1),child:new c0({mainAxisAlignment:"center",children:[Z,new W0({height:1}),V,K]})})})}}class ak1 extends C6{build(){return new n4({child:new f1({text:new t("",void 0,[new t(`✓ Thread Shared
|
|
4908
4908
|
|
|
@@ -5006,7 +5006,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
|
|
|
5006
5006
|
`)?`${V}...`:G,W=new X1({color:M1.index(8)}),H=[new t(K,W)];if(q>0){let z=new X1({color:Y.success});for(let U=1;U<=q;U++)H.push(new t(" ")),H.push(new t(`[${U}]`,z))}return new A6({padding:P0.only({bottom:0}),child:new g6({crossAxisAlignment:"start",children:[new A6({padding:P0.only({right:1}),child:new f1({text:new t("•",new X1({color:M1.index(8)}))})}),new F4({child:new f1({text:new t("",void 0,H)})})]})})}}class Py1 extends t0{createState(){return new ZZ6}}class ZZ6 extends r0{_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 X1({color:M1.red}),Y=new X1({color:this._visible?M1.red:M1.transparent()});return new g6({children:[new f1({text:new t("⏺",Y)}),new W0({width:1}),new f1({text:new t("Replay",Q)})]})}}class Ry1 extends C6{entry;constructor({key:J,entry:Q}){super({key:J});this.entry=Q}build(J){let Q=H6.of(J),Y=Q.colors.secondary,X=Q.colors.foreground,G=this.entry.authors.map((Z)=>Z.name).join(", ");return new e0({decoration:new G8(void 0,new I4(new N4(Y,1,"rounded"),new N4(Y,1,"rounded"),void 0,new N4(Y,1,"rounded"))),child:new A6({padding:P0.horizontal(1),child:new c0({children:[new g6({crossAxisAlignment:"start",children:[new F4({child:new f1({text:new t(this.entry.title,new X1({color:X,bold:!0}))})}),new W0({width:4}),new f1({text:new t(G||"Community",new X1({color:X,dim:!0}))})]}),new g6({crossAxisAlignment:"start",children:[new F4({child:new f1({text:new t(this.truncateDescription(this.entry.description),new X1({color:X,dim:!0}))})}),new W0({width:2}),new Y7({uri:this.entry.link,text:"View Thread",style:new X1({color:Y,underline:!0})})]})]})})})}truncateDescription(J){let Y=J.replace(/\s+/g," ").trim();if(Y.length<=80)return Y;return Y.slice(0,79)+"…"}}s0();function Dw8(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/3600000),G=Math.floor(X/24),Z=Math.floor(G/7),q=Math.floor(G/30);if(X<1)return"Just now";if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;if(Z<=4)return`${Z}w ago`;return`${q}mo ago`}class Ty1{threadHistoryService;constructor(J){this.threadHistoryService=J}async fetchThreadSummaries(J=""){try{let Q=await new Promise((Y)=>{let X=this.threadHistoryService.observeThreadList().subscribe((G)=>{X.unsubscribe(),Y(G)})});return{ok:!0,threads:this.formatThreadSummaries(Q,J)}}catch(Q){return{ok:!1,errorMsg:Q instanceof Error?Q.message:"An unexpected error occurred"}}}observeThreadSummaries(J=""){return this.threadHistoryService.observeHistory().pipe(q6((Q)=>this.formatThreadSummaries(Q,J)))}formatThreadSummaries(J,Q){return J.filter((X)=>{if(!Q.trim())return!0;let G=X.title?.toLowerCase()||"untitled",Z=X.id.toLowerCase(),q=Q.toLowerCase();return G.includes(q)||Z.includes(q)}).map((X)=>{let G=new Date(X.userLastInteractedAt),Z=Dw8(G),q=X.id.slice(-8),V=X.env?.initial.trees?.[0]?.uri;return{id:X.id,title:X.title||"Untitled",updatedAt:new Date(X.userLastInteractedAt).toISOString(),description:{timeAgo:Z,title:X.title||"Untitled",shortThreadID:q},diffStats:X.summaryStats?.diffStats,workspaceURI:V,parentRelationships:X.parentRelationships}})}}N0();n8();class Cy1{currentId=null;current=null;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new $2;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){v.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId===J)return;this.cancelTimerAndSubscription(),this.currentId=J;let Q=await this.threadService.get(J);if(Q){if(this.currentId===J)this.current=Q,this.notifyListeners()}this.subscribeTimer=setTimeout(()=>{this.subscribeLive(J)},1000)}clear(){this.cancelTimerAndSubscription(),this.currentId=null,this.current=null,this.notifyListeners()}addListener(J){this.listeners.push(J)}removeListener(J){let Q=this.listeners.indexOf(J);if(Q!==-1)this.listeners.splice(Q,1)}dispose(){this.cancelTimerAndSubscription(),this.scrollController.dispose(),this.listeners=[]}subscribeLive(J){if(!this.threadService){v.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(yM()).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 $Z6(J,Q){switch(J){case"update-available":return[new t("A newer Amp is available. Run ",new X1({color:Q.foreground,dim:!0})),new t("amp update",new X1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new t("Update complete, run ",new X1({color:Q.foreground,dim:!0})),new t("amp update",new X1({color:Q.warning})),new t(" to see warnings",new X1({color:Q.foreground,dim:!0}))];case"update-error":return[new t("Update failed, run ",new X1({color:Q.foreground,dim:!0})),new t("amp update",new X1({color:Q.warning})),new t(" to see warnings",new X1({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function ww8(J){return new Promise((Q)=>{Lw8("git",["branch","--show-current"],{cwd:J},(Y,X)=>{if(Y){Q(null);return}let G=X.trim();Q(G||null)})})}class UZ6 extends t0{dependencies;constructor(J){super();this.dependencies=J}createState(){return new BZ6}}class BZ6 extends r0{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;connectedClientsStatusExpanded=!1;randomAd=null;adSubscription=null;threadLoadSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingMCPStatusModal=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;isShowingContextDetailOverlay=!1;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;cancelProcessingConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;paletteShowOptions=null;threadsForPicker=[];isLoadingThreads=!1;threadPreviewController=new Cy1;previewThread=null;planScrollController=(()=>{let J=new $2;return J.followMode=!1,J})();todoScrollController=(()=>{let J=new $2;return J.followMode=!1,J})();filterThreadPickerByWorkspace=!0;currentGitBranch=null;messageViewFocusNode=new o8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new o8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;threadFeedReader=null;currentThreadFeedEntry=null;threadFeedEntries=[];threadFeedSubscription=null;threadFeedRotationTimer=null;threadFeedHidden=!1;threadFeedTickerQueue=[];hasSubmittedFirstMessage=!1;currentUserInfo=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;previousThreadIdForHint=null;pendingMCPServers=[];mcpTrustSubscription=null;mcpServers=[];mcpServersSubscription=null;cacheTimerState=null;cacheTimerSubscription=null;agentModeController=null;freeTierStatus=void 0;agentModePulseSeq=0;agentModeSlideProgress=null;agentModeSlideTimer=null;updateState="hidden";updateServiceSubscription=null;toastController=new IS1;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=null;async initThreadFeed(){let J=await N6(this.widget.dependencies.configService.config);if(J.settings["feed.enabled"]===!1)this.threadFeedHidden=!0;let Q=J.settings.url,Y=Q.includes("localhost")||Q.includes("127.0.0.1");try{let q=await this.widget.dependencies.internalAPIClient.getUserInfo({},{config:this.widget.dependencies.configService});if(q.ok){let V=q.result,K="user"in V?V.user:V;this.currentUserInfo={username:K.username??void 0,displayName:K.displayName??void 0};let W="ffe10a0c-6c42-41ce-a3a6-38990fd6caf8";if(!Y&&V.team?.id!==W)return}else return}catch(q){v.debug("Failed to fetch user info for thread feed filtering",q);return}let X="/threads.rss",G=async(q,V)=>{let K=q instanceof Request?q.url:q.toString();return BJ(K,V,this.widget.dependencies.configService)},Z=Zi0();Z.get("entries").then((q)=>{if(q){let V=this.filterEntries(q);if(this.threadFeedEntries=V,V.length>0&&!this.currentThreadFeedEntry){let K=[...V].sort((H,z)=>z.pubDate.getTime()-H.pubDate.getTime());this.threadFeedTickerQueue=[...K,...this.threadFeedTickerQueue];let W=this.getNextFeedEntry();if(W)this.setState(()=>{this.currentThreadFeedEntry=W})}}}),this.threadFeedReader=new gj1(Z,G,{url:X}),this.threadFeedSubscription=this.threadFeedReader.stream().subscribe({next:(q)=>{try{let V=this.filterEntries(q);if(V.length>0){this.threadFeedEntries=[...V,...this.threadFeedEntries];let K=[...V].sort((W,H)=>H.pubDate.getTime()-W.pubDate.getTime());if(this.threadFeedTickerQueue=[...K,...this.threadFeedTickerQueue],!this.currentThreadFeedEntry){let W=this.getNextFeedEntry();if(W)this.setState(()=>{this.currentThreadFeedEntry=W})}}}catch(V){v.error("Thread feed: error in next handler",V)}},error:(q)=>{v.error("Thread feed error:",q)}}),this.resetThreadFeedRotation()}filterEntries(J){if(!this.currentUserInfo)return J;let{username:Q,displayName:Y}=this.currentUserInfo;return J.filter((X)=>{return!X.authors.some((G)=>{let Z=G.name;if(!Z)return!1;return Q&&Z===Q||Y&&Z===Y||Q&&Z.includes(Q)})})}rotateThreadFeed(){if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);this.threadFeedRotationTimer=setInterval(()=>{let J=this.getNextFeedEntry();if(J)this.setState(()=>{this.currentThreadFeedEntry=J})},30000)}resetThreadFeedRotation(){this.rotateThreadFeed()}getNextFeedEntry(){if(this.threadFeedTickerQueue.length>0)return this.threadFeedTickerQueue.shift();return null}recordNavigation(J){this.threadBackStack.push(J),this.threadForwardStack=[]}navigateBack=async()=>{if(this.threadBackStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadBackStack.pop();this.threadForwardStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};navigateForward=async()=>{if(this.threadForwardStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadForwardStack.pop();this.threadBackStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};startAndSwitchToNewThread=async()=>{let J=this.widget.dependencies.worker.thread.id;this.recordNavigation(J);let Q=await this.widget.dependencies.startNewThread();return this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,this.widget.dependencies.switchWorker(Q),this.setState(()=>{this.isMessageViewInSelectionMode=!1,this.previousThreadIdForHint=J}),Q};async startReplay(){let J=this.widget.dependencies.replayMode;if(!J)return;let{thread:Q,typingEnabled:Y,baseWpm:X}=J,G=Q.messages;for(let Z=0;Z<G.length;Z++){if(this.replayAbortController.signal.aborted)break;let q=G[Z];if(!q)continue;if(Z>0)await this.replaySleep(J.messageDelayMs);if(q.role==="user"&&Y){let W=q.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
|
|
5007
5007
|
`);if(W)await this.replayTypeMessage(W,X)}if(q.role==="assistant"){let W=q.content.some((U)=>U.type==="tool_use"),H=G[Z+1],z=H?.role==="user"&&H.content.some((U)=>U.type==="tool_result");if(W&&z){let U={...q,state:{type:"streaming"}};this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,U],this.textController.clear()});let N=J.thread.id;this.getMessageScrollController(N).scrollToBottom(),await this.replaySleep(J.toolProgressDelayMs),this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages.slice(0,-1),q]});continue}}this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,q],this.textController.clear()});let V=J.thread.id;this.getMessageScrollController(V).scrollToBottom()}await this.replaySleep(J.exitDelayMs),P9.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;if(this.looksLikePastedContent(G.trim())){await this.replaySleep(150),this.textController.text=this.textController.text+G,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{}),await this.replaySleep(300);continue}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)}}}looksLikePastedContent(J){if(/^[a-z][a-z0-9+.-]*:\/\//i.test(J))return!0;if(J.startsWith("/")&&J.length>10)return!0;if(/^[a-z]:\\/i.test(J))return!0;if(/^[a-f0-9]{7,40}$/i.test(J))return!0;if(/^T-[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(J))return!0;return!1}replaySleep(J){return new Promise((Q)=>{this.replayTypingTimer=setTimeout(Q,J)})}getEffectiveAgentMode(){return this.agentModeController?.getEffectiveMode()??"smart"}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Y=J.items.filter((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 t(this.submitDisabledHint,new X1({color:J.foreground,dim:!0}));if(this.isExiting)return new t("Exiting...",new X1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new t("",void 0,[new t("Ctrl+C",new X1({color:Q.keybind})),new t(" again to exit",new X1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new t("",void 0,[new t("Esc",new X1({color:Q.keybind})),new t(" again to clear input",new X1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new t("",void 0,[new t("Escape",new X1({color:Q.keybind})),new t(" to close help",new X1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let G=this.getEffectiveAgentMode(),Z=xy1(G);return new t("",void 0,[new t("Images aren't supported in ",new X1({color:J.warning,dim:!1})),new t(G,new X1({color:Z})),new t(" mode.",new X1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new t("",void 0,[new t("Esc",new X1({color:Q.keybind})),new t(" again to cancel",new X1({color:J.foreground,dim:!0}))]);return new t("",void 0,[new t("Esc",new X1({color:Q.keybind})),new t(" to cancel",new X1({color:J.foreground,dim:!0}))])}let Y=$Z6(this.updateState,J);if(Y)return new t("",void 0,Y);let X=this.widget.dependencies.worker.thread;if(X.agentMode==="plan"&&UO(X))return new t("",void 0,[new t("Ctrl+O",new X1({color:Q.keybind})),new t(" → Execute Plan",new X1({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){v.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 R3.getOrCreateForThread(Y,G),V=await yT(q,X,Z-1);await this.switchToExistingThread(V)}catch(q){v.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=AN(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){v.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){v.error("Failed to edit message:",q)}};getAffectedFiles=async(J)=>{let{worker:Q}=this.widget.dependencies;try{return(await Q.getFilesAffectedByTruncation(J)).map(VJ)}catch(Y){return v.error("Failed to get affected files:",Y),[]}};textController=new aZ;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new $2);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let G=this.searchElementTreeByKey(X,Q);if(G)return G}return null}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{this.toastController.show("Selection copied to clipboard","success",2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Y=process.cwd().replace(process.env.HOME||"","~"),X=Q?`amp - ${Q} - ${Y}`:"";process.stdout.write(rC1(X))}}_handleTextCopy(J){if(J&&J.length>0)this.toastController.show("Selection copied to clipboard","success",2000)}textFieldKey=new G2("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;paletteCommands;paletteConfig;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Y=AN(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}),Z9.instance.addPostFrameCallback(()=>{this.autocompleteFocusNode.requestFocus()})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.dismissIdePicker();return}try{await this.connectToSelectedIde(J,Q)}catch(Y){let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.dismissIdePicker()};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}previewControllerListener=(J)=>{this.setState(()=>{this.previewThread=J})};showStandaloneThreadPicker=()=>{this.showCommandPalette({type:"standalone",commandId:"continue",onSubmit:()=>{this.threadPreviewController.clear(),this.setState(()=>{this.isShowingPalette=!1,this.paletteShowOptions=null}),Z9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette)this.autocompleteFocusNode.requestFocus()})},onCancel:()=>{this.exitApplication()}})};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(J){if(this.setState(()=>{this.isShowingPalette=!this.isShowingPalette,this.paletteShowOptions=J??null}),this.isShowingPalette)this.loadThreadsForPicker()}isShowingStandalonePalette(){return this.isShowingPalette&&this.paletteShowOptions?.type==="standalone"}getPaletteCommands(){if(!this.paletteCommands){if(!this.paletteConfig)throw Error("Config not yet available");this.paletteCommands=new rk1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})},this.widget.dependencies.isDogfooding,this.paletteConfig)}return this.paletteCommands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new ek1(this.widget.dependencies.fuzzyServer);return this.completionBuilder}dismissPalette=()=>{this.setState(()=>{this.isShowingPalette=!1,this.paletteShowOptions=null})};getCommandPaletteContext=(J)=>{let{threadState:Q,recentThreadIDs:Y}=this.widget.dependencies;if(!Q.mainThread)return null;let X=u0.file(process.cwd()),G=T6(X);return{recentThreadIDs:Y,currentThreadID:Q.mainThread.id,context:J,worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:Q.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let Z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),Z},setImageAttachments:(Z)=>{this.setState(()=>{this.imageAttachments=Z})},editorDispatch:(Z)=>{switch(Z.type){case"set-input":this.textController.clear(),this.textController.insertText(Z.input);break;case"insert-text":this.textController.insertText(Z.text);break;case"clear":this.textController.clear();break}},submitMessage:(Z)=>{return this.proceedWithUserMessage(Z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,mcpService:this.widget.dependencies.mcpService,startNewThread:async()=>{await this.startAndSwitchToNewThread()},navigateBack:this.navigateBack,navigateForward:this.navigateForward,canNavigateBack:this.threadBackStack.length>0,canNavigateForward:this.threadForwardStack.length>0,canUseAmpFree:this.widget.dependencies.freeTierStatus?.canUseAmpFree??!1,switchToThread:async(Z)=>{return await this.switchToExistingThread(Z),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(Z,q,V)=>{let K=this.widget.dependencies.threadState.mainThread?.id;if(!K)throw Error("No active thread");let W=setTimeout(()=>{V.throwIfAborted()},60000);try{let H=await this.widget.dependencies.threadService.generateHandoffPrompt(K,Z,q,this.widget.dependencies.configService,V);return clearTimeout(W),H}catch(H){throw clearTimeout(W),H}},handleHandoff:async(Z,q)=>{let{goal:V,generatedPrompt:K,images:W}=q;if(!V&&!K)return{ok:!1,error:Error("Either goal or generatedPrompt required")};try{let H=this.widget.dependencies.threadState.mainThread?.id;if(!H)return{ok:!1,error:Error("No active thread")};let z=setTimeout(()=>Z.abort(new b91("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let U=await this.widget.dependencies.threadService.createHandoffThread(H,{goal:V,generatedPrompt:K,images:W},this.widget.dependencies.configService,Z.signal);return clearTimeout(z),await this.switchToExistingThread(U),{ok:!0}}catch(U){if(clearTimeout(z),U instanceof Error&&(U.name==="AbortError"||U.message.includes("aborted")))throw Z.signal.reason;throw U}}catch(H){return v.error("Failed to create handoff thread",H),{ok:!1,error:H instanceof Error?H:Error(String(H))}}},getGuidanceFiles:async(Z)=>{if(!Q.mainThread)return[];return(await Ws({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,Z)).map((V)=>({uri:V.uri,type:V.type}))},openIdePicker:()=>{this.openIdePicker()},getAgentMode:()=>{return this.agentModeController?.getMode()??null},setAgentMode:(Z)=>{this.agentModeController?.setMode(Z)},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,handleExecutePlan:async()=>{try{let Z=Q.mainThread?.id;if(!Z){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let q=await this.widget.dependencies.threadService.createPlanExecutionThread(Z,"smart");await this.switchToExistingThread(q)}catch(Z){v.error("Failed to execute plan",Z),this.setState(()=>{this.displayMessage=Error(`Failed to execute plan: ${Z instanceof Error?Z.message:String(Z)}`)})}},planFileManager:this.widget.dependencies.planFileManager,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:G,threadViewStates:this.widget.dependencies.workerController.threadViewStates,currentThreadFeedEntry:this.currentThreadFeedEntry,threadFeedEntries:this.threadFeedEntries,threadFeedHidden:this.threadFeedHidden,setThreadFeedHidden:(Z)=>{this.setState(()=>{this.threadFeedHidden=Z})},showMCPStatusModal:()=>{this.setState(()=>{this.isShowingMCPStatusModal=!0})}}};loadThreadsForPicker(){if(this.threadLoadSubscription)return;this.setState(()=>{this.isLoadingThreads=!0});let J=new Ty1(this.widget.dependencies.threadHistoryService);this.threadLoadSubscription=J.observeThreadSummaries("").subscribe({next:(Q)=>{this.setState(()=>{this.threadsForPicker=Q,this.isLoadingThreads=!1})},error:()=>{this.setState(()=>{this.isLoadingThreads=!1})}})}updateGitBranch=async()=>{let J=await ww8(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===LN).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===LN};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})};showContextDetailOverlay=()=>{this.setState(()=>{this.isShowingContextDetailOverlay=!0})};toggleAgentMode=()=>{if(!this.agentModeController)return;if(this.agentModeController.toggle())this.setState(()=>{this.showImageUnsupportedHint=!1,this.agentModePulseSeq++})};startAgentModeSlide=()=>{if(this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer);this.setState(()=>{this.agentModeSlideProgress=0});let J=800,Q=16,Y=Q/J;this.agentModeSlideTimer=setInterval(()=>{this.setState(()=>{if(this.agentModeSlideProgress!==null){if(this.agentModeSlideProgress=Math.min(1,this.agentModeSlideProgress+Y),this.agentModeSlideProgress>=1){if(this.agentModeSlideProgress=null,this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer),this.agentModeSlideTimer=null}}})},Q)};handleInsertImage=(J)=>{let Q=this.getEffectiveAgentMode();if(!Jy(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>=wU)return!1;let Y=pC(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 hq(W);try{let H=await Y(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")v.error("Failed to read temporary file",H)}try{await X(W),await G(K)}catch(H){v.warn("Failed to clean up temporary file",H)}}catch(K){v.error("Error opening editor:",K)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=AN(J);if(Q)if(!Q.cmd){this.showSubmitDisabledHint("No command provided");return}else if(this.isProcessing()){this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}else{this.invokeBashCommand(Q.cmd,{visibility:Q.visibility}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();return}this.textController.clear(),this.resetHistory(),await this.updateGitBranch(),await this.sendUserMessage(J)};agentModeListener=()=>{this.setState(()=>{})};initState(){if(WG.getInstance().interceptConsole(),this.freeTierStatus=this.widget.dependencies.freeTierStatus,this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();P9.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),P9.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),P9.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Y)=>{Z9.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Y.hasFocus})})}),N6(this.widget.dependencies.configService.config).then((Y)=>{this.paletteConfig=Y,this.agentModeController=new lj1({initialCliMode:this.widget.dependencies.initialAgentMode,sessionState:this.widget.dependencies.sessionState??null,freeTierStatus:this.freeTierStatus?{canUseAmpFree:this.freeTierStatus.canUseAmpFree,eligible:this.freeTierStatus.eligible,workspaceAllowsAmpFree:this.freeTierStatus.workspaceAllowsAmpFree}:void 0,initialSettings:Y.settings,config$:this.widget.dependencies.configService.config,getThread:()=>this.widget.dependencies.getCurrentWorker()?.thread??this.widget.dependencies.worker.thread}),this.agentModeController.addListener(this.agentModeListener)}),this.updateGitBranch(),this.adSubscription=Lj1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{let Y=this.agentModeController?.getMode();return(Y&&q5(Y)||this.randomAd===null)&&Mj1(this.lastUserInteractionTime)}).subscribe({next:(Y)=>{if(Y){let X=Aw8(16).toString("hex");this.lastAdImpressionId=X,Promise.resolve().then(() => (H51(),W51)).then(({recordAdEvent:G})=>{let Z=this.widget.dependencies.worker.thread,q=Z.messages[Z.messages.length-1];G("viewed",{adId:Y.id,advertiserId:Y.advertiserId,threadId:Z.id,messageId:q?.messageId,impressionId:X,placement:"tui",matchType:Y.metadata?.matchType,matchedPatterns:Y.metadata?.matchedPatterns,candidateAdPoolCount:Y.metadata?.candidateAdPoolCount,clientRegion:Y.metadata?.clientRegion})})}this.setState(()=>{this.randomAd=Y}),Z9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}});let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((Y)=>{this.setState(()=>{this.pendingMCPServers=Y})}),this.mcpServersSubscription=this.widget.dependencies.mcpService.servers.subscribe((Y)=>{this.setState(()=>{this.mcpServers=Y})}),this.cacheTimerSubscription=this.widget.dependencies.worker.cacheTimer.subscribe((Y)=>{this.setState(()=>{this.cacheTimerState=Y})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Y)=>{this.setState(()=>{this.ideStatus=Y})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Y)=>{let X=this.widget.dependencies.getCurrentWorker();if(!X){v.warn("No active thread worker found to handle IDE message");return}await new Promise((G)=>setTimeout(G,50)),await X.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}}),v.debug("Message sent from IDE to agent",{message:Y.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Y)=>{this.textController.insertText(Y),v.debug("Appended text to CLI prompt from IDE",{text:Y.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Y)=>{this.setState(()=>{this.connectedClientsStatus=Y})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Y)=>{this.setState(()=>{this.updateState=Y})}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Y)=>{let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller();if(this.widget.dependencies.replayMode)setTimeout(()=>this.startReplay(),100);this.initThreadFeed()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.replayAbortController.abort(),this.replayTypingTimer)clearTimeout(this.replayTypingTimer);if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeController)this.agentModeController.removeListener(this.agentModeListener),this.agentModeController.dispose();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.mcpTrustSubscription)this.mcpTrustSubscription.unsubscribe();if(this.mcpServersSubscription)this.mcpServersSubscription.unsubscribe();if(this.cacheTimerSubscription)this.cacheTimerSubscription.unsubscribe();if(this.threadLoadSubscription)this.threadLoadSubscription.unsubscribe();if(this.threadFeedSubscription)this.threadFeedSubscription.unsubscribe();if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);if(this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer),this.agentModeSlideTimer=null;if(this.threadPreviewController.removeListener(this.previewControllerListener),this.threadPreviewController.dispose(),this.toastController.dispose(),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.textController.removeListener(this.textChangeListener);for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(rC1("")),this.shouldUseProgressBar())process.stdout.write(b76())}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"){v.error("No current tool confirmation found");return}let Y=Q.tools[0]?.useBlock;if(!Y){v.error("No tool use block found in confirmation");return}if(J==="allow-all-session")b$("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 v.error("Failed to write dangerouslyAllowAll setting:",G);return}if(J==="always-guarded"){let G=Q.tools[0]?.toAllow??[],Z=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],q=[...G,...Z];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",q,"global")}if(J==="connect-github"){let G=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();await QX(this.context,G);return}if(J==="disable-librarian"){let G=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!G.includes(TX))await this.widget.dependencies.settingsStorage.set("tools.disable",[...G,TX],"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 R3.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(G);else await this.widget.dependencies.worker.handle(G)}catch(G){v.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.agentModeController?.setMode("smart"),this.setState(()=>{this.dismissedEphemeralErrorKey=null}),C41({agentMode:"smart"}),await this.startAndSwitchToNewThread();break}case"handoff":{if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);this.showCommandPalette({type:"normal",commandId:"handoff"});break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};handleMCPTrustOpenSettings=async()=>{let{mcpTrustHandler:J,settingsStorage:Q}=this.widget.dependencies;await J.deny();try{await hq(Q.getSettingsFilePath())}catch(Y){let X=Y instanceof Error?Y.message:String(Y);await this.showErrorMessage(`Failed to open settings: ${X}`)}};cancelStreamingMessage=async()=>{await R3.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{v.info(`[switchToExistingThread] Switching to thread: ${J}`);let X=await this.widget.dependencies.switchToThread(J);if(v.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${X.thread.agentMode}`),this.widget.dependencies.worker=X,this.widget.dependencies.threadID=X.thread.id,this.widget.dependencies.switchWorker(X),v.info("[switchToExistingThread] Clearing agent mode"),this.agentModeController?.setMode(null),X.thread.draft)if(v.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),typeof X.thread.draft==="string")this.textController.insertText(X.thread.draft);else{let G=X.thread.draft.filter((V)=>V.type==="text"),Z=X.thread.draft.filter((V)=>V.type==="image"),q=G.map((V)=>V.text).join(`
|
|
5008
5008
|
`);if(q)this.textController.insertText(q);if(Z.length>0)this.setState(()=>{this.imageAttachments=Z})}}catch(X){throw v.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=zJ(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(Y)this.startAgentModeSlide();if(await Q.handle({type:"user:message",message:{content:G,agentMode:X}}),Y)C41({agentMode:X});this.scrollMessageViewToBottom(),this.setState(()=>{if(this.imageAttachments=[],!this.hasSubmittedFirstMessage)this.hasSubmittedFirstMessage=!0}),Z9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{this.setState(()=>{this.isExiting=!0});let J=this.widget.dependencies.threadState.mainThread;if(J?.messages.length===0){if(J.relationships?.find((X)=>X.type==="handoff"&&X.role==="child"))await this.widget.dependencies.threadService.discardHandoffThread(J.id).catch(()=>{})}let Q=this.getEffectiveAgentMode();C41({agentMode:Q}).catch((Y)=>{v.warn("Failed to save session state on exit:",Y)}).finally(()=>{P9.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=Ow8();if(J===Q)return"~";if(J.startsWith(Q+Uu.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(Uu.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(Uu.sep),"…",Q.slice(-2).join(Uu.sep)].join(Uu.sep)}build(J){let Q=X8.of(J),Y=H6.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&&q5(q.thread.agentMode),K=V&&this.randomAd!==null,W=!V&&this.currentThreadFeedEntry!==null&&!this.threadFeedHidden&&this.hasSubmittedFirstMessage,H=K||W,{threadState:z}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),N=this.widget.dependencies.replayMode,M=Boolean(N),L=z.items,A=z.mainThread||void 0,E=z.subagentToolsByParentID,P=z.todosList;if(M){let Z4={...N.thread,messages:this.replayDisplayedMessages};L=Zj(Z4).items,A=Z4,E={};let R4=AI({messages:this.replayDisplayedMessages});P=Array.isArray(R4)?R4:[]}let I=A?.id,T=A,S=M?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),k=(Z4)=>new v91({key:new G2(`preview-message-view-${Z4.id}`),items:Zj(Z4).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:Z4,focusNode:new o8({debugLabel:"PreviewFocus"})}),x=this.previewThread,b=x?x.messages.length>2000?new c0({mainAxisSize:"max",children:[new F4({child:new W0}),new A6({padding:P0.all(2),child:new n4({child:new f1({text:new t("Thread too long for preview",new X1({color:G.mutedForeground,dim:!0}))})})})]}):k(x):S?new h91({agentMode:this.getEffectiveAgentMode()}):new v91({key:I?new G2(`message-view-${I}`):void 0,items:L,subagentToolsByParentID:E,controller:I?this.getMessageScrollController(I):new $2,autofocus:!1,onCopy:M?void 0:this._handleTextCopy.bind(this),thread:T,onMessageEditSubmit:M?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:M?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:M?void 0:this.forkMessage,getAffectedFiles:M?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),p=Math.max(Math.floor(Q.size.height*0.4),12),g=this.getCurrentEphemeralError(),i=Q.size.width<40,Q1=z.mainThread?zN0(z.mainThread):void 0,o=vz(J),u=this.buildBottomWidget(g,U,G,Y,z,P,p,H,M,Q1,this.cacheTimerState??void 0,Q,o),e=new r81({threadViewState:z.viewState,threadTokenUsage:Q1,threadID:I??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,mcpServers:this.mcpServers,isNarrow:i,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!U,showingEphemeralError:Boolean(z.viewState.state==="active"&&z.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),V1=new a81({bashInvocations:this.bashInvocations}),H1=[],a=this.getEffectiveAgentMode(),s=this.currentShellModeStatus,l=xy1(a),K1=!s?a.length+1:0,k1=Q.capabilities.animationSupport,J1=k1==="disabled"?0:k1==="slow"?30:60,v1=uV(a)?.uiHints?.fasterAnimation?3:1,I1=J1>0&&this.agentModePulseSeq>0?new z5({children:[u,new _7({top:0,left:1,right:1,height:1,child:new wy1({color:l,trigger:this.agentModePulseSeq,fps:J1,speed:v1,leftOffset:K1})})]}):u;H1.push(new F4({child:b}),V1);let A0=new z5({children:[new c0({mainAxisSize:"min",children:[K?new bk1({ad:this.randomAd,onButtonClick:async()=>{let Z4=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (H51(),W51)).then(({recordAdEvent:l6})=>{let $9=this.widget.dependencies.worker.thread,C8=$9.messages[$9.messages.length-1];l6("clicked",{adId:Z4.id,advertiserId:Z4.advertiserId,threadId:$9.id,messageId:C8?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:Z4.metadata?.matchType,matchedPatterns:Z4.metadata?.matchedPatterns,candidateAdPoolCount:Z4.metadata?.candidateAdPoolCount,clientRegion:Z4.metadata?.clientRegion})});if(!await QX(this.context,Z4.shortDestinationUrl)){let $9=P9.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:$9,url:Z4.shortDestinationUrl}})}}}):W?new Ry1({entry:this.currentThreadFeedEntry}):new W0({height:0}),new e0({constraints:new v6(0,Q.size.width,0,p),child:I1})]}),H?new _7({top:0,left:0,right:0,child:new MZ6({userHeight:this.bottomGridUserHeight,maxHeight:p,onInitializeHeight:(Z4)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(Z4,p)})},onDrag:(Z4)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(Z4.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let R4=Math.floor(Z4.localPosition.y)-this.bottomGridDragStartY,l6=Math.max(4,this.bottomGridDragStartHeight-R4),$9=Math.min(l6,p),C8=Math.floor($9);if(this.bottomGridUserHeight!==C8)this.setState(()=>{this.bottomGridUserHeight=C8})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new W0({height:0})]});H1.push(A0,new W0({height:1,child:new A6({padding:P0.horizontal(1),child:e})}));let T1=new c0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:H1}),U1=M&&N?.showIndicator!==!1?new z5({children:[T1,new _7({top:0,left:0,child:new Py1})]}):T1,Y1=new s8(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.isShowingMCPStatusModal)return this.setState(()=>{this.isShowingMCPStatusModal=!1}),"handled";if(this.pendingMCPServers.length>0)return this.widget.dependencies.mcpTrustHandler.deny(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!1}),"handled";if(this.isShowingContextDetailOverlay)return this.setState(()=>{this.isShowingContextDetailOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.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((R4)=>{v.error("Failed to mark message as interrupted:",R4)}),this.cancelStreamingMessage().catch((R4)=>{v.error("Failed to cancel streaming message:",R4)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return v.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.bashInvocations.length>0||this.isProcessing()){if(this.setState(()=>{this.isConfirmingCancelProcessing=!0}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout);return this.cancelProcessingConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout=null},1000),"handled"}if(this.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"}),O1=new s8(()=>{return this.onExitPressed(),"handled"}),w1=new s8(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),P1=new s8(()=>{return this.setState(()=>{this.isShowingMCPStatusModal=!this.isShowingMCPStatusModal}),"handled"}),E1=new s8(()=>{return SJ.instance.toggleAll(),"handled"}),d1=new s8(()=>{return this.widget.dependencies.configService.getLatest().then((Z4)=>{b$("internal.showCost",!(Z4.settings["internal.showCost"]??!0))}),"handled"}),b1=new s8(()=>{return P9.instance.toggleFrameStatsOverlay(),"handled"}),r1=new s8(()=>{return P9.instance.tuiInstance.getScreen().markForRefresh(),Z9.instance.requestFrame(),"handled"}),$0=new s8(()=>{return this.toggleAgentMode(),"handled"}),G0=new s8(()=>{let R4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:l6}=this.widget.dependencies,$9=l6.mainThread?.id;return $9?this.getMessageScrollController($9):null})();if(R4){let l6=Math.max(Math.floor(Q.size.height*0.4),10),$9=Q.size.height-l6;R4.animatePageUp($9,100)}return"handled"}),C0=new s8(()=>{let R4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:l6}=this.widget.dependencies,$9=l6.mainThread?.id;return $9?this.getMessageScrollController($9):null})();if(R4){let l6=Math.max(Math.floor(Q.size.height*0.4),10),$9=Q.size.height-l6;R4.animatePageDown($9,100)}return"handled"}),U6=new s8(()=>{let R4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:l6}=this.widget.dependencies,$9=l6.mainThread?.id;return $9?this.getMessageScrollController($9):null})();if(R4)R4.animateTo(0,100);return"handled"}),L6=new s8(()=>{let R4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:l6}=this.widget.dependencies,$9=l6.mainThread?.id;return $9?this.getMessageScrollController($9):null})();if(R4)R4.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),P4=new s8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:Z4}=this.widget.dependencies;if(!Z4.mainThread?.messages.some((l6)=>l6.role==="user"||LI(l6)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),a4=new s8((Z4)=>{if(Z4.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),k9=new s8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return p81().then(async(Z4)=>{if(Z4)try{this.handleInsertImage(Z4)}finally{try{let{unlink:R4}=await import("node:fs/promises");await R4(Z4)}catch{}}}),"handled"}),E0=new Map([[U4.ctrl("c"),new um],[U4.ctrl("l"),new nm],[U4.ctrl("o"),new b81],[U4.ctrl("v"),new gm],[U4.alt("s"),new iC],[U4.ctrl("s"),new iC],[U4.alt("p"),new lm],[U4.ctrl("r"),new dm],[U4.alt("d"),new cm],[U4.ctrl("t"),new am],[U4.key("PageUp"),new x81],[U4.key("PageDown"),new v81],[U4.key("Home"),new f81],[U4.key("End"),new h81],[U4.key("Escape"),new mm],[U4.ctrl("p"),new nC("previous")],[U4.ctrl("n"),new nC("next")],[U4.key("Tab"),new om]]);if(!Y3())E0.set(U4.key("ArrowUp"),new om);if(!1)E0.set(U4.alt("c"),new pm);E0.set(U4.ctrl("m"),new im);let t6=new s8(()=>{if(this.isShowingStandalonePalette())return"handled";return this.showCommandPalette(),"handled"}),$8=new s8(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),T8=new Map([[mm,Y1],[nm,r1],[iC,$0],[b81,t6],[gm,k9],[pm,w1],[im,P1],[dm,E1],[cm,d1],[lm,b1],[am,$8],[um,O1],[x81,G0],[v81,C0],[f81,U6],[h81,L6],[om,P4],[nC,a4]]),b8=[U1];if(this.isShowingConsoleOverlay)b8.push(new Yy1);if(this.isShowingHelp&&this.paletteConfig)b8.push(new $y1({commands:this.getPaletteCommands().getAllCommands()}));if(this.isShowingMCPStatusModal)b8.push(new Gk1({servers:this.mcpServers,onDismiss:()=>{this.setState(()=>{this.isShowingMCPStatusModal=!1})}}));if(this.adActionModal)b8.push(new gk1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(Z4)=>{let R4=this.adActionModal.url;if(Z4==="copy")try{await P9.instance.tuiInstance.clipboard.writeText(R4),this.setState(()=>{this.displayMessage=new NG("Link copied to clipboard")})}catch(l6){v.error("Failed to copy to clipboard",{error:l6}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.pendingMCPServers.length>0){let{mcpTrustHandler:Z4}=this.widget.dependencies;b8.push(new Ey1({servers:this.pendingMCPServers,onAlwaysTrust:Z4.trustAlways.bind(Z4),onTrustOnce:Z4.trustOnce.bind(Z4),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:Z4.deny.bind(Z4)}))}if(this.isShowingFileChangesOverlay)b8.push(new vS1({threadData:z}));if(this.isShowingCostBreakdownOverlay&&z.mainThread)b8.push(new Gy1({thread:z.mainThread}));if(this.isShowingContextDetailOverlay)b8.push(new Xy1({thread:z.mainThread??void 0,tokenUsage:Q1??void 0,cacheTimerState:this.cacheTimerState??void 0,onDismiss:()=>{this.setState(()=>{this.isShowingContextDetailOverlay=!1})}}));if(this.isShowingConfirmationOverlay)b8.push(new Jy1({details:this.confirmationOverlayContent}));let U5=this.getCommandPaletteContext(J);if(U5&&this.isShowingPalette&&this.paletteConfig)b8.push(new n4({child:new e0({constraints:v6.loose(80,20),child:new tk1({commandContext:U5,mainThread:z.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,showOptions:this.paletteShowOptions??void 0})})}));if(this.isShowingIdePicker)b8.push(new Vy1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));let Z7=new z5({children:b8});if(this.isShowingJetBrainsInstaller)return new EO({child:new ZY({actions:T8,child:new mq({shortcuts:E0,debugLabel:"jetbrains-installer-shortcuts",child:new Oy1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new kz({controller:this.toastController,child:new EO({child:new PS1({controller:this.toastController,child:new ZY({actions:T8,child:new mq({shortcuts:E0,debugLabel:"main-app-shortcuts",child:Z7})})})})})}buildScrollableTodoList(J,Q,Y){return new NZ6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Y})}buildBottomWidget(J,Q,Y,X,G,Z,q,V,K,W,H,z,U){if(J)return new Zy1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Qy1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new Iy1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let N=i81(X),M=this.agentModeController?.isInRestrictedFreeMode()??!1,L=new hO({key:this.textFieldKey,controller:this.textController,triggers:K?[]:[new TN],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":M?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!M&&!this.isShowingStandalonePalette(),shellPromptRules:N,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandalonePalette()&&!this.isShowingIdePicker,clipboard:P9.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage,previousThreadId:this.previousThreadIdForHint&&(G.mainThread?.messages.length??0)===0?this.previousThreadIdForHint:void 0,onPreviousThreadHintAccepted:()=>{let a=this.previousThreadIdForHint;if(a)this.setState(()=>{this.previousThreadIdForHint=null}),this.textController.text=`following: @${a} `},onDoubleAtTrigger:K?void 0:()=>{let a=this.textController.text,s=this.textController.cursorPosition,K1=a.slice(0,s).lastIndexOf("@@");this.showCommandPalette({type:"standalone",commandId:"mention-thread",onBeforeExecute:()=>{if(K1!==-1){let k1=this.textController.text,J1=k1.slice(0,K1)+k1.slice(K1+2);this.textController.text=J1,this.textController.cursorPosition=K1}},onSubmit:()=>{this.dismissPalette()},onCancel:()=>{this.dismissPalette()}})}}),A=G.mainThread?.queuedMessages??[],E=Array.isArray(Z)&&Z.length>0,P=Array.isArray(A)&&A.length>0,I=G.mainThread?.agentMode==="plan"&&UO(G.mainThread),T,S;if(I){if(T=new WS1(new f91({thread:G.mainThread,onExecute:async()=>{let a=this.getCommandPaletteContext();if(a)await this.getPaletteCommands().execute("execute-plan",a,void 0,new AbortController)},onEdit:async()=>{try{let a=process.env.EDITOR||process.env.VISUAL||"nano",{filePath:s}=await this.widget.dependencies.planFileManager.ensureSync(G.mainThread.id);P9.instance.tuiInstance.suspend();let{execSync:l}=await import("child_process");l(`${a} "${s}"`,{stdio:"inherit"}),P9.instance.tuiInstance.resume()}catch(a){v.error("Failed to edit plan",a),this.setState(()=>{this.displayMessage=Error("Failed to edit plan")})}},controller:this.planScrollController,appTheme:X}),{clipBehavior:"antiAlias"}),P)S=new K51({queuedMessages:A});else if(E)S=this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!M,X)}else T=P?new K51({queuedMessages:A}):void 0,S=E?this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!M,X):void 0;let k=[],x=this.currentShellModeStatus;if(x)k.push({child:new f1({text:new t(x==="hidden"?"shell mode (incognito)":"shell mode",new X1({color:x==="hidden"?X.app.shellModeHidden:X.app.shellMode}))}),position:"top-left"});let p=this.connectedClientsStatus&&this.connectedClientsStatus.enabled?this.connectedClientsStatusExpanded?(this.connectedClientsStatus?.clientID?.length??7)+3:3:0,g=this.agentModeController?.getVisibleModes()??[];if(!x&&g.length>1){let a=this.previewThread,s=a?a.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),l=xy1(s),K1=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,k1=zJ(K1.thread)>0,J1=this.agentModeSlideProgress!==null,v1,I1;if(J1){v1="top-left";let T1=z.size.width-s.length-4-p;I1=Math.floor(this.agentModeSlideProgress*T1)}else if(k1)v1="top-right",I1=p;else v1="top-left",I1=void 0;if(a)k.push({child:new f1({text:new t(s,new X1({color:l}))}),position:v1,offsetX:I1});else{let A0=!k1&&!J1,T1=new f1({text:new t(s,new X1({color:l}))});k.push({child:A0?new U8({child:T1,onClick:this.toggleAgentMode,cursor:"pointer"}):T1,position:v1,offsetX:I1})}}if(this.connectedClientsStatus&&this.connectedClientsStatus.enabled){let a=this.connectedClientsStatus,s=a.mode||"disconnected",l=!!a.errorMessage,K1=a.clientID||"unknown",k1,J1;if(l)k1="●",J1=M1.red;else if(s==="presence")k1="○",J1=M1.yellow;else if(s==="connected"&&a.connected)k1="●",J1=M1.green;else k1="○",J1=M1.yellow;let v1=this.connectedClientsStatusExpanded?`${K1} ${k1}`:k1;k.push({child:new U8({child:new f1({text:new t(v1,new X1({color:J1}))}),onClick:this.toggleConnectedClientsStatus,cursor:"pointer"}),position:"top-right",offsetX:-2})}let i=K?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:G.mainThread?.env?.initial.trees?.[0]?.uri,Q1;if(i)Q1=u0.parse(i).fsPath;else Q1=process.cwd();let o=this.toHomeRelative(Q1),u=this.shorten(o),e=!K&&this.currentGitBranch?`${u} (${this.currentGitBranch})`:u;k.push({child:new f1({text:new t(e,new X1({color:Y.foreground,dim:!0}))}),position:"bottom-right"});let V1=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker;if(zJ(V1.thread)>0){let a=[],s=new X1({color:Y.foreground,dim:!0}),l=new t(" · ",s);if(U&&G.mainThread){let K1=ut(G.mainThread);if(K1>0)a.push(new t(gq(K1),s))}if(W){if(a.length>0)a.push(l);let K1=W.totalInputTokens/W.maxInputTokens,k1=Math.round(K1*100),J1=Math.max(0,Math.min(k1,100)),v1=o81(K1,W.maxInputTokens),I1=s;if(v1==="danger")I1=new X1({color:Y.destructive});else if(v1==="warning")I1=new X1({color:Y.warning});else if(v1==="recommendation")I1=new X1({color:X.app.recommendation});a.push(new t(`${J1}%`,I1))}if(U&&H){let K1=nX6(H,{isNarrow:!0});if(K1){if(a.length>0)a.push(l);let k1=s;if(K1.urgency==="warning")k1=new X1({color:Y.warning});a.push(new t(K1.text,k1))}}if(a.length>0){let K1=new f1({text:new t("",void 0,a)});k.push({child:U?new U8({child:K1,onClick:this.showContextDetailOverlay,cursor:"pointer"}):K1,position:"top-left"})}}return new SS1({leftChild:new F4({child:L}),rightChild1:T,rightChild2:S,maxHeight:q,overlayTexts:k,borderColor:M||!this.isTextfieldAndAutocompleteFocused?M1.index(8):void 0,hasBanner:V,userHeight:this.bottomGridUserHeight,onInitializeHeight:(a)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(a,q)})},onDrag:(a)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(a.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let s=Math.floor(a.localPosition.y)-this.bottomGridDragStartY,l=Math.max(4,this.bottomGridDragStartHeight-s),K1=Math.min(l,q),k1=Math.floor(K1);if(this.bottomGridUserHeight!==k1)this.setState(()=>{this.bottomGridUserHeight=k1})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:!V})}}async function vy1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)P9.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let X=()=>null,Z=!1,q=new Pz(Z,1000,J.inspectorPort),V=J.features?.find((A)=>A.name==="amp-connect")?.enabled??!1,K=new fk1({threadService:J.threadService,worker:J.worker,builder:(A,E,P,I,T,S)=>{if(X=T,J.threadDependencies&&V)dj1(J.threadDependencies,J.configService,T,I,J.connectedClientsService,J.startNewThread,J.switchToThread,J.clientId).catch((b)=>{v.error("Failed to start automatic presence:",b)});let k=T(),x={...J,worker:k,threadID:k.thread.id};return new UZ6({...x,threadState:E,workerController:P,switchWorker:I,getCurrentWorker:T,recentThreadIDs:S})}}),W=new _S1({configService:J.configService,child:K}),H=new $k1({configService:J.configService,child:W}),z=new DS1(H),U=new H6({data:aC.fromBaseTheme(nZ.default()),child:z});try{await Hj1(U,{onRootElementMounted:(A)=>{if(v.info("TUI input ready for user interaction"),Z)q.start(A)}})}finally{if(Z)q.stop();if(J.threadDependencies&&V){let{stopGlobalSession:A}=await Promise.resolve().then(() => (cj1(),i36));A()}}let M=X()?.thread.id||J.threadID,L=await J.threadService.get(M);if(L&&L.messages.length>0){let A=`${J.ampURL.replace(/\/$/,"")}/threads/${M}`;FJ6(L,A,J.stdout)}}function xy1(J){let Y=uV(J)?.uiHints?.secondaryColor;if(Y)return M1.rgb(Y.r,Y.g,Y.b);return Ew8(J)}class NZ6 extends t0{props;constructor(J){super();this.props=J}createState(){return new DZ6}}class DZ6 extends r0{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 g6({crossAxisAlignment:"stretch",children:[new F4({child:new B7({controller:Y,autofocus:!1,child:new hk1({todos:Q})})}),new qY({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 MZ6 extends C6{props;constructor(J){super();this.props=J}build(J){return new U8({child:new W0({height:1}),cursor:a9.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 Ew8(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])}Wj1();try{if(process.platform==="win32")await Promise.resolve().then(() => D6(Tj(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){$$.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
5009
|
-
`)}var Wv1=Kv1.join(mF0||Kv1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function cR8(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 G$(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")b$("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")b$("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")b$("model.sonnet",Q.useSonnet)}async function zv1(J){try{await uR8(Kv1.dirname(Wv1),{recursive:!0}),await pR8(Wv1,J,"utf-8")}catch(Q){v.debug("Failed to save last thread ID",Q)}}async function lR8(){try{return(await lV6(Wv1,"utf-8")).trim()}catch(J){return null}}var pV6=[{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??uZ,description:`Custom settings file path (overrides the default location ${uZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(v).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${BC1})`},{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:Y3(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:FI.SMART.key,description:`Set the agent mode (${eG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:eG().map((J)=>J.mode)}],dV6=(J)=>("deprecated"in J)&&J.deprecated===!0,iR8=(J)=>("hidden"in J)&&J.hidden===!0,nR8=(J)=>("default"in J),aR8=(J)=>("default"in J)?J.default:void 0;function oR8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new _8(mZ.unknownCommand(Y),1,q)}}var iV6=null;function yE5(){return iV6}function hu(J){return{...J,getThreadEnvironment:X41,vfs:FP0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new Xv(J.fileSystem),generateThreadTitle:zi0,deleteThread:(Q)=>J.threadService.delete(Q)}}var Fv1=u0.file(dR8.homedir()),nV6=process.env.XDG_CONFIG_HOME?u0.file(process.env.XDG_CONFIG_HOME):o0.joinPath(Fv1,".config");async function Z$(J,Q){EN0("0.0.
|
|
5009
|
+
`)}var Wv1=Kv1.join(mF0||Kv1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function cR8(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 G$(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")b$("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")b$("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")b$("model.sonnet",Q.useSonnet)}async function zv1(J){try{await uR8(Kv1.dirname(Wv1),{recursive:!0}),await pR8(Wv1,J,"utf-8")}catch(Q){v.debug("Failed to save last thread ID",Q)}}async function lR8(){try{return(await lV6(Wv1,"utf-8")).trim()}catch(J){return null}}var pV6=[{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??uZ,description:`Custom settings file path (overrides the default location ${uZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(v).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${BC1})`},{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:Y3(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:FI.SMART.key,description:`Set the agent mode (${eG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:eG().map((J)=>J.mode)}],dV6=(J)=>("deprecated"in J)&&J.deprecated===!0,iR8=(J)=>("hidden"in J)&&J.hidden===!0,nR8=(J)=>("default"in J),aR8=(J)=>("default"in J)?J.default:void 0;function oR8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new _8(mZ.unknownCommand(Y),1,q)}}var iV6=null;function yE5(){return iV6}function hu(J){return{...J,getThreadEnvironment:X41,vfs:FP0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new Xv(J.fileSystem),generateThreadTitle:zi0,deleteThread:(Q)=>J.threadService.delete(Q)}}var Fv1=u0.file(dR8.homedir()),nV6=process.env.XDG_CONFIG_HOME?u0.file(process.env.XDG_CONFIG_HOME):o0.joinPath(Fv1,".config");async function Z$(J,Q){EN0("0.0.1764720103-g0db7ac");let Y=Nq1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:X0.of([u0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Fv1,userConfigDir:nV6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (H51(),W51));X(Y);let G=await Y.getLatest();v.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let{toolService:Z,dispose:q}=C16({configService:Y}),V=new Map,K=()=>V.clear(),W=new DU1(Y,J.settings.getWorkspaceRootPath()),H=AI0({configService:Y,trustStore:W,createOAuthProvider:async(o)=>{let u=V.get(o);if(u)return v.debug("Reusing existing OAuth provider for server",{serverName:o}),u;v.debug("Creating OAuth provider for server",{serverName:o});let e=(async()=>{let V1=new sM(J.secrets),H1=await V1.getClientInfo(o),a=new gF1({storage:V1,serverName:o,clientId:H1?.clientId,clientSecret:H1?.clientSecret,scopes:H1?.scopes});return v.debug("OAuth provider created",{serverName:o,hasManualClientId:!!H1?.clientId,willUseDCR:!H1?.clientId}),a})();return V.set(o,e),e}}),z=Q61({configService:Y,filesystem:H9,spawn:pA}),{initializeToolProviders:U,startToolProviders:N}=await Promise.resolve().then(() => (uV6(),mV6)),M;if(J.executeMode){let o=await U({toolService:Z,providers:[H,z],initialTimeout:15000});M=o.registrations;for(let[u,e]of o.initErrors)v.warn(`${u} provider initialization slow or failed:`,e)}else M=N({toolService:Z,providers:[H,z]});if(Q.jetbrains)wI("JetBrains");else if(Q.ide&&k56())wI("VS Code");else if(Q.ide&&y56())wI("Neovim");if(J.executeMode)IN0(!0);let L,A=P2.status.pipe(q6((o)=>Boolean(o.connected&&o.authenticated)),j4()).subscribe((o)=>{if(o){if(!L)L=Z.registerTool(Nt0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new U41(process.cwd(),{},!0);else E=new class extends U41{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(b5.write(`No API key found. Starting login flow...
|
|
5010
5010
|
`),!await rR8(J))await KO(),process.exit(1)}let P=await cR0({isDevelopment:!1}),I=new DI1(P,Y),T=new FI1(P,{lazy:!0}),S=new TU1(I,(o,u)=>{let e=R3.get(o);if(e)e.handle(u).catch((V1)=>{v.error("Failed to apply artifact delta",V1)})}),k=Q.notifications!==void 0?Q.notifications:!J.executeMode,x=S16({playNotificationSound:async(o)=>{if(k){j16(o);let u=Vj1(),e=Kj1();if((!u||e)&&G.settings["notifications.system.enabled"]!==!1){if(o==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(o==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:I,configService:Y});v.info("Starting Amp background services");let b=Ui0({threadService:I,threadHistoryService:T,configService:Y,isExtensionDevelopment:!1}),p;P2.status.subscribe((o)=>{p=o});let g=new eZ1({workspaceRoots:[u0.file(process.cwd())],getCurrentFile:()=>{if(!p?.openFile)return;try{return u0.parse(p.openFile)}catch(o){v.warn("Failed to parse current file URI",{uri:p.openFile,error:o});return}},getOpenFiles:()=>{if(!p?.visibleFiles?.length)return[];let o=p.openFile;return p.visibleFiles.filter((u)=>u!==o).map((u)=>{try{return u0.parse(u)}catch(e){return v.warn("Failed to parse visible file URI",{uri:u,error:e}),null}}).filter((u)=>u!==null)}}),i=new zj1,Q1={codebaseContextService:g,configService:Y,toolService:Z,mcpService:H,trustStore:W,threadService:I,threadHistoryService:T,threadSyncService:b,planFileManager:S,threadStorage:P,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:E,notificationService:x,fileSystem:Q.jetbrains||Q.ide?WP0:H9,terminal:i};return{...Q1,async asyncDispose(){if(Q1.mcpService.hasAuthenticatingClients())v.info("Waiting for OAuth authentication to complete before exit..."),await Q1.mcpService.waitForAuthentication();for(let o of M.values())o.dispose();await Q1.mcpService.dispose(),K(),await Q1.threadService.asyncDispose(),Q1.configService.unsubscribe(),q(),Q1.fuzzyServer.dispose(),Q1.threadSyncService.dispose(),Q1.settingsStorage[Symbol.dispose](),A.unsubscribe(),L?.dispose()}}}async function rR8(J){if(!J.executeMode){if(!await mC1("Would you like to log in to Amp? [(y)es, (n)o]: "))return b5.write(`Login cancelled. Run the command again to retry.
|
|
5011
5011
|
`),!1}return await aV6(J)}async function aV6(J){let Q=mR8(32).toString("hex"),Y=await gC1(J.ampURL,Q),X=new AbortController;try{await QH(Y,X.signal)}catch(Z){v.error("Error opening browser",{error:Z})}let G=await gC1(J.ampURL,Q,!1);b5.write(`If your browser does not open automatically, visit:
|
|
5012
5012
|
|
|
@@ -5016,7 +5016,7 @@ ${b4.blue.bold(G)}
|
|
|
5016
5016
|
Login successful! You can now use the Amp CLI.
|
|
5017
5017
|
`),!0}catch(Z){return v.error("Login failed",{error:Z}),$$.write(`
|
|
5018
5018
|
Login failed: ${Z instanceof Error?Z.message:String(Z)}
|
|
5019
|
-
`),!1}}function sR8(){let J=new sA().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)zC(),process.exit(0);let z=H.originalError??H;R96(z)}),J.option("-V, --version","Print the version number and exit",()=>{b5.write(`0.0.
|
|
5019
|
+
`),!1}}function sR8(){let J=new sA().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)zC(),process.exit(0);let z=H.originalError??H;R96(z)}),J.option("-V, --version","Print the version number and exit",()=>{b5.write(`0.0.1764720103-g0db7ac (released 2025-12-03T00:07:10.941Z)
|
|
5020
5020
|
`),process.exit(0)}),J.addHelpText("after",j56()),J.configureHelp({formatHelp:S56}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await FY(U);await QT8(N)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await FY(U);await JT8(N,await CC1(U,N.settings))});let Q=async(H,z,U)=>{Nq1({storage:z.settings,secretStorage:z.secrets,workspaceRoots:X0.of([u0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:Fv1,userConfigDir:nV6});let N={...z,executeMode:!1};await Hv1(N,{...H,openThreadSwitcher:!0},U)},Y=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await FY(U);await cV6(U,N,z)});Y.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await FY(U);await VT8(U,N,z)}),Y.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await FY(N);if(z.pick)$$.write(`${b4.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
5021
5021
|
`);if(z.last||H||M.executeMode)await qT8(N,M,H,U);else await Q(N,M,U)}),Y.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await FY(N);await $T8(N,M,H,U)}),Y.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await FY(U);await cV6(U,N,z)}),Y.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, unlisted, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await FY(N);await ZT8(N,M,H,U,z.support)}),Y.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(H,z,U,N)=>{let M=N.optsWithGlobals(),L=await FY(M);await YT8(M,L,H,z,N)}),Y.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await FY(N);await XT8(N,M,H,U)}),Y.command("replay <threadId>").alias("p").summary("Replay a thread").description("Replay a thread by downloading it and playing through all interactions. User messages are simulated with variable typing speed.").option("--wpm <wpm>","Typing speed in words per minute (default: 120)","120").option("--no-typing","Disable typing simulation and display messages instantly").option("--message-delay <ms>","Delay between messages in milliseconds (default: 1000)","1000").option("--tool-progress-delay <ms>","Delay to show tool in-progress state in milliseconds (default: 800)","800").option("--exit-delay <seconds>","Delay in seconds before exiting after replay completes (default: 3)","3").option("--no-indicator","Hide the replay progress indicator").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await FY(N);await GT8(N,M,H,z,U)}),P26(J,async(H,z)=>{let U=await FY(z);G$(H,z);let N=await Z$(U,z);return{context:U,mcpService:N.mcpService,toolService:N.toolService,toolServices:N.toolService,configService:N.configService,cleanupTerminal:zC,asyncDispose:N.asyncDispose.bind(N)}}),F76(J,async(H)=>{let z=H.optsWithGlobals();return await FY(z)}),X76(J,async(H)=>{let z=await FY(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(U)=>{G$(U,H);let N=await Z$(z,H);return{mcpService:N.mcpService,settings:z.settings,asyncDispose:N.asyncDispose.bind(N)}}}});function G(H,z,U){let M=typeof H.description==="string"?H.description:U===void 0?H.description(!0):H.description(U),L=new pK(z,M),A=aR8(H);if(A)L.default(A);if(L.hidden=iR8(H)||dV6(H),"choices"in H)L.choices([...H.choices]);return L}for(let H of pV6)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 pK("-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 pK("-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 pK("--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 pK("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(K);let W=new pK("--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 pK("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(H)}return k26(J),J.action(async(H,z)=>{let U=H,N=await FY(U);if(z.getOptionValueSourceWithGlobals("tryOpus")==="cli")b5.write(b4.yellow(`Opus 4.5 is now the default in Amp's smart mode. Rerun without --try-opus.
|
|
5022
5022
|
`)),process.exit(0);if(Object.keys(U).forEach((L)=>{let A=pV6.find((E)=>E.name===L);if(A&&dV6(A)&&!nR8(A))$$.write(b4.yellow(`Warning: '--${L}' flag is deprecated
|
|
@@ -5024,8 +5024,8 @@ Login failed: ${Z instanceof Error?Z.message:String(Z)}
|
|
|
5024
5024
|
Or pipe via stdin: echo "your message" | amp --execute`);G$(Y,Q);let q=await Z$(J,Q);iV6=q;let V=hu(q),K=async(i)=>{let Q1=await lV6(i,"utf-8"),o=JSON.parse(Q1);if(!n$(o.id))throw new _8(mZ.invalidThreadId);return e51(q,{visibility:X,agentMode:Q.mode,thread:o})},W=async(i)=>{if(!n$(i))throw new _8(mZ.invalidThreadId);try{let[o,u]=await Promise.all([C5.getThreadLinkInfo({thread:i},{config:q.configService}),C5.getUserInfo({},{config:q.configService})]);if(o.ok&&u.ok){let e=o.result.creatorUserID,V1=u.result.id;if(e&&e!==V1&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new _8(`Cannot resume thread created by another user.
|
|
5025
5025
|
|
|
5026
5026
|
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(o){if(o instanceof _8)throw o;v.warn("Failed to validate thread ownership in CLI, allowing to open",{error:o})}let Q1=await q.threadService.get(i)??void 0;return v.info(`[fetchAndStartThread] Loaded thread ${i}, agentMode: ${Q1?.agentMode??"undefined"}`),e51(q,{visibility:X,agentMode:Q1?void 0:Q.mode,thread:Q1})},H=async()=>{try{if(Q.threadId)return W(Q.threadId);else return e51(q,{visibility:X,agentMode:Q.mode})}catch(i){if(i instanceof _8)throw i;throw await Xm(i,Q.threadId),Error("handleError should have called process.exit()")}},z=async()=>{return e51(q,{visibility:X,agentMode:Q.mode})};if(Q.format==="jsonl")$$.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
5027
|
-
`),await KO(),process.exit(1);if(J.executeMode&&Q.remote)await U76(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)$76(q.mcpService,J.settings),await u96(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,M=!1;if(Q.jetbrains||Q.ide){await uM0();let i=hI({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let Q1=i[0];if(Q1)P2.selectConfig(Q1)}else N=!0}let L=E41("0.0.
|
|
5028
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await F56({...J,workspaceTrust:{current:!0,changes:Tk},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 G76(J.mcpConfig);X=Z76(X,Z)}let G=await X.get("url","global");if(!G)G=RY;if(!aF(G))v.info("Targeting custom Amp server",{ampURL:G});return X=gU0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:B76(await CC1(J,X))}}function tR8(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 eR8(){let J=tR8(process.argv);if(D96({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),cR8(v),v.info("Starting Amp CLI.",{version:"0.0.
|
|
5027
|
+
`),await KO(),process.exit(1);if(J.executeMode&&Q.remote)await U76(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)$76(q.mcpService,J.settings),await u96(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,M=!1;if(Q.jetbrains||Q.ide){await uM0();let i=hI({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let Q1=i[0];if(Q1)P2.selectConfig(Q1)}else N=!0}let L=E41("0.0.1764720103-g0db7ac",q.settingsStorage),A=new o11(q.threadStorage),E=X0.of([u0.file(process.cwd())]),P=W$1(void 0,E),I=new I41(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let T=(async()=>{try{let i=await C5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(i.ok)return v.info("User free tier status:",i),i.result}catch(i){v.error("Failed to fetch free tier status:",i)}})(),S=(async()=>{try{let i=await C5.getUserInfo({},{config:q.configService});if(i.ok)return i.result}catch(i){v.debug("Failed to fetch user workspace info:",i)}})(),[k,x]=await Promise.all([T,S]),b=x?.email,p=b&&(b.endsWith("@sourcegraph.com")||b.endsWith("@ampcode.com")||b==="auth-bypass-user@example.com"),g=await M76();v.info("Loaded session state:",g),await vy1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new q41,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:C5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:P2,connectedClientsService:new ni,commandRegistry:P,mcpService:q.mcpService,mcpTrustHandler:I,showJetBrainsInstaller:M,showIdePicker:N,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:g,freeTierStatus:k,workspace:x?.team??null,features:x?.features??[],isDogfooding:p||!1,threadDependencies:q,initialAgentMode:Y.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0}),await q.asyncDispose(),process.exit(0)}async function FY(J){if(J.interactive)$$.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
5028
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await F56({...J,workspaceTrust:{current:!0,changes:Tk},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 G76(J.mcpConfig);X=Z76(X,Z)}let G=await X.get("url","global");if(!G)G=RY;if(!aF(G))v.info("Targeting custom Amp server",{ampURL:G});return X=gU0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:B76(await CC1(J,X))}}function tR8(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 eR8(){let J=tR8(process.argv);if(D96({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),cR8(v),v.info("Starting Amp CLI.",{version:"0.0.1764720103-g0db7ac",buildTimestamp:"2025-12-03T00:07:10.941Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new _8(mZ.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await sR8().parseAsync(process.argv)}$I1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await eR8().catch(Xm)});async function JT8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),b5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
5029
5029
|
`);else if(!aF(J.ampURL))b5.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
5030
5030
|
`);let Y=process.env.AMP_API_KEY;if(Y)b5.write(`API key found in environment variable, storing...
|
|
5031
5031
|
`),await Q.set("apiKey",Y,J.ampURL),b5.write(`API key successfully stored.
|
|
@@ -5038,7 +5038,7 @@ This thread belongs to a different user and cannot be continued for security rea
|
|
|
5038
5038
|
`);else b5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
|
|
5039
5039
|
`);process.exit(0)}async function YT8(J,Q,Y,X,G){G$(G,J);let Z=await Z$(Q,J);try{let q=J71(Y);if(!q)Q71(Y);let V=q,K=X.trim();if(K.length===0)X$("Thread name cannot be empty");if(K.length>256)X$("Thread name cannot exceed 256 characters");if(!(await Cj(V,Z)).messages.length)X$("Cannot rename an empty thread.");let H=hu(Z);await(await R3.getOrCreateForThread(H,V)).handle({type:"title",value:K}),v.info("GOT HERE"),await Z.threadSyncService.sync(),v.info("GOT THERE"),b5.write(b4.green(`✓ Thread ${V} renamed to "${K}"
|
|
5040
5040
|
`)),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose();let V=`Failed to rename thread: ${q instanceof Error?q.message:String(q)}`;X$(V)}}async function XT8(J,Q,Y,X){G$(X,J);let G=await Z$(Q,J);try{let Z=J71(Y);if(!Z)Q71(Y);let V=await Cj(Z,G),K=kT(V);b5.write(K+`
|
|
5041
|
-
`),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)}`;X$(q)}}async function GT8(J,Q,Y,X,G){G$(G,J);let Z=await Z$(Q,J);try{let q=await Uv1(Y),V=await Cj(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,M=hu(Z),L=V.id;await Z.threadStorage.set(L,V);let A=await R3.getOrCreateForThread(M,L);await A.resume();let E=a11.fromWorker(A),P=new o11(Z.threadStorage),I=X0.of([u0.file(process.cwd())]),T=W$1(void 0,I),S=new I41(Z.mcpService,Q.settings.getWorkspaceRootPath()),k=E41("0.0.
|
|
5041
|
+
`),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)}`;X$(q)}}async function GT8(J,Q,Y,X,G){G$(G,J);let Z=await Z$(Q,J);try{let q=await Uv1(Y),V=await Cj(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,M=hu(Z),L=V.id;await Z.threadStorage.set(L,V);let A=await R3.getOrCreateForThread(M,L);await A.resume();let E=a11.fromWorker(A),P=new o11(Z.threadStorage),I=X0.of([u0.file(process.cwd())]),T=W$1(void 0,I),S=new I41(Z.mcpService,Q.settings.getWorkspaceRootPath()),k=E41("0.0.1764720103-g0db7ac",Z.settingsStorage);await vy1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new q41,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:L,threadFuzzyIndexer:P,worker:E,workerDeps:M,configService:Z.configService,internalAPIClient:C5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:P2,connectedClientsService:new ni,commandRegistry:T,mcpService:Z.mcpService,mcpTrustHandler:S,showJetBrainsInstaller:!1,updateService:k,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:N}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await Xm(q,Y)}}async function ZT8(J,Q,Y,X,G){G$(X,J);let Z=await Z$(Q,J);try{let q=J71(Y);if(!q)Q71(Y);let V=q,K=await C5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=P41(J,W);if(!H&&!G)X$("Must specify either --visibility or --support");if(H&&G)X$("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)X$(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,R41(H)),b5.write(b4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
|
|
5042
5042
|
`);if(G){await Cj(V,Z);let z=typeof G==="string"?G:void 0;await bR0(Z.threadService,V,Z.configService,z),b5.write(b4.green("✓ ")+`Thread ${V} has been shared with Amp support. These thread reports will be aggregated and analysed.
|
|
5043
5043
|
`)}await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),X$(`Failed to update thread: ${q instanceof Error?q.message:String(q)}`)}}async function $T8(J,Q,Y,X){G$(X,J);let G=await Z$(Q,J),Z=hu(G);try{let q=await Uv1(Y),K=(await Cj(q,G)).messages.length-1,W=await R3.getOrCreateForThread(Z,q),H=await yT(W,G.threadSyncService,K);await Promise.all([G.threadSyncService.uploadThread(q),G.threadSyncService.uploadThread(H)]),await zv1(H),b5.write(`${H}
|
|
5044
5044
|
`),await G.asyncDispose(),process.exit(0)}catch(q){$$.write(`Error forking thread: ${q instanceof Error?q.message:String(q)}
|