@sourcegraph/amp 0.0.1755676925-g804c7f → 0.0.1755681161-gdd8c23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +7 -7
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import{createRequire as C3A}from"node:module";var I3A=Object.create;var{getPrototypeOf:N3A,defineProperty:KY1,getOwnPropertyNames:V3A}=Object;var O3A=Object.prototype.hasOwnProperty;var WA=(A,Q,B)=>{B=A!=null?I3A(N3A(A)):{};let J=Q||!A||!A.__esModule?KY1(B,"default",{value:A,enumerable:!0}):B;for(let D of V3A(A))if(!O3A.call(J,D))KY1(J,D,{get:()=>A[D],enumerable:!0});return J};var n=(A,Q)=>()=>(Q||A((Q={exports:{}}).exports,Q),Q.exports);var h6=(A,Q)=>{for(var B in Q)KY1(A,B,{get:Q[B],enumerable:!0,configurable:!0,set:(J)=>Q[B]=()=>J})};var j1=(A,Q)=>()=>(A&&(Q=A(A=0)),Q);var T0=C3A(import.meta.url);var Va1=n((Ia1)=>{Object.defineProperty(Ia1,"__esModule",{value:!0});Ia1._globalThis=void 0;Ia1._globalThis=typeof globalThis==="object"?globalThis:global});var Oa1=n((Y3)=>{var L3A=Y3&&Y3.__createBinding||(Object.create?function(A,Q,B,J){if(J===void 0)J=B;Object.defineProperty(A,J,{enumerable:!0,get:function(){return Q[B]}})}:function(A,Q,B,J){if(J===void 0)J=B;A[J]=Q[B]}),R3A=Y3&&Y3.__exportStar||function(A,Q){for(var B in A)if(B!=="default"&&!Object.prototype.hasOwnProperty.call(Q,B))L3A(Q,A,B)};Object.defineProperty(Y3,"__esModule",{value:!0});R3A(Va1(),Y3)});var Ca1=n((q3)=>{var j3A=q3&&q3.__createBinding||(Object.create?function(A,Q,B,J){if(J===void 0)J=B;Object.defineProperty(A,J,{enumerable:!0,get:function(){return Q[B]}})}:function(A,Q,B,J){if(J===void 0)J=B;A[J]=Q[B]}),T3A=q3&&q3.__exportStar||function(A,Q){for(var B in A)if(B!=="default"&&!Object.prototype.hasOwnProperty.call(Q,B))j3A(Q,A,B)};Object.defineProperty(q3,"__esModule",{value:!0});T3A(Oa1(),q3)});var YY1=n((La1)=>{Object.defineProperty(La1,"__esModule",{value:!0});La1.VERSION=void 0;La1.VERSION="1.9.0"});var Pa1=n(($a1)=>{Object.defineProperty($a1,"__esModule",{value:!0});$a1.isCompatible=$a1._makeCompatibilityCheck=void 0;var $3A=YY1(),ja1=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Ta1(A){let Q=new Set([A]),B=new Set,J=A.match(ja1);if(!J)return()=>!1;let D={major:+J[1],minor:+J[2],patch:+J[3],prerelease:J[4]};if(D.prerelease!=null)return function X(K){return K===A};function z(X){return B.add(X),!1}function G(X){return Q.add(X),!0}return function X(K){if(Q.has(K))return!0;if(B.has(K))return!1;let Y=K.match(ja1);if(!Y)return z(K);let q={major:+Y[1],minor:+Y[2],patch:+Y[3],prerelease:Y[4]};if(q.prerelease!=null)return z(K);if(D.major!==q.major)return z(K);if(D.major===0){if(D.minor===q.minor&&D.patch<=q.patch)return G(K);return z(K)}if(D.minor<=q.minor)return G(K);return z(K)}}$a1._makeCompatibilityCheck=Ta1;$a1.isCompatible=Ta1($3A.VERSION)});var Z3=n((Sa1)=>{Object.defineProperty(Sa1,"__esModule",{value:!0});Sa1.unregisterGlobal=Sa1.getGlobal=Sa1.registerGlobal=void 0;var P3A=Ca1(),XT=YY1(),S3A=Pa1(),v3A=XT.VERSION.split(".")[0],Vb=Symbol.for(`opentelemetry.js.api.${v3A}`),Ob=P3A._globalThis;function k3A(A,Q,B,J=!1){var D;let z=Ob[Vb]=(D=Ob[Vb])!==null&&D!==void 0?D:{version:XT.VERSION};if(!J&&z[A]){let G=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${A}`);return B.error(G.stack||G.message),!1}if(z.version!==XT.VERSION){let G=new Error(`@opentelemetry/api: Registration of version v${z.version} for ${A} does not match previously registered API v${XT.VERSION}`);return B.error(G.stack||G.message),!1}return z[A]=Q,B.debug(`@opentelemetry/api: Registered a global for ${A} v${XT.VERSION}.`),!0}Sa1.registerGlobal=k3A;function f3A(A){var Q,B;let J=(Q=Ob[Vb])===null||Q===void 0?void 0:Q.version;if(!J||!S3A.isCompatible(J))return;return(B=Ob[Vb])===null||B===void 0?void 0:B[A]}Sa1.getGlobal=f3A;function y3A(A,Q){Q.debug(`@opentelemetry/api: Unregistering a global for ${A} v${XT.VERSION}.`);let B=Ob[Vb];if(B)delete B[A]}Sa1.unregisterGlobal=y3A});var ba1=n((fa1)=>{Object.defineProperty(fa1,"__esModule",{value:!0});fa1.DiagComponentLogger=void 0;var x3A=Z3();class ka1{constructor(A){this._namespace=A.namespace||"DiagComponentLogger"}debug(...A){return Cb("debug",this._namespace,A)}error(...A){return Cb("error",this._namespace,A)}info(...A){return Cb("info",this._namespace,A)}warn(...A){return Cb("warn",this._namespace,A)}verbose(...A){return Cb("verbose",this._namespace,A)}}fa1.DiagComponentLogger=ka1;function Cb(A,Q,B){let J=x3A.getGlobal("diag");if(!J)return;return B.unshift(Q),J[A](...B)}});var Xs=n((ga1)=>{Object.defineProperty(ga1,"__esModule",{value:!0});ga1.DiagLogLevel=void 0;var h3A;(function(A){A[A.NONE=0]="NONE",A[A.ERROR=30]="ERROR",A[A.WARN=50]="WARN",A[A.INFO=60]="INFO",A[A.DEBUG=70]="DEBUG",A[A.VERBOSE=80]="VERBOSE",A[A.ALL=9999]="ALL"})(h3A=ga1.DiagLogLevel||(ga1.DiagLogLevel={}))});var ma1=n((xa1)=>{Object.defineProperty(xa1,"__esModule",{value:!0});xa1.createLogLevelDiagLogger=void 0;var CF=Xs();function m3A(A,Q){if(A<CF.DiagLogLevel.NONE)A=CF.DiagLogLevel.NONE;else if(A>CF.DiagLogLevel.ALL)A=CF.DiagLogLevel.ALL;Q=Q||{};function B(J,D){let z=Q[J];if(typeof z==="function"&&A>=D)return z.bind(Q);return function(){}}return{error:B("error",CF.DiagLogLevel.ERROR),warn:B("warn",CF.DiagLogLevel.WARN),info:B("info",CF.DiagLogLevel.INFO),debug:B("debug",CF.DiagLogLevel.DEBUG),verbose:B("verbose",CF.DiagLogLevel.VERBOSE)}}xa1.createLogLevelDiagLogger=m3A});var U3=n((pa1)=>{Object.defineProperty(pa1,"__esModule",{value:!0});pa1.DiagAPI=void 0;var u3A=ba1(),p3A=ma1(),ua1=Xs(),Ks=Z3(),c3A="diag";class ZY1{constructor(){function A(J){return function(...D){let z=Ks.getGlobal("diag");if(!z)return;return z[J](...D)}}let Q=this,B=(J,D={logLevel:ua1.DiagLogLevel.INFO})=>{var z,G,X;if(J===Q){let q=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return Q.error((z=q.stack)!==null&&z!==void 0?z:q.message),!1}if(typeof D==="number")D={logLevel:D};let K=Ks.getGlobal("diag"),Y=p3A.createLogLevelDiagLogger((G=D.logLevel)!==null&&G!==void 0?G:ua1.DiagLogLevel.INFO,J);if(K&&!D.suppressOverrideMessage){let q=(X=new Error().stack)!==null&&X!==void 0?X:"<failed to generate stacktrace>";K.warn(`Current logger will be overwritten from ${q}`),Y.warn(`Current logger will overwrite one already registered from ${q}`)}return Ks.registerGlobal("diag",Y,Q,!0)};Q.setLogger=B,Q.disable=()=>{Ks.unregisterGlobal(c3A,Q)},Q.createComponentLogger=(J)=>{return new u3A.DiagComponentLogger(J)},Q.verbose=A("verbose"),Q.debug=A("debug"),Q.info=A("info"),Q.warn=A("warn"),Q.error=A("error")}static instance(){if(!this._instance)this._instance=new ZY1;return this._instance}}pa1.DiagAPI=ZY1});var ia1=n((la1)=>{Object.defineProperty(la1,"__esModule",{value:!0});la1.BaggageImpl=void 0;class KT{constructor(A){this._entries=A?new Map(A):new Map}getEntry(A){let Q=this._entries.get(A);if(!Q)return;return Object.assign({},Q)}getAllEntries(){return Array.from(this._entries.entries()).map(([A,Q])=>[A,Q])}setEntry(A,Q){let B=new KT(this._entries);return B._entries.set(A,Q),B}removeEntry(A){let Q=new KT(this._entries);return Q._entries.delete(A),Q}removeEntries(...A){let Q=new KT(this._entries);for(let B of A)Q._entries.delete(B);return Q}clear(){return new KT}}la1.BaggageImpl=KT});var na1=n((aa1)=>{Object.defineProperty(aa1,"__esModule",{value:!0});aa1.baggageEntryMetadataSymbol=void 0;aa1.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var UY1=n((sa1)=>{Object.defineProperty(sa1,"__esModule",{value:!0});sa1.baggageEntryMetadataFromString=sa1.createBaggage=void 0;var l3A=U3(),d3A=ia1(),i3A=na1(),a3A=l3A.DiagAPI.instance();function r3A(A={}){return new d3A.BaggageImpl(new Map(Object.entries(A)))}sa1.createBaggage=r3A;function n3A(A){if(typeof A!=="string")a3A.error(`Cannot create baggage metadata from unknown type: ${typeof A}`),A="";return{__TYPE__:i3A.baggageEntryMetadataSymbol,toString(){return A}}}sa1.baggageEntryMetadataFromString=n3A});var Lb=n((ta1)=>{Object.defineProperty(ta1,"__esModule",{value:!0});ta1.ROOT_CONTEXT=ta1.createContextKey=void 0;function o3A(A){return Symbol.for(A)}ta1.createContextKey=o3A;class Ys{constructor(A){let Q=this;Q._currentContext=A?new Map(A):new Map,Q.getValue=(B)=>Q._currentContext.get(B),Q.setValue=(B,J)=>{let D=new Ys(Q._currentContext);return D._currentContext.set(B,J),D},Q.deleteValue=(B)=>{let J=new Ys(Q._currentContext);return J._currentContext.delete(B),J}}}ta1.ROOT_CONTEXT=new Ys});var Jr1=n((Qr1)=>{Object.defineProperty(Qr1,"__esModule",{value:!0});Qr1.DiagConsoleLogger=void 0;var HY1=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class Ar1{constructor(){function A(Q){return function(...B){if(console){let J=console[Q];if(typeof J!=="function")J=console.log;if(typeof J==="function")return J.apply(console,B)}}}for(let Q=0;Q<HY1.length;Q++)this[HY1[Q].n]=A(HY1[Q].c)}}Qr1.DiagConsoleLogger=Ar1});var OY1=n((Dr1)=>{Object.defineProperty(Dr1,"__esModule",{value:!0});Dr1.createNoopMeter=Dr1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=Dr1.NOOP_OBSERVABLE_GAUGE_METRIC=Dr1.NOOP_OBSERVABLE_COUNTER_METRIC=Dr1.NOOP_UP_DOWN_COUNTER_METRIC=Dr1.NOOP_HISTOGRAM_METRIC=Dr1.NOOP_GAUGE_METRIC=Dr1.NOOP_COUNTER_METRIC=Dr1.NOOP_METER=Dr1.NoopObservableUpDownCounterMetric=Dr1.NoopObservableGaugeMetric=Dr1.NoopObservableCounterMetric=Dr1.NoopObservableMetric=Dr1.NoopHistogramMetric=Dr1.NoopGaugeMetric=Dr1.NoopUpDownCounterMetric=Dr1.NoopCounterMetric=Dr1.NoopMetric=Dr1.NoopMeter=void 0;class FY1{constructor(){}createGauge(A,Q){return Dr1.NOOP_GAUGE_METRIC}createHistogram(A,Q){return Dr1.NOOP_HISTOGRAM_METRIC}createCounter(A,Q){return Dr1.NOOP_COUNTER_METRIC}createUpDownCounter(A,Q){return Dr1.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(A,Q){return Dr1.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(A,Q){return Dr1.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(A,Q){return Dr1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(A,Q){}removeBatchObservableCallback(A){}}Dr1.NoopMeter=FY1;class YT{}Dr1.NoopMetric=YT;class EY1 extends YT{add(A,Q){}}Dr1.NoopCounterMetric=EY1;class MY1 extends YT{add(A,Q){}}Dr1.NoopUpDownCounterMetric=MY1;class WY1 extends YT{record(A,Q){}}Dr1.NoopGaugeMetric=WY1;class wY1 extends YT{record(A,Q){}}Dr1.NoopHistogramMetric=wY1;class Rb{addCallback(A){}removeCallback(A){}}Dr1.NoopObservableMetric=Rb;class IY1 extends Rb{}Dr1.NoopObservableCounterMetric=IY1;class NY1 extends Rb{}Dr1.NoopObservableGaugeMetric=NY1;class VY1 extends Rb{}Dr1.NoopObservableUpDownCounterMetric=VY1;Dr1.NOOP_METER=new FY1;Dr1.NOOP_COUNTER_METRIC=new EY1;Dr1.NOOP_GAUGE_METRIC=new WY1;Dr1.NOOP_HISTOGRAM_METRIC=new wY1;Dr1.NOOP_UP_DOWN_COUNTER_METRIC=new MY1;Dr1.NOOP_OBSERVABLE_COUNTER_METRIC=new IY1;Dr1.NOOP_OBSERVABLE_GAUGE_METRIC=new NY1;Dr1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new VY1;function e3A(){return Dr1.NOOP_METER}Dr1.createNoopMeter=e3A});var Er1=n((Fr1)=>{Object.defineProperty(Fr1,"__esModule",{value:!0});Fr1.ValueType=void 0;var qOA;(function(A){A[A.INT=0]="INT",A[A.DOUBLE=1]="DOUBLE"})(qOA=Fr1.ValueType||(Fr1.ValueType={}))});var LY1=n((Mr1)=>{Object.defineProperty(Mr1,"__esModule",{value:!0});Mr1.defaultTextMapSetter=Mr1.defaultTextMapGetter=void 0;Mr1.defaultTextMapGetter={get(A,Q){if(A==null)return;return A[Q]},keys(A){if(A==null)return[];return Object.keys(A)}};Mr1.defaultTextMapSetter={set(A,Q,B){if(A==null)return;A[Q]=B}}});var Vr1=n((Ir1)=>{Object.defineProperty(Ir1,"__esModule",{value:!0});Ir1.NoopContextManager=void 0;var UOA=Lb();class wr1{active(){return UOA.ROOT_CONTEXT}with(A,Q,B,...J){return Q.call(B,...J)}bind(A,Q){return Q}enable(){return this}disable(){return this}}Ir1.NoopContextManager=wr1});var jb=n((Cr1)=>{Object.defineProperty(Cr1,"__esModule",{value:!0});Cr1.ContextAPI=void 0;var HOA=Vr1(),RY1=Z3(),Or1=U3(),jY1="context",FOA=new HOA.NoopContextManager;class TY1{constructor(){}static getInstance(){if(!this._instance)this._instance=new TY1;return this._instance}setGlobalContextManager(A){return RY1.registerGlobal(jY1,A,Or1.DiagAPI.instance())}active(){return this._getContextManager().active()}with(A,Q,B,...J){return this._getContextManager().with(A,Q,B,...J)}bind(A,Q){return this._getContextManager().bind(A,Q)}_getContextManager(){return RY1.getGlobal(jY1)||FOA}disable(){this._getContextManager().disable(),RY1.unregisterGlobal(jY1,Or1.DiagAPI.instance())}}Cr1.ContextAPI=TY1});var _Y1=n((Rr1)=>{Object.defineProperty(Rr1,"__esModule",{value:!0});Rr1.TraceFlags=void 0;var EOA;(function(A){A[A.NONE=0]="NONE",A[A.SAMPLED=1]="SAMPLED"})(EOA=Rr1.TraceFlags||(Rr1.TraceFlags={}))});var qs=n((jr1)=>{Object.defineProperty(jr1,"__esModule",{value:!0});jr1.INVALID_SPAN_CONTEXT=jr1.INVALID_TRACEID=jr1.INVALID_SPANID=void 0;var MOA=_Y1();jr1.INVALID_SPANID="0000000000000000";jr1.INVALID_TRACEID="00000000000000000000000000000000";jr1.INVALID_SPAN_CONTEXT={traceId:jr1.INVALID_TRACEID,spanId:jr1.INVALID_SPANID,traceFlags:MOA.TraceFlags.NONE}});var Zs=n((Sr1)=>{Object.defineProperty(Sr1,"__esModule",{value:!0});Sr1.NonRecordingSpan=void 0;var WOA=qs();class Pr1{constructor(A=WOA.INVALID_SPAN_CONTEXT){this._spanContext=A}spanContext(){return this._spanContext}setAttribute(A,Q){return this}setAttributes(A){return this}addEvent(A,Q){return this}addLink(A){return this}addLinks(A){return this}setStatus(A){return this}updateName(A){return this}end(A){}isRecording(){return!1}recordException(A,Q){}}Sr1.NonRecordingSpan=Pr1});var vY1=n((fr1)=>{Object.defineProperty(fr1,"__esModule",{value:!0});fr1.getSpanContext=fr1.setSpanContext=fr1.deleteSpan=fr1.setSpan=fr1.getActiveSpan=fr1.getSpan=void 0;var wOA=Lb(),IOA=Zs(),NOA=jb(),PY1=wOA.createContextKey("OpenTelemetry Context Key SPAN");function SY1(A){return A.getValue(PY1)||void 0}fr1.getSpan=SY1;function VOA(){return SY1(NOA.ContextAPI.getInstance().active())}fr1.getActiveSpan=VOA;function kr1(A,Q){return A.setValue(PY1,Q)}fr1.setSpan=kr1;function OOA(A){return A.deleteValue(PY1)}fr1.deleteSpan=OOA;function COA(A,Q){return kr1(A,new IOA.NonRecordingSpan(Q))}fr1.setSpanContext=COA;function LOA(A){var Q;return(Q=SY1(A))===null||Q===void 0?void 0:Q.spanContext()}fr1.getSpanContext=LOA});var Us=n((hr1)=>{Object.defineProperty(hr1,"__esModule",{value:!0});hr1.wrapSpanContext=hr1.isSpanContextValid=hr1.isValidSpanId=hr1.isValidTraceId=void 0;var br1=qs(),POA=Zs(),SOA=/^([0-9a-f]{32})$/i,vOA=/^[0-9a-f]{16}$/i;function gr1(A){return SOA.test(A)&&A!==br1.INVALID_TRACEID}hr1.isValidTraceId=gr1;function xr1(A){return vOA.test(A)&&A!==br1.INVALID_SPANID}hr1.isValidSpanId=xr1;function kOA(A){return gr1(A.traceId)&&xr1(A.spanId)}hr1.isSpanContextValid=kOA;function fOA(A){return new POA.NonRecordingSpan(A)}hr1.wrapSpanContext=fOA});var yY1=n((cr1)=>{Object.defineProperty(cr1,"__esModule",{value:!0});cr1.NoopTracer=void 0;var xOA=jb(),ur1=vY1(),kY1=Zs(),hOA=Us(),fY1=xOA.ContextAPI.getInstance();class pr1{startSpan(A,Q,B=fY1.active()){if(Boolean(Q===null||Q===void 0?void 0:Q.root))return new kY1.NonRecordingSpan;let D=B&&ur1.getSpanContext(B);if(mOA(D)&&hOA.isSpanContextValid(D))return new kY1.NonRecordingSpan(D);else return new kY1.NonRecordingSpan}startActiveSpan(A,Q,B,J){let D,z,G;if(arguments.length<2)return;else if(arguments.length===2)G=Q;else if(arguments.length===3)D=Q,G=B;else D=Q,z=B,G=J;let X=z!==null&&z!==void 0?z:fY1.active(),K=this.startSpan(A,D,X),Y=ur1.setSpan(X,K);return fY1.with(Y,G,void 0,K)}}cr1.NoopTracer=pr1;function mOA(A){return typeof A==="object"&&typeof A.spanId==="string"&&typeof A.traceId==="string"&&typeof A.traceFlags==="number"}});var bY1=n((ir1)=>{Object.defineProperty(ir1,"__esModule",{value:!0});ir1.ProxyTracer=void 0;var uOA=yY1(),pOA=new uOA.NoopTracer;class dr1{constructor(A,Q,B,J){this._provider=A,this.name=Q,this.version=B,this.options=J}startSpan(A,Q,B){return this._getTracer().startSpan(A,Q,B)}startActiveSpan(A,Q,B,J){let D=this._getTracer();return Reflect.apply(D.startActiveSpan,D,arguments)}_getTracer(){if(this._delegate)return this._delegate;let A=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!A)return pOA;return this._delegate=A,this._delegate}}ir1.ProxyTracer=dr1});var or1=n((nr1)=>{Object.defineProperty(nr1,"__esModule",{value:!0});nr1.NoopTracerProvider=void 0;var cOA=yY1();class rr1{getTracer(A,Q,B){return new cOA.NoopTracer}}nr1.NoopTracerProvider=rr1});var gY1=n((er1)=>{Object.defineProperty(er1,"__esModule",{value:!0});er1.ProxyTracerProvider=void 0;var lOA=bY1(),dOA=or1(),iOA=new dOA.NoopTracerProvider;class tr1{getTracer(A,Q,B){var J;return(J=this.getDelegateTracer(A,Q,B))!==null&&J!==void 0?J:new lOA.ProxyTracer(this,A,Q,B)}getDelegate(){var A;return(A=this._delegate)!==null&&A!==void 0?A:iOA}setDelegate(A){this._delegate=A}getDelegateTracer(A,Q,B){var J;return(J=this._delegate)===null||J===void 0?void 0:J.getTracer(A,Q,B)}}er1.ProxyTracerProvider=tr1});var Bn1=n((Qn1)=>{Object.defineProperty(Qn1,"__esModule",{value:!0});Qn1.SamplingDecision=void 0;var aOA;(function(A){A[A.NOT_RECORD=0]="NOT_RECORD",A[A.RECORD=1]="RECORD",A[A.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(aOA=Qn1.SamplingDecision||(Qn1.SamplingDecision={}))});var Dn1=n((Jn1)=>{Object.defineProperty(Jn1,"__esModule",{value:!0});Jn1.SpanKind=void 0;var rOA;(function(A){A[A.INTERNAL=0]="INTERNAL",A[A.SERVER=1]="SERVER",A[A.CLIENT=2]="CLIENT",A[A.PRODUCER=3]="PRODUCER",A[A.CONSUMER=4]="CONSUMER"})(rOA=Jn1.SpanKind||(Jn1.SpanKind={}))});var Gn1=n((zn1)=>{Object.defineProperty(zn1,"__esModule",{value:!0});zn1.SpanStatusCode=void 0;var nOA;(function(A){A[A.UNSET=0]="UNSET",A[A.OK=1]="OK",A[A.ERROR=2]="ERROR"})(nOA=zn1.SpanStatusCode||(zn1.SpanStatusCode={}))});var Yn1=n((Xn1)=>{Object.defineProperty(Xn1,"__esModule",{value:!0});Xn1.validateValue=Xn1.validateKey=void 0;var uY1="[_0-9a-z-*/]",sOA=`[a-z]${uY1}{0,255}`,oOA=`[a-z0-9]${uY1}{0,240}@[a-z]${uY1}{0,13}`,tOA=new RegExp(`^(?:${sOA}|${oOA})$`),eOA=/^[ -~]{0,255}[!-~]$/,ACA=/,|=/;function QCA(A){return tOA.test(A)}Xn1.validateKey=QCA;function BCA(A){return eOA.test(A)&&!ACA.test(A)}Xn1.validateValue=BCA});var Mn1=n((Fn1)=>{Object.defineProperty(Fn1,"__esModule",{value:!0});Fn1.TraceStateImpl=void 0;var qn1=Yn1(),Zn1=32,DCA=512,Un1=",",Hn1="=";class pY1{constructor(A){if(this._internalState=new Map,A)this._parse(A)}set(A,Q){let B=this._clone();if(B._internalState.has(A))B._internalState.delete(A);return B._internalState.set(A,Q),B}unset(A){let Q=this._clone();return Q._internalState.delete(A),Q}get(A){return this._internalState.get(A)}serialize(){return this._keys().reduce((A,Q)=>{return A.push(Q+Hn1+this.get(Q)),A},[]).join(Un1)}_parse(A){if(A.length>DCA)return;if(this._internalState=A.split(Un1).reverse().reduce((Q,B)=>{let J=B.trim(),D=J.indexOf(Hn1);if(D!==-1){let z=J.slice(0,D),G=J.slice(D+1,B.length);if(qn1.validateKey(z)&&qn1.validateValue(G))Q.set(z,G)}return Q},new Map),this._internalState.size>Zn1)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Zn1))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let A=new pY1;return A._internalState=new Map(this._internalState),A}}Fn1.TraceStateImpl=pY1});var In1=n((Wn1)=>{Object.defineProperty(Wn1,"__esModule",{value:!0});Wn1.createTraceState=void 0;var zCA=Mn1();function GCA(A){return new zCA.TraceStateImpl(A)}Wn1.createTraceState=GCA});var On1=n((Nn1)=>{Object.defineProperty(Nn1,"__esModule",{value:!0});Nn1.context=void 0;var XCA=jb();Nn1.context=XCA.ContextAPI.getInstance()});var Rn1=n((Cn1)=>{Object.defineProperty(Cn1,"__esModule",{value:!0});Cn1.diag=void 0;var KCA=U3();Cn1.diag=KCA.DiagAPI.instance()});var $n1=n((jn1)=>{Object.defineProperty(jn1,"__esModule",{value:!0});jn1.NOOP_METER_PROVIDER=jn1.NoopMeterProvider=void 0;var YCA=OY1();class cY1{getMeter(A,Q,B){return YCA.NOOP_METER}}jn1.NoopMeterProvider=cY1;jn1.NOOP_METER_PROVIDER=new cY1});var vn1=n((Pn1)=>{Object.defineProperty(Pn1,"__esModule",{value:!0});Pn1.MetricsAPI=void 0;var ZCA=$n1(),lY1=Z3(),_n1=U3(),dY1="metrics";class iY1{constructor(){}static getInstance(){if(!this._instance)this._instance=new iY1;return this._instance}setGlobalMeterProvider(A){return lY1.registerGlobal(dY1,A,_n1.DiagAPI.instance())}getMeterProvider(){return lY1.getGlobal(dY1)||ZCA.NOOP_METER_PROVIDER}getMeter(A,Q,B){return this.getMeterProvider().getMeter(A,Q,B)}disable(){lY1.unregisterGlobal(dY1,_n1.DiagAPI.instance())}}Pn1.MetricsAPI=iY1});var yn1=n((kn1)=>{Object.defineProperty(kn1,"__esModule",{value:!0});kn1.metrics=void 0;var UCA=vn1();kn1.metrics=UCA.MetricsAPI.getInstance()});var hn1=n((gn1)=>{Object.defineProperty(gn1,"__esModule",{value:!0});gn1.NoopTextMapPropagator=void 0;class bn1{inject(A,Q){}extract(A,Q){return A}fields(){return[]}}gn1.NoopTextMapPropagator=bn1});var cn1=n((un1)=>{Object.defineProperty(un1,"__esModule",{value:!0});un1.deleteBaggage=un1.setBaggage=un1.getActiveBaggage=un1.getBaggage=void 0;var HCA=jb(),FCA=Lb(),aY1=FCA.createContextKey("OpenTelemetry Baggage Key");function mn1(A){return A.getValue(aY1)||void 0}un1.getBaggage=mn1;function ECA(){return mn1(HCA.ContextAPI.getInstance().active())}un1.getActiveBaggage=ECA;function MCA(A,Q){return A.setValue(aY1,Q)}un1.setBaggage=MCA;function WCA(A){return A.deleteValue(aY1)}un1.deleteBaggage=WCA});var rn1=n((in1)=>{Object.defineProperty(in1,"__esModule",{value:!0});in1.PropagationAPI=void 0;var rY1=Z3(),VCA=hn1(),ln1=LY1(),Hs=cn1(),OCA=UY1(),dn1=U3(),nY1="propagation",CCA=new VCA.NoopTextMapPropagator;class sY1{constructor(){this.createBaggage=OCA.createBaggage,this.getBaggage=Hs.getBaggage,this.getActiveBaggage=Hs.getActiveBaggage,this.setBaggage=Hs.setBaggage,this.deleteBaggage=Hs.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new sY1;return this._instance}setGlobalPropagator(A){return rY1.registerGlobal(nY1,A,dn1.DiagAPI.instance())}inject(A,Q,B=ln1.defaultTextMapSetter){return this._getGlobalPropagator().inject(A,Q,B)}extract(A,Q,B=ln1.defaultTextMapGetter){return this._getGlobalPropagator().extract(A,Q,B)}fields(){return this._getGlobalPropagator().fields()}disable(){rY1.unregisterGlobal(nY1,dn1.DiagAPI.instance())}_getGlobalPropagator(){return rY1.getGlobal(nY1)||CCA}}in1.PropagationAPI=sY1});var on1=n((nn1)=>{Object.defineProperty(nn1,"__esModule",{value:!0});nn1.propagation=void 0;var LCA=rn1();nn1.propagation=LCA.PropagationAPI.getInstance()});var Js1=n((Qs1)=>{Object.defineProperty(Qs1,"__esModule",{value:!0});Qs1.TraceAPI=void 0;var oY1=Z3(),tn1=gY1(),en1=Us(),qT=vY1(),As1=U3(),tY1="trace";class eY1{constructor(){this._proxyTracerProvider=new tn1.ProxyTracerProvider,this.wrapSpanContext=en1.wrapSpanContext,this.isSpanContextValid=en1.isSpanContextValid,this.deleteSpan=qT.deleteSpan,this.getSpan=qT.getSpan,this.getActiveSpan=qT.getActiveSpan,this.getSpanContext=qT.getSpanContext,this.setSpan=qT.setSpan,this.setSpanContext=qT.setSpanContext}static getInstance(){if(!this._instance)this._instance=new eY1;return this._instance}setGlobalTracerProvider(A){let Q=oY1.registerGlobal(tY1,this._proxyTracerProvider,As1.DiagAPI.instance());if(Q)this._proxyTracerProvider.setDelegate(A);return Q}getTracerProvider(){return oY1.getGlobal(tY1)||this._proxyTracerProvider}getTracer(A,Q){return this.getTracerProvider().getTracer(A,Q)}disable(){oY1.unregisterGlobal(tY1,As1.DiagAPI.instance()),this._proxyTracerProvider=new tn1.ProxyTracerProvider}}Qs1.TraceAPI=eY1});var Gs1=n((Ds1)=>{Object.defineProperty(Ds1,"__esModule",{value:!0});Ds1.trace=void 0;var RCA=Js1();Ds1.trace=RCA.TraceAPI.getInstance()});var ZT=n((T4)=>{Object.defineProperty(T4,"__esModule",{value:!0});T4.trace=T4.propagation=T4.metrics=T4.diag=T4.context=T4.INVALID_SPAN_CONTEXT=T4.INVALID_TRACEID=T4.INVALID_SPANID=T4.isValidSpanId=T4.isValidTraceId=T4.isSpanContextValid=T4.createTraceState=T4.TraceFlags=T4.SpanStatusCode=T4.SpanKind=T4.SamplingDecision=T4.ProxyTracerProvider=T4.ProxyTracer=T4.defaultTextMapSetter=T4.defaultTextMapGetter=T4.ValueType=T4.createNoopMeter=T4.DiagLogLevel=T4.DiagConsoleLogger=T4.ROOT_CONTEXT=T4.createContextKey=T4.baggageEntryMetadataFromString=void 0;var jCA=UY1();Object.defineProperty(T4,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return jCA.baggageEntryMetadataFromString}});var Xs1=Lb();Object.defineProperty(T4,"createContextKey",{enumerable:!0,get:function(){return Xs1.createContextKey}});Object.defineProperty(T4,"ROOT_CONTEXT",{enumerable:!0,get:function(){return Xs1.ROOT_CONTEXT}});var TCA=Jr1();Object.defineProperty(T4,"DiagConsoleLogger",{enumerable:!0,get:function(){return TCA.DiagConsoleLogger}});var $CA=Xs();Object.defineProperty(T4,"DiagLogLevel",{enumerable:!0,get:function(){return $CA.DiagLogLevel}});var _CA=OY1();Object.defineProperty(T4,"createNoopMeter",{enumerable:!0,get:function(){return _CA.createNoopMeter}});var PCA=Er1();Object.defineProperty(T4,"ValueType",{enumerable:!0,get:function(){return PCA.ValueType}});var Ks1=LY1();Object.defineProperty(T4,"defaultTextMapGetter",{enumerable:!0,get:function(){return Ks1.defaultTextMapGetter}});Object.defineProperty(T4,"defaultTextMapSetter",{enumerable:!0,get:function(){return Ks1.defaultTextMapSetter}});var SCA=bY1();Object.defineProperty(T4,"ProxyTracer",{enumerable:!0,get:function(){return SCA.ProxyTracer}});var vCA=gY1();Object.defineProperty(T4,"ProxyTracerProvider",{enumerable:!0,get:function(){return vCA.ProxyTracerProvider}});var kCA=Bn1();Object.defineProperty(T4,"SamplingDecision",{enumerable:!0,get:function(){return kCA.SamplingDecision}});var fCA=Dn1();Object.defineProperty(T4,"SpanKind",{enumerable:!0,get:function(){return fCA.SpanKind}});var yCA=Gn1();Object.defineProperty(T4,"SpanStatusCode",{enumerable:!0,get:function(){return yCA.SpanStatusCode}});var bCA=_Y1();Object.defineProperty(T4,"TraceFlags",{enumerable:!0,get:function(){return bCA.TraceFlags}});var gCA=In1();Object.defineProperty(T4,"createTraceState",{enumerable:!0,get:function(){return gCA.createTraceState}});var Aq1=Us();Object.defineProperty(T4,"isSpanContextValid",{enumerable:!0,get:function(){return Aq1.isSpanContextValid}});Object.defineProperty(T4,"isValidTraceId",{enumerable:!0,get:function(){return Aq1.isValidTraceId}});Object.defineProperty(T4,"isValidSpanId",{enumerable:!0,get:function(){return Aq1.isValidSpanId}});var Qq1=qs();Object.defineProperty(T4,"INVALID_SPANID",{enumerable:!0,get:function(){return Qq1.INVALID_SPANID}});Object.defineProperty(T4,"INVALID_TRACEID",{enumerable:!0,get:function(){return Qq1.INVALID_TRACEID}});Object.defineProperty(T4,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return Qq1.INVALID_SPAN_CONTEXT}});var Ys1=On1();Object.defineProperty(T4,"context",{enumerable:!0,get:function(){return Ys1.context}});var qs1=Rn1();Object.defineProperty(T4,"diag",{enumerable:!0,get:function(){return qs1.diag}});var Zs1=yn1();Object.defineProperty(T4,"metrics",{enumerable:!0,get:function(){return Zs1.metrics}});var Us1=on1();Object.defineProperty(T4,"propagation",{enumerable:!0,get:function(){return Us1.propagation}});var Hs1=Gs1();Object.defineProperty(T4,"trace",{enumerable:!0,get:function(){return Hs1.trace}});T4.default={context:Ys1.context,diag:qs1.diag,metrics:Zs1.metrics,propagation:Us1.propagation,trace:Hs1.trace}});function uCA(){return mCA}function Es1(A){UT=A}var Fs1,mCA=!1,pCA,UT,cCA,N1;var iA=j1(()=>{Fs1=WA(ZT(),1);pCA={error:(A,...Q)=>console.error(A,...Q),warn:(A,...Q)=>console.warn(A,...Q),info:(A,...Q)=>console.info(A,...Q),debug:(A,...Q)=>{if(uCA())console.debug(A,...Q)},audit:(A,...Q)=>{let B=Q.length>0?Q[0]:{};if(typeof B==="object"&&B!==null&&!("audit"in B))B.audit=!0;let J=Fs1.trace.getActiveSpan();if(J){let D=J.spanContext();if(D.traceId)B.traceId=D.traceId,B.spanId=D.spanId}console.info(A,B)}},UT=pCA;cCA={error:(A,...Q)=>UT.error(A,...Q),warn:(A,...Q)=>UT.warn(A,...Q),info:(A,...Q)=>UT.info(A,...Q),debug:(A,...Q)=>UT.debug(A,...Q),audit:(A,...Q)=>UT.audit(A,...Q)},N1=cCA});function xW(A){let Q=typeof A==="string"?A:A.toString();return Q===fz||Q===fz.slice(0,-1)}function Tb(A){return xW(A)?fz:A}var lCA,fz,dCA,iR2;var H3=j1(()=>{lCA=new URL("https://ampcode.com/"),fz=lCA.toString(),dCA=new URL("https://api.anthropic.com/"),iR2=dCA.toString()});function Fs(A){Promise.resolve().then(()=>{try{A()}catch(Q){console.error(Q)}})}function Ms1(A){let Q=A._cleanup;if(Q===void 0)return;if(A._cleanup=void 0,!Q)return;try{if(typeof Q==="function")Q();else if(Q&&typeof Q.unsubscribe==="function")Q.unsubscribe()}catch(B){console.error("cleanupSubscription",B)}}function Jq1(A){A._observer=void 0,A._queue=void 0,A._state="closed"}function iCA(A){let Q=A._queue;if(!Q)return;A._queue=void 0,A._state="ready";for(let B of Q)if(Ws1(A,B.type,B.value),A._state==="closed")break}function Ws1(A,Q,B){A._state="running";let J=A._observer;try{switch(Q){case"next":if(J&&typeof J.next==="function")J.next(B);break;case"error":if(Jq1(A),J&&typeof J.error==="function")J.error(B);else throw B;break;case"complete":if(Jq1(A),J&&typeof J.complete==="function")J.complete();break}}catch(D){console.error("notifySubscription",D)}if(A._state==="closed")Ms1(A);else if(A._state==="running")A._state="ready"}function Bq1(A,Q,B){if(A._state==="closed")return;if(A._state==="buffering"){A._queue=A._queue||[],A._queue.push({type:Q,value:B});return}if(A._state!=="ready"){A._state="buffering",A._queue=[{type:Q,value:B}],Fs(()=>iCA(A));return}Ws1(A,Q,B)}class ws1{_cleanup;_observer;_queue;_state;constructor(A,Q){this._cleanup=void 0,this._observer=A,this._queue=void 0,this._state="initializing";let B=new Is1(this);try{this._cleanup=Q.call(void 0,B)}catch(J){B.error(J)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")Jq1(this),Ms1(this)}}class Is1{_subscription;constructor(A){this._subscription=A}get closed(){return this._subscription._state==="closed"}next(A){Bq1(this._subscription,"next",A)}error(A){Bq1(this._subscription,"error",A)}complete(){Bq1(this._subscription,"complete")}}function u5(A){if(typeof A==="function")A();else if(A&&typeof A.unsubscribe==="function")A.unsubscribe()}class HT{_baseObserver;_pendingPromises;constructor(A){this._baseObserver=A,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch((A)=>this._baseObserver.error(A))}error(A){this._baseObserver.error(A)}schedule(A){let Q=Promise.all(this._pendingPromises),B=[],J=(z)=>B.push(z),D=Promise.resolve().then(async()=>{await Q,await A(J),this._pendingPromises.delete(D);for(let z of B)this._baseObserver.next(z)}).catch((z)=>{this._pendingPromises.delete(D),this._baseObserver.error(z)});this._pendingPromises.add(D)}}var GA;var $b=j1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");GA=class GA{_subscriber;constructor(A){if(!(this instanceof GA))throw new TypeError("Observable cannot be called as a function");if(typeof A!=="function")throw new TypeError("Observable initializer must be a function");this._subscriber=A}subscribe(A,Q,B){if(typeof A!=="object"||A===null)A={next:A,error:Q,complete:B};return new ws1(A,this._subscriber)}pipe(A,...Q){let B=this;for(let J of[A,...Q])B=J(B);return B}[Symbol.observable](){return this}static from(A){let Q=typeof this==="function"?this:GA;if(A==null)throw new TypeError(A+" is not an object");let B=A[Symbol.observable];if(typeof B==="function"){let D=B.call(A);if(Object(D)!==D)throw new TypeError(D+" is not an object");if(D instanceof GA)return D;return new Q((z)=>D.subscribe(z))}let J=A[Symbol.iterator];if(typeof J==="function")return new Q((D)=>{Fs(()=>{if(D.closed)return;for(let z of J.call(A))if(D.next(z),D.closed)return;D.complete()})});if(Array.isArray(A))return new Q((D)=>{Fs(()=>{if(D.closed)return;for(let z of A)if(D.next(z),D.closed)return;D.complete()})});throw new TypeError(A+" is not observable")}static of(...A){return new(typeof this==="function"?this:GA)((B)=>{Fs(()=>{if(B.closed)return;for(let J of A)if(B.next(J),B.closed)return;B.complete()})})}static get[Symbol.species](){return this}}});var R8,pQ;var Es=j1(()=>{$b();R8=class R8 extends GA{_observers=new Set;constructor(){super((A)=>{return this._observers.add(A),()=>this._observers.delete(A)})}next(A){for(let Q of this._observers)Q.next(A)}error(A){for(let Q of this._observers)Q.error(A)}complete(){for(let A of this._observers)A.complete()}};pQ=class pQ extends R8{currentValue;constructor(A){super();this.currentValue=A}next(A){this.currentValue=A,super.next(A)}subscribe(A,Q,B){if(typeof A!=="object"||A===null){let J={};if(A)J.next=A;if(Q)J.error=Q;if(B)J.complete=B;A=J}return A.next?.(this.currentValue),super.subscribe(A)}getValue(){return this.currentValue}}});function Ns1(){let A=new Set,Q=new pQ(A);return{add(B){A.add(B),Q.next(A)},delete(B){A.delete(B),Q.next(A)},set:A,observable:Q}}function Vs1(){let A=new Map,Q=new pQ(A);return{get(B){return A.get(B)},set(B,J){A.set(B,J),Q.next(A)},delete(B){A.delete(B),Q.next(A)},map:A,observable:Q}}var Os1=j1(()=>{Es()});function Ms(A,Q){if(A===Q)return!0;if(A==null||Q==null||typeof A!=="object"||typeof Q!=="object")return!1;let B=Array.isArray(A),J=Array.isArray(Q);if(B!==J)return!1;if(B&&J)return A.length===Q.length&&A.every((z,G)=>Ms(z,Q[G]));let D=new Set([...Object.keys(A),...Object.keys(Q)]);for(let z of D)if(!Ms(A[z],Q[z]))return!1;return!0}function Dq1(A){return{dispose:A.unsubscribe.bind(A)}}async function rA(A,Q){return new Promise((B,J)=>{let D=void 0,z=()=>{D?.unsubscribe(),J(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",z,{once:!0}),D=A.subscribe({next:(G)=>{D?.unsubscribe(),Q?.removeEventListener("abort",z),B(G)},error:(G)=>{Q?.removeEventListener("abort",z),J(G)},complete:()=>{Q?.removeEventListener("abort",z),J("Observable completed without emitting a value")}})})}async function LF(A,Q){return new Promise((B,J)=>{let D,z=!1,G=void 0,X=()=>{G?.unsubscribe(),J(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",X,{once:!0}),G=A.subscribe({next:(K)=>{D=K,z=!0},error:(K)=>{Q?.removeEventListener("abort",X),J(K)},complete:()=>{if(Q?.removeEventListener("abort",X),z)B(D);else J("Observable completed without emitting a value")}})})}function FT(A){return new GA((Q)=>{A.then((B)=>{Q.next(B),Q.complete()}).catch((B)=>{Q.error(B)})})}function M8(A){return new GA((Q)=>{let B=!1,J=new AbortController,D=J.signal;return(async()=>{try{D?.throwIfAborted();let G=await A(D);if(D?.throwIfAborted(),!B)Q.next(G),Q.complete()}catch(G){if(!B)if(D.aborted)Q.complete();else Q.error(G)}})(),()=>{B=!0,J.abort()}})}function Ls1(){let A=null,Q=[];return{observable:new GA((D)=>{let z=A?A.subscribe(D):null,G={observer:D,subscription:z};return Q.push(G),()=>{G.subscription?.unsubscribe();let X=Q.indexOf(G);if(X!==-1)Q.splice(X,1)}}),setSource:(D,z=!0)=>{if(A&&z)throw new Error("source is already set");A=D;for(let G of Q)G.subscription?.unsubscribe();for(let G of Q)G.subscription=A.subscribe(G.observer)}}}function U2(A){return(Q)=>{return new GA((B)=>{let J=new HT(B),D=0,z=Q.subscribe({complete(){J.complete()},error(G){J.error(G)},next(G){J.schedule(async(X)=>{let K=await A(G,D);D++,X(K)})}});return()=>u5(z)})}}function F3(...A){return new GA((Q)=>{let B=0,J=A.map((D)=>D.subscribe({next:(z)=>Q.next(z),error:(z)=>Q.error(z),complete:()=>{if(B++,B===A.length)Q.complete()}}));return()=>{Rs1(J)}})}function j5(...A){if(A.length===0)return zq1;return new GA((Q)=>{let B=new Array(A.length),J=new Array(A.length).fill(0),D=new Array(A.length).fill(!1),z=0,G=[],X=new HT(Q);for(let K=0;K<A.length;K++){let Y=A[K];G.push(Y.subscribe({next(q){B[K]=q,D[K]=!0;let Z=++J[K];if(D.every(Boolean))X.schedule(async(H)=>{if(J[K]===Z)H([...B])})},error(q){X.error(q)},complete(){if(z++,z===A.length)X.complete()}}))}return()=>{Rs1(G)}})}function CB(A){let B=A?.shouldCountRefs??!0,J=aCA++,D=(z,...G)=>{};return(z)=>{let G=new R8,X=null,K=!1,Y,q=0;return new GA((Z)=>{if(q++,K)D("new subscriber, emitting buffered value",Y),Z.next(Y);else D("new subscriber, no buffered value to emit");if(!X)X=z.subscribe({next:(F)=>{K=!0,Y=F,G.next(F)},error:(F)=>G.error(F),complete:()=>G.complete()});let H=G.subscribe(Z);return()=>{if(q--,H.unsubscribe(),B&&q===0){if(X)u5(X),X=null;K=!1}}})}}function Rs1(A){for(let Q of A)if(Q)u5(Q)}function Pb(A){return(Q)=>{return new GA((B)=>{let J=Q.subscribe({next:(z)=>B.next(z),error:(z)=>B.error(z),complete:()=>B.complete()}),D=A.subscribe({next:()=>{B.complete(),J.unsubscribe(),D.unsubscribe()},error:(z)=>{B.error(z),J.unsubscribe()}});return()=>{J.unsubscribe(),D.unsubscribe()}})}}function hW(A){return(Q)=>{return new GA((B)=>{let J,D=Q.subscribe({next(z){J=z,B.next(z)},error(z){B.error(z)},complete(){B.complete()}});return()=>{u5(D),A(J)}})}}function G7(A=Ms){return(Q)=>{return new GA((B)=>{let J=Cs1,D=new HT(B),z=Q.subscribe({complete(){D.complete()},error(G){D.error(G)},next(G){D.schedule(async(X)=>{if(J===Cs1||!A(J,G))J=G,X(G)})}});return()=>u5(z)})}}function RF(A){return rCA(typeof A==="function"?{next:A}:A)}function rCA(A){return(Q)=>new GA((B)=>{let J=typeof A==="function"?A():A,D=Q.subscribe({next(z){if(J.next)try{J.next(z)}catch(G){B.error(G);return}B.next(z)},error(z){if(J.error)try{J.error(z)}catch(G){B.error(G);return}B.error(z)},complete(){if(J.complete)try{J.complete()}catch(z){B.error(z);return}B.complete()}});return()=>u5(D)})}function Gq1(A){return(Q)=>{return new GA((B)=>{let J=!1,D=Q.subscribe({next:(G)=>{J=!0,clearTimeout(z),B.next(G)},error:(G)=>{clearTimeout(z),B.error(G)},complete:()=>{clearTimeout(z),B.complete()}}),z=setTimeout(()=>{if(!J)D.unsubscribe(),B.error(new js1(`Operation timed out after ${A}ms`))},A);return()=>{clearTimeout(z),D.unsubscribe()}})}}function L7(A){return(Q)=>new GA((B)=>{let J;try{B.next(A),J=Q.subscribe({next(D){B.next(D)},error(D){B.error(D)},complete(){B.complete()}})}catch(D){B.error(D)}return()=>{if(J)u5(J)}})}function Xq1(A){return(Q)=>new GA((B)=>{let J=0,D=Q.subscribe({next(z){if(J<A){if(B.next(z),J++,J===A)B.complete(),u5(D)}},error(z){B.error(z)},complete(){B.complete()}});return()=>{u5(D)}})}function y9(A){return(Q)=>{return new GA((B)=>{let J=0,D=null,z=!1,G=()=>{if(z&&!D)B.complete()},X=Q.subscribe({next(K){if(D)u5(D),D=null;let Y;try{Y=A(K,J++)}catch(q){B.error(q);return}D=Y.subscribe({next(q){B.next(q)},error(q){B.error(q)},complete(){D=null,G()}})},error(K){B.error(K)},complete(){z=!0,G()}});return()=>{if(u5(X),D)u5(D)}})}}function Ws(A){let Q={last:void 0,isSet:!1},B=A.subscribe((J)=>{Object.assign(Q,{last:J,isSet:!0})});return{value:Q,observable:A,subscription:B}}function dG(A){return(Q)=>new GA((B)=>{let J=null,D=null,z=!1,G=Q.subscribe({next:(X)=>{if(D=X,z=!0,J===null)J=setTimeout(()=>{if(z)B.next(D),z=!1;J=null},A)},error:(X)=>B.error(X),complete:()=>{if(J!==null)clearTimeout(J);if(z)B.next(D);B.complete()}});return()=>{if(u5(G),J!==null)clearTimeout(J)}})}function Kq1(A,Q){if(!Q.leading||!Q.trailing)throw new Error("leading and trailing must be true");return(B)=>new GA((J)=>{let D=0,z=null,G=null,X=!1,K=B.subscribe({next:(Y)=>{let q=Date.now();if(G=Y,X=!0,q-D>=A)J.next(Y),D=q,X=!1;else if(z===null)z=setTimeout(()=>{if(X)J.next(G),D=Date.now(),X=!1;z=null},A-(q-D));if(D===0)J.next(Y),D=q,X=!1},error:(Y)=>J.error(Y),complete:()=>{if(z!==null)clearTimeout(z);if(X)J.next(G);J.complete()}});return()=>{if(u5(K),z!==null)clearTimeout(z)}})}function E3(...A){return new GA((Q)=>{let B=0,J=null;function D(){if(B>=A.length){Q.complete();return}J=A[B].subscribe({next:(G)=>Q.next(G),error:(G)=>Q.error(G),complete:()=>{B++,D()}})}return D(),()=>{if(J)u5(J)}})}function Yq1(A){return(Q)=>new GA((B)=>{let J=0,D=!1,z=null,G=Q.subscribe({next(X){try{let K=A(X,J++);if(z)u5(z);z=K.subscribe({next(Y){B.next(Y)},error(Y){B.error(Y)},complete(){if(z=null,D&&!z)B.complete()}})}catch(K){B.error(K)}},error(X){B.error(X)},complete(){if(D=!0,!z)B.complete()}});return()=>{if(u5(G),z)u5(z)}})}function ws({onSubscribe:A,onUnsubscribe:Q}){return(B)=>new GA((J)=>{A?.();let D=B.subscribe(J);return()=>{u5(D),Q?.()}})}function jF(A){return(Q)=>GA.from(Q).pipe(y9((B)=>M8((J)=>A(B,J))))}function mW(A){return(Q)=>new GA((B)=>{let J,D=Q.subscribe({next(z){B.next(z)},error(z){try{J=A(z).subscribe({next(X){B.next(X)},error(X){B.error(X)},complete(){B.complete()}})}catch(G){B.error(G)}},complete(){B.complete()}});return()=>{if(u5(D),J)u5(J)}})}function mJ(A){return(Q)=>{return new GA((B)=>{let J=Q.subscribe({next(D){if(A(D))B.next(D)},error(D){B.error(D)},complete(){B.complete()}});return()=>u5(J)})}}function Ts1(A,Q){return(B)=>{return new GA((J)=>{let D,z=0,G=new HT(J),X=B.subscribe({complete(){G.complete()},error(K){G.error(K)},next(K){G.schedule(async(Y)=>{D=await A(z===0?typeof Q==="undefined"?K:Q:D,K,z++),Y(D)})}});return()=>u5(X)})}}var zq1,_b,Jj2,aCA=0,Cs1,js1;var qq1=j1(()=>{$b();Es();zq1=new GA((A)=>{A.complete()}),_b=new GA(()=>{});Jj2=Symbol("noInitialValue");Cs1={};js1=class js1 extends Error{constructor(A="Timeout has occurred"){super(A);this.name="TimeoutError"}}});function ET(A,Q){return(B)=>{return GA.from(B).pipe(y9((J)=>J===iG?GA.of(iG):A(J).pipe(mW((D)=>GA.of(D instanceof Error?D:new Error(D))),L7(iG))),CB(Q))}}function nCA(){return(A)=>GA.from(A).pipe(mJ((Q)=>Q!==iG))}async function Sb(A,Q){let B=await rA(GA.from(A).pipe(nCA()),Q);if(B instanceof Error)throw B;return B}var iG;var $s1=j1(()=>{$b();qq1();iG=Symbol.for("@@pendingOperation")});var O6=j1(()=>{Os1();$b();$s1();qq1();Es()});function Ps1(A){_s1.setSource(A.pipe(CB()),!1)}var _s1,h2;var NQ=j1(()=>{O6();_s1=Ls1();h2=_s1.observable});function Ss1(){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 vs1(A,Q){if(!A.scheme&&Q)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${A.authority}", path: "${A.path}", query: "${A.query}", fragment: "${A.fragment}"}`);if(A.scheme&&!sCA.test(A.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(A.path){if(A.authority){if(!oCA.test(A.path))throw new 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(tCA.test(A.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function eCA(A,Q){if(!A&&!Q)return"file";return A}function ALA(A,Q){switch(A){case"https":case"http":case"file":if(!Q)Q=pY;else if(Q[0]!==pY)Q=pY+Q;break}return Q}class C6{static isUri(A){if(A instanceof C6)return!0;if(!A)return!1;let Q=A;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(A,Q,B,J,D,z=!1,G){if(typeof A==="object")this.scheme=A.scheme||a4,this.authority=A.authority||a4,this.path=A.path||a4,this.query=A.query||a4,this.fragment=A.fragment||a4,this.platform=A.platform;else this.scheme=eCA(A,z),this.authority=Q||a4,this.path=ALA(this.scheme,B||a4),this.query=J||a4,this.fragment=D||a4,this.platform=G,vs1(this,z)}get fsPath(){return gs1(this,!1)}with(A){if(!A)return this;let{scheme:Q,authority:B,path:J,query:D,fragment:z,platform:G}=A;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=a4;if(B===void 0)B=this.authority;else if(B===null)B=a4;if(J===void 0)J=this.path;else if(J===null)J=a4;if(D===void 0)D=this.query;else if(D===null)D=a4;if(z===void 0)z=this.fragment;else if(z===null)z=a4;if(G===void 0)G=this.platform;else if(G===null)G=void 0;if(Q===this.scheme&&B===this.authority&&J===this.path&&D===this.query&&z===this.fragment&&G===this.platform)return this;return new M3(Q,B,J,D,z,!1,G)}static parse(A,Q=!1){let B=QLA.exec(A);if(!B)return new M3(a4,a4,a4,a4,a4);return new M3(B[2]||a4,Is(B[4]||a4),Is(B[5]||a4),Is(B[7]||a4),Is(B[9]||a4),Q)}static file(A,Q=Ss1()){let B=a4;if(Q==="windows")A=A.replace(/\\/g,pY);if(A[0]===pY&&A[1]===pY){let J=A.indexOf(pY,2);if(J===-1)B=A.substring(2),A=pY;else B=A.substring(2,J),A=A.substring(J)||pY}return new M3("file",B,A,a4,a4,!1,Q)}static from(A){let Q=new M3(A.scheme,A.authority,A.path,A.query,A.fragment,!0,A.platform);return vs1(Q,!0),Q}toString(A=!1){return Zq1(this,A)}toJSON(){return this}static revive(A){if(!A)return A;if(A instanceof C6)return A;let Q=new M3(A),B=A;return Q._formatted=B.external,Q._fsPath=B._sep===ys1(Q.platform)?B.fsPath:null,Q}}function ys1(A){return A==="windows"?1:void 0}function ks1(A,Q,B){let J=void 0;for(let D=0;D<A.length;D++){let z=A.charCodeAt(D);if(z>=97&&z<=122||z>=65&&z<=90||z>=48&&z<=57||z===45||z===46||z===95||z===126||Q&&z===47||B&&z===91||B&&z===93||B&&z===58){if(J!==void 0)J+=A.charAt(D)}else{if(J===void 0)J=A.substring(0,D);let G=bs1[z];if(G!==void 0)J+=G;else J+=encodeURIComponent(A.charAt(D))}}return J!==void 0?J:A}function BLA(A){let Q=void 0;for(let B=0;B<A.length;B++){let J=A.charCodeAt(B);if(J===35||J===63){if(Q===void 0)Q=A.substring(0,B);Q+=bs1[J]}else if(Q!==void 0)Q+=A[B]}return Q!==void 0?Q:A}function gs1(A,Q){let B;if(A.authority&&A.path.length>1&&A.scheme==="file")B=`//${A.authority}${A.path}`;else if(A.path.charCodeAt(0)===47&&(A.path.charCodeAt(1)>=65&&A.path.charCodeAt(1)<=90||A.path.charCodeAt(1)>=97&&A.path.charCodeAt(1)<=122)&&A.path.charCodeAt(2)===58)if(!Q)B=A.path[1].toLowerCase()+A.path.substring(2);else B=A.path.substring(1);else B=A.path;if(A.platform==="windows")B=B.replace(/\//g,"\\");return B}function Zq1(A,Q){let B=!Q?ks1:BLA,J="",{scheme:D,authority:z,path:G,query:X,fragment:K}=A;if(D)J+=D,J+=":";if(z||D==="file")J+=pY,J+=pY;if(z){let Y=z.indexOf("@");if(Y!==-1){let q=z.substring(0,Y);if(z=z.substring(Y+1),Y=q.lastIndexOf(":"),Y===-1)J+=B(q,!1,!1);else J+=B(q.substring(0,Y),!1,!1),J+=":",J+=B(q.substring(Y+1),!1,!0);J+="@"}if(z=z.toLowerCase(),Y=z.lastIndexOf(":"),Y===-1)J+=B(z,!1,!0);else J+=B(z.substring(0,Y),!1,!0),J+=z.substring(Y)}if(G){if(G.length>=3&&G.charCodeAt(0)===47&&G.charCodeAt(2)===58){let Y=G.charCodeAt(1);if(Y>=65&&Y<=90)G=`/${String.fromCharCode(Y+32)}:${G.substring(3)}`}else if(G.length>=2&&G.charCodeAt(1)===58){let Y=G.charCodeAt(0);if(Y>=65&&Y<=90)G=`${String.fromCharCode(Y+32)}:${G.substring(2)}`}J+=B(G,!0,!1)}if(X)J+="?",J+=B(X,!1,!1);if(K)J+="#",J+=!Q?ks1(K,!1,!1):K;return J}function xs1(A){try{return decodeURIComponent(A)}catch{if(A.length>3)return A.substring(0,3)+xs1(A.substring(3));else return A}}function Is(A){if(!A.match(fs1))return A;return A.replace(fs1,(Q)=>xs1(Q))}function uW(A){return A.scheme==="file"}function TF(A){return C6.parse(A)}function f8(A){return A.toString()}function J4(A){if(typeof A==="string"||A instanceof URL)return C6.parse(A.toString());return A}var sCA,oCA,tCA,a4="",pY="/",QLA,M3,bs1,fs1;var Ns=j1(()=>{sCA=/^\w[\w\d+.-]*$/,oCA=/^\//,tCA=/^\/\//;QLA=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;M3=class M3 extends C6{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=gs1(this,!1);return this._fsPath}toString(A=!1){if(!A){if(!this._formatted)this._formatted=Zq1(this,!1);return this._formatted}return Zq1(this,!0)}toJSON(){let A={};if(this._fsPath)A.fsPath=this._fsPath,A._sep=ys1(this.platform);if(this._formatted)A.external=this._formatted;if(A.scheme=this.scheme,A.authority=this.authority,A.path=this.path,A.query=this.query,A.fragment=this.fragment,this.platform)A.platform=this.platform;return A}};bs1={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"};fs1=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function Uq1(A){if(A==="/")return"/";if(A==="")return".";let Q=A.replace(/\/+$/,"");if(!Q)return".";let B=Q.lastIndexOf("/");if(B===-1)return".";if(B===0)return"/";return Q.slice(0,B)}function W3(A){let Q=A.replace(/\/+$/,"");if(!Q)return"";let B=Q.lastIndexOf("/");return B===-1?Q:Q.slice(B+1)}function Vs(...A){if(A.length===0)return".";let Q="";for(let G of A)if(G)if(Q)Q+="/"+G;else Q=G;if(!Q)return".";let B=Q.endsWith("/"),J=Q.split("/").filter(Boolean),D=[];for(let G of J)if(G===".."){if(D.length>0&&D[D.length-1]!=="..")D.pop();else if(!Q.startsWith("/"))D.push("..")}else if(G!==".")D.push(G);let z=Q.startsWith("/")?"/"+D.join("/"):D.join("/");if(!z)z=Q.startsWith("/")?"/":".";if(B&&z!=="/"&&z!==".")z+="/";return z}function hs1(A,Q,B="/",J="/",D=!0){function z(Z,H){return D?Z===H:Z.toLowerCase()===H.toLowerCase()}if(B==="/")A=A.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else A=A.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(A!==B&&A.endsWith(B))A=A.slice(0,-1);if(Q!==B&&Q.endsWith(B))Q=Q.slice(0,-1);if(z(A,Q))return"";if(!A.startsWith(B)&&Q.startsWith(B))return Q;let G=A===B?[""]:A.split(B),X=Q===B?[""]:Q.split(B),K=0;while(K<G.length&&K<X.length&&z(G[K],X[K]))K++;let Y=G.length-K,q=[];for(let Z=0;Z<Y;Z++)q.push("..");return q.push(...X.slice(K)),q.join(J)}function Os(A){let Q=W3(A.replace(/\/+$/,"")),B=Q.lastIndexOf(".");if(B===0||B===-1)return"";return Q.slice(B)}function pW(A){if(A=J4(A),A.scheme==="file")return A.path;return A.toString()}var vb=j1(()=>{Ns()});function JLA(A,...Q){return A=J4(A),A.with({path:Vs(A.path,...Q)})}function DLA(A,...Q){let B=A.path,J=!1;if(B[0]!==Cs)B=Cs+B,J=!0;let D=B;for(let z of Q)if(z.startsWith("/"))D=Vs(z);else D=Vs(D,z);if(D!=="/"&&D.endsWith("/"))D=D.replace(/\/+$/,"");if(J&&D[0]===Cs&&!A.authority)D=D.substring(1);return A.with({path:D})}function zLA(A){if(A=J4(A),A.path.length===0||A.path===Cs)return A;let Q=Uq1(A.path);if(Q.length===1&&Q===".")Q="";return A.with({path:Q})}function GLA(A,Q){if(Q.scheme!==A.scheme||(Q.authority??"")!==(A.authority??""))return!1;let B=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),J=B?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,D=B?A.path.slice(0,2).toUpperCase()+A.path.slice(2):A.path;return D===J||D.startsWith(J.endsWith("/")?J:`${J}/`)||J.endsWith("/")&&D===J.slice(0,-1)}function XLA(A,Q){if(A.scheme!==Q.scheme||A.authority!==Q.authority||A.query!==Q.query||A.fragment!==Q.fragment)return null;let B=A.platform==="windows"?"\\":"/";return hs1(A.path,Q.path,B,B)}function KLA(A,Q){let B=f8(A),J=f8(Q);if(B.startsWith("file:///")&&J.startsWith("file:///"))return ms1(B)===ms1(J);return B===J}function ms1(A){return A.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Cs="/",$6;var Hq1=j1(()=>{vb();Ns();$6={joinPath:JLA,resolvePath:DLA,dirname:zLA,basename:(A)=>W3(J4(A).path),extname:(A)=>Os(J4(A).path),hasPrefix:GLA,relativePath:XLA,equalURIs:KLA}});var x8=j1(()=>{Ns();Hq1();vb()});var G9,Fq1,J6,QU=(A)=>{switch(typeof A){case"undefined":return J6.undefined;case"string":return J6.string;case"number":return Number.isNaN(A)?J6.nan:J6.number;case"boolean":return J6.boolean;case"function":return J6.function;case"bigint":return J6.bigint;case"symbol":return J6.symbol;case"object":if(Array.isArray(A))return J6.array;if(A===null)return J6.null;if(A.then&&typeof A.then==="function"&&A.catch&&typeof A.catch==="function")return J6.promise;if(typeof Map!=="undefined"&&A instanceof Map)return J6.map;if(typeof Set!=="undefined"&&A instanceof Set)return J6.set;if(typeof Date!=="undefined"&&A instanceof Date)return J6.date;return J6.object;default:return J6.unknown}};var kb=j1(()=>{(function(A){A.assertEqual=(D)=>{};function Q(D){}A.assertIs=Q;function B(D){throw new Error}A.assertNever=B,A.arrayToEnum=(D)=>{let z={};for(let G of D)z[G]=G;return z},A.getValidEnumValues=(D)=>{let z=A.objectKeys(D).filter((X)=>typeof D[D[X]]!=="number"),G={};for(let X of z)G[X]=D[X];return A.objectValues(G)},A.objectValues=(D)=>{return A.objectKeys(D).map(function(z){return D[z]})},A.objectKeys=typeof Object.keys==="function"?(D)=>Object.keys(D):(D)=>{let z=[];for(let G in D)if(Object.prototype.hasOwnProperty.call(D,G))z.push(G);return z},A.find=(D,z)=>{for(let G of D)if(z(G))return G;return},A.isInteger=typeof Number.isInteger==="function"?(D)=>Number.isInteger(D):(D)=>typeof D==="number"&&Number.isFinite(D)&&Math.floor(D)===D;function J(D,z=" | "){return D.map((G)=>typeof G==="string"?`'${G}'`:G).join(z)}A.joinValues=J,A.jsonStringifyReplacer=(D,z)=>{if(typeof z==="bigint")return z.toString();return z}})(G9||(G9={}));(function(A){A.mergeShapes=(Q,B)=>{return{...Q,...B}}})(Fq1||(Fq1={}));J6=G9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var hA,YLA=(A)=>{return JSON.stringify(A,null,2).replace(/"([^"]+)":/g,"$1:")},yz;var Ls=j1(()=>{kb();hA=G9.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"]);yz=class yz extends Error{get errors(){return this.issues}constructor(A){super();this.issues=[],this.addIssue=(B)=>{this.issues=[...this.issues,B]},this.addIssues=(B=[])=>{this.issues=[...this.issues,...B]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=A}format(A){let Q=A||function(D){return D.message},B={_errors:[]},J=(D)=>{for(let z of D.issues)if(z.code==="invalid_union")z.unionErrors.map(J);else if(z.code==="invalid_return_type")J(z.returnTypeError);else if(z.code==="invalid_arguments")J(z.argumentsError);else if(z.path.length===0)B._errors.push(Q(z));else{let G=B,X=0;while(X<z.path.length){let K=z.path[X];if(X!==z.path.length-1)G[K]=G[K]||{_errors:[]};else G[K]=G[K]||{_errors:[]},G[K]._errors.push(Q(z));G=G[K],X++}}};return J(this),B}static assert(A){if(!(A instanceof yz))throw new Error(`Not a ZodError: ${A}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(A=(Q)=>Q.message){let Q={},B=[];for(let J of this.issues)if(J.path.length>0){let D=J.path[0];Q[D]=Q[D]||[],Q[D].push(A(J))}else B.push(A(J));return{formErrors:B,fieldErrors:Q}}get formErrors(){return this.flatten()}};yz.create=(A)=>{return new yz(A)}});var qLA=(A,Q)=>{let B;switch(A.code){case hA.invalid_type:if(A.received===J6.undefined)B="Required";else B=`Expected ${A.expected}, received ${A.received}`;break;case hA.invalid_literal:B=`Invalid literal value, expected ${JSON.stringify(A.expected,G9.jsonStringifyReplacer)}`;break;case hA.unrecognized_keys:B=`Unrecognized key(s) in object: ${G9.joinValues(A.keys,", ")}`;break;case hA.invalid_union:B="Invalid input";break;case hA.invalid_union_discriminator:B=`Invalid discriminator value. Expected ${G9.joinValues(A.options)}`;break;case hA.invalid_enum_value:B=`Invalid enum value. Expected ${G9.joinValues(A.options)}, received '${A.received}'`;break;case hA.invalid_arguments:B="Invalid function arguments";break;case hA.invalid_return_type:B="Invalid function return type";break;case hA.invalid_date:B="Invalid date";break;case hA.invalid_string:if(typeof A.validation==="object")if("includes"in A.validation){if(B=`Invalid input: must include "${A.validation.includes}"`,typeof A.validation.position==="number")B=`${B} at one or more positions greater than or equal to ${A.validation.position}`}else if("startsWith"in A.validation)B=`Invalid input: must start with "${A.validation.startsWith}"`;else if("endsWith"in A.validation)B=`Invalid input: must end with "${A.validation.endsWith}"`;else G9.assertNever(A.validation);else if(A.validation!=="regex")B=`Invalid ${A.validation}`;else B="Invalid";break;case hA.too_small:if(A.type==="array")B=`Array must contain ${A.exact?"exactly":A.inclusive?"at least":"more than"} ${A.minimum} element(s)`;else if(A.type==="string")B=`String must contain ${A.exact?"exactly":A.inclusive?"at least":"over"} ${A.minimum} character(s)`;else if(A.type==="number")B=`Number must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${A.minimum}`;else if(A.type==="bigint")B=`Number must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${A.minimum}`;else if(A.type==="date")B=`Date must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(A.minimum))}`;else B="Invalid input";break;case hA.too_big:if(A.type==="array")B=`Array must contain ${A.exact?"exactly":A.inclusive?"at most":"less than"} ${A.maximum} element(s)`;else if(A.type==="string")B=`String must contain ${A.exact?"exactly":A.inclusive?"at most":"under"} ${A.maximum} character(s)`;else if(A.type==="number")B=`Number must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`;else if(A.type==="bigint")B=`BigInt must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`;else if(A.type==="date")B=`Date must be ${A.exact?"exactly":A.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(A.maximum))}`;else B="Invalid input";break;case hA.custom:B="Invalid input";break;case hA.invalid_intersection_types:B="Intersection results could not be merged";break;case hA.not_multiple_of:B=`Number must be a multiple of ${A.multipleOf}`;break;case hA.not_finite:B="Number must be finite";break;default:B=Q.defaultError,G9.assertNever(A)}return{message:B}},$F;var Eq1=j1(()=>{Ls();kb();$F=qLA});function ZLA(A){us1=A}function MT(){return us1}var us1;var Rs=j1(()=>{Eq1();us1=$F});function L6(A,Q){let B=MT(),J=fb({issueData:Q,data:A.data,path:A.path,errorMaps:[A.common.contextualErrorMap,A.schemaErrorMap,B,B===$F?void 0:$F].filter((D)=>!!D)});A.common.issues.push(J)}class QJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(A,Q){let B=[];for(let J of Q){if(J.status==="aborted")return m2;if(J.status==="dirty")A.dirty();B.push(J.value)}return{status:A.value,value:B}}static async mergeObjectAsync(A,Q){let B=[];for(let J of Q){let D=await J.key,z=await J.value;B.push({key:D,value:z})}return QJ.mergeObjectSync(A,B)}static mergeObjectSync(A,Q){let B={};for(let J of Q){let{key:D,value:z}=J;if(D.status==="aborted")return m2;if(z.status==="aborted")return m2;if(D.status==="dirty")A.dirty();if(z.status==="dirty")A.dirty();if(D.value!=="__proto__"&&(typeof z.value!=="undefined"||J.alwaysSet))B[D.value]=z.value}return{status:A.value,value:B}}}var fb=(A)=>{let{data:Q,path:B,errorMaps:J,issueData:D}=A,z=[...B,...D.path||[]],G={...D,path:z};if(D.message!==void 0)return{...D,path:z,message:D.message};let X="",K=J.filter((Y)=>!!Y).slice().reverse();for(let Y of K)X=Y(G,{data:Q,defaultError:X}).message;return{...D,path:z,message:X}},ULA,m2,w3=(A)=>({status:"dirty",value:A}),uJ=(A)=>({status:"valid",value:A}),js=(A)=>A.status==="aborted",Ts=(A)=>A.status==="dirty",cW=(A)=>A.status==="valid",WT=(A)=>typeof Promise!=="undefined"&&A instanceof Promise;var Mq1=j1(()=>{Rs();Eq1();ULA=[];m2=Object.freeze({status:"aborted"})});var ps1=()=>{};var B2;var cs1=j1(()=>{(function(A){A.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},A.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(B2||(B2={}))});class iY{constructor(A,Q,B,J){this._cachedPath=[],this.parent=A,this.data=Q,this._path=B,this._key=J}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 j8(A){if(!A)return{};let{errorMap:Q,invalid_type_error:B,required_error:J,description:D}=A;if(Q&&(B||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:D};return{errorMap:(G,X)=>{let{message:K}=A;if(G.code==="invalid_enum_value")return{message:K??X.defaultError};if(typeof X.data==="undefined")return{message:K??J??X.defaultError};if(G.code!=="invalid_type")return{message:X.defaultError};return{message:K??B??X.defaultError}},description:D}}class c8{get description(){return this._def.description}_getType(A){return QU(A.data)}_getOrReturnCtx(A,Q){return Q||{common:A.parent.common,data:A.data,parsedType:QU(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}_processInputParams(A){return{status:new QJ,ctx:{common:A.parent.common,data:A.data,parsedType:QU(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}}_parseSync(A){let Q=this._parse(A);if(WT(Q))throw new Error("Synchronous parse encountered promise.");return Q}_parseAsync(A){let Q=this._parse(A);return Promise.resolve(Q)}parse(A,Q){let B=this.safeParse(A,Q);if(B.success)return B.data;throw B.error}safeParse(A,Q){let B={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:QU(A)},J=this._parseSync({data:A,path:B.path,parent:B});return ls1(B,J)}"~validate"(A){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:QU(A)};if(!this["~standard"].async)try{let B=this._parseSync({data:A,path:[],parent:Q});return cW(B)?{value:B.value}:{issues:Q.common.issues}}catch(B){if(B?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:A,path:[],parent:Q}).then((B)=>cW(B)?{value:B.value}:{issues:Q.common.issues})}async parseAsync(A,Q){let B=await this.safeParseAsync(A,Q);if(B.success)return B.data;throw B.error}async safeParseAsync(A,Q){let B={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:QU(A)},J=this._parse({data:A,path:B.path,parent:B}),D=await(WT(J)?J:Promise.resolve(J));return ls1(B,D)}refine(A,Q){let B=(J)=>{if(typeof Q==="string"||typeof Q==="undefined")return{message:Q};else if(typeof Q==="function")return Q(J);else return Q};return this._refinement((J,D)=>{let z=A(J),G=()=>D.addIssue({code:hA.custom,...B(J)});if(typeof Promise!=="undefined"&&z instanceof Promise)return z.then((X)=>{if(!X)return G(),!1;else return!0});if(!z)return G(),!1;else return!0})}refinement(A,Q){return this._refinement((B,J)=>{if(!A(B))return J.addIssue(typeof Q==="function"?Q(B,J):Q),!1;else return!0})}_refinement(A){return new aY({schema:this,typeName:l2.ZodEffects,effect:{type:"refinement",refinement:A}})}superRefine(A){return this._refinement(A)}constructor(A){this.spa=this.safeParseAsync,this._def=A,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 dY.create(this,this._def)}nullable(){return PF.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lY.create(this)}promise(){return O3.create(this,this._def)}or(A){return CT.create([this,A],this._def)}and(A){return LT.create(this,A,this._def)}transform(A){return new aY({...j8(this._def),schema:this,typeName:l2.ZodEffects,effect:{type:"transform",transform:A}})}default(A){let Q=typeof A==="function"?A:()=>A;return new $T({...j8(this._def),innerType:this,defaultValue:Q,typeName:l2.ZodDefault})}brand(){return new _s({typeName:l2.ZodBranded,type:this,...j8(this._def)})}catch(A){let Q=typeof A==="function"?A:()=>A;return new _T({...j8(this._def),innerType:this,catchValue:Q,typeName:l2.ZodCatch})}describe(A){return new this.constructor({...this._def,description:A})}pipe(A){return mb.create(this,A)}readonly(){return PT.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function as1(A){let Q="[0-5]\\d";if(A.precision)Q=`${Q}\\.\\d{${A.precision}}`;else if(A.precision==null)Q=`${Q}(\\.\\d+)?`;let B=A.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${B}`}function _LA(A){return new RegExp(`^${as1(A)}$`)}function rs1(A){let Q=`${is1}T${as1(A)}`,B=[];if(B.push(A.local?"Z?":"Z"),A.offset)B.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${B.join("|")})`,new RegExp(`^${Q}$`)}function PLA(A,Q){if((Q==="v4"||!Q)&&OLA.test(A))return!0;if((Q==="v6"||!Q)&&LLA.test(A))return!0;return!1}function SLA(A,Q){if(!wLA.test(A))return!1;try{let[B]=A.split(".");if(!B)return!1;let J=B.replace(/-/g,"+").replace(/_/g,"/").padEnd(B.length+(4-B.length%4)%4,"="),D=JSON.parse(atob(J));if(typeof D!=="object"||D===null)return!1;if("typ"in D&&D?.typ!=="JWT")return!1;if(!D.alg)return!1;if(Q&&D.alg!==Q)return!1;return!0}catch{return!1}}function vLA(A,Q){if((Q==="v4"||!Q)&&CLA.test(A))return!0;if((Q==="v6"||!Q)&&RLA.test(A))return!0;return!1}function kLA(A,Q){let B=(A.toString().split(".")[1]||"").length,J=(Q.toString().split(".")[1]||"").length,D=B>J?B:J,z=Number.parseInt(A.toFixed(D).replace(".","")),G=Number.parseInt(Q.toFixed(D).replace(".",""));return z%G/10**D}function wT(A){if(A instanceof X7){let Q={};for(let B in A.shape){let J=A.shape[B];Q[B]=dY.create(wT(J))}return new X7({...A._def,shape:()=>Q})}else if(A instanceof lY)return new lY({...A._def,type:wT(A.element)});else if(A instanceof dY)return dY.create(wT(A.unwrap()));else if(A instanceof PF)return PF.create(wT(A.unwrap()));else if(A instanceof JU)return JU.create(A.items.map((Q)=>wT(Q)));else return A}function wq1(A,Q){let B=QU(A),J=QU(Q);if(A===Q)return{valid:!0,data:A};else if(B===J6.object&&J===J6.object){let D=G9.objectKeys(Q),z=G9.objectKeys(A).filter((X)=>D.indexOf(X)!==-1),G={...A,...Q};for(let X of z){let K=wq1(A[X],Q[X]);if(!K.valid)return{valid:!1};G[X]=K.data}return{valid:!0,data:G}}else if(B===J6.array&&J===J6.array){if(A.length!==Q.length)return{valid:!1};let D=[];for(let z=0;z<A.length;z++){let G=A[z],X=Q[z],K=wq1(G,X);if(!K.valid)return{valid:!1};D.push(K.data)}return{valid:!0,data:D}}else if(B===J6.date&&J===J6.date&&+A===+Q)return{valid:!0,data:A};else return{valid:!1}}function ns1(A,Q){return new aW({values:A,typeName:l2.ZodEnum,...j8(Q)})}function ds1(A,Q){let B=typeof A==="function"?A(Q):typeof A==="string"?{message:A}:A;return typeof B==="string"?{message:B}:B}function ss1(A,Q={},B){if(A)return N3.create().superRefine((J,D)=>{let z=A(J);if(z instanceof Promise)return z.then((G)=>{if(!G){let X=ds1(Q,J),K=X.fatal??B??!0;D.addIssue({code:"custom",...X,fatal:K})}});if(!z){let G=ds1(Q,J),X=G.fatal??B??!0;D.addIssue({code:"custom",...G,fatal:X})}return});return N3.create()}var ls1=(A,Q)=>{if(cW(Q))return{success:!0,data:Q.value};else{if(!A.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let B=new yz(A.common.issues);return this._error=B,this._error}}}},HLA,FLA,ELA,MLA,WLA,wLA,ILA,NLA,VLA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Wq1,OLA,CLA,LLA,RLA,jLA,TLA,is1="((\\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])))",$LA,cY,dW,iW,NT,I3,yb,VT,OT,N3,lW,BU,bb,lY,X7,CT,_F=(A)=>{if(A instanceof RT)return _F(A.schema);else if(A instanceof aY)return _F(A.innerType());else if(A instanceof jT)return[A.value];else if(A instanceof aW)return A.options;else if(A instanceof TT)return G9.objectValues(A.enum);else if(A instanceof $T)return _F(A._def.innerType);else if(A instanceof VT)return[void 0];else if(A instanceof OT)return[null];else if(A instanceof dY)return[void 0,..._F(A.unwrap())];else if(A instanceof PF)return[null,..._F(A.unwrap())];else if(A instanceof _s)return _F(A.unwrap());else if(A instanceof PT)return _F(A.unwrap());else if(A instanceof _T)return _F(A._def.innerType);else return[]},$s,LT,JU,gb,xb,V3,IT,RT,jT,aW,TT,O3,aY,dY,PF,$T,_T,hb,fLA,_s,mb,PT,yLA,l2,bLA=(A,Q={message:`Input not instance of ${A.name}`})=>ss1((B)=>B instanceof A,Q),os1,ts1,gLA,xLA,es1,hLA,mLA,uLA,pLA,cLA,lLA,dLA,iLA,aLA,rLA,nLA,sLA,oLA,tLA,eLA,ARA,QRA,BRA,JRA,DRA,zRA,GRA,XRA,KRA,YRA,qRA,ZRA,URA,HRA,FRA=()=>os1().optional(),ERA=()=>ts1().optional(),MRA=()=>es1().optional(),WRA,wRA;var Ao1=j1(()=>{Ls();Rs();cs1();Mq1();kb();HLA=/^c[^\s-]{8,}$/i,FLA=/^[0-9a-z]+$/,ELA=/^[0-9A-HJKMNP-TV-Z]{26}$/i,MLA=/^[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,WLA=/^[a-z0-9_-]{21}$/i,wLA=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ILA=/^[-+]?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)?)??$/,NLA=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,OLA=/^(?:(?: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])$/,CLA=/^(?:(?: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])$/,LLA=/^(([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]))$/,RLA=/^(([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])$/,jLA=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TLA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$LA=new RegExp(`^${is1}$`);cY=class cY extends c8{_parse(A){if(this._def.coerce)A.data=String(A.data);if(this._getType(A)!==J6.string){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_type,expected:J6.string,received:D.parsedType}),m2}let B=new QJ,J=void 0;for(let D of this._def.checks)if(D.kind==="min"){if(A.data.length<D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),B.dirty()}else if(D.kind==="max"){if(A.data.length>D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),B.dirty()}else if(D.kind==="length"){let z=A.data.length>D.value,G=A.data.length<D.value;if(z||G){if(J=this._getOrReturnCtx(A,J),z)L6(J,{code:hA.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message});else if(G)L6(J,{code:hA.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message});B.dirty()}}else if(D.kind==="email"){if(!NLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"email",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="emoji"){if(!Wq1)Wq1=new RegExp(VLA,"u");if(!Wq1.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"emoji",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="uuid"){if(!MLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"uuid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="nanoid"){if(!WLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"nanoid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="cuid"){if(!HLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"cuid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="cuid2"){if(!FLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"cuid2",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="ulid"){if(!ELA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"ulid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="url")try{new URL(A.data)}catch{J=this._getOrReturnCtx(A,J),L6(J,{validation:"url",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="regex"){if(D.regex.lastIndex=0,!D.regex.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"regex",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="trim")A.data=A.data.trim();else if(D.kind==="includes"){if(!A.data.includes(D.value,D.position))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:{includes:D.value,position:D.position},message:D.message}),B.dirty()}else if(D.kind==="toLowerCase")A.data=A.data.toLowerCase();else if(D.kind==="toUpperCase")A.data=A.data.toUpperCase();else if(D.kind==="startsWith"){if(!A.data.startsWith(D.value))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:{startsWith:D.value},message:D.message}),B.dirty()}else if(D.kind==="endsWith"){if(!A.data.endsWith(D.value))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:{endsWith:D.value},message:D.message}),B.dirty()}else if(D.kind==="datetime"){if(!rs1(D).test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:"datetime",message:D.message}),B.dirty()}else if(D.kind==="date"){if(!$LA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:"date",message:D.message}),B.dirty()}else if(D.kind==="time"){if(!_LA(D).test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:"time",message:D.message}),B.dirty()}else if(D.kind==="duration"){if(!ILA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"duration",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="ip"){if(!PLA(A.data,D.version))J=this._getOrReturnCtx(A,J),L6(J,{validation:"ip",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="jwt"){if(!SLA(A.data,D.alg))J=this._getOrReturnCtx(A,J),L6(J,{validation:"jwt",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="cidr"){if(!vLA(A.data,D.version))J=this._getOrReturnCtx(A,J),L6(J,{validation:"cidr",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="base64"){if(!jLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"base64",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="base64url"){if(!TLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"base64url",code:hA.invalid_string,message:D.message}),B.dirty()}else G9.assertNever(D);return{status:B.value,value:A.data}}_regex(A,Q,B){return this.refinement((J)=>A.test(J),{validation:Q,code:hA.invalid_string,...B2.errToObj(B)})}_addCheck(A){return new cY({...this._def,checks:[...this._def.checks,A]})}email(A){return this._addCheck({kind:"email",...B2.errToObj(A)})}url(A){return this._addCheck({kind:"url",...B2.errToObj(A)})}emoji(A){return this._addCheck({kind:"emoji",...B2.errToObj(A)})}uuid(A){return this._addCheck({kind:"uuid",...B2.errToObj(A)})}nanoid(A){return this._addCheck({kind:"nanoid",...B2.errToObj(A)})}cuid(A){return this._addCheck({kind:"cuid",...B2.errToObj(A)})}cuid2(A){return this._addCheck({kind:"cuid2",...B2.errToObj(A)})}ulid(A){return this._addCheck({kind:"ulid",...B2.errToObj(A)})}base64(A){return this._addCheck({kind:"base64",...B2.errToObj(A)})}base64url(A){return this._addCheck({kind:"base64url",...B2.errToObj(A)})}jwt(A){return this._addCheck({kind:"jwt",...B2.errToObj(A)})}ip(A){return this._addCheck({kind:"ip",...B2.errToObj(A)})}cidr(A){return this._addCheck({kind:"cidr",...B2.errToObj(A)})}datetime(A){if(typeof A==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:A});return this._addCheck({kind:"datetime",precision:typeof A?.precision==="undefined"?null:A?.precision,offset:A?.offset??!1,local:A?.local??!1,...B2.errToObj(A?.message)})}date(A){return this._addCheck({kind:"date",message:A})}time(A){if(typeof A==="string")return this._addCheck({kind:"time",precision:null,message:A});return this._addCheck({kind:"time",precision:typeof A?.precision==="undefined"?null:A?.precision,...B2.errToObj(A?.message)})}duration(A){return this._addCheck({kind:"duration",...B2.errToObj(A)})}regex(A,Q){return this._addCheck({kind:"regex",regex:A,...B2.errToObj(Q)})}includes(A,Q){return this._addCheck({kind:"includes",value:A,position:Q?.position,...B2.errToObj(Q?.message)})}startsWith(A,Q){return this._addCheck({kind:"startsWith",value:A,...B2.errToObj(Q)})}endsWith(A,Q){return this._addCheck({kind:"endsWith",value:A,...B2.errToObj(Q)})}min(A,Q){return this._addCheck({kind:"min",value:A,...B2.errToObj(Q)})}max(A,Q){return this._addCheck({kind:"max",value:A,...B2.errToObj(Q)})}length(A,Q){return this._addCheck({kind:"length",value:A,...B2.errToObj(Q)})}nonempty(A){return this.min(1,B2.errToObj(A))}trim(){return new cY({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cY({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cY({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((A)=>A.kind==="datetime")}get isDate(){return!!this._def.checks.find((A)=>A.kind==="date")}get isTime(){return!!this._def.checks.find((A)=>A.kind==="time")}get isDuration(){return!!this._def.checks.find((A)=>A.kind==="duration")}get isEmail(){return!!this._def.checks.find((A)=>A.kind==="email")}get isURL(){return!!this._def.checks.find((A)=>A.kind==="url")}get isEmoji(){return!!this._def.checks.find((A)=>A.kind==="emoji")}get isUUID(){return!!this._def.checks.find((A)=>A.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((A)=>A.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((A)=>A.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((A)=>A.kind==="cuid2")}get isULID(){return!!this._def.checks.find((A)=>A.kind==="ulid")}get isIP(){return!!this._def.checks.find((A)=>A.kind==="ip")}get isCIDR(){return!!this._def.checks.find((A)=>A.kind==="cidr")}get isBase64(){return!!this._def.checks.find((A)=>A.kind==="base64")}get isBase64url(){return!!this._def.checks.find((A)=>A.kind==="base64url")}get minLength(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A}get maxLength(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A}};cY.create=(A)=>{return new cY({checks:[],typeName:l2.ZodString,coerce:A?.coerce??!1,...j8(A)})};dW=class dW extends c8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(A){if(this._def.coerce)A.data=Number(A.data);if(this._getType(A)!==J6.number){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_type,expected:J6.number,received:D.parsedType}),m2}let B=void 0,J=new QJ;for(let D of this._def.checks)if(D.kind==="int"){if(!G9.isInteger(A.data))B=this._getOrReturnCtx(A,B),L6(B,{code:hA.invalid_type,expected:"integer",received:"float",message:D.message}),J.dirty()}else if(D.kind==="min"){if(D.inclusive?A.data<D.value:A.data<=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_small,minimum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),J.dirty()}else if(D.kind==="max"){if(D.inclusive?A.data>D.value:A.data>=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_big,maximum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),J.dirty()}else if(D.kind==="multipleOf"){if(kLA(A.data,D.value)!==0)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.not_multiple_of,multipleOf:D.value,message:D.message}),J.dirty()}else if(D.kind==="finite"){if(!Number.isFinite(A.data))B=this._getOrReturnCtx(A,B),L6(B,{code:hA.not_finite,message:D.message}),J.dirty()}else G9.assertNever(D);return{status:J.value,value:A.data}}gte(A,Q){return this.setLimit("min",A,!0,B2.toString(Q))}gt(A,Q){return this.setLimit("min",A,!1,B2.toString(Q))}lte(A,Q){return this.setLimit("max",A,!0,B2.toString(Q))}lt(A,Q){return this.setLimit("max",A,!1,B2.toString(Q))}setLimit(A,Q,B,J){return new dW({...this._def,checks:[...this._def.checks,{kind:A,value:Q,inclusive:B,message:B2.toString(J)}]})}_addCheck(A){return new dW({...this._def,checks:[...this._def.checks,A]})}int(A){return this._addCheck({kind:"int",message:B2.toString(A)})}positive(A){return this._addCheck({kind:"min",value:0,inclusive:!1,message:B2.toString(A)})}negative(A){return this._addCheck({kind:"max",value:0,inclusive:!1,message:B2.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:0,inclusive:!0,message:B2.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:0,inclusive:!0,message:B2.toString(A)})}multipleOf(A,Q){return this._addCheck({kind:"multipleOf",value:A,message:B2.toString(Q)})}finite(A){return this._addCheck({kind:"finite",message:B2.toString(A)})}safe(A){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:B2.toString(A)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:B2.toString(A)})}get minValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A}get maxValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A}get isInt(){return!!this._def.checks.find((A)=>A.kind==="int"||A.kind==="multipleOf"&&G9.isInteger(A.value))}get isFinite(){let A=null,Q=null;for(let B of this._def.checks)if(B.kind==="finite"||B.kind==="int"||B.kind==="multipleOf")return!0;else if(B.kind==="min"){if(Q===null||B.value>Q)Q=B.value}else if(B.kind==="max"){if(A===null||B.value<A)A=B.value}return Number.isFinite(Q)&&Number.isFinite(A)}};dW.create=(A)=>{return new dW({checks:[],typeName:l2.ZodNumber,coerce:A?.coerce||!1,...j8(A)})};iW=class iW extends c8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(A){if(this._def.coerce)try{A.data=BigInt(A.data)}catch{return this._getInvalidInput(A)}if(this._getType(A)!==J6.bigint)return this._getInvalidInput(A);let B=void 0,J=new QJ;for(let D of this._def.checks)if(D.kind==="min"){if(D.inclusive?A.data<D.value:A.data<=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_small,type:"bigint",minimum:D.value,inclusive:D.inclusive,message:D.message}),J.dirty()}else if(D.kind==="max"){if(D.inclusive?A.data>D.value:A.data>=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_big,type:"bigint",maximum:D.value,inclusive:D.inclusive,message:D.message}),J.dirty()}else if(D.kind==="multipleOf"){if(A.data%D.value!==BigInt(0))B=this._getOrReturnCtx(A,B),L6(B,{code:hA.not_multiple_of,multipleOf:D.value,message:D.message}),J.dirty()}else G9.assertNever(D);return{status:J.value,value:A.data}}_getInvalidInput(A){let Q=this._getOrReturnCtx(A);return L6(Q,{code:hA.invalid_type,expected:J6.bigint,received:Q.parsedType}),m2}gte(A,Q){return this.setLimit("min",A,!0,B2.toString(Q))}gt(A,Q){return this.setLimit("min",A,!1,B2.toString(Q))}lte(A,Q){return this.setLimit("max",A,!0,B2.toString(Q))}lt(A,Q){return this.setLimit("max",A,!1,B2.toString(Q))}setLimit(A,Q,B,J){return new iW({...this._def,checks:[...this._def.checks,{kind:A,value:Q,inclusive:B,message:B2.toString(J)}]})}_addCheck(A){return new iW({...this._def,checks:[...this._def.checks,A]})}positive(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:B2.toString(A)})}negative(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:B2.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:B2.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:B2.toString(A)})}multipleOf(A,Q){return this._addCheck({kind:"multipleOf",value:A,message:B2.toString(Q)})}get minValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A}get maxValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A}};iW.create=(A)=>{return new iW({checks:[],typeName:l2.ZodBigInt,coerce:A?.coerce??!1,...j8(A)})};NT=class NT extends c8{_parse(A){if(this._def.coerce)A.data=Boolean(A.data);if(this._getType(A)!==J6.boolean){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.boolean,received:B.parsedType}),m2}return uJ(A.data)}};NT.create=(A)=>{return new NT({typeName:l2.ZodBoolean,coerce:A?.coerce||!1,...j8(A)})};I3=class I3 extends c8{_parse(A){if(this._def.coerce)A.data=new Date(A.data);if(this._getType(A)!==J6.date){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_type,expected:J6.date,received:D.parsedType}),m2}if(Number.isNaN(A.data.getTime())){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_date}),m2}let B=new QJ,J=void 0;for(let D of this._def.checks)if(D.kind==="min"){if(A.data.getTime()<D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_small,message:D.message,inclusive:!0,exact:!1,minimum:D.value,type:"date"}),B.dirty()}else if(D.kind==="max"){if(A.data.getTime()>D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_big,message:D.message,inclusive:!0,exact:!1,maximum:D.value,type:"date"}),B.dirty()}else G9.assertNever(D);return{status:B.value,value:new Date(A.data.getTime())}}_addCheck(A){return new I3({...this._def,checks:[...this._def.checks,A]})}min(A,Q){return this._addCheck({kind:"min",value:A.getTime(),message:B2.toString(Q)})}max(A,Q){return this._addCheck({kind:"max",value:A.getTime(),message:B2.toString(Q)})}get minDate(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A!=null?new Date(A):null}get maxDate(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A!=null?new Date(A):null}};I3.create=(A)=>{return new I3({checks:[],coerce:A?.coerce||!1,typeName:l2.ZodDate,...j8(A)})};yb=class yb extends c8{_parse(A){if(this._getType(A)!==J6.symbol){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.symbol,received:B.parsedType}),m2}return uJ(A.data)}};yb.create=(A)=>{return new yb({typeName:l2.ZodSymbol,...j8(A)})};VT=class VT extends c8{_parse(A){if(this._getType(A)!==J6.undefined){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.undefined,received:B.parsedType}),m2}return uJ(A.data)}};VT.create=(A)=>{return new VT({typeName:l2.ZodUndefined,...j8(A)})};OT=class OT extends c8{_parse(A){if(this._getType(A)!==J6.null){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.null,received:B.parsedType}),m2}return uJ(A.data)}};OT.create=(A)=>{return new OT({typeName:l2.ZodNull,...j8(A)})};N3=class N3 extends c8{constructor(){super(...arguments);this._any=!0}_parse(A){return uJ(A.data)}};N3.create=(A)=>{return new N3({typeName:l2.ZodAny,...j8(A)})};lW=class lW extends c8{constructor(){super(...arguments);this._unknown=!0}_parse(A){return uJ(A.data)}};lW.create=(A)=>{return new lW({typeName:l2.ZodUnknown,...j8(A)})};BU=class BU extends c8{_parse(A){let Q=this._getOrReturnCtx(A);return L6(Q,{code:hA.invalid_type,expected:J6.never,received:Q.parsedType}),m2}};BU.create=(A)=>{return new BU({typeName:l2.ZodNever,...j8(A)})};bb=class bb extends c8{_parse(A){if(this._getType(A)!==J6.undefined){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.void,received:B.parsedType}),m2}return uJ(A.data)}};bb.create=(A)=>{return new bb({typeName:l2.ZodVoid,...j8(A)})};lY=class lY extends c8{_parse(A){let{ctx:Q,status:B}=this._processInputParams(A),J=this._def;if(Q.parsedType!==J6.array)return L6(Q,{code:hA.invalid_type,expected:J6.array,received:Q.parsedType}),m2;if(J.exactLength!==null){let z=Q.data.length>J.exactLength.value,G=Q.data.length<J.exactLength.value;if(z||G)L6(Q,{code:z?hA.too_big:hA.too_small,minimum:G?J.exactLength.value:void 0,maximum:z?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),B.dirty()}if(J.minLength!==null){if(Q.data.length<J.minLength.value)L6(Q,{code:hA.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),B.dirty()}if(J.maxLength!==null){if(Q.data.length>J.maxLength.value)L6(Q,{code:hA.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),B.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((z,G)=>{return J.type._parseAsync(new iY(Q,z,Q.path,G))})).then((z)=>{return QJ.mergeArray(B,z)});let D=[...Q.data].map((z,G)=>{return J.type._parseSync(new iY(Q,z,Q.path,G))});return QJ.mergeArray(B,D)}get element(){return this._def.type}min(A,Q){return new lY({...this._def,minLength:{value:A,message:B2.toString(Q)}})}max(A,Q){return new lY({...this._def,maxLength:{value:A,message:B2.toString(Q)}})}length(A,Q){return new lY({...this._def,exactLength:{value:A,message:B2.toString(Q)}})}nonempty(A){return this.min(1,A)}};lY.create=(A,Q)=>{return new lY({type:A,minLength:null,maxLength:null,exactLength:null,typeName:l2.ZodArray,...j8(Q)})};X7=class X7 extends c8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let A=this._def.shape(),Q=G9.objectKeys(A);return this._cached={shape:A,keys:Q},this._cached}_parse(A){if(this._getType(A)!==J6.object){let K=this._getOrReturnCtx(A);return L6(K,{code:hA.invalid_type,expected:J6.object,received:K.parsedType}),m2}let{status:B,ctx:J}=this._processInputParams(A),{shape:D,keys:z}=this._getCached(),G=[];if(!(this._def.catchall instanceof BU&&this._def.unknownKeys==="strip")){for(let K in J.data)if(!z.includes(K))G.push(K)}let X=[];for(let K of z){let Y=D[K],q=J.data[K];X.push({key:{status:"valid",value:K},value:Y._parse(new iY(J,q,J.path,K)),alwaysSet:K in J.data})}if(this._def.catchall instanceof BU){let K=this._def.unknownKeys;if(K==="passthrough")for(let Y of G)X.push({key:{status:"valid",value:Y},value:{status:"valid",value:J.data[Y]}});else if(K==="strict"){if(G.length>0)L6(J,{code:hA.unrecognized_keys,keys:G}),B.dirty()}else if(K==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let Y of G){let q=J.data[Y];X.push({key:{status:"valid",value:Y},value:K._parse(new iY(J,q,J.path,Y)),alwaysSet:Y in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let K=[];for(let Y of X){let q=await Y.key,Z=await Y.value;K.push({key:q,value:Z,alwaysSet:Y.alwaysSet})}return K}).then((K)=>{return QJ.mergeObjectSync(B,K)});else return QJ.mergeObjectSync(B,X)}get shape(){return this._def.shape()}strict(A){return B2.errToObj,new X7({...this._def,unknownKeys:"strict",...A!==void 0?{errorMap:(Q,B)=>{let J=this._def.errorMap?.(Q,B).message??B.defaultError;if(Q.code==="unrecognized_keys")return{message:B2.errToObj(A).message??J};return{message:J}}}:{}})}strip(){return new X7({...this._def,unknownKeys:"strip"})}passthrough(){return new X7({...this._def,unknownKeys:"passthrough"})}extend(A){return new X7({...this._def,shape:()=>({...this._def.shape(),...A})})}merge(A){return new X7({unknownKeys:A._def.unknownKeys,catchall:A._def.catchall,shape:()=>({...this._def.shape(),...A._def.shape()}),typeName:l2.ZodObject})}setKey(A,Q){return this.augment({[A]:Q})}catchall(A){return new X7({...this._def,catchall:A})}pick(A){let Q={};for(let B of G9.objectKeys(A))if(A[B]&&this.shape[B])Q[B]=this.shape[B];return new X7({...this._def,shape:()=>Q})}omit(A){let Q={};for(let B of G9.objectKeys(this.shape))if(!A[B])Q[B]=this.shape[B];return new X7({...this._def,shape:()=>Q})}deepPartial(){return wT(this)}partial(A){let Q={};for(let B of G9.objectKeys(this.shape)){let J=this.shape[B];if(A&&!A[B])Q[B]=J;else Q[B]=J.optional()}return new X7({...this._def,shape:()=>Q})}required(A){let Q={};for(let B of G9.objectKeys(this.shape))if(A&&!A[B])Q[B]=this.shape[B];else{let D=this.shape[B];while(D instanceof dY)D=D._def.innerType;Q[B]=D}return new X7({...this._def,shape:()=>Q})}keyof(){return ns1(G9.objectKeys(this.shape))}};X7.create=(A,Q)=>{return new X7({shape:()=>A,unknownKeys:"strip",catchall:BU.create(),typeName:l2.ZodObject,...j8(Q)})};X7.strictCreate=(A,Q)=>{return new X7({shape:()=>A,unknownKeys:"strict",catchall:BU.create(),typeName:l2.ZodObject,...j8(Q)})};X7.lazycreate=(A,Q)=>{return new X7({shape:A,unknownKeys:"strip",catchall:BU.create(),typeName:l2.ZodObject,...j8(Q)})};CT=class CT extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B=this._def.options;function J(D){for(let G of D)if(G.result.status==="valid")return G.result;for(let G of D)if(G.result.status==="dirty")return Q.common.issues.push(...G.ctx.common.issues),G.result;let z=D.map((G)=>new yz(G.ctx.common.issues));return L6(Q,{code:hA.invalid_union,unionErrors:z}),m2}if(Q.common.async)return Promise.all(B.map(async(D)=>{let z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await D._parseAsync({data:Q.data,path:Q.path,parent:z}),ctx:z}})).then(J);else{let D=void 0,z=[];for(let X of B){let K={...Q,common:{...Q.common,issues:[]},parent:null},Y=X._parseSync({data:Q.data,path:Q.path,parent:K});if(Y.status==="valid")return Y;else if(Y.status==="dirty"&&!D)D={result:Y,ctx:K};if(K.common.issues.length)z.push(K.common.issues)}if(D)return Q.common.issues.push(...D.ctx.common.issues),D.result;let G=z.map((X)=>new yz(X));return L6(Q,{code:hA.invalid_union,unionErrors:G}),m2}}get options(){return this._def.options}};CT.create=(A,Q)=>{return new CT({options:A,typeName:l2.ZodUnion,...j8(Q)})};$s=class $s extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A);if(Q.parsedType!==J6.object)return L6(Q,{code:hA.invalid_type,expected:J6.object,received:Q.parsedType}),m2;let B=this.discriminator,J=Q.data[B],D=this.optionsMap.get(J);if(!D)return L6(Q,{code:hA.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[B]}),m2;if(Q.common.async)return D._parseAsync({data:Q.data,path:Q.path,parent:Q});else return D._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(A,Q,B){let J=new Map;for(let D of Q){let z=_F(D.shape[A]);if(!z.length)throw new Error(`A discriminator value for key \`${A}\` could not be extracted from all schema options`);for(let G of z){if(J.has(G))throw new Error(`Discriminator property ${String(A)} has duplicate value ${String(G)}`);J.set(G,D)}}return new $s({typeName:l2.ZodDiscriminatedUnion,discriminator:A,options:Q,optionsMap:J,...j8(B)})}};LT=class LT extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A),J=(D,z)=>{if(js(D)||js(z))return m2;let G=wq1(D.value,z.value);if(!G.valid)return L6(B,{code:hA.invalid_intersection_types}),m2;if(Ts(D)||Ts(z))Q.dirty();return{status:Q.value,value:G.data}};if(B.common.async)return Promise.all([this._def.left._parseAsync({data:B.data,path:B.path,parent:B}),this._def.right._parseAsync({data:B.data,path:B.path,parent:B})]).then(([D,z])=>J(D,z));else return J(this._def.left._parseSync({data:B.data,path:B.path,parent:B}),this._def.right._parseSync({data:B.data,path:B.path,parent:B}))}};LT.create=(A,Q,B)=>{return new LT({left:A,right:Q,typeName:l2.ZodIntersection,...j8(B)})};JU=class JU extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.array)return L6(B,{code:hA.invalid_type,expected:J6.array,received:B.parsedType}),m2;if(B.data.length<this._def.items.length)return L6(B,{code:hA.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m2;if(!this._def.rest&&B.data.length>this._def.items.length)L6(B,{code:hA.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let D=[...B.data].map((z,G)=>{let X=this._def.items[G]||this._def.rest;if(!X)return null;return X._parse(new iY(B,z,B.path,G))}).filter((z)=>!!z);if(B.common.async)return Promise.all(D).then((z)=>{return QJ.mergeArray(Q,z)});else return QJ.mergeArray(Q,D)}get items(){return this._def.items}rest(A){return new JU({...this._def,rest:A})}};JU.create=(A,Q)=>{if(!Array.isArray(A))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new JU({items:A,typeName:l2.ZodTuple,rest:null,...j8(Q)})};gb=class gb extends c8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.object)return L6(B,{code:hA.invalid_type,expected:J6.object,received:B.parsedType}),m2;let J=[],D=this._def.keyType,z=this._def.valueType;for(let G in B.data)J.push({key:D._parse(new iY(B,G,B.path,G)),value:z._parse(new iY(B,B.data[G],B.path,G)),alwaysSet:G in B.data});if(B.common.async)return QJ.mergeObjectAsync(Q,J);else return QJ.mergeObjectSync(Q,J)}get element(){return this._def.valueType}static create(A,Q,B){if(Q instanceof c8)return new gb({keyType:A,valueType:Q,typeName:l2.ZodRecord,...j8(B)});return new gb({keyType:cY.create(),valueType:A,typeName:l2.ZodRecord,...j8(Q)})}};xb=class xb extends c8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.map)return L6(B,{code:hA.invalid_type,expected:J6.map,received:B.parsedType}),m2;let J=this._def.keyType,D=this._def.valueType,z=[...B.data.entries()].map(([G,X],K)=>{return{key:J._parse(new iY(B,G,B.path,[K,"key"])),value:D._parse(new iY(B,X,B.path,[K,"value"]))}});if(B.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let X of z){let K=await X.key,Y=await X.value;if(K.status==="aborted"||Y.status==="aborted")return m2;if(K.status==="dirty"||Y.status==="dirty")Q.dirty();G.set(K.value,Y.value)}return{status:Q.value,value:G}})}else{let G=new Map;for(let X of z){let{key:K,value:Y}=X;if(K.status==="aborted"||Y.status==="aborted")return m2;if(K.status==="dirty"||Y.status==="dirty")Q.dirty();G.set(K.value,Y.value)}return{status:Q.value,value:G}}}};xb.create=(A,Q,B)=>{return new xb({valueType:Q,keyType:A,typeName:l2.ZodMap,...j8(B)})};V3=class V3 extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.set)return L6(B,{code:hA.invalid_type,expected:J6.set,received:B.parsedType}),m2;let J=this._def;if(J.minSize!==null){if(B.data.size<J.minSize.value)L6(B,{code:hA.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),Q.dirty()}if(J.maxSize!==null){if(B.data.size>J.maxSize.value)L6(B,{code:hA.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),Q.dirty()}let D=this._def.valueType;function z(X){let K=new Set;for(let Y of X){if(Y.status==="aborted")return m2;if(Y.status==="dirty")Q.dirty();K.add(Y.value)}return{status:Q.value,value:K}}let G=[...B.data.values()].map((X,K)=>D._parse(new iY(B,X,B.path,K)));if(B.common.async)return Promise.all(G).then((X)=>z(X));else return z(G)}min(A,Q){return new V3({...this._def,minSize:{value:A,message:B2.toString(Q)}})}max(A,Q){return new V3({...this._def,maxSize:{value:A,message:B2.toString(Q)}})}size(A,Q){return this.min(A,Q).max(A,Q)}nonempty(A){return this.min(1,A)}};V3.create=(A,Q)=>{return new V3({valueType:A,minSize:null,maxSize:null,typeName:l2.ZodSet,...j8(Q)})};IT=class IT extends c8{constructor(){super(...arguments);this.validate=this.implement}_parse(A){let{ctx:Q}=this._processInputParams(A);if(Q.parsedType!==J6.function)return L6(Q,{code:hA.invalid_type,expected:J6.function,received:Q.parsedType}),m2;function B(G,X){return fb({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,MT(),$F].filter((K)=>!!K),issueData:{code:hA.invalid_arguments,argumentsError:X}})}function J(G,X){return fb({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,MT(),$F].filter((K)=>!!K),issueData:{code:hA.invalid_return_type,returnTypeError:X}})}let D={errorMap:Q.common.contextualErrorMap},z=Q.data;if(this._def.returns instanceof O3){let G=this;return uJ(async function(...X){let K=new yz([]),Y=await G._def.args.parseAsync(X,D).catch((H)=>{throw K.addIssue(B(X,H)),K}),q=await Reflect.apply(z,this,Y);return await G._def.returns._def.type.parseAsync(q,D).catch((H)=>{throw K.addIssue(J(q,H)),K})})}else{let G=this;return uJ(function(...X){let K=G._def.args.safeParse(X,D);if(!K.success)throw new yz([B(X,K.error)]);let Y=Reflect.apply(z,this,K.data),q=G._def.returns.safeParse(Y,D);if(!q.success)throw new yz([J(Y,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...A){return new IT({...this._def,args:JU.create(A).rest(lW.create())})}returns(A){return new IT({...this._def,returns:A})}implement(A){return this.parse(A)}strictImplement(A){return this.parse(A)}static create(A,Q,B){return new IT({args:A?A:JU.create([]).rest(lW.create()),returns:Q||lW.create(),typeName:l2.ZodFunction,...j8(B)})}};RT=class RT extends c8{get schema(){return this._def.getter()}_parse(A){let{ctx:Q}=this._processInputParams(A);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};RT.create=(A,Q)=>{return new RT({getter:A,typeName:l2.ZodLazy,...j8(Q)})};jT=class jT extends c8{_parse(A){if(A.data!==this._def.value){let Q=this._getOrReturnCtx(A);return L6(Q,{received:Q.data,code:hA.invalid_literal,expected:this._def.value}),m2}return{status:"valid",value:A.data}}get value(){return this._def.value}};jT.create=(A,Q)=>{return new jT({value:A,typeName:l2.ZodLiteral,...j8(Q)})};aW=class aW extends c8{_parse(A){if(typeof A.data!=="string"){let Q=this._getOrReturnCtx(A),B=this._def.values;return L6(Q,{expected:G9.joinValues(B),received:Q.parsedType,code:hA.invalid_type}),m2}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(A.data)){let Q=this._getOrReturnCtx(A),B=this._def.values;return L6(Q,{received:Q.data,code:hA.invalid_enum_value,options:B}),m2}return uJ(A.data)}get options(){return this._def.values}get enum(){let A={};for(let Q of this._def.values)A[Q]=Q;return A}get Values(){let A={};for(let Q of this._def.values)A[Q]=Q;return A}get Enum(){let A={};for(let Q of this._def.values)A[Q]=Q;return A}extract(A,Q=this._def){return aW.create(A,{...this._def,...Q})}exclude(A,Q=this._def){return aW.create(this.options.filter((B)=>!A.includes(B)),{...this._def,...Q})}};aW.create=ns1;TT=class TT extends c8{_parse(A){let Q=G9.getValidEnumValues(this._def.values),B=this._getOrReturnCtx(A);if(B.parsedType!==J6.string&&B.parsedType!==J6.number){let J=G9.objectValues(Q);return L6(B,{expected:G9.joinValues(J),received:B.parsedType,code:hA.invalid_type}),m2}if(!this._cache)this._cache=new Set(G9.getValidEnumValues(this._def.values));if(!this._cache.has(A.data)){let J=G9.objectValues(Q);return L6(B,{received:B.data,code:hA.invalid_enum_value,options:J}),m2}return uJ(A.data)}get enum(){return this._def.values}};TT.create=(A,Q)=>{return new TT({values:A,typeName:l2.ZodNativeEnum,...j8(Q)})};O3=class O3 extends c8{unwrap(){return this._def.type}_parse(A){let{ctx:Q}=this._processInputParams(A);if(Q.parsedType!==J6.promise&&Q.common.async===!1)return L6(Q,{code:hA.invalid_type,expected:J6.promise,received:Q.parsedType}),m2;let B=Q.parsedType===J6.promise?Q.data:Promise.resolve(Q.data);return uJ(B.then((J)=>{return this._def.type.parseAsync(J,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};O3.create=(A,Q)=>{return new O3({type:A,typeName:l2.ZodPromise,...j8(Q)})};aY=class aY extends c8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===l2.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(A){let{status:Q,ctx:B}=this._processInputParams(A),J=this._def.effect||null,D={addIssue:(z)=>{if(L6(B,z),z.fatal)Q.abort();else Q.dirty()},get path(){return B.path}};if(D.addIssue=D.addIssue.bind(D),J.type==="preprocess"){let z=J.transform(B.data,D);if(B.common.async)return Promise.resolve(z).then(async(G)=>{if(Q.value==="aborted")return m2;let X=await this._def.schema._parseAsync({data:G,path:B.path,parent:B});if(X.status==="aborted")return m2;if(X.status==="dirty")return w3(X.value);if(Q.value==="dirty")return w3(X.value);return X});else{if(Q.value==="aborted")return m2;let G=this._def.schema._parseSync({data:z,path:B.path,parent:B});if(G.status==="aborted")return m2;if(G.status==="dirty")return w3(G.value);if(Q.value==="dirty")return w3(G.value);return G}}if(J.type==="refinement"){let z=(G)=>{let X=J.refinement(G,D);if(B.common.async)return Promise.resolve(X);if(X instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(B.common.async===!1){let G=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(G.status==="aborted")return m2;if(G.status==="dirty")Q.dirty();return z(G.value),{status:Q.value,value:G.value}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((G)=>{if(G.status==="aborted")return m2;if(G.status==="dirty")Q.dirty();return z(G.value).then(()=>{return{status:Q.value,value:G.value}})})}if(J.type==="transform")if(B.common.async===!1){let z=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(!cW(z))return m2;let G=J.transform(z.value,D);if(G instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:G}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((z)=>{if(!cW(z))return m2;return Promise.resolve(J.transform(z.value,D)).then((G)=>({status:Q.value,value:G}))});G9.assertNever(J)}};aY.create=(A,Q,B)=>{return new aY({schema:A,typeName:l2.ZodEffects,effect:Q,...j8(B)})};aY.createWithPreprocess=(A,Q,B)=>{return new aY({schema:Q,effect:{type:"preprocess",transform:A},typeName:l2.ZodEffects,...j8(B)})};dY=class dY extends c8{_parse(A){if(this._getType(A)===J6.undefined)return uJ(void 0);return this._def.innerType._parse(A)}unwrap(){return this._def.innerType}};dY.create=(A,Q)=>{return new dY({innerType:A,typeName:l2.ZodOptional,...j8(Q)})};PF=class PF extends c8{_parse(A){if(this._getType(A)===J6.null)return uJ(null);return this._def.innerType._parse(A)}unwrap(){return this._def.innerType}};PF.create=(A,Q)=>{return new PF({innerType:A,typeName:l2.ZodNullable,...j8(Q)})};$T=class $T extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B=Q.data;if(Q.parsedType===J6.undefined)B=this._def.defaultValue();return this._def.innerType._parse({data:B,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};$T.create=(A,Q)=>{return new $T({innerType:A,typeName:l2.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...j8(Q)})};_T=class _T extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B={...Q,common:{...Q.common,issues:[]}},J=this._def.innerType._parse({data:B.data,path:B.path,parent:{...B}});if(WT(J))return J.then((D)=>{return{status:"valid",value:D.status==="valid"?D.value:this._def.catchValue({get error(){return new yz(B.common.issues)},input:B.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new yz(B.common.issues)},input:B.data})}}removeCatch(){return this._def.innerType}};_T.create=(A,Q)=>{return new _T({innerType:A,typeName:l2.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...j8(Q)})};hb=class hb extends c8{_parse(A){if(this._getType(A)!==J6.nan){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.nan,received:B.parsedType}),m2}return{status:"valid",value:A.data}}};hb.create=(A)=>{return new hb({typeName:l2.ZodNaN,...j8(A)})};fLA=Symbol("zod_brand");_s=class _s extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B=Q.data;return this._def.type._parse({data:B,path:Q.path,parent:Q})}unwrap(){return this._def.type}};mb=class mb extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.common.async)return(async()=>{let D=await this._def.in._parseAsync({data:B.data,path:B.path,parent:B});if(D.status==="aborted")return m2;if(D.status==="dirty")return Q.dirty(),w3(D.value);else return this._def.out._parseAsync({data:D.value,path:B.path,parent:B})})();else{let J=this._def.in._parseSync({data:B.data,path:B.path,parent:B});if(J.status==="aborted")return m2;if(J.status==="dirty")return Q.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:B.path,parent:B})}}static create(A,Q){return new mb({in:A,out:Q,typeName:l2.ZodPipeline})}};PT=class PT extends c8{_parse(A){let Q=this._def.innerType._parse(A),B=(J)=>{if(cW(J))J.value=Object.freeze(J.value);return J};return WT(Q)?Q.then((J)=>B(J)):B(Q)}unwrap(){return this._def.innerType}};PT.create=(A,Q)=>{return new PT({innerType:A,typeName:l2.ZodReadonly,...j8(Q)})};yLA={object:X7.lazycreate};(function(A){A.ZodString="ZodString",A.ZodNumber="ZodNumber",A.ZodNaN="ZodNaN",A.ZodBigInt="ZodBigInt",A.ZodBoolean="ZodBoolean",A.ZodDate="ZodDate",A.ZodSymbol="ZodSymbol",A.ZodUndefined="ZodUndefined",A.ZodNull="ZodNull",A.ZodAny="ZodAny",A.ZodUnknown="ZodUnknown",A.ZodNever="ZodNever",A.ZodVoid="ZodVoid",A.ZodArray="ZodArray",A.ZodObject="ZodObject",A.ZodUnion="ZodUnion",A.ZodDiscriminatedUnion="ZodDiscriminatedUnion",A.ZodIntersection="ZodIntersection",A.ZodTuple="ZodTuple",A.ZodRecord="ZodRecord",A.ZodMap="ZodMap",A.ZodSet="ZodSet",A.ZodFunction="ZodFunction",A.ZodLazy="ZodLazy",A.ZodLiteral="ZodLiteral",A.ZodEnum="ZodEnum",A.ZodEffects="ZodEffects",A.ZodNativeEnum="ZodNativeEnum",A.ZodOptional="ZodOptional",A.ZodNullable="ZodNullable",A.ZodDefault="ZodDefault",A.ZodCatch="ZodCatch",A.ZodPromise="ZodPromise",A.ZodBranded="ZodBranded",A.ZodPipeline="ZodPipeline",A.ZodReadonly="ZodReadonly"})(l2||(l2={}));os1=cY.create,ts1=dW.create,gLA=hb.create,xLA=iW.create,es1=NT.create,hLA=I3.create,mLA=yb.create,uLA=VT.create,pLA=OT.create,cLA=N3.create,lLA=lW.create,dLA=BU.create,iLA=bb.create,aLA=lY.create,rLA=X7.create,nLA=X7.strictCreate,sLA=CT.create,oLA=$s.create,tLA=LT.create,eLA=JU.create,ARA=gb.create,QRA=xb.create,BRA=V3.create,JRA=IT.create,DRA=RT.create,zRA=jT.create,GRA=aW.create,XRA=TT.create,KRA=O3.create,YRA=aY.create,qRA=dY.create,ZRA=PF.create,URA=aY.createWithPreprocess,HRA=mb.create,WRA={string:(A)=>cY.create({...A,coerce:!0}),number:(A)=>dW.create({...A,coerce:!0}),boolean:(A)=>NT.create({...A,coerce:!0}),bigint:(A)=>iW.create({...A,coerce:!0}),date:(A)=>I3.create({...A,coerce:!0})},wRA=m2});var L1={};h6(L1,{void:()=>iLA,util:()=>G9,unknown:()=>lLA,union:()=>sLA,undefined:()=>uLA,tuple:()=>eLA,transformer:()=>YRA,symbol:()=>mLA,string:()=>os1,strictObject:()=>nLA,setErrorMap:()=>ZLA,set:()=>BRA,record:()=>ARA,quotelessJson:()=>YLA,promise:()=>KRA,preprocess:()=>URA,pipeline:()=>HRA,ostring:()=>FRA,optional:()=>qRA,onumber:()=>ERA,oboolean:()=>MRA,objectUtil:()=>Fq1,object:()=>rLA,number:()=>ts1,nullable:()=>ZRA,null:()=>pLA,never:()=>dLA,nativeEnum:()=>XRA,nan:()=>gLA,map:()=>QRA,makeIssue:()=>fb,literal:()=>zRA,lazy:()=>DRA,late:()=>yLA,isValid:()=>cW,isDirty:()=>Ts,isAsync:()=>WT,isAborted:()=>js,intersection:()=>tLA,instanceof:()=>bLA,getParsedType:()=>QU,getErrorMap:()=>MT,function:()=>JRA,enum:()=>GRA,effect:()=>YRA,discriminatedUnion:()=>oLA,defaultErrorMap:()=>$F,datetimeRegex:()=>rs1,date:()=>hLA,custom:()=>ss1,coerce:()=>WRA,boolean:()=>es1,bigint:()=>xLA,array:()=>aLA,any:()=>cLA,addIssueToContext:()=>L6,ZodVoid:()=>bb,ZodUnknown:()=>lW,ZodUnion:()=>CT,ZodUndefined:()=>VT,ZodType:()=>c8,ZodTuple:()=>JU,ZodTransformer:()=>aY,ZodSymbol:()=>yb,ZodString:()=>cY,ZodSet:()=>V3,ZodSchema:()=>c8,ZodRecord:()=>gb,ZodReadonly:()=>PT,ZodPromise:()=>O3,ZodPipeline:()=>mb,ZodParsedType:()=>J6,ZodOptional:()=>dY,ZodObject:()=>X7,ZodNumber:()=>dW,ZodNullable:()=>PF,ZodNull:()=>OT,ZodNever:()=>BU,ZodNativeEnum:()=>TT,ZodNaN:()=>hb,ZodMap:()=>xb,ZodLiteral:()=>jT,ZodLazy:()=>RT,ZodIssueCode:()=>hA,ZodIntersection:()=>LT,ZodFunction:()=>IT,ZodFirstPartyTypeKind:()=>l2,ZodError:()=>yz,ZodEnum:()=>aW,ZodEffects:()=>aY,ZodDiscriminatedUnion:()=>$s,ZodDefault:()=>$T,ZodDate:()=>I3,ZodCatch:()=>_T,ZodBranded:()=>_s,ZodBoolean:()=>NT,ZodBigInt:()=>iW,ZodArray:()=>lY,ZodAny:()=>N3,Schema:()=>c8,ParseStatus:()=>QJ,OK:()=>uJ,NEVER:()=>wRA,INVALID:()=>m2,EMPTY_PATH:()=>ULA,DIRTY:()=>w3,BRAND:()=>fLA});var Iq1=j1(()=>{Rs();Mq1();ps1();kb();Ao1();Ls()});var Ps=j1(()=>{Iq1();Iq1()});function Vq1(A){return Qo1.safeParse(A)}function ST(A){return IRA.safeParse(A)}function Ss(A){if(!A||!Array.isArray(A))return[];let Q=[];for(let[B,J]of A.entries()){let D=Vq1(J);if(D.success)Q.push(D.data);else{let z=typeof J==="object"&&J!==null&&"tool"in J?String(J.tool):`entry at index ${B}`;N1.warn(`Permission entry for tool "${z}" is invalid: ${D.error.errors.map((G)=>`${G.path.join(".")}: ${G.message}`).join(", ")}`)}}return Q}var Nq1,Qo1,IRA;var C3=j1(()=>{Ps();iA();Nq1=L1.lazy(()=>L1.union([L1.string().describe('Pattern match where "*" matches any number of any characters'),L1.array(Nq1).min(1).describe("OR match of each entry"),L1.boolean().describe("A literal boolean match"),L1.number().describe("A literal number match"),L1.null().describe("A literal null match"),L1.undefined().describe("A literal undefined match"),L1.record(L1.string(),Nq1).describe("Matching individual keys of an object")])),Qo1=L1.object({tool:L1.string().min(1).describe("The name of the tool to which this entry applies"),matches:L1.record(L1.string(),Nq1).optional().describe("Maps tool inputs to conditions"),action:L1.enum(["allow","reject","ask","delegate"]).describe("How Amp should proceed in case of a match"),context:L1.enum(["thread","subagent"]).optional().describe("Only apply this entry in this context"),to:L1.string().min(1).optional().describe('Command to delegate to when action is "delegate"')}).superRefine((A,Q)=>{if(A.action==="delegate"&&!A.to)Q.addIssue({code:L1.ZodIssueCode.custom,message:'delegate action requires "to" field',path:["to"]});if(A.action!=="delegate"&&A.to)Q.addIssue({code:L1.ZodIssueCode.custom,message:'"to" field only allowed with delegate action',path:["to"]})}),IRA=L1.array(Qo1).describe("Entries checked in sequence to configure tool permissions")});function bz(A,Q){let B=NRA(A,Q);return typeof B==="string"?B:B.toString()}function NRA(A,Q,B=!0){if(!Q)Q=VRA();let{workspaceFolders:J,isWindows:D,homeDir:z}=Q,G=typeof A==="string"?C6.parse(A):C6.from(A);if(J)for(let X of J){let K=J4(X);if($6.hasPrefix(G,K)){let Y=K.path.endsWith("/")?K.path.slice(0,-1):K.path,Z=B&&J&&J.length>=2?W3(K.path)+(D?"\\":"/"):"";return Oq1(Z+G.path.slice(Y.length+1),D,G.scheme)}}if(G?.scheme==="file"){if(z){let X=J4(z);if($6.hasPrefix(G,X)){let K=X.path.endsWith("/")?X.path.slice(0,-1):X.path,Y=G.path.slice(K.length+1);return Oq1("~"+(D?"\\":"/")+Y,D,G.scheme)}}return Oq1(G.fsPath,D,G.scheme)}return G}function Oq1(A,Q,B){return Q&&B==="file"?A.replaceAll("/","\\"):A}function ks(A){let Q=vs;return vs=A,Q}function VRA(){if(vs)return vs;throw new Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var vs=null;var rW=j1(()=>{x8();vb();Hq1()});function L3({onlyFirst:A=!1}={}){let B=["[\\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(B,A?void 0:"g")}function R3(A){if(typeof A!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof A}\``);return A.replace(ORA,"")}var ORA;var fs=j1(()=>{ORA=L3()});var Jo1=n((HT2,Cq1)=>{var nW={};if(typeof Cq1=="undefined")window.eastasianwidth=nW;else Cq1.exports=nW;nW.eastAsianWidth=function(A){var Q=A.charCodeAt(0),B=A.length==2?A.charCodeAt(1):0,J=Q;if(55296<=Q&&Q<=56319&&(56320<=B&&B<=57343))Q&=1023,B&=1023,J=Q<<10|B,J+=65536;if(J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510)return"F";if(J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518)return"H";if(4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141)return"W";if(32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630)return"Na";if(J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109)return"A";return"N"};nW.characterLength=function(A){var Q=this.eastAsianWidth(A);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function Bo1(A){return A.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}nW.length=function(A){var Q=Bo1(A),B=0;for(var J=0;J<Q.length;J++)B=B+this.characterLength(Q[J]);return B};nW.slice=function(A,Q,B){if(textLen=nW.length(A),Q=Q?Q:0,B=B?B:1,Q<0)Q=textLen+Q;if(B<0)B=textLen+B;var J="",D=0,z=Bo1(A);for(var G=0;G<z.length;G++){var X=z[G],K=nW.length(X);if(D>=Q-(K==2?1:0))if(D+K<=B)J+=X;else break;D+=K}return J}});var Lq1=n((FT2,Do1)=>{Do1.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}});function ys(A,Q){if(typeof A!=="string"||A.length===0)return 0;if(Q={ambiguousIsNarrow:!0,countAnsiEscapeCodes:!1,...Q},!Q.countAnsiEscapeCodes)A=R3(A);if(A.length===0)return 0;let B=Q.ambiguousIsNarrow?1:2,J=0;for(let{segment:D}of new Intl.Segmenter().segment(A)){let z=D.codePointAt(0);if(z<=31||z>=127&&z<=159)continue;if(z>=768&&z<=879)continue;if(Go1.default().test(D)){J+=2;continue}switch(zo1.default.eastAsianWidth(D)){case"F":case"W":{J+=2;break}case"A":{J+=B;break}default:J+=1}}return J}var zo1,Go1;var Xo1=j1(()=>{fs();zo1=WA(Jo1(),1),Go1=WA(Lq1(),1)});var Ko1="run_terminal_command",Yo1="read_file",R7="Task",qo1="chat_llm",pJ="codebase_search_agent",DU="get_diagnostics",p5="Bash",gz="oracle",SF="mermaid",sX="todo_read",s7="todo_write",xz="read_web_page",Zo1="run_javascript",Uo1="summarize_git_diff",LB="create_file",oX="glob",vT="undo_edit",bs="read_mcp_resource",I4="Read",cQ="edit_file",sW="format_file",gD="list_directory",zU="web_search",K7="Grep",Ho1="RunCIChecks",Fo1;var t8=j1(()=>{Fo1=["Task","chat_llm","codebase_search_agent","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","run_javascript","summarize_git_diff","create_file","glob","undo_edit","Read","edit_file","format_file","list_directory","web_search","Grep","search_documents","get_document","RunCIChecks"]});var ub=n((wT2,Mo1)=>{var Eo1={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:"/"},CRA={...Eo1,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:"\\"},LRA={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"};Mo1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:LRA,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:{"***":"*","**/**":"**","**/**/**":"**"},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(A){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${A.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(A){return A===!0?CRA:Eo1}}});var pb=n((_RA)=>{var{REGEX_BACKSLASH:RRA,REGEX_REMOVE_BACKSLASH:jRA,REGEX_SPECIAL_CHARS:TRA,REGEX_SPECIAL_CHARS_GLOBAL:$RA}=ub();_RA.isObject=(A)=>A!==null&&typeof A==="object"&&!Array.isArray(A);_RA.hasRegexChars=(A)=>TRA.test(A);_RA.isRegexChar=(A)=>A.length===1&&_RA.hasRegexChars(A);_RA.escapeRegex=(A)=>A.replace($RA,"\\$1");_RA.toPosixSlashes=(A)=>A.replace(RRA,"/");_RA.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let A=navigator.platform.toLowerCase();return A==="win32"||A==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};_RA.removeBackslashes=(A)=>{return A.replace(jRA,(Q)=>{return Q==="\\"?"":Q})};_RA.escapeLast=(A,Q,B)=>{let J=A.lastIndexOf(Q,B);if(J===-1)return A;if(A[J-1]==="\\")return _RA.escapeLast(A,Q,J-1);return`${A.slice(0,J)}\\${A.slice(J)}`};_RA.removePrefix=(A,Q={})=>{let B=A;if(B.startsWith("./"))B=B.slice(2),Q.prefix="./";return B};_RA.wrapOutput=(A,Q={},B={})=>{let J=B.contains?"":"^",D=B.contains?"":"$",z=`${J}(?:${A})${D}`;if(Q.negated===!0)z=`(?:^(?!${z}).*$)`;return z};_RA.basename=(A,{windows:Q}={})=>{let B=A.split(Q?/[\\/]/:"/"),J=B[B.length-1];if(J==="")return B[B.length-2];return J}});var jo1=n((NT2,Ro1)=>{var Io1=pb(),{CHAR_ASTERISK:Rq1,CHAR_AT:hRA,CHAR_BACKWARD_SLASH:cb,CHAR_COMMA:mRA,CHAR_DOT:jq1,CHAR_EXCLAMATION_MARK:Tq1,CHAR_FORWARD_SLASH:Lo1,CHAR_LEFT_CURLY_BRACE:$q1,CHAR_LEFT_PARENTHESES:_q1,CHAR_LEFT_SQUARE_BRACKET:uRA,CHAR_PLUS:pRA,CHAR_QUESTION_MARK:No1,CHAR_RIGHT_CURLY_BRACE:cRA,CHAR_RIGHT_PARENTHESES:Vo1,CHAR_RIGHT_SQUARE_BRACKET:lRA}=ub(),Oo1=(A)=>{return A===Lo1||A===cb},Co1=(A)=>{if(A.isPrefix!==!0)A.depth=A.isGlobstar?1/0:1},dRA=(A,Q)=>{let B=Q||{},J=A.length-1,D=B.parts===!0||B.scanToEnd===!0,z=[],G=[],X=[],K=A,Y=-1,q=0,Z=0,H=!1,F=!1,E=!1,M=!1,W=!1,w=!1,I=!1,N=!1,V=!1,L=!1,j=0,R,$,T={value:"",depth:0,isGlob:!1},P=()=>Y>=J,S=()=>K.charCodeAt(Y+1),b=()=>{return R=$,K.charCodeAt(++Y)};while(Y<J){$=b();let m;if($===cb){if(I=T.backslashes=!0,$=b(),$===$q1)w=!0;continue}if(w===!0||$===$q1){j++;while(P()!==!0&&($=b())){if($===cb){I=T.backslashes=!0,b();continue}if($===$q1){j++;continue}if(w!==!0&&$===jq1&&($=b())===jq1){if(H=T.isBrace=!0,E=T.isGlob=!0,L=!0,D===!0)continue;break}if(w!==!0&&$===mRA){if(H=T.isBrace=!0,E=T.isGlob=!0,L=!0,D===!0)continue;break}if($===cRA){if(j--,j===0){w=!1,H=T.isBrace=!0,L=!0;break}}}if(D===!0)continue;break}if($===Lo1){if(z.push(Y),G.push(T),T={value:"",depth:0,isGlob:!1},L===!0)continue;if(R===jq1&&Y===q+1){q+=2;continue}Z=Y+1;continue}if(B.noext!==!0){if(($===pRA||$===hRA||$===Rq1||$===No1||$===Tq1)===!0&&S()===_q1){if(E=T.isGlob=!0,M=T.isExtglob=!0,L=!0,$===Tq1&&Y===q)V=!0;if(D===!0){while(P()!==!0&&($=b())){if($===cb){I=T.backslashes=!0,$=b();continue}if($===Vo1){E=T.isGlob=!0,L=!0;break}}continue}break}}if($===Rq1){if(R===Rq1)W=T.isGlobstar=!0;if(E=T.isGlob=!0,L=!0,D===!0)continue;break}if($===No1){if(E=T.isGlob=!0,L=!0,D===!0)continue;break}if($===uRA){while(P()!==!0&&(m=b())){if(m===cb){I=T.backslashes=!0,b();continue}if(m===lRA){F=T.isBracket=!0,E=T.isGlob=!0,L=!0;break}}if(D===!0)continue;break}if(B.nonegate!==!0&&$===Tq1&&Y===q){N=T.negated=!0,q++;continue}if(B.noparen!==!0&&$===_q1){if(E=T.isGlob=!0,D===!0){while(P()!==!0&&($=b())){if($===_q1){I=T.backslashes=!0,$=b();continue}if($===Vo1){L=!0;break}}continue}break}if(E===!0){if(L=!0,D===!0)continue;break}}if(B.noext===!0)M=!1,E=!1;let u=K,_="",k="";if(q>0)_=K.slice(0,q),K=K.slice(q),Z-=q;if(u&&E===!0&&Z>0)u=K.slice(0,Z),k=K.slice(Z);else if(E===!0)u="",k=K;else u=K;if(u&&u!==""&&u!=="/"&&u!==K){if(Oo1(u.charCodeAt(u.length-1)))u=u.slice(0,-1)}if(B.unescape===!0){if(k)k=Io1.removeBackslashes(k);if(u&&I===!0)u=Io1.removeBackslashes(u)}let y={prefix:_,input:A,start:q,base:u,glob:k,isBrace:H,isBracket:F,isGlob:E,isExtglob:M,isGlobstar:W,negated:N,negatedExtglob:V};if(B.tokens===!0){if(y.maxDepth=0,!Oo1($))G.push(T);y.tokens=G}if(B.parts===!0||B.tokens===!0){let m;for(let v=0;v<z.length;v++){let x=m?m+1:q,p=z[v],d=A.slice(x,p);if(B.tokens){if(v===0&&q!==0)G[v].isPrefix=!0,G[v].value=_;else G[v].value=d;Co1(G[v]),y.maxDepth+=G[v].depth}if(v!==0||d!=="")X.push(d);m=p}if(m&&m+1<A.length){let v=A.slice(m+1);if(X.push(v),B.tokens)G[G.length-1].value=v,Co1(G[G.length-1]),y.maxDepth+=G[G.length-1].depth}y.slashes=z,y.parts=X}return y};Ro1.exports=dRA});var _o1=n((VT2,$o1)=>{var gs=ub(),GU=pb(),{MAX_LENGTH:xs,POSIX_REGEX_SOURCE:iRA,REGEX_NON_SPECIAL_CHARS:aRA,REGEX_SPECIAL_CHARS_BACKREF:rRA,REPLACEMENTS:To1}=gs,nRA=(A,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...A,Q);A.sort();let B=`[${A.join("-")}]`;try{new RegExp(B)}catch(J){return A.map((D)=>GU.escapeRegex(D)).join("..")}return B},kT=(A,Q)=>{return`Missing ${A}: "${Q}" - use "\\\\${Q}" to match literal characters`},Pq1=(A,Q)=>{if(typeof A!=="string")throw new TypeError("Expected a string");A=To1[A]||A;let B={...Q},J=typeof B.maxLength==="number"?Math.min(xs,B.maxLength):xs,D=A.length;if(D>J)throw new SyntaxError(`Input length: ${D}, exceeds maximum allowed length: ${J}`);let z={type:"bos",value:"",output:B.prepend||""},G=[z],X=B.capture?"":"?:",K=gs.globChars(B.windows),Y=gs.extglobChars(K),{DOT_LITERAL:q,PLUS_LITERAL:Z,SLASH_LITERAL:H,ONE_CHAR:F,DOTS_SLASH:E,NO_DOT:M,NO_DOT_SLASH:W,NO_DOTS_SLASH:w,QMARK:I,QMARK_NO_DOT:N,STAR:V,START_ANCHOR:L}=K,j=(R1)=>{return`(${X}(?:(?!${L}${R1.dot?E:q}).)*?)`},R=B.dot?"":M,$=B.dot?I:N,T=B.bash===!0?j(B):V;if(B.capture)T=`(${T})`;if(typeof B.noext==="boolean")B.noextglob=B.noext;let P={input:A,index:-1,start:0,dot:B.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:G};A=GU.removePrefix(A,P),D=A.length;let S=[],b=[],u=[],_=z,k,y=()=>P.index===D-1,m=P.peek=(R1=1)=>A[P.index+R1],v=P.advance=()=>A[++P.index]||"",x=()=>A.slice(P.index+1),p=(R1="",a=0)=>{P.consumed+=R1,P.index+=a},d=(R1)=>{P.output+=R1.output!=null?R1.output:R1.value,p(R1.value)},B1=()=>{let R1=1;while(m()==="!"&&(m(2)!=="("||m(3)==="?"))v(),P.start++,R1++;if(R1%2===0)return!1;return P.negated=!0,P.start++,!0},s=(R1)=>{P[R1]++,u.push(R1)},z1=(R1)=>{P[R1]--,u.pop()},Q1=(R1)=>{if(_.type==="globstar"){let a=P.braces>0&&(R1.type==="comma"||R1.type==="brace"),r=R1.extglob===!0||S.length&&(R1.type==="pipe"||R1.type==="paren");if(R1.type!=="slash"&&R1.type!=="paren"&&!a&&!r)P.output=P.output.slice(0,-_.output.length),_.type="star",_.value="*",_.output=T,P.output+=_.output}if(S.length&&R1.type!=="paren")S[S.length-1].inner+=R1.value;if(R1.value||R1.output)d(R1);if(_&&_.type==="text"&&R1.type==="text"){_.output=(_.output||_.value)+R1.value,_.value+=R1.value;return}R1.prev=_,G.push(R1),_=R1},X1=(R1,a)=>{let r={...Y[a],conditions:1,inner:""};r.prev=_,r.parens=P.parens,r.output=P.output;let o=(B.capture?"(":"")+r.open;s("parens"),Q1({type:R1,value:a,output:P.output?"":F}),Q1({type:"paren",extglob:!0,value:v(),output:o}),S.push(r)},D1=(R1)=>{let a=R1.close+(B.capture?")":""),r;if(R1.type==="negate"){let o=T;if(R1.inner&&R1.inner.length>1&&R1.inner.includes("/"))o=j(B);if(o!==T||y()||/^\)+$/.test(x()))a=R1.close=`)$))${o}`;if(R1.inner.includes("*")&&(r=x())&&/^\.[^\\/.]+$/.test(r)){let J1=Pq1(r,{...Q,fastpaths:!1}).output;a=R1.close=`)${J1})${o})`}if(R1.prev.type==="bos")P.negatedExtglob=!0}Q1({type:"paren",extglob:!0,value:k,output:a}),z1("parens")};if(B.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(A)){let R1=!1,a=A.replace(rRA,(r,o,J1,G1,q1,Z1)=>{if(G1==="\\")return R1=!0,r;if(G1==="?"){if(o)return o+G1+(q1?I.repeat(q1.length):"");if(Z1===0)return $+(q1?I.repeat(q1.length):"");return I.repeat(J1.length)}if(G1===".")return q.repeat(J1.length);if(G1==="*"){if(o)return o+G1+(q1?T:"");return T}return o?r:`\\${r}`});if(R1===!0)if(B.unescape===!0)a=a.replace(/\\/g,"");else a=a.replace(/\\+/g,(r)=>{return r.length%2===0?"\\\\":r?"\\":""});if(a===A&&B.contains===!0)return P.output=A,P;return P.output=GU.wrapOutput(a,P,Q),P}while(!y()){if(k=v(),k==="\x00")continue;if(k==="\\"){let r=m();if(r==="/"&&B.bash!==!0)continue;if(r==="."||r===";")continue;if(!r){k+="\\",Q1({type:"text",value:k});continue}let o=/^\\+/.exec(x()),J1=0;if(o&&o[0].length>2){if(J1=o[0].length,P.index+=J1,J1%2!==0)k+="\\"}if(B.unescape===!0)k=v();else k+=v();if(P.brackets===0){Q1({type:"text",value:k});continue}}if(P.brackets>0&&(k!=="]"||_.value==="["||_.value==="[^")){if(B.posix!==!1&&k===":"){let r=_.value.slice(1);if(r.includes("[")){if(_.posix=!0,r.includes(":")){let o=_.value.lastIndexOf("["),J1=_.value.slice(0,o),G1=_.value.slice(o+2),q1=iRA[G1];if(q1){if(_.value=J1+q1,P.backtrack=!0,v(),!z.output&&G.indexOf(_)===1)z.output=F;continue}}}}if(k==="["&&m()!==":"||k==="-"&&m()==="]")k=`\\${k}`;if(k==="]"&&(_.value==="["||_.value==="[^"))k=`\\${k}`;if(B.posix===!0&&k==="!"&&_.value==="[")k="^";_.value+=k,d({value:k});continue}if(P.quotes===1&&k!=='"'){k=GU.escapeRegex(k),_.value+=k,d({value:k});continue}if(k==='"'){if(P.quotes=P.quotes===1?0:1,B.keepQuotes===!0)Q1({type:"text",value:k});continue}if(k==="("){s("parens"),Q1({type:"paren",value:k});continue}if(k===")"){if(P.parens===0&&B.strictBrackets===!0)throw new SyntaxError(kT("opening","("));let r=S[S.length-1];if(r&&P.parens===r.parens+1){D1(S.pop());continue}Q1({type:"paren",value:k,output:P.parens?")":"\\)"}),z1("parens");continue}if(k==="["){if(B.nobracket===!0||!x().includes("]")){if(B.nobracket!==!0&&B.strictBrackets===!0)throw new SyntaxError(kT("closing","]"));k=`\\${k}`}else s("brackets");Q1({type:"bracket",value:k});continue}if(k==="]"){if(B.nobracket===!0||_&&_.type==="bracket"&&_.value.length===1){Q1({type:"text",value:k,output:`\\${k}`});continue}if(P.brackets===0){if(B.strictBrackets===!0)throw new SyntaxError(kT("opening","["));Q1({type:"text",value:k,output:`\\${k}`});continue}z1("brackets");let r=_.value.slice(1);if(_.posix!==!0&&r[0]==="^"&&!r.includes("/"))k=`/${k}`;if(_.value+=k,d({value:k}),B.literalBrackets===!1||GU.hasRegexChars(r))continue;let o=GU.escapeRegex(_.value);if(P.output=P.output.slice(0,-_.value.length),B.literalBrackets===!0){P.output+=o,_.value=o;continue}_.value=`(${X}${o}|${_.value})`,P.output+=_.value;continue}if(k==="{"&&B.nobrace!==!0){s("braces");let r={type:"brace",value:k,output:"(",outputIndex:P.output.length,tokensIndex:P.tokens.length};b.push(r),Q1(r);continue}if(k==="}"){let r=b[b.length-1];if(B.nobrace===!0||!r){Q1({type:"text",value:k,output:k});continue}let o=")";if(r.dots===!0){let J1=G.slice(),G1=[];for(let q1=J1.length-1;q1>=0;q1--){if(G.pop(),J1[q1].type==="brace")break;if(J1[q1].type!=="dots")G1.unshift(J1[q1].value)}o=nRA(G1,B),P.backtrack=!0}if(r.comma!==!0&&r.dots!==!0){let J1=P.output.slice(0,r.outputIndex),G1=P.tokens.slice(r.tokensIndex);r.value=r.output="\\{",k=o="\\}",P.output=J1;for(let q1 of G1)P.output+=q1.output||q1.value}Q1({type:"brace",value:k,output:o}),z1("braces"),b.pop();continue}if(k==="|"){if(S.length>0)S[S.length-1].conditions++;Q1({type:"text",value:k});continue}if(k===","){let r=k,o=b[b.length-1];if(o&&u[u.length-1]==="braces")o.comma=!0,r="|";Q1({type:"comma",value:k,output:r});continue}if(k==="/"){if(_.type==="dot"&&P.index===P.start+1){P.start=P.index+1,P.consumed="",P.output="",G.pop(),_=z;continue}Q1({type:"slash",value:k,output:H});continue}if(k==="."){if(P.braces>0&&_.type==="dot"){if(_.value===".")_.output=q;let r=b[b.length-1];_.type="dots",_.output+=k,_.value+=k,r.dots=!0;continue}if(P.braces+P.parens===0&&_.type!=="bos"&&_.type!=="slash"){Q1({type:"text",value:k,output:q});continue}Q1({type:"dot",value:k,output:q});continue}if(k==="?"){if(!(_&&_.value==="(")&&B.noextglob!==!0&&m()==="("&&m(2)!=="?"){X1("qmark",k);continue}if(_&&_.type==="paren"){let o=m(),J1=k;if(_.value==="("&&!/[!=<:]/.test(o)||o==="<"&&!/<([!=]|\w+>)/.test(x()))J1=`\\${k}`;Q1({type:"text",value:k,output:J1});continue}if(B.dot!==!0&&(_.type==="slash"||_.type==="bos")){Q1({type:"qmark",value:k,output:N});continue}Q1({type:"qmark",value:k,output:I});continue}if(k==="!"){if(B.noextglob!==!0&&m()==="("){if(m(2)!=="?"||!/[!=<:]/.test(m(3))){X1("negate",k);continue}}if(B.nonegate!==!0&&P.index===0){B1();continue}}if(k==="+"){if(B.noextglob!==!0&&m()==="("&&m(2)!=="?"){X1("plus",k);continue}if(_&&_.value==="("||B.regex===!1){Q1({type:"plus",value:k,output:Z});continue}if(_&&(_.type==="bracket"||_.type==="paren"||_.type==="brace")||P.parens>0){Q1({type:"plus",value:k});continue}Q1({type:"plus",value:Z});continue}if(k==="@"){if(B.noextglob!==!0&&m()==="("&&m(2)!=="?"){Q1({type:"at",extglob:!0,value:k,output:""});continue}Q1({type:"text",value:k});continue}if(k!=="*"){if(k==="$"||k==="^")k=`\\${k}`;let r=aRA.exec(x());if(r)k+=r[0],P.index+=r[0].length;Q1({type:"text",value:k});continue}if(_&&(_.type==="globstar"||_.star===!0)){_.type="star",_.star=!0,_.value+=k,_.output=T,P.backtrack=!0,P.globstar=!0,p(k);continue}let R1=x();if(B.noextglob!==!0&&/^\([^?]/.test(R1)){X1("star",k);continue}if(_.type==="star"){if(B.noglobstar===!0){p(k);continue}let r=_.prev,o=r.prev,J1=r.type==="slash"||r.type==="bos",G1=o&&(o.type==="star"||o.type==="globstar");if(B.bash===!0&&(!J1||R1[0]&&R1[0]!=="/")){Q1({type:"star",value:k,output:""});continue}let q1=P.braces>0&&(r.type==="comma"||r.type==="brace"),Z1=S.length&&(r.type==="pipe"||r.type==="paren");if(!J1&&r.type!=="paren"&&!q1&&!Z1){Q1({type:"star",value:k,output:""});continue}while(R1.slice(0,3)==="/**"){let $1=A[P.index+4];if($1&&$1!=="/")break;R1=R1.slice(3),p("/**",3)}if(r.type==="bos"&&y()){_.type="globstar",_.value+=k,_.output=j(B),P.output=_.output,P.globstar=!0,p(k);continue}if(r.type==="slash"&&r.prev.type!=="bos"&&!G1&&y()){P.output=P.output.slice(0,-(r.output+_.output).length),r.output=`(?:${r.output}`,_.type="globstar",_.output=j(B)+(B.strictSlashes?")":"|$)"),_.value+=k,P.globstar=!0,P.output+=r.output+_.output,p(k);continue}if(r.type==="slash"&&r.prev.type!=="bos"&&R1[0]==="/"){let $1=R1[1]!==void 0?"|$":"";P.output=P.output.slice(0,-(r.output+_.output).length),r.output=`(?:${r.output}`,_.type="globstar",_.output=`${j(B)}${H}|${H}${$1})`,_.value+=k,P.output+=r.output+_.output,P.globstar=!0,p(k+v()),Q1({type:"slash",value:"/",output:""});continue}if(r.type==="bos"&&R1[0]==="/"){_.type="globstar",_.value+=k,_.output=`(?:^|${H}|${j(B)}${H})`,P.output=_.output,P.globstar=!0,p(k+v()),Q1({type:"slash",value:"/",output:""});continue}P.output=P.output.slice(0,-_.output.length),_.type="globstar",_.output=j(B),_.value+=k,P.output+=_.output,P.globstar=!0,p(k);continue}let a={type:"star",value:k,output:T};if(B.bash===!0){if(a.output=".*?",_.type==="bos"||_.type==="slash")a.output=R+a.output;Q1(a);continue}if(_&&(_.type==="bracket"||_.type==="paren")&&B.regex===!0){a.output=k,Q1(a);continue}if(P.index===P.start||_.type==="slash"||_.type==="dot"){if(_.type==="dot")P.output+=W,_.output+=W;else if(B.dot===!0)P.output+=w,_.output+=w;else P.output+=R,_.output+=R;if(m()!=="*")P.output+=F,_.output+=F}Q1(a)}while(P.brackets>0){if(B.strictBrackets===!0)throw new SyntaxError(kT("closing","]"));P.output=GU.escapeLast(P.output,"["),z1("brackets")}while(P.parens>0){if(B.strictBrackets===!0)throw new SyntaxError(kT("closing",")"));P.output=GU.escapeLast(P.output,"("),z1("parens")}while(P.braces>0){if(B.strictBrackets===!0)throw new SyntaxError(kT("closing","}"));P.output=GU.escapeLast(P.output,"{"),z1("braces")}if(B.strictSlashes!==!0&&(_.type==="star"||_.type==="bracket"))Q1({type:"maybe_slash",value:"",output:`${H}?`});if(P.backtrack===!0){P.output="";for(let R1 of P.tokens)if(P.output+=R1.output!=null?R1.output:R1.value,R1.suffix)P.output+=R1.suffix}return P};Pq1.fastpaths=(A,Q)=>{let B={...Q},J=typeof B.maxLength==="number"?Math.min(xs,B.maxLength):xs,D=A.length;if(D>J)throw new SyntaxError(`Input length: ${D}, exceeds maximum allowed length: ${J}`);A=To1[A]||A;let{DOT_LITERAL:z,SLASH_LITERAL:G,ONE_CHAR:X,DOTS_SLASH:K,NO_DOT:Y,NO_DOTS:q,NO_DOTS_SLASH:Z,STAR:H,START_ANCHOR:F}=gs.globChars(B.windows),E=B.dot?q:Y,M=B.dot?Z:Y,W=B.capture?"":"?:",w={negated:!1,prefix:""},I=B.bash===!0?".*?":H;if(B.capture)I=`(${I})`;let N=(R)=>{if(R.noglobstar===!0)return I;return`(${W}(?:(?!${F}${R.dot?K:z}).)*?)`},V=(R)=>{switch(R){case"*":return`${E}${X}${I}`;case".*":return`${z}${X}${I}`;case"*.*":return`${E}${I}${z}${X}${I}`;case"*/*":return`${E}${I}${G}${X}${M}${I}`;case"**":return E+N(B);case"**/*":return`(?:${E}${N(B)}${G})?${M}${X}${I}`;case"**/*.*":return`(?:${E}${N(B)}${G})?${M}${I}${z}${X}${I}`;case"**/.*":return`(?:${E}${N(B)}${G})?${z}${X}${I}`;default:{let $=/^(.*?)\.(\w+)$/.exec(R);if(!$)return;let T=V($[1]);if(!T)return;return T+z+$[2]}}},L=GU.removePrefix(A,w),j=V(L);if(j&&B.strictSlashes!==!0)j+=`${G}?`;return j};$o1.exports=Pq1});var vo1=n((OT2,So1)=>{var sRA=jo1(),Sq1=_o1(),Po1=pb(),oRA=ub(),tRA=(A)=>A&&typeof A==="object"&&!Array.isArray(A),o7=(A,Q,B=!1)=>{if(Array.isArray(A)){let q=A.map((H)=>o7(H,Q,B));return(H)=>{for(let F of q){let E=F(H);if(E)return E}return!1}}let J=tRA(A)&&A.tokens&&A.input;if(A===""||typeof A!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let D=Q||{},z=D.windows,G=J?o7.compileRe(A,Q):o7.makeRe(A,Q,!1,!0),X=G.state;delete G.state;let K=()=>!1;if(D.ignore){let q={...Q,ignore:null,onMatch:null,onResult:null};K=o7(D.ignore,q,B)}let Y=(q,Z=!1)=>{let{isMatch:H,match:F,output:E}=o7.test(q,G,Q,{glob:A,posix:z}),M={glob:A,state:X,regex:G,posix:z,input:q,output:E,match:F,isMatch:H};if(typeof D.onResult==="function")D.onResult(M);if(H===!1)return M.isMatch=!1,Z?M:!1;if(K(q)){if(typeof D.onIgnore==="function")D.onIgnore(M);return M.isMatch=!1,Z?M:!1}if(typeof D.onMatch==="function")D.onMatch(M);return Z?M:!0};if(B)Y.state=X;return Y};o7.test=(A,Q,B,{glob:J,posix:D}={})=>{if(typeof A!=="string")throw new TypeError("Expected input to be a string");if(A==="")return{isMatch:!1,output:""};let z=B||{},G=z.format||(D?Po1.toPosixSlashes:null),X=A===J,K=X&&G?G(A):A;if(X===!1)K=G?G(A):A,X=K===J;if(X===!1||z.capture===!0)if(z.matchBase===!0||z.basename===!0)X=o7.matchBase(A,Q,B,D);else X=Q.exec(K);return{isMatch:Boolean(X),match:X,output:K}};o7.matchBase=(A,Q,B)=>{return(Q instanceof RegExp?Q:o7.makeRe(Q,B)).test(Po1.basename(A))};o7.isMatch=(A,Q,B)=>o7(Q,B)(A);o7.parse=(A,Q)=>{if(Array.isArray(A))return A.map((B)=>o7.parse(B,Q));return Sq1(A,{...Q,fastpaths:!1})};o7.scan=(A,Q)=>sRA(A,Q);o7.compileRe=(A,Q,B=!1,J=!1)=>{if(B===!0)return A.output;let D=Q||{},z=D.contains?"":"^",G=D.contains?"":"$",X=`${z}(?:${A.output})${G}`;if(A&&A.negated===!0)X=`^(?!${X}).*$`;let K=o7.toRegex(X,Q);if(J===!0)K.state=A;return K};o7.makeRe=(A,Q={},B=!1,J=!1)=>{if(!A||typeof A!=="string")throw new TypeError("Expected a non-empty string");let D={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(A[0]==="."||A[0]==="*"))D.output=Sq1.fastpaths(A,Q);if(!D.output)D=Sq1(A,Q);return o7.compileRe(D,Q,B,J)};o7.toRegex=(A,Q)=>{try{let B=Q||{};return new RegExp(A,B.flags||(B.nocase?"i":""))}catch(B){if(Q&&Q.debug===!0)throw B;return/$^/}};o7.constants=oRA;So1.exports=o7});var lb=n((CT2,yo1)=>{var ko1=vo1(),eRA=pb();function fo1(A,Q,B=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:eRA.isWindows()};return ko1(A,Q,B)}Object.assign(fo1,ko1);yo1.exports=fo1});var hs;var bo1=j1(()=>{hs={name:"amp",description:"An agentic coding tool, in research preview from Sourcegraph.",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","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","start:dev:web":"vscode-test-web --extensionDevelopmentPath=. --browserOption=--disable-web-security --verbose --open-devtools --verbose --printServerLog","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":"vite build",build:"pnpm run -s _build:extension && concurrently 'pnpm run -s _build:debugger' 'pnpm run -s _build:web'","build:production":"pnpm run -s _build:extension:production && concurrently 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production'","_build:extension":"vite build","_build:extension:production":"cross-env NODE_ENV=production vite build","_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: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":"vite build && pnpm run -s _build:web && pnpm run -s _build:debugger && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"vite build && pnpm run -s _build:web && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team at Sourcegraph",email:"amp-devs@sourcegraph.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.node.js",activationEvents:["onStartupFinished"],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"}]},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.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{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.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 Amp Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.manualTrigger",title:"Amp Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Amp Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Amp Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.tab.clearStuckDecorations",title:"Amp Tab Clear Stuck Decorations",category:"Amp"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"}],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.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:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"}],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"}},required:["url"]}]}},"amp.experimental.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:[{matches:{command:"*"},action:"allow"},{matches:{url:"*"},action:"allow"}],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"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.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: chat_llm",items:{type:"string"},default:[],scope:"application"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",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.terminal.commands.hide":{type:"boolean",default:!0,description:"Whether to hide the integrated VS Code terminal by default when starting commands",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.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.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dimissCommandIds":{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.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"same_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.experimental.improvedDiffChunking":{type:"boolean",default:!1,description:"Experimental: Enable improved diff chunking for Amp Tab suggestions.",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.experimental.centralizedStorage.enabled":{type:"boolean",default:!1,description:"Enable centralized thread storage across CLI and VS Code. When disabled, VS Code uses its legacy storage location.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.reviewTool":{type:"boolean",default:!1,description:"Experimental: Enable the summarize_git_diff tool.",scope:"application"},"amp.summary.provider":{type:"string",enum:["anthropic","gemini"],default:"gemini",description:"Experimental: change summary provider.",scope:"application"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"},"amp.gpt5":{type:"boolean",default:!1,description:"Try GPT-5 from OpenAI as the primary agent model, instead of Claude Sonnet 4. Only available during the limited model testing period. See https://ampcode.com/news/model-evaluation#gpt5.",scope:"window"},"amp.gpt5ReasoningEffort":{type:"string",enum:["minimal","low","medium","high"],default:"medium",description:"Reasoning effort to use with GPT-5 (when enabled).",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.experimental.mcpPermissions","amp.url","amp.anthropic.baseURL"]},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:{"@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/observable":"workspace:*","@sourcegraph/amp-uri":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12"},devDependencies:{"@sourcegraph/amp-web":"workspace:*","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@vscode/test-electron":"^2.4.1","@vscode/test-web":"*","@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","vite-plugin-static-copy":"^3.0.0"}}});function QjA(A){return typeof A==="number"&&Number.isInteger(A)&&A>=1&&A<=3600}function go1(A){let Q=A.settings["tools.inactivityTimeout"],B=A.settings["tools.stopTimeout"],J=Q;if(J===void 0&&B!==void 0)J=B;if(J===void 0)J=hs.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!QjA(J))return null;return J*1000}function xo1(A){let Q=A.settings["tools.stopTimeout"],B=hs.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??B)*1000}var jT2;var vq1=j1(()=>{bo1();jT2=hs.contributes.configuration.properties});function ms(A,Q){return new GA((B)=>{let J=setTimeout(D,Q);function D(){B.error(new Error(`Tool execution timed out after ${Q/1000} seconds`))}function z(){if(J)clearTimeout(J);J=setTimeout(D,Q)}let G=A.subscribe({next:(X)=>{z(),B.next(X)},error:(X)=>{if(J)clearTimeout(J),J=null;B.error(X)},complete:()=>{if(J)clearTimeout(J),J=null;B.complete()}});return()=>{if(J)clearTimeout(J),J=null;G.unsubscribe()}})}var kq1=j1(()=>{O6()});function vF(A,Q){let B={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},J=Q.modelCustomizations;if(J){for(let D of J)if(D.modelSelector.test(A))B={...B,description:D.description??B.description,inputSchema:D.inputSchema??B.inputSchema,customizedForModel:!0}}return B}function y4(A){return["done","error","rejected-by-user","cancelled"].includes(A.status)}function ps(){let A=[],Q=new R8;function B(D,z){let G=A.filter((X)=>X.spec.name===D);for(let X of G)if(db(X.spec,z).enabled)return X;return}function J(D,z,G){if(!D)throw new Error("spec is required");let X={spec:D,fn:Promise.resolve(z),preprocessArgs:G};return A.push(X),Q.next(),{dispose:()=>{let K=A.indexOf(X);if(K!==-1)A.splice(K,1),Q.next()}}}return{registerTool({spec:D,fn:z,preprocessArgs:G}){if(!z)return BjA;return J(D,z,G)},tools:j5(h2,Q.pipe(L7(void 0))).pipe(U2(([D])=>{return A.map((z)=>({spec:z.spec,...db(z.spec,D)})).sort((z,G)=>z.spec.name.localeCompare(G.spec.name))})),invokeTool(D,z,G){let X=performance.now(),K=()=>DjA.record(performance.now()-X,{toolName:D});if(D===yq1&&z.args&&"invalid_tool_name"in z.args&&typeof z.args.invalid_tool_name==="string"){us.add(1,{toolName:D,error:"invalid"});let q=JjA(z.args.invalid_tool_name);return new GA((Z)=>{Z.error(new Error(q))})}let Y=B(D,G.config);if(!Y){let q=A.filter((E)=>E.spec.name===D);if(q.length===0)return us.add(1,{toolName:D,error:"not_found"}),new GA((E)=>{E.error(new Error(`tool ${JSON.stringify(D)} not found`))});let Z=q[0],H=db(Z.spec,G.config);us.add(1,{toolName:D,error:"disabled"});let F=H.enabled?"unknown":H.disabledReason;return new GA((E)=>{E.error(new Error(`tool ${JSON.stringify(D)} is disabled: ${F}`))})}return us.add(1,{toolName:D}),M8(()=>Y.fn).pipe(y9((q)=>{let Z=q(z,G);if(Y.spec.meta?.disableTimeout)return Z;return ms(Z,xo1(G.config))}),hW(()=>K()))},preprocessArgs(D,z,G){let X=B(D,G.config);if(!X||!X.preprocessArgs)return;let K=X.preprocessArgs;try{return K(z,G)}catch(Y){N1.error("preprocessArgs",{id:D,args:z,error:String(Y)});return}},dispose(){}}}function fq1(A,Q){for(let B of Q){if(B==="")continue;if(B.length===1){if(B==="*")return!0;if(B===A)return!0;continue}if(A===B)return!0;if(B.includes("*")||B.includes("?")||B.includes("[")||B.includes("{"))try{if(mo1.default(B,{dot:!0})(A))return!0}catch(J){continue}}return!1}function db(A,Q){let B=Q.settings?.["tools.disable"]??[];if(fq1(A.name,B))return{enabled:!1,disabledReason:"settings"};if(typeof A.source==="object"&&"mcp"in A.source){let J=po1(A.name);if(J&&A.source.mcp===J.server&&fq1(J.tool,B))return{enabled:!1,disabledReason:"settings"}}if(A.source==="builtin"&&fq1(`builtin:${A.name}`,B))return{enabled:!1,disabledReason:"settings"};if(A.name===s7||A.name===sX){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function JjA(A){return`Invalid tool name ${JSON.stringify(A)}. Tool names must match the pattern ${bq1.toString()}. Try again with a valid tool name.`}function po1(A){let[,Q,B]=A.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&B)return{server:Q,tool:B};return}function co1(A){if(A.status==="in-progress"||A.status==="done"||A.status==="cancelled"||A.status==="error")return A.progress;return}function fT(A,Q,B=!0){let J=new Set(Q.map((z)=>z.spec.name));function D(z){if(J.has(z))return!0;if(B&&po1(z))return!0;return!1}return{registerTool(z){throw new Error("Tools should not be registered in a filtered tool service")},invokeTool(z,G,X){if(!D(z))return new GA((K)=>{K.error(new Error(`tool ${JSON.stringify(z)} not allowed in filtered service`))});return A.invokeTool(z,G,X)},preprocessArgs(z,G,X){if(!D(z))return;return A.preprocessArgs?.(z,G,X)},tools:A.tools.pipe(U2((z)=>z.filter((G)=>D(G.spec.name)))),dispose(){}}}var ho1,mo1,BjA,yq1="invalid_tool",bq1,uo1,us,DjA;var cJ=j1(()=>{ho1=WA(ZT(),1);O6();mo1=WA(lb(),1);iA();vq1();NQ();kq1();t8();BjA={dispose(){}};bq1=/^[a-zA-Z0-9_]{1,64}$/,uo1=ho1.metrics.getMeter("tool_service"),us=uo1.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),DjA=uo1.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var no1=n((ao1)=>{Object.defineProperty(ao1,"__esModule",{value:!0});ao1.calcSlices=ao1.applyPatch=ao1.calcPatch=ao1.lcs=ao1.diff=ao1.diff_core=void 0;function zjA(A,Q){let{b:B,eq:J,stack_base:D}=A,{i:z,N:G,j:X,M:K,Z:Y,stack_top:q}=A;for(;;)switch(Q){case 0:{A:while(G>0&&K>0){B.fill(0,0,2*Y);let Z=G-K,H=G+K,F=H&1,E=z+G-1,M=X+K-1,W=(H+F)/2,w;Q:for(let I=0;I<=W;I++){let N=2*Math.max(0,I-K)-I,V=I-2*Math.max(0,I-G);for(let L=N;L<=V;L+=2){let j=B[L-1-Y*Math.floor((L-1)/Y)],R=B[L+1-Y*Math.floor((L+1)/Y)],$=L===-I||L!==I&&j<R?R:j+1,T=$-L,P=$,S=T;while(P<G&&S<K&&J(z+P,X+S))P++,S++;if(B[L-Y*Math.floor(L/Y)]=P,F===1&&(w=Z-L)>=1-I&&w<I&&P+B[Y+w-Y*Math.floor(w/Y)]>=G)if(I>1||P!==$){D[q++]=z+P,D[q++]=G-P,D[q++]=X+S,D[q++]=K-S,G=$,K=T,Y=2*(Math.min(G,K)+1);continue A}else break Q}for(let L=N;L<=V;L+=2){let j=B[Y+L-1-Y*Math.floor((L-1)/Y)],R=B[Y+L+1-Y*Math.floor((L+1)/Y)],$=L===-I||L!==I&&j<R?R:j+1,T=$-L,P=$,S=T;while(P<G&&S<K&&J(E-P,M-S))P++,S++;if(B[Y+L-Y*Math.floor(L/Y)]=P,F===0&&(w=Z-L)>=-I&&w<=I&&P+B[w-Y*Math.floor(w/Y)]>=G)if(I>0||P!==$){D[q++]=z+G-$,D[q++]=$,D[q++]=X+K-T,D[q++]=T,G=G-P,K=K-S,Y=2*(Math.min(G,K)+1);continue A}else break Q}}if(G===K)continue;if(K>G)z+=G,X+=G,K-=G,G=0;else z+=K,X+=K,G-=K,K=0;break}if(G+K!==0)if(A.pxe===z||A.pye===X)A.pxe=z+G,A.pye=X+K;else{let Z=A.pxs;if(A.oxs=A.pxs,A.oxe=A.pxe,A.oys=A.pys,A.oye=A.pye,A.pxs=z,A.pxe=z+G,A.pys=X,A.pye=X+K,Z>=0)return A.i=z,A.N=G,A.j=X,A.M=K,A.Z=Y,A.stack_top=q,1}}case 1:{if(q===0)return 2;K=D[--q],X=D[--q],G=D[--q],z=D[--q],Y=2*(Math.min(G,K)+1),Q=0}}}class lo1{constructor(A){this.state=A,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:A,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let B=zjA(A,this.c);if(this.c=B,B===1)return Q.value=[A.oxs,A.oxe,A.oys,A.oye],Q;if(A.pxs>=0)return Q.value=[A.pxs,A.pxe,A.pys,A.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function do1(A,Q,B,J,D){let z=(Math.min(Q,J)+1)*2,G=Q+J,X=new(G<256?Uint8Array:G<65536?Uint16Array:Uint32Array)(2*z);return new lo1({i:A,N:Q,j:B,M:J,Z:z,b:X,eq:D,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}ao1.diff_core=do1;function cs(A,Q,B){let[J,D,z]=[0,A.length,Q.length];if(typeof B==="function"){while(J<D&&J<z&&B(J,J))J++;if(J===D&&J===z)return[][Symbol.iterator]();while(B(--D,--z)&&D>J&&z>J);}else{while(J<D&&J<z&&A[J]===Q[J])J++;if(J===D&&J===z)return[][Symbol.iterator]();while(A[--D]===Q[--z]&&D>J&&z>J);B=(G,X)=>A[G]===Q[X]}return do1(J,D+1-J,J,z+1-J,B)}ao1.diff=cs;class io1{constructor(A,Q){this.diff=A,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let A=this.diff.next();if(A.done){let{i:X,j:K,N:Y}=this;if(X<Y)A.done=!1,A.value=[X,K,Y-X],this.i=Y;return A}let Q=A.value,B=Q[0],J=Q[1],D=Q[3],{i:z,j:G}=this;if(z!==B)Q.length--,Q[0]=z,Q[1]=G,Q[2]=B-z;return this.i=J,this.j=D,A}}function GjA(A,Q,B){return new io1(cs(A,Q,B),A.length)}ao1.lcs=GjA;function*XjA(A,Q,B){let J=ArrayBuffer.isView(A)?Uint8Array.prototype.subarray:A.slice;for(let D of cs(A,Q,B))D[2]=J.call(Q,D[2],D[3]),yield D}ao1.calcPatch=XjA;function*KjA(A,Q){let B=0,J=ArrayBuffer.isView(A)?Uint8Array.prototype.subarray:A.slice;for(let[D,z,G]of Q){if(B<D)yield J.call(A,B,D);if(G.length>0)yield G;B=z}if(B<A.length)yield J.call(A,B)}ao1.applyPatch=KjA;function*YjA(A,Q,B){let J=0,D=ArrayBuffer.isView(A)?Uint8Array.prototype.subarray:A.slice;for(let[z,G,X,K]of cs(A,Q,B)){if(J<z)yield[0,D.call(A,J,z)];if(z<G)yield[-1,D.call(A,z,G)];if(X<K)yield[1,D.call(Q,X,K)];J=G}if(J<A.length)yield[0,A.slice(J)]}ao1.calcSlices=YjA});function ls(A,Q){if(A===void 0||Q===void 0||A===Q)return{added:0,deleted:0,changed:0};let B={added:0,deleted:0,changed:0};for(let[J,D,z,G]of so1.diff(A.split(`
3
+ import{createRequire as C3A}from"node:module";var I3A=Object.create;var{getPrototypeOf:N3A,defineProperty:KY1,getOwnPropertyNames:V3A}=Object;var O3A=Object.prototype.hasOwnProperty;var WA=(A,Q,B)=>{B=A!=null?I3A(N3A(A)):{};let J=Q||!A||!A.__esModule?KY1(B,"default",{value:A,enumerable:!0}):B;for(let D of V3A(A))if(!O3A.call(J,D))KY1(J,D,{get:()=>A[D],enumerable:!0});return J};var n=(A,Q)=>()=>(Q||A((Q={exports:{}}).exports,Q),Q.exports);var h6=(A,Q)=>{for(var B in Q)KY1(A,B,{get:Q[B],enumerable:!0,configurable:!0,set:(J)=>Q[B]=()=>J})};var j1=(A,Q)=>()=>(A&&(Q=A(A=0)),Q);var T0=C3A(import.meta.url);var Va1=n((Ia1)=>{Object.defineProperty(Ia1,"__esModule",{value:!0});Ia1._globalThis=void 0;Ia1._globalThis=typeof globalThis==="object"?globalThis:global});var Oa1=n((Y3)=>{var L3A=Y3&&Y3.__createBinding||(Object.create?function(A,Q,B,J){if(J===void 0)J=B;Object.defineProperty(A,J,{enumerable:!0,get:function(){return Q[B]}})}:function(A,Q,B,J){if(J===void 0)J=B;A[J]=Q[B]}),R3A=Y3&&Y3.__exportStar||function(A,Q){for(var B in A)if(B!=="default"&&!Object.prototype.hasOwnProperty.call(Q,B))L3A(Q,A,B)};Object.defineProperty(Y3,"__esModule",{value:!0});R3A(Va1(),Y3)});var Ca1=n((q3)=>{var j3A=q3&&q3.__createBinding||(Object.create?function(A,Q,B,J){if(J===void 0)J=B;Object.defineProperty(A,J,{enumerable:!0,get:function(){return Q[B]}})}:function(A,Q,B,J){if(J===void 0)J=B;A[J]=Q[B]}),T3A=q3&&q3.__exportStar||function(A,Q){for(var B in A)if(B!=="default"&&!Object.prototype.hasOwnProperty.call(Q,B))j3A(Q,A,B)};Object.defineProperty(q3,"__esModule",{value:!0});T3A(Oa1(),q3)});var YY1=n((La1)=>{Object.defineProperty(La1,"__esModule",{value:!0});La1.VERSION=void 0;La1.VERSION="1.9.0"});var Pa1=n(($a1)=>{Object.defineProperty($a1,"__esModule",{value:!0});$a1.isCompatible=$a1._makeCompatibilityCheck=void 0;var $3A=YY1(),ja1=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Ta1(A){let Q=new Set([A]),B=new Set,J=A.match(ja1);if(!J)return()=>!1;let D={major:+J[1],minor:+J[2],patch:+J[3],prerelease:J[4]};if(D.prerelease!=null)return function X(K){return K===A};function z(X){return B.add(X),!1}function G(X){return Q.add(X),!0}return function X(K){if(Q.has(K))return!0;if(B.has(K))return!1;let Y=K.match(ja1);if(!Y)return z(K);let q={major:+Y[1],minor:+Y[2],patch:+Y[3],prerelease:Y[4]};if(q.prerelease!=null)return z(K);if(D.major!==q.major)return z(K);if(D.major===0){if(D.minor===q.minor&&D.patch<=q.patch)return G(K);return z(K)}if(D.minor<=q.minor)return G(K);return z(K)}}$a1._makeCompatibilityCheck=Ta1;$a1.isCompatible=Ta1($3A.VERSION)});var Z3=n((Sa1)=>{Object.defineProperty(Sa1,"__esModule",{value:!0});Sa1.unregisterGlobal=Sa1.getGlobal=Sa1.registerGlobal=void 0;var P3A=Ca1(),XT=YY1(),S3A=Pa1(),v3A=XT.VERSION.split(".")[0],Vb=Symbol.for(`opentelemetry.js.api.${v3A}`),Ob=P3A._globalThis;function k3A(A,Q,B,J=!1){var D;let z=Ob[Vb]=(D=Ob[Vb])!==null&&D!==void 0?D:{version:XT.VERSION};if(!J&&z[A]){let G=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${A}`);return B.error(G.stack||G.message),!1}if(z.version!==XT.VERSION){let G=new Error(`@opentelemetry/api: Registration of version v${z.version} for ${A} does not match previously registered API v${XT.VERSION}`);return B.error(G.stack||G.message),!1}return z[A]=Q,B.debug(`@opentelemetry/api: Registered a global for ${A} v${XT.VERSION}.`),!0}Sa1.registerGlobal=k3A;function f3A(A){var Q,B;let J=(Q=Ob[Vb])===null||Q===void 0?void 0:Q.version;if(!J||!S3A.isCompatible(J))return;return(B=Ob[Vb])===null||B===void 0?void 0:B[A]}Sa1.getGlobal=f3A;function y3A(A,Q){Q.debug(`@opentelemetry/api: Unregistering a global for ${A} v${XT.VERSION}.`);let B=Ob[Vb];if(B)delete B[A]}Sa1.unregisterGlobal=y3A});var ba1=n((fa1)=>{Object.defineProperty(fa1,"__esModule",{value:!0});fa1.DiagComponentLogger=void 0;var x3A=Z3();class ka1{constructor(A){this._namespace=A.namespace||"DiagComponentLogger"}debug(...A){return Cb("debug",this._namespace,A)}error(...A){return Cb("error",this._namespace,A)}info(...A){return Cb("info",this._namespace,A)}warn(...A){return Cb("warn",this._namespace,A)}verbose(...A){return Cb("verbose",this._namespace,A)}}fa1.DiagComponentLogger=ka1;function Cb(A,Q,B){let J=x3A.getGlobal("diag");if(!J)return;return B.unshift(Q),J[A](...B)}});var Xs=n((ga1)=>{Object.defineProperty(ga1,"__esModule",{value:!0});ga1.DiagLogLevel=void 0;var h3A;(function(A){A[A.NONE=0]="NONE",A[A.ERROR=30]="ERROR",A[A.WARN=50]="WARN",A[A.INFO=60]="INFO",A[A.DEBUG=70]="DEBUG",A[A.VERBOSE=80]="VERBOSE",A[A.ALL=9999]="ALL"})(h3A=ga1.DiagLogLevel||(ga1.DiagLogLevel={}))});var ma1=n((xa1)=>{Object.defineProperty(xa1,"__esModule",{value:!0});xa1.createLogLevelDiagLogger=void 0;var CF=Xs();function m3A(A,Q){if(A<CF.DiagLogLevel.NONE)A=CF.DiagLogLevel.NONE;else if(A>CF.DiagLogLevel.ALL)A=CF.DiagLogLevel.ALL;Q=Q||{};function B(J,D){let z=Q[J];if(typeof z==="function"&&A>=D)return z.bind(Q);return function(){}}return{error:B("error",CF.DiagLogLevel.ERROR),warn:B("warn",CF.DiagLogLevel.WARN),info:B("info",CF.DiagLogLevel.INFO),debug:B("debug",CF.DiagLogLevel.DEBUG),verbose:B("verbose",CF.DiagLogLevel.VERBOSE)}}xa1.createLogLevelDiagLogger=m3A});var U3=n((pa1)=>{Object.defineProperty(pa1,"__esModule",{value:!0});pa1.DiagAPI=void 0;var u3A=ba1(),p3A=ma1(),ua1=Xs(),Ks=Z3(),c3A="diag";class ZY1{constructor(){function A(J){return function(...D){let z=Ks.getGlobal("diag");if(!z)return;return z[J](...D)}}let Q=this,B=(J,D={logLevel:ua1.DiagLogLevel.INFO})=>{var z,G,X;if(J===Q){let q=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return Q.error((z=q.stack)!==null&&z!==void 0?z:q.message),!1}if(typeof D==="number")D={logLevel:D};let K=Ks.getGlobal("diag"),Y=p3A.createLogLevelDiagLogger((G=D.logLevel)!==null&&G!==void 0?G:ua1.DiagLogLevel.INFO,J);if(K&&!D.suppressOverrideMessage){let q=(X=new Error().stack)!==null&&X!==void 0?X:"<failed to generate stacktrace>";K.warn(`Current logger will be overwritten from ${q}`),Y.warn(`Current logger will overwrite one already registered from ${q}`)}return Ks.registerGlobal("diag",Y,Q,!0)};Q.setLogger=B,Q.disable=()=>{Ks.unregisterGlobal(c3A,Q)},Q.createComponentLogger=(J)=>{return new u3A.DiagComponentLogger(J)},Q.verbose=A("verbose"),Q.debug=A("debug"),Q.info=A("info"),Q.warn=A("warn"),Q.error=A("error")}static instance(){if(!this._instance)this._instance=new ZY1;return this._instance}}pa1.DiagAPI=ZY1});var ia1=n((la1)=>{Object.defineProperty(la1,"__esModule",{value:!0});la1.BaggageImpl=void 0;class KT{constructor(A){this._entries=A?new Map(A):new Map}getEntry(A){let Q=this._entries.get(A);if(!Q)return;return Object.assign({},Q)}getAllEntries(){return Array.from(this._entries.entries()).map(([A,Q])=>[A,Q])}setEntry(A,Q){let B=new KT(this._entries);return B._entries.set(A,Q),B}removeEntry(A){let Q=new KT(this._entries);return Q._entries.delete(A),Q}removeEntries(...A){let Q=new KT(this._entries);for(let B of A)Q._entries.delete(B);return Q}clear(){return new KT}}la1.BaggageImpl=KT});var na1=n((aa1)=>{Object.defineProperty(aa1,"__esModule",{value:!0});aa1.baggageEntryMetadataSymbol=void 0;aa1.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var UY1=n((sa1)=>{Object.defineProperty(sa1,"__esModule",{value:!0});sa1.baggageEntryMetadataFromString=sa1.createBaggage=void 0;var l3A=U3(),d3A=ia1(),i3A=na1(),a3A=l3A.DiagAPI.instance();function r3A(A={}){return new d3A.BaggageImpl(new Map(Object.entries(A)))}sa1.createBaggage=r3A;function n3A(A){if(typeof A!=="string")a3A.error(`Cannot create baggage metadata from unknown type: ${typeof A}`),A="";return{__TYPE__:i3A.baggageEntryMetadataSymbol,toString(){return A}}}sa1.baggageEntryMetadataFromString=n3A});var Lb=n((ta1)=>{Object.defineProperty(ta1,"__esModule",{value:!0});ta1.ROOT_CONTEXT=ta1.createContextKey=void 0;function o3A(A){return Symbol.for(A)}ta1.createContextKey=o3A;class Ys{constructor(A){let Q=this;Q._currentContext=A?new Map(A):new Map,Q.getValue=(B)=>Q._currentContext.get(B),Q.setValue=(B,J)=>{let D=new Ys(Q._currentContext);return D._currentContext.set(B,J),D},Q.deleteValue=(B)=>{let J=new Ys(Q._currentContext);return J._currentContext.delete(B),J}}}ta1.ROOT_CONTEXT=new Ys});var Jr1=n((Qr1)=>{Object.defineProperty(Qr1,"__esModule",{value:!0});Qr1.DiagConsoleLogger=void 0;var HY1=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class Ar1{constructor(){function A(Q){return function(...B){if(console){let J=console[Q];if(typeof J!=="function")J=console.log;if(typeof J==="function")return J.apply(console,B)}}}for(let Q=0;Q<HY1.length;Q++)this[HY1[Q].n]=A(HY1[Q].c)}}Qr1.DiagConsoleLogger=Ar1});var OY1=n((Dr1)=>{Object.defineProperty(Dr1,"__esModule",{value:!0});Dr1.createNoopMeter=Dr1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=Dr1.NOOP_OBSERVABLE_GAUGE_METRIC=Dr1.NOOP_OBSERVABLE_COUNTER_METRIC=Dr1.NOOP_UP_DOWN_COUNTER_METRIC=Dr1.NOOP_HISTOGRAM_METRIC=Dr1.NOOP_GAUGE_METRIC=Dr1.NOOP_COUNTER_METRIC=Dr1.NOOP_METER=Dr1.NoopObservableUpDownCounterMetric=Dr1.NoopObservableGaugeMetric=Dr1.NoopObservableCounterMetric=Dr1.NoopObservableMetric=Dr1.NoopHistogramMetric=Dr1.NoopGaugeMetric=Dr1.NoopUpDownCounterMetric=Dr1.NoopCounterMetric=Dr1.NoopMetric=Dr1.NoopMeter=void 0;class FY1{constructor(){}createGauge(A,Q){return Dr1.NOOP_GAUGE_METRIC}createHistogram(A,Q){return Dr1.NOOP_HISTOGRAM_METRIC}createCounter(A,Q){return Dr1.NOOP_COUNTER_METRIC}createUpDownCounter(A,Q){return Dr1.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(A,Q){return Dr1.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(A,Q){return Dr1.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(A,Q){return Dr1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(A,Q){}removeBatchObservableCallback(A){}}Dr1.NoopMeter=FY1;class YT{}Dr1.NoopMetric=YT;class EY1 extends YT{add(A,Q){}}Dr1.NoopCounterMetric=EY1;class MY1 extends YT{add(A,Q){}}Dr1.NoopUpDownCounterMetric=MY1;class WY1 extends YT{record(A,Q){}}Dr1.NoopGaugeMetric=WY1;class wY1 extends YT{record(A,Q){}}Dr1.NoopHistogramMetric=wY1;class Rb{addCallback(A){}removeCallback(A){}}Dr1.NoopObservableMetric=Rb;class IY1 extends Rb{}Dr1.NoopObservableCounterMetric=IY1;class NY1 extends Rb{}Dr1.NoopObservableGaugeMetric=NY1;class VY1 extends Rb{}Dr1.NoopObservableUpDownCounterMetric=VY1;Dr1.NOOP_METER=new FY1;Dr1.NOOP_COUNTER_METRIC=new EY1;Dr1.NOOP_GAUGE_METRIC=new WY1;Dr1.NOOP_HISTOGRAM_METRIC=new wY1;Dr1.NOOP_UP_DOWN_COUNTER_METRIC=new MY1;Dr1.NOOP_OBSERVABLE_COUNTER_METRIC=new IY1;Dr1.NOOP_OBSERVABLE_GAUGE_METRIC=new NY1;Dr1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new VY1;function e3A(){return Dr1.NOOP_METER}Dr1.createNoopMeter=e3A});var Er1=n((Fr1)=>{Object.defineProperty(Fr1,"__esModule",{value:!0});Fr1.ValueType=void 0;var qOA;(function(A){A[A.INT=0]="INT",A[A.DOUBLE=1]="DOUBLE"})(qOA=Fr1.ValueType||(Fr1.ValueType={}))});var LY1=n((Mr1)=>{Object.defineProperty(Mr1,"__esModule",{value:!0});Mr1.defaultTextMapSetter=Mr1.defaultTextMapGetter=void 0;Mr1.defaultTextMapGetter={get(A,Q){if(A==null)return;return A[Q]},keys(A){if(A==null)return[];return Object.keys(A)}};Mr1.defaultTextMapSetter={set(A,Q,B){if(A==null)return;A[Q]=B}}});var Vr1=n((Ir1)=>{Object.defineProperty(Ir1,"__esModule",{value:!0});Ir1.NoopContextManager=void 0;var UOA=Lb();class wr1{active(){return UOA.ROOT_CONTEXT}with(A,Q,B,...J){return Q.call(B,...J)}bind(A,Q){return Q}enable(){return this}disable(){return this}}Ir1.NoopContextManager=wr1});var jb=n((Cr1)=>{Object.defineProperty(Cr1,"__esModule",{value:!0});Cr1.ContextAPI=void 0;var HOA=Vr1(),RY1=Z3(),Or1=U3(),jY1="context",FOA=new HOA.NoopContextManager;class TY1{constructor(){}static getInstance(){if(!this._instance)this._instance=new TY1;return this._instance}setGlobalContextManager(A){return RY1.registerGlobal(jY1,A,Or1.DiagAPI.instance())}active(){return this._getContextManager().active()}with(A,Q,B,...J){return this._getContextManager().with(A,Q,B,...J)}bind(A,Q){return this._getContextManager().bind(A,Q)}_getContextManager(){return RY1.getGlobal(jY1)||FOA}disable(){this._getContextManager().disable(),RY1.unregisterGlobal(jY1,Or1.DiagAPI.instance())}}Cr1.ContextAPI=TY1});var _Y1=n((Rr1)=>{Object.defineProperty(Rr1,"__esModule",{value:!0});Rr1.TraceFlags=void 0;var EOA;(function(A){A[A.NONE=0]="NONE",A[A.SAMPLED=1]="SAMPLED"})(EOA=Rr1.TraceFlags||(Rr1.TraceFlags={}))});var qs=n((jr1)=>{Object.defineProperty(jr1,"__esModule",{value:!0});jr1.INVALID_SPAN_CONTEXT=jr1.INVALID_TRACEID=jr1.INVALID_SPANID=void 0;var MOA=_Y1();jr1.INVALID_SPANID="0000000000000000";jr1.INVALID_TRACEID="00000000000000000000000000000000";jr1.INVALID_SPAN_CONTEXT={traceId:jr1.INVALID_TRACEID,spanId:jr1.INVALID_SPANID,traceFlags:MOA.TraceFlags.NONE}});var Zs=n((Sr1)=>{Object.defineProperty(Sr1,"__esModule",{value:!0});Sr1.NonRecordingSpan=void 0;var WOA=qs();class Pr1{constructor(A=WOA.INVALID_SPAN_CONTEXT){this._spanContext=A}spanContext(){return this._spanContext}setAttribute(A,Q){return this}setAttributes(A){return this}addEvent(A,Q){return this}addLink(A){return this}addLinks(A){return this}setStatus(A){return this}updateName(A){return this}end(A){}isRecording(){return!1}recordException(A,Q){}}Sr1.NonRecordingSpan=Pr1});var vY1=n((fr1)=>{Object.defineProperty(fr1,"__esModule",{value:!0});fr1.getSpanContext=fr1.setSpanContext=fr1.deleteSpan=fr1.setSpan=fr1.getActiveSpan=fr1.getSpan=void 0;var wOA=Lb(),IOA=Zs(),NOA=jb(),PY1=wOA.createContextKey("OpenTelemetry Context Key SPAN");function SY1(A){return A.getValue(PY1)||void 0}fr1.getSpan=SY1;function VOA(){return SY1(NOA.ContextAPI.getInstance().active())}fr1.getActiveSpan=VOA;function kr1(A,Q){return A.setValue(PY1,Q)}fr1.setSpan=kr1;function OOA(A){return A.deleteValue(PY1)}fr1.deleteSpan=OOA;function COA(A,Q){return kr1(A,new IOA.NonRecordingSpan(Q))}fr1.setSpanContext=COA;function LOA(A){var Q;return(Q=SY1(A))===null||Q===void 0?void 0:Q.spanContext()}fr1.getSpanContext=LOA});var Us=n((hr1)=>{Object.defineProperty(hr1,"__esModule",{value:!0});hr1.wrapSpanContext=hr1.isSpanContextValid=hr1.isValidSpanId=hr1.isValidTraceId=void 0;var br1=qs(),POA=Zs(),SOA=/^([0-9a-f]{32})$/i,vOA=/^[0-9a-f]{16}$/i;function gr1(A){return SOA.test(A)&&A!==br1.INVALID_TRACEID}hr1.isValidTraceId=gr1;function xr1(A){return vOA.test(A)&&A!==br1.INVALID_SPANID}hr1.isValidSpanId=xr1;function kOA(A){return gr1(A.traceId)&&xr1(A.spanId)}hr1.isSpanContextValid=kOA;function fOA(A){return new POA.NonRecordingSpan(A)}hr1.wrapSpanContext=fOA});var yY1=n((cr1)=>{Object.defineProperty(cr1,"__esModule",{value:!0});cr1.NoopTracer=void 0;var xOA=jb(),ur1=vY1(),kY1=Zs(),hOA=Us(),fY1=xOA.ContextAPI.getInstance();class pr1{startSpan(A,Q,B=fY1.active()){if(Boolean(Q===null||Q===void 0?void 0:Q.root))return new kY1.NonRecordingSpan;let D=B&&ur1.getSpanContext(B);if(mOA(D)&&hOA.isSpanContextValid(D))return new kY1.NonRecordingSpan(D);else return new kY1.NonRecordingSpan}startActiveSpan(A,Q,B,J){let D,z,G;if(arguments.length<2)return;else if(arguments.length===2)G=Q;else if(arguments.length===3)D=Q,G=B;else D=Q,z=B,G=J;let X=z!==null&&z!==void 0?z:fY1.active(),K=this.startSpan(A,D,X),Y=ur1.setSpan(X,K);return fY1.with(Y,G,void 0,K)}}cr1.NoopTracer=pr1;function mOA(A){return typeof A==="object"&&typeof A.spanId==="string"&&typeof A.traceId==="string"&&typeof A.traceFlags==="number"}});var bY1=n((ir1)=>{Object.defineProperty(ir1,"__esModule",{value:!0});ir1.ProxyTracer=void 0;var uOA=yY1(),pOA=new uOA.NoopTracer;class dr1{constructor(A,Q,B,J){this._provider=A,this.name=Q,this.version=B,this.options=J}startSpan(A,Q,B){return this._getTracer().startSpan(A,Q,B)}startActiveSpan(A,Q,B,J){let D=this._getTracer();return Reflect.apply(D.startActiveSpan,D,arguments)}_getTracer(){if(this._delegate)return this._delegate;let A=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!A)return pOA;return this._delegate=A,this._delegate}}ir1.ProxyTracer=dr1});var or1=n((nr1)=>{Object.defineProperty(nr1,"__esModule",{value:!0});nr1.NoopTracerProvider=void 0;var cOA=yY1();class rr1{getTracer(A,Q,B){return new cOA.NoopTracer}}nr1.NoopTracerProvider=rr1});var gY1=n((er1)=>{Object.defineProperty(er1,"__esModule",{value:!0});er1.ProxyTracerProvider=void 0;var lOA=bY1(),dOA=or1(),iOA=new dOA.NoopTracerProvider;class tr1{getTracer(A,Q,B){var J;return(J=this.getDelegateTracer(A,Q,B))!==null&&J!==void 0?J:new lOA.ProxyTracer(this,A,Q,B)}getDelegate(){var A;return(A=this._delegate)!==null&&A!==void 0?A:iOA}setDelegate(A){this._delegate=A}getDelegateTracer(A,Q,B){var J;return(J=this._delegate)===null||J===void 0?void 0:J.getTracer(A,Q,B)}}er1.ProxyTracerProvider=tr1});var Bn1=n((Qn1)=>{Object.defineProperty(Qn1,"__esModule",{value:!0});Qn1.SamplingDecision=void 0;var aOA;(function(A){A[A.NOT_RECORD=0]="NOT_RECORD",A[A.RECORD=1]="RECORD",A[A.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(aOA=Qn1.SamplingDecision||(Qn1.SamplingDecision={}))});var Dn1=n((Jn1)=>{Object.defineProperty(Jn1,"__esModule",{value:!0});Jn1.SpanKind=void 0;var rOA;(function(A){A[A.INTERNAL=0]="INTERNAL",A[A.SERVER=1]="SERVER",A[A.CLIENT=2]="CLIENT",A[A.PRODUCER=3]="PRODUCER",A[A.CONSUMER=4]="CONSUMER"})(rOA=Jn1.SpanKind||(Jn1.SpanKind={}))});var Gn1=n((zn1)=>{Object.defineProperty(zn1,"__esModule",{value:!0});zn1.SpanStatusCode=void 0;var nOA;(function(A){A[A.UNSET=0]="UNSET",A[A.OK=1]="OK",A[A.ERROR=2]="ERROR"})(nOA=zn1.SpanStatusCode||(zn1.SpanStatusCode={}))});var Yn1=n((Xn1)=>{Object.defineProperty(Xn1,"__esModule",{value:!0});Xn1.validateValue=Xn1.validateKey=void 0;var uY1="[_0-9a-z-*/]",sOA=`[a-z]${uY1}{0,255}`,oOA=`[a-z0-9]${uY1}{0,240}@[a-z]${uY1}{0,13}`,tOA=new RegExp(`^(?:${sOA}|${oOA})$`),eOA=/^[ -~]{0,255}[!-~]$/,ACA=/,|=/;function QCA(A){return tOA.test(A)}Xn1.validateKey=QCA;function BCA(A){return eOA.test(A)&&!ACA.test(A)}Xn1.validateValue=BCA});var Mn1=n((Fn1)=>{Object.defineProperty(Fn1,"__esModule",{value:!0});Fn1.TraceStateImpl=void 0;var qn1=Yn1(),Zn1=32,DCA=512,Un1=",",Hn1="=";class pY1{constructor(A){if(this._internalState=new Map,A)this._parse(A)}set(A,Q){let B=this._clone();if(B._internalState.has(A))B._internalState.delete(A);return B._internalState.set(A,Q),B}unset(A){let Q=this._clone();return Q._internalState.delete(A),Q}get(A){return this._internalState.get(A)}serialize(){return this._keys().reduce((A,Q)=>{return A.push(Q+Hn1+this.get(Q)),A},[]).join(Un1)}_parse(A){if(A.length>DCA)return;if(this._internalState=A.split(Un1).reverse().reduce((Q,B)=>{let J=B.trim(),D=J.indexOf(Hn1);if(D!==-1){let z=J.slice(0,D),G=J.slice(D+1,B.length);if(qn1.validateKey(z)&&qn1.validateValue(G))Q.set(z,G)}return Q},new Map),this._internalState.size>Zn1)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Zn1))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let A=new pY1;return A._internalState=new Map(this._internalState),A}}Fn1.TraceStateImpl=pY1});var In1=n((Wn1)=>{Object.defineProperty(Wn1,"__esModule",{value:!0});Wn1.createTraceState=void 0;var zCA=Mn1();function GCA(A){return new zCA.TraceStateImpl(A)}Wn1.createTraceState=GCA});var On1=n((Nn1)=>{Object.defineProperty(Nn1,"__esModule",{value:!0});Nn1.context=void 0;var XCA=jb();Nn1.context=XCA.ContextAPI.getInstance()});var Rn1=n((Cn1)=>{Object.defineProperty(Cn1,"__esModule",{value:!0});Cn1.diag=void 0;var KCA=U3();Cn1.diag=KCA.DiagAPI.instance()});var $n1=n((jn1)=>{Object.defineProperty(jn1,"__esModule",{value:!0});jn1.NOOP_METER_PROVIDER=jn1.NoopMeterProvider=void 0;var YCA=OY1();class cY1{getMeter(A,Q,B){return YCA.NOOP_METER}}jn1.NoopMeterProvider=cY1;jn1.NOOP_METER_PROVIDER=new cY1});var vn1=n((Pn1)=>{Object.defineProperty(Pn1,"__esModule",{value:!0});Pn1.MetricsAPI=void 0;var ZCA=$n1(),lY1=Z3(),_n1=U3(),dY1="metrics";class iY1{constructor(){}static getInstance(){if(!this._instance)this._instance=new iY1;return this._instance}setGlobalMeterProvider(A){return lY1.registerGlobal(dY1,A,_n1.DiagAPI.instance())}getMeterProvider(){return lY1.getGlobal(dY1)||ZCA.NOOP_METER_PROVIDER}getMeter(A,Q,B){return this.getMeterProvider().getMeter(A,Q,B)}disable(){lY1.unregisterGlobal(dY1,_n1.DiagAPI.instance())}}Pn1.MetricsAPI=iY1});var yn1=n((kn1)=>{Object.defineProperty(kn1,"__esModule",{value:!0});kn1.metrics=void 0;var UCA=vn1();kn1.metrics=UCA.MetricsAPI.getInstance()});var hn1=n((gn1)=>{Object.defineProperty(gn1,"__esModule",{value:!0});gn1.NoopTextMapPropagator=void 0;class bn1{inject(A,Q){}extract(A,Q){return A}fields(){return[]}}gn1.NoopTextMapPropagator=bn1});var cn1=n((un1)=>{Object.defineProperty(un1,"__esModule",{value:!0});un1.deleteBaggage=un1.setBaggage=un1.getActiveBaggage=un1.getBaggage=void 0;var HCA=jb(),FCA=Lb(),aY1=FCA.createContextKey("OpenTelemetry Baggage Key");function mn1(A){return A.getValue(aY1)||void 0}un1.getBaggage=mn1;function ECA(){return mn1(HCA.ContextAPI.getInstance().active())}un1.getActiveBaggage=ECA;function MCA(A,Q){return A.setValue(aY1,Q)}un1.setBaggage=MCA;function WCA(A){return A.deleteValue(aY1)}un1.deleteBaggage=WCA});var rn1=n((in1)=>{Object.defineProperty(in1,"__esModule",{value:!0});in1.PropagationAPI=void 0;var rY1=Z3(),VCA=hn1(),ln1=LY1(),Hs=cn1(),OCA=UY1(),dn1=U3(),nY1="propagation",CCA=new VCA.NoopTextMapPropagator;class sY1{constructor(){this.createBaggage=OCA.createBaggage,this.getBaggage=Hs.getBaggage,this.getActiveBaggage=Hs.getActiveBaggage,this.setBaggage=Hs.setBaggage,this.deleteBaggage=Hs.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new sY1;return this._instance}setGlobalPropagator(A){return rY1.registerGlobal(nY1,A,dn1.DiagAPI.instance())}inject(A,Q,B=ln1.defaultTextMapSetter){return this._getGlobalPropagator().inject(A,Q,B)}extract(A,Q,B=ln1.defaultTextMapGetter){return this._getGlobalPropagator().extract(A,Q,B)}fields(){return this._getGlobalPropagator().fields()}disable(){rY1.unregisterGlobal(nY1,dn1.DiagAPI.instance())}_getGlobalPropagator(){return rY1.getGlobal(nY1)||CCA}}in1.PropagationAPI=sY1});var on1=n((nn1)=>{Object.defineProperty(nn1,"__esModule",{value:!0});nn1.propagation=void 0;var LCA=rn1();nn1.propagation=LCA.PropagationAPI.getInstance()});var Js1=n((Qs1)=>{Object.defineProperty(Qs1,"__esModule",{value:!0});Qs1.TraceAPI=void 0;var oY1=Z3(),tn1=gY1(),en1=Us(),qT=vY1(),As1=U3(),tY1="trace";class eY1{constructor(){this._proxyTracerProvider=new tn1.ProxyTracerProvider,this.wrapSpanContext=en1.wrapSpanContext,this.isSpanContextValid=en1.isSpanContextValid,this.deleteSpan=qT.deleteSpan,this.getSpan=qT.getSpan,this.getActiveSpan=qT.getActiveSpan,this.getSpanContext=qT.getSpanContext,this.setSpan=qT.setSpan,this.setSpanContext=qT.setSpanContext}static getInstance(){if(!this._instance)this._instance=new eY1;return this._instance}setGlobalTracerProvider(A){let Q=oY1.registerGlobal(tY1,this._proxyTracerProvider,As1.DiagAPI.instance());if(Q)this._proxyTracerProvider.setDelegate(A);return Q}getTracerProvider(){return oY1.getGlobal(tY1)||this._proxyTracerProvider}getTracer(A,Q){return this.getTracerProvider().getTracer(A,Q)}disable(){oY1.unregisterGlobal(tY1,As1.DiagAPI.instance()),this._proxyTracerProvider=new tn1.ProxyTracerProvider}}Qs1.TraceAPI=eY1});var Gs1=n((Ds1)=>{Object.defineProperty(Ds1,"__esModule",{value:!0});Ds1.trace=void 0;var RCA=Js1();Ds1.trace=RCA.TraceAPI.getInstance()});var ZT=n((T4)=>{Object.defineProperty(T4,"__esModule",{value:!0});T4.trace=T4.propagation=T4.metrics=T4.diag=T4.context=T4.INVALID_SPAN_CONTEXT=T4.INVALID_TRACEID=T4.INVALID_SPANID=T4.isValidSpanId=T4.isValidTraceId=T4.isSpanContextValid=T4.createTraceState=T4.TraceFlags=T4.SpanStatusCode=T4.SpanKind=T4.SamplingDecision=T4.ProxyTracerProvider=T4.ProxyTracer=T4.defaultTextMapSetter=T4.defaultTextMapGetter=T4.ValueType=T4.createNoopMeter=T4.DiagLogLevel=T4.DiagConsoleLogger=T4.ROOT_CONTEXT=T4.createContextKey=T4.baggageEntryMetadataFromString=void 0;var jCA=UY1();Object.defineProperty(T4,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return jCA.baggageEntryMetadataFromString}});var Xs1=Lb();Object.defineProperty(T4,"createContextKey",{enumerable:!0,get:function(){return Xs1.createContextKey}});Object.defineProperty(T4,"ROOT_CONTEXT",{enumerable:!0,get:function(){return Xs1.ROOT_CONTEXT}});var TCA=Jr1();Object.defineProperty(T4,"DiagConsoleLogger",{enumerable:!0,get:function(){return TCA.DiagConsoleLogger}});var $CA=Xs();Object.defineProperty(T4,"DiagLogLevel",{enumerable:!0,get:function(){return $CA.DiagLogLevel}});var _CA=OY1();Object.defineProperty(T4,"createNoopMeter",{enumerable:!0,get:function(){return _CA.createNoopMeter}});var PCA=Er1();Object.defineProperty(T4,"ValueType",{enumerable:!0,get:function(){return PCA.ValueType}});var Ks1=LY1();Object.defineProperty(T4,"defaultTextMapGetter",{enumerable:!0,get:function(){return Ks1.defaultTextMapGetter}});Object.defineProperty(T4,"defaultTextMapSetter",{enumerable:!0,get:function(){return Ks1.defaultTextMapSetter}});var SCA=bY1();Object.defineProperty(T4,"ProxyTracer",{enumerable:!0,get:function(){return SCA.ProxyTracer}});var vCA=gY1();Object.defineProperty(T4,"ProxyTracerProvider",{enumerable:!0,get:function(){return vCA.ProxyTracerProvider}});var kCA=Bn1();Object.defineProperty(T4,"SamplingDecision",{enumerable:!0,get:function(){return kCA.SamplingDecision}});var fCA=Dn1();Object.defineProperty(T4,"SpanKind",{enumerable:!0,get:function(){return fCA.SpanKind}});var yCA=Gn1();Object.defineProperty(T4,"SpanStatusCode",{enumerable:!0,get:function(){return yCA.SpanStatusCode}});var bCA=_Y1();Object.defineProperty(T4,"TraceFlags",{enumerable:!0,get:function(){return bCA.TraceFlags}});var gCA=In1();Object.defineProperty(T4,"createTraceState",{enumerable:!0,get:function(){return gCA.createTraceState}});var Aq1=Us();Object.defineProperty(T4,"isSpanContextValid",{enumerable:!0,get:function(){return Aq1.isSpanContextValid}});Object.defineProperty(T4,"isValidTraceId",{enumerable:!0,get:function(){return Aq1.isValidTraceId}});Object.defineProperty(T4,"isValidSpanId",{enumerable:!0,get:function(){return Aq1.isValidSpanId}});var Qq1=qs();Object.defineProperty(T4,"INVALID_SPANID",{enumerable:!0,get:function(){return Qq1.INVALID_SPANID}});Object.defineProperty(T4,"INVALID_TRACEID",{enumerable:!0,get:function(){return Qq1.INVALID_TRACEID}});Object.defineProperty(T4,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return Qq1.INVALID_SPAN_CONTEXT}});var Ys1=On1();Object.defineProperty(T4,"context",{enumerable:!0,get:function(){return Ys1.context}});var qs1=Rn1();Object.defineProperty(T4,"diag",{enumerable:!0,get:function(){return qs1.diag}});var Zs1=yn1();Object.defineProperty(T4,"metrics",{enumerable:!0,get:function(){return Zs1.metrics}});var Us1=on1();Object.defineProperty(T4,"propagation",{enumerable:!0,get:function(){return Us1.propagation}});var Hs1=Gs1();Object.defineProperty(T4,"trace",{enumerable:!0,get:function(){return Hs1.trace}});T4.default={context:Ys1.context,diag:qs1.diag,metrics:Zs1.metrics,propagation:Us1.propagation,trace:Hs1.trace}});function uCA(){return mCA}function Es1(A){UT=A}var Fs1,mCA=!1,pCA,UT,cCA,N1;var iA=j1(()=>{Fs1=WA(ZT(),1);pCA={error:(A,...Q)=>console.error(A,...Q),warn:(A,...Q)=>console.warn(A,...Q),info:(A,...Q)=>console.info(A,...Q),debug:(A,...Q)=>{if(uCA())console.debug(A,...Q)},audit:(A,...Q)=>{let B=Q.length>0?Q[0]:{};if(typeof B==="object"&&B!==null&&!("audit"in B))B.audit=!0;let J=Fs1.trace.getActiveSpan();if(J){let D=J.spanContext();if(D.traceId)B.traceId=D.traceId,B.spanId=D.spanId}console.info(A,B)}},UT=pCA;cCA={error:(A,...Q)=>UT.error(A,...Q),warn:(A,...Q)=>UT.warn(A,...Q),info:(A,...Q)=>UT.info(A,...Q),debug:(A,...Q)=>UT.debug(A,...Q),audit:(A,...Q)=>UT.audit(A,...Q)},N1=cCA});function xW(A){let Q=typeof A==="string"?A:A.toString();return Q===fz||Q===fz.slice(0,-1)}function Tb(A){return xW(A)?fz:A}var lCA,fz,dCA,iR2;var H3=j1(()=>{lCA=new URL("https://ampcode.com/"),fz=lCA.toString(),dCA=new URL("https://api.anthropic.com/"),iR2=dCA.toString()});function Fs(A){Promise.resolve().then(()=>{try{A()}catch(Q){console.error(Q)}})}function Ms1(A){let Q=A._cleanup;if(Q===void 0)return;if(A._cleanup=void 0,!Q)return;try{if(typeof Q==="function")Q();else if(Q&&typeof Q.unsubscribe==="function")Q.unsubscribe()}catch(B){console.error("cleanupSubscription",B)}}function Jq1(A){A._observer=void 0,A._queue=void 0,A._state="closed"}function iCA(A){let Q=A._queue;if(!Q)return;A._queue=void 0,A._state="ready";for(let B of Q)if(Ws1(A,B.type,B.value),A._state==="closed")break}function Ws1(A,Q,B){A._state="running";let J=A._observer;try{switch(Q){case"next":if(J&&typeof J.next==="function")J.next(B);break;case"error":if(Jq1(A),J&&typeof J.error==="function")J.error(B);else throw B;break;case"complete":if(Jq1(A),J&&typeof J.complete==="function")J.complete();break}}catch(D){console.error("notifySubscription",D)}if(A._state==="closed")Ms1(A);else if(A._state==="running")A._state="ready"}function Bq1(A,Q,B){if(A._state==="closed")return;if(A._state==="buffering"){A._queue=A._queue||[],A._queue.push({type:Q,value:B});return}if(A._state!=="ready"){A._state="buffering",A._queue=[{type:Q,value:B}],Fs(()=>iCA(A));return}Ws1(A,Q,B)}class ws1{_cleanup;_observer;_queue;_state;constructor(A,Q){this._cleanup=void 0,this._observer=A,this._queue=void 0,this._state="initializing";let B=new Is1(this);try{this._cleanup=Q.call(void 0,B)}catch(J){B.error(J)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")Jq1(this),Ms1(this)}}class Is1{_subscription;constructor(A){this._subscription=A}get closed(){return this._subscription._state==="closed"}next(A){Bq1(this._subscription,"next",A)}error(A){Bq1(this._subscription,"error",A)}complete(){Bq1(this._subscription,"complete")}}function u5(A){if(typeof A==="function")A();else if(A&&typeof A.unsubscribe==="function")A.unsubscribe()}class HT{_baseObserver;_pendingPromises;constructor(A){this._baseObserver=A,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch((A)=>this._baseObserver.error(A))}error(A){this._baseObserver.error(A)}schedule(A){let Q=Promise.all(this._pendingPromises),B=[],J=(z)=>B.push(z),D=Promise.resolve().then(async()=>{await Q,await A(J),this._pendingPromises.delete(D);for(let z of B)this._baseObserver.next(z)}).catch((z)=>{this._pendingPromises.delete(D),this._baseObserver.error(z)});this._pendingPromises.add(D)}}var GA;var $b=j1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");GA=class GA{_subscriber;constructor(A){if(!(this instanceof GA))throw new TypeError("Observable cannot be called as a function");if(typeof A!=="function")throw new TypeError("Observable initializer must be a function");this._subscriber=A}subscribe(A,Q,B){if(typeof A!=="object"||A===null)A={next:A,error:Q,complete:B};return new ws1(A,this._subscriber)}pipe(A,...Q){let B=this;for(let J of[A,...Q])B=J(B);return B}[Symbol.observable](){return this}static from(A){let Q=typeof this==="function"?this:GA;if(A==null)throw new TypeError(A+" is not an object");let B=A[Symbol.observable];if(typeof B==="function"){let D=B.call(A);if(Object(D)!==D)throw new TypeError(D+" is not an object");if(D instanceof GA)return D;return new Q((z)=>D.subscribe(z))}let J=A[Symbol.iterator];if(typeof J==="function")return new Q((D)=>{Fs(()=>{if(D.closed)return;for(let z of J.call(A))if(D.next(z),D.closed)return;D.complete()})});if(Array.isArray(A))return new Q((D)=>{Fs(()=>{if(D.closed)return;for(let z of A)if(D.next(z),D.closed)return;D.complete()})});throw new TypeError(A+" is not observable")}static of(...A){return new(typeof this==="function"?this:GA)((B)=>{Fs(()=>{if(B.closed)return;for(let J of A)if(B.next(J),B.closed)return;B.complete()})})}static get[Symbol.species](){return this}}});var R8,pQ;var Es=j1(()=>{$b();R8=class R8 extends GA{_observers=new Set;constructor(){super((A)=>{return this._observers.add(A),()=>this._observers.delete(A)})}next(A){for(let Q of this._observers)Q.next(A)}error(A){for(let Q of this._observers)Q.error(A)}complete(){for(let A of this._observers)A.complete()}};pQ=class pQ extends R8{currentValue;constructor(A){super();this.currentValue=A}next(A){this.currentValue=A,super.next(A)}subscribe(A,Q,B){if(typeof A!=="object"||A===null){let J={};if(A)J.next=A;if(Q)J.error=Q;if(B)J.complete=B;A=J}return A.next?.(this.currentValue),super.subscribe(A)}getValue(){return this.currentValue}}});function Ns1(){let A=new Set,Q=new pQ(A);return{add(B){A.add(B),Q.next(A)},delete(B){A.delete(B),Q.next(A)},set:A,observable:Q}}function Vs1(){let A=new Map,Q=new pQ(A);return{get(B){return A.get(B)},set(B,J){A.set(B,J),Q.next(A)},delete(B){A.delete(B),Q.next(A)},map:A,observable:Q}}var Os1=j1(()=>{Es()});function Ms(A,Q){if(A===Q)return!0;if(A==null||Q==null||typeof A!=="object"||typeof Q!=="object")return!1;let B=Array.isArray(A),J=Array.isArray(Q);if(B!==J)return!1;if(B&&J)return A.length===Q.length&&A.every((z,G)=>Ms(z,Q[G]));let D=new Set([...Object.keys(A),...Object.keys(Q)]);for(let z of D)if(!Ms(A[z],Q[z]))return!1;return!0}function Dq1(A){return{dispose:A.unsubscribe.bind(A)}}async function rA(A,Q){return new Promise((B,J)=>{let D=void 0,z=()=>{D?.unsubscribe(),J(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",z,{once:!0}),D=A.subscribe({next:(G)=>{D?.unsubscribe(),Q?.removeEventListener("abort",z),B(G)},error:(G)=>{Q?.removeEventListener("abort",z),J(G)},complete:()=>{Q?.removeEventListener("abort",z),J("Observable completed without emitting a value")}})})}async function LF(A,Q){return new Promise((B,J)=>{let D,z=!1,G=void 0,X=()=>{G?.unsubscribe(),J(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",X,{once:!0}),G=A.subscribe({next:(K)=>{D=K,z=!0},error:(K)=>{Q?.removeEventListener("abort",X),J(K)},complete:()=>{if(Q?.removeEventListener("abort",X),z)B(D);else J("Observable completed without emitting a value")}})})}function FT(A){return new GA((Q)=>{A.then((B)=>{Q.next(B),Q.complete()}).catch((B)=>{Q.error(B)})})}function M8(A){return new GA((Q)=>{let B=!1,J=new AbortController,D=J.signal;return(async()=>{try{D?.throwIfAborted();let G=await A(D);if(D?.throwIfAborted(),!B)Q.next(G),Q.complete()}catch(G){if(!B)if(D.aborted)Q.complete();else Q.error(G)}})(),()=>{B=!0,J.abort()}})}function Ls1(){let A=null,Q=[];return{observable:new GA((D)=>{let z=A?A.subscribe(D):null,G={observer:D,subscription:z};return Q.push(G),()=>{G.subscription?.unsubscribe();let X=Q.indexOf(G);if(X!==-1)Q.splice(X,1)}}),setSource:(D,z=!0)=>{if(A&&z)throw new Error("source is already set");A=D;for(let G of Q)G.subscription?.unsubscribe();for(let G of Q)G.subscription=A.subscribe(G.observer)}}}function U2(A){return(Q)=>{return new GA((B)=>{let J=new HT(B),D=0,z=Q.subscribe({complete(){J.complete()},error(G){J.error(G)},next(G){J.schedule(async(X)=>{let K=await A(G,D);D++,X(K)})}});return()=>u5(z)})}}function F3(...A){return new GA((Q)=>{let B=0,J=A.map((D)=>D.subscribe({next:(z)=>Q.next(z),error:(z)=>Q.error(z),complete:()=>{if(B++,B===A.length)Q.complete()}}));return()=>{Rs1(J)}})}function j5(...A){if(A.length===0)return zq1;return new GA((Q)=>{let B=new Array(A.length),J=new Array(A.length).fill(0),D=new Array(A.length).fill(!1),z=0,G=[],X=new HT(Q);for(let K=0;K<A.length;K++){let Y=A[K];G.push(Y.subscribe({next(q){B[K]=q,D[K]=!0;let Z=++J[K];if(D.every(Boolean))X.schedule(async(H)=>{if(J[K]===Z)H([...B])})},error(q){X.error(q)},complete(){if(z++,z===A.length)X.complete()}}))}return()=>{Rs1(G)}})}function CB(A){let B=A?.shouldCountRefs??!0,J=aCA++,D=(z,...G)=>{};return(z)=>{let G=new R8,X=null,K=!1,Y,q=0;return new GA((Z)=>{if(q++,K)D("new subscriber, emitting buffered value",Y),Z.next(Y);else D("new subscriber, no buffered value to emit");if(!X)X=z.subscribe({next:(F)=>{K=!0,Y=F,G.next(F)},error:(F)=>G.error(F),complete:()=>G.complete()});let H=G.subscribe(Z);return()=>{if(q--,H.unsubscribe(),B&&q===0){if(X)u5(X),X=null;K=!1}}})}}function Rs1(A){for(let Q of A)if(Q)u5(Q)}function Pb(A){return(Q)=>{return new GA((B)=>{let J=Q.subscribe({next:(z)=>B.next(z),error:(z)=>B.error(z),complete:()=>B.complete()}),D=A.subscribe({next:()=>{B.complete(),J.unsubscribe(),D.unsubscribe()},error:(z)=>{B.error(z),J.unsubscribe()}});return()=>{J.unsubscribe(),D.unsubscribe()}})}}function hW(A){return(Q)=>{return new GA((B)=>{let J,D=Q.subscribe({next(z){J=z,B.next(z)},error(z){B.error(z)},complete(){B.complete()}});return()=>{u5(D),A(J)}})}}function G7(A=Ms){return(Q)=>{return new GA((B)=>{let J=Cs1,D=new HT(B),z=Q.subscribe({complete(){D.complete()},error(G){D.error(G)},next(G){D.schedule(async(X)=>{if(J===Cs1||!A(J,G))J=G,X(G)})}});return()=>u5(z)})}}function RF(A){return rCA(typeof A==="function"?{next:A}:A)}function rCA(A){return(Q)=>new GA((B)=>{let J=typeof A==="function"?A():A,D=Q.subscribe({next(z){if(J.next)try{J.next(z)}catch(G){B.error(G);return}B.next(z)},error(z){if(J.error)try{J.error(z)}catch(G){B.error(G);return}B.error(z)},complete(){if(J.complete)try{J.complete()}catch(z){B.error(z);return}B.complete()}});return()=>u5(D)})}function Gq1(A){return(Q)=>{return new GA((B)=>{let J=!1,D=Q.subscribe({next:(G)=>{J=!0,clearTimeout(z),B.next(G)},error:(G)=>{clearTimeout(z),B.error(G)},complete:()=>{clearTimeout(z),B.complete()}}),z=setTimeout(()=>{if(!J)D.unsubscribe(),B.error(new js1(`Operation timed out after ${A}ms`))},A);return()=>{clearTimeout(z),D.unsubscribe()}})}}function L7(A){return(Q)=>new GA((B)=>{let J;try{B.next(A),J=Q.subscribe({next(D){B.next(D)},error(D){B.error(D)},complete(){B.complete()}})}catch(D){B.error(D)}return()=>{if(J)u5(J)}})}function Xq1(A){return(Q)=>new GA((B)=>{let J=0,D=Q.subscribe({next(z){if(J<A){if(B.next(z),J++,J===A)B.complete(),u5(D)}},error(z){B.error(z)},complete(){B.complete()}});return()=>{u5(D)}})}function y9(A){return(Q)=>{return new GA((B)=>{let J=0,D=null,z=!1,G=()=>{if(z&&!D)B.complete()},X=Q.subscribe({next(K){if(D)u5(D),D=null;let Y;try{Y=A(K,J++)}catch(q){B.error(q);return}D=Y.subscribe({next(q){B.next(q)},error(q){B.error(q)},complete(){D=null,G()}})},error(K){B.error(K)},complete(){z=!0,G()}});return()=>{if(u5(X),D)u5(D)}})}}function Ws(A){let Q={last:void 0,isSet:!1},B=A.subscribe((J)=>{Object.assign(Q,{last:J,isSet:!0})});return{value:Q,observable:A,subscription:B}}function dG(A){return(Q)=>new GA((B)=>{let J=null,D=null,z=!1,G=Q.subscribe({next:(X)=>{if(D=X,z=!0,J===null)J=setTimeout(()=>{if(z)B.next(D),z=!1;J=null},A)},error:(X)=>B.error(X),complete:()=>{if(J!==null)clearTimeout(J);if(z)B.next(D);B.complete()}});return()=>{if(u5(G),J!==null)clearTimeout(J)}})}function Kq1(A,Q){if(!Q.leading||!Q.trailing)throw new Error("leading and trailing must be true");return(B)=>new GA((J)=>{let D=0,z=null,G=null,X=!1,K=B.subscribe({next:(Y)=>{let q=Date.now();if(G=Y,X=!0,q-D>=A)J.next(Y),D=q,X=!1;else if(z===null)z=setTimeout(()=>{if(X)J.next(G),D=Date.now(),X=!1;z=null},A-(q-D));if(D===0)J.next(Y),D=q,X=!1},error:(Y)=>J.error(Y),complete:()=>{if(z!==null)clearTimeout(z);if(X)J.next(G);J.complete()}});return()=>{if(u5(K),z!==null)clearTimeout(z)}})}function E3(...A){return new GA((Q)=>{let B=0,J=null;function D(){if(B>=A.length){Q.complete();return}J=A[B].subscribe({next:(G)=>Q.next(G),error:(G)=>Q.error(G),complete:()=>{B++,D()}})}return D(),()=>{if(J)u5(J)}})}function Yq1(A){return(Q)=>new GA((B)=>{let J=0,D=!1,z=null,G=Q.subscribe({next(X){try{let K=A(X,J++);if(z)u5(z);z=K.subscribe({next(Y){B.next(Y)},error(Y){B.error(Y)},complete(){if(z=null,D&&!z)B.complete()}})}catch(K){B.error(K)}},error(X){B.error(X)},complete(){if(D=!0,!z)B.complete()}});return()=>{if(u5(G),z)u5(z)}})}function ws({onSubscribe:A,onUnsubscribe:Q}){return(B)=>new GA((J)=>{A?.();let D=B.subscribe(J);return()=>{u5(D),Q?.()}})}function jF(A){return(Q)=>GA.from(Q).pipe(y9((B)=>M8((J)=>A(B,J))))}function mW(A){return(Q)=>new GA((B)=>{let J,D=Q.subscribe({next(z){B.next(z)},error(z){try{J=A(z).subscribe({next(X){B.next(X)},error(X){B.error(X)},complete(){B.complete()}})}catch(G){B.error(G)}},complete(){B.complete()}});return()=>{if(u5(D),J)u5(J)}})}function mJ(A){return(Q)=>{return new GA((B)=>{let J=Q.subscribe({next(D){if(A(D))B.next(D)},error(D){B.error(D)},complete(){B.complete()}});return()=>u5(J)})}}function Ts1(A,Q){return(B)=>{return new GA((J)=>{let D,z=0,G=new HT(J),X=B.subscribe({complete(){G.complete()},error(K){G.error(K)},next(K){G.schedule(async(Y)=>{D=await A(z===0?typeof Q==="undefined"?K:Q:D,K,z++),Y(D)})}});return()=>u5(X)})}}var zq1,_b,Jj2,aCA=0,Cs1,js1;var qq1=j1(()=>{$b();Es();zq1=new GA((A)=>{A.complete()}),_b=new GA(()=>{});Jj2=Symbol("noInitialValue");Cs1={};js1=class js1 extends Error{constructor(A="Timeout has occurred"){super(A);this.name="TimeoutError"}}});function ET(A,Q){return(B)=>{return GA.from(B).pipe(y9((J)=>J===iG?GA.of(iG):A(J).pipe(mW((D)=>GA.of(D instanceof Error?D:new Error(D))),L7(iG))),CB(Q))}}function nCA(){return(A)=>GA.from(A).pipe(mJ((Q)=>Q!==iG))}async function Sb(A,Q){let B=await rA(GA.from(A).pipe(nCA()),Q);if(B instanceof Error)throw B;return B}var iG;var $s1=j1(()=>{$b();qq1();iG=Symbol.for("@@pendingOperation")});var O6=j1(()=>{Os1();$b();$s1();qq1();Es()});function Ps1(A){_s1.setSource(A.pipe(CB()),!1)}var _s1,h2;var NQ=j1(()=>{O6();_s1=Ls1();h2=_s1.observable});function Ss1(){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 vs1(A,Q){if(!A.scheme&&Q)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${A.authority}", path: "${A.path}", query: "${A.query}", fragment: "${A.fragment}"}`);if(A.scheme&&!sCA.test(A.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(A.path){if(A.authority){if(!oCA.test(A.path))throw new 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(tCA.test(A.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function eCA(A,Q){if(!A&&!Q)return"file";return A}function ALA(A,Q){switch(A){case"https":case"http":case"file":if(!Q)Q=pY;else if(Q[0]!==pY)Q=pY+Q;break}return Q}class C6{static isUri(A){if(A instanceof C6)return!0;if(!A)return!1;let Q=A;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(A,Q,B,J,D,z=!1,G){if(typeof A==="object")this.scheme=A.scheme||a4,this.authority=A.authority||a4,this.path=A.path||a4,this.query=A.query||a4,this.fragment=A.fragment||a4,this.platform=A.platform;else this.scheme=eCA(A,z),this.authority=Q||a4,this.path=ALA(this.scheme,B||a4),this.query=J||a4,this.fragment=D||a4,this.platform=G,vs1(this,z)}get fsPath(){return gs1(this,!1)}with(A){if(!A)return this;let{scheme:Q,authority:B,path:J,query:D,fragment:z,platform:G}=A;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=a4;if(B===void 0)B=this.authority;else if(B===null)B=a4;if(J===void 0)J=this.path;else if(J===null)J=a4;if(D===void 0)D=this.query;else if(D===null)D=a4;if(z===void 0)z=this.fragment;else if(z===null)z=a4;if(G===void 0)G=this.platform;else if(G===null)G=void 0;if(Q===this.scheme&&B===this.authority&&J===this.path&&D===this.query&&z===this.fragment&&G===this.platform)return this;return new M3(Q,B,J,D,z,!1,G)}static parse(A,Q=!1){let B=QLA.exec(A);if(!B)return new M3(a4,a4,a4,a4,a4);return new M3(B[2]||a4,Is(B[4]||a4),Is(B[5]||a4),Is(B[7]||a4),Is(B[9]||a4),Q)}static file(A,Q=Ss1()){let B=a4;if(Q==="windows")A=A.replace(/\\/g,pY);if(A[0]===pY&&A[1]===pY){let J=A.indexOf(pY,2);if(J===-1)B=A.substring(2),A=pY;else B=A.substring(2,J),A=A.substring(J)||pY}return new M3("file",B,A,a4,a4,!1,Q)}static from(A){let Q=new M3(A.scheme,A.authority,A.path,A.query,A.fragment,!0,A.platform);return vs1(Q,!0),Q}toString(A=!1){return Zq1(this,A)}toJSON(){return this}static revive(A){if(!A)return A;if(A instanceof C6)return A;let Q=new M3(A),B=A;return Q._formatted=B.external,Q._fsPath=B._sep===ys1(Q.platform)?B.fsPath:null,Q}}function ys1(A){return A==="windows"?1:void 0}function ks1(A,Q,B){let J=void 0;for(let D=0;D<A.length;D++){let z=A.charCodeAt(D);if(z>=97&&z<=122||z>=65&&z<=90||z>=48&&z<=57||z===45||z===46||z===95||z===126||Q&&z===47||B&&z===91||B&&z===93||B&&z===58){if(J!==void 0)J+=A.charAt(D)}else{if(J===void 0)J=A.substring(0,D);let G=bs1[z];if(G!==void 0)J+=G;else J+=encodeURIComponent(A.charAt(D))}}return J!==void 0?J:A}function BLA(A){let Q=void 0;for(let B=0;B<A.length;B++){let J=A.charCodeAt(B);if(J===35||J===63){if(Q===void 0)Q=A.substring(0,B);Q+=bs1[J]}else if(Q!==void 0)Q+=A[B]}return Q!==void 0?Q:A}function gs1(A,Q){let B;if(A.authority&&A.path.length>1&&A.scheme==="file")B=`//${A.authority}${A.path}`;else if(A.path.charCodeAt(0)===47&&(A.path.charCodeAt(1)>=65&&A.path.charCodeAt(1)<=90||A.path.charCodeAt(1)>=97&&A.path.charCodeAt(1)<=122)&&A.path.charCodeAt(2)===58)if(!Q)B=A.path[1].toLowerCase()+A.path.substring(2);else B=A.path.substring(1);else B=A.path;if(A.platform==="windows")B=B.replace(/\//g,"\\");return B}function Zq1(A,Q){let B=!Q?ks1:BLA,J="",{scheme:D,authority:z,path:G,query:X,fragment:K}=A;if(D)J+=D,J+=":";if(z||D==="file")J+=pY,J+=pY;if(z){let Y=z.indexOf("@");if(Y!==-1){let q=z.substring(0,Y);if(z=z.substring(Y+1),Y=q.lastIndexOf(":"),Y===-1)J+=B(q,!1,!1);else J+=B(q.substring(0,Y),!1,!1),J+=":",J+=B(q.substring(Y+1),!1,!0);J+="@"}if(z=z.toLowerCase(),Y=z.lastIndexOf(":"),Y===-1)J+=B(z,!1,!0);else J+=B(z.substring(0,Y),!1,!0),J+=z.substring(Y)}if(G){if(G.length>=3&&G.charCodeAt(0)===47&&G.charCodeAt(2)===58){let Y=G.charCodeAt(1);if(Y>=65&&Y<=90)G=`/${String.fromCharCode(Y+32)}:${G.substring(3)}`}else if(G.length>=2&&G.charCodeAt(1)===58){let Y=G.charCodeAt(0);if(Y>=65&&Y<=90)G=`${String.fromCharCode(Y+32)}:${G.substring(2)}`}J+=B(G,!0,!1)}if(X)J+="?",J+=B(X,!1,!1);if(K)J+="#",J+=!Q?ks1(K,!1,!1):K;return J}function xs1(A){try{return decodeURIComponent(A)}catch{if(A.length>3)return A.substring(0,3)+xs1(A.substring(3));else return A}}function Is(A){if(!A.match(fs1))return A;return A.replace(fs1,(Q)=>xs1(Q))}function uW(A){return A.scheme==="file"}function TF(A){return C6.parse(A)}function f8(A){return A.toString()}function J4(A){if(typeof A==="string"||A instanceof URL)return C6.parse(A.toString());return A}var sCA,oCA,tCA,a4="",pY="/",QLA,M3,bs1,fs1;var Ns=j1(()=>{sCA=/^\w[\w\d+.-]*$/,oCA=/^\//,tCA=/^\/\//;QLA=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;M3=class M3 extends C6{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=gs1(this,!1);return this._fsPath}toString(A=!1){if(!A){if(!this._formatted)this._formatted=Zq1(this,!1);return this._formatted}return Zq1(this,!0)}toJSON(){let A={};if(this._fsPath)A.fsPath=this._fsPath,A._sep=ys1(this.platform);if(this._formatted)A.external=this._formatted;if(A.scheme=this.scheme,A.authority=this.authority,A.path=this.path,A.query=this.query,A.fragment=this.fragment,this.platform)A.platform=this.platform;return A}};bs1={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"};fs1=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function Uq1(A){if(A==="/")return"/";if(A==="")return".";let Q=A.replace(/\/+$/,"");if(!Q)return".";let B=Q.lastIndexOf("/");if(B===-1)return".";if(B===0)return"/";return Q.slice(0,B)}function W3(A){let Q=A.replace(/\/+$/,"");if(!Q)return"";let B=Q.lastIndexOf("/");return B===-1?Q:Q.slice(B+1)}function Vs(...A){if(A.length===0)return".";let Q="";for(let G of A)if(G)if(Q)Q+="/"+G;else Q=G;if(!Q)return".";let B=Q.endsWith("/"),J=Q.split("/").filter(Boolean),D=[];for(let G of J)if(G===".."){if(D.length>0&&D[D.length-1]!=="..")D.pop();else if(!Q.startsWith("/"))D.push("..")}else if(G!==".")D.push(G);let z=Q.startsWith("/")?"/"+D.join("/"):D.join("/");if(!z)z=Q.startsWith("/")?"/":".";if(B&&z!=="/"&&z!==".")z+="/";return z}function hs1(A,Q,B="/",J="/",D=!0){function z(Z,H){return D?Z===H:Z.toLowerCase()===H.toLowerCase()}if(B==="/")A=A.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else A=A.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(A!==B&&A.endsWith(B))A=A.slice(0,-1);if(Q!==B&&Q.endsWith(B))Q=Q.slice(0,-1);if(z(A,Q))return"";if(!A.startsWith(B)&&Q.startsWith(B))return Q;let G=A===B?[""]:A.split(B),X=Q===B?[""]:Q.split(B),K=0;while(K<G.length&&K<X.length&&z(G[K],X[K]))K++;let Y=G.length-K,q=[];for(let Z=0;Z<Y;Z++)q.push("..");return q.push(...X.slice(K)),q.join(J)}function Os(A){let Q=W3(A.replace(/\/+$/,"")),B=Q.lastIndexOf(".");if(B===0||B===-1)return"";return Q.slice(B)}function pW(A){if(A=J4(A),A.scheme==="file")return A.path;return A.toString()}var vb=j1(()=>{Ns()});function JLA(A,...Q){return A=J4(A),A.with({path:Vs(A.path,...Q)})}function DLA(A,...Q){let B=A.path,J=!1;if(B[0]!==Cs)B=Cs+B,J=!0;let D=B;for(let z of Q)if(z.startsWith("/"))D=Vs(z);else D=Vs(D,z);if(D!=="/"&&D.endsWith("/"))D=D.replace(/\/+$/,"");if(J&&D[0]===Cs&&!A.authority)D=D.substring(1);return A.with({path:D})}function zLA(A){if(A=J4(A),A.path.length===0||A.path===Cs)return A;let Q=Uq1(A.path);if(Q.length===1&&Q===".")Q="";return A.with({path:Q})}function GLA(A,Q){if(Q.scheme!==A.scheme||(Q.authority??"")!==(A.authority??""))return!1;let B=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),J=B?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,D=B?A.path.slice(0,2).toUpperCase()+A.path.slice(2):A.path;return D===J||D.startsWith(J.endsWith("/")?J:`${J}/`)||J.endsWith("/")&&D===J.slice(0,-1)}function XLA(A,Q){if(A.scheme!==Q.scheme||A.authority!==Q.authority||A.query!==Q.query||A.fragment!==Q.fragment)return null;let B=A.platform==="windows"?"\\":"/";return hs1(A.path,Q.path,B,B)}function KLA(A,Q){let B=f8(A),J=f8(Q);if(B.startsWith("file:///")&&J.startsWith("file:///"))return ms1(B)===ms1(J);return B===J}function ms1(A){return A.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Cs="/",$6;var Hq1=j1(()=>{vb();Ns();$6={joinPath:JLA,resolvePath:DLA,dirname:zLA,basename:(A)=>W3(J4(A).path),extname:(A)=>Os(J4(A).path),hasPrefix:GLA,relativePath:XLA,equalURIs:KLA}});var x8=j1(()=>{Ns();Hq1();vb()});var G9,Fq1,J6,QU=(A)=>{switch(typeof A){case"undefined":return J6.undefined;case"string":return J6.string;case"number":return Number.isNaN(A)?J6.nan:J6.number;case"boolean":return J6.boolean;case"function":return J6.function;case"bigint":return J6.bigint;case"symbol":return J6.symbol;case"object":if(Array.isArray(A))return J6.array;if(A===null)return J6.null;if(A.then&&typeof A.then==="function"&&A.catch&&typeof A.catch==="function")return J6.promise;if(typeof Map!=="undefined"&&A instanceof Map)return J6.map;if(typeof Set!=="undefined"&&A instanceof Set)return J6.set;if(typeof Date!=="undefined"&&A instanceof Date)return J6.date;return J6.object;default:return J6.unknown}};var kb=j1(()=>{(function(A){A.assertEqual=(D)=>{};function Q(D){}A.assertIs=Q;function B(D){throw new Error}A.assertNever=B,A.arrayToEnum=(D)=>{let z={};for(let G of D)z[G]=G;return z},A.getValidEnumValues=(D)=>{let z=A.objectKeys(D).filter((X)=>typeof D[D[X]]!=="number"),G={};for(let X of z)G[X]=D[X];return A.objectValues(G)},A.objectValues=(D)=>{return A.objectKeys(D).map(function(z){return D[z]})},A.objectKeys=typeof Object.keys==="function"?(D)=>Object.keys(D):(D)=>{let z=[];for(let G in D)if(Object.prototype.hasOwnProperty.call(D,G))z.push(G);return z},A.find=(D,z)=>{for(let G of D)if(z(G))return G;return},A.isInteger=typeof Number.isInteger==="function"?(D)=>Number.isInteger(D):(D)=>typeof D==="number"&&Number.isFinite(D)&&Math.floor(D)===D;function J(D,z=" | "){return D.map((G)=>typeof G==="string"?`'${G}'`:G).join(z)}A.joinValues=J,A.jsonStringifyReplacer=(D,z)=>{if(typeof z==="bigint")return z.toString();return z}})(G9||(G9={}));(function(A){A.mergeShapes=(Q,B)=>{return{...Q,...B}}})(Fq1||(Fq1={}));J6=G9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var hA,YLA=(A)=>{return JSON.stringify(A,null,2).replace(/"([^"]+)":/g,"$1:")},yz;var Ls=j1(()=>{kb();hA=G9.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"]);yz=class yz extends Error{get errors(){return this.issues}constructor(A){super();this.issues=[],this.addIssue=(B)=>{this.issues=[...this.issues,B]},this.addIssues=(B=[])=>{this.issues=[...this.issues,...B]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=A}format(A){let Q=A||function(D){return D.message},B={_errors:[]},J=(D)=>{for(let z of D.issues)if(z.code==="invalid_union")z.unionErrors.map(J);else if(z.code==="invalid_return_type")J(z.returnTypeError);else if(z.code==="invalid_arguments")J(z.argumentsError);else if(z.path.length===0)B._errors.push(Q(z));else{let G=B,X=0;while(X<z.path.length){let K=z.path[X];if(X!==z.path.length-1)G[K]=G[K]||{_errors:[]};else G[K]=G[K]||{_errors:[]},G[K]._errors.push(Q(z));G=G[K],X++}}};return J(this),B}static assert(A){if(!(A instanceof yz))throw new Error(`Not a ZodError: ${A}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(A=(Q)=>Q.message){let Q={},B=[];for(let J of this.issues)if(J.path.length>0){let D=J.path[0];Q[D]=Q[D]||[],Q[D].push(A(J))}else B.push(A(J));return{formErrors:B,fieldErrors:Q}}get formErrors(){return this.flatten()}};yz.create=(A)=>{return new yz(A)}});var qLA=(A,Q)=>{let B;switch(A.code){case hA.invalid_type:if(A.received===J6.undefined)B="Required";else B=`Expected ${A.expected}, received ${A.received}`;break;case hA.invalid_literal:B=`Invalid literal value, expected ${JSON.stringify(A.expected,G9.jsonStringifyReplacer)}`;break;case hA.unrecognized_keys:B=`Unrecognized key(s) in object: ${G9.joinValues(A.keys,", ")}`;break;case hA.invalid_union:B="Invalid input";break;case hA.invalid_union_discriminator:B=`Invalid discriminator value. Expected ${G9.joinValues(A.options)}`;break;case hA.invalid_enum_value:B=`Invalid enum value. Expected ${G9.joinValues(A.options)}, received '${A.received}'`;break;case hA.invalid_arguments:B="Invalid function arguments";break;case hA.invalid_return_type:B="Invalid function return type";break;case hA.invalid_date:B="Invalid date";break;case hA.invalid_string:if(typeof A.validation==="object")if("includes"in A.validation){if(B=`Invalid input: must include "${A.validation.includes}"`,typeof A.validation.position==="number")B=`${B} at one or more positions greater than or equal to ${A.validation.position}`}else if("startsWith"in A.validation)B=`Invalid input: must start with "${A.validation.startsWith}"`;else if("endsWith"in A.validation)B=`Invalid input: must end with "${A.validation.endsWith}"`;else G9.assertNever(A.validation);else if(A.validation!=="regex")B=`Invalid ${A.validation}`;else B="Invalid";break;case hA.too_small:if(A.type==="array")B=`Array must contain ${A.exact?"exactly":A.inclusive?"at least":"more than"} ${A.minimum} element(s)`;else if(A.type==="string")B=`String must contain ${A.exact?"exactly":A.inclusive?"at least":"over"} ${A.minimum} character(s)`;else if(A.type==="number")B=`Number must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${A.minimum}`;else if(A.type==="bigint")B=`Number must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${A.minimum}`;else if(A.type==="date")B=`Date must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(A.minimum))}`;else B="Invalid input";break;case hA.too_big:if(A.type==="array")B=`Array must contain ${A.exact?"exactly":A.inclusive?"at most":"less than"} ${A.maximum} element(s)`;else if(A.type==="string")B=`String must contain ${A.exact?"exactly":A.inclusive?"at most":"under"} ${A.maximum} character(s)`;else if(A.type==="number")B=`Number must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`;else if(A.type==="bigint")B=`BigInt must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`;else if(A.type==="date")B=`Date must be ${A.exact?"exactly":A.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(A.maximum))}`;else B="Invalid input";break;case hA.custom:B="Invalid input";break;case hA.invalid_intersection_types:B="Intersection results could not be merged";break;case hA.not_multiple_of:B=`Number must be a multiple of ${A.multipleOf}`;break;case hA.not_finite:B="Number must be finite";break;default:B=Q.defaultError,G9.assertNever(A)}return{message:B}},$F;var Eq1=j1(()=>{Ls();kb();$F=qLA});function ZLA(A){us1=A}function MT(){return us1}var us1;var Rs=j1(()=>{Eq1();us1=$F});function L6(A,Q){let B=MT(),J=fb({issueData:Q,data:A.data,path:A.path,errorMaps:[A.common.contextualErrorMap,A.schemaErrorMap,B,B===$F?void 0:$F].filter((D)=>!!D)});A.common.issues.push(J)}class QJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(A,Q){let B=[];for(let J of Q){if(J.status==="aborted")return m2;if(J.status==="dirty")A.dirty();B.push(J.value)}return{status:A.value,value:B}}static async mergeObjectAsync(A,Q){let B=[];for(let J of Q){let D=await J.key,z=await J.value;B.push({key:D,value:z})}return QJ.mergeObjectSync(A,B)}static mergeObjectSync(A,Q){let B={};for(let J of Q){let{key:D,value:z}=J;if(D.status==="aborted")return m2;if(z.status==="aborted")return m2;if(D.status==="dirty")A.dirty();if(z.status==="dirty")A.dirty();if(D.value!=="__proto__"&&(typeof z.value!=="undefined"||J.alwaysSet))B[D.value]=z.value}return{status:A.value,value:B}}}var fb=(A)=>{let{data:Q,path:B,errorMaps:J,issueData:D}=A,z=[...B,...D.path||[]],G={...D,path:z};if(D.message!==void 0)return{...D,path:z,message:D.message};let X="",K=J.filter((Y)=>!!Y).slice().reverse();for(let Y of K)X=Y(G,{data:Q,defaultError:X}).message;return{...D,path:z,message:X}},ULA,m2,w3=(A)=>({status:"dirty",value:A}),uJ=(A)=>({status:"valid",value:A}),js=(A)=>A.status==="aborted",Ts=(A)=>A.status==="dirty",cW=(A)=>A.status==="valid",WT=(A)=>typeof Promise!=="undefined"&&A instanceof Promise;var Mq1=j1(()=>{Rs();Eq1();ULA=[];m2=Object.freeze({status:"aborted"})});var ps1=()=>{};var B2;var cs1=j1(()=>{(function(A){A.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},A.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(B2||(B2={}))});class iY{constructor(A,Q,B,J){this._cachedPath=[],this.parent=A,this.data=Q,this._path=B,this._key=J}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 j8(A){if(!A)return{};let{errorMap:Q,invalid_type_error:B,required_error:J,description:D}=A;if(Q&&(B||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:D};return{errorMap:(G,X)=>{let{message:K}=A;if(G.code==="invalid_enum_value")return{message:K??X.defaultError};if(typeof X.data==="undefined")return{message:K??J??X.defaultError};if(G.code!=="invalid_type")return{message:X.defaultError};return{message:K??B??X.defaultError}},description:D}}class c8{get description(){return this._def.description}_getType(A){return QU(A.data)}_getOrReturnCtx(A,Q){return Q||{common:A.parent.common,data:A.data,parsedType:QU(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}_processInputParams(A){return{status:new QJ,ctx:{common:A.parent.common,data:A.data,parsedType:QU(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}}_parseSync(A){let Q=this._parse(A);if(WT(Q))throw new Error("Synchronous parse encountered promise.");return Q}_parseAsync(A){let Q=this._parse(A);return Promise.resolve(Q)}parse(A,Q){let B=this.safeParse(A,Q);if(B.success)return B.data;throw B.error}safeParse(A,Q){let B={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:QU(A)},J=this._parseSync({data:A,path:B.path,parent:B});return ls1(B,J)}"~validate"(A){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:QU(A)};if(!this["~standard"].async)try{let B=this._parseSync({data:A,path:[],parent:Q});return cW(B)?{value:B.value}:{issues:Q.common.issues}}catch(B){if(B?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:A,path:[],parent:Q}).then((B)=>cW(B)?{value:B.value}:{issues:Q.common.issues})}async parseAsync(A,Q){let B=await this.safeParseAsync(A,Q);if(B.success)return B.data;throw B.error}async safeParseAsync(A,Q){let B={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:QU(A)},J=this._parse({data:A,path:B.path,parent:B}),D=await(WT(J)?J:Promise.resolve(J));return ls1(B,D)}refine(A,Q){let B=(J)=>{if(typeof Q==="string"||typeof Q==="undefined")return{message:Q};else if(typeof Q==="function")return Q(J);else return Q};return this._refinement((J,D)=>{let z=A(J),G=()=>D.addIssue({code:hA.custom,...B(J)});if(typeof Promise!=="undefined"&&z instanceof Promise)return z.then((X)=>{if(!X)return G(),!1;else return!0});if(!z)return G(),!1;else return!0})}refinement(A,Q){return this._refinement((B,J)=>{if(!A(B))return J.addIssue(typeof Q==="function"?Q(B,J):Q),!1;else return!0})}_refinement(A){return new aY({schema:this,typeName:l2.ZodEffects,effect:{type:"refinement",refinement:A}})}superRefine(A){return this._refinement(A)}constructor(A){this.spa=this.safeParseAsync,this._def=A,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 dY.create(this,this._def)}nullable(){return PF.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lY.create(this)}promise(){return O3.create(this,this._def)}or(A){return CT.create([this,A],this._def)}and(A){return LT.create(this,A,this._def)}transform(A){return new aY({...j8(this._def),schema:this,typeName:l2.ZodEffects,effect:{type:"transform",transform:A}})}default(A){let Q=typeof A==="function"?A:()=>A;return new $T({...j8(this._def),innerType:this,defaultValue:Q,typeName:l2.ZodDefault})}brand(){return new _s({typeName:l2.ZodBranded,type:this,...j8(this._def)})}catch(A){let Q=typeof A==="function"?A:()=>A;return new _T({...j8(this._def),innerType:this,catchValue:Q,typeName:l2.ZodCatch})}describe(A){return new this.constructor({...this._def,description:A})}pipe(A){return mb.create(this,A)}readonly(){return PT.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function as1(A){let Q="[0-5]\\d";if(A.precision)Q=`${Q}\\.\\d{${A.precision}}`;else if(A.precision==null)Q=`${Q}(\\.\\d+)?`;let B=A.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${B}`}function _LA(A){return new RegExp(`^${as1(A)}$`)}function rs1(A){let Q=`${is1}T${as1(A)}`,B=[];if(B.push(A.local?"Z?":"Z"),A.offset)B.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${B.join("|")})`,new RegExp(`^${Q}$`)}function PLA(A,Q){if((Q==="v4"||!Q)&&OLA.test(A))return!0;if((Q==="v6"||!Q)&&LLA.test(A))return!0;return!1}function SLA(A,Q){if(!wLA.test(A))return!1;try{let[B]=A.split(".");if(!B)return!1;let J=B.replace(/-/g,"+").replace(/_/g,"/").padEnd(B.length+(4-B.length%4)%4,"="),D=JSON.parse(atob(J));if(typeof D!=="object"||D===null)return!1;if("typ"in D&&D?.typ!=="JWT")return!1;if(!D.alg)return!1;if(Q&&D.alg!==Q)return!1;return!0}catch{return!1}}function vLA(A,Q){if((Q==="v4"||!Q)&&CLA.test(A))return!0;if((Q==="v6"||!Q)&&RLA.test(A))return!0;return!1}function kLA(A,Q){let B=(A.toString().split(".")[1]||"").length,J=(Q.toString().split(".")[1]||"").length,D=B>J?B:J,z=Number.parseInt(A.toFixed(D).replace(".","")),G=Number.parseInt(Q.toFixed(D).replace(".",""));return z%G/10**D}function wT(A){if(A instanceof X7){let Q={};for(let B in A.shape){let J=A.shape[B];Q[B]=dY.create(wT(J))}return new X7({...A._def,shape:()=>Q})}else if(A instanceof lY)return new lY({...A._def,type:wT(A.element)});else if(A instanceof dY)return dY.create(wT(A.unwrap()));else if(A instanceof PF)return PF.create(wT(A.unwrap()));else if(A instanceof JU)return JU.create(A.items.map((Q)=>wT(Q)));else return A}function wq1(A,Q){let B=QU(A),J=QU(Q);if(A===Q)return{valid:!0,data:A};else if(B===J6.object&&J===J6.object){let D=G9.objectKeys(Q),z=G9.objectKeys(A).filter((X)=>D.indexOf(X)!==-1),G={...A,...Q};for(let X of z){let K=wq1(A[X],Q[X]);if(!K.valid)return{valid:!1};G[X]=K.data}return{valid:!0,data:G}}else if(B===J6.array&&J===J6.array){if(A.length!==Q.length)return{valid:!1};let D=[];for(let z=0;z<A.length;z++){let G=A[z],X=Q[z],K=wq1(G,X);if(!K.valid)return{valid:!1};D.push(K.data)}return{valid:!0,data:D}}else if(B===J6.date&&J===J6.date&&+A===+Q)return{valid:!0,data:A};else return{valid:!1}}function ns1(A,Q){return new aW({values:A,typeName:l2.ZodEnum,...j8(Q)})}function ds1(A,Q){let B=typeof A==="function"?A(Q):typeof A==="string"?{message:A}:A;return typeof B==="string"?{message:B}:B}function ss1(A,Q={},B){if(A)return N3.create().superRefine((J,D)=>{let z=A(J);if(z instanceof Promise)return z.then((G)=>{if(!G){let X=ds1(Q,J),K=X.fatal??B??!0;D.addIssue({code:"custom",...X,fatal:K})}});if(!z){let G=ds1(Q,J),X=G.fatal??B??!0;D.addIssue({code:"custom",...G,fatal:X})}return});return N3.create()}var ls1=(A,Q)=>{if(cW(Q))return{success:!0,data:Q.value};else{if(!A.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let B=new yz(A.common.issues);return this._error=B,this._error}}}},HLA,FLA,ELA,MLA,WLA,wLA,ILA,NLA,VLA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Wq1,OLA,CLA,LLA,RLA,jLA,TLA,is1="((\\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])))",$LA,cY,dW,iW,NT,I3,yb,VT,OT,N3,lW,BU,bb,lY,X7,CT,_F=(A)=>{if(A instanceof RT)return _F(A.schema);else if(A instanceof aY)return _F(A.innerType());else if(A instanceof jT)return[A.value];else if(A instanceof aW)return A.options;else if(A instanceof TT)return G9.objectValues(A.enum);else if(A instanceof $T)return _F(A._def.innerType);else if(A instanceof VT)return[void 0];else if(A instanceof OT)return[null];else if(A instanceof dY)return[void 0,..._F(A.unwrap())];else if(A instanceof PF)return[null,..._F(A.unwrap())];else if(A instanceof _s)return _F(A.unwrap());else if(A instanceof PT)return _F(A.unwrap());else if(A instanceof _T)return _F(A._def.innerType);else return[]},$s,LT,JU,gb,xb,V3,IT,RT,jT,aW,TT,O3,aY,dY,PF,$T,_T,hb,fLA,_s,mb,PT,yLA,l2,bLA=(A,Q={message:`Input not instance of ${A.name}`})=>ss1((B)=>B instanceof A,Q),os1,ts1,gLA,xLA,es1,hLA,mLA,uLA,pLA,cLA,lLA,dLA,iLA,aLA,rLA,nLA,sLA,oLA,tLA,eLA,ARA,QRA,BRA,JRA,DRA,zRA,GRA,XRA,KRA,YRA,qRA,ZRA,URA,HRA,FRA=()=>os1().optional(),ERA=()=>ts1().optional(),MRA=()=>es1().optional(),WRA,wRA;var Ao1=j1(()=>{Ls();Rs();cs1();Mq1();kb();HLA=/^c[^\s-]{8,}$/i,FLA=/^[0-9a-z]+$/,ELA=/^[0-9A-HJKMNP-TV-Z]{26}$/i,MLA=/^[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,WLA=/^[a-z0-9_-]{21}$/i,wLA=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ILA=/^[-+]?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)?)??$/,NLA=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,OLA=/^(?:(?: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])$/,CLA=/^(?:(?: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])$/,LLA=/^(([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]))$/,RLA=/^(([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])$/,jLA=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TLA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$LA=new RegExp(`^${is1}$`);cY=class cY extends c8{_parse(A){if(this._def.coerce)A.data=String(A.data);if(this._getType(A)!==J6.string){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_type,expected:J6.string,received:D.parsedType}),m2}let B=new QJ,J=void 0;for(let D of this._def.checks)if(D.kind==="min"){if(A.data.length<D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),B.dirty()}else if(D.kind==="max"){if(A.data.length>D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),B.dirty()}else if(D.kind==="length"){let z=A.data.length>D.value,G=A.data.length<D.value;if(z||G){if(J=this._getOrReturnCtx(A,J),z)L6(J,{code:hA.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message});else if(G)L6(J,{code:hA.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message});B.dirty()}}else if(D.kind==="email"){if(!NLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"email",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="emoji"){if(!Wq1)Wq1=new RegExp(VLA,"u");if(!Wq1.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"emoji",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="uuid"){if(!MLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"uuid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="nanoid"){if(!WLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"nanoid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="cuid"){if(!HLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"cuid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="cuid2"){if(!FLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"cuid2",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="ulid"){if(!ELA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"ulid",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="url")try{new URL(A.data)}catch{J=this._getOrReturnCtx(A,J),L6(J,{validation:"url",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="regex"){if(D.regex.lastIndex=0,!D.regex.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"regex",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="trim")A.data=A.data.trim();else if(D.kind==="includes"){if(!A.data.includes(D.value,D.position))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:{includes:D.value,position:D.position},message:D.message}),B.dirty()}else if(D.kind==="toLowerCase")A.data=A.data.toLowerCase();else if(D.kind==="toUpperCase")A.data=A.data.toUpperCase();else if(D.kind==="startsWith"){if(!A.data.startsWith(D.value))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:{startsWith:D.value},message:D.message}),B.dirty()}else if(D.kind==="endsWith"){if(!A.data.endsWith(D.value))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:{endsWith:D.value},message:D.message}),B.dirty()}else if(D.kind==="datetime"){if(!rs1(D).test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:"datetime",message:D.message}),B.dirty()}else if(D.kind==="date"){if(!$LA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:"date",message:D.message}),B.dirty()}else if(D.kind==="time"){if(!_LA(D).test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{code:hA.invalid_string,validation:"time",message:D.message}),B.dirty()}else if(D.kind==="duration"){if(!ILA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"duration",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="ip"){if(!PLA(A.data,D.version))J=this._getOrReturnCtx(A,J),L6(J,{validation:"ip",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="jwt"){if(!SLA(A.data,D.alg))J=this._getOrReturnCtx(A,J),L6(J,{validation:"jwt",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="cidr"){if(!vLA(A.data,D.version))J=this._getOrReturnCtx(A,J),L6(J,{validation:"cidr",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="base64"){if(!jLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"base64",code:hA.invalid_string,message:D.message}),B.dirty()}else if(D.kind==="base64url"){if(!TLA.test(A.data))J=this._getOrReturnCtx(A,J),L6(J,{validation:"base64url",code:hA.invalid_string,message:D.message}),B.dirty()}else G9.assertNever(D);return{status:B.value,value:A.data}}_regex(A,Q,B){return this.refinement((J)=>A.test(J),{validation:Q,code:hA.invalid_string,...B2.errToObj(B)})}_addCheck(A){return new cY({...this._def,checks:[...this._def.checks,A]})}email(A){return this._addCheck({kind:"email",...B2.errToObj(A)})}url(A){return this._addCheck({kind:"url",...B2.errToObj(A)})}emoji(A){return this._addCheck({kind:"emoji",...B2.errToObj(A)})}uuid(A){return this._addCheck({kind:"uuid",...B2.errToObj(A)})}nanoid(A){return this._addCheck({kind:"nanoid",...B2.errToObj(A)})}cuid(A){return this._addCheck({kind:"cuid",...B2.errToObj(A)})}cuid2(A){return this._addCheck({kind:"cuid2",...B2.errToObj(A)})}ulid(A){return this._addCheck({kind:"ulid",...B2.errToObj(A)})}base64(A){return this._addCheck({kind:"base64",...B2.errToObj(A)})}base64url(A){return this._addCheck({kind:"base64url",...B2.errToObj(A)})}jwt(A){return this._addCheck({kind:"jwt",...B2.errToObj(A)})}ip(A){return this._addCheck({kind:"ip",...B2.errToObj(A)})}cidr(A){return this._addCheck({kind:"cidr",...B2.errToObj(A)})}datetime(A){if(typeof A==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:A});return this._addCheck({kind:"datetime",precision:typeof A?.precision==="undefined"?null:A?.precision,offset:A?.offset??!1,local:A?.local??!1,...B2.errToObj(A?.message)})}date(A){return this._addCheck({kind:"date",message:A})}time(A){if(typeof A==="string")return this._addCheck({kind:"time",precision:null,message:A});return this._addCheck({kind:"time",precision:typeof A?.precision==="undefined"?null:A?.precision,...B2.errToObj(A?.message)})}duration(A){return this._addCheck({kind:"duration",...B2.errToObj(A)})}regex(A,Q){return this._addCheck({kind:"regex",regex:A,...B2.errToObj(Q)})}includes(A,Q){return this._addCheck({kind:"includes",value:A,position:Q?.position,...B2.errToObj(Q?.message)})}startsWith(A,Q){return this._addCheck({kind:"startsWith",value:A,...B2.errToObj(Q)})}endsWith(A,Q){return this._addCheck({kind:"endsWith",value:A,...B2.errToObj(Q)})}min(A,Q){return this._addCheck({kind:"min",value:A,...B2.errToObj(Q)})}max(A,Q){return this._addCheck({kind:"max",value:A,...B2.errToObj(Q)})}length(A,Q){return this._addCheck({kind:"length",value:A,...B2.errToObj(Q)})}nonempty(A){return this.min(1,B2.errToObj(A))}trim(){return new cY({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cY({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cY({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((A)=>A.kind==="datetime")}get isDate(){return!!this._def.checks.find((A)=>A.kind==="date")}get isTime(){return!!this._def.checks.find((A)=>A.kind==="time")}get isDuration(){return!!this._def.checks.find((A)=>A.kind==="duration")}get isEmail(){return!!this._def.checks.find((A)=>A.kind==="email")}get isURL(){return!!this._def.checks.find((A)=>A.kind==="url")}get isEmoji(){return!!this._def.checks.find((A)=>A.kind==="emoji")}get isUUID(){return!!this._def.checks.find((A)=>A.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((A)=>A.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((A)=>A.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((A)=>A.kind==="cuid2")}get isULID(){return!!this._def.checks.find((A)=>A.kind==="ulid")}get isIP(){return!!this._def.checks.find((A)=>A.kind==="ip")}get isCIDR(){return!!this._def.checks.find((A)=>A.kind==="cidr")}get isBase64(){return!!this._def.checks.find((A)=>A.kind==="base64")}get isBase64url(){return!!this._def.checks.find((A)=>A.kind==="base64url")}get minLength(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A}get maxLength(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A}};cY.create=(A)=>{return new cY({checks:[],typeName:l2.ZodString,coerce:A?.coerce??!1,...j8(A)})};dW=class dW extends c8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(A){if(this._def.coerce)A.data=Number(A.data);if(this._getType(A)!==J6.number){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_type,expected:J6.number,received:D.parsedType}),m2}let B=void 0,J=new QJ;for(let D of this._def.checks)if(D.kind==="int"){if(!G9.isInteger(A.data))B=this._getOrReturnCtx(A,B),L6(B,{code:hA.invalid_type,expected:"integer",received:"float",message:D.message}),J.dirty()}else if(D.kind==="min"){if(D.inclusive?A.data<D.value:A.data<=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_small,minimum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),J.dirty()}else if(D.kind==="max"){if(D.inclusive?A.data>D.value:A.data>=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_big,maximum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),J.dirty()}else if(D.kind==="multipleOf"){if(kLA(A.data,D.value)!==0)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.not_multiple_of,multipleOf:D.value,message:D.message}),J.dirty()}else if(D.kind==="finite"){if(!Number.isFinite(A.data))B=this._getOrReturnCtx(A,B),L6(B,{code:hA.not_finite,message:D.message}),J.dirty()}else G9.assertNever(D);return{status:J.value,value:A.data}}gte(A,Q){return this.setLimit("min",A,!0,B2.toString(Q))}gt(A,Q){return this.setLimit("min",A,!1,B2.toString(Q))}lte(A,Q){return this.setLimit("max",A,!0,B2.toString(Q))}lt(A,Q){return this.setLimit("max",A,!1,B2.toString(Q))}setLimit(A,Q,B,J){return new dW({...this._def,checks:[...this._def.checks,{kind:A,value:Q,inclusive:B,message:B2.toString(J)}]})}_addCheck(A){return new dW({...this._def,checks:[...this._def.checks,A]})}int(A){return this._addCheck({kind:"int",message:B2.toString(A)})}positive(A){return this._addCheck({kind:"min",value:0,inclusive:!1,message:B2.toString(A)})}negative(A){return this._addCheck({kind:"max",value:0,inclusive:!1,message:B2.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:0,inclusive:!0,message:B2.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:0,inclusive:!0,message:B2.toString(A)})}multipleOf(A,Q){return this._addCheck({kind:"multipleOf",value:A,message:B2.toString(Q)})}finite(A){return this._addCheck({kind:"finite",message:B2.toString(A)})}safe(A){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:B2.toString(A)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:B2.toString(A)})}get minValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A}get maxValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A}get isInt(){return!!this._def.checks.find((A)=>A.kind==="int"||A.kind==="multipleOf"&&G9.isInteger(A.value))}get isFinite(){let A=null,Q=null;for(let B of this._def.checks)if(B.kind==="finite"||B.kind==="int"||B.kind==="multipleOf")return!0;else if(B.kind==="min"){if(Q===null||B.value>Q)Q=B.value}else if(B.kind==="max"){if(A===null||B.value<A)A=B.value}return Number.isFinite(Q)&&Number.isFinite(A)}};dW.create=(A)=>{return new dW({checks:[],typeName:l2.ZodNumber,coerce:A?.coerce||!1,...j8(A)})};iW=class iW extends c8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(A){if(this._def.coerce)try{A.data=BigInt(A.data)}catch{return this._getInvalidInput(A)}if(this._getType(A)!==J6.bigint)return this._getInvalidInput(A);let B=void 0,J=new QJ;for(let D of this._def.checks)if(D.kind==="min"){if(D.inclusive?A.data<D.value:A.data<=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_small,type:"bigint",minimum:D.value,inclusive:D.inclusive,message:D.message}),J.dirty()}else if(D.kind==="max"){if(D.inclusive?A.data>D.value:A.data>=D.value)B=this._getOrReturnCtx(A,B),L6(B,{code:hA.too_big,type:"bigint",maximum:D.value,inclusive:D.inclusive,message:D.message}),J.dirty()}else if(D.kind==="multipleOf"){if(A.data%D.value!==BigInt(0))B=this._getOrReturnCtx(A,B),L6(B,{code:hA.not_multiple_of,multipleOf:D.value,message:D.message}),J.dirty()}else G9.assertNever(D);return{status:J.value,value:A.data}}_getInvalidInput(A){let Q=this._getOrReturnCtx(A);return L6(Q,{code:hA.invalid_type,expected:J6.bigint,received:Q.parsedType}),m2}gte(A,Q){return this.setLimit("min",A,!0,B2.toString(Q))}gt(A,Q){return this.setLimit("min",A,!1,B2.toString(Q))}lte(A,Q){return this.setLimit("max",A,!0,B2.toString(Q))}lt(A,Q){return this.setLimit("max",A,!1,B2.toString(Q))}setLimit(A,Q,B,J){return new iW({...this._def,checks:[...this._def.checks,{kind:A,value:Q,inclusive:B,message:B2.toString(J)}]})}_addCheck(A){return new iW({...this._def,checks:[...this._def.checks,A]})}positive(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:B2.toString(A)})}negative(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:B2.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:B2.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:B2.toString(A)})}multipleOf(A,Q){return this._addCheck({kind:"multipleOf",value:A,message:B2.toString(Q)})}get minValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A}get maxValue(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A}};iW.create=(A)=>{return new iW({checks:[],typeName:l2.ZodBigInt,coerce:A?.coerce??!1,...j8(A)})};NT=class NT extends c8{_parse(A){if(this._def.coerce)A.data=Boolean(A.data);if(this._getType(A)!==J6.boolean){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.boolean,received:B.parsedType}),m2}return uJ(A.data)}};NT.create=(A)=>{return new NT({typeName:l2.ZodBoolean,coerce:A?.coerce||!1,...j8(A)})};I3=class I3 extends c8{_parse(A){if(this._def.coerce)A.data=new Date(A.data);if(this._getType(A)!==J6.date){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_type,expected:J6.date,received:D.parsedType}),m2}if(Number.isNaN(A.data.getTime())){let D=this._getOrReturnCtx(A);return L6(D,{code:hA.invalid_date}),m2}let B=new QJ,J=void 0;for(let D of this._def.checks)if(D.kind==="min"){if(A.data.getTime()<D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_small,message:D.message,inclusive:!0,exact:!1,minimum:D.value,type:"date"}),B.dirty()}else if(D.kind==="max"){if(A.data.getTime()>D.value)J=this._getOrReturnCtx(A,J),L6(J,{code:hA.too_big,message:D.message,inclusive:!0,exact:!1,maximum:D.value,type:"date"}),B.dirty()}else G9.assertNever(D);return{status:B.value,value:new Date(A.data.getTime())}}_addCheck(A){return new I3({...this._def,checks:[...this._def.checks,A]})}min(A,Q){return this._addCheck({kind:"min",value:A.getTime(),message:B2.toString(Q)})}max(A,Q){return this._addCheck({kind:"max",value:A.getTime(),message:B2.toString(Q)})}get minDate(){let A=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(A===null||Q.value>A)A=Q.value}return A!=null?new Date(A):null}get maxDate(){let A=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(A===null||Q.value<A)A=Q.value}return A!=null?new Date(A):null}};I3.create=(A)=>{return new I3({checks:[],coerce:A?.coerce||!1,typeName:l2.ZodDate,...j8(A)})};yb=class yb extends c8{_parse(A){if(this._getType(A)!==J6.symbol){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.symbol,received:B.parsedType}),m2}return uJ(A.data)}};yb.create=(A)=>{return new yb({typeName:l2.ZodSymbol,...j8(A)})};VT=class VT extends c8{_parse(A){if(this._getType(A)!==J6.undefined){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.undefined,received:B.parsedType}),m2}return uJ(A.data)}};VT.create=(A)=>{return new VT({typeName:l2.ZodUndefined,...j8(A)})};OT=class OT extends c8{_parse(A){if(this._getType(A)!==J6.null){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.null,received:B.parsedType}),m2}return uJ(A.data)}};OT.create=(A)=>{return new OT({typeName:l2.ZodNull,...j8(A)})};N3=class N3 extends c8{constructor(){super(...arguments);this._any=!0}_parse(A){return uJ(A.data)}};N3.create=(A)=>{return new N3({typeName:l2.ZodAny,...j8(A)})};lW=class lW extends c8{constructor(){super(...arguments);this._unknown=!0}_parse(A){return uJ(A.data)}};lW.create=(A)=>{return new lW({typeName:l2.ZodUnknown,...j8(A)})};BU=class BU extends c8{_parse(A){let Q=this._getOrReturnCtx(A);return L6(Q,{code:hA.invalid_type,expected:J6.never,received:Q.parsedType}),m2}};BU.create=(A)=>{return new BU({typeName:l2.ZodNever,...j8(A)})};bb=class bb extends c8{_parse(A){if(this._getType(A)!==J6.undefined){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.void,received:B.parsedType}),m2}return uJ(A.data)}};bb.create=(A)=>{return new bb({typeName:l2.ZodVoid,...j8(A)})};lY=class lY extends c8{_parse(A){let{ctx:Q,status:B}=this._processInputParams(A),J=this._def;if(Q.parsedType!==J6.array)return L6(Q,{code:hA.invalid_type,expected:J6.array,received:Q.parsedType}),m2;if(J.exactLength!==null){let z=Q.data.length>J.exactLength.value,G=Q.data.length<J.exactLength.value;if(z||G)L6(Q,{code:z?hA.too_big:hA.too_small,minimum:G?J.exactLength.value:void 0,maximum:z?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),B.dirty()}if(J.minLength!==null){if(Q.data.length<J.minLength.value)L6(Q,{code:hA.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),B.dirty()}if(J.maxLength!==null){if(Q.data.length>J.maxLength.value)L6(Q,{code:hA.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),B.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((z,G)=>{return J.type._parseAsync(new iY(Q,z,Q.path,G))})).then((z)=>{return QJ.mergeArray(B,z)});let D=[...Q.data].map((z,G)=>{return J.type._parseSync(new iY(Q,z,Q.path,G))});return QJ.mergeArray(B,D)}get element(){return this._def.type}min(A,Q){return new lY({...this._def,minLength:{value:A,message:B2.toString(Q)}})}max(A,Q){return new lY({...this._def,maxLength:{value:A,message:B2.toString(Q)}})}length(A,Q){return new lY({...this._def,exactLength:{value:A,message:B2.toString(Q)}})}nonempty(A){return this.min(1,A)}};lY.create=(A,Q)=>{return new lY({type:A,minLength:null,maxLength:null,exactLength:null,typeName:l2.ZodArray,...j8(Q)})};X7=class X7 extends c8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let A=this._def.shape(),Q=G9.objectKeys(A);return this._cached={shape:A,keys:Q},this._cached}_parse(A){if(this._getType(A)!==J6.object){let K=this._getOrReturnCtx(A);return L6(K,{code:hA.invalid_type,expected:J6.object,received:K.parsedType}),m2}let{status:B,ctx:J}=this._processInputParams(A),{shape:D,keys:z}=this._getCached(),G=[];if(!(this._def.catchall instanceof BU&&this._def.unknownKeys==="strip")){for(let K in J.data)if(!z.includes(K))G.push(K)}let X=[];for(let K of z){let Y=D[K],q=J.data[K];X.push({key:{status:"valid",value:K},value:Y._parse(new iY(J,q,J.path,K)),alwaysSet:K in J.data})}if(this._def.catchall instanceof BU){let K=this._def.unknownKeys;if(K==="passthrough")for(let Y of G)X.push({key:{status:"valid",value:Y},value:{status:"valid",value:J.data[Y]}});else if(K==="strict"){if(G.length>0)L6(J,{code:hA.unrecognized_keys,keys:G}),B.dirty()}else if(K==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let Y of G){let q=J.data[Y];X.push({key:{status:"valid",value:Y},value:K._parse(new iY(J,q,J.path,Y)),alwaysSet:Y in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let K=[];for(let Y of X){let q=await Y.key,Z=await Y.value;K.push({key:q,value:Z,alwaysSet:Y.alwaysSet})}return K}).then((K)=>{return QJ.mergeObjectSync(B,K)});else return QJ.mergeObjectSync(B,X)}get shape(){return this._def.shape()}strict(A){return B2.errToObj,new X7({...this._def,unknownKeys:"strict",...A!==void 0?{errorMap:(Q,B)=>{let J=this._def.errorMap?.(Q,B).message??B.defaultError;if(Q.code==="unrecognized_keys")return{message:B2.errToObj(A).message??J};return{message:J}}}:{}})}strip(){return new X7({...this._def,unknownKeys:"strip"})}passthrough(){return new X7({...this._def,unknownKeys:"passthrough"})}extend(A){return new X7({...this._def,shape:()=>({...this._def.shape(),...A})})}merge(A){return new X7({unknownKeys:A._def.unknownKeys,catchall:A._def.catchall,shape:()=>({...this._def.shape(),...A._def.shape()}),typeName:l2.ZodObject})}setKey(A,Q){return this.augment({[A]:Q})}catchall(A){return new X7({...this._def,catchall:A})}pick(A){let Q={};for(let B of G9.objectKeys(A))if(A[B]&&this.shape[B])Q[B]=this.shape[B];return new X7({...this._def,shape:()=>Q})}omit(A){let Q={};for(let B of G9.objectKeys(this.shape))if(!A[B])Q[B]=this.shape[B];return new X7({...this._def,shape:()=>Q})}deepPartial(){return wT(this)}partial(A){let Q={};for(let B of G9.objectKeys(this.shape)){let J=this.shape[B];if(A&&!A[B])Q[B]=J;else Q[B]=J.optional()}return new X7({...this._def,shape:()=>Q})}required(A){let Q={};for(let B of G9.objectKeys(this.shape))if(A&&!A[B])Q[B]=this.shape[B];else{let D=this.shape[B];while(D instanceof dY)D=D._def.innerType;Q[B]=D}return new X7({...this._def,shape:()=>Q})}keyof(){return ns1(G9.objectKeys(this.shape))}};X7.create=(A,Q)=>{return new X7({shape:()=>A,unknownKeys:"strip",catchall:BU.create(),typeName:l2.ZodObject,...j8(Q)})};X7.strictCreate=(A,Q)=>{return new X7({shape:()=>A,unknownKeys:"strict",catchall:BU.create(),typeName:l2.ZodObject,...j8(Q)})};X7.lazycreate=(A,Q)=>{return new X7({shape:A,unknownKeys:"strip",catchall:BU.create(),typeName:l2.ZodObject,...j8(Q)})};CT=class CT extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B=this._def.options;function J(D){for(let G of D)if(G.result.status==="valid")return G.result;for(let G of D)if(G.result.status==="dirty")return Q.common.issues.push(...G.ctx.common.issues),G.result;let z=D.map((G)=>new yz(G.ctx.common.issues));return L6(Q,{code:hA.invalid_union,unionErrors:z}),m2}if(Q.common.async)return Promise.all(B.map(async(D)=>{let z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await D._parseAsync({data:Q.data,path:Q.path,parent:z}),ctx:z}})).then(J);else{let D=void 0,z=[];for(let X of B){let K={...Q,common:{...Q.common,issues:[]},parent:null},Y=X._parseSync({data:Q.data,path:Q.path,parent:K});if(Y.status==="valid")return Y;else if(Y.status==="dirty"&&!D)D={result:Y,ctx:K};if(K.common.issues.length)z.push(K.common.issues)}if(D)return Q.common.issues.push(...D.ctx.common.issues),D.result;let G=z.map((X)=>new yz(X));return L6(Q,{code:hA.invalid_union,unionErrors:G}),m2}}get options(){return this._def.options}};CT.create=(A,Q)=>{return new CT({options:A,typeName:l2.ZodUnion,...j8(Q)})};$s=class $s extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A);if(Q.parsedType!==J6.object)return L6(Q,{code:hA.invalid_type,expected:J6.object,received:Q.parsedType}),m2;let B=this.discriminator,J=Q.data[B],D=this.optionsMap.get(J);if(!D)return L6(Q,{code:hA.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[B]}),m2;if(Q.common.async)return D._parseAsync({data:Q.data,path:Q.path,parent:Q});else return D._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(A,Q,B){let J=new Map;for(let D of Q){let z=_F(D.shape[A]);if(!z.length)throw new Error(`A discriminator value for key \`${A}\` could not be extracted from all schema options`);for(let G of z){if(J.has(G))throw new Error(`Discriminator property ${String(A)} has duplicate value ${String(G)}`);J.set(G,D)}}return new $s({typeName:l2.ZodDiscriminatedUnion,discriminator:A,options:Q,optionsMap:J,...j8(B)})}};LT=class LT extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A),J=(D,z)=>{if(js(D)||js(z))return m2;let G=wq1(D.value,z.value);if(!G.valid)return L6(B,{code:hA.invalid_intersection_types}),m2;if(Ts(D)||Ts(z))Q.dirty();return{status:Q.value,value:G.data}};if(B.common.async)return Promise.all([this._def.left._parseAsync({data:B.data,path:B.path,parent:B}),this._def.right._parseAsync({data:B.data,path:B.path,parent:B})]).then(([D,z])=>J(D,z));else return J(this._def.left._parseSync({data:B.data,path:B.path,parent:B}),this._def.right._parseSync({data:B.data,path:B.path,parent:B}))}};LT.create=(A,Q,B)=>{return new LT({left:A,right:Q,typeName:l2.ZodIntersection,...j8(B)})};JU=class JU extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.array)return L6(B,{code:hA.invalid_type,expected:J6.array,received:B.parsedType}),m2;if(B.data.length<this._def.items.length)return L6(B,{code:hA.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m2;if(!this._def.rest&&B.data.length>this._def.items.length)L6(B,{code:hA.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let D=[...B.data].map((z,G)=>{let X=this._def.items[G]||this._def.rest;if(!X)return null;return X._parse(new iY(B,z,B.path,G))}).filter((z)=>!!z);if(B.common.async)return Promise.all(D).then((z)=>{return QJ.mergeArray(Q,z)});else return QJ.mergeArray(Q,D)}get items(){return this._def.items}rest(A){return new JU({...this._def,rest:A})}};JU.create=(A,Q)=>{if(!Array.isArray(A))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new JU({items:A,typeName:l2.ZodTuple,rest:null,...j8(Q)})};gb=class gb extends c8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.object)return L6(B,{code:hA.invalid_type,expected:J6.object,received:B.parsedType}),m2;let J=[],D=this._def.keyType,z=this._def.valueType;for(let G in B.data)J.push({key:D._parse(new iY(B,G,B.path,G)),value:z._parse(new iY(B,B.data[G],B.path,G)),alwaysSet:G in B.data});if(B.common.async)return QJ.mergeObjectAsync(Q,J);else return QJ.mergeObjectSync(Q,J)}get element(){return this._def.valueType}static create(A,Q,B){if(Q instanceof c8)return new gb({keyType:A,valueType:Q,typeName:l2.ZodRecord,...j8(B)});return new gb({keyType:cY.create(),valueType:A,typeName:l2.ZodRecord,...j8(Q)})}};xb=class xb extends c8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.map)return L6(B,{code:hA.invalid_type,expected:J6.map,received:B.parsedType}),m2;let J=this._def.keyType,D=this._def.valueType,z=[...B.data.entries()].map(([G,X],K)=>{return{key:J._parse(new iY(B,G,B.path,[K,"key"])),value:D._parse(new iY(B,X,B.path,[K,"value"]))}});if(B.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let X of z){let K=await X.key,Y=await X.value;if(K.status==="aborted"||Y.status==="aborted")return m2;if(K.status==="dirty"||Y.status==="dirty")Q.dirty();G.set(K.value,Y.value)}return{status:Q.value,value:G}})}else{let G=new Map;for(let X of z){let{key:K,value:Y}=X;if(K.status==="aborted"||Y.status==="aborted")return m2;if(K.status==="dirty"||Y.status==="dirty")Q.dirty();G.set(K.value,Y.value)}return{status:Q.value,value:G}}}};xb.create=(A,Q,B)=>{return new xb({valueType:Q,keyType:A,typeName:l2.ZodMap,...j8(B)})};V3=class V3 extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.parsedType!==J6.set)return L6(B,{code:hA.invalid_type,expected:J6.set,received:B.parsedType}),m2;let J=this._def;if(J.minSize!==null){if(B.data.size<J.minSize.value)L6(B,{code:hA.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),Q.dirty()}if(J.maxSize!==null){if(B.data.size>J.maxSize.value)L6(B,{code:hA.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),Q.dirty()}let D=this._def.valueType;function z(X){let K=new Set;for(let Y of X){if(Y.status==="aborted")return m2;if(Y.status==="dirty")Q.dirty();K.add(Y.value)}return{status:Q.value,value:K}}let G=[...B.data.values()].map((X,K)=>D._parse(new iY(B,X,B.path,K)));if(B.common.async)return Promise.all(G).then((X)=>z(X));else return z(G)}min(A,Q){return new V3({...this._def,minSize:{value:A,message:B2.toString(Q)}})}max(A,Q){return new V3({...this._def,maxSize:{value:A,message:B2.toString(Q)}})}size(A,Q){return this.min(A,Q).max(A,Q)}nonempty(A){return this.min(1,A)}};V3.create=(A,Q)=>{return new V3({valueType:A,minSize:null,maxSize:null,typeName:l2.ZodSet,...j8(Q)})};IT=class IT extends c8{constructor(){super(...arguments);this.validate=this.implement}_parse(A){let{ctx:Q}=this._processInputParams(A);if(Q.parsedType!==J6.function)return L6(Q,{code:hA.invalid_type,expected:J6.function,received:Q.parsedType}),m2;function B(G,X){return fb({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,MT(),$F].filter((K)=>!!K),issueData:{code:hA.invalid_arguments,argumentsError:X}})}function J(G,X){return fb({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,MT(),$F].filter((K)=>!!K),issueData:{code:hA.invalid_return_type,returnTypeError:X}})}let D={errorMap:Q.common.contextualErrorMap},z=Q.data;if(this._def.returns instanceof O3){let G=this;return uJ(async function(...X){let K=new yz([]),Y=await G._def.args.parseAsync(X,D).catch((H)=>{throw K.addIssue(B(X,H)),K}),q=await Reflect.apply(z,this,Y);return await G._def.returns._def.type.parseAsync(q,D).catch((H)=>{throw K.addIssue(J(q,H)),K})})}else{let G=this;return uJ(function(...X){let K=G._def.args.safeParse(X,D);if(!K.success)throw new yz([B(X,K.error)]);let Y=Reflect.apply(z,this,K.data),q=G._def.returns.safeParse(Y,D);if(!q.success)throw new yz([J(Y,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...A){return new IT({...this._def,args:JU.create(A).rest(lW.create())})}returns(A){return new IT({...this._def,returns:A})}implement(A){return this.parse(A)}strictImplement(A){return this.parse(A)}static create(A,Q,B){return new IT({args:A?A:JU.create([]).rest(lW.create()),returns:Q||lW.create(),typeName:l2.ZodFunction,...j8(B)})}};RT=class RT extends c8{get schema(){return this._def.getter()}_parse(A){let{ctx:Q}=this._processInputParams(A);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};RT.create=(A,Q)=>{return new RT({getter:A,typeName:l2.ZodLazy,...j8(Q)})};jT=class jT extends c8{_parse(A){if(A.data!==this._def.value){let Q=this._getOrReturnCtx(A);return L6(Q,{received:Q.data,code:hA.invalid_literal,expected:this._def.value}),m2}return{status:"valid",value:A.data}}get value(){return this._def.value}};jT.create=(A,Q)=>{return new jT({value:A,typeName:l2.ZodLiteral,...j8(Q)})};aW=class aW extends c8{_parse(A){if(typeof A.data!=="string"){let Q=this._getOrReturnCtx(A),B=this._def.values;return L6(Q,{expected:G9.joinValues(B),received:Q.parsedType,code:hA.invalid_type}),m2}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(A.data)){let Q=this._getOrReturnCtx(A),B=this._def.values;return L6(Q,{received:Q.data,code:hA.invalid_enum_value,options:B}),m2}return uJ(A.data)}get options(){return this._def.values}get enum(){let A={};for(let Q of this._def.values)A[Q]=Q;return A}get Values(){let A={};for(let Q of this._def.values)A[Q]=Q;return A}get Enum(){let A={};for(let Q of this._def.values)A[Q]=Q;return A}extract(A,Q=this._def){return aW.create(A,{...this._def,...Q})}exclude(A,Q=this._def){return aW.create(this.options.filter((B)=>!A.includes(B)),{...this._def,...Q})}};aW.create=ns1;TT=class TT extends c8{_parse(A){let Q=G9.getValidEnumValues(this._def.values),B=this._getOrReturnCtx(A);if(B.parsedType!==J6.string&&B.parsedType!==J6.number){let J=G9.objectValues(Q);return L6(B,{expected:G9.joinValues(J),received:B.parsedType,code:hA.invalid_type}),m2}if(!this._cache)this._cache=new Set(G9.getValidEnumValues(this._def.values));if(!this._cache.has(A.data)){let J=G9.objectValues(Q);return L6(B,{received:B.data,code:hA.invalid_enum_value,options:J}),m2}return uJ(A.data)}get enum(){return this._def.values}};TT.create=(A,Q)=>{return new TT({values:A,typeName:l2.ZodNativeEnum,...j8(Q)})};O3=class O3 extends c8{unwrap(){return this._def.type}_parse(A){let{ctx:Q}=this._processInputParams(A);if(Q.parsedType!==J6.promise&&Q.common.async===!1)return L6(Q,{code:hA.invalid_type,expected:J6.promise,received:Q.parsedType}),m2;let B=Q.parsedType===J6.promise?Q.data:Promise.resolve(Q.data);return uJ(B.then((J)=>{return this._def.type.parseAsync(J,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};O3.create=(A,Q)=>{return new O3({type:A,typeName:l2.ZodPromise,...j8(Q)})};aY=class aY extends c8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===l2.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(A){let{status:Q,ctx:B}=this._processInputParams(A),J=this._def.effect||null,D={addIssue:(z)=>{if(L6(B,z),z.fatal)Q.abort();else Q.dirty()},get path(){return B.path}};if(D.addIssue=D.addIssue.bind(D),J.type==="preprocess"){let z=J.transform(B.data,D);if(B.common.async)return Promise.resolve(z).then(async(G)=>{if(Q.value==="aborted")return m2;let X=await this._def.schema._parseAsync({data:G,path:B.path,parent:B});if(X.status==="aborted")return m2;if(X.status==="dirty")return w3(X.value);if(Q.value==="dirty")return w3(X.value);return X});else{if(Q.value==="aborted")return m2;let G=this._def.schema._parseSync({data:z,path:B.path,parent:B});if(G.status==="aborted")return m2;if(G.status==="dirty")return w3(G.value);if(Q.value==="dirty")return w3(G.value);return G}}if(J.type==="refinement"){let z=(G)=>{let X=J.refinement(G,D);if(B.common.async)return Promise.resolve(X);if(X instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(B.common.async===!1){let G=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(G.status==="aborted")return m2;if(G.status==="dirty")Q.dirty();return z(G.value),{status:Q.value,value:G.value}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((G)=>{if(G.status==="aborted")return m2;if(G.status==="dirty")Q.dirty();return z(G.value).then(()=>{return{status:Q.value,value:G.value}})})}if(J.type==="transform")if(B.common.async===!1){let z=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(!cW(z))return m2;let G=J.transform(z.value,D);if(G instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:G}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((z)=>{if(!cW(z))return m2;return Promise.resolve(J.transform(z.value,D)).then((G)=>({status:Q.value,value:G}))});G9.assertNever(J)}};aY.create=(A,Q,B)=>{return new aY({schema:A,typeName:l2.ZodEffects,effect:Q,...j8(B)})};aY.createWithPreprocess=(A,Q,B)=>{return new aY({schema:Q,effect:{type:"preprocess",transform:A},typeName:l2.ZodEffects,...j8(B)})};dY=class dY extends c8{_parse(A){if(this._getType(A)===J6.undefined)return uJ(void 0);return this._def.innerType._parse(A)}unwrap(){return this._def.innerType}};dY.create=(A,Q)=>{return new dY({innerType:A,typeName:l2.ZodOptional,...j8(Q)})};PF=class PF extends c8{_parse(A){if(this._getType(A)===J6.null)return uJ(null);return this._def.innerType._parse(A)}unwrap(){return this._def.innerType}};PF.create=(A,Q)=>{return new PF({innerType:A,typeName:l2.ZodNullable,...j8(Q)})};$T=class $T extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B=Q.data;if(Q.parsedType===J6.undefined)B=this._def.defaultValue();return this._def.innerType._parse({data:B,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};$T.create=(A,Q)=>{return new $T({innerType:A,typeName:l2.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...j8(Q)})};_T=class _T extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B={...Q,common:{...Q.common,issues:[]}},J=this._def.innerType._parse({data:B.data,path:B.path,parent:{...B}});if(WT(J))return J.then((D)=>{return{status:"valid",value:D.status==="valid"?D.value:this._def.catchValue({get error(){return new yz(B.common.issues)},input:B.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new yz(B.common.issues)},input:B.data})}}removeCatch(){return this._def.innerType}};_T.create=(A,Q)=>{return new _T({innerType:A,typeName:l2.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...j8(Q)})};hb=class hb extends c8{_parse(A){if(this._getType(A)!==J6.nan){let B=this._getOrReturnCtx(A);return L6(B,{code:hA.invalid_type,expected:J6.nan,received:B.parsedType}),m2}return{status:"valid",value:A.data}}};hb.create=(A)=>{return new hb({typeName:l2.ZodNaN,...j8(A)})};fLA=Symbol("zod_brand");_s=class _s extends c8{_parse(A){let{ctx:Q}=this._processInputParams(A),B=Q.data;return this._def.type._parse({data:B,path:Q.path,parent:Q})}unwrap(){return this._def.type}};mb=class mb extends c8{_parse(A){let{status:Q,ctx:B}=this._processInputParams(A);if(B.common.async)return(async()=>{let D=await this._def.in._parseAsync({data:B.data,path:B.path,parent:B});if(D.status==="aborted")return m2;if(D.status==="dirty")return Q.dirty(),w3(D.value);else return this._def.out._parseAsync({data:D.value,path:B.path,parent:B})})();else{let J=this._def.in._parseSync({data:B.data,path:B.path,parent:B});if(J.status==="aborted")return m2;if(J.status==="dirty")return Q.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:B.path,parent:B})}}static create(A,Q){return new mb({in:A,out:Q,typeName:l2.ZodPipeline})}};PT=class PT extends c8{_parse(A){let Q=this._def.innerType._parse(A),B=(J)=>{if(cW(J))J.value=Object.freeze(J.value);return J};return WT(Q)?Q.then((J)=>B(J)):B(Q)}unwrap(){return this._def.innerType}};PT.create=(A,Q)=>{return new PT({innerType:A,typeName:l2.ZodReadonly,...j8(Q)})};yLA={object:X7.lazycreate};(function(A){A.ZodString="ZodString",A.ZodNumber="ZodNumber",A.ZodNaN="ZodNaN",A.ZodBigInt="ZodBigInt",A.ZodBoolean="ZodBoolean",A.ZodDate="ZodDate",A.ZodSymbol="ZodSymbol",A.ZodUndefined="ZodUndefined",A.ZodNull="ZodNull",A.ZodAny="ZodAny",A.ZodUnknown="ZodUnknown",A.ZodNever="ZodNever",A.ZodVoid="ZodVoid",A.ZodArray="ZodArray",A.ZodObject="ZodObject",A.ZodUnion="ZodUnion",A.ZodDiscriminatedUnion="ZodDiscriminatedUnion",A.ZodIntersection="ZodIntersection",A.ZodTuple="ZodTuple",A.ZodRecord="ZodRecord",A.ZodMap="ZodMap",A.ZodSet="ZodSet",A.ZodFunction="ZodFunction",A.ZodLazy="ZodLazy",A.ZodLiteral="ZodLiteral",A.ZodEnum="ZodEnum",A.ZodEffects="ZodEffects",A.ZodNativeEnum="ZodNativeEnum",A.ZodOptional="ZodOptional",A.ZodNullable="ZodNullable",A.ZodDefault="ZodDefault",A.ZodCatch="ZodCatch",A.ZodPromise="ZodPromise",A.ZodBranded="ZodBranded",A.ZodPipeline="ZodPipeline",A.ZodReadonly="ZodReadonly"})(l2||(l2={}));os1=cY.create,ts1=dW.create,gLA=hb.create,xLA=iW.create,es1=NT.create,hLA=I3.create,mLA=yb.create,uLA=VT.create,pLA=OT.create,cLA=N3.create,lLA=lW.create,dLA=BU.create,iLA=bb.create,aLA=lY.create,rLA=X7.create,nLA=X7.strictCreate,sLA=CT.create,oLA=$s.create,tLA=LT.create,eLA=JU.create,ARA=gb.create,QRA=xb.create,BRA=V3.create,JRA=IT.create,DRA=RT.create,zRA=jT.create,GRA=aW.create,XRA=TT.create,KRA=O3.create,YRA=aY.create,qRA=dY.create,ZRA=PF.create,URA=aY.createWithPreprocess,HRA=mb.create,WRA={string:(A)=>cY.create({...A,coerce:!0}),number:(A)=>dW.create({...A,coerce:!0}),boolean:(A)=>NT.create({...A,coerce:!0}),bigint:(A)=>iW.create({...A,coerce:!0}),date:(A)=>I3.create({...A,coerce:!0})},wRA=m2});var L1={};h6(L1,{void:()=>iLA,util:()=>G9,unknown:()=>lLA,union:()=>sLA,undefined:()=>uLA,tuple:()=>eLA,transformer:()=>YRA,symbol:()=>mLA,string:()=>os1,strictObject:()=>nLA,setErrorMap:()=>ZLA,set:()=>BRA,record:()=>ARA,quotelessJson:()=>YLA,promise:()=>KRA,preprocess:()=>URA,pipeline:()=>HRA,ostring:()=>FRA,optional:()=>qRA,onumber:()=>ERA,oboolean:()=>MRA,objectUtil:()=>Fq1,object:()=>rLA,number:()=>ts1,nullable:()=>ZRA,null:()=>pLA,never:()=>dLA,nativeEnum:()=>XRA,nan:()=>gLA,map:()=>QRA,makeIssue:()=>fb,literal:()=>zRA,lazy:()=>DRA,late:()=>yLA,isValid:()=>cW,isDirty:()=>Ts,isAsync:()=>WT,isAborted:()=>js,intersection:()=>tLA,instanceof:()=>bLA,getParsedType:()=>QU,getErrorMap:()=>MT,function:()=>JRA,enum:()=>GRA,effect:()=>YRA,discriminatedUnion:()=>oLA,defaultErrorMap:()=>$F,datetimeRegex:()=>rs1,date:()=>hLA,custom:()=>ss1,coerce:()=>WRA,boolean:()=>es1,bigint:()=>xLA,array:()=>aLA,any:()=>cLA,addIssueToContext:()=>L6,ZodVoid:()=>bb,ZodUnknown:()=>lW,ZodUnion:()=>CT,ZodUndefined:()=>VT,ZodType:()=>c8,ZodTuple:()=>JU,ZodTransformer:()=>aY,ZodSymbol:()=>yb,ZodString:()=>cY,ZodSet:()=>V3,ZodSchema:()=>c8,ZodRecord:()=>gb,ZodReadonly:()=>PT,ZodPromise:()=>O3,ZodPipeline:()=>mb,ZodParsedType:()=>J6,ZodOptional:()=>dY,ZodObject:()=>X7,ZodNumber:()=>dW,ZodNullable:()=>PF,ZodNull:()=>OT,ZodNever:()=>BU,ZodNativeEnum:()=>TT,ZodNaN:()=>hb,ZodMap:()=>xb,ZodLiteral:()=>jT,ZodLazy:()=>RT,ZodIssueCode:()=>hA,ZodIntersection:()=>LT,ZodFunction:()=>IT,ZodFirstPartyTypeKind:()=>l2,ZodError:()=>yz,ZodEnum:()=>aW,ZodEffects:()=>aY,ZodDiscriminatedUnion:()=>$s,ZodDefault:()=>$T,ZodDate:()=>I3,ZodCatch:()=>_T,ZodBranded:()=>_s,ZodBoolean:()=>NT,ZodBigInt:()=>iW,ZodArray:()=>lY,ZodAny:()=>N3,Schema:()=>c8,ParseStatus:()=>QJ,OK:()=>uJ,NEVER:()=>wRA,INVALID:()=>m2,EMPTY_PATH:()=>ULA,DIRTY:()=>w3,BRAND:()=>fLA});var Iq1=j1(()=>{Rs();Mq1();ps1();kb();Ao1();Ls()});var Ps=j1(()=>{Iq1();Iq1()});function Vq1(A){return Qo1.safeParse(A)}function ST(A){return IRA.safeParse(A)}function Ss(A){if(!A||!Array.isArray(A))return[];let Q=[];for(let[B,J]of A.entries()){let D=Vq1(J);if(D.success)Q.push(D.data);else{let z=typeof J==="object"&&J!==null&&"tool"in J?String(J.tool):`entry at index ${B}`;N1.warn(`Permission entry for tool "${z}" is invalid: ${D.error.errors.map((G)=>`${G.path.join(".")}: ${G.message}`).join(", ")}`)}}return Q}var Nq1,Qo1,IRA;var C3=j1(()=>{Ps();iA();Nq1=L1.lazy(()=>L1.union([L1.string().describe('Pattern match where "*" matches any number of any characters'),L1.array(Nq1).min(1).describe("OR match of each entry"),L1.boolean().describe("A literal boolean match"),L1.number().describe("A literal number match"),L1.null().describe("A literal null match"),L1.undefined().describe("A literal undefined match"),L1.record(L1.string(),Nq1).describe("Matching individual keys of an object")])),Qo1=L1.object({tool:L1.string().min(1).describe("The name of the tool to which this entry applies"),matches:L1.record(L1.string(),Nq1).optional().describe("Maps tool inputs to conditions"),action:L1.enum(["allow","reject","ask","delegate"]).describe("How Amp should proceed in case of a match"),context:L1.enum(["thread","subagent"]).optional().describe("Only apply this entry in this context"),to:L1.string().min(1).optional().describe('Command to delegate to when action is "delegate"')}).superRefine((A,Q)=>{if(A.action==="delegate"&&!A.to)Q.addIssue({code:L1.ZodIssueCode.custom,message:'delegate action requires "to" field',path:["to"]});if(A.action!=="delegate"&&A.to)Q.addIssue({code:L1.ZodIssueCode.custom,message:'"to" field only allowed with delegate action',path:["to"]})}),IRA=L1.array(Qo1).describe("Entries checked in sequence to configure tool permissions")});function bz(A,Q){let B=NRA(A,Q);return typeof B==="string"?B:B.toString()}function NRA(A,Q,B=!0){if(!Q)Q=VRA();let{workspaceFolders:J,isWindows:D,homeDir:z}=Q,G=typeof A==="string"?C6.parse(A):C6.from(A);if(J)for(let X of J){let K=J4(X);if($6.hasPrefix(G,K)){let Y=K.path.endsWith("/")?K.path.slice(0,-1):K.path,Z=B&&J&&J.length>=2?W3(K.path)+(D?"\\":"/"):"";return Oq1(Z+G.path.slice(Y.length+1),D,G.scheme)}}if(G?.scheme==="file"){if(z){let X=J4(z);if($6.hasPrefix(G,X)){let K=X.path.endsWith("/")?X.path.slice(0,-1):X.path,Y=G.path.slice(K.length+1);return Oq1("~"+(D?"\\":"/")+Y,D,G.scheme)}}return Oq1(G.fsPath,D,G.scheme)}return G}function Oq1(A,Q,B){return Q&&B==="file"?A.replaceAll("/","\\"):A}function ks(A){let Q=vs;return vs=A,Q}function VRA(){if(vs)return vs;throw new Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var vs=null;var rW=j1(()=>{x8();vb();Hq1()});function L3({onlyFirst:A=!1}={}){let B=["[\\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(B,A?void 0:"g")}function R3(A){if(typeof A!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof A}\``);return A.replace(ORA,"")}var ORA;var fs=j1(()=>{ORA=L3()});var Jo1=n((HT2,Cq1)=>{var nW={};if(typeof Cq1=="undefined")window.eastasianwidth=nW;else Cq1.exports=nW;nW.eastAsianWidth=function(A){var Q=A.charCodeAt(0),B=A.length==2?A.charCodeAt(1):0,J=Q;if(55296<=Q&&Q<=56319&&(56320<=B&&B<=57343))Q&=1023,B&=1023,J=Q<<10|B,J+=65536;if(J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510)return"F";if(J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518)return"H";if(4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141)return"W";if(32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630)return"Na";if(J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109)return"A";return"N"};nW.characterLength=function(A){var Q=this.eastAsianWidth(A);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function Bo1(A){return A.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}nW.length=function(A){var Q=Bo1(A),B=0;for(var J=0;J<Q.length;J++)B=B+this.characterLength(Q[J]);return B};nW.slice=function(A,Q,B){if(textLen=nW.length(A),Q=Q?Q:0,B=B?B:1,Q<0)Q=textLen+Q;if(B<0)B=textLen+B;var J="",D=0,z=Bo1(A);for(var G=0;G<z.length;G++){var X=z[G],K=nW.length(X);if(D>=Q-(K==2?1:0))if(D+K<=B)J+=X;else break;D+=K}return J}});var Lq1=n((FT2,Do1)=>{Do1.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}});function ys(A,Q){if(typeof A!=="string"||A.length===0)return 0;if(Q={ambiguousIsNarrow:!0,countAnsiEscapeCodes:!1,...Q},!Q.countAnsiEscapeCodes)A=R3(A);if(A.length===0)return 0;let B=Q.ambiguousIsNarrow?1:2,J=0;for(let{segment:D}of new Intl.Segmenter().segment(A)){let z=D.codePointAt(0);if(z<=31||z>=127&&z<=159)continue;if(z>=768&&z<=879)continue;if(Go1.default().test(D)){J+=2;continue}switch(zo1.default.eastAsianWidth(D)){case"F":case"W":{J+=2;break}case"A":{J+=B;break}default:J+=1}}return J}var zo1,Go1;var Xo1=j1(()=>{fs();zo1=WA(Jo1(),1),Go1=WA(Lq1(),1)});var Ko1="run_terminal_command",Yo1="read_file",R7="Task",qo1="chat_llm",pJ="codebase_search_agent",DU="get_diagnostics",p5="Bash",gz="oracle",SF="mermaid",sX="todo_read",s7="todo_write",xz="read_web_page",Zo1="run_javascript",Uo1="summarize_git_diff",LB="create_file",oX="glob",vT="undo_edit",bs="read_mcp_resource",I4="Read",cQ="edit_file",sW="format_file",gD="list_directory",zU="web_search",K7="Grep",Ho1="RunCIChecks",Fo1;var t8=j1(()=>{Fo1=["Task","chat_llm","codebase_search_agent","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","run_javascript","summarize_git_diff","create_file","glob","undo_edit","Read","edit_file","format_file","list_directory","web_search","Grep","search_documents","get_document","RunCIChecks"]});var ub=n((wT2,Mo1)=>{var Eo1={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:"/"},CRA={...Eo1,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:"\\"},LRA={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"};Mo1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:LRA,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:{"***":"*","**/**":"**","**/**/**":"**"},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(A){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${A.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(A){return A===!0?CRA:Eo1}}});var pb=n((_RA)=>{var{REGEX_BACKSLASH:RRA,REGEX_REMOVE_BACKSLASH:jRA,REGEX_SPECIAL_CHARS:TRA,REGEX_SPECIAL_CHARS_GLOBAL:$RA}=ub();_RA.isObject=(A)=>A!==null&&typeof A==="object"&&!Array.isArray(A);_RA.hasRegexChars=(A)=>TRA.test(A);_RA.isRegexChar=(A)=>A.length===1&&_RA.hasRegexChars(A);_RA.escapeRegex=(A)=>A.replace($RA,"\\$1");_RA.toPosixSlashes=(A)=>A.replace(RRA,"/");_RA.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let A=navigator.platform.toLowerCase();return A==="win32"||A==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};_RA.removeBackslashes=(A)=>{return A.replace(jRA,(Q)=>{return Q==="\\"?"":Q})};_RA.escapeLast=(A,Q,B)=>{let J=A.lastIndexOf(Q,B);if(J===-1)return A;if(A[J-1]==="\\")return _RA.escapeLast(A,Q,J-1);return`${A.slice(0,J)}\\${A.slice(J)}`};_RA.removePrefix=(A,Q={})=>{let B=A;if(B.startsWith("./"))B=B.slice(2),Q.prefix="./";return B};_RA.wrapOutput=(A,Q={},B={})=>{let J=B.contains?"":"^",D=B.contains?"":"$",z=`${J}(?:${A})${D}`;if(Q.negated===!0)z=`(?:^(?!${z}).*$)`;return z};_RA.basename=(A,{windows:Q}={})=>{let B=A.split(Q?/[\\/]/:"/"),J=B[B.length-1];if(J==="")return B[B.length-2];return J}});var jo1=n((NT2,Ro1)=>{var Io1=pb(),{CHAR_ASTERISK:Rq1,CHAR_AT:hRA,CHAR_BACKWARD_SLASH:cb,CHAR_COMMA:mRA,CHAR_DOT:jq1,CHAR_EXCLAMATION_MARK:Tq1,CHAR_FORWARD_SLASH:Lo1,CHAR_LEFT_CURLY_BRACE:$q1,CHAR_LEFT_PARENTHESES:_q1,CHAR_LEFT_SQUARE_BRACKET:uRA,CHAR_PLUS:pRA,CHAR_QUESTION_MARK:No1,CHAR_RIGHT_CURLY_BRACE:cRA,CHAR_RIGHT_PARENTHESES:Vo1,CHAR_RIGHT_SQUARE_BRACKET:lRA}=ub(),Oo1=(A)=>{return A===Lo1||A===cb},Co1=(A)=>{if(A.isPrefix!==!0)A.depth=A.isGlobstar?1/0:1},dRA=(A,Q)=>{let B=Q||{},J=A.length-1,D=B.parts===!0||B.scanToEnd===!0,z=[],G=[],X=[],K=A,Y=-1,q=0,Z=0,H=!1,F=!1,E=!1,M=!1,W=!1,w=!1,I=!1,N=!1,V=!1,L=!1,j=0,R,$,T={value:"",depth:0,isGlob:!1},P=()=>Y>=J,S=()=>K.charCodeAt(Y+1),b=()=>{return R=$,K.charCodeAt(++Y)};while(Y<J){$=b();let m;if($===cb){if(I=T.backslashes=!0,$=b(),$===$q1)w=!0;continue}if(w===!0||$===$q1){j++;while(P()!==!0&&($=b())){if($===cb){I=T.backslashes=!0,b();continue}if($===$q1){j++;continue}if(w!==!0&&$===jq1&&($=b())===jq1){if(H=T.isBrace=!0,E=T.isGlob=!0,L=!0,D===!0)continue;break}if(w!==!0&&$===mRA){if(H=T.isBrace=!0,E=T.isGlob=!0,L=!0,D===!0)continue;break}if($===cRA){if(j--,j===0){w=!1,H=T.isBrace=!0,L=!0;break}}}if(D===!0)continue;break}if($===Lo1){if(z.push(Y),G.push(T),T={value:"",depth:0,isGlob:!1},L===!0)continue;if(R===jq1&&Y===q+1){q+=2;continue}Z=Y+1;continue}if(B.noext!==!0){if(($===pRA||$===hRA||$===Rq1||$===No1||$===Tq1)===!0&&S()===_q1){if(E=T.isGlob=!0,M=T.isExtglob=!0,L=!0,$===Tq1&&Y===q)V=!0;if(D===!0){while(P()!==!0&&($=b())){if($===cb){I=T.backslashes=!0,$=b();continue}if($===Vo1){E=T.isGlob=!0,L=!0;break}}continue}break}}if($===Rq1){if(R===Rq1)W=T.isGlobstar=!0;if(E=T.isGlob=!0,L=!0,D===!0)continue;break}if($===No1){if(E=T.isGlob=!0,L=!0,D===!0)continue;break}if($===uRA){while(P()!==!0&&(m=b())){if(m===cb){I=T.backslashes=!0,b();continue}if(m===lRA){F=T.isBracket=!0,E=T.isGlob=!0,L=!0;break}}if(D===!0)continue;break}if(B.nonegate!==!0&&$===Tq1&&Y===q){N=T.negated=!0,q++;continue}if(B.noparen!==!0&&$===_q1){if(E=T.isGlob=!0,D===!0){while(P()!==!0&&($=b())){if($===_q1){I=T.backslashes=!0,$=b();continue}if($===Vo1){L=!0;break}}continue}break}if(E===!0){if(L=!0,D===!0)continue;break}}if(B.noext===!0)M=!1,E=!1;let u=K,_="",k="";if(q>0)_=K.slice(0,q),K=K.slice(q),Z-=q;if(u&&E===!0&&Z>0)u=K.slice(0,Z),k=K.slice(Z);else if(E===!0)u="",k=K;else u=K;if(u&&u!==""&&u!=="/"&&u!==K){if(Oo1(u.charCodeAt(u.length-1)))u=u.slice(0,-1)}if(B.unescape===!0){if(k)k=Io1.removeBackslashes(k);if(u&&I===!0)u=Io1.removeBackslashes(u)}let y={prefix:_,input:A,start:q,base:u,glob:k,isBrace:H,isBracket:F,isGlob:E,isExtglob:M,isGlobstar:W,negated:N,negatedExtglob:V};if(B.tokens===!0){if(y.maxDepth=0,!Oo1($))G.push(T);y.tokens=G}if(B.parts===!0||B.tokens===!0){let m;for(let v=0;v<z.length;v++){let x=m?m+1:q,p=z[v],d=A.slice(x,p);if(B.tokens){if(v===0&&q!==0)G[v].isPrefix=!0,G[v].value=_;else G[v].value=d;Co1(G[v]),y.maxDepth+=G[v].depth}if(v!==0||d!=="")X.push(d);m=p}if(m&&m+1<A.length){let v=A.slice(m+1);if(X.push(v),B.tokens)G[G.length-1].value=v,Co1(G[G.length-1]),y.maxDepth+=G[G.length-1].depth}y.slashes=z,y.parts=X}return y};Ro1.exports=dRA});var _o1=n((VT2,$o1)=>{var gs=ub(),GU=pb(),{MAX_LENGTH:xs,POSIX_REGEX_SOURCE:iRA,REGEX_NON_SPECIAL_CHARS:aRA,REGEX_SPECIAL_CHARS_BACKREF:rRA,REPLACEMENTS:To1}=gs,nRA=(A,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...A,Q);A.sort();let B=`[${A.join("-")}]`;try{new RegExp(B)}catch(J){return A.map((D)=>GU.escapeRegex(D)).join("..")}return B},kT=(A,Q)=>{return`Missing ${A}: "${Q}" - use "\\\\${Q}" to match literal characters`},Pq1=(A,Q)=>{if(typeof A!=="string")throw new TypeError("Expected a string");A=To1[A]||A;let B={...Q},J=typeof B.maxLength==="number"?Math.min(xs,B.maxLength):xs,D=A.length;if(D>J)throw new SyntaxError(`Input length: ${D}, exceeds maximum allowed length: ${J}`);let z={type:"bos",value:"",output:B.prepend||""},G=[z],X=B.capture?"":"?:",K=gs.globChars(B.windows),Y=gs.extglobChars(K),{DOT_LITERAL:q,PLUS_LITERAL:Z,SLASH_LITERAL:H,ONE_CHAR:F,DOTS_SLASH:E,NO_DOT:M,NO_DOT_SLASH:W,NO_DOTS_SLASH:w,QMARK:I,QMARK_NO_DOT:N,STAR:V,START_ANCHOR:L}=K,j=(R1)=>{return`(${X}(?:(?!${L}${R1.dot?E:q}).)*?)`},R=B.dot?"":M,$=B.dot?I:N,T=B.bash===!0?j(B):V;if(B.capture)T=`(${T})`;if(typeof B.noext==="boolean")B.noextglob=B.noext;let P={input:A,index:-1,start:0,dot:B.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:G};A=GU.removePrefix(A,P),D=A.length;let S=[],b=[],u=[],_=z,k,y=()=>P.index===D-1,m=P.peek=(R1=1)=>A[P.index+R1],v=P.advance=()=>A[++P.index]||"",x=()=>A.slice(P.index+1),p=(R1="",a=0)=>{P.consumed+=R1,P.index+=a},d=(R1)=>{P.output+=R1.output!=null?R1.output:R1.value,p(R1.value)},B1=()=>{let R1=1;while(m()==="!"&&(m(2)!=="("||m(3)==="?"))v(),P.start++,R1++;if(R1%2===0)return!1;return P.negated=!0,P.start++,!0},s=(R1)=>{P[R1]++,u.push(R1)},z1=(R1)=>{P[R1]--,u.pop()},Q1=(R1)=>{if(_.type==="globstar"){let a=P.braces>0&&(R1.type==="comma"||R1.type==="brace"),r=R1.extglob===!0||S.length&&(R1.type==="pipe"||R1.type==="paren");if(R1.type!=="slash"&&R1.type!=="paren"&&!a&&!r)P.output=P.output.slice(0,-_.output.length),_.type="star",_.value="*",_.output=T,P.output+=_.output}if(S.length&&R1.type!=="paren")S[S.length-1].inner+=R1.value;if(R1.value||R1.output)d(R1);if(_&&_.type==="text"&&R1.type==="text"){_.output=(_.output||_.value)+R1.value,_.value+=R1.value;return}R1.prev=_,G.push(R1),_=R1},X1=(R1,a)=>{let r={...Y[a],conditions:1,inner:""};r.prev=_,r.parens=P.parens,r.output=P.output;let o=(B.capture?"(":"")+r.open;s("parens"),Q1({type:R1,value:a,output:P.output?"":F}),Q1({type:"paren",extglob:!0,value:v(),output:o}),S.push(r)},D1=(R1)=>{let a=R1.close+(B.capture?")":""),r;if(R1.type==="negate"){let o=T;if(R1.inner&&R1.inner.length>1&&R1.inner.includes("/"))o=j(B);if(o!==T||y()||/^\)+$/.test(x()))a=R1.close=`)$))${o}`;if(R1.inner.includes("*")&&(r=x())&&/^\.[^\\/.]+$/.test(r)){let J1=Pq1(r,{...Q,fastpaths:!1}).output;a=R1.close=`)${J1})${o})`}if(R1.prev.type==="bos")P.negatedExtglob=!0}Q1({type:"paren",extglob:!0,value:k,output:a}),z1("parens")};if(B.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(A)){let R1=!1,a=A.replace(rRA,(r,o,J1,G1,q1,Z1)=>{if(G1==="\\")return R1=!0,r;if(G1==="?"){if(o)return o+G1+(q1?I.repeat(q1.length):"");if(Z1===0)return $+(q1?I.repeat(q1.length):"");return I.repeat(J1.length)}if(G1===".")return q.repeat(J1.length);if(G1==="*"){if(o)return o+G1+(q1?T:"");return T}return o?r:`\\${r}`});if(R1===!0)if(B.unescape===!0)a=a.replace(/\\/g,"");else a=a.replace(/\\+/g,(r)=>{return r.length%2===0?"\\\\":r?"\\":""});if(a===A&&B.contains===!0)return P.output=A,P;return P.output=GU.wrapOutput(a,P,Q),P}while(!y()){if(k=v(),k==="\x00")continue;if(k==="\\"){let r=m();if(r==="/"&&B.bash!==!0)continue;if(r==="."||r===";")continue;if(!r){k+="\\",Q1({type:"text",value:k});continue}let o=/^\\+/.exec(x()),J1=0;if(o&&o[0].length>2){if(J1=o[0].length,P.index+=J1,J1%2!==0)k+="\\"}if(B.unescape===!0)k=v();else k+=v();if(P.brackets===0){Q1({type:"text",value:k});continue}}if(P.brackets>0&&(k!=="]"||_.value==="["||_.value==="[^")){if(B.posix!==!1&&k===":"){let r=_.value.slice(1);if(r.includes("[")){if(_.posix=!0,r.includes(":")){let o=_.value.lastIndexOf("["),J1=_.value.slice(0,o),G1=_.value.slice(o+2),q1=iRA[G1];if(q1){if(_.value=J1+q1,P.backtrack=!0,v(),!z.output&&G.indexOf(_)===1)z.output=F;continue}}}}if(k==="["&&m()!==":"||k==="-"&&m()==="]")k=`\\${k}`;if(k==="]"&&(_.value==="["||_.value==="[^"))k=`\\${k}`;if(B.posix===!0&&k==="!"&&_.value==="[")k="^";_.value+=k,d({value:k});continue}if(P.quotes===1&&k!=='"'){k=GU.escapeRegex(k),_.value+=k,d({value:k});continue}if(k==='"'){if(P.quotes=P.quotes===1?0:1,B.keepQuotes===!0)Q1({type:"text",value:k});continue}if(k==="("){s("parens"),Q1({type:"paren",value:k});continue}if(k===")"){if(P.parens===0&&B.strictBrackets===!0)throw new SyntaxError(kT("opening","("));let r=S[S.length-1];if(r&&P.parens===r.parens+1){D1(S.pop());continue}Q1({type:"paren",value:k,output:P.parens?")":"\\)"}),z1("parens");continue}if(k==="["){if(B.nobracket===!0||!x().includes("]")){if(B.nobracket!==!0&&B.strictBrackets===!0)throw new SyntaxError(kT("closing","]"));k=`\\${k}`}else s("brackets");Q1({type:"bracket",value:k});continue}if(k==="]"){if(B.nobracket===!0||_&&_.type==="bracket"&&_.value.length===1){Q1({type:"text",value:k,output:`\\${k}`});continue}if(P.brackets===0){if(B.strictBrackets===!0)throw new SyntaxError(kT("opening","["));Q1({type:"text",value:k,output:`\\${k}`});continue}z1("brackets");let r=_.value.slice(1);if(_.posix!==!0&&r[0]==="^"&&!r.includes("/"))k=`/${k}`;if(_.value+=k,d({value:k}),B.literalBrackets===!1||GU.hasRegexChars(r))continue;let o=GU.escapeRegex(_.value);if(P.output=P.output.slice(0,-_.value.length),B.literalBrackets===!0){P.output+=o,_.value=o;continue}_.value=`(${X}${o}|${_.value})`,P.output+=_.value;continue}if(k==="{"&&B.nobrace!==!0){s("braces");let r={type:"brace",value:k,output:"(",outputIndex:P.output.length,tokensIndex:P.tokens.length};b.push(r),Q1(r);continue}if(k==="}"){let r=b[b.length-1];if(B.nobrace===!0||!r){Q1({type:"text",value:k,output:k});continue}let o=")";if(r.dots===!0){let J1=G.slice(),G1=[];for(let q1=J1.length-1;q1>=0;q1--){if(G.pop(),J1[q1].type==="brace")break;if(J1[q1].type!=="dots")G1.unshift(J1[q1].value)}o=nRA(G1,B),P.backtrack=!0}if(r.comma!==!0&&r.dots!==!0){let J1=P.output.slice(0,r.outputIndex),G1=P.tokens.slice(r.tokensIndex);r.value=r.output="\\{",k=o="\\}",P.output=J1;for(let q1 of G1)P.output+=q1.output||q1.value}Q1({type:"brace",value:k,output:o}),z1("braces"),b.pop();continue}if(k==="|"){if(S.length>0)S[S.length-1].conditions++;Q1({type:"text",value:k});continue}if(k===","){let r=k,o=b[b.length-1];if(o&&u[u.length-1]==="braces")o.comma=!0,r="|";Q1({type:"comma",value:k,output:r});continue}if(k==="/"){if(_.type==="dot"&&P.index===P.start+1){P.start=P.index+1,P.consumed="",P.output="",G.pop(),_=z;continue}Q1({type:"slash",value:k,output:H});continue}if(k==="."){if(P.braces>0&&_.type==="dot"){if(_.value===".")_.output=q;let r=b[b.length-1];_.type="dots",_.output+=k,_.value+=k,r.dots=!0;continue}if(P.braces+P.parens===0&&_.type!=="bos"&&_.type!=="slash"){Q1({type:"text",value:k,output:q});continue}Q1({type:"dot",value:k,output:q});continue}if(k==="?"){if(!(_&&_.value==="(")&&B.noextglob!==!0&&m()==="("&&m(2)!=="?"){X1("qmark",k);continue}if(_&&_.type==="paren"){let o=m(),J1=k;if(_.value==="("&&!/[!=<:]/.test(o)||o==="<"&&!/<([!=]|\w+>)/.test(x()))J1=`\\${k}`;Q1({type:"text",value:k,output:J1});continue}if(B.dot!==!0&&(_.type==="slash"||_.type==="bos")){Q1({type:"qmark",value:k,output:N});continue}Q1({type:"qmark",value:k,output:I});continue}if(k==="!"){if(B.noextglob!==!0&&m()==="("){if(m(2)!=="?"||!/[!=<:]/.test(m(3))){X1("negate",k);continue}}if(B.nonegate!==!0&&P.index===0){B1();continue}}if(k==="+"){if(B.noextglob!==!0&&m()==="("&&m(2)!=="?"){X1("plus",k);continue}if(_&&_.value==="("||B.regex===!1){Q1({type:"plus",value:k,output:Z});continue}if(_&&(_.type==="bracket"||_.type==="paren"||_.type==="brace")||P.parens>0){Q1({type:"plus",value:k});continue}Q1({type:"plus",value:Z});continue}if(k==="@"){if(B.noextglob!==!0&&m()==="("&&m(2)!=="?"){Q1({type:"at",extglob:!0,value:k,output:""});continue}Q1({type:"text",value:k});continue}if(k!=="*"){if(k==="$"||k==="^")k=`\\${k}`;let r=aRA.exec(x());if(r)k+=r[0],P.index+=r[0].length;Q1({type:"text",value:k});continue}if(_&&(_.type==="globstar"||_.star===!0)){_.type="star",_.star=!0,_.value+=k,_.output=T,P.backtrack=!0,P.globstar=!0,p(k);continue}let R1=x();if(B.noextglob!==!0&&/^\([^?]/.test(R1)){X1("star",k);continue}if(_.type==="star"){if(B.noglobstar===!0){p(k);continue}let r=_.prev,o=r.prev,J1=r.type==="slash"||r.type==="bos",G1=o&&(o.type==="star"||o.type==="globstar");if(B.bash===!0&&(!J1||R1[0]&&R1[0]!=="/")){Q1({type:"star",value:k,output:""});continue}let q1=P.braces>0&&(r.type==="comma"||r.type==="brace"),Z1=S.length&&(r.type==="pipe"||r.type==="paren");if(!J1&&r.type!=="paren"&&!q1&&!Z1){Q1({type:"star",value:k,output:""});continue}while(R1.slice(0,3)==="/**"){let $1=A[P.index+4];if($1&&$1!=="/")break;R1=R1.slice(3),p("/**",3)}if(r.type==="bos"&&y()){_.type="globstar",_.value+=k,_.output=j(B),P.output=_.output,P.globstar=!0,p(k);continue}if(r.type==="slash"&&r.prev.type!=="bos"&&!G1&&y()){P.output=P.output.slice(0,-(r.output+_.output).length),r.output=`(?:${r.output}`,_.type="globstar",_.output=j(B)+(B.strictSlashes?")":"|$)"),_.value+=k,P.globstar=!0,P.output+=r.output+_.output,p(k);continue}if(r.type==="slash"&&r.prev.type!=="bos"&&R1[0]==="/"){let $1=R1[1]!==void 0?"|$":"";P.output=P.output.slice(0,-(r.output+_.output).length),r.output=`(?:${r.output}`,_.type="globstar",_.output=`${j(B)}${H}|${H}${$1})`,_.value+=k,P.output+=r.output+_.output,P.globstar=!0,p(k+v()),Q1({type:"slash",value:"/",output:""});continue}if(r.type==="bos"&&R1[0]==="/"){_.type="globstar",_.value+=k,_.output=`(?:^|${H}|${j(B)}${H})`,P.output=_.output,P.globstar=!0,p(k+v()),Q1({type:"slash",value:"/",output:""});continue}P.output=P.output.slice(0,-_.output.length),_.type="globstar",_.output=j(B),_.value+=k,P.output+=_.output,P.globstar=!0,p(k);continue}let a={type:"star",value:k,output:T};if(B.bash===!0){if(a.output=".*?",_.type==="bos"||_.type==="slash")a.output=R+a.output;Q1(a);continue}if(_&&(_.type==="bracket"||_.type==="paren")&&B.regex===!0){a.output=k,Q1(a);continue}if(P.index===P.start||_.type==="slash"||_.type==="dot"){if(_.type==="dot")P.output+=W,_.output+=W;else if(B.dot===!0)P.output+=w,_.output+=w;else P.output+=R,_.output+=R;if(m()!=="*")P.output+=F,_.output+=F}Q1(a)}while(P.brackets>0){if(B.strictBrackets===!0)throw new SyntaxError(kT("closing","]"));P.output=GU.escapeLast(P.output,"["),z1("brackets")}while(P.parens>0){if(B.strictBrackets===!0)throw new SyntaxError(kT("closing",")"));P.output=GU.escapeLast(P.output,"("),z1("parens")}while(P.braces>0){if(B.strictBrackets===!0)throw new SyntaxError(kT("closing","}"));P.output=GU.escapeLast(P.output,"{"),z1("braces")}if(B.strictSlashes!==!0&&(_.type==="star"||_.type==="bracket"))Q1({type:"maybe_slash",value:"",output:`${H}?`});if(P.backtrack===!0){P.output="";for(let R1 of P.tokens)if(P.output+=R1.output!=null?R1.output:R1.value,R1.suffix)P.output+=R1.suffix}return P};Pq1.fastpaths=(A,Q)=>{let B={...Q},J=typeof B.maxLength==="number"?Math.min(xs,B.maxLength):xs,D=A.length;if(D>J)throw new SyntaxError(`Input length: ${D}, exceeds maximum allowed length: ${J}`);A=To1[A]||A;let{DOT_LITERAL:z,SLASH_LITERAL:G,ONE_CHAR:X,DOTS_SLASH:K,NO_DOT:Y,NO_DOTS:q,NO_DOTS_SLASH:Z,STAR:H,START_ANCHOR:F}=gs.globChars(B.windows),E=B.dot?q:Y,M=B.dot?Z:Y,W=B.capture?"":"?:",w={negated:!1,prefix:""},I=B.bash===!0?".*?":H;if(B.capture)I=`(${I})`;let N=(R)=>{if(R.noglobstar===!0)return I;return`(${W}(?:(?!${F}${R.dot?K:z}).)*?)`},V=(R)=>{switch(R){case"*":return`${E}${X}${I}`;case".*":return`${z}${X}${I}`;case"*.*":return`${E}${I}${z}${X}${I}`;case"*/*":return`${E}${I}${G}${X}${M}${I}`;case"**":return E+N(B);case"**/*":return`(?:${E}${N(B)}${G})?${M}${X}${I}`;case"**/*.*":return`(?:${E}${N(B)}${G})?${M}${I}${z}${X}${I}`;case"**/.*":return`(?:${E}${N(B)}${G})?${z}${X}${I}`;default:{let $=/^(.*?)\.(\w+)$/.exec(R);if(!$)return;let T=V($[1]);if(!T)return;return T+z+$[2]}}},L=GU.removePrefix(A,w),j=V(L);if(j&&B.strictSlashes!==!0)j+=`${G}?`;return j};$o1.exports=Pq1});var vo1=n((OT2,So1)=>{var sRA=jo1(),Sq1=_o1(),Po1=pb(),oRA=ub(),tRA=(A)=>A&&typeof A==="object"&&!Array.isArray(A),o7=(A,Q,B=!1)=>{if(Array.isArray(A)){let q=A.map((H)=>o7(H,Q,B));return(H)=>{for(let F of q){let E=F(H);if(E)return E}return!1}}let J=tRA(A)&&A.tokens&&A.input;if(A===""||typeof A!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let D=Q||{},z=D.windows,G=J?o7.compileRe(A,Q):o7.makeRe(A,Q,!1,!0),X=G.state;delete G.state;let K=()=>!1;if(D.ignore){let q={...Q,ignore:null,onMatch:null,onResult:null};K=o7(D.ignore,q,B)}let Y=(q,Z=!1)=>{let{isMatch:H,match:F,output:E}=o7.test(q,G,Q,{glob:A,posix:z}),M={glob:A,state:X,regex:G,posix:z,input:q,output:E,match:F,isMatch:H};if(typeof D.onResult==="function")D.onResult(M);if(H===!1)return M.isMatch=!1,Z?M:!1;if(K(q)){if(typeof D.onIgnore==="function")D.onIgnore(M);return M.isMatch=!1,Z?M:!1}if(typeof D.onMatch==="function")D.onMatch(M);return Z?M:!0};if(B)Y.state=X;return Y};o7.test=(A,Q,B,{glob:J,posix:D}={})=>{if(typeof A!=="string")throw new TypeError("Expected input to be a string");if(A==="")return{isMatch:!1,output:""};let z=B||{},G=z.format||(D?Po1.toPosixSlashes:null),X=A===J,K=X&&G?G(A):A;if(X===!1)K=G?G(A):A,X=K===J;if(X===!1||z.capture===!0)if(z.matchBase===!0||z.basename===!0)X=o7.matchBase(A,Q,B,D);else X=Q.exec(K);return{isMatch:Boolean(X),match:X,output:K}};o7.matchBase=(A,Q,B)=>{return(Q instanceof RegExp?Q:o7.makeRe(Q,B)).test(Po1.basename(A))};o7.isMatch=(A,Q,B)=>o7(Q,B)(A);o7.parse=(A,Q)=>{if(Array.isArray(A))return A.map((B)=>o7.parse(B,Q));return Sq1(A,{...Q,fastpaths:!1})};o7.scan=(A,Q)=>sRA(A,Q);o7.compileRe=(A,Q,B=!1,J=!1)=>{if(B===!0)return A.output;let D=Q||{},z=D.contains?"":"^",G=D.contains?"":"$",X=`${z}(?:${A.output})${G}`;if(A&&A.negated===!0)X=`^(?!${X}).*$`;let K=o7.toRegex(X,Q);if(J===!0)K.state=A;return K};o7.makeRe=(A,Q={},B=!1,J=!1)=>{if(!A||typeof A!=="string")throw new TypeError("Expected a non-empty string");let D={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(A[0]==="."||A[0]==="*"))D.output=Sq1.fastpaths(A,Q);if(!D.output)D=Sq1(A,Q);return o7.compileRe(D,Q,B,J)};o7.toRegex=(A,Q)=>{try{let B=Q||{};return new RegExp(A,B.flags||(B.nocase?"i":""))}catch(B){if(Q&&Q.debug===!0)throw B;return/$^/}};o7.constants=oRA;So1.exports=o7});var lb=n((CT2,yo1)=>{var ko1=vo1(),eRA=pb();function fo1(A,Q,B=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:eRA.isWindows()};return ko1(A,Q,B)}Object.assign(fo1,ko1);yo1.exports=fo1});var hs;var bo1=j1(()=>{hs={name:"amp",description:"An agentic coding tool, in research preview from Sourcegraph.",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","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","start:dev:web":"vscode-test-web --extensionDevelopmentPath=. --browserOption=--disable-web-security --verbose --open-devtools --verbose --printServerLog","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":"vite build",build:"pnpm run -s _build:extension && concurrently 'pnpm run -s _build:debugger' 'pnpm run -s _build:web'","build:production":"pnpm run -s _build:extension:production && concurrently 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production'","_build:extension":"vite build","_build:extension:production":"cross-env NODE_ENV=production vite build","_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: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":"vite build && pnpm run -s _build:web && pnpm run -s _build:debugger && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"vite build && pnpm run -s _build:web && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team at Sourcegraph",email:"amp-devs@sourcegraph.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.node.js",activationEvents:["onStartupFinished"],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"}]},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.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{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.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 Amp Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.manualTrigger",title:"Amp Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Amp Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Amp Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.tab.clearStuckDecorations",title:"Amp Tab Clear Stuck Decorations",category:"Amp"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"}],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.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:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"}],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"}},required:["url"]}]}},"amp.experimental.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:[{matches:{command:"*"},action:"allow"},{matches:{url:"*"},action:"allow"}],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"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.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: chat_llm",items:{type:"string"},default:[],scope:"application"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",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.terminal.commands.hide":{type:"boolean",default:!0,description:"Whether to hide the integrated VS Code terminal by default when starting commands",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.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.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dimissCommandIds":{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.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"same_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.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.experimental.centralizedStorage.enabled":{type:"boolean",default:!1,description:"Enable centralized thread storage across CLI and VS Code. When disabled, VS Code uses its legacy storage location.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.reviewTool":{type:"boolean",default:!1,description:"Experimental: Enable the summarize_git_diff tool.",scope:"application"},"amp.summary.provider":{type:"string",enum:["anthropic","gemini"],default:"gemini",description:"Experimental: change summary provider.",scope:"application"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"},"amp.gpt5":{type:"boolean",default:!1,description:"Try GPT-5 from OpenAI as the primary agent model, instead of Claude Sonnet 4. Only available during the limited model testing period. See https://ampcode.com/news/model-evaluation#gpt5.",scope:"window"},"amp.gpt5ReasoningEffort":{type:"string",enum:["minimal","low","medium","high"],default:"medium",description:"Reasoning effort to use with GPT-5 (when enabled).",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.experimental.mcpPermissions","amp.url","amp.anthropic.baseURL"]},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:{"@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/observable":"workspace:*","@sourcegraph/amp-uri":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12"},devDependencies:{"@sourcegraph/amp-web":"workspace:*","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@vscode/test-electron":"^2.4.1","@vscode/test-web":"*","@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","vite-plugin-static-copy":"^3.0.0"}}});function QjA(A){return typeof A==="number"&&Number.isInteger(A)&&A>=1&&A<=3600}function go1(A){let Q=A.settings["tools.inactivityTimeout"],B=A.settings["tools.stopTimeout"],J=Q;if(J===void 0&&B!==void 0)J=B;if(J===void 0)J=hs.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!QjA(J))return null;return J*1000}function xo1(A){let Q=A.settings["tools.stopTimeout"],B=hs.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??B)*1000}var jT2;var vq1=j1(()=>{bo1();jT2=hs.contributes.configuration.properties});function ms(A,Q){return new GA((B)=>{let J=setTimeout(D,Q);function D(){B.error(new Error(`Tool execution timed out after ${Q/1000} seconds`))}function z(){if(J)clearTimeout(J);J=setTimeout(D,Q)}let G=A.subscribe({next:(X)=>{z(),B.next(X)},error:(X)=>{if(J)clearTimeout(J),J=null;B.error(X)},complete:()=>{if(J)clearTimeout(J),J=null;B.complete()}});return()=>{if(J)clearTimeout(J),J=null;G.unsubscribe()}})}var kq1=j1(()=>{O6()});function vF(A,Q){let B={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},J=Q.modelCustomizations;if(J){for(let D of J)if(D.modelSelector.test(A))B={...B,description:D.description??B.description,inputSchema:D.inputSchema??B.inputSchema,customizedForModel:!0}}return B}function y4(A){return["done","error","rejected-by-user","cancelled"].includes(A.status)}function ps(){let A=[],Q=new R8;function B(D,z){let G=A.filter((X)=>X.spec.name===D);for(let X of G)if(db(X.spec,z).enabled)return X;return}function J(D,z,G){if(!D)throw new Error("spec is required");let X={spec:D,fn:Promise.resolve(z),preprocessArgs:G};return A.push(X),Q.next(),{dispose:()=>{let K=A.indexOf(X);if(K!==-1)A.splice(K,1),Q.next()}}}return{registerTool({spec:D,fn:z,preprocessArgs:G}){if(!z)return BjA;return J(D,z,G)},tools:j5(h2,Q.pipe(L7(void 0))).pipe(U2(([D])=>{return A.map((z)=>({spec:z.spec,...db(z.spec,D)})).sort((z,G)=>z.spec.name.localeCompare(G.spec.name))})),invokeTool(D,z,G){let X=performance.now(),K=()=>DjA.record(performance.now()-X,{toolName:D});if(D===yq1&&z.args&&"invalid_tool_name"in z.args&&typeof z.args.invalid_tool_name==="string"){us.add(1,{toolName:D,error:"invalid"});let q=JjA(z.args.invalid_tool_name);return new GA((Z)=>{Z.error(new Error(q))})}let Y=B(D,G.config);if(!Y){let q=A.filter((E)=>E.spec.name===D);if(q.length===0)return us.add(1,{toolName:D,error:"not_found"}),new GA((E)=>{E.error(new Error(`tool ${JSON.stringify(D)} not found`))});let Z=q[0],H=db(Z.spec,G.config);us.add(1,{toolName:D,error:"disabled"});let F=H.enabled?"unknown":H.disabledReason;return new GA((E)=>{E.error(new Error(`tool ${JSON.stringify(D)} is disabled: ${F}`))})}return us.add(1,{toolName:D}),M8(()=>Y.fn).pipe(y9((q)=>{let Z=q(z,G);if(Y.spec.meta?.disableTimeout)return Z;return ms(Z,xo1(G.config))}),hW(()=>K()))},preprocessArgs(D,z,G){let X=B(D,G.config);if(!X||!X.preprocessArgs)return;let K=X.preprocessArgs;try{return K(z,G)}catch(Y){N1.error("preprocessArgs",{id:D,args:z,error:String(Y)});return}},dispose(){}}}function fq1(A,Q){for(let B of Q){if(B==="")continue;if(B.length===1){if(B==="*")return!0;if(B===A)return!0;continue}if(A===B)return!0;if(B.includes("*")||B.includes("?")||B.includes("[")||B.includes("{"))try{if(mo1.default(B,{dot:!0})(A))return!0}catch(J){continue}}return!1}function db(A,Q){let B=Q.settings?.["tools.disable"]??[];if(fq1(A.name,B))return{enabled:!1,disabledReason:"settings"};if(typeof A.source==="object"&&"mcp"in A.source){let J=po1(A.name);if(J&&A.source.mcp===J.server&&fq1(J.tool,B))return{enabled:!1,disabledReason:"settings"}}if(A.source==="builtin"&&fq1(`builtin:${A.name}`,B))return{enabled:!1,disabledReason:"settings"};if(A.name===s7||A.name===sX){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function JjA(A){return`Invalid tool name ${JSON.stringify(A)}. Tool names must match the pattern ${bq1.toString()}. Try again with a valid tool name.`}function po1(A){let[,Q,B]=A.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&B)return{server:Q,tool:B};return}function co1(A){if(A.status==="in-progress"||A.status==="done"||A.status==="cancelled"||A.status==="error")return A.progress;return}function fT(A,Q,B=!0){let J=new Set(Q.map((z)=>z.spec.name));function D(z){if(J.has(z))return!0;if(B&&po1(z))return!0;return!1}return{registerTool(z){throw new Error("Tools should not be registered in a filtered tool service")},invokeTool(z,G,X){if(!D(z))return new GA((K)=>{K.error(new Error(`tool ${JSON.stringify(z)} not allowed in filtered service`))});return A.invokeTool(z,G,X)},preprocessArgs(z,G,X){if(!D(z))return;return A.preprocessArgs?.(z,G,X)},tools:A.tools.pipe(U2((z)=>z.filter((G)=>D(G.spec.name)))),dispose(){}}}var ho1,mo1,BjA,yq1="invalid_tool",bq1,uo1,us,DjA;var cJ=j1(()=>{ho1=WA(ZT(),1);O6();mo1=WA(lb(),1);iA();vq1();NQ();kq1();t8();BjA={dispose(){}};bq1=/^[a-zA-Z0-9_]{1,64}$/,uo1=ho1.metrics.getMeter("tool_service"),us=uo1.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),DjA=uo1.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var no1=n((ao1)=>{Object.defineProperty(ao1,"__esModule",{value:!0});ao1.calcSlices=ao1.applyPatch=ao1.calcPatch=ao1.lcs=ao1.diff=ao1.diff_core=void 0;function zjA(A,Q){let{b:B,eq:J,stack_base:D}=A,{i:z,N:G,j:X,M:K,Z:Y,stack_top:q}=A;for(;;)switch(Q){case 0:{A:while(G>0&&K>0){B.fill(0,0,2*Y);let Z=G-K,H=G+K,F=H&1,E=z+G-1,M=X+K-1,W=(H+F)/2,w;Q:for(let I=0;I<=W;I++){let N=2*Math.max(0,I-K)-I,V=I-2*Math.max(0,I-G);for(let L=N;L<=V;L+=2){let j=B[L-1-Y*Math.floor((L-1)/Y)],R=B[L+1-Y*Math.floor((L+1)/Y)],$=L===-I||L!==I&&j<R?R:j+1,T=$-L,P=$,S=T;while(P<G&&S<K&&J(z+P,X+S))P++,S++;if(B[L-Y*Math.floor(L/Y)]=P,F===1&&(w=Z-L)>=1-I&&w<I&&P+B[Y+w-Y*Math.floor(w/Y)]>=G)if(I>1||P!==$){D[q++]=z+P,D[q++]=G-P,D[q++]=X+S,D[q++]=K-S,G=$,K=T,Y=2*(Math.min(G,K)+1);continue A}else break Q}for(let L=N;L<=V;L+=2){let j=B[Y+L-1-Y*Math.floor((L-1)/Y)],R=B[Y+L+1-Y*Math.floor((L+1)/Y)],$=L===-I||L!==I&&j<R?R:j+1,T=$-L,P=$,S=T;while(P<G&&S<K&&J(E-P,M-S))P++,S++;if(B[Y+L-Y*Math.floor(L/Y)]=P,F===0&&(w=Z-L)>=-I&&w<=I&&P+B[w-Y*Math.floor(w/Y)]>=G)if(I>0||P!==$){D[q++]=z+G-$,D[q++]=$,D[q++]=X+K-T,D[q++]=T,G=G-P,K=K-S,Y=2*(Math.min(G,K)+1);continue A}else break Q}}if(G===K)continue;if(K>G)z+=G,X+=G,K-=G,G=0;else z+=K,X+=K,G-=K,K=0;break}if(G+K!==0)if(A.pxe===z||A.pye===X)A.pxe=z+G,A.pye=X+K;else{let Z=A.pxs;if(A.oxs=A.pxs,A.oxe=A.pxe,A.oys=A.pys,A.oye=A.pye,A.pxs=z,A.pxe=z+G,A.pys=X,A.pye=X+K,Z>=0)return A.i=z,A.N=G,A.j=X,A.M=K,A.Z=Y,A.stack_top=q,1}}case 1:{if(q===0)return 2;K=D[--q],X=D[--q],G=D[--q],z=D[--q],Y=2*(Math.min(G,K)+1),Q=0}}}class lo1{constructor(A){this.state=A,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:A,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let B=zjA(A,this.c);if(this.c=B,B===1)return Q.value=[A.oxs,A.oxe,A.oys,A.oye],Q;if(A.pxs>=0)return Q.value=[A.pxs,A.pxe,A.pys,A.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function do1(A,Q,B,J,D){let z=(Math.min(Q,J)+1)*2,G=Q+J,X=new(G<256?Uint8Array:G<65536?Uint16Array:Uint32Array)(2*z);return new lo1({i:A,N:Q,j:B,M:J,Z:z,b:X,eq:D,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}ao1.diff_core=do1;function cs(A,Q,B){let[J,D,z]=[0,A.length,Q.length];if(typeof B==="function"){while(J<D&&J<z&&B(J,J))J++;if(J===D&&J===z)return[][Symbol.iterator]();while(B(--D,--z)&&D>J&&z>J);}else{while(J<D&&J<z&&A[J]===Q[J])J++;if(J===D&&J===z)return[][Symbol.iterator]();while(A[--D]===Q[--z]&&D>J&&z>J);B=(G,X)=>A[G]===Q[X]}return do1(J,D+1-J,J,z+1-J,B)}ao1.diff=cs;class io1{constructor(A,Q){this.diff=A,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let A=this.diff.next();if(A.done){let{i:X,j:K,N:Y}=this;if(X<Y)A.done=!1,A.value=[X,K,Y-X],this.i=Y;return A}let Q=A.value,B=Q[0],J=Q[1],D=Q[3],{i:z,j:G}=this;if(z!==B)Q.length--,Q[0]=z,Q[1]=G,Q[2]=B-z;return this.i=J,this.j=D,A}}function GjA(A,Q,B){return new io1(cs(A,Q,B),A.length)}ao1.lcs=GjA;function*XjA(A,Q,B){let J=ArrayBuffer.isView(A)?Uint8Array.prototype.subarray:A.slice;for(let D of cs(A,Q,B))D[2]=J.call(Q,D[2],D[3]),yield D}ao1.calcPatch=XjA;function*KjA(A,Q){let B=0,J=ArrayBuffer.isView(A)?Uint8Array.prototype.subarray:A.slice;for(let[D,z,G]of Q){if(B<D)yield J.call(A,B,D);if(G.length>0)yield G;B=z}if(B<A.length)yield J.call(A,B)}ao1.applyPatch=KjA;function*YjA(A,Q,B){let J=0,D=ArrayBuffer.isView(A)?Uint8Array.prototype.subarray:A.slice;for(let[z,G,X,K]of cs(A,Q,B)){if(J<z)yield[0,D.call(A,J,z)];if(z<G)yield[-1,D.call(A,z,G)];if(X<K)yield[1,D.call(Q,X,K)];J=G}if(J<A.length)yield[0,A.slice(J)]}ao1.calcSlices=YjA});function ls(A,Q){if(A===void 0||Q===void 0||A===Q)return{added:0,deleted:0,changed:0};let B={added:0,deleted:0,changed:0};for(let[J,D,z,G]of so1.diff(A.split(`
4
4
  `),Q.split(`
5
5
  `)))B.deleted+=D-J,B.added+=G-z,B.changed+=Math.min(D-J,G-z);return B}function ds(A){if(!A)return{totalFiles:0,createdFiles:0,totalAdded:0,totalRemoved:0,totalModified:0,revertedFiles:0,allReverted:!1};let Q=A.files.length,B=A.files.filter((K)=>K.created).length,J=A.files.filter((K)=>K.reverted).length,D=J===Q&&Q>0,z=0,G=0,X=0;for(let K of A.files){if(K.reverted)continue;z+=K.diffStat.added,G+=K.diffStat.removed,X+=K.diffStat.modified}return{totalFiles:Q,createdFiles:B,totalAdded:z,totalRemoved:G,totalModified:X,revertedFiles:J,allReverted:D}}var so1;var ib=j1(()=>{so1=WA(no1(),1)});function lJ(A,...Q){throw new Error(`[Immer] minified error nr: ${A}. Full error at: https://bit.ly/3cXEKWf`)}function $3(A){return!!A&&!!A[aG]}function oW(A){if(!A)return!1;return Qt1(A)||Array.isArray(A)||!!A[ab]||!!A.constructor?.[ab]||tb(A)||eb(A)}function Qt1(A){if(!A||typeof A!=="object")return!1;let Q=T3(A);if(Q===null)return!0;let B=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(B===Object)return!0;return typeof B=="function"&&Function.toString.call(B)===EjA}function rb(A,Q){if(_3(A)===0)Reflect.ownKeys(A).forEach((B)=>{Q(B,A[B],A)});else A.forEach((B,J)=>Q(J,B,A))}function _3(A){let Q=A[aG];return Q?Q.type_:Array.isArray(A)?1:tb(A)?2:eb(A)?3:0}function nb(A,Q){return _3(A)===2?A.has(Q):Object.prototype.hasOwnProperty.call(A,Q)}function gq1(A,Q){return _3(A)===2?A.get(Q):A[Q]}function Bt1(A,Q,B){let J=_3(A);if(J===2)A.set(Q,B);else if(J===3)A.add(B);else A[Q]=B}function MjA(A,Q){if(A===Q)return A!==0||1/A===1/Q;else return A!==A&&Q!==Q}function tb(A){return A instanceof Map}function eb(A){return A instanceof Set}function j3(A){return A.copy_||A.base_}function mq1(A,Q){if(tb(A))return new Map(A);if(eb(A))return new Set(A);if(Array.isArray(A))return Array.prototype.slice.call(A);let B=Qt1(A);if(Q===!0||Q==="class_only"&&!B){let J=Object.getOwnPropertyDescriptors(A);delete J[aG];let D=Reflect.ownKeys(J);for(let z=0;z<D.length;z++){let G=D[z],X=J[G];if(X.writable===!1)X.writable=!0,X.configurable=!0;if(X.get||X.set)J[G]={configurable:!0,writable:!0,enumerable:X.enumerable,value:A[G]}}return Object.create(T3(A),J)}else{let J=T3(A);if(J!==null&&B)return{...A};let D=Object.create(J);return Object.assign(D,A)}}function hz(A,Q=!1){if(rs(A)||$3(A)||!oW(A))return A;if(_3(A)>1)A.set=A.add=A.clear=A.delete=WjA;if(Object.freeze(A),Q)Object.entries(A).forEach(([B,J])=>hz(J,!0));return A}function WjA(){lJ(2)}function rs(A){return Object.isFrozen(A)}function P3(A){let Q=uq1[A];if(!Q)lJ(0,A);return Q}function wjA(A,Q){if(!uq1[A])uq1[A]=Q}function Jt1(){return sb}function IjA(A,Q){return{drafts_:[],parent_:A,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function oo1(A,Q){if(Q)P3("Patches"),A.patches_=[],A.inversePatches_=[],A.patchListener_=Q}function pq1(A){cq1(A),A.drafts_.forEach(NjA),A.drafts_=null}function cq1(A){if(A===sb)sb=A.parent_}function to1(A){return sb=IjA(sb,A)}function NjA(A){let Q=A[aG];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function eo1(A,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let B=Q.drafts_[0];if(A!==void 0&&A!==B){if(B[aG].modified_)pq1(Q),lJ(4);if(oW(A)){if(A=is(Q,A),!Q.parent_)as(Q,A)}if(Q.patches_)P3("Patches").generateReplacementPatches_(B[aG].base_,A,Q.patches_,Q.inversePatches_)}else A=is(Q,B,[]);if(pq1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return A!==iq1?A:void 0}function is(A,Q,B){if(rs(Q))return Q;let J=Q[aG];if(!J)return rb(Q,(D,z)=>At1(A,J,Q,D,z,B)),Q;if(J.scope_!==A)return Q;if(!J.modified_)return as(A,J.base_,!0),J.base_;if(!J.finalized_){J.finalized_=!0,J.scope_.unfinalizedDrafts_--;let D=J.copy_,z=D,G=!1;if(J.type_===3)z=new Set(D),D.clear(),G=!0;if(rb(z,(X,K)=>At1(A,J,D,X,K,B,G)),as(A,D,!1),B&&A.patches_)P3("Patches").generatePatches_(J,B,A.patches_,A.inversePatches_)}return J.copy_}function At1(A,Q,B,J,D,z,G){if($3(D)){let X=z&&Q&&Q.type_!==3&&!nb(Q.assigned_,J)?z.concat(J):void 0,K=is(A,D,X);if(Bt1(B,J,K),$3(K))A.canAutoFreeze_=!1;else return}else if(G)B.add(D);if(oW(D)&&!rs(D)){if(!A.immer_.autoFreeze_&&A.unfinalizedDrafts_<1)return;if(is(A,D),(!Q||!Q.scope_.parent_)&&typeof J!=="symbol"&&Object.prototype.propertyIsEnumerable.call(B,J))as(A,D)}}function as(A,Q,B=!1){if(!A.parent_&&A.immer_.autoFreeze_&&A.canAutoFreeze_)hz(Q,B)}function VjA(A,Q){let B=Array.isArray(A),J={type_:B?1:0,scope_:Q?Q.scope_:Jt1(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:A,draft_:null,copy_:null,revoke_:null,isManual_:!1},D=J,z=aq1;if(B)D=[J],z=ob;let{revoke:G,proxy:X}=Proxy.revocable(D,z);return J.draft_=X,J.revoke_=G,X}function xq1(A,Q){let B=A[aG];return(B?j3(B):A)[Q]}function OjA(A,Q,B){let J=Dt1(Q,B);return J?"value"in J?J.value:J.get?.call(A.draft_):void 0}function Dt1(A,Q){if(!(Q in A))return;let B=T3(A);while(B){let J=Object.getOwnPropertyDescriptor(B,Q);if(J)return J;B=T3(B)}return}function lq1(A){if(!A.modified_){if(A.modified_=!0,A.parent_)lq1(A.parent_)}}function hq1(A){if(!A.copy_)A.copy_=mq1(A.base_,A.scope_.immer_.useStrictShallowCopy_)}function dq1(A,Q){let B=tb(A)?P3("MapSet").proxyMap_(A,Q):eb(A)?P3("MapSet").proxySet_(A,Q):VjA(A,Q);return(Q?Q.scope_:Jt1()).drafts_.push(B),B}function LjA(A){if(!$3(A))lJ(10,A);return zt1(A)}function zt1(A){if(!oW(A)||rs(A))return A;let Q=A[aG],B;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,B=mq1(A,Q.scope_.immer_.useStrictShallowCopy_)}else B=mq1(A,!0);if(rb(B,(J,D)=>{Bt1(B,J,zt1(D))}),Q)Q.finalized_=!1;return B}function ns(){let Q="replace",B="add",J="remove";function D(H,F,E,M){switch(H.type_){case 0:case 2:return G(H,F,E,M);case 1:return z(H,F,E,M);case 3:return X(H,F,E,M)}}function z(H,F,E,M){let{base_:W,assigned_:w}=H,I=H.copy_;if(I.length<W.length)[W,I]=[I,W],[E,M]=[M,E];for(let N=0;N<W.length;N++)if(w[N]&&I[N]!==W[N]){let V=F.concat([N]);E.push({op:Q,path:V,value:Z(I[N])}),M.push({op:Q,path:V,value:Z(W[N])})}for(let N=W.length;N<I.length;N++){let V=F.concat([N]);E.push({op:B,path:V,value:Z(I[N])})}for(let N=I.length-1;W.length<=N;--N){let V=F.concat([N]);M.push({op:J,path:V})}}function G(H,F,E,M){let{base_:W,copy_:w}=H;rb(H.assigned_,(I,N)=>{let V=gq1(W,I),L=gq1(w,I),j=!N?J:nb(W,I)?Q:B;if(V===L&&j===Q)return;let R=F.concat(I);E.push(j===J?{op:j,path:R}:{op:j,path:R,value:L}),M.push(j===B?{op:J,path:R}:j===J?{op:B,path:R,value:Z(V)}:{op:Q,path:R,value:Z(V)})})}function X(H,F,E,M){let{base_:W,copy_:w}=H,I=0;W.forEach((N)=>{if(!w.has(N)){let V=F.concat([I]);E.push({op:J,path:V,value:N}),M.unshift({op:B,path:V,value:N})}I++}),I=0,w.forEach((N)=>{if(!W.has(N)){let V=F.concat([I]);E.push({op:B,path:V,value:N}),M.unshift({op:J,path:V,value:N})}I++})}function K(H,F,E,M){E.push({op:Q,path:[],value:F===iq1?void 0:F}),M.push({op:Q,path:[],value:H})}function Y(H,F){return F.forEach((E)=>{let{path:M,op:W}=E,w=H;for(let L=0;L<M.length-1;L++){let j=_3(w),R=M[L];if(typeof R!=="string"&&typeof R!=="number")R=""+R;if((j===0||j===1)&&(R==="__proto__"||R==="constructor"))lJ(19);if(typeof w==="function"&&R==="prototype")lJ(19);if(w=gq1(w,R),typeof w!=="object")lJ(18,M.join("/"))}let I=_3(w),N=q(E.value),V=M[M.length-1];switch(W){case Q:switch(I){case 2:return w.set(V,N);case 3:lJ(16);default:return w[V]=N}case B:switch(I){case 1:return V==="-"?w.push(N):w.splice(V,0,N);case 2:return w.set(V,N);case 3:return w.add(N);default:return w[V]=N}case J:switch(I){case 1:return w.splice(V,1);case 2:return w.delete(V);case 3:return w.delete(E.value);default:return delete w[V]}default:lJ(17,W)}}),H}function q(H){if(!oW(H))return H;if(Array.isArray(H))return H.map(q);if(tb(H))return new Map(Array.from(H.entries()).map(([E,M])=>[E,q(M)]));if(eb(H))return new Set(Array.from(H).map(q));let F=Object.create(T3(H));for(let E in H)F[E]=q(H[E]);if(nb(H,ab))F[ab]=H[ab];return F}function Z(H){if($3(H))return q(H);else return H}wjA("Patches",{applyPatches_:Y,generatePatches_:D,generateReplacementPatches_:K})}function b9(A){return A}var iq1,ab,aG,T3,EjA,uq1,sb,aq1,ob,CjA=class{constructor(A){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,B,J)=>{if(typeof Q==="function"&&typeof B!=="function"){let z=B;B=Q;let G=this;return function X(K=z,...Y){return G.produce(K,(q)=>B.call(this,q,...Y))}}if(typeof B!=="function")lJ(6);if(J!==void 0&&typeof J!=="function")lJ(7);let D;if(oW(Q)){let z=to1(this),G=dq1(Q,void 0),X=!0;try{D=B(G),X=!1}finally{if(X)pq1(z);else cq1(z)}return oo1(z,J),eo1(D,z)}else if(!Q||typeof Q!=="object"){if(D=B(Q),D===void 0)D=Q;if(D===iq1)D=void 0;if(this.autoFreeze_)hz(D,!0);if(J){let z=[],G=[];P3("Patches").generateReplacementPatches_(Q,D,z,G),J(z,G)}return D}else lJ(1,Q)},this.produceWithPatches=(Q,B)=>{if(typeof Q==="function")return(G,...X)=>this.produceWithPatches(G,(K)=>Q(K,...X));let J,D;return[this.produce(Q,B,(G,X)=>{J=G,D=X}),J,D]},typeof A?.autoFreeze==="boolean")this.setAutoFreeze(A.autoFreeze);if(typeof A?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(A.useStrictShallowCopy)}createDraft(A){if(!oW(A))lJ(8);if($3(A))A=LjA(A);let Q=to1(this),B=dq1(A,void 0);return B[aG].isManual_=!0,cq1(Q),B}finishDraft(A,Q){let B=A&&A[aG];if(!B||!B.isManual_)lJ(9);let{scope_:J}=B;return oo1(J,Q),eo1(void 0,J)}setAutoFreeze(A){this.autoFreeze_=A}setUseStrictShallowCopy(A){this.useStrictShallowCopy_=A}applyPatches(A,Q){let B;for(B=Q.length-1;B>=0;B--){let D=Q[B];if(D.path.length===0&&D.op==="replace"){A=D.value;break}}if(B>-1)Q=Q.slice(B+1);let J=P3("Patches").applyPatches_;if($3(A))return J(A,Q);return this.produce(A,(D)=>J(D,Q))}},rG,S3,rq1,hT2,mT2,Gt1,uT2,pT2;var tX=j1(()=>{iq1=Symbol.for("immer-nothing"),ab=Symbol.for("immer-draftable"),aG=Symbol.for("immer-state");T3=Object.getPrototypeOf;EjA=Object.prototype.constructor.toString();uq1={};aq1={get(A,Q){if(Q===aG)return A;let B=j3(A);if(!nb(B,Q))return OjA(A,B,Q);let J=B[Q];if(A.finalized_||!oW(J))return J;if(J===xq1(A.base_,Q))return hq1(A),A.copy_[Q]=dq1(J,A);return J},has(A,Q){return Q in j3(A)},ownKeys(A){return Reflect.ownKeys(j3(A))},set(A,Q,B){let J=Dt1(j3(A),Q);if(J?.set)return J.set.call(A.draft_,B),!0;if(!A.modified_){let D=xq1(j3(A),Q),z=D?.[aG];if(z&&z.base_===B)return A.copy_[Q]=B,A.assigned_[Q]=!1,!0;if(MjA(B,D)&&(B!==void 0||nb(A.base_,Q)))return!0;hq1(A),lq1(A)}if(A.copy_[Q]===B&&(B!==void 0||(Q in A.copy_))||Number.isNaN(B)&&Number.isNaN(A.copy_[Q]))return!0;return A.copy_[Q]=B,A.assigned_[Q]=!0,!0},deleteProperty(A,Q){if(xq1(A.base_,Q)!==void 0||Q in A.base_)A.assigned_[Q]=!1,hq1(A),lq1(A);else delete A.assigned_[Q];if(A.copy_)delete A.copy_[Q];return!0},getOwnPropertyDescriptor(A,Q){let B=j3(A),J=Reflect.getOwnPropertyDescriptor(B,Q);if(!J)return J;return{writable:!0,configurable:A.type_!==1||Q!=="length",enumerable:J.enumerable,value:B[Q]}},defineProperty(){lJ(11)},getPrototypeOf(A){return T3(A.base_)},setPrototypeOf(){lJ(12)}},ob={};rb(aq1,(A,Q)=>{ob[A]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});ob.deleteProperty=function(A,Q){return ob.set.call(this,A,Q,void 0)};ob.set=function(A,Q,B){return aq1.set.call(this,A[0],Q,B,A[0])};rG=new CjA,S3=rG.produce,rq1=rG.produceWithPatches.bind(rG),hT2=rG.setAutoFreeze.bind(rG),mT2=rG.setUseStrictShallowCopy.bind(rG),Gt1=rG.applyPatches.bind(rG),uT2=rG.createDraft.bind(rG),pT2=rG.finishDraft.bind(rG)});function kF(){return`T-${crypto.randomUUID()}`}function v3(A){if(!A.startsWith("T-"))return!1;let Q=A.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 Xt1(){return`toolu_${crypto.randomUUID()}`}function Kt1(A){return A.startsWith("toolu_")}function Ag(A){for(let Q=A.messages.length-1;Q>=0;Q--){let B=A.messages[Q];if(B?.role==="info"){let J=B.content[0];if(J?.type==="summary"&&J?.summary.type==="message")return}if(B?.role==="assistant"&&B.usage)return B.usage}return A["~debug"]?.lastInferenceUsage}function xD(A,Q){for(let B of A.messages){if(B.role!=="assistant")continue;for(let J of B.content)if(J.type==="tool_use"&&J.id===Q)return J}return}function ss(A,Q){for(let[B,J]of A.messages.entries()){if(J.role!=="assistant")continue;for(let[D,z]of J.content.entries())if(z.type==="tool_use"&&z.id===Q)return{message:J,messageIndex:B,block:z,blockIndex:D}}return null}function Qg(A,Q){for(let B of A.messages){if(B.role!=="user")continue;for(let J of B.content)if(J.type==="tool_result"&&J.toolUseID===Q)return J}return}function t7(A){return A.messages.filter((Q)=>Q.role==="user").flatMap((Q)=>Q.content).filter((Q)=>Q.type==="tool_result").reduce((Q,B)=>{return Q.set(B.toolUseID,B),Q},new Map)}function nq1(A){if(A&&typeof A==="object"&&"threadID"in A){let Q=A.threadID;if(typeof Q==="string"&&v3(Q))return Q}return}function sq1(A){let Q=[],B=new Map;for(let J of A)if(J.role==="assistant"){for(let D of J.content)if(D.type==="tool_use"&&D.name===R7)B.set(D.id,D)}else if(J.role==="user"){for(let D of J.content)if(D.type==="tool_result"){let z=B.get(D.toolUseID);if(z){let G=D.run,X=(G.status==="in-progress"||G.status==="cancelled"||G.status==="done"||G.status==="error")&&G.progress?nq1(G.progress):void 0;if(X)Q.push({toolUseID:D.toolUseID,threadID:X,toolUse:z})}}}return Q}function Yt1(A){if(!A)return!1;if(A.role==="assistant")return A.state?.type==="cancelled";if(A.role==="user")return A.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="cancelled");return!1}function Bg(A){if(!A)return!1;return A.role==="info"}function RjA(A){return A.replace(/u([0-9A-Fa-f]{4})(\s)/gi,(Q,B,J)=>{try{return String.fromCodePoint(parseInt(B,16))+J}catch{return`u${B}${J}`}})}function tW(A){for(let Q=A.messages.length-1;Q>=0;Q--){let B=A.messages[Q];if(B?.role==="info"){if(B.content.some((D)=>D.type==="summary"&&D.summary.type==="message"))break}if(B?.role!=="assistant"||!B.state||B.state.type!=="complete"||B.state.stopReason!=="tool_use")continue;for(let J of B.content)if(J.type==="tool_use"&&J.name===s7&&J.input){let D=J.input.todos;if(Array.isArray(D))return D;let z=J.input.content;if(typeof z==="string")return RjA(z)}}return}function eW(A){return A.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
6
6
 
@@ -887,7 +887,7 @@ ${Q.comment}`:Q.comment}this.doc.range[2]=Q.offset;break}default:this.errors.pus
887
887
  `)+1;while(Q!==0)this.onNewLine(this.offset+Q),Q=this.source.indexOf(`
888
888
  `,Q)+1}return{type:A,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(A){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Q=j21(A),B=PP(Q);return B.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:B,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Q=j21(A),B=PP(Q);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:B,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(A,Q){if(this.type!=="comment")return!1;if(this.indent<=Q)return!1;return A.every((B)=>B.type==="newline"||B.type==="space")}*documentEnd(A){if(this.type!=="doc-mode"){if(A.end)A.end.push(this.sourceToken);else A.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(A){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(A.end)A.end.push(this.sourceToken);else A.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}rM6.Parser=xN0});var cN0=n((JW6)=>{var hN0=_L1(),sM6=Iu(),Ru=Nu(),oM6=hC1(),tM6=x9(),eM6=hL1(),mN0=mL1();function uN0(A){let Q=A.prettyErrors!==!1;return{lineCounter:A.lineCounter||Q&&new eM6.LineCounter||null,prettyErrors:Q}}function AW6(A,Q={}){let{lineCounter:B,prettyErrors:J}=uN0(Q),D=new mN0.Parser(B?.addNewLine),z=new hN0.Composer(Q),G=Array.from(z.compose(D.parse(A)));if(J&&B)for(let X of G)X.errors.forEach(Ru.prettifyError(A,B)),X.warnings.forEach(Ru.prettifyError(A,B));if(G.length>0)return G;return Object.assign([],{empty:!0},z.streamInfo())}function pN0(A,Q={}){let{lineCounter:B,prettyErrors:J}=uN0(Q),D=new mN0.Parser(B?.addNewLine),z=new hN0.Composer(Q),G=null;for(let X of z.compose(D.parse(A),!0,A.length))if(!G)G=X;else if(G.options.logLevel!=="silent"){G.errors.push(new Ru.YAMLParseError(X.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(J&&B)G.errors.forEach(Ru.prettifyError(A,B)),G.warnings.forEach(Ru.prettifyError(A,B));return G}function QW6(A,Q,B){let J=void 0;if(typeof Q==="function")J=Q;else if(B===void 0&&Q&&typeof Q==="object")B=Q;let D=pN0(A,B);if(!D)return null;if(D.warnings.forEach((z)=>oM6.warn(D.options.logLevel,z)),D.errors.length>0)if(D.options.logLevel!=="silent")throw D.errors[0];else D.errors=[];return D.toJS(Object.assign({reviver:J},B))}function BW6(A,Q,B){let J=null;if(typeof Q==="function"||Array.isArray(Q))J=Q;else if(B===void 0&&Q)B=Q;if(typeof B==="string")B=B.length;if(typeof B==="number"){let D=Math.round(B);B=D<1?void 0:D>8?{indent:8}:{indent:D}}if(A===void 0){let{keepUndefined:D}=B??Q??{};if(!D)return}if(tM6.isDocument(A)&&!J)return A.toString(B);return new sM6.Document(A,J,B).toString(B)}JW6.parse=QW6;JW6.parseAllDocuments=AW6;JW6.parseDocument=pN0;JW6.stringify=BW6});var dN0=n((NW6)=>{var KW6=_L1(),YW6=Iu(),qW6=HL1(),uL1=Nu(),ZW6=Du(),II=x9(),UW6=FI(),HW6=CQ(),FW6=MI(),EW6=WI(),MW6=L21(),WW6=xL1(),wW6=hL1(),IW6=mL1(),T21=cN0(),lN0=Bu();NW6.Composer=KW6.Composer;NW6.Document=YW6.Document;NW6.Schema=qW6.Schema;NW6.YAMLError=uL1.YAMLError;NW6.YAMLParseError=uL1.YAMLParseError;NW6.YAMLWarning=uL1.YAMLWarning;NW6.Alias=ZW6.Alias;NW6.isAlias=II.isAlias;NW6.isCollection=II.isCollection;NW6.isDocument=II.isDocument;NW6.isMap=II.isMap;NW6.isNode=II.isNode;NW6.isPair=II.isPair;NW6.isScalar=II.isScalar;NW6.isSeq=II.isSeq;NW6.Pair=UW6.Pair;NW6.Scalar=HW6.Scalar;NW6.YAMLMap=FW6.YAMLMap;NW6.YAMLSeq=EW6.YAMLSeq;NW6.CST=MW6;NW6.Lexer=WW6.Lexer;NW6.LineCounter=wW6.LineCounter;NW6.Parser=IW6.Parser;NW6.parse=T21.parse;NW6.parseAllDocuments=T21.parseAllDocuments;NW6.parseDocument=T21.parseDocument;NW6.stringify=T21.stringify;NW6.visit=lN0.visit;NW6.visitAsync=lN0.visitAsync});function aN0(A,Q){if(A.status==="done"){if(A.result!==null&&typeof A.result==="object"&&"output"in A.result&&typeof A.result.output==="string"){if(Q.detail==="full"&&"hidden_truncatedOutput"in A.result&&typeof A.result.hidden_truncatedOutput==="string")return A.result.hidden_truncatedOutput+A.result.output.split(`
889
889
  `).slice(1).join(`
890
- `);return A.result.output}}return iN0.default.stringify(A)}var iN0;var rN0=j1(()=>{iN0=WA(dN0(),1)});function fq(A,Q){return{...Q,interactionState:A&&Q?.state==="active"?sW6(A,Q.inferenceState):!1}}function sW6(A,Q){if(Q==="running")return!1;let B=A.messages.at(-1);if(!B)return"user-message-initial";if(B.role==="assistant")return B.state.type==="complete"&&B.state.stopReason==="end_turn"?"user-message-reply":!1;if(B.content.some((J)=>J.type==="tool_result"&&J.run.status==="blocked-on-user"))return"user-tool-approval";if(B.content.some((J)=>J.type==="tool_result"&&J.run.status==="in-progress"))return"tool-running";return!1}function nN0(A){let Q=new AbortController;if(A?.aborted)Q.abort();else if(A)A.addEventListener("abort",()=>Q.abort(),{once:!0});return Q}function sN0(A,Q){return A?.addEventListener("abort",Q,{once:!0}),()=>A?.removeEventListener("abort",Q)}function SP(A){return A instanceof DOMException&&A.name==="AbortError"}function oN0(A){return A instanceof Error&&A.message===pL1.USER_CANCELLED}var pL1;var $21=j1(()=>{pL1={USER_CANCELLED:"User cancelled"}});function tN0(A){if(A===59999)return"59.99s";if(A===3599999)return"59m 59.99s";let Q=A/1000,B=Q/60,J=B/60,D=J/24,z=Math.floor(D),G=Math.floor(J)%24,X=Math.floor(B)%60,K=Math.floor(Q)%60,Y=(Q-Math.floor(Q)).toFixed(2).substring(1);if(z>0)return`${z}d ${G}h`;if(G>0)return`${G}h ${X}m`;if(X>0)return`${X}m ${K}${Y}s`;return`${Math.floor(Q)}${Y}s`}async function*eN0(A,Q){if(Q.aborted)throw new DOMException("Aborted","AbortError");let B=new Promise((J,D)=>{Q.addEventListener("abort",()=>{D(new DOMException("Aborted","AbortError"))},{once:!0})});while(!0){let J=await Promise.race([A.next(),B]);if(J.done)return J.value;yield J.value}}function oW6(A){let Q={...A};if(Q.type==="thinking"){if("finalTime"in Q)delete Q.finalTime}if("inputIncomplete"in Q)delete Q.inputIncomplete;return Q}function AV0(A){return S3(A,(Q)=>{for(let B of Q.messages)if(B.role==="assistant")for(let J=0;J<B.content.length;J++){let D=B.content[J];if(D)B.content[J]=oW6(D)}})}function tW6(A){return A.some((Q)=>Q.type==="tool_use")}function eW6(A){if(A.length===0)return!1;let Q=A[0];return Q?.type==="thinking"||Q?.type==="redacted_thinking"}function QV0(A,Q){if(Object.keys(Q).length>0)return!1;let B=A.messages[A.messages.length-1];if(B?.role==="assistant"||B?.role==="user"&&B.content.some((D)=>D.type==="tool_result")){let D=VQ(A,"assistant");if(!D)return!0;if(D.state.type!=="complete")return!1;if(D.state.type==="complete"&&D.state.stopReason==="tool_use"){let X=D.content.filter((K)=>K.type==="tool_use").map((K)=>K.id);if(X.length===0)return!1;else{let K=t7(A);if(X.filter((q)=>{let Z=K.get(q);return!Z||!y4(Z.run)}).length>0)return!1}}let z=D.content;if(z.length>0){let X=z[z.length-1];if(X&&(X.type==="thinking"||X.type==="redacted_thinking"))return!1}if(tW6(D.content)&&!eW6(D.content))return!1;if(D.content.some((X)=>{if(X.type==="thinking"){let K=X.signature;return!K||typeof K!=="string"||K.trim()===""}return!1}))return!1}return!0}var cL1=j1(()=>{tX();j7();cJ()});function BV0(A,Q){if(Q.length===0)return GA.of([]);return new GA((B)=>{let J=new tG,D=()=>{B.next(Array.from(J.keys()).toSorted((X,K)=>X.toString().localeCompare(K.toString())))},z=new AbortController;Promise.all(Q.map(async(X)=>{if(wD0(X))return A.findFiles(X,{signal:z.signal});try{return await A.stat(X),[X]}catch(K){if(K instanceof nJ)return[];throw K}})).then((X)=>{for(let K of X)for(let Y of K)J.add(Y);D()}).catch((X)=>{if(!z.signal.aborted)z.abort();if(!SP(X))B.error(X)});let G=Q.map((X)=>A.watch(X,{ignoreChanges:!0}).subscribe({next:(K)=>{if(K.type==="create"||K.type==="change")J.add(K.uri);else if(K.type==="delete")J.delete(K.uri);D()}}));return()=>{z.abort();for(let X of G)X.unsubscribe()}})}var JV0=j1(()=>{O6();$21();zw();CO()});function DV0(A,Q,B){let J=[];Q=Aw6(Q);let D=/@([a-zA-Z0-9._~/-]+)/g,z;while((z=D.exec(Q))!==null){let G=z[1];if(!G)continue;if(G=G.replace(/[.,;!?)]+$/,""),G==="/"||G==="")continue;try{let X=Qw6(A,G,B);if(X)J.push(X)}catch(X){continue}}return J}function Aw6(A){let Q=A.replace(/```[\s\S]*?```/g,"");return Q=Q.replace(/`[^`]*`/g,""),Q=Q.replace(/<code[^>]*>[\s\S]*?<\/code>/gi,""),Q}function Qw6(A,Q,B){if(Q.startsWith("~/")){if(B.homeDir===null)return null;let J=Q.slice(2);return $6.joinPath(C6.parse(B.homeDir),J)}if(Q.startsWith("/"))return C6.file(Q);return $6.joinPath($6.dirname(A),Q)}var zV0=j1(()=>{x8()});async function GV0({filesystem:A},Q,B,J){let D=[],z=new tG,G=new tG,X=new BJ,K=[];async function Y(E,M=!1){let W=E.uri;if(z.has(W))return null;if(G.has(W))return null;G.add(W);try{let w=await A.readFile(C6.parse(W),{signal:J}),I={...E,type:M?E.type:"mentioned",content:w,"~debug":{mentionedBy:X.has(W)?[X.get(W)]:void 0}};z.add(W),D.push(I);let N=DV0(C6.parse(W),w,B);for(let V of N){let L=f8(V);if(!X.has(L))X.set(L,W);let R=await Y({uri:L,type:"mentioned"},!1);if(R)K.push({file:R,afterFile:W})}return I}catch(w){if(w instanceof Error&&w.name==="FileNotExistError")N1.debug("Guidance file not found (expected)",{uri:E.uri});else N1.error("Error resolving guidance file",{uri:E.uri,error:w});return null}finally{G.delete(W)}}for(let E of lL1(Q))await Y(E,!0);let q=[],Z=new Set;function H(E){if(Z.has(E.uri))return;q.push(E),Z.add(E.uri);let M=K.filter((W)=>W.afterFile===E.uri);for(let W of M)H(W.file)}let F=D.filter((E)=>E.type!=="mentioned");for(let E of F)H(E);return q}var XV0=j1(()=>{x8();iA();zw();vP();zV0()});function Bw6(A){return{homeDir:A.userConfigDir?f8(A.userConfigDir):null}}function Jw6(A){if(A.path==="/"||A.path==="")return!0;let Q=A.fsPath;if(Q==="/"||Q==="/Users"||Q==="/home"||/^[A-Z]:[\\/?]?$/.test(Q))return!0;return!1}function Dw6({filesystem:A,configService:Q}){return j5(Q.workspaceRoots,qV0).pipe(y9(([B,J])=>{if(!B)B=[];let D=[];D.push(...B);for(let G of B){let X=$6.dirname(G);while(X){if(Jw6(X))break;D.push(X);let K=$6.dirname(X);if($6.equalURIs(K,X))break;X=K}}if(Q.userConfigDir)D.push(Q.userConfigDir);let z=D.flatMap((G)=>_21.map((X)=>$6.joinPath(G,X)));if(J)z.push(...B.map((G)=>({base:G,pattern:YV0})));return BV0(A,z).pipe(U2((G)=>{let X=[],K=new Set;for(let Y of G){let q=$6.dirname(Y).toString(),Z=$6.basename(Y);if(Z.endsWith(".spec.md")){if(B.some((E)=>$6.hasPrefix(Y,E)))X.push({uri:f8(Y),type:"project"});continue}if(K.has(q))continue;let H=_21.indexOf(Z);if(H===-1)continue;let F=!1;for(let E=0;E<H;E++){let M=_21[E],W=$6.joinPath($6.dirname(Y),M);if(G.some((w)=>$6.equalURIs(w,W))){F=!0;break}}if(F)continue;if(K.add(q),B.some((E)=>$6.hasPrefix(Y,E))){X.push({uri:f8(Y),type:"project"});continue}if(Q.userConfigDir&&$6.hasPrefix(Y,Q.userConfigDir)){X.push({uri:f8(Y),type:"user"});continue}X.push({uri:f8(Y),type:"parent"})}return X}))}))}function zw6({filesystem:A,configService:Q},B){function J(D){let z=new Set,G=[];for(let X of D){let K=$6.dirname(X).toString();if(!z.has(K))z.add(K),G.push(K)}return G.join(",")}return j5(B.pipe(U2((D)=>({thread:D,readFiles:Gw6(D)})),G7((D,z)=>J(D.readFiles)===J(z.readFiles))),Q.workspaceRoots,qV0).pipe(jF(async([{readFiles:D},z,G],X)=>{if(!z)z=[];let K=new tG;for(let q of D){let Z=$6.dirname(q);while(!K.has(Z)&&z.some((H)=>$6.hasPrefix(Z,H)&&!$6.equalURIs(H,Z)))K.add(Z),Z=$6.dirname(Z)}let Y=(await Promise.all(Array.from(K.keys()).map(async(q)=>{for(let Z of _21)try{let H=$6.joinPath(q,Z);return await A.stat(H,{signal:X}),{uri:f8(H),type:"subtree"}}catch{continue}return null}))).filter((q)=>q!==null);if(G){let q=await Promise.all(Array.from(K.keys()).map(async(Z)=>{return await A.findFiles({base:Z,pattern:YV0})}));Y.push(...q.flat().map((Z)=>({uri:f8(Z),type:"subtree"})))}return Y}))}function Gw6(A){let Q=[];for(let B of A.messages)if(B.role==="assistant"){for(let J of B.content)if(J.type==="tool_use"&&(J.name===I4||J.name===Yo1)){let D=Qg(A,J.id);if(D&&D.run.status==="done"){let z=D.run.result;if(typeof z==="object"&&z.absolutePath)Q.push(C6.file(z.absolutePath))}}}for(let B of A.messages)if(B.role==="user"&&B.fileMentions){for(let J of B.fileMentions.files)if(J.uri)Q.push(J.uri);else if(J.path)Q.push(C6.file(J.path))}return Q}async function ZV0(A,Q,B){let[J,D]=await Promise.all([rA(Dw6(A),B),rA(zw6(A,GA.of(Q)),B)]);return B?.throwIfAborted(),GV0({filesystem:A.filesystem},lL1([...J,...D]),Bw6(A.configService),B)}function lL1(A){return A.toSorted((Q,B)=>{let J=KV0[Q.type]-KV0[B.type];if(J!==0)return J;return Q.uri.localeCompare(B.uri)})}var ju="AGENT.md",qJ="AGENTS.md",_21,YV0="*.spec.md",qV0,KV0;var vP=j1(()=>{x8();O6();NQ();zw();JV0();j7();t8();XV0();_21=[qJ,"Agents.md","agents.md",ju,"Agent.md","agent.md"];qV0=h2.pipe(U2((A)=>!!A.settings["guidanceFiles.specs"]),G7());KV0={user:0,project:1,parent:2,subtree:3}});function UV0(A){let{interval:Q,fn:B,cacheKey:J}=A,D=new Map,z=new Map;return(...G)=>{let X=J?J(...G):"default",K=Date.now(),Y=z.get(X)||0;if(D.has(X)&&K-Y<Q)return D.get(X);z.set(X,K);let q=B(...G);return D.set(X,q),q}}async function Xw6(A,Q,B,J){let D=J?.workingDirectory&&$6.equalURIs(J?.workingDirectory,A)?" (current working directory)":"",z=[J?.testing?"./":A.fsPath+D],G=0,X=0,K=await B.readdir(A),Y=await Promise.all(K.filter((F)=>!mg($6.basename(F.uri))).map(async(F)=>{try{let E=await B.stat(F.uri);return{name:$6.basename(F.uri),isDirectory:E.isDirectory}}catch{return{name:$6.basename(F.uri),isDirectory:!1}}}));Y.sort((F,E)=>{if(F.isDirectory===E.isDirectory)return F.name.localeCompare(E.name);return F.isDirectory?-1:1});let q=500,Z=Y.length>q,H=Y.slice(0,q);for(let F=0;F<H.length;F++){let{name:E,isDirectory:M}=H[F],w=F===H.length-1&&!Z?"└ ":"├ ";if(M)G++;else X++;let I=`${w}${E}${M?"/":""}`;z.push(I)}if(Z){let F=Y.length-q;z.push(`└ ... and ${F} more ${Gq(F,"entry","entries")}`)}return z.join(`
890
+ `);return A.result.output}}return iN0.default.stringify(A)}var iN0;var rN0=j1(()=>{iN0=WA(dN0(),1)});function fq(A,Q){return{...Q,interactionState:A&&Q?.state==="active"?sW6(A,Q.inferenceState):!1}}function sW6(A,Q){if(Q==="running")return!1;let B=A.messages.at(-1);if(!B)return"user-message-initial";if(B.role==="assistant")return B.state.type==="complete"&&B.state.stopReason==="end_turn"?"user-message-reply":!1;if(B.content.some((J)=>J.type==="tool_result"&&J.run.status==="blocked-on-user"))return"user-tool-approval";if(B.content.some((J)=>J.type==="tool_result"&&J.run.status==="in-progress"))return"tool-running";return!1}function nN0(A){let Q=new AbortController;if(A?.aborted)Q.abort();else if(A)A.addEventListener("abort",()=>Q.abort(),{once:!0});return Q}function sN0(A,Q){return A?.addEventListener("abort",Q,{once:!0}),()=>A?.removeEventListener("abort",Q)}function SP(A){return A instanceof DOMException&&A.name==="AbortError"}function oN0(A){return A instanceof Error&&A.message===pL1.USER_CANCELLED}var pL1;var $21=j1(()=>{pL1={USER_CANCELLED:"User cancelled"}});function tN0(A){if(A===59999)return"59.99s";if(A===3599999)return"59m 59.99s";let Q=A/1000,B=Q/60,J=B/60,D=J/24,z=Math.floor(D),G=Math.floor(J)%24,X=Math.floor(B)%60,K=Math.floor(Q)%60,Y=(Q-Math.floor(Q)).toFixed(2).substring(1);if(z>0)return`${z}d ${G}h`;if(G>0)return`${G}h ${X}m`;if(X>0)return`${X}m ${K}${Y}s`;return`${Math.floor(Q)}${Y}s`}async function*eN0(A,Q){if(Q.aborted)throw new DOMException("Aborted","AbortError");let B=new Promise((J,D)=>{Q.addEventListener("abort",()=>{D(new DOMException("Aborted","AbortError"))},{once:!0})});while(!0){let J=await Promise.race([A.next(),B]);if(J.done)return J.value;yield J.value}}function oW6(A){let Q={...A};if(Q.type==="thinking"){if("finalTime"in Q)delete Q.finalTime}if("inputIncomplete"in Q)delete Q.inputIncomplete;return Q}function AV0(A){return S3(A,(Q)=>{for(let B of Q.messages)if(B.role==="assistant")for(let J=0;J<B.content.length;J++){let D=B.content[J];if(D)B.content[J]=oW6(D)}})}function tW6(A){return A.some((Q)=>Q.type==="tool_use")}function eW6(A){if(A.length===0)return!1;let Q=A[0];return Q?.type==="thinking"||Q?.type==="redacted_thinking"}function QV0(A,Q){if(Object.keys(Q).length>0)return!1;let B=A.messages[A.messages.length-1];if(B?.role==="assistant"||B?.role==="user"&&B.content.some((D)=>D.type==="tool_result")){let D=VQ(A,"assistant");if(!D)return!0;if(D.state.type!=="complete")return!1;if(D.state.type==="complete"&&D.state.stopReason==="tool_use"){let X=D.content.filter((K)=>K.type==="tool_use").map((K)=>K.id);if(X.length===0)return!1;else{let K=t7(A);if(X.filter((q)=>{let Z=K.get(q);return!Z||!y4(Z.run)}).length>0)return!1}}let z=D.content;if(z.length>0){let X=z[z.length-1];if(X&&(X.type==="thinking"||X.type==="redacted_thinking"))return!1}if(tW6(D.content)&&!eW6(D.content))return!1;if(D.content.some((X)=>{if(X.type==="thinking"){let K=X.signature;return!K||typeof K!=="string"||K.trim()===""}return!1}))return!1}return!0}var cL1=j1(()=>{tX();j7();cJ()});function BV0(A,Q){if(Q.length===0)return GA.of([]);return new GA((B)=>{let J=new tG,D=()=>{B.next(Array.from(J.keys()).toSorted((X,K)=>X.toString().localeCompare(K.toString())))},z=new AbortController;Promise.all(Q.map(async(X)=>{if(wD0(X))return A.findFiles(X,{signal:z.signal});try{return await A.stat(X),[X]}catch(K){if(K instanceof nJ)return[];throw K}})).then((X)=>{for(let K of X)for(let Y of K)J.add(Y);D()}).catch((X)=>{if(!z.signal.aborted)z.abort();if(!SP(X))B.error(X)});let G=Q.map((X)=>A.watch(X,{ignoreChanges:!0}).subscribe({next:(K)=>{if(K.type==="create"||K.type==="change")J.add(K.uri);else if(K.type==="delete")J.delete(K.uri);D()}}));return()=>{z.abort();for(let X of G)X.unsubscribe()}})}var JV0=j1(()=>{O6();$21();zw();CO()});function DV0(A,Q,B){let J=[];Q=Aw6(Q);let D=/@([a-zA-Z0-9._~/-]+)/g,z;while((z=D.exec(Q))!==null){let G=z[1];if(!G)continue;if(G=G.replace(/[.,;!?)]+$/,""),G==="/"||G==="")continue;try{let X=Qw6(A,G,B);if(X)J.push(X)}catch(X){continue}}return J}function Aw6(A){let Q=A.replace(/```[\s\S]*?```/g,"");return Q=Q.replace(/`[^`]*`/g,""),Q=Q.replace(/<code[^>]*>[\s\S]*?<\/code>/gi,""),Q}function Qw6(A,Q,B){if(Q.startsWith("~/")){if(B.homeDir===null)return null;let J=Q.slice(2);return $6.joinPath(C6.parse(B.homeDir),J)}if(Q.startsWith("/"))return C6.file(Q);return $6.joinPath($6.dirname(A),Q)}var zV0=j1(()=>{x8()});async function GV0({filesystem:A},Q,B,J){let D=[],z=new tG,G=new tG,X=new BJ,K=[];async function Y(E,M=!1){let W=E.uri;if(z.has(W))return null;if(G.has(W))return null;G.add(W);try{let w=await A.readFile(C6.parse(W),{signal:J}),I={...E,type:M?E.type:"mentioned",content:w,"~debug":{mentionedBy:X.has(W)?[X.get(W)]:void 0}};z.add(W),D.push(I);let N=DV0(C6.parse(W),w,B);for(let V of N){let L=f8(V);if(!X.has(L))X.set(L,W);let R=await Y({uri:L,type:"mentioned"},!1);if(R)K.push({file:R,afterFile:W})}return I}catch(w){if(w instanceof Error&&w.name==="FileNotExistError")N1.debug("Guidance file not found (expected)",{uri:E.uri});else N1.error("Error resolving guidance file",{uri:E.uri,error:w});return null}finally{G.delete(W)}}for(let E of lL1(Q))await Y(E,!0);let q=[],Z=new Set;function H(E){if(Z.has(E.uri))return;q.push(E),Z.add(E.uri);let M=K.filter((W)=>W.afterFile===E.uri);for(let W of M)H(W.file)}let F=D.filter((E)=>E.type!=="mentioned");for(let E of F)H(E);return q}var XV0=j1(()=>{x8();iA();zw();vP();zV0()});function Bw6(A){return{homeDir:A.userConfigDir?f8(A.userConfigDir):null}}function Jw6(A){if(A.path==="/"||A.path==="")return!0;let Q=A.fsPath;if(Q==="/"||Q==="/Users"||Q==="/home"||/^[A-Z]:[\\/?]?$/.test(Q))return!0;return!1}function Dw6({filesystem:A,configService:Q}){return j5(Q.workspaceRoots,qV0).pipe(y9(([B,J])=>{if(!B)B=[];let D=[];D.push(...B);for(let G of B){let X=$6.dirname(G);while(X){if(Jw6(X))break;D.push(X);let K=$6.dirname(X);if($6.equalURIs(K,X))break;X=K}}if(Q.userConfigDir)D.push(Q.userConfigDir);let z=D.flatMap((G)=>_21.map((X)=>$6.joinPath(G,X)));if(J)z.push(...B.map((G)=>({base:G,pattern:YV0})));return BV0(A,z).pipe(U2((G)=>{let X=[],K=new Set;for(let Y of G){let q=$6.dirname(Y).toString(),Z=$6.basename(Y);if(Z.endsWith(".spec.md")){if(B.some((E)=>$6.hasPrefix(Y,E)))X.push({uri:f8(Y),type:"project"});continue}if(K.has(q))continue;let H=_21.indexOf(Z);if(H===-1)continue;let F=!1;for(let E=0;E<H;E++){let M=_21[E],W=$6.joinPath($6.dirname(Y),M);if(G.some((w)=>$6.equalURIs(w,W))){F=!0;break}}if(F)continue;if(K.add(q),B.some((E)=>$6.hasPrefix(Y,E))){X.push({uri:f8(Y),type:"project"});continue}if(Q.userConfigDir&&$6.hasPrefix(Y,Q.userConfigDir)){X.push({uri:f8(Y),type:"user"});continue}X.push({uri:f8(Y),type:"parent"})}return X}))}))}function zw6({filesystem:A,configService:Q},B){function J(D){let z=new Set,G=[];for(let X of D){let K=$6.dirname(X).toString();if(!z.has(K))z.add(K),G.push(K)}return G.join(",")}return j5(B.pipe(U2((D)=>({thread:D,readFiles:Gw6(D)})),G7((D,z)=>J(D.readFiles)===J(z.readFiles))),Q.workspaceRoots,qV0).pipe(jF(async([{readFiles:D},z,G],X)=>{if(!z)z=[];let K=new tG;for(let q of D){let Z=$6.dirname(q);while(!K.has(Z)&&z.some((H)=>$6.hasPrefix(Z,H)&&!$6.equalURIs(H,Z)))K.add(Z),Z=$6.dirname(Z)}let Y=(await Promise.all(Array.from(K.keys()).map(async(q)=>{for(let Z of _21)try{let H=await A.realpath($6.joinPath(q,Z),{signal:X});return{uri:f8(H),type:"subtree"}}catch{continue}return null}))).filter((q)=>q!==null);if(G){let q=await Promise.all(Array.from(K.keys()).map(async(Z)=>{return await A.findFiles({base:Z,pattern:YV0})}));Y.push(...q.flat().map((Z)=>({uri:f8(Z),type:"subtree"})))}return Y}))}function Gw6(A){let Q=[];for(let B of A.messages)if(B.role==="assistant"){for(let J of B.content)if(J.type==="tool_use"&&(J.name===I4||J.name===Yo1)){let D=Qg(A,J.id);if(D&&D.run.status==="done"){let z=D.run.result;if(typeof z==="object"&&z.absolutePath)Q.push(C6.file(z.absolutePath))}}}for(let B of A.messages)if(B.role==="user"&&B.fileMentions){for(let J of B.fileMentions.files)if(J.uri)Q.push(J.uri);else if(J.path)Q.push(C6.file(J.path))}return Q}async function ZV0(A,Q,B){let[J,D]=await Promise.all([rA(Dw6(A),B),rA(zw6(A,GA.of(Q)),B)]);return B?.throwIfAborted(),GV0({filesystem:A.filesystem},lL1([...J,...D]),Bw6(A.configService),B)}function lL1(A){return A.toSorted((Q,B)=>{let J=KV0[Q.type]-KV0[B.type];if(J!==0)return J;return Q.uri.localeCompare(B.uri)})}var ju="AGENT.md",qJ="AGENTS.md",_21,YV0="*.spec.md",qV0,KV0;var vP=j1(()=>{x8();O6();NQ();zw();JV0();j7();t8();XV0();_21=[qJ,"Agents.md","agents.md",ju,"Agent.md","agent.md"];qV0=h2.pipe(U2((A)=>!!A.settings["guidanceFiles.specs"]),G7());KV0={user:0,project:1,parent:2,subtree:3}});function UV0(A){let{interval:Q,fn:B,cacheKey:J}=A,D=new Map,z=new Map;return(...G)=>{let X=J?J(...G):"default",K=Date.now(),Y=z.get(X)||0;if(D.has(X)&&K-Y<Q)return D.get(X);z.set(X,K);let q=B(...G);return D.set(X,q),q}}async function Xw6(A,Q,B,J){let D=J?.workingDirectory&&$6.equalURIs(J?.workingDirectory,A)?" (current working directory)":"",z=[J?.testing?"./":A.fsPath+D],G=0,X=0,K=await B.readdir(A),Y=await Promise.all(K.filter((F)=>!mg($6.basename(F.uri))).map(async(F)=>{try{let E=await B.stat(F.uri);return{name:$6.basename(F.uri),isDirectory:E.isDirectory}}catch{return{name:$6.basename(F.uri),isDirectory:!1}}}));Y.sort((F,E)=>{if(F.isDirectory===E.isDirectory)return F.name.localeCompare(E.name);return F.isDirectory?-1:1});let q=500,Z=Y.length>q,H=Y.slice(0,q);for(let F=0;F<H.length;F++){let{name:E,isDirectory:M}=H[F],w=F===H.length-1&&!Z?"└ ":"├ ";if(M)G++;else X++;let I=`${w}${E}${M?"/":""}`;z.push(I)}if(Z){let F=Y.length-q;z.push(`└ ... and ${F} more ${Gq(F,"entry","entries")}`)}return z.join(`
891
891
  `)}var HV0;var FV0=j1(()=>{x8();BK();HV0=UV0({fn:Xw6,interval:1800000,cacheKey:(A,Q)=>`${A.toString()}#${Q}`})});function EV0(A){let{AGENTS_MD_FILENAME:Q,LEGACY_AGENT_FILE_NAME:B}=A;return`
892
892
  <identity>
893
893
  You are Amp, a powerful AI coding agent built by Sourcegraph. You help the user primarily with software engineering tasks. Follow these instructions and use tools when needed to fully resolve the user's request.
@@ -4813,7 +4813,7 @@ ${uz1("\t",w??"(unknown)")}
4813
4813
  `)+`
4814
4814
  `;await Jl1(this.historyFile,Q,"utf-8")}async add(A){if(!A.trim())return;if(await this.ensureLoaded(),this.history.length>0&&this.history[this.history.length-1]===A)return;try{if(await FEA(Ar.dirname(this.historyFile),{recursive:!0}),await this.atomicAppend(A),this.history.push(A),this.history.length>this.maxSize){let Q=await this.readHistoryFromDisk();if(Q.length>this.maxSize){let B=Q.slice(Q.length-this.maxSize);await this.writeHistoryToDisk(B),this.history=B}}}catch(Q){N1.error(`Failed to save history: ${Q instanceof Error?Q.message:String(Q)}`)}this.reset()}async atomicAppend(A){let Q=JSON.stringify(A)+`
4815
4815
  `,B=this.historyFile+".lock",J=10,D=50;for(let z=0;z<10;z++)try{let G=await ZW2(B,"wx");try{await Jl1(this.historyFile,Q,{flag:"a",encoding:"utf-8"})}finally{await G.close(),await Jl1(B,"",{flag:"w"});try{await MEA(B)}catch{}}return}catch(G){if(G.code==="EEXIST"&&z<9){await new Promise((X)=>setTimeout(X,50));continue}throw G}throw new Error("Failed to acquire lock for history file after multiple attempts")}previous(){if(this.history.length===0)return null;if(this.index===0){let Q=this.history[0];return typeof Q==="string"?Q:null}if(this.index===-1)this.index=this.history.length-1;else this.index--;let A=this.history[this.index];return typeof A==="string"?A:null}next(){if(this.history.length===0||this.index===-1)return null;if(this.index++,this.index>=this.history.length)return this.index=-1,null;let A=this.history[this.index];return typeof A==="string"?A:null}reset(){this.index=-1}}iA();iA();iA();import{join as Qr}from"node:path";import{exec as MW2,execFile as WW2,execSync as WEA}from"node:child_process";import{promises as dz1}from"node:fs";import{promisify as wEA}from"node:util";var wW2=wEA(MW2),iz1=wEA(WW2),IW2="git --no-optional-locks status --porcelain=v2 --untracked-files=normal --no-renames -z";class IEA{async watch(A){}unwatch(A){}dispose(){}onFileSystemEvent(A){}offFileSystemEvent(A){}getWatchedPaths(){return[]}isSupported(){return!1}}class NEA{watchedPaths=new Map;callbacks=[];pollInterval;constructor(A=1000){this.pollInterval=A}async watch(A){if(this.watchedPaths.has(A))return;let{promises:Q}=await import("node:fs"),B=new Map;try{await this.scanPath(Q,A,B)}catch(D){throw new Error(`Failed to watch path ${A}: ${D}`)}let J=setInterval(async()=>{try{await this.checkForChanges(Q,A,B)}catch(D){N1.warn("Error polling path",{path:A,error:D})}},this.pollInterval);this.watchedPaths.set(A,{interval:J,lastModified:B})}unwatch(A){let Q=this.watchedPaths.get(A);if(Q)clearInterval(Q.interval),this.watchedPaths.delete(A)}dispose(){for(let A of Array.from(this.watchedPaths.keys()))this.unwatch(A);this.callbacks.length=0}onFileSystemEvent(A){this.callbacks.push(A)}offFileSystemEvent(A){let Q=this.callbacks.indexOf(A);if(Q>=0)this.callbacks.splice(Q,1)}getWatchedPaths(){return Array.from(this.watchedPaths.keys())}isSupported(){return!0}async scanPath(A,Q,B){try{let J=await A.stat(Q);if(B.set(Q,J.mtime.getTime()),J.isDirectory()){let D=await A.readdir(Q);for(let z of D){let G=Qr(Q,z);await this.scanPath(A,G,B)}}}catch(J){}}async checkForChanges(A,Q,B){let J=[],D=new Map;await this.scanPath(A,Q,D);for(let[z,G]of Array.from(D.entries())){let X=B.get(z);if(X===void 0)J.push({type:"created",path:z,timestamp:Date.now(),isDirectory:await this.isDirectory(A,z)});else if(G>X)J.push({type:"modified",path:z,timestamp:Date.now(),isDirectory:await this.isDirectory(A,z)})}for(let z of Array.from(B.keys()))if(!D.has(z))J.push({type:"deleted",path:z,timestamp:Date.now(),isDirectory:!1});B.clear();for(let[z,G]of Array.from(D.entries()))B.set(z,G);if(J.length>0)for(let z of this.callbacks)try{z(J)}catch(G){N1.error("Error in file watcher callback",{error:G})}}async isDirectory(A,Q){try{return(await A.stat(Q)).isDirectory()}catch{return!1}}}class xf{static isRepo(A){try{return WEA("git rev-parse --is-inside-work-tree",{cwd:A,stdio:"ignore"}),!0}catch{return!1}}repos=new Map;callbacks=[];ongoingScans=new Map;scanCooldownMs;constructor(A=5000){this.scanCooldownMs=A}async resolveRepoRoot(A){let{stdout:Q}=await iz1("git",["rev-parse","--show-toplevel"],{cwd:A});return Q.trim()}async watch(A){let Q=await this.resolveRepoRoot(A);if(this.repos.has(Q))return;await this.initialise(Q)}unwatch(A){if(!this.repos.get(A))return;this.repos.delete(A),this.ongoingScans.delete(A)}dispose(){for(let A of Array.from(this.repos.keys()))this.unwatch(A);this.callbacks.length=0}onFileSystemEvent(A){this.callbacks.push(A)}offFileSystemEvent(A){let Q=this.callbacks.indexOf(A);if(Q!==-1)this.callbacks.splice(Q,1)}getWatchedPaths(){return Array.from(this.repos.keys())}isSupported(){try{return WEA("git --version",{stdio:"ignore"}),!0}catch{return!1}}async triggerScan(A,Q=!1){let B=await this.resolveRepoRoot(A),J=this.repos.get(B),D=!J;if(!J){if(N1.debug("First time watching repo",{repoRoot:B}),await this.watch(A),J=this.repos.get(B),!J)return;return}let z=Date.now(),G=z-J.lastScanTime;if(!Q&&G<this.scanCooldownMs)return;N1.debug("Starting scan",{repoRoot:B,force:Q,timeSinceLastScan:G}),J.lastScanTime=z,await this.scan(B)}async reset(A){let Q=await this.resolveRepoRoot(A),B=this.repos.get(Q);if(!B)return;B.cancelled=!0;let J=this.ongoingScans.get(Q);if(J)await J.catch(()=>{});this.repos.delete(Q),this.ongoingScans.delete(Q),await this.watch(A)}async initialise(A){let Q=Date.now(),B=await iz1("git",["ls-files","--others","--exclude-standard","-z"],{cwd:A,maxBuffer:67108864}),J=new Set,D=B.stdout.split("\x00").filter(Boolean);for(let z of D){let G=Qr(A,z);J.add(G)}this.repos.set(A,{lastScanTime:Q,seenUntracked:J})}async scan(A){let Q=this.repos.get(A);if(!Q||Q.cancelled)return;let B=this.performScan(A);this.ongoingScans.set(A,B);try{await B}finally{if(this.ongoingScans.get(A)===B)this.ongoingScans.delete(A)}}async performScan(A){let Q=this.repos.get(A);if(!Q||Q.cancelled)return;let B=Date.now();try{let[J,D]=await Promise.all([iz1("git",["ls-files","--others","--exclude-standard","-z"],{cwd:A,maxBuffer:1/0,timeout:60000}),iz1("git",["ls-files","--deleted","-z"],{cwd:A,maxBuffer:1/0,timeout:60000})]),z=J.stdout.split("\x00").filter(Boolean),G=D.stdout.split("\x00").filter(Boolean);N1.debug("Git ls-files completed",{repoRoot:A,untrackedCount:z.length,deletedCount:G.length,duration:Date.now()-B,untrackedFiles:z.slice(0,10),deletedFiles:G.slice(0,10)});let X=this.repos.get(A);if(!X||X.cancelled)return;let K=[],Y=new Set;for(let q of z){let Z=Qr(A,q);Y.add(Z);try{let H=await dz1.stat(Z);if(H.isFile()&&!X.seenUntracked.has(Z))K.push({type:"created",path:Z,timestamp:H.mtimeMs,isDirectory:!1})}catch{}}for(let q of Array.from(X.seenUntracked))if(!Y.has(q)){if(!await dz1.access(q).then(()=>!0).catch(()=>!1))K.push({type:"deleted",path:q,timestamp:B,isDirectory:!1})}for(let q of G){let Z=Qr(A,q);K.push({type:"deleted",path:Z,timestamp:B,isDirectory:!1})}if(X.seenUntracked=Y,X.lastScanTime=B,K.length){N1.debug("Emitting file events",{repoRoot:A,eventCount:K.length,events:K.slice(0,5).map((q)=>({type:q.type,path:q.path}))});for(let q of this.callbacks)q(K)}else N1.debug("No file events to emit",{repoRoot:A})}catch(J){N1.warn("Fast ls-files scan failed, falling back to full status",{repoRoot:A,error:J instanceof Error?J.message:String(J),duration:Date.now()-B}),await this.performFullStatusScan(A)}}async performFullStatusScan(A){let Q=this.repos.get(A);if(!Q||Q.cancelled)return;let B=Date.now(),{stdout:J}=await wW2(IW2,{cwd:A,maxBuffer:16777216}),D=this.repos.get(A);if(!D||D.cancelled)return;let z=[];for(let G of this.parseStatus(J)){let X=Qr(A,G.path);if(G.type==="created"){let K=await dz1.stat(X).catch(()=>null);if(!K)continue;if(K.isFile()&&K.mtimeMs>D.lastScanTime)z.push({type:"created",path:X,timestamp:K.mtimeMs,isDirectory:!1})}if(G.type==="deleted")z.push({type:"deleted",path:X,timestamp:B,isDirectory:!1})}if(z.length)for(let G of this.callbacks)G(z)}parseStatus(A){let Q=[],B=A.split("\x00");for(let J of B){if(!J)continue;let D=J[0];if(D==="?"){let z=J.slice(2);Q.push({type:"created",path:z});continue}if(D==="1"){let z=J[2],G=J.substring(J.indexOf("\t")+1);if(z==="D")Q.push({type:"deleted",path:G});else if(z==="A")Q.push({type:"created",path:G})}}return Q}}function az1(A){if(A?.useGit)return new xf(A.pollInterval);if(A?.usePolling)return new NEA(A.pollInterval);let Q=A?.rootPath||process.cwd();if(xf.isRepo(Q)){let B=new xf(A?.pollInterval);if(B.isSupported())return N1.info("Git repository detected, using GitFileWatcher",{rootPath:Q}),B}return N1.info("Not a git repository, using NoOpFileWatcher",{rootPath:Q}),new IEA}x8();iA();import{EventEmitter as RW2}from"node:events";import{promises as jW2}from"node:fs";import{relative as TW2}from"node:path";x8();iA();import{spawn as VW2}from"node:child_process";import{promises as VEA}from"node:fs";import{dirname as OW2,join as Dl1,relative as OEA,resolve as CW2}from"node:path";class Wz{bits;constructor(A){this.bits=A}static empty(){return new Wz(0n)}static fromString(A){let Q=0n;for(let B=0;B<A.length;B++){let J=A.charCodeAt(B),D=Wz.charToBitIndex(J);if(D>=0)Q|=1n<<BigInt(D)}return new Wz(Q)}static fromPath(A){let Q=0n,B=A.split(/[/\\]/);for(let J of B){if(J===""||J==="."||J==="..")continue;for(let D=0;D<J.length;D++){let z=J.charCodeAt(D),G=Wz.charToBitIndex(z);if(G>=0)Q|=1n<<BigInt(G)}}return new Wz(Q)}hasChars(A){return(this.bits&A.bits)===A.bits}union(A){return new Wz(this.bits|A.bits)}intersection(A){return new Wz(this.bits&A.bits)}isEmpty(){return this.bits===0n}getCharCount(){return this.bits.toString(2).split("").filter((A)=>A==="1").length}toString(){let A=[];for(let Q=0;Q<64;Q++)if((this.bits&1n<<BigInt(Q))!==0n){let B=Wz.bitIndexToChar(Q);if(B)A.push(B)}return`CharBag{${A.join("")}}`}toJSON(){return{bits:this.bits.toString()}}static fromJSON(A){return new Wz(BigInt(A.bits))}equals(A){return this.bits===A.bits}static charToBitIndex(A){if(A>=65&&A<=90)A+=32;if(A>=48&&A<=57)return A-48;if(A>=97&&A<=122)return A-97+10;return-1}static bitIndexToChar(A){if(A>=0&&A<=9)return String.fromCharCode(48+A);if(A>=10&&A<=35)return String.fromCharCode(97+A-10);return null}}class EV{id;kind;path;uri;charBag;metadata;isIgnored;isExternal;isPrivate;isAlwaysIncluded;constructor(A){this.id=A.id,this.kind=A.kind,this.path=A.path,this.uri=A.uri,this.metadata=A.metadata,this.isIgnored=A.isIgnored??!1,this.isExternal=A.isExternal??!1,this.isPrivate=A.isPrivate??!1,this.isAlwaysIncluded=A.isAlwaysIncluded??!1,this.charBag=Wz.fromPath(this.path)}withUpdates(A){return new EV({id:this.id,kind:A.kind??this.kind,path:this.path,uri:this.uri,metadata:A.metadata??this.metadata,isIgnored:A.isIgnored??this.isIgnored,isExternal:A.isExternal??this.isExternal,isPrivate:A.isPrivate??this.isPrivate,isAlwaysIncluded:A.isAlwaysIncluded??this.isAlwaysIncluded})}isFile(){return this.kind==="file"}isDirectory(){return this.kind==="directory"||this.kind==="unloaded-directory"||this.kind==="pending-directory"}isLoadedDirectory(){return this.kind==="directory"}getFilename(){return this.path.split(/[/\\]/).pop()||this.path}getExtension(){let A=this.getFilename(),Q=A.lastIndexOf(".");return Q>0?A.slice(Q+1):""}getDirectory(){let A=this.path.split(/[/\\]/);return A.length>1?A.slice(0,-1).join("/"):""}shouldIncludeInResults(){if(this.isAlwaysIncluded)return!0;if(this.isIgnored||this.isPrivate)return!1;return!0}shouldIncludeInMentions(){if(this.isAlwaysIncluded)return!0;if(this.isIgnored||this.isPrivate)return!1;if(this.isFile())return!0;return this.isLoadedDirectory()}getImportanceBoost(){return this.isAlwaysIncluded?0.1:0}toJSON(){return{id:this.id,kind:this.kind,path:this.path,uri:this.uri.toString(),metadata:this.metadata,isIgnored:this.isIgnored,isExternal:this.isExternal,isPrivate:this.isPrivate,isAlwaysIncluded:this.isAlwaysIncluded,charBag:this.charBag.toJSON()}}static fromJSON(A,Q){return new EV({id:A.id,kind:A.kind,path:A.path,uri:Q(A.uri),metadata:A.metadata,isIgnored:A.isIgnored,isExternal:A.isExternal,isPrivate:A.isPrivate,isAlwaysIncluded:A.isAlwaysIncluded})}equals(A){return this.id===A.id&&this.kind===A.kind&&this.path===A.path&&this.metadata.mtime===A.metadata.mtime&&this.metadata.size===A.metadata.size}hashCode(){return`${this.path}:${this.metadata.mtime}:${this.metadata.size}`}toString(){return`Entry{${this.kind}:${this.path}}`}}class SG{static DEFAULT_PATTERNS=[{pattern:"node_modules",type:"directory",description:"Node.js dependencies"},{pattern:"vendor",type:"directory",description:"PHP/Go/Ruby dependencies"},{pattern:"deps",type:"directory",description:"Elixir dependencies"},{pattern:"packages",type:"directory",description:".NET/NuGet packages"},{pattern:".gradle",type:"directory",description:"Gradle cache"},{pattern:".m2",type:"directory",description:"Maven repository"},{pattern:".dart_tool",type:"directory",description:"Dart/Flutter tools"},{pattern:".stack-work",type:"directory",description:"Haskell Stack build"},{pattern:".bundle",type:"directory",description:"Ruby Bundler cache"},{pattern:"__pycache__",type:"directory",description:"Python bytecode cache"},{pattern:".venv",type:"directory",description:"Python virtual environment"},{pattern:"venv",type:"directory",description:"Python virtual environment"},{pattern:".git",type:"directory",description:"Git repository"},{pattern:".svn",type:"directory",description:"Subversion repository"},{pattern:".hg",type:"directory",description:"Mercurial repository"},{pattern:"dist",type:"directory",description:"Distribution files"},{pattern:"build",type:"directory",description:"Build output"},{pattern:"out",type:"directory",description:"Output directory"},{pattern:"target",type:"directory",description:"Rust/Java build target"},{pattern:"_build",type:"directory",description:"Elixir build output"},{pattern:"dist-newstyle",type:"directory",description:"Haskell Cabal build"},{pattern:"zig-cache",type:"directory",description:"Zig build cache"},{pattern:"zig-out",type:"directory",description:"Zig build output"},{pattern:"nimcache",type:"directory",description:"Nim build cache"},{pattern:".dub",type:"directory",description:"D package manager cache"},{pattern:"bin",type:"directory",description:"Binary output"},{pattern:"obj",type:"directory",description:"Object files"},{pattern:"coverage",type:"directory",description:"Test coverage reports"},{pattern:".nyc_output",type:"directory",description:"NYC coverage output"},{pattern:"reports",type:"directory",description:"Test/build reports"},{pattern:".next",type:"directory",description:"Next.js build output"},{pattern:".nuxt",type:"directory",description:"Nuxt.js build output"},{pattern:".cache",type:"directory",description:"Cache directory"},{pattern:".parcel-cache",type:"directory",description:"Parcel cache"},{pattern:".webpack",type:"directory",description:"Webpack cache"},{pattern:".vscode",type:"directory",description:"VS Code settings"},{pattern:".idea",type:"directory",description:"IntelliJ IDEA settings"},{pattern:".elixir_ls",type:"directory",description:"Elixir Language Server cache"},{pattern:".sublime-project",type:"file",description:"Sublime Text project"},{pattern:".sublime-workspace",type:"file",description:"Sublime Text workspace"},{pattern:".DS_Store",type:"file",description:"macOS metadata"},{pattern:"Thumbs.db",type:"file",description:"Windows thumbnails"},{pattern:"desktop.ini",type:"file",description:"Windows folder settings"},{pattern:"*.log",type:"file",description:"Log files"},{pattern:"*.tmp",type:"file",description:"Temporary files"},{pattern:"*.temp",type:"file",description:"Temporary files"},{pattern:"*.swp",type:"file",description:"Vim swap files"},{pattern:"*.swo",type:"file",description:"Vim swap files"},{pattern:"*~",type:"file",description:"Backup files"},{pattern:"*.zip",type:"file",description:"ZIP archives"},{pattern:"*.tar.gz",type:"file",description:"Tar archives"},{pattern:"*.exe",type:"file",description:"Windows executables"},{pattern:"*.dll",type:"file",description:"Windows libraries"},{pattern:"*.so",type:"file",description:"Shared libraries"},{pattern:"*.dylib",type:"file",description:"macOS dynamic libraries"},{pattern:"*.class",type:"file",description:"Java bytecode"},{pattern:"*.pyc",type:"file",description:"Python bytecode"},{pattern:"*.pyo",type:"file",description:"Python optimized bytecode"}];static customPatterns=[];static shouldIgnore(A,Q){let B=[...SG.DEFAULT_PATTERNS,...SG.customPatterns];for(let J of B){if(J.type==="directory"&&!Q)continue;if(J.type==="file"&&Q)continue;if(SG.matchesPattern(A,J.pattern))return!0}return!1}static addCustomPattern(A){SG.customPatterns.push(A)}static clearCustomPatterns(){SG.customPatterns=[]}static getAllPatterns(){return[...SG.DEFAULT_PATTERNS,...SG.customPatterns]}static matchesPattern(A,Q){let J=A.replace(/\\/g,"/").split("/"),D=J[J.length-1];if(Q.includes("*"))return SG.matchesGlob(D??"",Q);return J.some((z)=>z===Q)}static matchesGlob(A,Q){let B=Q.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${B}$`).test(A)}}class zl1{async scanDirectory(A,Q={respectIgnorePatterns:!0}){let B=Date.now(),J=CW2(A),{respectIgnorePatterns:D=!0,maxDepth:z=20,maxFiles:G=1e5,onProgress:X,signal:K,forceNodeJS:Y=!1,strategy:q="auto"}=Q,Z="nodejs",H=[],F=!1,E=0;try{if(Y||q==="nodejs")Z="nodejs";else{let I=await this.tryExternalTools(J,q,K);if(I)H=I.entries,Z=I.strategy,F=!0;else Z="nodejs"}if(Z==="nodejs"){let I=await this.scanWithNodeJS(J,{respectIgnorePatterns:D,maxDepth:z,maxFiles:G,onProgress:X||(()=>{}),signal:K||new AbortController().signal});H=I.entries,E=I.skippedPaths}if(Z!=="nodejs"){if(isFinite(G))H=H.slice(0,G);if(X){let I=H.filter((V)=>V.kind==="file").length,N=H.filter((V)=>V.kind==="directory").length;X({scannedFiles:I,scannedDirectories:N,currentPath:J})}}}catch(I){if(I instanceof Error&&(I.name==="AbortError"||I.message==="Scan aborted"))throw I;N1.warn("Directory scan completed with errors",{error:I})}let M=Date.now()-B,W=H.filter((I)=>I.kind==="file").length,w=H.filter((I)=>I.kind==="directory").length;return{entries:H,stats:{totalFiles:W,totalDirectories:w,scanDuration:M,skippedPaths:E,strategy:Z,externalToolsAvailable:F}}}async tryExternalTools(A,Q,B){let J=[];if(Q==="auto")J.push("git","ripgrep");else if(Q==="git")J.push("git");else if(Q==="ripgrep")J.push("ripgrep");for(let D of J)try{N1.debug("Attempting to use external tool",{tool:D});let z=await this.runExternalTool(D,A,B);if(z.length>0)return{entries:z,strategy:D};else N1.debug("External tool returned no entries, trying next",{tool:D})}catch(z){N1.debug("External tool failed, trying next",{tool:D,error:z})}return N1.debug("All external tools failed, falling back to Node.js scanning"),null}async runExternalTool(A,Q,B){let J=A==="git"?"git":"rg",D=A==="git"?["ls-files","--exclude-standard","--cached","--others"]:["--files"];return N1.debug("Running external tool",{command:J,args:D,rootPath:Q}),new Promise((z,G)=>{let X=VW2(J,D,{cwd:Q,stdio:["ignore","pipe","pipe"]}),K="",Y="";if(X.stdout?.on("data",(q)=>{K+=q.toString()}),X.stderr?.on("data",(q)=>{Y+=q.toString()}),B)B.addEventListener("abort",()=>{X.kill("SIGTERM"),G(new Error("Scan aborted"))},{once:!0});X.on("close",(q)=>{if(q!==0){N1.debug("External tool failed",{command:J,code:q,stderr:Y}),G(new Error(`${J} exited with code ${q}: ${Y}`));return}try{let Z=K.trim().split(`
4816
- `).filter((W)=>W.length>0),H=new Set,F=Z.map((W)=>{let w=this.createEntryFromPath(Dl1(Q,W),{size:0,mtime:new Date,isDirectory:!1,isFile:!0,isSymlink:!1}),I=W;while(I!==""&&I!==".")if(I=OW2(I),I&&I!=="."&&!H.has(I))H.add(I);return w}),E=Array.from(H).map((W)=>{return this.createEntryFromPath(Dl1(Q,W),{size:0,mtime:new Date,isDirectory:!0,isFile:!1,isSymlink:!1})}),M=[...F,...E];z(M)}catch(Z){G(Z)}}),X.on("error",(q)=>{G(q)})})}async scanWithNodeJS(A,Q){if(Q.signal?.aborted)throw new Error("Scan aborted");let B=[],J={scannedFiles:0,scannedDirectories:0,skippedPaths:0};return await this.scanDirectoryRecursive(A,A,0,Q,B,J),{entries:B,skippedPaths:J.skippedPaths}}async scanDirectoryRecursive(A,Q,B,J,D,z){if(J.signal?.aborted)throw new Error("Scan aborted");if(B>J.maxDepth)return;if(D.length>=J.maxFiles)return;let G=OEA(Q,A);if(J.respectIgnorePatterns&&G){if(SG.shouldIgnore(G,!0)){z.skippedPaths++;return}}let X;try{X=await VEA.readdir(A,{withFileTypes:!0})}catch(K){if(K instanceof Error){if("code"in K&&(K.code==="EACCES"||K.code==="EPERM")){z.skippedPaths++;return}if("code"in K&&K.code==="ENOENT")return}throw K}for(let K of X){if(J.signal?.aborted)throw new Error("Scan aborted");if(D.length>=J.maxFiles)break;let Y=Dl1(A,K.name),q=OEA(Q,Y);if(J.respectIgnorePatterns){if(SG.shouldIgnore(q,K.isDirectory())){z.skippedPaths++;continue}}try{let Z;if(K.isDirectory())Z=this.createEntryFromPath(Y,{size:0,mtime:new Date,isDirectory:!0,isFile:!1,isSymlink:!1}),z.scannedDirectories++;else{let H=await VEA.stat(Y);Z=this.createEntryFromPath(Y,{size:H.size,mtime:H.mtime,isDirectory:!1,isFile:!0,isSymlink:H.isSymbolicLink()}),z.scannedFiles++}if(D.push(Z),J.onProgress&&D.length%100===0)J.onProgress({scannedFiles:z.scannedFiles,scannedDirectories:z.scannedDirectories,currentPath:Y});if(K.isDirectory())await this.scanDirectoryRecursive(Y,Q,B+1,J,D,z)}catch(Z){if(Z instanceof Error){if("code"in Z&&(Z.code==="EACCES"||Z.code==="EPERM"||Z.code==="ENOENT")){z.skippedPaths++;continue}}N1.warn("Error processing file",{error:Z}),z.skippedPaths++}}}createEntryFromPath(A,Q){let B;if(Q.isDirectory)B="directory";else B="file";let J={size:Q.size,mtime:Q.mtime.getTime(),isSymlink:Q.isSymlink},D=A,z=C6.file(A);return new EV({id:D,kind:B,path:A,uri:z,metadata:J})}}var LW2={minScore:400,caseSensitive:!1,penalizeLengthDifference:!0,maxResults:50,smartCase:!0},wz={EXACT_FILENAME:1000,SEGMENT_ORDERED_EXACT:950,PREFIX_FILENAME:900,SUFFIX_FILENAME:850,SEGMENT_ORDERED_PARTIAL:840,SUBSTRING_FILENAME:800,SEGMENT_EXACT:650,SEGMENT_SUBSTRING:600,PATH_SUBSTRING:500,FUZZY:250};class CEA{config;queryChars;queryLower;constructor(A,Q={}){this.config={...LW2,...Q};let B=A.replace(/^[@#]+/,"");if(this.queryChars=Array.from(B),this.queryLower=Array.from(B.toLowerCase()),this.config.smartCase)this.config.caseSensitive=B!==B.toLowerCase()}match(A){if(this.queryChars.length===0)return A.filter((B)=>B.shouldIncludeInResults()).sort((B,J)=>J.getImportanceBoost()-B.getImportanceBoost()).slice(0,this.config.maxResults).map((B)=>({entry:B,score:B.getImportanceBoost(),matchPositions:[],highlightedPath:B.path}));let Q=this.matchWithSemanticScoring(A);if(Q.length>0)return Q;return this.matchWithFuzzyScoring(A)}matchWithSemanticScoring(A){let Q=[],B=0,J=this.queryChars.join(""),D=this.queryChars[0],G=this.queryChars.length===1&&D!==void 0&&/[a-z]/i.test(D)?1e4:20000;for(let X of A){if(!X.shouldIncludeInResults())continue;if(J.length>5&&!this.passesCharBagFilter(J,X))continue;let K=this.matchEntrySemantic(X);if(K&&K.score>=this.config.minScore)Q.push(K);if(B++,Q.length>=this.config.maxResults*5||B>=G)break}return Q.sort((X,K)=>{let Y=K.score-X.score;if(Math.abs(Y)>0.001)return Y;return X.entry.path.length-K.entry.path.length}),Q.slice(0,this.config.maxResults)}matchWithFuzzyScoring(A){let Q=[],B=0,J=this.queryChars.join(""),D=this.queryChars[0],G=this.queryChars.length===1&&D!==void 0&&/[a-z]/i.test(D)?1e4:20000;for(let X of A){if(!X.shouldIncludeInResults())continue;if(J.length>5&&!this.passesCharBagFilter(J,X))continue;let K=this.matchEntryFuzzy(X);if(K)Q.push(K);if(B++,Q.length>=this.config.maxResults*5||B>=G)break}return Q.sort((X,K)=>{let Y=K.score-X.score;if(Math.abs(Y)>0.001)return Y;return X.entry.path.length-K.entry.path.length}),Q.slice(0,this.config.maxResults)}matchEntrySemantic(A){let Q=A.path,B=this.queryLower.join(""),J=this.calculateSemanticScore(B,A);if(J===0)return null;let D=this.applyTieBreakers(J,B,A),z=this.findMatchPositions(B,Q),G=this.createHighlightedPath(Q,z);return{entry:A,score:D,matchPositions:z,highlightedPath:G}}matchEntryFuzzy(A){let Q=A.path,B=this.queryLower.join(""),J=this.calculateFuzzyScore(B,A);if(J===0)return null;let D=this.applyTieBreakers(J,B,A),z=this.findMatchPositions(B,Q),G=this.createHighlightedPath(Q,z);return{entry:A,score:D,matchPositions:z,highlightedPath:G}}calculateSemanticScore(A,Q){let B=A.toLowerCase(),J=Q.path,D=J.toLowerCase(),z=this.getFilename(J),G=this.removeExtension(z).toLowerCase(),X=D.split(/[/.\s-_]/).filter((Z)=>Z.length>0);if(A.endsWith("/")&&Q.isDirectory()){let Z=B.slice(0,-1);if(D===Z||D.endsWith("/"+Z))return wz.EXACT_FILENAME+100;if(D.includes(Z))return wz.SUBSTRING_FILENAME+50}if(G===B||z.toLowerCase()===B)return wz.EXACT_FILENAME;if(G.startsWith(B))return wz.PREFIX_FILENAME;if(G.endsWith(B))return wz.SUFFIX_FILENAME;if(G.includes(B))return wz.SUBSTRING_FILENAME;let K=this.simpleTokens(B);if(K.length>1){let Z=this.matchTokensToSegments(K,X);if(Z)return Z}if(K.length===1&&B.length>6){let Z=this.progressiveSegmentMatch(B,X);if(Z)return Z}if(X.includes(B))return wz.SEGMENT_EXACT;if(X.some((Z)=>Z.includes(B)))return wz.SEGMENT_SUBSTRING;if(X.join("").includes(B))return wz.SEGMENT_SUBSTRING;if(D.replace(/[\s-_]/g,"").includes(B))return wz.PATH_SUBSTRING;return 0}calculateFuzzyScore(A,Q){let B=A.toLowerCase(),J=Q.path.toLowerCase();if(this.fuzzyIn(B,J))return wz.FUZZY;return 0}applyTieBreakers(A,Q,B){let J=A,D=Math.abs(B.path.length-Q.length);J-=0.01*D;let z=B.path.split("/").length-1;J-=0.1*z;let G=this.getFilename(B.path),X=this.removeExtension(G).toLowerCase();if(/^(license|readme|copy(ing|left))$/i.test(X)&&z===1)J-=200;if(B.metadata.mtime){let Y=(Date.now()-B.metadata.mtime)/86400000;if(Y<30){let q=Math.max(0,1-Y/30);J+=50*q}}if(this.config.openFiles?.includes(B.path))J+=300;return J}simpleTokens(A){return A.replace(/([a-z])([A-Z0-9])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}progressiveSegmentMatch(A,Q){let B=0,J=0,D=0;for(let G of Q){if(B>=A.length)break;let X="",K="none";if(B+G.length<=A.length){if(A.slice(B,B+G.length)===G)X=G,K="exact"}if(!X&&G.length>=3){if(A.slice(B).startsWith(G))X=G,K="prefix"}if(!X&&G.length>=3){let Y=A.slice(B);if(Y.includes(G)&&Y.indexOf(G)===0)X=G,K="substring"}if(!X){let Y=A.slice(B);if(Y.length>=3&&G.includes(Y))X=Y,K="substring"}if(X){if(B+=X.length,J++,K==="exact")D++}}if(B/A.length>=0.8&&J>=2)return D>=2?wz.SEGMENT_ORDERED_EXACT:wz.SEGMENT_ORDERED_PARTIAL;return 0}matchTokensToSegments(A,Q){let B=this.findTokenMatches(A,Q),J=this.getWorstMatchType(B);return this.scoreFromMatchType(J)}findTokenMatches(A,Q){let B=0,J=[];for(let D of A){let z=!1;for(let G=B;G<Q.length;G++){let X=Q[G];if(!X)continue;if(D===X){J.push("exact"),B=G+1,z=!0;break}else if(X.startsWith(D)||D.startsWith(X)||X.endsWith(D)||X.includes(D)||D.includes(X)){J.push("partial"),B=G+1,z=!0;break}}if(!z)return[]}return J}getWorstMatchType(A){if(A.length===0)return"none";if(A.includes("partial"))return"partial";return"exact"}scoreFromMatchType(A){switch(A){case"exact":return wz.SEGMENT_ORDERED_EXACT;case"partial":return wz.SEGMENT_ORDERED_PARTIAL;default:return 0}}fuzzyIn(A,Q){let B=0;for(let J=0;J<Q.length&&B<A.length;J++)if(Q[J]===A[B])B++;return B===A.length}getFilename(A){return A.split("/").pop()||A}removeExtension(A){let Q=A.lastIndexOf(".");return Q>0?A.substring(0,Q):A}findMatchPositions(A,Q){let B=[],J=Q.toLowerCase(),D=A.toLowerCase();if(J.includes(D)){let G=J.indexOf(D);for(let X=0;X<D.length;X++)B.push(G+X);return B}let z=0;for(let G of D){let X=J.indexOf(G,z);if(X!==-1)B.push(X),z=X+1}return B}passesCharBagFilter(A,Q){if(A.includes("/")){let B=A.split("/");for(let J of B){if(J.trim()==="")continue;let D=Wz.fromString(J);if(!Q.charBag.hasChars(D))return!1}return!0}else{let B=Wz.fromString(A);return Q.charBag.hasChars(B)}}createHighlightedPath(A,Q){if(Q.length===0)return A;let B="",J=0;for(let D of Q){if(D>=A.length)continue;B+=A.slice(J,D),B+=`**${A[D]}**`,J=D+1}return B+=A.slice(J),B}}function LEA(A,Q,B){return new CEA(A,B).match(Q)}class Br{metadata;entries;entriesByPath;entriesById;constructor(A,Q=[],B,J){if(this.metadata=A,this.entries=Q,B&&J)this.entriesByPath=B,this.entriesById=J;else{let D=new Map,z=new Map;for(let G of Q)D.set(G.path,G),z.set(G.id,G);this.entriesByPath=D,this.entriesById=z}this.cachedArray=Array.from(this.entriesByPath.values()),this.entriesArrayDirty=!1}static create(A){let Q=Date.now();return new Br({id:Q,createdAt:Q,rootPath:A,entryCount:0,scanStatus:"scanning"},[])}static fromEntries(A,Q){let B=Date.now(),J={id:B,createdAt:B,rootPath:A,entryCount:Q.length,scanStatus:"complete"};return new Br(J,Q)}entriesArrayDirty=!1;cachedArray=[];getAllEntries(){if(this.entriesArrayDirty)this.cachedArray=[...this.entriesByPath.values()],this.entriesArrayDirty=!1;return this.cachedArray}getEntryByPath(A){return this.entriesByPath.get(A)??null}getEntryById(A){return this.entriesById.get(A)??null}applyChanges(A){let{added:Q=[],removed:B=[],modified:J=[]}=A;for(let D of B){let z=this.entriesByPath.get(D);if(z){if(this.entriesByPath.delete(D),this.entriesById.delete(z.id),!this.entriesArrayDirty){let G=this.cachedArray.findIndex((X)=>X.path===D);if(G>=0)this.cachedArray.splice(G,1)}}}for(let D of[...Q,...J])if(this.entriesByPath.set(D.path,D),this.entriesById.set(D.id,D),!this.entriesArrayDirty){let z=this.cachedArray.findIndex((G)=>G.path===D.path);if(z>=0)this.cachedArray.splice(z,1);this.cachedArray.unshift(D)}this.metadata.entryCount=this.entriesByPath.size}findEntries(A){return this.entries.filter(A)}getFiles(){return this.findEntries((A)=>A.kind==="file")}getDirectories(){return this.findEntries((A)=>A.kind==="directory")}getInDirectory(A){let Q=A.endsWith("/")?A:A+"/";return this.findEntries((B)=>B.path.startsWith(Q)&&B.path!==A)}hasPath(A){return this.entriesByPath.has(A)}getStats(){let A=this.metadata.entryCount||this.entries.length,Q=this.getFiles().length,B=A-Q,J=A*250;return{totalEntries:A,fileEntries:Q,directoryEntries:B,memoryUsage:J}}}class Gl1 extends RW2{rootPath;currentSnapshot=null;fileWatcher;scanner;isScanning=!1;stats;constructor(A,Q){super();this.rootPath=A;this.fileWatcher=Q??az1(),this.scanner=new zl1,this.stats={totalFiles:0,totalDirectories:0,lastScanDuration:0,lastScanTime:0,memoryUsage:0,status:"idle"},this.fileWatcher.onFileSystemEvent(this.handleFileSystemEvents.bind(this))}async initialize(A){if(this.isScanning)throw new Error("Index is already being initialized");try{await this.performFullScan(A),await this.fileWatcher.watch(this.rootPath)}catch(Q){throw this.updateStatus("error"),Q}}async rescan(A){await this.performFullScan(A)}getCurrentSnapshot(){return this.currentSnapshot}getStats(){return{...this.stats}}search(A,Q={}){if(this.fileWatcher.triggerScan)this.fileWatcher.triggerScan(this.rootPath).catch(()=>{});if(!this.currentSnapshot)return[];let{limit:B=50,minScore:J=0.1,includeDirectories:D=!0,includeIgnored:z=!1}=Q,G=this.currentSnapshot.getAllEntries(),X=A.replace(/[@/]/g,"");if(X.length>2){if(G.some((Z)=>Z.path.includes(X))){let Z=G.find((H)=>H.path.includes(X));N1.debug("Search for existing file",{query:A,matchingFile:Z?.path,entryIndex:G.findIndex((H)=>H===Z)})}}G=G.filter((q)=>{if(!z&&q.isIgnored)return!1;if(!D&&q.isDirectory())return!1;return q.shouldIncludeInMentions()});let K=LEA(A,G,{minScore:J,openFiles:Q.openFiles});return K.sort((q,Z)=>Z.score-q.score),K.slice(0,B)}dispose(){this.fileWatcher.dispose(),this.removeAllListeners()}async performFullScan(A){this.isScanning=!0,this.updateStatus("scanning");let Q=Date.now();try{let B=await this.scanner.scanDirectory(this.rootPath,{respectIgnorePatterns:!0,...A});this.currentSnapshot=Br.fromEntries(this.rootPath,B.entries);let J=Date.now()-Q;this.stats={...this.stats,totalFiles:B.stats.totalFiles,totalDirectories:B.stats.totalDirectories,lastScanDuration:J,lastScanTime:Q,memoryUsage:this.currentSnapshot.getStats().memoryUsage,status:"idle"},this.emit("scan-complete",{entries:B.entries.length,duration:J}),this.emit("status-changed",this.getStats())}catch(B){throw this.updateStatus("error"),this.emit("scan-error",B),B}finally{this.isScanning=!1}}async handleFileSystemEvents(A){if(!this.currentSnapshot||this.isScanning)return;this.updateStatus("updating");try{let Q=[],B=[],J=[];for(let D of A){let z=D.path;switch(D.type){case"deleted":Q.push(z);break;case"created":await this.processCreatedEvent(D,B);break;case"modified":await this.processModifiedEvent(D,J);break;case"renamed":if(D.oldPath)Q.push(D.oldPath);await this.processCreatedEvent(D,B);break}}if(this.currentSnapshot.applyChanges({removed:Q,added:B,modified:J}),Q.length>0||B.length>0||J.length>0)N1.debug("Incremental snapshot update",{removed:Q.length,added:B.length,modified:J.length,totalEntries:this.currentSnapshot.metadata.entryCount,sampleAdded:B.slice(0,3).map((D)=>D.path),sampleRemoved:Q.slice(0,3)});this.stats={...this.stats,memoryUsage:this.currentSnapshot.getStats().memoryUsage,status:"idle"},this.emit("files-updated",{added:B.length,removed:Q.length,modified:J.length}),this.emit("status-changed",this.getStats())}catch(Q){this.updateStatus("error"),this.emit("scan-error",Q)}}async processCreatedEvent(A,Q){let B=A.path;try{let J=A.stat||(A.isDirectory?null:await jW2.lstat(B)),D=A.isDirectory,z=TW2(this.rootPath,B);if(SG.shouldIgnore(z,D))return;if(D)Q.push(new EV({id:B,kind:"directory",path:B,uri:C6.file(B),metadata:{size:0,mtime:Date.now(),isSymlink:!1},isIgnored:!1}));else if(J)Q.push(new EV({id:B,kind:"file",path:B,uri:C6.file(B),metadata:{size:J.size,mtime:J.mtimeMs,isSymlink:J.isSymbolicLink()},isIgnored:!1}))}catch{}}async processModifiedEvent(A,Q){let B=this.currentSnapshot?.getEntryByPath(A.path);if(B){let J=B.withUpdates({metadata:{...B.metadata,mtime:A.timestamp}});Q.push(J)}}updateStatus(A){this.stats={...this.stats,status:A},this.emit("status-changed",this.getStats())}}iA();import{execFile as $W2}from"node:child_process";import{EventEmitter as _W2}from"node:events";import{promises as rz1,watch as PW2}from"node:fs";import{join as hf}from"node:path";import{promisify as SW2}from"node:util";var vW2=SW2($W2);class Xl1 extends _W2{repoRoot;pollInterval;on(A,Q){return super.on(A,Q)}emit(A,...Q){return super.emit(A,...Q)}currentSha;disposed=!1;started=!1;running=!1;pendingForce=!1;watchers=new Set;currentRefWatcher;timer;constructor(A,Q=30000){super();this.repoRoot=A;this.pollInterval=Q;this.repoRoot=this.validateRepoRoot(A)}static async isRepo(A){try{let Q=hf(A,".git");return await rz1.access(Q),!0}catch{try{let Q=hf(A,"HEAD");return await rz1.access(Q),!0}catch{return!1}}}async start(){if(this.disposed)throw new Error("GitHeadWatcher has been disposed");if(this.started)throw new Error("GitHeadWatcher has already been started");this.started=!0,this.currentSha=await this.getCurrentSha(),this.watch(hf(this.repoRoot,".git/HEAD"),async()=>{await this.updateRefWatcher(),this.scheduleCheck()}),await this.updateRefWatcher();let A=hf(this.repoRoot,".git/logs/HEAD");try{await rz1.access(A),this.watch(A,()=>this.scheduleCheck(!0))}catch{}this.timer=setInterval(()=>this.scheduleCheck(),this.pollInterval),N1.debug("GitHeadWatcher started",{repoRoot:this.repoRoot})}stop(){for(let A of Array.from(this.watchers))this.cleanupWatcher(A);if(this.timer)clearInterval(this.timer),this.timer=void 0;this.currentRefWatcher=void 0,this.started=!1,this.running=!1,this.pendingForce=!1}dispose(){if(this.disposed)return;this.stop(),this.disposed=!0,this.removeAllListeners()}watch(A,Q){let B=PW2(A);return B.on("change",Q),B.on("rename",()=>{this.cleanupWatcher(B),setTimeout(()=>{if(!this.disposed)this.watch(A,Q),this.scheduleCheck(!0)},50)}),B.on("error",(J)=>{N1.debug("Git file watcher error",{filePath:A,error:J}),this.cleanupWatcher(B)}),this.watchers.add(B),B}cleanupWatcher(A){try{A.removeAllListeners(),A.close()}catch(Q){N1.debug("Error during watcher cleanup",{error:Q})}this.watchers.delete(A)}async updateRefWatcher(){if(this.currentRefWatcher)this.cleanupWatcher(this.currentRefWatcher),this.currentRefWatcher=void 0;try{let A=await rz1.readFile(hf(this.repoRoot,".git/HEAD"),"utf8");if(!A)return;let Q=A.trim();if(Q.startsWith("ref: ")){let B=Q.slice(5),J=hf(this.repoRoot,".git",B);this.currentRefWatcher=this.watch(J,()=>this.scheduleCheck())}}catch(A){N1.debug("Failed to update ref watcher",{repoRoot:this.repoRoot,error:A})}}scheduleCheck(A=!1){if(this.disposed)return;if(this.pendingForce||=A,this.running)return;this.running=!0,queueMicrotask(async()=>{if(this.disposed)return;let Q=this.pendingForce;this.pendingForce=!1;try{await this.performCheck(Q)}finally{this.running=!1}})}async checkForChanges(A=!1){this.scheduleCheck(A)}async performCheck(A){if(this.disposed)return;try{let Q=await this.getCurrentSha();if(!Q&&this.currentSha){N1.warn("Failed to get current SHA, keeping previous value",{repoRoot:this.repoRoot,previousSha:this.currentSha.slice(0,7)});return}if(Q&&Q!==this.currentSha&&this.currentSha||A){let B=this.currentSha;this.currentSha=Q??this.currentSha,this.emit("head-change",{oldSha:B,newSha:this.currentSha,repoRoot:this.repoRoot,force:A})}else if(Q!==this.currentSha)this.currentSha=Q}catch(Q){N1.warn("Error checking for git HEAD changes",{repoRoot:this.repoRoot,error:Q})}}async getCurrentSha(){try{let{stdout:A}=await vW2("git",["rev-parse","HEAD"],{cwd:this.repoRoot});return A.trim()}catch(A){return}}validateRepoRoot(A){if(!A||typeof A!=="string")throw new Error("Repository root must be a valid string path");if(!A.startsWith("/")&&!A.match(/^[A-Za-z]:\\/))throw new Error("Repository root must be an absolute path");return A}}async function REA(A,Q){if(!await Xl1.isRepo(A))return null;return new Xl1(A,Q?.pollInterval)}class nz1{indexes=new Map;headWatchers=new Map;reindexingWorkspaces=new Set;config;disposed=!1;static forWorkspace(A){return new nz1({workspaceRoots:[A],scanOnStartup:!0,maxIndexedFiles:500000,enableFileWatching:!0,usePollingFallback:!1,enableHeadWatching:!0})}constructor(A){this.config={...A}}async initialize(){if(this.disposed)throw new Error("Service has been disposed");if(this.config.scanOnStartup){let A=this.config.workspaceRoots.map((Q)=>this.indexWorkspace(Q));await Promise.allSettled(A)}}async indexWorkspace(A){if(this.disposed)throw new Error("Service has been disposed");if(this.indexes.has(A)){await this.indexes.get(A).rescan();return}let Q=this.config.enableFileWatching?az1({rootPath:A,usePolling:this.config.usePollingFallback}):void 0,B=new Gl1(A,Q);B.on("scan-error",(D)=>{N1.error("Scan error in workspace",{rootPath:A,error:D})});let J={respectIgnorePatterns:!0,maxFiles:this.config.maxIndexedFiles};try{if(await B.initialize(J),this.indexes.set(A,B),this.config.enableHeadWatching)await this.setupHeadWatching(A,B,Q)}catch(D){B.dispose();let z=this.headWatchers.get(A);if(z)z.dispose(),this.headWatchers.delete(A);throw D}}async removeWorkspace(A){let Q=this.indexes.get(A);if(Q)Q.dispose(),this.indexes.delete(A);let B=this.headWatchers.get(A);if(B)B.dispose(),this.headWatchers.delete(A)}searchAll(A,Q){let B=[];for(let J of this.indexes.values())try{let D=J.search(A,Q);B.push(...D)}catch(D){}return B.sort((J,D)=>D.score-J.score),Q?.limit?B.slice(0,Q.limit):B}searchWorkspace(A,Q,B){let J=this.indexes.get(A);if(!J)return[];try{return J.search(Q,B)}catch(D){return N1.error(`Search error in workspace ${A}:`,D),[]}}getIndexStats(A){if(A){let B=this.indexes.get(A);if(B)return[{...B.getStats(),rootPath:A}];return[]}let Q=[];for(let[B,J]of this.indexes.entries())Q.push({...J.getStats(),rootPath:B});return Q}getConfig(){return{...this.config}}updateConfig(A){this.config={...this.config,...A}}async rescanAll(){let A=[];for(let[Q,B]of this.indexes.entries())A.push(B.rescan().catch((J)=>{N1.error(`Rescan error in workspace ${Q}:`,J)}));await Promise.allSettled(A)}getIndexedWorkspaces(){return Array.from(this.indexes.keys())}isWorkspaceIndexed(A){return this.indexes.has(A)}dispose(){if(this.disposed)return;for(let[,A]of this.indexes.entries())A.dispose();for(let[,A]of this.headWatchers.entries())A.dispose();this.indexes.clear(),this.headWatchers.clear(),this.disposed=!0}isDisposed(){return this.disposed}async setupHeadWatching(A,Q,B){try{let J=await REA(A);if(!J)return;J.on("head-change",async({oldSha:D,newSha:z})=>{if(this.reindexingWorkspaces.has(A)){N1.debug("Re-index already in progress, skipping",{rootPath:A});return}this.reindexingWorkspaces.add(A);try{if(await Q.rescan(),B&&B instanceof xf)await B.reset(A);N1.debug("Re-index completed after HEAD change",{rootPath:A})}catch(G){N1.error("Failed to re-index after change",{rootPath:A,error:G})}finally{this.reindexingWorkspaces.delete(A)}}),await J.start(),this.headWatchers.set(A,J),N1.debug("Git HEAD watching enabled",{rootPath:A})}catch(J){N1.warn("Failed to setup git HEAD watching",{rootPath:A,error:J})}}}function Kl1(A,Q){let B={workspaceRoots:A,scanOnStartup:!0,maxIndexedFiles:500000,enableFileWatching:!0,usePollingFallback:!1,enableHeadWatching:!0,...Q};return new nz1(B)}import kW2 from"node:os";import sz1 from"node:path";class oz1{rootPath;opts;startInBackground;fuzzyService=null;state="unstarted";initPromise=null;constructor(A=process.cwd(),Q={},B=!1){this.rootPath=A;this.opts=Q;this.startInBackground=B;if(B)this.initPromise=this.init(),this.initPromise.then(()=>{N1.debug("Fuzzy service background initialization completed")}).catch((J)=>{N1.debug("Fuzzy service background initialization failed",J)})}async start(){if(this.initPromise)return this.initPromise;return this.initPromise=this.init(),this.initPromise}async init(){if(sz1.resolve(this.rootPath)===sz1.resolve(kW2.homedir())){N1.debug("Skipping fuzzy service initialization for home directory");return}this.state="initializing";try{this.fuzzyService=Kl1([this.rootPath],{scanOnStartup:!0,enableFileWatching:!0,usePollingFallback:!1,...this.opts}),await this.fuzzyService.initialize(),this.state="ready"}catch(A){throw this.state="failed",N1.error("Failed to initialize fuzzy service",A),A}}async query(A,Q=50){if(this.initPromise)try{await this.initPromise}catch(J){return N1.warn("Background fuzzy initialization failed, returning empty results",J),[]}if(!this.fuzzyService)return N1.warn("Fuzzy service not initialized, returning empty results"),[];let B=(J)=>sz1.relative(this.rootPath,J);try{let J=A.trim();return this.fuzzyService.searchAll(J,{limit:Q,minScore:J?0.1:void 0}).map((z)=>B(z.entry.path))}catch(J){return N1.error("Fuzzy search failed",J),[]}}async queryCompletions(A,Q=50){if(this.initPromise)try{await this.initPromise}catch(J){return N1.warn("Background fuzzy initialization failed, returning empty results",J),[]}if(!this.fuzzyService)return N1.warn("Fuzzy service not initialized, returning empty results"),[];let B=(J)=>sz1.relative(this.rootPath,J);try{let J=A.trim();return this.fuzzyService.searchAll(J,{limit:Q,minScore:J?0.1:void 0}).map((z)=>({path:B(z.entry.path),kind:z.entry.isDirectory()?"folder":"file"}))}catch(J){return N1.error("Fuzzy search failed",J),[]}}getStats(){return{state:this.state,stats:this.fuzzyService?.getIndexStats()??[]}}dispose(){if(this.fuzzyService)this.fuzzyService.dispose(),this.fuzzyService=null;this.state="unstarted",this.initPromise=null}}H3();LJ();XW();var hEA={url:{value:"https://ampcode.com",visible:!1,description:"The Amp server URL to connect to"},"anthropic.thinking.enabled":{value:!1,visible:!1,description:"Enable Claude thinking process output for debugging"},"anthropic.interleavedThinking.enabled":{value:!1,visible:!1,description:"Enable interleaved thinking for Claude 4 models (allows reasoning between tool calls)"},"anthropic.temperature":{value:1,visible:!1,description:"Temperature setting for Anthropic models (0.0 = deterministic, 1.0 = creative). Note: Only takes effect when thinking is disabled. Internal use only."},"notifications.enabled":{value:!0,visible:!0,description:"Enable system sound notifications when agent completes tasks"},"notifications.system.enabled":{value:!0,visible:!0,description:"Enable system notifications when terminal is not focused"},"todos.enabled":{value:!0,visible:!1,description:"Enable TODO tracking and management features"},mcpServers:{value:{filesystem:{command:"npx",args:["@modelcontextprotocol/server-filesystem","/path/to/allowed/dir"]}},visible:!0,description:"Model Context Protocol servers to connect to for additional tools"},"tools.disable":{value:["browser_navigate","builtin:edit_file"],visible:!0,description:"Array of tool names to disable. Use 'builtin:toolname' to disable only the builtin tool with that name (allowing an MCP server to provide a tool by that name)."},"tools.inactivityTimeout":{value:300,visible:!1,description:"How many seconds of no output to wait before canceling bash commands"},"tools.stopTimeout":{value:300,visible:!1,description:"Timeout for stopping tools"},cacheDirectory:{value:void 0,visible:!1,description:"Directory to use for caching logs or storing other files"},permissions:{value:[{tool:"Bash",action:"ask",matches:{cmd:["git push*","git commit*"]}}],visible:!0,description:"Permission rules for tool calls. See amp permissions --help"},"guardedFiles.allowlist":{value:[],visible:!0,description:"Array of file glob patterns that are allowed to be accessed without confirmation. Takes precedence over the built-in denylist."},dangerouslyAllowAll:{value:!1,visible:!0,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},submitOnEnter:{value:!0,visible:!1,description:"Whether to submit messages on Enter (true) or require Ctrl+Enter (false)"},"terminal.commands.hide":{value:!1,visible:!1,description:"Hide terminal command output from the user"},"terminal.commands.nodeSpawn.loadProfile":{value:"daily",visible:!1,description:"How often to load shell profile in node-spawn mode (always, daily, never)"},"terminal.commands.nodeSpawn.detachedLogsDirectory":{value:void 0,visible:!1,description:"Directory to store detached logs in node-spawn mode"},"tab.enabled":{value:!0,visible:!1,description:"Enable tab completion features"},"tab.disabledLanguages":{value:[],visible:!1,description:"List of language IDs for which tab completion is disabled"},"tab.disableOnComment":{value:!1,visible:!1,description:"Disable tab completion on comment lines"},"tab.autoImport.enabled":{value:!1,visible:!1,description:"Enable auto-import feature for tab completion"},"tab.experimental.unobtrusiveDiffs":{value:!1,visible:!1,description:"Experimental: Enable unobtrusive diffs mode for tab suggestions to avoid layout shifts"},"tab.experimental.disableClientFilters":{value:[],visible:!1,description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior."},"tab.diagnosticTracking":{value:"same_file",visible:!1,description:'Enable diagnostic tracking for tab suggestions. Values: "disabled" | "same_file" | "multi_file"'},"tab.experimental.improvedDiffChunking":{value:!1,visible:!1,description:"Experimental: Enable improved diff chunking for better readability of large diff suggestions"},"tab.dimissCommandIds":{value:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],visible:!1,description:"Command IDs to execute when escape key is pressed in modal editors"},"tab.verboseLogs":{value:!1,visible:!1,description:"Enable verbose logging for tab completion"},debugLogs:{value:!1,visible:!1,description:"Enable debug logging output"},"guidanceFiles.specs":{value:!1,visible:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read"},hooks:{value:[],visible:!1,description:"Custom hooks for extending Amp functionality"},"anthropic.provider":{value:"anthropic",visible:!1,description:'Which provider to use for Anthropic Claude inference: "anthropic" or "vertex"'},"experimental.run_javascript.enabled":{value:!1,visible:!1,description:"Whether to enable the experimental run_javascript tool"},"internal.alloy.enabled":{value:!1,visible:!1,description:"Enable experimental alloy mode (switch between Anthropic and OpenAI between turns when safe)."},"experimental.cli.nativeSecretsStorage.enabled":{value:!1,visible:!1,description:"Use native secret storage instead of the plain-text secrets configuration file"},"experimental.reviewTool":{value:!1,visible:!1,description:"Experimental: Enable the summarize_git_diff tool."},"experimental.tools":{value:[],visible:!1,description:"Enable experimental tools by name. Available tools: chat_llm"},"summary.provider":{value:"gemini",visible:!1,description:"Summary provider to use (anthropic or gemini)"},"git.commit.coauthor.enabled":{value:!0,visible:!0,description:"Enable adding Amp as co-author in git commits"},"git.commit.ampThread.enabled":{value:!0,visible:!0,description:"Enable adding Amp-Thread trailer in git commits"},gpt5:{value:!1,visible:!1,description:"Try GPT-5 from OpenAI as the primary agent model. See https://ampcode.com/news/gpt-5."},gpt5ReasoningEffort:{value:"medium",visible:!1,description:"Reasoning effort to use with GPT-5: minimal | low | medium | high"},"jetbrains.skipInstall":{value:!1,visible:!1,description:"Skip JetBrains plugin installation"},proxy:{value:void 0,visible:!0,description:"Proxy URL used for both HTTP and HTTPS requests to the Amp server"}},cW2=Object.fromEntries(Object.entries(hEA).filter(([,A])=>A.visible).map(([A,Q])=>[`amp.${A}`,Q.value])),Jr={examples:[{description:"Start an interactive session:",command:"amp"},{description:"Start an interactive session with a user message:",command:'echo "commit all my unstaged changes" | amp'},{description:"Use execute mode (--execute or -x) to send a command to an agent, have it execute it, print only the agent's last message, and then exit:",command:'amp -x "what file in this folder is in markdown format?"',output:`All Markdown files in this folder:
4816
+ `).filter((W)=>W.length>0),H=new Set,F=Z.map((W)=>{let w=this.createEntryFromPath(Dl1(Q,W),{size:0,mtime:new Date,isDirectory:!1,isFile:!0,isSymlink:!1}),I=W;while(I!==""&&I!==".")if(I=OW2(I),I&&I!=="."&&!H.has(I))H.add(I);return w}),E=Array.from(H).map((W)=>{return this.createEntryFromPath(Dl1(Q,W),{size:0,mtime:new Date,isDirectory:!0,isFile:!1,isSymlink:!1})}),M=[...F,...E];z(M)}catch(Z){G(Z)}}),X.on("error",(q)=>{G(q)})})}async scanWithNodeJS(A,Q){if(Q.signal?.aborted)throw new Error("Scan aborted");let B=[],J={scannedFiles:0,scannedDirectories:0,skippedPaths:0};return await this.scanDirectoryRecursive(A,A,0,Q,B,J),{entries:B,skippedPaths:J.skippedPaths}}async scanDirectoryRecursive(A,Q,B,J,D,z){if(J.signal?.aborted)throw new Error("Scan aborted");if(B>J.maxDepth)return;if(D.length>=J.maxFiles)return;let G=OEA(Q,A);if(J.respectIgnorePatterns&&G){if(SG.shouldIgnore(G,!0)){z.skippedPaths++;return}}let X;try{X=await VEA.readdir(A,{withFileTypes:!0})}catch(K){if(K instanceof Error){if("code"in K&&(K.code==="EACCES"||K.code==="EPERM")){z.skippedPaths++;return}if("code"in K&&K.code==="ENOENT")return}throw K}for(let K of X){if(J.signal?.aborted)throw new Error("Scan aborted");if(D.length>=J.maxFiles)break;let Y=Dl1(A,K.name),q=OEA(Q,Y);if(J.respectIgnorePatterns){if(SG.shouldIgnore(q,K.isDirectory())){z.skippedPaths++;continue}}try{let Z;if(K.isDirectory())Z=this.createEntryFromPath(Y,{size:0,mtime:new Date,isDirectory:!0,isFile:!1,isSymlink:!1}),z.scannedDirectories++;else{let H=await VEA.stat(Y);Z=this.createEntryFromPath(Y,{size:H.size,mtime:H.mtime,isDirectory:!1,isFile:!0,isSymlink:H.isSymbolicLink()}),z.scannedFiles++}if(D.push(Z),J.onProgress&&D.length%100===0)J.onProgress({scannedFiles:z.scannedFiles,scannedDirectories:z.scannedDirectories,currentPath:Y});if(K.isDirectory())await this.scanDirectoryRecursive(Y,Q,B+1,J,D,z)}catch(Z){if(Z instanceof Error){if("code"in Z&&(Z.code==="EACCES"||Z.code==="EPERM"||Z.code==="ENOENT")){z.skippedPaths++;continue}}N1.warn("Error processing file",{error:Z}),z.skippedPaths++}}}createEntryFromPath(A,Q){let B;if(Q.isDirectory)B="directory";else B="file";let J={size:Q.size,mtime:Q.mtime.getTime(),isSymlink:Q.isSymlink},D=A,z=C6.file(A);return new EV({id:D,kind:B,path:A,uri:z,metadata:J})}}var LW2={minScore:400,caseSensitive:!1,penalizeLengthDifference:!0,maxResults:50,smartCase:!0},wz={EXACT_FILENAME:1000,SEGMENT_ORDERED_EXACT:950,PREFIX_FILENAME:900,SUFFIX_FILENAME:850,SEGMENT_ORDERED_PARTIAL:840,SUBSTRING_FILENAME:800,SEGMENT_EXACT:650,SEGMENT_SUBSTRING:600,PATH_SUBSTRING:500,FUZZY:250};class CEA{config;queryChars;queryLower;constructor(A,Q={}){this.config={...LW2,...Q};let B=A.replace(/^[@#]+/,"");if(this.queryChars=Array.from(B),this.queryLower=Array.from(B.toLowerCase()),this.config.smartCase)this.config.caseSensitive=B!==B.toLowerCase()}match(A){if(this.queryChars.length===0)return A.filter((B)=>B.shouldIncludeInResults()).sort((B,J)=>J.getImportanceBoost()-B.getImportanceBoost()).slice(0,this.config.maxResults).map((B)=>({entry:B,score:B.getImportanceBoost(),matchPositions:[],highlightedPath:B.path}));let Q=this.matchWithSemanticScoring(A);if(Q.length>0)return Q;return this.matchWithFuzzyScoring(A)}matchWithSemanticScoring(A){let Q=[],B=0,J=this.queryChars.join(""),D=this.queryChars[0],G=this.queryChars.length===1&&D!==void 0&&/[a-z]/i.test(D)?1e4:20000;for(let X of A){if(!X.shouldIncludeInResults())continue;if(J.length>5&&!this.passesCharBagFilter(J,X))continue;let K=this.matchEntrySemantic(X);if(K&&K.score>=this.config.minScore)Q.push(K);if(B++,Q.length>=this.config.maxResults*5||B>=G)break}return Q.sort((X,K)=>{let Y=K.score-X.score;if(Math.abs(Y)>0.001)return Y;return X.entry.path.length-K.entry.path.length}),Q.slice(0,this.config.maxResults)}matchWithFuzzyScoring(A){let Q=[],B=0,J=this.queryChars.join(""),D=this.queryChars[0],G=this.queryChars.length===1&&D!==void 0&&/[a-z]/i.test(D)?1e4:20000;for(let X of A){if(!X.shouldIncludeInResults())continue;if(J.length>5&&!this.passesCharBagFilter(J,X))continue;let K=this.matchEntryFuzzy(X);if(K)Q.push(K);if(B++,Q.length>=this.config.maxResults*5||B>=G)break}return Q.sort((X,K)=>{let Y=K.score-X.score;if(Math.abs(Y)>0.001)return Y;return X.entry.path.length-K.entry.path.length}),Q.slice(0,this.config.maxResults)}matchEntrySemantic(A){let Q=A.path,B=this.queryLower.join(""),J=this.calculateSemanticScore(B,A);if(J===0)return null;let D=this.applyTieBreakers(J,B,A),z=this.findMatchPositions(B,Q),G=this.createHighlightedPath(Q,z);return{entry:A,score:D,matchPositions:z,highlightedPath:G}}matchEntryFuzzy(A){let Q=A.path,B=this.queryLower.join(""),J=this.calculateFuzzyScore(B,A);if(J===0)return null;let D=this.applyTieBreakers(J,B,A),z=this.findMatchPositions(B,Q),G=this.createHighlightedPath(Q,z);return{entry:A,score:D,matchPositions:z,highlightedPath:G}}calculateSemanticScore(A,Q){let B=A.toLowerCase(),J=Q.path,D=J.toLowerCase(),z=this.getFilename(J),G=this.removeExtension(z).toLowerCase(),X=D.split(/[/.\s-_]/).filter((Z)=>Z.length>0);if(A.endsWith("/")&&Q.isDirectory()){let Z=B.slice(0,-1);if(D===Z||D.endsWith("/"+Z))return wz.EXACT_FILENAME+100;if(D.includes(Z))return wz.SUBSTRING_FILENAME+50}if(G===B||z.toLowerCase()===B)return wz.EXACT_FILENAME;if(G.startsWith(B))return wz.PREFIX_FILENAME;if(G.endsWith(B))return wz.SUFFIX_FILENAME;if(G.includes(B))return wz.SUBSTRING_FILENAME;let K=this.simpleTokens(B);if(K.length>1){let Z=this.matchTokensToSegments(K,X);if(Z)return Z}if(K.length===1&&B.length>6){let Z=this.progressiveSegmentMatch(B,X);if(Z)return Z}if(X.includes(B))return wz.SEGMENT_EXACT;if(X.some((Z)=>Z.includes(B)))return wz.SEGMENT_SUBSTRING;if(X.join("").includes(B))return wz.SEGMENT_SUBSTRING;if(D.replace(/[\s-_]/g,"").includes(B))return wz.PATH_SUBSTRING;return 0}calculateFuzzyScore(A,Q){let B=A.toLowerCase(),J=Q.path.toLowerCase();if(this.fuzzyIn(B,J))return wz.FUZZY;return 0}applyTieBreakers(A,Q,B){let J=A,D=Math.abs(B.path.length-Q.length);J-=0.01*D;let z=B.path.split("/").length-1;J-=0.1*z;let G=this.getFilename(B.path),X=this.removeExtension(G).toLowerCase();if(/^(license|readme|copy(ing|left))$/i.test(X)&&z===1)J-=200;if(B.metadata.mtime){let Y=(Date.now()-B.metadata.mtime)/86400000;if(Y<30){let q=Math.max(0,1-Y/30);J+=50*q}}if(this.config.openFiles?.includes(B.path))J+=300;return J}simpleTokens(A){return A.replace(/([a-z])([A-Z0-9])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}progressiveSegmentMatch(A,Q){let B=0,J=0,D=0;for(let G of Q){if(B>=A.length)break;let X="",K="none";if(B+G.length<=A.length){if(A.slice(B,B+G.length)===G)X=G,K="exact"}if(!X&&G.length>=3){if(A.slice(B).startsWith(G))X=G,K="prefix"}if(!X&&G.length>=3){let Y=A.slice(B);if(Y.includes(G)&&Y.indexOf(G)===0)X=G,K="substring"}if(!X){let Y=A.slice(B);if(Y.length>=3&&G.includes(Y))X=Y,K="substring"}if(X){if(B+=X.length,J++,K==="exact")D++}}if(B/A.length>=0.8&&J>=2)return D>=2?wz.SEGMENT_ORDERED_EXACT:wz.SEGMENT_ORDERED_PARTIAL;return 0}matchTokensToSegments(A,Q){let B=this.findTokenMatches(A,Q),J=this.getWorstMatchType(B);return this.scoreFromMatchType(J)}findTokenMatches(A,Q){let B=0,J=[];for(let D of A){let z=!1;for(let G=B;G<Q.length;G++){let X=Q[G];if(!X)continue;if(D===X){J.push("exact"),B=G+1,z=!0;break}else if(X.startsWith(D)||D.startsWith(X)||X.endsWith(D)||X.includes(D)||D.includes(X)){J.push("partial"),B=G+1,z=!0;break}}if(!z)return[]}return J}getWorstMatchType(A){if(A.length===0)return"none";if(A.includes("partial"))return"partial";return"exact"}scoreFromMatchType(A){switch(A){case"exact":return wz.SEGMENT_ORDERED_EXACT;case"partial":return wz.SEGMENT_ORDERED_PARTIAL;default:return 0}}fuzzyIn(A,Q){let B=0;for(let J=0;J<Q.length&&B<A.length;J++)if(Q[J]===A[B])B++;return B===A.length}getFilename(A){return A.split("/").pop()||A}removeExtension(A){let Q=A.lastIndexOf(".");return Q>0?A.substring(0,Q):A}findMatchPositions(A,Q){let B=[],J=Q.toLowerCase(),D=A.toLowerCase();if(J.includes(D)){let G=J.indexOf(D);for(let X=0;X<D.length;X++)B.push(G+X);return B}let z=0;for(let G of D){let X=J.indexOf(G,z);if(X!==-1)B.push(X),z=X+1}return B}passesCharBagFilter(A,Q){if(A.includes("/")){let B=A.split("/");for(let J of B){if(J.trim()==="")continue;let D=Wz.fromString(J);if(!Q.charBag.hasChars(D))return!1}return!0}else{let B=Wz.fromString(A);return Q.charBag.hasChars(B)}}createHighlightedPath(A,Q){if(Q.length===0)return A;let B="",J=0;for(let D of Q){if(D>=A.length)continue;B+=A.slice(J,D),B+=`**${A[D]}**`,J=D+1}return B+=A.slice(J),B}}function LEA(A,Q,B){return new CEA(A,B).match(Q)}class Br{metadata;entries;entriesByPath;entriesById;constructor(A,Q=[],B,J){if(this.metadata=A,this.entries=Q,B&&J)this.entriesByPath=B,this.entriesById=J;else{let D=new Map,z=new Map;for(let G of Q)D.set(G.path,G),z.set(G.id,G);this.entriesByPath=D,this.entriesById=z}this.cachedArray=Array.from(this.entriesByPath.values()),this.entriesArrayDirty=!1}static create(A){let Q=Date.now();return new Br({id:Q,createdAt:Q,rootPath:A,entryCount:0,scanStatus:"scanning"},[])}static fromEntries(A,Q){let B=Date.now(),J={id:B,createdAt:B,rootPath:A,entryCount:Q.length,scanStatus:"complete"};return new Br(J,Q)}entriesArrayDirty=!1;cachedArray=[];getAllEntries(){if(this.entriesArrayDirty)this.cachedArray=[...this.entriesByPath.values()],this.entriesArrayDirty=!1;return this.cachedArray}getEntryByPath(A){return this.entriesByPath.get(A)??null}getEntryById(A){return this.entriesById.get(A)??null}applyChanges(A){let{added:Q=[],removed:B=[],modified:J=[]}=A;for(let D of B){let z=this.entriesByPath.get(D);if(z){if(this.entriesByPath.delete(D),this.entriesById.delete(z.id),!this.entriesArrayDirty){let G=this.cachedArray.findIndex((X)=>X.path===D);if(G>=0)this.cachedArray.splice(G,1)}}}for(let D of[...Q,...J])if(this.entriesByPath.set(D.path,D),this.entriesById.set(D.id,D),!this.entriesArrayDirty){let z=this.cachedArray.findIndex((G)=>G.path===D.path);if(z>=0)this.cachedArray.splice(z,1);this.cachedArray.unshift(D)}this.metadata.entryCount=this.entriesByPath.size}findEntries(A){return this.entries.filter(A)}getFiles(){return this.findEntries((A)=>A.kind==="file")}getDirectories(){return this.findEntries((A)=>A.kind==="directory")}getInDirectory(A){let Q=A.endsWith("/")?A:A+"/";return this.findEntries((B)=>B.path.startsWith(Q)&&B.path!==A)}hasPath(A){return this.entriesByPath.has(A)}getStats(){let A=this.metadata.entryCount||this.entries.length,Q=this.getFiles().length,B=A-Q,J=A*250;return{totalEntries:A,fileEntries:Q,directoryEntries:B,memoryUsage:J}}}class Gl1 extends RW2{rootPath;currentSnapshot=null;fileWatcher;scanner;isScanning=!1;stats;constructor(A,Q){super();this.rootPath=A;this.fileWatcher=Q??az1(),this.scanner=new zl1,this.stats={totalFiles:0,totalDirectories:0,lastScanDuration:0,lastScanTime:0,memoryUsage:0,status:"idle"},this.fileWatcher.onFileSystemEvent(this.handleFileSystemEvents.bind(this))}async initialize(A){if(this.isScanning)throw new Error("Index is already being initialized");try{await this.performFullScan(A),await this.fileWatcher.watch(this.rootPath)}catch(Q){throw this.updateStatus("error"),Q}}async rescan(A){await this.performFullScan(A)}getCurrentSnapshot(){return this.currentSnapshot}getStats(){return{...this.stats}}search(A,Q={}){if(this.fileWatcher.triggerScan)this.fileWatcher.triggerScan(this.rootPath).catch(()=>{});if(!this.currentSnapshot)return[];let{limit:B=50,minScore:J=0.1,includeDirectories:D=!0,includeIgnored:z=!1}=Q,G=this.currentSnapshot.getAllEntries(),X=A.replace(/[@/]/g,"");if(X.length>2){if(G.some((Z)=>Z.path.includes(X))){let Z=G.find((H)=>H.path.includes(X));N1.debug("Search for existing file",{query:A,matchingFile:Z?.path,entryIndex:G.findIndex((H)=>H===Z)})}}G=G.filter((q)=>{if(!z&&q.isIgnored)return!1;if(!D&&q.isDirectory())return!1;return q.shouldIncludeInMentions()});let K=LEA(A,G,{minScore:J,openFiles:Q.openFiles});return K.sort((q,Z)=>Z.score-q.score),K.slice(0,B)}dispose(){this.fileWatcher.dispose(),this.removeAllListeners()}async performFullScan(A){this.isScanning=!0,this.updateStatus("scanning");let Q=Date.now();try{let B=await this.scanner.scanDirectory(this.rootPath,{respectIgnorePatterns:!0,...A});this.currentSnapshot=Br.fromEntries(this.rootPath,B.entries);let J=Date.now()-Q;this.stats={...this.stats,totalFiles:B.stats.totalFiles,totalDirectories:B.stats.totalDirectories,lastScanDuration:J,lastScanTime:Q,memoryUsage:this.currentSnapshot.getStats().memoryUsage,status:"idle"},this.emit("scan-complete",{entries:B.entries.length,duration:J}),this.emit("status-changed",this.getStats())}catch(B){throw this.updateStatus("error"),this.emit("scan-error",B),B}finally{this.isScanning=!1}}async handleFileSystemEvents(A){if(!this.currentSnapshot||this.isScanning)return;this.updateStatus("updating");try{let Q=[],B=[],J=[];for(let D of A){let z=D.path;switch(D.type){case"deleted":Q.push(z);break;case"created":await this.processCreatedEvent(D,B);break;case"modified":await this.processModifiedEvent(D,J);break;case"renamed":if(D.oldPath)Q.push(D.oldPath);await this.processCreatedEvent(D,B);break}}if(this.currentSnapshot.applyChanges({removed:Q,added:B,modified:J}),Q.length>0||B.length>0||J.length>0)N1.debug("Incremental snapshot update",{removed:Q.length,added:B.length,modified:J.length,totalEntries:this.currentSnapshot.metadata.entryCount,sampleAdded:B.slice(0,3).map((D)=>D.path),sampleRemoved:Q.slice(0,3)});this.stats={...this.stats,memoryUsage:this.currentSnapshot.getStats().memoryUsage,status:"idle"},this.emit("files-updated",{added:B.length,removed:Q.length,modified:J.length}),this.emit("status-changed",this.getStats())}catch(Q){this.updateStatus("error"),this.emit("scan-error",Q)}}async processCreatedEvent(A,Q){let B=A.path;try{let J=A.stat||(A.isDirectory?null:await jW2.lstat(B)),D=A.isDirectory,z=TW2(this.rootPath,B);if(SG.shouldIgnore(z,D))return;if(D)Q.push(new EV({id:B,kind:"directory",path:B,uri:C6.file(B),metadata:{size:0,mtime:Date.now(),isSymlink:!1},isIgnored:!1}));else if(J)Q.push(new EV({id:B,kind:"file",path:B,uri:C6.file(B),metadata:{size:J.size,mtime:J.mtimeMs,isSymlink:J.isSymbolicLink()},isIgnored:!1}))}catch{}}async processModifiedEvent(A,Q){let B=this.currentSnapshot?.getEntryByPath(A.path);if(B){let J=B.withUpdates({metadata:{...B.metadata,mtime:A.timestamp}});Q.push(J)}}updateStatus(A){this.stats={...this.stats,status:A},this.emit("status-changed",this.getStats())}}iA();import{execFile as $W2}from"node:child_process";import{EventEmitter as _W2}from"node:events";import{promises as rz1,watch as PW2}from"node:fs";import{join as hf}from"node:path";import{promisify as SW2}from"node:util";var vW2=SW2($W2);class Xl1 extends _W2{repoRoot;pollInterval;on(A,Q){return super.on(A,Q)}emit(A,...Q){return super.emit(A,...Q)}currentSha;disposed=!1;started=!1;running=!1;pendingForce=!1;watchers=new Set;currentRefWatcher;timer;constructor(A,Q=30000){super();this.repoRoot=A;this.pollInterval=Q;this.repoRoot=this.validateRepoRoot(A)}static async isRepo(A){try{let Q=hf(A,".git");return await rz1.access(Q),!0}catch{try{let Q=hf(A,"HEAD");return await rz1.access(Q),!0}catch{return!1}}}async start(){if(this.disposed)throw new Error("GitHeadWatcher has been disposed");if(this.started)throw new Error("GitHeadWatcher has already been started");this.started=!0,this.currentSha=await this.getCurrentSha(),this.watch(hf(this.repoRoot,".git/HEAD"),async()=>{await this.updateRefWatcher(),this.scheduleCheck()}),await this.updateRefWatcher();let A=hf(this.repoRoot,".git/logs/HEAD");try{await rz1.access(A),this.watch(A,()=>this.scheduleCheck(!0))}catch{}this.timer=setInterval(()=>this.scheduleCheck(),this.pollInterval),N1.debug("GitHeadWatcher started",{repoRoot:this.repoRoot})}stop(){for(let A of Array.from(this.watchers))this.cleanupWatcher(A);if(this.timer)clearInterval(this.timer),this.timer=void 0;this.currentRefWatcher=void 0,this.started=!1,this.running=!1,this.pendingForce=!1}dispose(){if(this.disposed)return;this.stop(),this.disposed=!0,this.removeAllListeners()}watch(A,Q){let B=PW2(A);return B.on("change",Q),B.on("rename",()=>{this.cleanupWatcher(B),setTimeout(()=>{if(!this.disposed)this.watch(A,Q),this.scheduleCheck(!0)},50)}),B.on("error",(J)=>{N1.debug("Git file watcher error",{filePath:A,error:J}),this.cleanupWatcher(B)}),this.watchers.add(B),B}cleanupWatcher(A){try{A.removeAllListeners(),A.close()}catch(Q){N1.debug("Error during watcher cleanup",{error:Q})}this.watchers.delete(A)}async updateRefWatcher(){if(this.currentRefWatcher)this.cleanupWatcher(this.currentRefWatcher),this.currentRefWatcher=void 0;try{let A=await rz1.readFile(hf(this.repoRoot,".git/HEAD"),"utf8");if(!A)return;let Q=A.trim();if(Q.startsWith("ref: ")){let B=Q.slice(5),J=hf(this.repoRoot,".git",B);this.currentRefWatcher=this.watch(J,()=>this.scheduleCheck())}}catch(A){N1.debug("Failed to update ref watcher",{repoRoot:this.repoRoot,error:A})}}scheduleCheck(A=!1){if(this.disposed)return;if(this.pendingForce||=A,this.running)return;this.running=!0,queueMicrotask(async()=>{if(this.disposed)return;let Q=this.pendingForce;this.pendingForce=!1;try{await this.performCheck(Q)}finally{this.running=!1}})}async checkForChanges(A=!1){this.scheduleCheck(A)}async performCheck(A){if(this.disposed)return;try{let Q=await this.getCurrentSha();if(!Q&&this.currentSha){N1.warn("Failed to get current SHA, keeping previous value",{repoRoot:this.repoRoot,previousSha:this.currentSha.slice(0,7)});return}if(Q&&Q!==this.currentSha&&this.currentSha||A){let B=this.currentSha;this.currentSha=Q??this.currentSha,this.emit("head-change",{oldSha:B,newSha:this.currentSha,repoRoot:this.repoRoot,force:A})}else if(Q!==this.currentSha)this.currentSha=Q}catch(Q){N1.warn("Error checking for git HEAD changes",{repoRoot:this.repoRoot,error:Q})}}async getCurrentSha(){try{let{stdout:A}=await vW2("git",["rev-parse","HEAD"],{cwd:this.repoRoot});return A.trim()}catch(A){return}}validateRepoRoot(A){if(!A||typeof A!=="string")throw new Error("Repository root must be a valid string path");if(!A.startsWith("/")&&!A.match(/^[A-Za-z]:\\/))throw new Error("Repository root must be an absolute path");return A}}async function REA(A,Q){if(!await Xl1.isRepo(A))return null;return new Xl1(A,Q?.pollInterval)}class nz1{indexes=new Map;headWatchers=new Map;reindexingWorkspaces=new Set;config;disposed=!1;static forWorkspace(A){return new nz1({workspaceRoots:[A],scanOnStartup:!0,maxIndexedFiles:500000,enableFileWatching:!0,usePollingFallback:!1,enableHeadWatching:!0})}constructor(A){this.config={...A}}async initialize(){if(this.disposed)throw new Error("Service has been disposed");if(this.config.scanOnStartup){let A=this.config.workspaceRoots.map((Q)=>this.indexWorkspace(Q));await Promise.allSettled(A)}}async indexWorkspace(A){if(this.disposed)throw new Error("Service has been disposed");if(this.indexes.has(A)){await this.indexes.get(A).rescan();return}let Q=this.config.enableFileWatching?az1({rootPath:A,usePolling:this.config.usePollingFallback}):void 0,B=new Gl1(A,Q);B.on("scan-error",(D)=>{N1.error("Scan error in workspace",{rootPath:A,error:D})});let J={respectIgnorePatterns:!0,maxFiles:this.config.maxIndexedFiles};try{if(await B.initialize(J),this.indexes.set(A,B),this.config.enableHeadWatching)await this.setupHeadWatching(A,B,Q)}catch(D){B.dispose();let z=this.headWatchers.get(A);if(z)z.dispose(),this.headWatchers.delete(A);throw D}}async removeWorkspace(A){let Q=this.indexes.get(A);if(Q)Q.dispose(),this.indexes.delete(A);let B=this.headWatchers.get(A);if(B)B.dispose(),this.headWatchers.delete(A)}searchAll(A,Q){let B=[];for(let J of this.indexes.values())try{let D=J.search(A,Q);B.push(...D)}catch(D){}return B.sort((J,D)=>D.score-J.score),Q?.limit?B.slice(0,Q.limit):B}searchWorkspace(A,Q,B){let J=this.indexes.get(A);if(!J)return[];try{return J.search(Q,B)}catch(D){return N1.error(`Search error in workspace ${A}:`,D),[]}}getIndexStats(A){if(A){let B=this.indexes.get(A);if(B)return[{...B.getStats(),rootPath:A}];return[]}let Q=[];for(let[B,J]of this.indexes.entries())Q.push({...J.getStats(),rootPath:B});return Q}getConfig(){return{...this.config}}updateConfig(A){this.config={...this.config,...A}}async rescanAll(){let A=[];for(let[Q,B]of this.indexes.entries())A.push(B.rescan().catch((J)=>{N1.error(`Rescan error in workspace ${Q}:`,J)}));await Promise.allSettled(A)}getIndexedWorkspaces(){return Array.from(this.indexes.keys())}isWorkspaceIndexed(A){return this.indexes.has(A)}dispose(){if(this.disposed)return;for(let[,A]of this.indexes.entries())A.dispose();for(let[,A]of this.headWatchers.entries())A.dispose();this.indexes.clear(),this.headWatchers.clear(),this.disposed=!0}isDisposed(){return this.disposed}async setupHeadWatching(A,Q,B){try{let J=await REA(A);if(!J)return;J.on("head-change",async({oldSha:D,newSha:z})=>{if(this.reindexingWorkspaces.has(A)){N1.debug("Re-index already in progress, skipping",{rootPath:A});return}this.reindexingWorkspaces.add(A);try{if(await Q.rescan(),B&&B instanceof xf)await B.reset(A);N1.debug("Re-index completed after HEAD change",{rootPath:A})}catch(G){N1.error("Failed to re-index after change",{rootPath:A,error:G})}finally{this.reindexingWorkspaces.delete(A)}}),await J.start(),this.headWatchers.set(A,J),N1.debug("Git HEAD watching enabled",{rootPath:A})}catch(J){N1.warn("Failed to setup git HEAD watching",{rootPath:A,error:J})}}}function Kl1(A,Q){let B={workspaceRoots:A,scanOnStartup:!0,maxIndexedFiles:500000,enableFileWatching:!0,usePollingFallback:!1,enableHeadWatching:!0,...Q};return new nz1(B)}import kW2 from"node:os";import sz1 from"node:path";class oz1{rootPath;opts;startInBackground;fuzzyService=null;state="unstarted";initPromise=null;constructor(A=process.cwd(),Q={},B=!1){this.rootPath=A;this.opts=Q;this.startInBackground=B;if(B)this.initPromise=this.init(),this.initPromise.then(()=>{N1.debug("Fuzzy service background initialization completed")}).catch((J)=>{N1.debug("Fuzzy service background initialization failed",J)})}async start(){if(this.initPromise)return this.initPromise;return this.initPromise=this.init(),this.initPromise}async init(){if(sz1.resolve(this.rootPath)===sz1.resolve(kW2.homedir())){N1.debug("Skipping fuzzy service initialization for home directory");return}this.state="initializing";try{this.fuzzyService=Kl1([this.rootPath],{scanOnStartup:!0,enableFileWatching:!0,usePollingFallback:!1,...this.opts}),await this.fuzzyService.initialize(),this.state="ready"}catch(A){throw this.state="failed",N1.error("Failed to initialize fuzzy service",A),A}}async query(A,Q=50){if(this.initPromise)try{await this.initPromise}catch(J){return N1.warn("Background fuzzy initialization failed, returning empty results",J),[]}if(!this.fuzzyService)return N1.warn("Fuzzy service not initialized, returning empty results"),[];let B=(J)=>sz1.relative(this.rootPath,J);try{let J=A.trim();return this.fuzzyService.searchAll(J,{limit:Q,minScore:J?0.1:void 0}).map((z)=>B(z.entry.path))}catch(J){return N1.error("Fuzzy search failed",J),[]}}async queryCompletions(A,Q=50){if(this.initPromise)try{await this.initPromise}catch(J){return N1.warn("Background fuzzy initialization failed, returning empty results",J),[]}if(!this.fuzzyService)return N1.warn("Fuzzy service not initialized, returning empty results"),[];let B=(J)=>sz1.relative(this.rootPath,J);try{let J=A.trim();return this.fuzzyService.searchAll(J,{limit:Q,minScore:J?0.1:void 0}).map((z)=>({path:B(z.entry.path),kind:z.entry.isDirectory()?"folder":"file"}))}catch(J){return N1.error("Fuzzy search failed",J),[]}}getStats(){return{state:this.state,stats:this.fuzzyService?.getIndexStats()??[]}}dispose(){if(this.fuzzyService)this.fuzzyService.dispose(),this.fuzzyService=null;this.state="unstarted",this.initPromise=null}}H3();LJ();XW();var hEA={url:{value:"https://ampcode.com",visible:!1,description:"The Amp server URL to connect to"},"anthropic.thinking.enabled":{value:!1,visible:!1,description:"Enable Claude thinking process output for debugging"},"anthropic.interleavedThinking.enabled":{value:!1,visible:!1,description:"Enable interleaved thinking for Claude 4 models (allows reasoning between tool calls)"},"anthropic.temperature":{value:1,visible:!1,description:"Temperature setting for Anthropic models (0.0 = deterministic, 1.0 = creative). Note: Only takes effect when thinking is disabled. Internal use only."},"notifications.enabled":{value:!0,visible:!0,description:"Enable system sound notifications when agent completes tasks"},"notifications.system.enabled":{value:!0,visible:!0,description:"Enable system notifications when terminal is not focused"},"todos.enabled":{value:!0,visible:!1,description:"Enable TODO tracking and management features"},mcpServers:{value:{filesystem:{command:"npx",args:["@modelcontextprotocol/server-filesystem","/path/to/allowed/dir"]}},visible:!0,description:"Model Context Protocol servers to connect to for additional tools"},"tools.disable":{value:["browser_navigate","builtin:edit_file"],visible:!0,description:"Array of tool names to disable. Use 'builtin:toolname' to disable only the builtin tool with that name (allowing an MCP server to provide a tool by that name)."},"tools.inactivityTimeout":{value:300,visible:!1,description:"How many seconds of no output to wait before canceling bash commands"},"tools.stopTimeout":{value:300,visible:!1,description:"Timeout for stopping tools"},cacheDirectory:{value:void 0,visible:!1,description:"Directory to use for caching logs or storing other files"},permissions:{value:[{tool:"Bash",action:"ask",matches:{cmd:["git push*","git commit*"]}}],visible:!0,description:"Permission rules for tool calls. See amp permissions --help"},"guardedFiles.allowlist":{value:[],visible:!0,description:"Array of file glob patterns that are allowed to be accessed without confirmation. Takes precedence over the built-in denylist."},dangerouslyAllowAll:{value:!1,visible:!0,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},submitOnEnter:{value:!0,visible:!1,description:"Whether to submit messages on Enter (true) or require Ctrl+Enter (false)"},"terminal.commands.hide":{value:!1,visible:!1,description:"Hide terminal command output from the user"},"terminal.commands.nodeSpawn.loadProfile":{value:"daily",visible:!1,description:"How often to load shell profile in node-spawn mode (always, daily, never)"},"terminal.commands.nodeSpawn.detachedLogsDirectory":{value:void 0,visible:!1,description:"Directory to store detached logs in node-spawn mode"},"tab.enabled":{value:!0,visible:!1,description:"Enable tab completion features"},"tab.disabledLanguages":{value:[],visible:!1,description:"List of language IDs for which tab completion is disabled"},"tab.disableOnComment":{value:!1,visible:!1,description:"Disable tab completion on comment lines"},"tab.autoImport.enabled":{value:!1,visible:!1,description:"Enable auto-import feature for tab completion"},"tab.experimental.unobtrusiveDiffs":{value:!1,visible:!1,description:"Experimental: Enable unobtrusive diffs mode for tab suggestions to avoid layout shifts"},"tab.experimental.disableClientFilters":{value:[],visible:!1,description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior."},"tab.diagnosticTracking":{value:"same_file",visible:!1,description:'Enable diagnostic tracking for tab suggestions. Values: "disabled" | "same_file" | "multi_file"'},"tab.dimissCommandIds":{value:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],visible:!1,description:"Command IDs to execute when escape key is pressed in modal editors"},"tab.verboseLogs":{value:!1,visible:!1,description:"Enable verbose logging for tab completion"},debugLogs:{value:!1,visible:!1,description:"Enable debug logging output"},"guidanceFiles.specs":{value:!1,visible:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read"},hooks:{value:[],visible:!1,description:"Custom hooks for extending Amp functionality"},"anthropic.provider":{value:"anthropic",visible:!1,description:'Which provider to use for Anthropic Claude inference: "anthropic" or "vertex"'},"experimental.run_javascript.enabled":{value:!1,visible:!1,description:"Whether to enable the experimental run_javascript tool"},"internal.alloy.enabled":{value:!1,visible:!1,description:"Enable experimental alloy mode (switch between Anthropic and OpenAI between turns when safe)."},"experimental.cli.nativeSecretsStorage.enabled":{value:!1,visible:!1,description:"Use native secret storage instead of the plain-text secrets configuration file"},"experimental.reviewTool":{value:!1,visible:!1,description:"Experimental: Enable the summarize_git_diff tool."},"experimental.tools":{value:[],visible:!1,description:"Enable experimental tools by name. Available tools: chat_llm"},"summary.provider":{value:"gemini",visible:!1,description:"Summary provider to use (anthropic or gemini)"},"git.commit.coauthor.enabled":{value:!0,visible:!0,description:"Enable adding Amp as co-author in git commits"},"git.commit.ampThread.enabled":{value:!0,visible:!0,description:"Enable adding Amp-Thread trailer in git commits"},gpt5:{value:!1,visible:!1,description:"Try GPT-5 from OpenAI as the primary agent model. See https://ampcode.com/news/gpt-5."},gpt5ReasoningEffort:{value:"medium",visible:!1,description:"Reasoning effort to use with GPT-5: minimal | low | medium | high"},"jetbrains.skipInstall":{value:!1,visible:!1,description:"Skip JetBrains plugin installation"},proxy:{value:void 0,visible:!0,description:"Proxy URL used for both HTTP and HTTPS requests to the Amp server"}},cW2=Object.fromEntries(Object.entries(hEA).filter(([,A])=>A.visible).map(([A,Q])=>[`amp.${A}`,Q.value])),Jr={examples:[{description:"Start an interactive session:",command:"amp"},{description:"Start an interactive session with a user message:",command:'echo "commit all my unstaged changes" | amp'},{description:"Use execute mode (--execute or -x) to send a command to an agent, have it execute it, print only the agent's last message, and then exit:",command:'amp -x "what file in this folder is in markdown format?"',output:`All Markdown files in this folder:
4817
4817
 
4818
4818
  - README.md (root)
4819
4819
  - AGENT.md (root)
@@ -4913,7 +4913,7 @@ Total: **13 Markdown files** found across the project.
4913
4913
  See ${G0.underline("https://ampcode.com/manual#permissions")} for more details`).enablePositionalOptions();Iw2(Q),Nw2(Q),Vw2(Q),Ow2(Q)}function Iw2(A){A.command("list").summary("List permissions").description("List user-configured permissions.").option("--json","output as JSON").option("--builtin","output only builtin permissions").action(async function(Q,B){let J=B.optsWithGlobals();await AMA({builtinOnly:J.builtin??!1,settingsFile:J.settingsFile,exit:process.exit.bind(process),json:J.json,stdout:process.stdout})})}function Nw2(A){A.command("test").summary("Test permissions").description("Test permissions against configured rules without running the tool.").argument("<tool-name>","Name of the tool to test").option("-c, --context <context>","Execution context (thread or subagent)").option("-t, --thread-id <id>","Thread ID for evaluation").option("--json","output as JSON").option("-q, --quiet","suppress output, only use exit status").allowUnknownOption(!0).action(async function(Q,B,J){let D=J.optsWithGlobals(),z=()=>!1;await QMA({toolName:Q,context:B.context,threadId:B.threadId,json:B.json,settingsFile:D.settingsFile,remainingArgs:J.args,stdout:B.quiet?{write:z}:process.stdout,stderr:process.stderr,exit:process.exit.bind(process)})}).addHelpText("after",["Example: "," # Test permissions of Amp trying to use bash"," amp permissions test Bash --cmd ls"," # ...when running in a subagent"," amp permissions test --context subagent Bash --cmd ls","","See output of:",""," amp tools show","","for all tool schemas."].join(`
4914
4914
  `))}function Vw2(A){A.command("edit").summary("Edit permissions").description("Edit permissions interactively in your $EDITOR or from stdin.").action(async function(Q,B){let J=B.optsWithGlobals();await mf({settingsFile:J.settingsFile,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,exit:process.exit.bind(process),resolveEditor:MV})})}function Ow2(A){A.command("add").summary("Add permission rule").description("Add a permission rule to the beginning of the list. Rules are evaluated in order, so newer rules take precedence.").argument("<action>","Permission action: allow, reject, ask, or delegate").option("--to <program>","Program to delegate decision to for delegate action").option("--context <type>","Limit to specific context (thread or subagent)").argument("<tool>",'Tool name (supports globs like "mcp__playwright__*")').allowUnknownOption(!0).action(async function(Q,B,J,D){let z=D.optsWithGlobals();await sEA({args:D.parent.args.slice(1),settingsFile:z.settingsFile,stderr:process.stderr,exit:process.exit.bind(process)})})}vp1();function Il1(A){let Q=A.match(/\((.)\)/);if(Q)return{hotkey:Q[1].toLowerCase(),hasParens:!0};return{hotkey:A.toLowerCase(),hasParens:!1}}function Cw2(A){let Q=A.some((J)=>J.includes("(")&&J.includes(")")),B=A.every((J)=>J.includes("(")&&J.includes(")"));if(Q){if(!B)throw new Error("All options must have exactly one character in parentheses");for(let z of A){let G=z.match(/\([^)]\)/g);if(!G||G.length!==1)throw new Error("All options must have exactly one character in parentheses")}let J=A.map((z)=>Il1(z).hotkey),D=new Set(J);if(J.length!==D.size)throw new Error("Hotkey characters must be unique")}}function KG1(A,Q,{stdin:B,stdout:J}={stdin:process.stdin,stdout:process.stdout}){return Cw2(Q),new Promise((D)=>{let z=Q.some((q)=>q.includes("(")&&q.includes(")")),G;if(z)G=Q.map((q,Z)=>{if(Z===0)return q.replace(/\((.)\)/,(H,F)=>`(${F.toUpperCase()})`);return q.replace(/\((.)\)/,(H,F)=>`(${F.toLowerCase()})`)}).join("/");else G=Q.map((q,Z)=>Z===0?q.toUpperCase():q.toLowerCase()).join("/");J.write(`${A} ${G} `);function X(q){B.removeListener("data",K),B.removeListener("error",Y),J.write(`
4915
4915
  `),D(q)}function K(q){for(let Z=0;Z<q.length;Z++){if(q[Z]===3){X(null);return}if(JMA($a.CTRL_C,q.subarray(Z))){X(null);return}if(q[Z]===27){if(q.length===1){X(null);return}}if(JMA($a.ESC,q.subarray(Z))){X(null);return}let H=String.fromCharCode(q[Z]).toLowerCase();for(let F of Q){let{hotkey:E,hasParens:M}=Il1(F);if(M){if(E===H){J.write(E),X(E);return}}else if(F.toLowerCase()===H){J.write(F),X(F);return}}if(q[Z]===13||q[Z]===10){let F=Q[0]||"",{hotkey:E,hasParens:M}=Il1(F);if(M)J.write(E),X(E);else J.write(F),X(F);return}}}function Y(q){X(null)}B.on("data",K),B.once("error",Y)})}function JMA(A,Q){if(A.length>Q.length)return!1;return Buffer.from(Uint8Array.prototype.slice.call(Q,0,A.length)).equals(A)}XW();iA();import{readlinkSync as Lw2,fstatSync as Rw2,openSync as jw2}from"node:fs";import DMA from"node:tty";class zr extends Error{cause;constructor(A,Q){super(A);this.cause=Q;this.name="StdinReadError"}}async function Nl1(){let A=jw2("/dev/tty","r");if(!DMA.isatty(A))throw new zr("/dev/tty is not a a TTY device");return new DMA.ReadStream(A)}async function Tw2(A={}){let{maxSizeBytes:Q=1048576,timeoutMs:B=30000}=A;if(process.stdin.isTTY)return{content:"",truncated:!1,timedOut:!1,bytesRead:0};try{if(Rw2(process.stdin.fd).isCharacterDevice()){let D=`/proc/self/fd/${process.stdin.fd}`;try{let z=Lw2(D);if(z==="/dev/zero")return N1.warn("Detected /dev/zero input, returning empty content to avoid infinite read"),{content:"",truncated:!1,timedOut:!1,bytesRead:0};if(z==="/dev/random"||z==="/dev/urandom")throw new zr(`Refusing to read from special device: ${z}. This would cause infinite data consumption.`)}catch{}}}catch{}return new Promise((J,D)=>{let z="",G=0,X=!1,K=!1,Y=null,q=()=>{if(Y)clearTimeout(Y),Y=null;process.stdin.removeAllListeners("data"),process.stdin.removeAllListeners("end"),process.stdin.removeAllListeners("error")},Z=()=>{q(),J({content:z,truncated:X,timedOut:K,bytesRead:G})};Y=setTimeout(()=>{K=!0,Z()},B),process.stdin.once("error",(H)=>{q(),D(new zr("Failed to read from stdin",H))}),process.stdin.once("end",()=>{Z()}),process.stdin.on("data",(H)=>{let F=H.length;if(G+F>Q){let E=Q-G;if(E>0)z+=H.subarray(0,E).toString("utf8"),G=Q;X=!0,Z();return}z+=H.toString("utf8"),G+=F}),process.stdin.resume()})}async function Vl1(){let A=await Tw2();if(A.timedOut)throw new zr("Timeout while reading from stdin");if(A.truncated)N1.warn(`Warning: stdin input was truncated at ${A.bytesRead} bytes`);return A.content}O6();O6();import{Console as $w2}from"node:console";var _w2=(A)=>A.json?Pw2(A):Sw2(A),zMA=(A)=>{if(!A)return"";let Q=A.match(/[.;:\n]/);if(Q)return A.slice(0,Q.index);return A},GMA=(A)=>{if(A==="builtin")return"built-in";if("mcp"in A)return"local-mcp";return A.remote},Pw2=(A)=>(Q)=>{let B=Q.map((D)=>({name:D.spec.name,source:GMA(D.spec.source),description:zMA(D.spec.description)})),J=A.isTTY?JSON.stringify(B,null,2):JSON.stringify(B);A.stdout.write(J)},Sw2=(A)=>(Q)=>{let B=Q.map(({spec:q})=>({name:q.name,source:GMA(q.source),description:zMA(q.description)})),J=new $w2(A.stdout),D=B.filter((q)=>q.source==="built-in"),z=B.filter((q)=>q.source==="local-mcp"),G=B.filter((q)=>!["built-in","local-mcp"].includes(q.source)),X=Math.max(...B.map((q)=>q.name.length)),K=Math.max(...B.map((q)=>q.source.length)),Y=(q)=>J.log(q.name.padEnd(X),q.source.padEnd(K),q.description);D.forEach(Y),z.forEach(Y),G.forEach(Y)};async function XMA(A){let Q=await rA(A.toolService.tools);_w2(A)(Q),A.exit(0)}O6();import{Console as vw2}from"node:console";var kw2=(A)=>A==="builtin"?"built-in":("mcp"in A)?`mcp: ${A.mcp}`:("remote"in A)?`remote: ${A.remote}`:"unknown",fw2=(A)=>A.json?yw2(A):bw2(A),yw2=(A)=>(Q)=>{let B={name:Q.name,description:Q.description??null,inputSchema:Q.inputSchema,source:Q.source},J=A.isTTY?JSON.stringify(B,null,2):JSON.stringify(B);A.stdout.write(J)},bw2=(A)=>(Q)=>{function B(X){return X&&"type"in X&&typeof X.type==="string"}function J(X,K){if(z.log(`${" ".repeat(K)}- ${X.key} (${X.type}): ${X.description??""}`),X.children.length>0)for(let Y of X.children)J(Y,K+1)}function D(X,K){if(!B(K))return null;let Y={key:X,type:K.type,description:K.description,children:[]};if(Y.type==="object")Y.children=Object.entries(K.properties??{}).map(([q,Z])=>D(X?`${X}.${q}`:q,Z)).filter((q)=>!!q);else if(Y.type==="array"&&K.items){if(Y.type=`array of ${K.items.type}`,K.items.type==="object")Y.children=D(null,K.items)?.children||[]}return Y}let z=new vw2(A.stdout);if(z.log(`# ${Q.name} (${kw2(Q.source)})`),z.log(""),Q.description)z.log(Q.description);if(z.log(""),!Q.inputSchema.properties||Object.keys(Q.inputSchema.properties).length===0)return;z.log("# Schema"),z.log("");let G=Object.keys(Q.inputSchema.properties).map((X)=>{let K=Q.inputSchema.properties?Q.inputSchema.properties[X]:void 0;return D(X,K)}).filter((X)=>!!X);for(let X of G)J(X,0)};async function KMA(A){let B=(await rA(A.toolService.tools)).find((z)=>z.spec.name===A.toolName);if(B===void 0){A.stdout.write(`No such tool: ${A.toolName}
4916
- `),A.exit(1);return}let J=B.spec;fw2(A)(J),A.exit(0)}function YMA(A,Q){let B=A.command("tools").description("Tool management commands");return gw2(B,Q),xw2(B,Q),B}function gw2(A,Q){A.command("list").description("List all active tools (including MCP tools)").option("--json","output as a single JSON array").action(async function(B,J){let D=J.optsWithGlobals(),z=await Q(J,D),G=0;await rA(z.mcpService.servers),await XMA({json:D.json,isTTY:z.context.isTTY,toolService:z.toolService,stdout:process.stdout,exit:(X)=>{G=X}}),await z.dispose(),z.cleanupTerminal(),process.exit(G)})}function xw2(A,Q){A.command("show").argument("<tool>","The tool for which to show details").description("Show details about an active tool").option("--json","output as a single JSON object").action(async function(B,J,D){let z=D.optsWithGlobals(),G=await Q(D,z);await rA(G.mcpService.servers);let X=0;await KMA({toolName:B,json:z.json,isTTY:G.context.isTTY,toolService:G.toolService,stdout:process.stdout,exit:(K)=>{X=K}}),await G.dispose(),G.cleanupTerminal(),process.exit(X)})}yw();var VY=WA(p2(),1);iA();var WV=WA(p2(),1);var Gr=WA(p2(),1),YG1=!0;function qMA(){Gr.useEffect(()=>{return process.stderr.write("\x1B[?1004h"),()=>{process.stderr.write("\x1B[?1004l")}},[])}function ZMA(){let A=Gr.useCallback((B)=>{if(B==="\x1B[I")return YG1=!0,!0;if(B==="\x1B[O")return YG1=!1,!0;return!1},[]),Q=Gr.useCallback(()=>YG1,[]);return{tryFocusEvent:A,getFocused:Q}}function UMA(){return YG1}function HG1(){let{isRawModeSupported:A,setRawMode:Q}=Kf();WV.useEffect(()=>{if(A)Q(!0);return process.stderr.write("\x1B[=1u"),process.stderr.write("\x1B[?2004h"),()=>{if(A)Q(!1);process.stderr.write("\x1B[?2004l"),process.stderr.write("\x1B[=0u"),process.stderr.write("\x1B[<u")}},[A,Q])}var hw2=13,mw2=9,uw2=27,pw2=127,cw2=32,lw2=32,dw2=126,iw2=1,WMA=26,wMA=96,aw2=1,rw2=5,nw2=8,sw2=12,ow2=21,tw2=23,ew2=27,AI2=127,HMA=9,Ol1=10,FMA=13,ZG1=1,IMA=2,Kr=4,QI2=8,UG1=16,Xr="\x1B[200~",qG1="\x1B[201~",BI2={57344:"f1",57345:"f2",57346:"f3",57347:"f4",57348:"f5",57349:"f6",57350:"f7",57351:"f8",57352:"f9",57353:"f10",57354:"f11",57355:"f12",57358:"up",57359:"down",57360:"right",57361:"left",57362:"home",57363:"end",57364:"pageup",57365:"pagedown",57366:"insert",57367:"delete"},JI2=["up","down","left","right","pageup","pagedown","home","end","insert","delete","tab","shift-tab","escape","backspace","return"],EMA={A:"up",B:"down",C:"right",D:"left",H:"home",F:"end",Z:"shift-tab"},DI2={1:"home",2:"insert",3:"delete",4:"end",5:"pageup",6:"pagedown",15:"f5",17:"f6",18:"f7",19:"f8",20:"f9",21:"f10",23:"f11",24:"f12"},MMA={P:"f1",Q:"f2",R:"f3",S:"f4"};function zI2(A){let Q=A.match(/^\u001b\[(\d+)(?:;(\d+))?u$/);if(Q&&Q.length>0&&Q[1]){let B=parseInt(Q[1],10),J=Q[2]?parseInt(Q[2],10)-1:0;return{unicode:B,modifiers:J}}else return null}function GI2(A){let Q=A.match(/^\u001b\[([0-9;]*)([\x40-\x7e])$/);if(!Q||Q[1]===void 0||!Q[2])return null;return{params:Q[1]===""?[]:Q[1].split(";").map((J)=>Number.parseInt(J,10)),final:Q[2]}}function XI2(A){let Q=A.match(/^\u001bO([\x40-\x7e])$/);return Q&&Q[1]?Q[1]:null}function KI2(A){if(A.length===2&&A.startsWith("\x1B")){let J=A[1];if(!J||/[O[]/.test(J))return null;let D;if(J==="")D="backspace";else if(J==="\r")D="return";else if(J==="\t")D="tab";else if(J==="b")D="left";else if(J==="f")D="right";else D=J;return{name:D,modifiers:IMA}}let Q=GI2(A);if(Q){let{params:J,final:D}=Q;if(EMA[D]){let z=EMA[D],G=1;if(J.length===2&&J[1]!==void 0)G=J[1];else if(J.length===1&&J[0]!==void 0&&J[0]!==1)G=J[0];return G-=1,{name:z,modifiers:G}}if(D==="~"&&J.length>=1&&J[0]!==void 0){let z=J[0],G=DI2[z];if(G){let X=J.length>=2&&J[1]!==void 0?J[1]-1:0;return{name:G,modifiers:X}}}}let B=XI2(A);if(B&&MMA[B])return{name:MMA[B],modifiers:0};return null}function YI2(A){if(A===hw2)return{name:"return"};if(A===mw2)return{name:"tab"};if(A===uw2)return{name:"escape"};if(A===pw2)return{name:"backspace"};if(A===cw2)return{char:" "};if(A>=iw2&&A<=WMA)return{char:String.fromCharCode(A+wMA)};if(A>=lw2&&A<=dw2)return{char:String.fromCharCode(A)};let Q=BI2[A];if(Q)return{name:Q};return{char:String.fromCharCode(A)}}function Cl1(A,Q,B){let J=!!(B&ZG1),D=!!(B&IMA),z=!!(B&Kr),G=!!(B&QI2),X=!!(B&UG1);return{upArrow:A==="up",downArrow:A==="down",leftArrow:A==="left",rightArrow:A==="right",pageDown:A==="pagedown",pageUp:A==="pageup",return:A==="return",escape:A==="escape",tab:A==="tab"||A==="shift-tab",backspace:A==="backspace",delete:A==="delete",home:A==="home",end:A==="end",insert:A==="insert",ctrl:z,shift:J||A==="shift-tab",alt:D,meta:G,super:X,f1:A==="f1",f2:A==="f2",f3:A==="f3",f4:A==="f4",f5:A==="f5",f6:A==="f6",f7:A==="f7",f8:A==="f8",f9:A==="f9",f10:A==="f10",f11:A==="f11",f12:A==="f12",ctrlC:z&&(Q==="c"||A==="c"),ctrlD:z&&(Q==="d"||A==="d"),ctrlL:z&&(Q==="l"||A==="l"),ctrlZ:z&&(Q==="z"||A==="z")}}function qI2(A){let Q=WV.useRef(""),B=WV.useRef(!1);return{tryBracketedPaste:(J)=>{if(J.includes(Xr)&&J.includes(qG1)){let D=J.indexOf(Xr),z=J.indexOf(qG1);if(D<z){let G=J.slice(D+Xr.length,z);if(G){let X=Cl1(void 0,G,0);A(G,X)}return!0}}if(J.includes(Xr))return B.current=!0,Q.current=J.replace(Xr,""),!0;if(J.includes(qG1)){let D=J.split(qG1);if(Q.current+=D[0]||"",Q.current){let z=Cl1(void 0,Q.current,0);A(Q.current,z)}return B.current=!1,Q.current="",!0}if(B.current)return Q.current+=J,!0;return!1}}}function vG(A,Q){let{internal_eventEmitter:B}=Kf(),J=WV.useRef(A),D=WV.useRef(Q),{tryBracketedPaste:z}=qI2(J.current),{tryFocusEvent:G,getFocused:X}=ZMA();J.current=A,D.current=Q,WV.useEffect(()=>{let K=(Y)=>{let q=Y.toString();if(z(q))return;if(G(q)){if(D.current)D.current(X());return}let Z,H,F=0,E=zI2(q);if(E){let I=YI2(E.unicode);Z=I.name,H=I.char,F=E.modifiers}else{let I=KI2(q);if(I)Z=I.name,F=I.modifiers;else if(q.length===1){let N=q.charCodeAt(0);if(N===aw2)Z="left",F=UG1;else if(N===rw2)Z="right",F=UG1;else if(N===nw2)Z="backspace",F=Kr;else if(N===sw2)H="l",F=Kr;else if(N===ow2)Z="backspace",F=UG1;else if(N===tw2)Z="backspace",F=Kr;else if(N<=WMA&&N!==HMA&&N!==Ol1&&N!==FMA)H=String.fromCharCode(N+wMA),F=Kr;else if(N===AI2)Z="backspace";else if(N===ew2)Z="escape";else if(N===HMA)Z="tab";else if(N===Ol1||N===FMA){if(Z="return",N===Ol1)F=ZG1}else if(H=q,q>="A"&&q<="Z")F=ZG1}else if(q==="\\\r")H="\r",Z="return",F=ZG1;else H=q}let M=Cl1(Z,H,F),W="";if(H)W=H;else if(Z&&!JI2.includes(Z))W=Z;let w=W.replace(L3(),"");if(w!=W)N1.error("unprocessed-input",{input:JSON.stringify(W)});J.current(w,M)};return B.on("input",K),()=>{B.removeListener("input",K)}},[B,z,G,X])}function NMA(A,Q){let B=new Set;return A.filter((J)=>{let D=J[Q];if(B.has(D))return!1;return B.add(D),!0})}var NY=WA(p2(),1);var wV=WA(p2(),1);var ZI2=Symbol.for("react.transitional.element"),UI2=Symbol.for("react.fragment");function VMA(A,Q,B){var J=null;if(B!==void 0&&(J=""+B),Q.key!==void 0&&(J=""+Q.key),"key"in Q){B={};for(var D in Q)D!=="key"&&(B[D]=Q[D])}else B=Q;return Q=B.ref,{$$typeof:ZI2,type:A,key:J,ref:Q!==void 0?Q:null,props:B}}var TZ=UI2,t1=VMA,_A=VMA;function FG1({options:A,selectedIndex:Q,title:B,body:J,borderColor:D,width:z,hideDismissalMessage:G,hideBorder:X}){let K=wV.useRef(null),{stdout:Y}=SX(),[q,Z]=wV.useState(Y.columns);wV.useEffect(()=>{if(K.current){let{width:E}=NR(K.current);Z(E)}},[Y.columns]);let H=q<25,F=wV.useMemo(()=>A.some((E)=>E.description),[A]);if(A.length===0)return null;return _A(y0,{ref:K,width:z,flexDirection:"column",borderColor:X?void 0:D||"dim",borderStyle:X?void 0:"round",paddingX:X?0:1,children:[B&&t1(y0,{marginBottom:1,children:t1(i0,{bold:!0,children:B})}),J&&t1(y0,{marginBottom:1,children:t1(i0,{children:J})}),H?t1(FI2,{options:A,selectedIndex:Q}):F?t1(EI2,{options:A,selectedIndex:Q,effectiveWidth:q}):t1(HI2,{options:A,selectedIndex:Q}),!G&&t1(y0,{marginTop:1,children:t1(i0,{color:"dim",children:"Escape to close"})})]})}function HI2({options:A,selectedIndex:Q}){return t1(y0,{flexDirection:"column",children:A.map((B,J)=>t1(Ll1,{label:B.label,isSelected:J===Q},J))})}function FI2({options:A,selectedIndex:Q}){return t1(y0,{flexDirection:"column",children:A.map((B,J)=>{let D=J===Q;return _A(y0,{flexDirection:"column",children:[t1(Ll1,{label:B.label,isSelected:D}),B.description&&t1(y0,{marginLeft:4,children:t1(OMA,{description:B.description,isSelected:D})})]},J)})})}function EI2({options:A,selectedIndex:Q,effectiveWidth:B}){let J=B-4,D=Math.max(...A.map((Y)=>Y.label.length+3)),z=Math.floor(J*0.8),G=25,X=Math.max(30,J-25),K=Math.min(D,z,X);return t1(y0,{flexDirection:"column",children:A.map((Y,q)=>{let Z=q===Q;return _A(y0,{flexDirection:"row",children:[t1(y0,{width:K,flexShrink:0,children:t1(Ll1,{label:Y.label,isSelected:Z,maxWidth:K})}),t1(y0,{marginLeft:1,children:t1(OMA,{description:Y.description,isSelected:Z})})]},q)})})}function Ll1({label:A,isSelected:Q,maxWidth:B}){return _A(y0,{width:B,flexDirection:"row",children:[t1(i0,{bold:Q,color:Q?"blue":void 0,children:Q?"‣ ":" "}),t1(y0,{flexShrink:1,children:t1(i0,{bold:Q,color:Q?"blue":void 0,wrap:"wrap",children:A})})]})}function OMA({description:A,isSelected:Q}){if(!A)return null;return t1(i0,{color:Q?"blue":"dim",children:A})}function CMA({options:A,onSelect:Q,itemsPerPage:B=10,loader:J,bufferCount:D,customPaginationText:z}){let[G,X]=NY.useState(0),K=NY.useMemo(()=>{if(A.length===0)return 0;return Math.min(G,A.length-1)},[G,A.length]);NY.useEffect(()=>{if(A.length<K+D)J()},[J,D,A.length,K]);let Y=Math.max(1,Math.ceil(A.length/B)),q=Math.floor(K/B),Z=q*B,H=Z+B,F=NY.useMemo(()=>{return A.slice(Z,H)},[A,Z,H]),E=Math.max(0,Math.min(K-Z,F.length-1)),M=NY.useCallback(()=>{if(A.length===0)return;if(K>=A.length-1)X(0);else X(K+1)},[A.length,K]),W=NY.useCallback(()=>{if(K===0)return;X(K-1)},[K]),w=NY.useCallback(()=>{if(q>=Y-1)return!1;let N=(q+1)*B,V=Math.min(N+E,Math.max(0,A.length-1));return X(V),!0},[q,Y,B,E,A.length]),I=NY.useCallback(()=>{if(q<=0)return!1;let N=(q-1)*B,V=Math.max(0,Math.min(B,A.length-N)),L=Math.max(0,Math.min(E,Math.max(0,V-1))),j=N+L;return X(j),!0},[q,B,E,A.length]);if(vG((N,V)=>{if(V.rightArrow){w();return}if(V.leftArrow){I();return}if(V.downArrow||V.ctrl&&N.toLowerCase()==="n"||V.tab&&!V.shift||N.toLowerCase()==="j")M();else if(V.upArrow||V.ctrl&&N.toLowerCase()==="p"||V.shift&&V.tab||N.toLowerCase()==="k")W();else if(V.return&&A[K])Q(A[K].value);else if(V.escape||V.ctrlC)Q(null)}),A.length===0)return null;return _A(y0,{flexDirection:"column",children:[t1(y0,{marginBottom:1,children:t1(i0,{color:"dim",children:z?z(q,Y,Z,H):`Page ${q+1} of ${Y} • ${A.length} items total`})}),t1(FG1,{options:F,selectedIndex:E,hideDismissalMessage:!0,hideBorder:!0}),t1(y0,{marginTop:1,children:t1(i0,{color:"dim",children:"←/→: page • ↑/↓/j/k: line • Enter: select • Esc: quit"})})]})}function EG1({onSelect:A}){HG1();let[Q,B]=VY.useState([]),[J,D]=VY.useState(null),[z,G]=VY.useState(!1),X=VY.useCallback(async()=>{let E=await sJ("/api/user");if(!E.ok){console.error("Failed to get user info:",E.status);return}let M=await E.json();D(M.id)},[]),K=VY.useCallback(async(E=50)=>{if(z)return;if(!J)return;G(!0);try{let M=new URLSearchParams({createdByUserID:J,limit:String(E),offset:String(Q.length)}),W=await sJ(`/api/threads?${M}`);if(!W.ok){console.error("Failed to load more threads:",W.status);return}let w=await W.json();B((I)=>{let N=[...I,...w];return N.sort((V,L)=>L.updatedAt.localeCompare(V.updatedAt)),NMA(N,"id")})}catch(M){console.error("Error loading more threads:",M)}finally{G(!1)}},[J,Q.length,z]);VY.useEffect(()=>{if(J)return;X()},[J,X]);let Y=VY.useCallback((E)=>{let M=E.title||"Untitled",W=new Date(E.updatedAt),w=Z(W),I=H(W),N=`${String(E.messageCount).padStart(3)} messages • ${w} • ${I}`;return{value:E.id,label:M,description:N,updatedAt:E.updatedAt}},[]),q=VY.useMemo(()=>{return Q.filter((E)=>E.messageCount>0).map(Y)},[Q,Y]);function Z(E){let W=new Date().getTime()-E.getTime(),w=Math.floor(W/60000),I=Math.floor(W/3600000),N=Math.floor(W/86400000);if(I<1)return`${w}m`.padStart(3);if(N<1)return`${I}h`.padStart(3);if(N<7)return`${N}d`.padStart(3);return`${Math.floor(N/7)}w`.padStart(3)}function H(E){let W=new Date().getTime()-E.getTime();if(Math.floor(W/86400000)===0)return E.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});else return E.toLocaleDateString("en-US",{month:"short",day:"numeric"})}return _A(y0,{width:"100%",flexDirection:"column",children:[t1(y0,{marginBottom:1,children:t1(i0,{bold:!0,children:"Select a thread to continue:"})}),t1(CMA,{options:q,onSelect:A,itemsPerPage:10,loader:K,bufferCount:50,customPaginationText:(E,M,W)=>{let w=q.slice(M,W);if(w.length===0)return`Page ${E+1}`;let I=w.map((L)=>L.updatedAt).filter(Boolean).map((L)=>new Date(L));if(I.length===0)return`Page ${E+1}`;let N=I.reduce((L,j)=>j<L?j:L),V=Z(N);return`Page ${E+1} - ${V}`}})]})}LJ();var Wd1=WA(p2(),1);iA();NQ();C3();zC();O6();var OD=WA(p2(),1);OG1();var bX=WA(p2(),1);import{createWriteStream as UN2,existsSync as fG1,readdirSync as HN2,readFileSync as FN2}from"node:fs";import{mkdir as EN2,readFile as MN2,rename as WN2,unlink as wN2}from"node:fs/promises";import{homedir as GWA,platform as cl1}from"node:os";import iR from"node:path";import{Readable as IN2}from"node:stream";import{pipeline as NN2}from"node:stream/promises";import Hr from"node:path";import{createWriteStream as DN2,existsSync as zN2,mkdirSync as GN2,readdirSync as XN2,rmSync as KN2}from"node:fs";import{writeFile as YN2}from"node:fs/promises";import{pipeline as qN2}from"node:stream/promises";var xl1=T0("fs"),dI2=T0("zlib"),iI2=eMA(),aI2=BWA(),PG1=T0("util"),SG1=T0("events").EventEmitter,JWA=T0("stream").Transform,ml1=T0("stream").PassThrough,rI2=T0("stream").Writable;var ul1=nI2;function nI2(A,Q,B){if(typeof Q==="function")B=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!0;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(B==null)B=_G1;xl1.open(A,"r",function(J,D){if(J)return B(J);sI2(D,Q,function(z,G){if(z)xl1.close(D,_G1);B(z,G)})})}function sI2(A,Q,B){if(typeof Q==="function")B=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!1;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(B==null)B=_G1;xl1.fstat(A,function(J,D){if(J)return B(J);var z=iI2.createFromFd(A,{autoClose:!0});oI2(z,D.size,Q,B)})}function oI2(A,Q,B,J){if(typeof B==="function")J=B,B=null;if(B==null)B={};if(B.autoClose==null)B.autoClose=!0;if(B.lazyEntries==null)B.lazyEntries=!1;if(B.decodeStrings==null)B.decodeStrings=!0;var D=!!B.decodeStrings;if(B.validateEntrySizes==null)B.validateEntrySizes=!0;if(B.strictFileNames==null)B.strictFileNames=!1;if(J==null)J=_G1;if(typeof Q!=="number")throw new Error("expected totalSize parameter to be a number");if(Q>Number.MAX_SAFE_INTEGER)throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");A.ref();var z=22,G=20,X=65535,K=Math.min(G+z+X,Q),Y=HW(K),q=Q-Y.length;lf(A,Y,0,K,q,function(Z){if(Z)return J(Z);for(var H=K-z;H>=0;H-=1){if(Y.readUInt32LE(H)!==101010256)continue;var F=Y.subarray(H),E=F.readUInt16LE(4),M=F.readUInt16LE(10),W=F.readUInt32LE(16),w=F.readUInt16LE(20),I=F.length-z;if(w!==I)return J(new Error("Invalid comment length. Expected: "+I+". Found: "+w+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var N=D?$G1(F.subarray(22),!1):F.subarray(22);if(H-G>=0&&Y.readUInt32LE(H-G)===117853008){var V=Y.subarray(H-G,H-G+G),L=cf(V,8),j=HW(56);return lf(A,j,0,j.length,L,function(R){if(R)return J(R);if(j.readUInt32LE(0)!==101075792)return J(new Error("invalid zip64 end of central directory record signature"));if(E=j.readUInt32LE(16),E!==0)return J(new Error("multi-disk zip files are not supported: found disk number: "+E));return M=cf(j,32),W=cf(j,48),J(null,new UW(A,W,Q,M,N,B.autoClose,B.lazyEntries,D,B.validateEntrySizes,B.strictFileNames))})}if(E!==0)return J(new Error("multi-disk zip files are not supported: found disk number: "+E));return J(null,new UW(A,W,Q,M,N,B.autoClose,B.lazyEntries,D,B.validateEntrySizes,B.strictFileNames))}J(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}PG1.inherits(UW,SG1);function UW(A,Q,B,J,D,z,G,X,K,Y){var q=this;if(SG1.call(q),q.reader=A,q.reader.on("error",function(Z){DWA(q,Z)}),q.reader.once("close",function(){q.emit("close")}),q.readEntryCursor=Q,q.fileSize=B,q.entryCount=J,q.comment=D,q.entriesRead=0,q.autoClose=!!z,q.lazyEntries=!!G,q.decodeStrings=!!X,q.validateEntrySizes=!!K,q.strictFileNames=!!Y,q.isOpen=!0,q.emittedError=!1,!q.lazyEntries)q._readEntry()}UW.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function dH(A,Q){if(A.autoClose)A.close();DWA(A,Q)}function DWA(A,Q){if(A.emittedError)return;A.emittedError=!0,A.emit("error",Q)}UW.prototype.readEntry=function(){if(!this.lazyEntries)throw new Error("readEntry() called without lazyEntries:true");this._readEntry()};UW.prototype._readEntry=function(){var A=this;if(A.entryCount===A.entriesRead){setImmediate(function(){if(A.autoClose)A.close();if(A.emittedError)return;A.emit("end")});return}if(A.emittedError)return;var Q=HW(46);lf(A.reader,Q,0,Q.length,A.readEntryCursor,function(B){if(B)return dH(A,B);if(A.emittedError)return;var J=new vG1,D=Q.readUInt32LE(0);if(D!==33639248)return dH(A,new Error("invalid central directory file header signature: 0x"+D.toString(16)));if(J.versionMadeBy=Q.readUInt16LE(4),J.versionNeededToExtract=Q.readUInt16LE(6),J.generalPurposeBitFlag=Q.readUInt16LE(8),J.compressionMethod=Q.readUInt16LE(10),J.lastModFileTime=Q.readUInt16LE(12),J.lastModFileDate=Q.readUInt16LE(14),J.crc32=Q.readUInt32LE(16),J.compressedSize=Q.readUInt32LE(20),J.uncompressedSize=Q.readUInt32LE(24),J.fileNameLength=Q.readUInt16LE(28),J.extraFieldLength=Q.readUInt16LE(30),J.fileCommentLength=Q.readUInt16LE(32),J.internalFileAttributes=Q.readUInt16LE(36),J.externalFileAttributes=Q.readUInt32LE(38),J.relativeOffsetOfLocalHeader=Q.readUInt32LE(42),J.generalPurposeBitFlag&64)return dH(A,new Error("strong encryption is not supported"));A.readEntryCursor+=46,Q=HW(J.fileNameLength+J.extraFieldLength+J.fileCommentLength),lf(A.reader,Q,0,Q.length,A.readEntryCursor,function(z){if(z)return dH(A,z);if(A.emittedError)return;J.fileNameRaw=Q.subarray(0,J.fileNameLength);var G=J.fileNameLength+J.extraFieldLength;J.extraFieldRaw=Q.subarray(J.fileNameLength,G),J.fileCommentRaw=Q.subarray(G,G+J.fileCommentLength);try{J.extraFields=BN2(J.extraFieldRaw)}catch(M){return dH(A,M)}if(A.decodeStrings){var X=(J.generalPurposeBitFlag&2048)!==0;J.fileComment=$G1(J.fileCommentRaw,X),J.fileName=AN2(J.generalPurposeBitFlag,J.fileNameRaw,J.extraFields,A.strictFileNames);var K=QN2(J.fileName);if(K!=null)return dH(A,new Error(K))}else J.fileComment=J.fileCommentRaw,J.fileName=J.fileNameRaw;J.comment=J.fileComment,A.readEntryCursor+=Q.length,A.entriesRead+=1;for(var Y=0;Y<J.extraFields.length;Y++){var q=J.extraFields[Y];if(q.id!==1)continue;var Z=q.data,H=0;if(J.uncompressedSize===4294967295){if(H+8>Z.length)return dH(A,new Error("zip64 extended information extra field does not include uncompressed size"));J.uncompressedSize=cf(Z,H),H+=8}if(J.compressedSize===4294967295){if(H+8>Z.length)return dH(A,new Error("zip64 extended information extra field does not include compressed size"));J.compressedSize=cf(Z,H),H+=8}if(J.relativeOffsetOfLocalHeader===4294967295){if(H+8>Z.length)return dH(A,new Error("zip64 extended information extra field does not include relative header offset"));J.relativeOffsetOfLocalHeader=cf(Z,H),H+=8}break}if(A.validateEntrySizes&&J.compressionMethod===0){var F=J.uncompressedSize;if(J.isEncrypted())F+=12;if(J.compressedSize!==F){var E="compressed/uncompressed size mismatch for stored file: "+J.compressedSize+" != "+J.uncompressedSize;return dH(A,new Error(E))}}if(A.emit("entry",J),!A.lazyEntries)A._readEntry()})})};UW.prototype.openReadStream=function(A,Q,B){var J=this,D=0,z=A.compressedSize;if(B==null)B=Q,Q=null;if(Q==null)Q={};else{if(Q.decrypt!=null){if(!A.isEncrypted())throw new Error("options.decrypt can only be specified for encrypted entries");if(Q.decrypt!==!1)throw new Error("invalid options.decrypt value: "+Q.decrypt);if(A.isCompressed()){if(Q.decompress!==!1)throw new Error("entry is encrypted and compressed, and options.decompress !== false")}}if(Q.decompress!=null){if(!A.isCompressed())throw new Error("options.decompress can only be specified for compressed entries");if(!(Q.decompress===!1||Q.decompress===!0))throw new Error("invalid options.decompress value: "+Q.decompress)}if(Q.start!=null||Q.end!=null){if(A.isCompressed()&&Q.decompress!==!1)throw new Error("start/end range not allowed for compressed entry without options.decompress === false");if(A.isEncrypted()&&Q.decrypt!==!1)throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(Q.start!=null){if(D=Q.start,D<0)throw new Error("options.start < 0");if(D>A.compressedSize)throw new Error("options.start > entry.compressedSize")}if(Q.end!=null){if(z=Q.end,z<0)throw new Error("options.end < 0");if(z>A.compressedSize)throw new Error("options.end > entry.compressedSize");if(z<D)throw new Error("options.end < options.start")}}if(!J.isOpen)return B(new Error("closed"));if(A.isEncrypted()){if(Q.decrypt!==!1)return B(new Error("entry is encrypted, and options.decrypt !== false"))}var G;if(A.compressionMethod===0)G=!1;else if(A.compressionMethod===8)G=Q.decompress!=null?Q.decompress:!0;else return B(new Error("unsupported compression method: "+A.compressionMethod));J.readLocalFileHeader(A,{minimal:!0},function(X,K){if(X)return B(X);J.openReadStreamLowLevel(K.fileDataStart,A.compressedSize,D,z,G,A.uncompressedSize,B)})};UW.prototype.openReadStreamLowLevel=function(A,Q,B,J,D,z,G){var X=this,K=A+Q,Y=X.reader.createReadStream({start:A+B,end:A+J}),q=Y;if(D){var Z=!1,H=dI2.createInflateRaw();if(Y.on("error",function(F){setImmediate(function(){if(!Z)H.emit("error",F)})}),Y.pipe(H),X.validateEntrySizes)q=new Ur(z),H.on("error",function(F){setImmediate(function(){if(!Z)q.emit("error",F)})}),H.pipe(q);else q=H;hl1(q,function(){if(Z=!0,H!==q)H.unpipe(q);Y.unpipe(H),Y.destroy()})}G(null,q)};UW.prototype.readLocalFileHeader=function(A,Q,B){var J=this;if(B==null)B=Q,Q=null;if(Q==null)Q={};J.reader.ref();var D=HW(30);lf(J.reader,D,0,D.length,A.relativeOffsetOfLocalHeader,function(z){try{if(z)return B(z);var G=D.readUInt32LE(0);if(G!==67324752)return B(new Error("invalid local file header signature: 0x"+G.toString(16)));var X=D.readUInt16LE(26),K=D.readUInt16LE(28),Y=A.relativeOffsetOfLocalHeader+30+X+K;if(Y+A.compressedSize>J.fileSize)return B(new Error("file data overflows file bounds: "+Y+" + "+A.compressedSize+" > "+J.fileSize));if(Q.minimal)return B(null,{fileDataStart:Y});var q=new tI2;q.fileDataStart=Y,q.versionNeededToExtract=D.readUInt16LE(4),q.generalPurposeBitFlag=D.readUInt16LE(6),q.compressionMethod=D.readUInt16LE(8),q.lastModFileTime=D.readUInt16LE(10),q.lastModFileDate=D.readUInt16LE(12),q.crc32=D.readUInt32LE(14),q.compressedSize=D.readUInt32LE(18),q.uncompressedSize=D.readUInt32LE(22),q.fileNameLength=X,q.extraFieldLength=K,D=HW(X+K),J.reader.ref(),lf(J.reader,D,0,D.length,A.relativeOffsetOfLocalHeader+30,function(Z){try{if(Z)return B(Z);return q.fileName=D.subarray(0,X),q.extraField=D.subarray(X),B(null,q)}finally{J.reader.unref()}})}finally{J.reader.unref()}})};function vG1(){}vG1.prototype.getLastModDate=function(A){if(A==null)A={};if(!A.forceDosFormat)for(var Q=0;Q<this.extraFields.length;Q++){var B=this.extraFields[Q];if(B.id===21589){var J=B.data;if(J.length<5)continue;var D=J[0],z=1;if(!(D&z))continue;var G=J.readInt32LE(1);return new Date(G*1000)}else if(B.id===10){var J=B.data,X=4;while(X<J.length+4){var K=J.readUInt16LE(X);X+=2;var Y=J.readUInt16LE(X);if(X+=2,K!==1){X+=Y;continue}if(Y<8||X+Y>J.length)break;var q=4294967296*J.readInt32LE(X+4)+J.readUInt32LE(X),Z=q/1e4-11644473600000;return new Date(Z)}}}return eI2(this.lastModFileDate,this.lastModFileTime,A.timezone)};vG1.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};vG1.prototype.isCompressed=function(){return this.compressionMethod===8};function tI2(){}function eI2(A,Q,B){var J=A&31,D=(A>>5&15)-1,z=(A>>9&127)+1980,G=0,X=(Q&31)*2,K=Q>>5&63,Y=Q>>11&31;if(B==null||B==="local")return new Date(z,D,J,Y,K,X,G);else if(B==="UTC")return new Date(Date.UTC(z,D,J,Y,K,X,G));else throw new Error("unrecognized options.timezone: "+options.timezone)}function AN2(A,Q,B,J){var D=null;for(var z=0;z<B.length;z++){var G=B[z];if(G.id===28789){if(G.data.length<6)continue;if(G.data.readUInt8(0)!==1)continue;var X=G.data.readUInt32LE(1);if(aI2.unsigned(Q)!==X)continue;D=$G1(G.data.subarray(5),!0);break}}if(D==null){var K=(A&2048)!==0;D=$G1(Q,K)}if(!J)D=D.replace(/\\/g,"/");return D}function QN2(A){if(A.indexOf("\\")!==-1)return"invalid characters in fileName: "+A;if(/^[a-zA-Z]:/.test(A)||/^\//.test(A))return"absolute path: "+A;if(A.split("/").indexOf("..")!==-1)return"invalid relative path: "+A;return null}function BN2(A){var Q=[],B=0;while(B<A.length-3){var J=A.readUInt16LE(B+0),D=A.readUInt16LE(B+2),z=B+4,G=z+D;if(G>A.length)throw new Error("extra field length exceeds extra field buffer size");var X=A.subarray(z,G);Q.push({id:J,data:X}),B=G}return Q}function lf(A,Q,B,J,D,z){if(J===0)return setImmediate(function(){z(null,HW(0))});A.read(Q,B,J,D,function(G,X){if(G)return z(G);if(X<J)return z(new Error("unexpected EOF"));z()})}PG1.inherits(Ur,JWA);function Ur(A){JWA.call(this),this.actualByteCount=0,this.expectedByteCount=A}Ur.prototype._transform=function(A,Q,B){if(this.actualByteCount+=A.length,this.actualByteCount>this.expectedByteCount){var J="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return B(new Error(J))}B(null,A)};Ur.prototype._flush=function(A){if(this.actualByteCount<this.expectedByteCount){var Q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return A(new Error(Q))}A()};PG1.inherits(dR,SG1);function dR(){SG1.call(this),this.refCount=0}dR.prototype.ref=function(){this.refCount+=1};dR.prototype.unref=function(){var A=this;if(A.refCount-=1,A.refCount>0)return;if(A.refCount<0)throw new Error("invalid unref");A.close(Q);function Q(B){if(B)return A.emit("error",B);A.emit("close")}};dR.prototype.createReadStream=function(A){if(A==null)A={};var{start:Q,end:B}=A;if(Q===B){var J=new ml1;return setImmediate(function(){J.end()}),J}var D=this._readStreamForRange(Q,B),z=!1,G=new kG1(this);D.on("error",function(K){setImmediate(function(){if(!z)G.emit("error",K)})}),hl1(G,function(){D.unpipe(G),G.unref(),D.destroy()});var X=new Ur(B-Q);return G.on("error",function(K){setImmediate(function(){if(!z)X.emit("error",K)})}),hl1(X,function(){z=!0,G.unpipe(X),G.destroy()}),D.pipe(G).pipe(X)};dR.prototype._readStreamForRange=function(A,Q){throw new Error("not implemented")};dR.prototype.read=function(A,Q,B,J,D){var z=this.createReadStream({start:J,end:J+B}),G=new rI2,X=0;G._write=function(K,Y,q){K.copy(A,Q+X,0,K.length),X+=K.length,q()},G.on("finish",D),z.on("error",function(K){D(K)}),z.pipe(G)};dR.prototype.close=function(A){setImmediate(A)};PG1.inherits(kG1,ml1);function kG1(A){ml1.call(this),this.context=A,this.context.ref(),this.unreffedYet=!1}kG1.prototype._flush=function(A){this.unref(),A()};kG1.prototype.unref=function(A){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var JN2="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function $G1(A,Q){if(Q)return A.toString("utf8");else{var B="";for(var J=0;J<A.length;J++)B+=JN2[A[J]];return B}}function cf(A,Q){var B=A.readUInt32LE(Q),J=A.readUInt32LE(Q+4);return J*4294967296+B}var HW;if(typeof Buffer.allocUnsafe==="function")HW=function(A){return Buffer.allocUnsafe(A)};else HW=function(A){return new Buffer(A)};function hl1(A,Q){if(typeof A.destroy==="function")A._destroy=function(B,J){if(Q(),J!=null)J(B)};else A.destroy=Q}function _G1(A){if(A)throw A}iA();async function zWA(A,Q,B,J=ZN2){N1.debug("jetbrains-plugin-install",{pluginDirectory:A});let D=Hr.join(A,"lib");if(zN2(D)){let G=XN2(D,{withFileTypes:!0}).filter((X)=>X.name.endsWith(".jar"));N1.info("jetbrains-plugin-install",{libDirectory:D,removableJarFiles:G.map((X)=>X.name)}),G.forEach((X)=>{KN2(Hr.join(X.parentPath,X.name))})}GN2(D,{recursive:!0});let z=Hr.join(A,"version.txt");return await YN2(z,B,"utf8"),J(Q,D)}function ZN2(A,Q){return new Promise((B,J)=>{ul1(A,{lazyEntries:!0},(D,z)=>{if(D)return J(D);if(!z)return J(new Error("Failed to open ZIP file"));z.readEntry(),z.on("entry",(G)=>{if(G.fileName.startsWith("amp-jetbrains-plugin/lib/"))z.openReadStream(G,async(X,K)=>{if(X)return J(X);if(!K)return J(new Error("Failed to open read stream"));let Y=Hr.basename(G.fileName),q=Hr.join(Q,Y);await qN2(K,DN2(q)),z.readEntry()});else z.readEntry()}),z.on("end",B),z.on("error",J)})})}iA();import{createHash as VN2}from"node:crypto";var KWA="amp-jetbrains-plugin",FW="0.91",YWA=`${KWA}-${FW}.zip`,pl1=`https://storage.googleapis.com/amp-public-assets-prod-0/jetbrains/${YWA}`;function ON2(){let A=cl1();return N1.debug("jetbrains-plugin-discovery",{os:A}),["darwin","win32"].includes(A)}async function CN2(A){if(!A?.pluginVersion)return"unknown";return A?.pluginVersion===FW?"uptodate":"outdated"}async function qWA(A){let Q=await CN2(A);if(N1.debug("jetbrains-plugin-discovery",{connectedVersionStatus:Q,ideStatus:A}),Q==="unknown"&&!ON2())return{success:!0,requiresManualInstall:!0,products:[]};else if(Q==="outdated"&&A?.pluginDirectory&&A?.ideName)return{success:!0,products:[{name:A.ideName,version:"",pluginDirectory:A.pluginDirectory,installType:"upgrade",installedVersion:A.pluginVersion}]};else if(Q==="uptodate")return{success:!0,products:[]};let B=RN2();if(N1.debug("jetbrains-plugin-discovery",{discoveryResult:B}),!B.success)return B;let J=B.products.map((D)=>{let z=XWA(D.pluginDirectory);return{...D,installType:z.installType,installedVersion:z.installedVersion}}).filter((D)=>XWA(D.pluginDirectory).needsInstall);return N1.debug("jetbrains-plugin-discovery",{installationTargets:J}),{success:!0,products:J}}async function ZWA(A,Q){let B=await ll1(Q);for(let J of A)try{N1.debug("jetbrains-plugin-install:start",{product:J}),await zWA(J.pluginDirectory,B,FW),N1.debug("jetbrains-plugin-install:complete",{product:J})}catch(D){throw N1.error("jetbrains-plugin-install",{product:J,error:D}),new Error(`Failed to install JetBrains plugin to ${J.name} ${J.version}: ${D}`)}}function yG1(A){let Q=cl1(),B;switch(Q){case"darwin":B=iR.join(GWA(),"Library","Application Support",A);break;case"win32":{let J=process.env.APPDATA||iR.join(GWA(),"AppData","Roaming");B=iR.join(J,A);break}default:throw new Error(`Unsupported operating system: ${Q}`)}return B}function LN2(){let A=["bl","crl","consentOptions","PrivacyPolicy","Toolbox","Chrome","Google","RLZ"];return[yG1("JetBrains"),yG1("Google")].map((Q)=>{if(!fG1(Q))return[];return HN2(Q,{withFileTypes:!0})}).flatMap((Q)=>Q).filter((Q)=>{if(!Q.isDirectory())return!1;return!A.find((B)=>Q.name.startsWith(B))})}function RN2(){try{let A=LN2();if(A.length===0)return{success:!1,products:[],helpMessage:"Directory does not exist. Please ensure you have JetBrains IDEs installed."};N1.debug("jetbrains-plugin-discovery",{productDirectories:A});let Q=[];for(let B of A){let{productName:J,version:D}=jN2(B.name);if(["2020","2021","2022","2023","unknown"].find((z)=>D.startsWith(z))){N1.debug("jetbrains-plugin-discovery",{skipped:B.name});continue}Q.push({name:J,version:D,pluginDirectory:iR.join(B.parentPath,B.name,"plugins",KWA)})}return{success:!0,products:Q.sort((B,J)=>{return B.name.localeCompare(J.name)||B.version.localeCompare(J.version)})}}catch(A){N1.error("jetbrains-plugin-discovery",{error:A});let Q=cl1(),J=`Failed to access JetBrains directory at: ${[yG1("JetBrains"),yG1("Google")].join(", ")}
4916
+ `),A.exit(1);return}let J=B.spec;fw2(A)(J),A.exit(0)}function YMA(A,Q){let B=A.command("tools").description("Tool management commands");return gw2(B,Q),xw2(B,Q),B}function gw2(A,Q){A.command("list").description("List all active tools (including MCP tools)").option("--json","output as a single JSON array").action(async function(B,J){let D=J.optsWithGlobals(),z=await Q(J,D),G=0;await rA(z.mcpService.servers),await XMA({json:D.json,isTTY:z.context.isTTY,toolService:z.toolService,stdout:process.stdout,exit:(X)=>{G=X}}),await z.dispose(),z.cleanupTerminal(),process.exit(G)})}function xw2(A,Q){A.command("show").argument("<tool>","The tool for which to show details").description("Show details about an active tool").option("--json","output as a single JSON object").action(async function(B,J,D){let z=D.optsWithGlobals(),G=await Q(D,z);await rA(G.mcpService.servers);let X=0;await KMA({toolName:B,json:z.json,isTTY:G.context.isTTY,toolService:G.toolService,stdout:process.stdout,exit:(K)=>{X=K}}),await G.dispose(),G.cleanupTerminal(),process.exit(X)})}yw();var VY=WA(p2(),1);iA();var WV=WA(p2(),1);var Gr=WA(p2(),1),YG1=!0;function qMA(){Gr.useEffect(()=>{return process.stderr.write("\x1B[?1004h"),()=>{process.stderr.write("\x1B[?1004l")}},[])}function ZMA(){let A=Gr.useCallback((B)=>{if(B==="\x1B[I")return YG1=!0,!0;if(B==="\x1B[O")return YG1=!1,!0;return!1},[]),Q=Gr.useCallback(()=>YG1,[]);return{tryFocusEvent:A,getFocused:Q}}function UMA(){return YG1}function HG1(){let{isRawModeSupported:A,setRawMode:Q}=Kf();WV.useEffect(()=>{if(A)Q(!0);return process.stderr.write("\x1B[=1u"),process.stderr.write("\x1B[?2004h"),()=>{if(A)Q(!1);process.stderr.write("\x1B[?2004l"),process.stderr.write("\x1B[=0u"),process.stderr.write("\x1B[<u")}},[A,Q])}var hw2=13,mw2=9,uw2=27,pw2=127,cw2=32,lw2=32,dw2=126,iw2=1,WMA=26,wMA=96,aw2=1,rw2=5,nw2=8,sw2=12,ow2=21,tw2=23,ew2=27,AI2=127,HMA=9,Ol1=10,FMA=13,ZG1=1,IMA=2,Kr=4,QI2=8,UG1=16,Xr="\x1B[200~",qG1="\x1B[201~",BI2={57344:"f1",57345:"f2",57346:"f3",57347:"f4",57348:"f5",57349:"f6",57350:"f7",57351:"f8",57352:"f9",57353:"f10",57354:"f11",57355:"f12",57358:"up",57359:"down",57360:"right",57361:"left",57362:"home",57363:"end",57364:"pageup",57365:"pagedown",57366:"insert",57367:"delete"},JI2=["up","down","left","right","pageup","pagedown","home","end","insert","delete","tab","shift-tab","escape","backspace","return"],EMA={A:"up",B:"down",C:"right",D:"left",H:"home",F:"end",Z:"shift-tab"},DI2={1:"home",2:"insert",3:"delete",4:"end",5:"pageup",6:"pagedown",15:"f5",17:"f6",18:"f7",19:"f8",20:"f9",21:"f10",23:"f11",24:"f12"},MMA={P:"f1",Q:"f2",R:"f3",S:"f4"};function zI2(A){let Q=A.match(/^\u001b\[(\d+)(?:;(\d+))?u$/);if(Q&&Q.length>0&&Q[1]){let B=parseInt(Q[1],10),J=Q[2]?parseInt(Q[2],10)-1:0;return{unicode:B,modifiers:J}}else return null}function GI2(A){let Q=A.match(/^\u001b\[([0-9;]*)([\x40-\x7e])$/);if(!Q||Q[1]===void 0||!Q[2])return null;return{params:Q[1]===""?[]:Q[1].split(";").map((J)=>Number.parseInt(J,10)),final:Q[2]}}function XI2(A){let Q=A.match(/^\u001bO([\x40-\x7e])$/);return Q&&Q[1]?Q[1]:null}function KI2(A){if(A.length===2&&A.startsWith("\x1B")){let J=A[1];if(!J||/[O[]/.test(J))return null;let D;if(J==="")D="backspace";else if(J==="\r")D="return";else if(J==="\t")D="tab";else if(J==="b")D="left";else if(J==="f")D="right";else D=J;return{name:D,modifiers:IMA}}let Q=GI2(A);if(Q){let{params:J,final:D}=Q;if(EMA[D]){let z=EMA[D],G=1;if(J.length===2&&J[1]!==void 0)G=J[1];else if(J.length===1&&J[0]!==void 0&&J[0]!==1)G=J[0];return G-=1,{name:z,modifiers:G}}if(D==="~"&&J.length>=1&&J[0]!==void 0){let z=J[0],G=DI2[z];if(G){let X=J.length>=2&&J[1]!==void 0?J[1]-1:0;return{name:G,modifiers:X}}}}let B=XI2(A);if(B&&MMA[B])return{name:MMA[B],modifiers:0};return null}function YI2(A){if(A===hw2)return{name:"return"};if(A===mw2)return{name:"tab"};if(A===uw2)return{name:"escape"};if(A===pw2)return{name:"backspace"};if(A===cw2)return{char:" "};if(A>=iw2&&A<=WMA)return{char:String.fromCharCode(A+wMA)};if(A>=lw2&&A<=dw2)return{char:String.fromCharCode(A)};let Q=BI2[A];if(Q)return{name:Q};return{char:String.fromCharCode(A)}}function Cl1(A,Q,B){let J=!!(B&ZG1),D=!!(B&IMA),z=!!(B&Kr),G=!!(B&QI2),X=!!(B&UG1);return{upArrow:A==="up",downArrow:A==="down",leftArrow:A==="left",rightArrow:A==="right",pageDown:A==="pagedown",pageUp:A==="pageup",return:A==="return",escape:A==="escape",tab:A==="tab"||A==="shift-tab",backspace:A==="backspace",delete:A==="delete",home:A==="home",end:A==="end",insert:A==="insert",ctrl:z,shift:J||A==="shift-tab",alt:D,meta:G,super:X,f1:A==="f1",f2:A==="f2",f3:A==="f3",f4:A==="f4",f5:A==="f5",f6:A==="f6",f7:A==="f7",f8:A==="f8",f9:A==="f9",f10:A==="f10",f11:A==="f11",f12:A==="f12",ctrlC:z&&(Q==="c"||A==="c"),ctrlD:z&&(Q==="d"||A==="d"),ctrlL:z&&(Q==="l"||A==="l"),ctrlZ:z&&(Q==="z"||A==="z")}}function qI2(A){let Q=WV.useRef(""),B=WV.useRef(!1);return{tryBracketedPaste:(J)=>{if(J.includes(Xr)&&J.includes(qG1)){let D=J.indexOf(Xr),z=J.indexOf(qG1);if(D<z){let G=J.slice(D+Xr.length,z);if(G){let X=Cl1(void 0,G,0);A(G,X)}return!0}}if(J.includes(Xr))return B.current=!0,Q.current=J.replace(Xr,""),!0;if(J.includes(qG1)){let D=J.split(qG1);if(Q.current+=D[0]||"",Q.current){let z=Cl1(void 0,Q.current,0);A(Q.current,z)}return B.current=!1,Q.current="",!0}if(B.current)return Q.current+=J,!0;return!1}}}function vG(A,Q){let{internal_eventEmitter:B}=Kf(),J=WV.useRef(A),D=WV.useRef(Q),{tryBracketedPaste:z}=qI2(J.current),{tryFocusEvent:G,getFocused:X}=ZMA();J.current=A,D.current=Q,WV.useEffect(()=>{let K=(Y)=>{let q=Y.toString();if(z(q))return;if(G(q)){if(D.current)D.current(X());return}let Z,H,F=0,E=zI2(q);if(E){let I=YI2(E.unicode);Z=I.name,H=I.char,F=E.modifiers}else{let I=KI2(q);if(I)Z=I.name,F=I.modifiers;else if(q.length===1){let N=q.charCodeAt(0);if(N===aw2)Z="left",F=UG1;else if(N===rw2)Z="right",F=UG1;else if(N===nw2)Z="backspace",F=Kr;else if(N===sw2)H="l",F=Kr;else if(N===ow2)Z="backspace",F=UG1;else if(N===tw2)Z="backspace",F=Kr;else if(N<=WMA&&N!==HMA&&N!==Ol1&&N!==FMA)H=String.fromCharCode(N+wMA),F=Kr;else if(N===AI2)Z="backspace";else if(N===ew2)Z="escape";else if(N===HMA)Z="tab";else if(N===Ol1||N===FMA){if(Z="return",N===Ol1)F=ZG1}else if(H=q,q>="A"&&q<="Z")F=ZG1}else if(q==="\\\r")H="\r",Z="return",F=ZG1;else H=q}let M=Cl1(Z,H,F),W="";if(H)W=H;else if(Z&&!JI2.includes(Z))W=Z;let w=W.replace(L3(),"");if(w!=W)N1.error("unprocessed-input",{input:JSON.stringify(W)});J.current(w,M)};return B.on("input",K),()=>{B.removeListener("input",K)}},[B,z,G,X])}function NMA(A,Q){let B=new Set;return A.filter((J)=>{let D=J[Q];if(B.has(D))return!1;return B.add(D),!0})}var NY=WA(p2(),1);var wV=WA(p2(),1);var ZI2=Symbol.for("react.transitional.element"),UI2=Symbol.for("react.fragment");function VMA(A,Q,B){var J=null;if(B!==void 0&&(J=""+B),Q.key!==void 0&&(J=""+Q.key),"key"in Q){B={};for(var D in Q)D!=="key"&&(B[D]=Q[D])}else B=Q;return Q=B.ref,{$$typeof:ZI2,type:A,key:J,ref:Q!==void 0?Q:null,props:B}}var TZ=UI2,t1=VMA,_A=VMA;function FG1({options:A,selectedIndex:Q,title:B,body:J,borderColor:D,width:z,hideDismissalMessage:G,hideBorder:X}){let K=wV.useRef(null),{stdout:Y}=SX(),[q,Z]=wV.useState(Y.columns);wV.useEffect(()=>{if(K.current){let{width:E}=NR(K.current);Z(E)}},[Y.columns]);let H=q<25,F=wV.useMemo(()=>A.some((E)=>E.description),[A]);if(A.length===0)return null;return _A(y0,{ref:K,width:z,flexDirection:"column",borderColor:X?void 0:D||"dim",borderStyle:X?void 0:"round",paddingX:X?0:1,children:[B&&t1(y0,{marginBottom:1,children:t1(i0,{bold:!0,children:B})}),J&&t1(y0,{marginBottom:1,children:t1(i0,{children:J})}),H?t1(FI2,{options:A,selectedIndex:Q}):F?t1(EI2,{options:A,selectedIndex:Q,effectiveWidth:q}):t1(HI2,{options:A,selectedIndex:Q}),!G&&t1(y0,{marginTop:1,children:t1(i0,{color:"dim",children:"Escape to close"})})]})}function HI2({options:A,selectedIndex:Q}){return t1(y0,{flexDirection:"column",children:A.map((B,J)=>t1(Ll1,{label:B.label,isSelected:J===Q},J))})}function FI2({options:A,selectedIndex:Q}){return t1(y0,{flexDirection:"column",children:A.map((B,J)=>{let D=J===Q;return _A(y0,{flexDirection:"column",children:[t1(Ll1,{label:B.label,isSelected:D}),B.description&&t1(y0,{marginLeft:4,children:t1(OMA,{description:B.description,isSelected:D})})]},J)})})}function EI2({options:A,selectedIndex:Q,effectiveWidth:B}){let J=B-4,D=Math.max(...A.map((Y)=>Y.label.length+3)),z=Math.floor(J*0.8),G=25,X=Math.max(30,J-25),K=Math.min(D,z,X);return t1(y0,{flexDirection:"column",children:A.map((Y,q)=>{let Z=q===Q;return _A(y0,{flexDirection:"row",children:[t1(y0,{width:K,flexShrink:0,children:t1(Ll1,{label:Y.label,isSelected:Z,maxWidth:K})}),t1(y0,{marginLeft:1,children:t1(OMA,{description:Y.description,isSelected:Z})})]},q)})})}function Ll1({label:A,isSelected:Q,maxWidth:B}){return _A(y0,{width:B,flexDirection:"row",children:[t1(i0,{bold:Q,color:Q?"blue":void 0,children:Q?"‣ ":" "}),t1(y0,{flexShrink:1,children:t1(i0,{bold:Q,color:Q?"blue":void 0,wrap:"wrap",children:A})})]})}function OMA({description:A,isSelected:Q}){if(!A)return null;return t1(i0,{color:Q?"blue":"dim",children:A})}function CMA({options:A,onSelect:Q,itemsPerPage:B=10,loader:J,bufferCount:D,customPaginationText:z}){let[G,X]=NY.useState(0),K=NY.useMemo(()=>{if(A.length===0)return 0;return Math.min(G,A.length-1)},[G,A.length]);NY.useEffect(()=>{if(A.length<K+D)J()},[J,D,A.length,K]);let Y=Math.max(1,Math.ceil(A.length/B)),q=Math.floor(K/B),Z=q*B,H=Z+B,F=NY.useMemo(()=>{return A.slice(Z,H)},[A,Z,H]),E=Math.max(0,Math.min(K-Z,F.length-1)),M=NY.useCallback(()=>{if(A.length===0)return;if(K>=A.length-1)X(0);else X(K+1)},[A.length,K]),W=NY.useCallback(()=>{if(K===0)return;X(K-1)},[K]),w=NY.useCallback(()=>{if(q>=Y-1)return!1;let N=(q+1)*B,V=Math.min(N+E,Math.max(0,A.length-1));return X(V),!0},[q,Y,B,E,A.length]),I=NY.useCallback(()=>{if(q<=0)return!1;let N=(q-1)*B,V=Math.max(0,Math.min(B,A.length-N)),L=Math.max(0,Math.min(E,Math.max(0,V-1))),j=N+L;return X(j),!0},[q,B,E,A.length]);if(vG((N,V)=>{if(V.rightArrow){w();return}if(V.leftArrow){I();return}if(V.downArrow||V.ctrl&&N.toLowerCase()==="n"||V.tab&&!V.shift||N.toLowerCase()==="j")M();else if(V.upArrow||V.ctrl&&N.toLowerCase()==="p"||V.shift&&V.tab||N.toLowerCase()==="k")W();else if(V.return&&A[K])Q(A[K].value);else if(V.escape||V.ctrlC)Q(null)}),A.length===0)return null;return _A(y0,{flexDirection:"column",children:[t1(y0,{marginBottom:1,children:t1(i0,{color:"dim",children:z?z(q,Y,Z,H):`Page ${q+1} of ${Y} • ${A.length} items total`})}),t1(FG1,{options:F,selectedIndex:E,hideDismissalMessage:!0,hideBorder:!0}),t1(y0,{marginTop:1,children:t1(i0,{color:"dim",children:"←/→: page • ↑/↓/j/k: line • Enter: select • Esc: quit"})})]})}function EG1({onSelect:A}){HG1();let[Q,B]=VY.useState([]),[J,D]=VY.useState(null),[z,G]=VY.useState(!1),X=VY.useCallback(async()=>{let E=await sJ("/api/user");if(!E.ok){console.error("Failed to get user info:",E.status);return}let M=await E.json();D(M.id)},[]),K=VY.useCallback(async(E=50)=>{if(z)return;if(!J)return;G(!0);try{let M=new URLSearchParams({createdByUserID:J,limit:String(E),offset:String(Q.length)}),W=await sJ(`/api/threads?${M}`);if(!W.ok){console.error("Failed to load more threads:",W.status);return}let w=await W.json();B((I)=>{let N=[...I,...w];return N.sort((V,L)=>L.updatedAt.localeCompare(V.updatedAt)),NMA(N,"id")})}catch(M){console.error("Error loading more threads:",M)}finally{G(!1)}},[J,Q.length,z]);VY.useEffect(()=>{if(J)return;X()},[J,X]);let Y=VY.useCallback((E)=>{let M=E.title||"Untitled",W=new Date(E.updatedAt),w=Z(W),I=H(W),N=`${String(E.messageCount).padStart(3)} messages • ${w} • ${I}`;return{value:E.id,label:M,description:N,updatedAt:E.updatedAt}},[]),q=VY.useMemo(()=>{return Q.filter((E)=>E.messageCount>0).map(Y)},[Q,Y]);function Z(E){let W=new Date().getTime()-E.getTime(),w=Math.floor(W/60000),I=Math.floor(W/3600000),N=Math.floor(W/86400000);if(I<1)return`${w}m`.padStart(3);if(N<1)return`${I}h`.padStart(3);if(N<7)return`${N}d`.padStart(3);return`${Math.floor(N/7)}w`.padStart(3)}function H(E){let W=new Date().getTime()-E.getTime();if(Math.floor(W/86400000)===0)return E.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});else return E.toLocaleDateString("en-US",{month:"short",day:"numeric"})}return _A(y0,{width:"100%",flexDirection:"column",children:[t1(y0,{marginBottom:1,children:t1(i0,{bold:!0,children:"Select a thread to continue:"})}),t1(CMA,{options:q,onSelect:A,itemsPerPage:10,loader:K,bufferCount:50,customPaginationText:(E,M,W)=>{let w=q.slice(M,W);if(w.length===0)return`Page ${E+1}`;let I=w.map((L)=>L.updatedAt).filter(Boolean).map((L)=>new Date(L));if(I.length===0)return`Page ${E+1}`;let N=I.reduce((L,j)=>j<L?j:L),V=Z(N);return`Page ${E+1} - ${V}`}})]})}LJ();var Wd1=WA(p2(),1);iA();NQ();C3();zC();O6();var OD=WA(p2(),1);OG1();var bX=WA(p2(),1);import{createWriteStream as UN2,existsSync as fG1,readdirSync as HN2,readFileSync as FN2}from"node:fs";import{mkdir as EN2,readFile as MN2,rename as WN2,unlink as wN2}from"node:fs/promises";import{homedir as GWA,platform as cl1}from"node:os";import iR from"node:path";import{Readable as IN2}from"node:stream";import{pipeline as NN2}from"node:stream/promises";import Hr from"node:path";import{createWriteStream as DN2,existsSync as zN2,mkdirSync as GN2,readdirSync as XN2,rmSync as KN2}from"node:fs";import{writeFile as YN2}from"node:fs/promises";import{pipeline as qN2}from"node:stream/promises";var xl1=T0("fs"),dI2=T0("zlib"),iI2=eMA(),aI2=BWA(),PG1=T0("util"),SG1=T0("events").EventEmitter,JWA=T0("stream").Transform,ml1=T0("stream").PassThrough,rI2=T0("stream").Writable;var ul1=nI2;function nI2(A,Q,B){if(typeof Q==="function")B=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!0;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(B==null)B=_G1;xl1.open(A,"r",function(J,D){if(J)return B(J);sI2(D,Q,function(z,G){if(z)xl1.close(D,_G1);B(z,G)})})}function sI2(A,Q,B){if(typeof Q==="function")B=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!1;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(B==null)B=_G1;xl1.fstat(A,function(J,D){if(J)return B(J);var z=iI2.createFromFd(A,{autoClose:!0});oI2(z,D.size,Q,B)})}function oI2(A,Q,B,J){if(typeof B==="function")J=B,B=null;if(B==null)B={};if(B.autoClose==null)B.autoClose=!0;if(B.lazyEntries==null)B.lazyEntries=!1;if(B.decodeStrings==null)B.decodeStrings=!0;var D=!!B.decodeStrings;if(B.validateEntrySizes==null)B.validateEntrySizes=!0;if(B.strictFileNames==null)B.strictFileNames=!1;if(J==null)J=_G1;if(typeof Q!=="number")throw new Error("expected totalSize parameter to be a number");if(Q>Number.MAX_SAFE_INTEGER)throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");A.ref();var z=22,G=20,X=65535,K=Math.min(G+z+X,Q),Y=HW(K),q=Q-Y.length;lf(A,Y,0,K,q,function(Z){if(Z)return J(Z);for(var H=K-z;H>=0;H-=1){if(Y.readUInt32LE(H)!==101010256)continue;var F=Y.subarray(H),E=F.readUInt16LE(4),M=F.readUInt16LE(10),W=F.readUInt32LE(16),w=F.readUInt16LE(20),I=F.length-z;if(w!==I)return J(new Error("Invalid comment length. Expected: "+I+". Found: "+w+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var N=D?$G1(F.subarray(22),!1):F.subarray(22);if(H-G>=0&&Y.readUInt32LE(H-G)===117853008){var V=Y.subarray(H-G,H-G+G),L=cf(V,8),j=HW(56);return lf(A,j,0,j.length,L,function(R){if(R)return J(R);if(j.readUInt32LE(0)!==101075792)return J(new Error("invalid zip64 end of central directory record signature"));if(E=j.readUInt32LE(16),E!==0)return J(new Error("multi-disk zip files are not supported: found disk number: "+E));return M=cf(j,32),W=cf(j,48),J(null,new UW(A,W,Q,M,N,B.autoClose,B.lazyEntries,D,B.validateEntrySizes,B.strictFileNames))})}if(E!==0)return J(new Error("multi-disk zip files are not supported: found disk number: "+E));return J(null,new UW(A,W,Q,M,N,B.autoClose,B.lazyEntries,D,B.validateEntrySizes,B.strictFileNames))}J(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}PG1.inherits(UW,SG1);function UW(A,Q,B,J,D,z,G,X,K,Y){var q=this;if(SG1.call(q),q.reader=A,q.reader.on("error",function(Z){DWA(q,Z)}),q.reader.once("close",function(){q.emit("close")}),q.readEntryCursor=Q,q.fileSize=B,q.entryCount=J,q.comment=D,q.entriesRead=0,q.autoClose=!!z,q.lazyEntries=!!G,q.decodeStrings=!!X,q.validateEntrySizes=!!K,q.strictFileNames=!!Y,q.isOpen=!0,q.emittedError=!1,!q.lazyEntries)q._readEntry()}UW.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function dH(A,Q){if(A.autoClose)A.close();DWA(A,Q)}function DWA(A,Q){if(A.emittedError)return;A.emittedError=!0,A.emit("error",Q)}UW.prototype.readEntry=function(){if(!this.lazyEntries)throw new Error("readEntry() called without lazyEntries:true");this._readEntry()};UW.prototype._readEntry=function(){var A=this;if(A.entryCount===A.entriesRead){setImmediate(function(){if(A.autoClose)A.close();if(A.emittedError)return;A.emit("end")});return}if(A.emittedError)return;var Q=HW(46);lf(A.reader,Q,0,Q.length,A.readEntryCursor,function(B){if(B)return dH(A,B);if(A.emittedError)return;var J=new vG1,D=Q.readUInt32LE(0);if(D!==33639248)return dH(A,new Error("invalid central directory file header signature: 0x"+D.toString(16)));if(J.versionMadeBy=Q.readUInt16LE(4),J.versionNeededToExtract=Q.readUInt16LE(6),J.generalPurposeBitFlag=Q.readUInt16LE(8),J.compressionMethod=Q.readUInt16LE(10),J.lastModFileTime=Q.readUInt16LE(12),J.lastModFileDate=Q.readUInt16LE(14),J.crc32=Q.readUInt32LE(16),J.compressedSize=Q.readUInt32LE(20),J.uncompressedSize=Q.readUInt32LE(24),J.fileNameLength=Q.readUInt16LE(28),J.extraFieldLength=Q.readUInt16LE(30),J.fileCommentLength=Q.readUInt16LE(32),J.internalFileAttributes=Q.readUInt16LE(36),J.externalFileAttributes=Q.readUInt32LE(38),J.relativeOffsetOfLocalHeader=Q.readUInt32LE(42),J.generalPurposeBitFlag&64)return dH(A,new Error("strong encryption is not supported"));A.readEntryCursor+=46,Q=HW(J.fileNameLength+J.extraFieldLength+J.fileCommentLength),lf(A.reader,Q,0,Q.length,A.readEntryCursor,function(z){if(z)return dH(A,z);if(A.emittedError)return;J.fileNameRaw=Q.subarray(0,J.fileNameLength);var G=J.fileNameLength+J.extraFieldLength;J.extraFieldRaw=Q.subarray(J.fileNameLength,G),J.fileCommentRaw=Q.subarray(G,G+J.fileCommentLength);try{J.extraFields=BN2(J.extraFieldRaw)}catch(M){return dH(A,M)}if(A.decodeStrings){var X=(J.generalPurposeBitFlag&2048)!==0;J.fileComment=$G1(J.fileCommentRaw,X),J.fileName=AN2(J.generalPurposeBitFlag,J.fileNameRaw,J.extraFields,A.strictFileNames);var K=QN2(J.fileName);if(K!=null)return dH(A,new Error(K))}else J.fileComment=J.fileCommentRaw,J.fileName=J.fileNameRaw;J.comment=J.fileComment,A.readEntryCursor+=Q.length,A.entriesRead+=1;for(var Y=0;Y<J.extraFields.length;Y++){var q=J.extraFields[Y];if(q.id!==1)continue;var Z=q.data,H=0;if(J.uncompressedSize===4294967295){if(H+8>Z.length)return dH(A,new Error("zip64 extended information extra field does not include uncompressed size"));J.uncompressedSize=cf(Z,H),H+=8}if(J.compressedSize===4294967295){if(H+8>Z.length)return dH(A,new Error("zip64 extended information extra field does not include compressed size"));J.compressedSize=cf(Z,H),H+=8}if(J.relativeOffsetOfLocalHeader===4294967295){if(H+8>Z.length)return dH(A,new Error("zip64 extended information extra field does not include relative header offset"));J.relativeOffsetOfLocalHeader=cf(Z,H),H+=8}break}if(A.validateEntrySizes&&J.compressionMethod===0){var F=J.uncompressedSize;if(J.isEncrypted())F+=12;if(J.compressedSize!==F){var E="compressed/uncompressed size mismatch for stored file: "+J.compressedSize+" != "+J.uncompressedSize;return dH(A,new Error(E))}}if(A.emit("entry",J),!A.lazyEntries)A._readEntry()})})};UW.prototype.openReadStream=function(A,Q,B){var J=this,D=0,z=A.compressedSize;if(B==null)B=Q,Q=null;if(Q==null)Q={};else{if(Q.decrypt!=null){if(!A.isEncrypted())throw new Error("options.decrypt can only be specified for encrypted entries");if(Q.decrypt!==!1)throw new Error("invalid options.decrypt value: "+Q.decrypt);if(A.isCompressed()){if(Q.decompress!==!1)throw new Error("entry is encrypted and compressed, and options.decompress !== false")}}if(Q.decompress!=null){if(!A.isCompressed())throw new Error("options.decompress can only be specified for compressed entries");if(!(Q.decompress===!1||Q.decompress===!0))throw new Error("invalid options.decompress value: "+Q.decompress)}if(Q.start!=null||Q.end!=null){if(A.isCompressed()&&Q.decompress!==!1)throw new Error("start/end range not allowed for compressed entry without options.decompress === false");if(A.isEncrypted()&&Q.decrypt!==!1)throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(Q.start!=null){if(D=Q.start,D<0)throw new Error("options.start < 0");if(D>A.compressedSize)throw new Error("options.start > entry.compressedSize")}if(Q.end!=null){if(z=Q.end,z<0)throw new Error("options.end < 0");if(z>A.compressedSize)throw new Error("options.end > entry.compressedSize");if(z<D)throw new Error("options.end < options.start")}}if(!J.isOpen)return B(new Error("closed"));if(A.isEncrypted()){if(Q.decrypt!==!1)return B(new Error("entry is encrypted, and options.decrypt !== false"))}var G;if(A.compressionMethod===0)G=!1;else if(A.compressionMethod===8)G=Q.decompress!=null?Q.decompress:!0;else return B(new Error("unsupported compression method: "+A.compressionMethod));J.readLocalFileHeader(A,{minimal:!0},function(X,K){if(X)return B(X);J.openReadStreamLowLevel(K.fileDataStart,A.compressedSize,D,z,G,A.uncompressedSize,B)})};UW.prototype.openReadStreamLowLevel=function(A,Q,B,J,D,z,G){var X=this,K=A+Q,Y=X.reader.createReadStream({start:A+B,end:A+J}),q=Y;if(D){var Z=!1,H=dI2.createInflateRaw();if(Y.on("error",function(F){setImmediate(function(){if(!Z)H.emit("error",F)})}),Y.pipe(H),X.validateEntrySizes)q=new Ur(z),H.on("error",function(F){setImmediate(function(){if(!Z)q.emit("error",F)})}),H.pipe(q);else q=H;hl1(q,function(){if(Z=!0,H!==q)H.unpipe(q);Y.unpipe(H),Y.destroy()})}G(null,q)};UW.prototype.readLocalFileHeader=function(A,Q,B){var J=this;if(B==null)B=Q,Q=null;if(Q==null)Q={};J.reader.ref();var D=HW(30);lf(J.reader,D,0,D.length,A.relativeOffsetOfLocalHeader,function(z){try{if(z)return B(z);var G=D.readUInt32LE(0);if(G!==67324752)return B(new Error("invalid local file header signature: 0x"+G.toString(16)));var X=D.readUInt16LE(26),K=D.readUInt16LE(28),Y=A.relativeOffsetOfLocalHeader+30+X+K;if(Y+A.compressedSize>J.fileSize)return B(new Error("file data overflows file bounds: "+Y+" + "+A.compressedSize+" > "+J.fileSize));if(Q.minimal)return B(null,{fileDataStart:Y});var q=new tI2;q.fileDataStart=Y,q.versionNeededToExtract=D.readUInt16LE(4),q.generalPurposeBitFlag=D.readUInt16LE(6),q.compressionMethod=D.readUInt16LE(8),q.lastModFileTime=D.readUInt16LE(10),q.lastModFileDate=D.readUInt16LE(12),q.crc32=D.readUInt32LE(14),q.compressedSize=D.readUInt32LE(18),q.uncompressedSize=D.readUInt32LE(22),q.fileNameLength=X,q.extraFieldLength=K,D=HW(X+K),J.reader.ref(),lf(J.reader,D,0,D.length,A.relativeOffsetOfLocalHeader+30,function(Z){try{if(Z)return B(Z);return q.fileName=D.subarray(0,X),q.extraField=D.subarray(X),B(null,q)}finally{J.reader.unref()}})}finally{J.reader.unref()}})};function vG1(){}vG1.prototype.getLastModDate=function(A){if(A==null)A={};if(!A.forceDosFormat)for(var Q=0;Q<this.extraFields.length;Q++){var B=this.extraFields[Q];if(B.id===21589){var J=B.data;if(J.length<5)continue;var D=J[0],z=1;if(!(D&z))continue;var G=J.readInt32LE(1);return new Date(G*1000)}else if(B.id===10){var J=B.data,X=4;while(X<J.length+4){var K=J.readUInt16LE(X);X+=2;var Y=J.readUInt16LE(X);if(X+=2,K!==1){X+=Y;continue}if(Y<8||X+Y>J.length)break;var q=4294967296*J.readInt32LE(X+4)+J.readUInt32LE(X),Z=q/1e4-11644473600000;return new Date(Z)}}}return eI2(this.lastModFileDate,this.lastModFileTime,A.timezone)};vG1.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};vG1.prototype.isCompressed=function(){return this.compressionMethod===8};function tI2(){}function eI2(A,Q,B){var J=A&31,D=(A>>5&15)-1,z=(A>>9&127)+1980,G=0,X=(Q&31)*2,K=Q>>5&63,Y=Q>>11&31;if(B==null||B==="local")return new Date(z,D,J,Y,K,X,G);else if(B==="UTC")return new Date(Date.UTC(z,D,J,Y,K,X,G));else throw new Error("unrecognized options.timezone: "+options.timezone)}function AN2(A,Q,B,J){var D=null;for(var z=0;z<B.length;z++){var G=B[z];if(G.id===28789){if(G.data.length<6)continue;if(G.data.readUInt8(0)!==1)continue;var X=G.data.readUInt32LE(1);if(aI2.unsigned(Q)!==X)continue;D=$G1(G.data.subarray(5),!0);break}}if(D==null){var K=(A&2048)!==0;D=$G1(Q,K)}if(!J)D=D.replace(/\\/g,"/");return D}function QN2(A){if(A.indexOf("\\")!==-1)return"invalid characters in fileName: "+A;if(/^[a-zA-Z]:/.test(A)||/^\//.test(A))return"absolute path: "+A;if(A.split("/").indexOf("..")!==-1)return"invalid relative path: "+A;return null}function BN2(A){var Q=[],B=0;while(B<A.length-3){var J=A.readUInt16LE(B+0),D=A.readUInt16LE(B+2),z=B+4,G=z+D;if(G>A.length)throw new Error("extra field length exceeds extra field buffer size");var X=A.subarray(z,G);Q.push({id:J,data:X}),B=G}return Q}function lf(A,Q,B,J,D,z){if(J===0)return setImmediate(function(){z(null,HW(0))});A.read(Q,B,J,D,function(G,X){if(G)return z(G);if(X<J)return z(new Error("unexpected EOF"));z()})}PG1.inherits(Ur,JWA);function Ur(A){JWA.call(this),this.actualByteCount=0,this.expectedByteCount=A}Ur.prototype._transform=function(A,Q,B){if(this.actualByteCount+=A.length,this.actualByteCount>this.expectedByteCount){var J="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return B(new Error(J))}B(null,A)};Ur.prototype._flush=function(A){if(this.actualByteCount<this.expectedByteCount){var Q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return A(new Error(Q))}A()};PG1.inherits(dR,SG1);function dR(){SG1.call(this),this.refCount=0}dR.prototype.ref=function(){this.refCount+=1};dR.prototype.unref=function(){var A=this;if(A.refCount-=1,A.refCount>0)return;if(A.refCount<0)throw new Error("invalid unref");A.close(Q);function Q(B){if(B)return A.emit("error",B);A.emit("close")}};dR.prototype.createReadStream=function(A){if(A==null)A={};var{start:Q,end:B}=A;if(Q===B){var J=new ml1;return setImmediate(function(){J.end()}),J}var D=this._readStreamForRange(Q,B),z=!1,G=new kG1(this);D.on("error",function(K){setImmediate(function(){if(!z)G.emit("error",K)})}),hl1(G,function(){D.unpipe(G),G.unref(),D.destroy()});var X=new Ur(B-Q);return G.on("error",function(K){setImmediate(function(){if(!z)X.emit("error",K)})}),hl1(X,function(){z=!0,G.unpipe(X),G.destroy()}),D.pipe(G).pipe(X)};dR.prototype._readStreamForRange=function(A,Q){throw new Error("not implemented")};dR.prototype.read=function(A,Q,B,J,D){var z=this.createReadStream({start:J,end:J+B}),G=new rI2,X=0;G._write=function(K,Y,q){K.copy(A,Q+X,0,K.length),X+=K.length,q()},G.on("finish",D),z.on("error",function(K){D(K)}),z.pipe(G)};dR.prototype.close=function(A){setImmediate(A)};PG1.inherits(kG1,ml1);function kG1(A){ml1.call(this),this.context=A,this.context.ref(),this.unreffedYet=!1}kG1.prototype._flush=function(A){this.unref(),A()};kG1.prototype.unref=function(A){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var JN2="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function $G1(A,Q){if(Q)return A.toString("utf8");else{var B="";for(var J=0;J<A.length;J++)B+=JN2[A[J]];return B}}function cf(A,Q){var B=A.readUInt32LE(Q),J=A.readUInt32LE(Q+4);return J*4294967296+B}var HW;if(typeof Buffer.allocUnsafe==="function")HW=function(A){return Buffer.allocUnsafe(A)};else HW=function(A){return new Buffer(A)};function hl1(A,Q){if(typeof A.destroy==="function")A._destroy=function(B,J){if(Q(),J!=null)J(B)};else A.destroy=Q}function _G1(A){if(A)throw A}iA();async function zWA(A,Q,B,J=ZN2){N1.debug("jetbrains-plugin-install",{pluginDirectory:A});let D=Hr.join(A,"lib");if(zN2(D)){let G=XN2(D,{withFileTypes:!0}).filter((X)=>X.name.endsWith(".jar"));N1.info("jetbrains-plugin-install",{libDirectory:D,removableJarFiles:G.map((X)=>X.name)}),G.forEach((X)=>{KN2(Hr.join(X.parentPath,X.name))})}GN2(D,{recursive:!0});let z=Hr.join(A,"version.txt");return await YN2(z,B,"utf8"),J(Q,D)}function ZN2(A,Q){return new Promise((B,J)=>{ul1(A,{lazyEntries:!0},(D,z)=>{if(D)return J(D);if(!z)return J(new Error("Failed to open ZIP file"));z.readEntry(),z.on("entry",(G)=>{if(G.fileName.startsWith("amp-jetbrains-plugin/lib/"))z.openReadStream(G,async(X,K)=>{if(X)return J(X);if(!K)return J(new Error("Failed to open read stream"));let Y=Hr.basename(G.fileName),q=Hr.join(Q,Y);await qN2(K,DN2(q)),z.readEntry()});else z.readEntry()}),z.on("end",B),z.on("error",J)})})}iA();import{createHash as VN2}from"node:crypto";var KWA="amp-jetbrains-plugin",FW="0.9.1",YWA=`${KWA}-${FW}.zip`,pl1=`https://storage.googleapis.com/amp-public-assets-prod-0/jetbrains/${YWA}`;function ON2(){let A=cl1();return N1.debug("jetbrains-plugin-discovery",{os:A}),["darwin","win32"].includes(A)}async function CN2(A){if(!A?.pluginVersion)return"unknown";return A?.pluginVersion===FW?"uptodate":"outdated"}async function qWA(A){let Q=await CN2(A);if(N1.debug("jetbrains-plugin-discovery",{connectedVersionStatus:Q,ideStatus:A}),Q==="unknown"&&!ON2())return{success:!0,requiresManualInstall:!0,products:[]};else if(Q==="outdated"&&A?.pluginDirectory&&A?.ideName)return{success:!0,products:[{name:A.ideName,version:"",pluginDirectory:A.pluginDirectory,installType:"upgrade",installedVersion:A.pluginVersion}]};else if(Q==="uptodate")return{success:!0,products:[]};let B=RN2();if(N1.debug("jetbrains-plugin-discovery",{discoveryResult:B}),!B.success)return B;let J=B.products.map((D)=>{let z=XWA(D.pluginDirectory);return{...D,installType:z.installType,installedVersion:z.installedVersion}}).filter((D)=>XWA(D.pluginDirectory).needsInstall);return N1.debug("jetbrains-plugin-discovery",{installationTargets:J}),{success:!0,products:J}}async function ZWA(A,Q){let B=await ll1(Q);for(let J of A)try{N1.debug("jetbrains-plugin-install:start",{product:J}),await zWA(J.pluginDirectory,B,FW),N1.debug("jetbrains-plugin-install:complete",{product:J})}catch(D){throw N1.error("jetbrains-plugin-install",{product:J,error:D}),new Error(`Failed to install JetBrains plugin to ${J.name} ${J.version}: ${D}`)}}function yG1(A){let Q=cl1(),B;switch(Q){case"darwin":B=iR.join(GWA(),"Library","Application Support",A);break;case"win32":{let J=process.env.APPDATA||iR.join(GWA(),"AppData","Roaming");B=iR.join(J,A);break}default:throw new Error(`Unsupported operating system: ${Q}`)}return B}function LN2(){let A=["bl","crl","consentOptions","PrivacyPolicy","Toolbox","Chrome","Google","RLZ"];return[yG1("JetBrains"),yG1("Google")].map((Q)=>{if(!fG1(Q))return[];return HN2(Q,{withFileTypes:!0})}).flatMap((Q)=>Q).filter((Q)=>{if(!Q.isDirectory())return!1;return!A.find((B)=>Q.name.startsWith(B))})}function RN2(){try{let A=LN2();if(A.length===0)return{success:!1,products:[],helpMessage:"Directory does not exist. Please ensure you have JetBrains IDEs installed."};N1.debug("jetbrains-plugin-discovery",{productDirectories:A});let Q=[];for(let B of A){let{productName:J,version:D}=jN2(B.name);if(["2020","2021","2022","2023","unknown"].find((z)=>D.startsWith(z))){N1.debug("jetbrains-plugin-discovery",{skipped:B.name});continue}Q.push({name:J,version:D,pluginDirectory:iR.join(B.parentPath,B.name,"plugins",KWA)})}return{success:!0,products:Q.sort((B,J)=>{return B.name.localeCompare(J.name)||B.version.localeCompare(J.version)})}}catch(A){N1.error("jetbrains-plugin-discovery",{error:A});let Q=cl1(),J=`Failed to access JetBrains directory at: ${[yG1("JetBrains"),yG1("Google")].join(", ")}
4917
4917
  `;if(A instanceof Error&&"code"in A)switch(A.code){case"EACCES":J+="Permission denied. Please check directory permissions.";break;default:J+=`Error: ${A.message}`}else J+=`Error: ${String(A)}`;if(Q==="darwin")J+=`
4918
4918
  On macOS, JetBrains IDEs are typically installed in ~/Library/Application Support/JetBrains/`;else if(Q==="win32")J+=`
4919
4919
  On Windows, check %APPDATA%\\JetBrains\\`;return{success:!1,products:[],error:A instanceof Error?A.message:String(A),helpMessage:J}}}function jN2(A){let Q=A.match(/^(.+?)(\d{4}\.\d+(?:\.\d+)?)$/);if(!Q)return{productName:A,version:"unknown"};let B=Q[1],J=Q[2];if(!B||!J)return{productName:A,version:"unknown"};return{productName:B,version:J}}function XWA(A){let Q=iR.join(A,"version.txt");if(N1.debug("jetbrains-plugin-discovery",{ampPluginDir:A}),!fG1(A))return N1.debug("jetbrains-plugin-discovery",{message:"Plugin directory does not exist",ampPluginDir:A}),{needsInstall:!0,installType:"fresh"};try{if(fG1(Q)){let B=FN2(Q,"utf8").trim(),J=B!==FW;return N1.debug("jetbrains-plugin-discovery",{needsUpdate:J,installedVersion:B,targetVersion:FW}),{needsInstall:J,installType:"upgrade",installedVersion:B}}else return N1.debug("jetbrains-plugin-discovery",{message:"No version file found, plugin needs to be installed"}),{needsInstall:!0,installType:"upgrade"}}catch(B){return N1.error("jetbrains-plugin-discovery",{message:"Error reading version file",versionFilePath:Q,error:B}),{needsInstall:!0,installType:"upgrade"}}}async function TN2(A){if(fG1(A))return A;let Q=3;for(let B=1;B<=Q;B++)try{return await $N2(A),N1.info("jetbrains-plugin-install:downloadSuccess",{path:A}),A}catch(J){let D=J instanceof Error?J.message:String(J);if(B===Q)throw N1.error("jetbrains-plugin-install:downloadError",{error:D}),J;N1.warn("jetbrains-plugin-install:downloadFailed",{attempt:B,MAX_RETRIES:Q,message:D}),await new Promise((z)=>setTimeout(z,500*Math.pow(2,B-1)))}throw new Error("Unexpected end of retry loop")}async function ll1(A){let Q=iR.join(A,"jetbrains-plugins",YWA);return await TN2(Q),Q}async function $N2(A){await EN2(iR.dirname(A),{recursive:!0});let Q=`${pl1}.sha256`,B=await fetch(Q);if(!B.ok)throw N1.error("jetbrains failed to download plugin checksum file",{url:Q,status:B.status,body:await B.text()}),new Error(`failed to download JetBrains plugin checksum: ${B.status} ${B.statusText}`);let J=(await B.text()).trim().split(/\s+/)[0],D=await fetch(pl1);if(!D.ok||!D.body){let G=await D.text();throw N1.error("jetbrains failed to download plugin file",{url:pl1,status:B.status,body:G}),new Error(`failed to download JetBrains plugin: ${D.status} ${D.statusText}
@@ -5030,7 +5030,7 @@ allow ${z}${G?` ${G}`:""}`}let J={stdin:process.stdin,stdout:process.stdout,stde
5030
5030
  ${H}`;if(B==="pnpm"&&H.includes("Unable to find the global bin directory"))F+=`
5031
5031
 
5032
5032
  Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
5033
- npm install -g @sourcegraph/amp`;G(new Error(F))}},error:(Z)=>{if(!Y)Y=!0,G(new Error(`Failed to spawn ${B}: ${Z.message}`))},complete:()=>{if(!Y)Y=!0,z()}})})}var Ja1=Qa1.join(u00||Qa1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function Fj(A,Q){let B={};if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")B.dangerouslyAllowAll=Q.dangerouslyAllowAll;if(A.getOptionValueSourceWithGlobals("tryGpt5")==="cli")B.gpt5=Q.tryGpt5;return B}var tC2=T6.union([T6.object({command:T6.string(),args:T6.array(T6.string()).optional(),env:T6.record(T6.string(),T6.string()).optional()}).strict(),T6.object({url:T6.string()}).strict()]),eC2=T6.record(T6.string(),tC2);async function Da1(A){try{await nC2(Qa1.dirname(Ja1),{recursive:!0}),await sC2(Ja1,A,"utf-8")}catch(Q){N1.debug("Failed to save last thread ID",Q)}}async function AL2(){try{return(await rVA(Ja1,"utf-8")).trim()}catch(A){return null}}async function QL2(A){let Q;try{Q=JSON.parse(A)}catch(B){throw new Error(`Failed to parse --mcp-config as JSON: ${B instanceof Error?B.message:String(B)}`)}try{return eC2.parse(Q)}catch(B){if(B instanceof T6.ZodError){let J=B.issues.map((D)=>`${D.path.join(".")}: ${D.message}`).join(", ");throw new Error(`Invalid MCP server configuration: ${J}`)}throw new Error(`Failed to validate MCP server configuration: ${String(B)}`)}}function BL2(A,Q){return{...A,async get(B){if(B==="mcpServers"){let J=await A.get(B)||{},D={};if(typeof J==="object")for(let[z,G]of Object.entries(J))D[z]={...G,_target:"global"};for(let[z,G]of Object.entries(Q))D[z]={...G,_target:"workspace"};return D}return A.get(B)},async keys(){let B=await A.keys();if(!B.includes("mcpServers"))B.push("mcpServers");return B},[Symbol.dispose](){A[Symbol.dispose]()}}}async function JL2(A){let Q=await sJ(`/api/threads/${A}`);if(!Q.ok){let B=await Q.text();if(Q.status===404||B.includes("not found"))throw new cB(vX.threadNotFound(A));throw new cB(`Failed to load thread ${A}`,1,`Use 'amp threads share ${A} --support' to share this with the Amp team if this persists.`)}return await Q.json()}var lVA=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(A)=>`${A?"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??fX,description:`Custom settings file path (overrides the default location ${fX})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(N1).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:"Set log file location"},{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:cR(),description:(A)=>A?"Enable JetBrains integration. You must start Amp in the same directory as your JetBrains project. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration.",hidden:!0},{name:"interactive",long:"interactive",type:"flag",description:(A)=>A?"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:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"Try GPT-5 as the primary agent model (limited time; see https://ampcode.com/news/gpt-5)"}],dVA=(A)=>("deprecated"in A)&&A.deprecated===!0,DL2=(A)=>("hidden"in A)&&A.hidden===!0,zL2=(A)=>("default"in A),GL2=(A)=>("default"in A)?A.default:void 0;function XL2(A,Q){let B=Q.args[0],J=Q.commands.map((z)=>z.name());if(B&&!B.includes(" ")&&B.length<30&&!/[./\\]/.test(B)){let z=J.filter((X)=>B.includes(X)||X.includes(B)),G="Run amp --help for a list of available commands.";if(z.length>0)G=`Did you mean: ${z.join(", ")}? Or run amp --help for all commands.`;throw new cB(vX.unknownCommand(B),1,G)}}function iX1(A){return{...A,getThreadEnvironment:XJA,createFileSystem:()=>vh,createFileChangeTrackerForThread:(Q)=>{let B=new kh(vh);return uD0(B,vh,Q)},generateThreadTitle:eA1,internalAPIClient:FK}}var za1=C6.file(oC2.homedir()),nVA=process.env.XDG_CONFIG_HOME?C6.file(process.env.XDG_CONFIG_HOME):$6.joinPath(za1,".config");async function Ej(A,Q,B,J=!1){Wt1("0.0.1755676925-g804c7f"),wt1(Q.jetbrains);let D=lZ1({storage:A.settings,secretStorage:A.secrets,workspaceRoots:GA.of([C6.file(process.cwd())]),defaultAmpURL:A.ampURL,defaultCacheDirectory:Pp1,settingsOverrides:B,homeDir:za1,userConfigDir:nVA}),z=await rA(h2);N1.debug("Global configuration initialized",{hasCacheDirectory:!!z.settings.cacheDirectory,settingsKeys:Object.keys(z.settings)});let G=Y11(ps()),X=w40({configService:D,toolService:G});if(process.env.AMP_TOOLBOX)ZD0(G,vh,Y01);try{await X.initialized}catch(V){N1.warn("Failed to wait for MCP servers, continuing anyway:",V)}if(Q.jetbrains){process.env.JB_DIAGNOSTICS="true";try{N1.debug("ide-client",{terminalEmulator:process.env.TERMINAL_EMULATOR}),await zK.start()}catch(V){let L=V instanceof Error?V.message:String(V);LD(`Failed to connect to JetBrains IDE: ${L}`)}}let K=z.settings["experimental.reviewTool"]??!1,Y=z.settings["experimental.tools"]??[],q=!!process.env.JB_DIAGNOSTICS;e2A(G,!1,K,Y,q);let Z;if(!A.executeMode)Z=new oz1(process.cwd(),{},!0);else Z=new class extends oz1{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await A.secrets.get("apiKey",A.ampURL)){if(P4.write(`No API key found. Starting login flow...
5033
+ npm install -g @sourcegraph/amp`;G(new Error(F))}},error:(Z)=>{if(!Y)Y=!0,G(new Error(`Failed to spawn ${B}: ${Z.message}`))},complete:()=>{if(!Y)Y=!0,z()}})})}var Ja1=Qa1.join(u00||Qa1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function Fj(A,Q){let B={};if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")B.dangerouslyAllowAll=Q.dangerouslyAllowAll;if(A.getOptionValueSourceWithGlobals("tryGpt5")==="cli")B.gpt5=Q.tryGpt5;return B}var tC2=T6.union([T6.object({command:T6.string(),args:T6.array(T6.string()).optional(),env:T6.record(T6.string(),T6.string()).optional()}).strict(),T6.object({url:T6.string()}).strict()]),eC2=T6.record(T6.string(),tC2);async function Da1(A){try{await nC2(Qa1.dirname(Ja1),{recursive:!0}),await sC2(Ja1,A,"utf-8")}catch(Q){N1.debug("Failed to save last thread ID",Q)}}async function AL2(){try{return(await rVA(Ja1,"utf-8")).trim()}catch(A){return null}}async function QL2(A){let Q;try{Q=JSON.parse(A)}catch(B){throw new Error(`Failed to parse --mcp-config as JSON: ${B instanceof Error?B.message:String(B)}`)}try{return eC2.parse(Q)}catch(B){if(B instanceof T6.ZodError){let J=B.issues.map((D)=>`${D.path.join(".")}: ${D.message}`).join(", ");throw new Error(`Invalid MCP server configuration: ${J}`)}throw new Error(`Failed to validate MCP server configuration: ${String(B)}`)}}function BL2(A,Q){return{...A,async get(B){if(B==="mcpServers"){let J=await A.get(B)||{},D={};if(typeof J==="object")for(let[z,G]of Object.entries(J))D[z]={...G,_target:"global"};for(let[z,G]of Object.entries(Q))D[z]={...G,_target:"workspace"};return D}return A.get(B)},async keys(){let B=await A.keys();if(!B.includes("mcpServers"))B.push("mcpServers");return B},[Symbol.dispose](){A[Symbol.dispose]()}}}async function JL2(A){let Q=await sJ(`/api/threads/${A}`);if(!Q.ok){let B=await Q.text();if(Q.status===404||B.includes("not found"))throw new cB(vX.threadNotFound(A));throw new cB(`Failed to load thread ${A}`,1,`Use 'amp threads share ${A} --support' to share this with the Amp team if this persists.`)}return await Q.json()}var lVA=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(A)=>`${A?"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??fX,description:`Custom settings file path (overrides the default location ${fX})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(N1).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:"Set log file location"},{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:cR(),description:(A)=>A?"Enable JetBrains integration. You must start Amp in the same directory as your JetBrains project. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration.",hidden:!0},{name:"interactive",long:"interactive",type:"flag",description:(A)=>A?"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:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"Try GPT-5 as the primary agent model (limited time; see https://ampcode.com/news/gpt-5)"}],dVA=(A)=>("deprecated"in A)&&A.deprecated===!0,DL2=(A)=>("hidden"in A)&&A.hidden===!0,zL2=(A)=>("default"in A),GL2=(A)=>("default"in A)?A.default:void 0;function XL2(A,Q){let B=Q.args[0],J=Q.commands.map((z)=>z.name());if(B&&!B.includes(" ")&&B.length<30&&!/[./\\]/.test(B)){let z=J.filter((X)=>B.includes(X)||X.includes(B)),G="Run amp --help for a list of available commands.";if(z.length>0)G=`Did you mean: ${z.join(", ")}? Or run amp --help for all commands.`;throw new cB(vX.unknownCommand(B),1,G)}}function iX1(A){return{...A,getThreadEnvironment:XJA,createFileSystem:()=>vh,createFileChangeTrackerForThread:(Q)=>{let B=new kh(vh);return uD0(B,vh,Q)},generateThreadTitle:eA1,internalAPIClient:FK}}var za1=C6.file(oC2.homedir()),nVA=process.env.XDG_CONFIG_HOME?C6.file(process.env.XDG_CONFIG_HOME):$6.joinPath(za1,".config");async function Ej(A,Q,B,J=!1){Wt1("0.0.1755681161-gdd8c23"),wt1(Q.jetbrains);let D=lZ1({storage:A.settings,secretStorage:A.secrets,workspaceRoots:GA.of([C6.file(process.cwd())]),defaultAmpURL:A.ampURL,defaultCacheDirectory:Pp1,settingsOverrides:B,homeDir:za1,userConfigDir:nVA}),z=await rA(h2);N1.debug("Global configuration initialized",{hasCacheDirectory:!!z.settings.cacheDirectory,settingsKeys:Object.keys(z.settings)});let G=Y11(ps()),X=w40({configService:D,toolService:G});if(process.env.AMP_TOOLBOX)ZD0(G,vh,Y01);try{await X.initialized}catch(V){N1.warn("Failed to wait for MCP servers, continuing anyway:",V)}if(Q.jetbrains){process.env.JB_DIAGNOSTICS="true";try{N1.debug("ide-client",{terminalEmulator:process.env.TERMINAL_EMULATOR}),await zK.start()}catch(V){let L=V instanceof Error?V.message:String(V);LD(`Failed to connect to JetBrains IDE: ${L}`)}}let K=z.settings["experimental.reviewTool"]??!1,Y=z.settings["experimental.tools"]??[],q=!!process.env.JB_DIAGNOSTICS;e2A(G,!1,K,Y,q);let Z;if(!A.executeMode)Z=new oz1(process.cwd(),{},!0);else Z=new class extends oz1{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await A.secrets.get("apiKey",A.ampURL)){if(P4.write(`No API key found. Starting login flow...
5034
5034
  `),!await KL2(A))process.exit(1)}let H=OD0(),F=new qN1(H),E=new XN1(H),M=new CO1(F),W=Q.notifications!==void 0?Q.notifications:!A.executeMode,w=Q8A({playNotificationSound:async(V)=>{if(W){if(A8A(V),!(J?jl1():UMA())&&z.settings["notifications.system.enabled"]!==!1){if(V==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(V==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:F});N1.info("Starting Amp background services");let I=dF0({threadService:F,threadHistoryService:E,isExtensionDevelopment:!1}),N={configService:D,toolService:G,mcpService:X,threadService:F,threadHistoryService:E,threadSummaryService:M,threadSyncService:I,threadStorage:H,secretStorage:A.secrets,settingsStorage:A.settings,fuzzyServer:Z,notificationService:w};return{...N,async dispose(){await N.mcpService.dispose(),N.configService.unsubscribe(),N.toolService.dispose(),N.fuzzyServer.dispose(),N.threadSyncService.dispose(),N.settingsStorage[Symbol.dispose]()}}}async function KL2(A){if(!A.executeMode){if(await KG1("Would you like to log in to Amp?",["(y)es","(n)o"])!="y")return P4.write(`Login cancelled. Run the command again to retry.
5035
5035
  `),!1}return await sVA(A)}async function sVA(A){let Q=rC2(32).toString("hex"),B=await dEA(A.ampURL,Q);P4.write(`If your browser doesn't open automatically, visit:
5036
5036
 
@@ -5044,7 +5044,7 @@ ${G0.blue.bold(B)}
5044
5044
  Login successful! You can now use the Amp CLI.
5045
5045
  `),!0}catch(J){return Q7.write(`
5046
5046
  Login failed: ${J instanceof Error?J.message:String(J)}
5047
- `),!1}}function YL2(A){let Q=A.outputHelp.bind(A);A.outputHelp=function(B){let J="",D=this.configureOutput();if(this.configureOutput({writeOut:(z)=>{J+=z},writeErr:(z)=>{J+=z}}),typeof B==="function")B(J);else Q(B);this.configureOutput(D),nEA(J)}}function oVA(A){YL2(A);for(let Q of A.commands)oVA(Q)}function qL2(){let A=new PJ1().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, team)").configureOutput({writeErr:()=>{}});A.exitOverride((X)=>{if(X.code==="commander.help"||X.code==="commander.version"||X.exitCode===0)Nf(),process.exit(0);let K=X.originalError??X;_a(K)}),A.option("-V, --version","output the version number",()=>{P4.write(`0.0.1755676925-g804c7f (released 2025-08-20T08:07:10.760Z)
5047
+ `),!1}}function YL2(A){let Q=A.outputHelp.bind(A);A.outputHelp=function(B){let J="",D=this.configureOutput();if(this.configureOutput({writeOut:(z)=>{J+=z},writeErr:(z)=>{J+=z}}),typeof B==="function")B(J);else Q(B);this.configureOutput(D),nEA(J)}}function oVA(A){YL2(A);for(let Q of A.commands)oVA(Q)}function qL2(){let A=new PJ1().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, team)").configureOutput({writeErr:()=>{}});A.exitOverride((X)=>{if(X.code==="commander.help"||X.code==="commander.version"||X.exitCode===0)Nf(),process.exit(0);let K=X.originalError??X;_a(K)}),A.option("-V, --version","output the version number",()=>{P4.write(`0.0.1755681161-gdd8c23 (released 2025-08-20T09:18:19.617Z)
5048
5048
  `),process.exit(0)}),A.addHelpText("after",uEA()),A.configureHelp({formatHelp:pEA}),A.command("logout").description("Log out by removing stored API key").action(async(X,K)=>{let Y=K.optsWithGlobals(),q=await yZ(Y);await FL2(q)}),A.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(X,K)=>{let Y=K.optsWithGlobals(),q=await yZ(Y);await HL2(q)});let Q=A.command("threads").alias("t").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(X,K)=>{let Y=K.optsWithGlobals(),q=await yZ(Y);await aVA(Y,q,K)});Q.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, team)").action(async(X,K)=>{let Y=K.optsWithGlobals(),q=await yZ(Y);await NL2(Y,q,K)}),Q.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(X,K,Y)=>{let q=Y.optsWithGlobals(),Z=await yZ(q);if(K.pick){lZ1({storage:Z.settings,secretStorage:Z.secrets,workspaceRoots:GA.of([C6.file(process.cwd())]),defaultAmpURL:Z.ampURL,homeDir:za1,userConfigDir:nVA});let H=await VL2();if(H)await iVA(q,Z,H,Y);else process.exit(0)}else await iVA(q,Z,X,Y)}),Q.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(X,K,Y)=>{let q=Y.optsWithGlobals(),Z=await yZ(q);await IL2(q,Z,X,Y)}),Q.command("list").alias("l").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(X,K)=>{let Y=K.optsWithGlobals(),q=await yZ(Y);await aVA(Y,q,K)}),Q.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, team) 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, team)").option("--support","Share thread with Amp support for debugging").action(async(X,K,Y)=>{let q=Y.optsWithGlobals(),Z=await yZ(q);await wL2(q,Z,X,Y,K.support)}),Q.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(X,K,Y)=>{let q=Y.optsWithGlobals(),Z=await yZ(q);await WL2(q,Z,X,Y)}),YMA(A,async(X,K)=>{let Y=await yZ(K),q=Fj(X,K),Z=await Ej(Y,K,q,!1);return{context:Y,mcpService:Z.mcpService,toolService:Z.toolService,cleanupTerminal:Nf,dispose:Z.dispose.bind(Z)}}),BMA(A);function B(X,K,Y){let Z=typeof X.description==="string"?X.description:Y===void 0?X.description(!0):X.description(Y),H=new SJ1(K,Z),F=GL2(X);if(F)H.default(F);return H.hidden=DL2(X)||dVA(X),H}for(let X of lVA)switch(X.type){case"flag":{A.addOption(B(X,`--${X.long}`)),A.addOption(B(X,`--no-${X.long}`,!1));break}case"switch":{A.addOption(B(X,`--${X.long}`,!0));break}default:{A.addOption(B(X,`--${X.long} <value>`));break}}let J=new SJ1("-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);A.addOption(J);let D=new SJ1("--tui","Launch experimental TUI interface").hideHelp();A.addOption(D),A.action(async(X,K)=>{let Y=X,q=await yZ(Y);if(Object.keys(Y).forEach((Z)=>{if(Z==="format"&&X.format==="jsonl"){Q7.write(G0.yellow(`jsonl format is deprecated. Version "0.0.1753194394-g45962a" is required to use jsonl format.
5049
5049
  `));return}let H=lVA.find((F)=>F.name===Z);if(H&&dVA(H)&&!zL2(H))Q7.write(G0.yellow(`Warning: '--${Z}' flag is deprecated
5050
5050
  `))}),K.args.length>0)XL2(q,K);await tVA(q,Y,K)});let z=new PJ1("doctor").summary("Generate support bundle").description("Generate a support bundle for troubleshooting issues. This collects logs, configuration, and system information into a file that can be shared with Amp support for debugging.").option("--output-dir <path>","Directory to save the support bundle",process.cwd()).option("--include-full-logs","Include full log history",!1).allowUnknownOption(!1).action(async(X)=>{await ML2(X.outputDir,X.includeFullLogs)});A.addCommand(z);let G=new PJ1("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await EL2(X.version)});return A.addCommand(G),oVA(A),A}async function dX1(A,Q,B){let{thread:J,visibility:D}=B,z=J?.id??kF(),G=iX1(Q);if(J)await Q.threadStorage.set(z,J);let X=await aD.getOrCreateForThread(G,z);if(D)await Q.threadSyncService.updateThreadMeta(z,JG1(D));let K=Q.threadService.observe(z).subscribe(async(q)=>{if(VQ(q,"assistant"))await Da1(z),K.unsubscribe()});await X.resume();let Y=await rA(h2);if(wO0(X.thread))await WO0(X.thread);return X}async function tVA(A,Q,B){let J=process.stdin,D=BG1(Q);if(D instanceof Error)LD(D.message);let z,G=null;if(typeof Q.execute==="string"){z=Q.execute;let W=(await Vl1()).trimEnd();if(W)G=W}else z=(await Vl1()).trimEnd();if(A.executeMode&&z==="")throw new cB("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp -x "your message"
@@ -5064,7 +5064,7 @@ Or pipe via stdin: echo "your message" | amp -x`);if(z!==""&&!A.executeMode&&typ
5064
5064
  `);process.exit(0)}async function EL2(A){try{if(A)Q7.write(G0.blue(`Updating to version ${A}...
5065
5065
  `)),await Id1(A),Q7.write(G0.green(`✓ Successfully updated to version ${A}
5066
5066
  `));else{Q7.write(G0.blue(`Checking for updates...
5067
- `));let Q=await E01("0.0.1755676925-g804c7f");if(!Q.hasUpdate)Q7.write(G0.green(`✓ Amp CLI is already up to date.
5067
+ `));let Q=await E01("0.0.1755681161-gdd8c23");if(!Q.hasUpdate)Q7.write(G0.green(`✓ Amp CLI is already up to date.
5068
5068
  `)),process.exit(0);Q7.write(G0.blue(`Updating to version ${Q.latestVersion}...
5069
5069
  `)),await Id1(Q.latestVersion),Q7.write(G0.green(`✓ Successfully updated to version ${Q.latestVersion}
5070
5070
  `))}process.exit(0)}catch(Q){LD(Q instanceof Error?Q.message:String(Q))}}async function ML2(A,Q){try{Q7.write(G0.green("Generating Amp support bundle...")+`