@sourcegraph/amp 0.0.1779081543-gea23bb → 0.0.1779083535-g196e66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +11 -11
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -213,7 +213,7 @@ ${J}
|
|
|
213
213
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Z of A.seen.entries()){let F=Z[1];if(Q===Z[0]){Y(Z);continue}if(A.external){let D=A.external.registry.get(Z[0])?.id;if(Q!==Z[0]&&D){Y(Z);continue}}if(A.metadataRegistry.get(Z[0])?.id){Y(Z);continue}if(F.cycle){Y(Z);continue}if(F.count>1){if(A.reused==="ref"){Y(Z);continue}}}}function IH(A,Q){let B=A.seen.get(Q);if(!B)throw Error("Unprocessed schema. This is a bug in Zod.");let $=(Z)=>{let F=A.seen.get(Z);if(F.ref===null)return;let X=F.def??F.schema,D={...X},G=F.ref;if(F.ref=null,G){$(G);let U=A.seen.get(G),K=U.schema;if(K.$ref&&(A.target==="draft-07"||A.target==="draft-04"||A.target==="openapi-3.0"))X.allOf=X.allOf??[],X.allOf.push(K);else Object.assign(X,K);if(Object.assign(X,D),Z._zod.parent===G)for(let z in X){if(z==="$ref"||z==="allOf")continue;if(!(z in D))delete X[z]}if(K.$ref&&U.def)for(let z in X){if(z==="$ref"||z==="allOf")continue;if(z in U.def&&JSON.stringify(X[z])===JSON.stringify(U.def[z]))delete X[z]}}let V=Z._zod.parent;if(V&&V!==G){$(V);let U=A.seen.get(V);if(U?.schema.$ref){if(X.$ref=U.schema.$ref,U.def)for(let K in X){if(K==="$ref"||K==="allOf")continue;if(K in U.def&&JSON.stringify(X[K])===JSON.stringify(U.def[K]))delete X[K]}}}A.override({zodSchema:Z,jsonSchema:X,path:F.path??[]})};for(let Z of[...A.seen.entries()].reverse())$(Z[0]);let J={};if(A.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if(A.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if(A.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if(A.target==="openapi-3.0");if(A.external?.uri){let Z=A.external.registry.get(Q)?.id;if(!Z)throw Error("Schema is missing an `id` property");J.$id=A.external.uri(Z)}Object.assign(J,B.def??B.schema);let Y=A.external?.defs??{};for(let Z of A.seen.entries()){let F=Z[1];if(F.def&&F.defId)Y[F.defId]=F.def}if(A.external);else if(Object.keys(Y).length>0)if(A.target==="draft-2020-12")J.$defs=Y;else J.definitions=Y;try{let Z=JSON.parse(JSON.stringify(J));return Object.defineProperty(Z,"~standard",{value:{...Q["~standard"],jsonSchema:{input:AT(Q,"input",A.processors),output:AT(Q,"output",A.processors)}},enumerable:!1,writable:!1}),Z}catch(Z){throw Error("Error converting schema to JSON.")}}function qB(A,Q){let B=Q??{seen:new Set};if(B.seen.has(A))return!1;B.seen.add(A);let $=A._zod.def;if($.type==="transform")return!0;if($.type==="array")return qB($.element,B);if($.type==="set")return qB($.valueType,B);if($.type==="lazy")return qB($.getter(),B);if($.type==="promise"||$.type==="optional"||$.type==="nonoptional"||$.type==="nullable"||$.type==="readonly"||$.type==="default"||$.type==="prefault")return qB($.innerType,B);if($.type==="intersection")return qB($.left,B)||qB($.right,B);if($.type==="record"||$.type==="map")return qB($.keyType,B)||qB($.valueType,B);if($.type==="pipe")return qB($.in,B)||qB($.out,B);if($.type==="object"){for(let J in $.shape)if(qB($.shape[J],B))return!0;return!1}if($.type==="union"){for(let J of $.options)if(qB(J,B))return!0;return!1}if($.type==="tuple"){for(let J of $.items)if(qB(J,B))return!0;if($.rest&&qB($.rest,B))return!0;return!1}return!1}var jP0=(A,Q={})=>(B)=>{let $=qH({...B,processors:Q});return r5(A,$),NH($,A),IH($,A)},AT=(A,Q,B={})=>($)=>{let{libraryOptions:J,target:Y}=$??{},Z=qH({...J??{},target:Y,io:Q,processors:B});return r5(A,Z),NH(Z,A),IH(Z,A)};var Jm=o(()=>{Qm()});function j60(A,Q){if("_idmap"in A){let $=A,J=qH({...Q,processors:M60}),Y={};for(let X of $._idmap.entries()){let[D,G]=X;r5(G,J)}let Z={},F={registry:$,uri:Q?.uri,defs:Y};J.external=F;for(let X of $._idmap.entries()){let[D,G]=X;NH(J,G),Z[D]=IH(J,G)}if(Object.keys(Y).length>0){let X=J.target==="draft-2020-12"?"$defs":"definitions";Z.__shared={[X]:Y}}return{schemas:Z}}let B=qH({...Q,processors:M60});return r5(A,B),NH(B,A),IH(B,A)}var S56,RP0=(A,Q,B,$)=>{let J=B;J.type="string";let{minimum:Y,maximum:Z,format:F,patterns:X,contentEncoding:D}=A._zod.bag;if(typeof Y==="number")J.minLength=Y;if(typeof Z==="number")J.maxLength=Z;if(F){if(J.format=S56[F]??F,J.format==="")delete J.format;if(F==="time")delete J.format}if(D)J.contentEncoding=D;if(X&&X.size>0){let G=[...X];if(G.length===1)J.pattern=G[0].source;else if(G.length>1)J.allOf=[...G.map((V)=>({...Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},PP0=(A,Q,B,$)=>{let J=B,{minimum:Y,maximum:Z,format:F,multipleOf:X,exclusiveMaximum:D,exclusiveMinimum:G}=A._zod.bag;if(typeof F==="string"&&F.includes("int"))J.type="integer";else J.type="number";if(typeof G==="number")if(Q.target==="draft-04"||Q.target==="openapi-3.0")J.minimum=G,J.exclusiveMinimum=!0;else J.exclusiveMinimum=G;if(typeof Y==="number"){if(J.minimum=Y,typeof G==="number"&&Q.target!=="draft-04")if(G>=Y)delete J.minimum;else delete J.exclusiveMinimum}if(typeof D==="number")if(Q.target==="draft-04"||Q.target==="openapi-3.0")J.maximum=D,J.exclusiveMaximum=!0;else J.exclusiveMaximum=D;if(typeof Z==="number"){if(J.maximum=Z,typeof D==="number"&&Q.target!=="draft-04")if(D<=Z)delete J.maximum;else delete J.exclusiveMaximum}if(typeof X==="number")J.multipleOf=X},_P0=(A,Q,B,$)=>{B.type="boolean"},TP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},kP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},SP0=(A,Q,B,$)=>{if(Q.target==="openapi-3.0")B.type="string",B.nullable=!0,B.enum=[null];else B.type="null"},vP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},yP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},fP0=(A,Q,B,$)=>{B.not={}},xP0=(A,Q,B,$)=>{},bP0=(A,Q,B,$)=>{},uP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},hP0=(A,Q,B,$)=>{let J=A._zod.def,Y=yg(J.entries);if(Y.every((Z)=>typeof Z==="number"))B.type="number";if(Y.every((Z)=>typeof Z==="string"))B.type="string";B.enum=Y},gP0=(A,Q,B,$)=>{let J=A._zod.def,Y=[];for(let Z of J.values)if(Z===void 0){if(Q.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof Z==="bigint")if(Q.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else Y.push(Number(Z));else Y.push(Z);if(Y.length===0);else if(Y.length===1){let Z=Y[0];if(B.type=Z===null?"null":typeof Z,Q.target==="draft-04"||Q.target==="openapi-3.0")B.enum=[Z];else B.const=Z}else{if(Y.every((Z)=>typeof Z==="number"))B.type="number";if(Y.every((Z)=>typeof Z==="string"))B.type="string";if(Y.every((Z)=>typeof Z==="boolean"))B.type="boolean";if(Y.every((Z)=>Z===null))B.type="null";B.enum=Y}},mP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},pP0=(A,Q,B,$)=>{let J=B,Y=A._zod.pattern;if(!Y)throw Error("Pattern not found in template literal");J.type="string",J.pattern=Y.source},dP0=(A,Q,B,$)=>{let J=B,Y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:Z,maximum:F,mime:X}=A._zod.bag;if(Z!==void 0)Y.minLength=Z;if(F!==void 0)Y.maxLength=F;if(X)if(X.length===1)Y.contentMediaType=X[0],Object.assign(J,Y);else Object.assign(J,Y),J.anyOf=X.map((D)=>({contentMediaType:D}));else Object.assign(J,Y)},cP0=(A,Q,B,$)=>{B.type="boolean"},lP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},iP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},nP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},aP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},oP0=(A,Q,B,$)=>{if(Q.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},rP0=(A,Q,B,$)=>{let J=B,Y=A._zod.def,{minimum:Z,maximum:F}=A._zod.bag;if(typeof Z==="number")J.minItems=Z;if(typeof F==="number")J.maxItems=F;J.type="array",J.items=r5(Y.element,Q,{...$,path:[...$.path,"items"]})},sP0=(A,Q,B,$)=>{let J=B,Y=A._zod.def;J.type="object",J.properties={};let Z=Y.shape;for(let D in Z)J.properties[D]=r5(Z[D],Q,{...$,path:[...$.path,"properties",D]});let F=new Set(Object.keys(Z)),X=new Set([...F].filter((D)=>{let G=Y.shape[D]._zod;if(Q.io==="input")return G.optin===void 0;else return G.optout===void 0}));if(X.size>0)J.required=Array.from(X);if(Y.catchall?._zod.def.type==="never")J.additionalProperties=!1;else if(!Y.catchall){if(Q.io==="output")J.additionalProperties=!1}else if(Y.catchall)J.additionalProperties=r5(Y.catchall,Q,{...$,path:[...$.path,"additionalProperties"]})},L60=(A,Q,B,$)=>{let J=A._zod.def,Y=J.inclusive===!1,Z=J.options.map((F,X)=>r5(F,Q,{...$,path:[...$.path,Y?"oneOf":"anyOf",X]}));if(Y)B.oneOf=Z;else B.anyOf=Z},tP0=(A,Q,B,$)=>{let J=A._zod.def,Y=r5(J.left,Q,{...$,path:[...$.path,"allOf",0]}),Z=r5(J.right,Q,{...$,path:[...$.path,"allOf",1]}),F=(D)=>("allOf"in D)&&Object.keys(D).length===1,X=[...F(Y)?Y.allOf:[Y],...F(Z)?Z.allOf:[Z]];B.allOf=X},eP0=(A,Q,B,$)=>{let J=B,Y=A._zod.def;J.type="array";let Z=Q.target==="draft-2020-12"?"prefixItems":"items",F=Q.target==="draft-2020-12"?"items":Q.target==="openapi-3.0"?"items":"additionalItems",X=Y.items.map((U,K)=>r5(U,Q,{...$,path:[...$.path,Z,K]})),D=Y.rest?r5(Y.rest,Q,{...$,path:[...$.path,F,...Q.target==="openapi-3.0"?[Y.items.length]:[]]}):null;if(Q.target==="draft-2020-12"){if(J.prefixItems=X,D)J.items=D}else if(Q.target==="openapi-3.0"){if(J.items={anyOf:X},D)J.items.anyOf.push(D);if(J.minItems=X.length,!D)J.maxItems=X.length}else if(J.items=X,D)J.additionalItems=D;let{minimum:G,maximum:V}=A._zod.bag;if(typeof G==="number")J.minItems=G;if(typeof V==="number")J.maxItems=V},A_0=(A,Q,B,$)=>{let J=B,Y=A._zod.def;J.type="object";let Z=Y.keyType,X=Z._zod.bag?.patterns;if(Y.mode==="loose"&&X&&X.size>0){let G=r5(Y.valueType,Q,{...$,path:[...$.path,"patternProperties","*"]});J.patternProperties={};for(let V of X)J.patternProperties[V.source]=G}else{if(Q.target==="draft-07"||Q.target==="draft-2020-12")J.propertyNames=r5(Y.keyType,Q,{...$,path:[...$.path,"propertyNames"]});J.additionalProperties=r5(Y.valueType,Q,{...$,path:[...$.path,"additionalProperties"]})}let D=Z._zod.values;if(D){let G=[...D].filter((V)=>typeof V==="string"||typeof V==="number");if(G.length>0)J.required=G}},Q_0=(A,Q,B,$)=>{let J=A._zod.def,Y=r5(J.innerType,Q,$),Z=Q.seen.get(A);if(Q.target==="openapi-3.0")Z.ref=J.innerType,B.nullable=!0;else B.anyOf=[Y,{type:"null"}]},B_0=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);Y.ref=J.innerType},$_0=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);Y.ref=J.innerType,B.default=JSON.parse(JSON.stringify(J.defaultValue))},J_0=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);if(Y.ref=J.innerType,Q.io==="input")B._prefault=JSON.parse(JSON.stringify(J.defaultValue))},Y_0=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);Y.ref=J.innerType;let Z;try{Z=J.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}B.default=Z},Z_0=(A,Q,B,$)=>{let J=A._zod.def,Y=Q.io==="input"?J.in._zod.def.type==="transform"?J.out:J.in:J.out;r5(Y,Q,$);let Z=Q.seen.get(A);Z.ref=Y},F_0=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);Y.ref=J.innerType,B.readOnly=!0},X_0=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);Y.ref=J.innerType},O60=(A,Q,B,$)=>{let J=A._zod.def;r5(J.innerType,Q,$);let Y=Q.seen.get(A);Y.ref=J.innerType},D_0=(A,Q,B,$)=>{let J=A._zod.innerType;r5(J,Q,$);let Y=Q.seen.get(A);Y.ref=J},M60;var Ym=o(()=>{Jm();JA();S56={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},M60={string:RP0,number:PP0,boolean:_P0,bigint:TP0,symbol:kP0,null:SP0,undefined:vP0,void:yP0,never:fP0,any:xP0,unknown:bP0,date:uP0,enum:hP0,literal:gP0,nan:mP0,template_literal:pP0,file:dP0,success:cP0,custom:lP0,function:iP0,transform:nP0,map:aP0,set:oP0,array:rP0,object:sP0,union:L60,intersection:tP0,tuple:eP0,record:A_0,nullable:Q_0,nonoptional:B_0,default:$_0,prefault:J_0,catch:Y_0,pipe:Z_0,readonly:F_0,promise:X_0,optional:O60,lazy:D_0}});class G_0{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(A){this.ctx.counter=A}get seen(){return this.ctx.seen}constructor(A){let Q=A?.target??"draft-2020-12";if(Q==="draft-4")Q="draft-04";if(Q==="draft-7")Q="draft-07";this.ctx=qH({processors:M60,target:Q,...A?.metadata&&{metadata:A.metadata},...A?.unrepresentable&&{unrepresentable:A.unrepresentable},...A?.override&&{override:A.override},...A?.io&&{io:A.io}})}process(A,Q={path:[],schemaPath:[]}){return r5(A,this.ctx,Q)}emit(A,Q){if(Q){if(Q.cycles)this.ctx.cycles=Q.cycles;if(Q.reused)this.ctx.reused=Q.reused;if(Q.external)this.ctx.external=Q.external}NH(this.ctx,A);let B=IH(this.ctx,A),{"~standard":$,...J}=B;return J}}var ta1=o(()=>{Ym();Jm()});var ea1={};var Ao1=()=>{};var cG={};z2(cG,{version:()=>TO0,util:()=>$4,treeifyError:()=>yL0,toJSONSchema:()=>j60,toDotPath:()=>Cn1,safeParseAsync:()=>cg,safeParse:()=>x_,safeEncodeAsync:()=>_n1,safeEncode:()=>Rn1,safeDecodeAsync:()=>Tn1,safeDecode:()=>Pn1,registry:()=>sA0,regexes:()=>TZ,process:()=>r5,prettifyError:()=>fL0,parseAsync:()=>dg,parse:()=>pg,meta:()=>LP0,locales:()=>g_,isValidJWT:()=>on1,isValidBase64URL:()=>an1,isValidBase64:()=>eO0,initializeContext:()=>qH,globalRegistry:()=>v7,globalConfig:()=>kg,formatError:()=>mg,flattenError:()=>gg,finalize:()=>IH,extractDefs:()=>NH,encodeAsync:()=>On1,encode:()=>Mn1,describe:()=>MP0,decodeAsync:()=>jn1,decode:()=>Ln1,createToJSONSchemaMethod:()=>jP0,createStandardJSONSchemaMethod:()=>AT,config:()=>w2,clone:()=>WB,_xor:()=>G56,_xid:()=>X60,_void:()=>EP0,_uuidv7:()=>B60,_uuidv6:()=>Q60,_uuidv4:()=>A60,_uuid:()=>eA0,_url:()=>$m,_uppercase:()=>d_,_unknown:()=>UP0,_union:()=>D56,_undefined:()=>DP0,_ulid:()=>F60,_uint64:()=>FP0,_uint32:()=>QP0,_tuple:()=>K56,_trim:()=>o_,_transform:()=>I56,_toUpperCase:()=>s_,_toLowerCase:()=>r_,_templateLiteral:()=>_56,_symbol:()=>XP0,_superRefine:()=>CP0,_success:()=>O56,_stringbool:()=>OP0,_stringFormat:()=>e_,_string:()=>mR0,_startsWith:()=>l_,_slugify:()=>t_,_size:()=>GM,_set:()=>W56,_safeParseAsync:()=>b_,_safeParse:()=>f_,_safeEncodeAsync:()=>vA0,_safeEncode:()=>kA0,_safeDecodeAsync:()=>yA0,_safeDecode:()=>SA0,_regex:()=>m_,_refine:()=>wP0,_record:()=>E56,_readonly:()=>P56,_property:()=>C60,_promise:()=>k56,_positive:()=>q60,_pipe:()=>R56,_parseAsync:()=>y_,_parse:()=>v_,_overwrite:()=>OX,_optional:()=>w56,_number:()=>oR0,_nullable:()=>C56,_null:()=>GP0,_normalize:()=>a_,_nonpositive:()=>I60,_nonoptional:()=>L56,_nonnegative:()=>w60,_never:()=>KP0,_negative:()=>N60,_nativeEnum:()=>q56,_nanoid:()=>J60,_nan:()=>HP0,_multipleOf:()=>WH,_minSize:()=>dG,_minLength:()=>uK,_min:()=>HB,_mime:()=>n_,_maxSize:()=>HH,_maxLength:()=>VM,_max:()=>sJ,_map:()=>z56,_mac:()=>dR0,_lte:()=>sJ,_lt:()=>mG,_lowercase:()=>p_,_literal:()=>N56,_length:()=>UM,_lazy:()=>T56,_ksuid:()=>D60,_jwt:()=>H60,_isoTime:()=>nR0,_isoDuration:()=>aR0,_isoDateTime:()=>lR0,_isoDate:()=>iR0,_ipv6:()=>V60,_ipv4:()=>G60,_intersection:()=>U56,_int64:()=>ZP0,_int32:()=>AP0,_int:()=>sR0,_includes:()=>c_,_guid:()=>Bm,_gte:()=>HB,_gt:()=>pG,_float64:()=>eR0,_float32:()=>tR0,_file:()=>NP0,_enum:()=>H56,_endsWith:()=>i_,_encodeAsync:()=>_A0,_encode:()=>RA0,_emoji:()=>$60,_email:()=>tA0,_e164:()=>W60,_discriminatedUnion:()=>V56,_default:()=>M56,_decodeAsync:()=>TA0,_decode:()=>PA0,_date:()=>zP0,_custom:()=>IP0,_cuid2:()=>Z60,_cuid:()=>Y60,_coercedString:()=>pR0,_coercedNumber:()=>rR0,_coercedDate:()=>WP0,_coercedBoolean:()=>$P0,_coercedBigint:()=>YP0,_cidrv6:()=>K60,_cidrv4:()=>U60,_check:()=>ra1,_catch:()=>j56,_boolean:()=>BP0,_bigint:()=>JP0,_base64url:()=>z60,_base64:()=>E60,_array:()=>qP0,_any:()=>VP0,TimePrecision:()=>cR0,NEVER:()=>Sg,JSONSchemaGenerator:()=>G_0,JSONSchema:()=>ea1,Doc:()=>gA0,$output:()=>uR0,$input:()=>hR0,$constructor:()=>e0,$brand:()=>LL0,$ZodXor:()=>Hj0,$ZodXID:()=>pO0,$ZodVoid:()=>Kj0,$ZodUnknown:()=>Vj0,$ZodUnion:()=>og,$ZodUndefined:()=>Xj0,$ZodUUID:()=>yO0,$ZodURL:()=>xO0,$ZodULID:()=>mO0,$ZodType:()=>nA,$ZodTuple:()=>aA0,$ZodTransform:()=>jj0,$ZodTemplateLiteral:()=>bj0,$ZodSymbol:()=>Fj0,$ZodSuccess:()=>Sj0,$ZodStringFormat:()=>E3,$ZodString:()=>DM,$ZodSet:()=>Cj0,$ZodRegistry:()=>gR0,$ZodRecord:()=>Ij0,$ZodRealError:()=>f$,$ZodReadonly:()=>xj0,$ZodPromise:()=>hj0,$ZodPrefault:()=>Tj0,$ZodPipe:()=>fj0,$ZodOptional:()=>oA0,$ZodObjectJIT:()=>Wj0,$ZodObject:()=>tn1,$ZodNumberFormat:()=>Yj0,$ZodNumber:()=>iA0,$ZodNullable:()=>Pj0,$ZodNull:()=>Dj0,$ZodNonOptional:()=>kj0,$ZodNever:()=>Uj0,$ZodNanoID:()=>uO0,$ZodNaN:()=>yj0,$ZodMap:()=>wj0,$ZodMAC:()=>rO0,$ZodLiteral:()=>Lj0,$ZodLazy:()=>gj0,$ZodKSUID:()=>dO0,$ZodJWT:()=>$j0,$ZodIntersection:()=>Nj0,$ZodISOTime:()=>iO0,$ZodISODuration:()=>nO0,$ZodISODateTime:()=>cO0,$ZodISODate:()=>lO0,$ZodIPv6:()=>oO0,$ZodIPv4:()=>aO0,$ZodGUID:()=>vO0,$ZodFunction:()=>uj0,$ZodFile:()=>Oj0,$ZodExactOptional:()=>Rj0,$ZodError:()=>hg,$ZodEnum:()=>Mj0,$ZodEncodeError:()=>ZM,$ZodEmoji:()=>bO0,$ZodEmail:()=>fO0,$ZodE164:()=>Bj0,$ZodDiscriminatedUnion:()=>qj0,$ZodDefault:()=>_j0,$ZodDate:()=>Ej0,$ZodCustomStringFormat:()=>Jj0,$ZodCustom:()=>mj0,$ZodCodec:()=>rg,$ZodCheckUpperCase:()=>MO0,$ZodCheckStringFormat:()=>u_,$ZodCheckStartsWith:()=>OO0,$ZodCheckSizeEquals:()=>HO0,$ZodCheckRegex:()=>wO0,$ZodCheckProperty:()=>RO0,$ZodCheckOverwrite:()=>_O0,$ZodCheckNumberFormat:()=>KO0,$ZodCheckMultipleOf:()=>UO0,$ZodCheckMinSize:()=>WO0,$ZodCheckMinLength:()=>NO0,$ZodCheckMimeType:()=>PO0,$ZodCheckMaxSize:()=>zO0,$ZodCheckMaxLength:()=>qO0,$ZodCheckLowerCase:()=>CO0,$ZodCheckLessThan:()=>bA0,$ZodCheckLengthEquals:()=>IO0,$ZodCheckIncludes:()=>LO0,$ZodCheckGreaterThan:()=>uA0,$ZodCheckEndsWith:()=>jO0,$ZodCheckBigIntFormat:()=>EO0,$ZodCheck:()=>P3,$ZodCatch:()=>vj0,$ZodCUID2:()=>gO0,$ZodCUID:()=>hO0,$ZodCIDRv6:()=>tO0,$ZodCIDRv4:()=>sO0,$ZodBoolean:()=>ag,$ZodBigIntFormat:()=>Zj0,$ZodBigInt:()=>nA0,$ZodBase64URL:()=>Qj0,$ZodBase64:()=>Aj0,$ZodAsyncError:()=>gG,$ZodArray:()=>zj0,$ZodAny:()=>Gj0});var NB=o(()=>{JA();xA0();rA0();Ym();ta1();Ao1();__();bL0();xL0();pj0();hA0();kO0();Qm();sa1();Jm()});var R60={};z2(R60,{uppercase:()=>d_,trim:()=>o_,toUpperCase:()=>s_,toLowerCase:()=>r_,startsWith:()=>l_,slugify:()=>t_,size:()=>GM,regex:()=>m_,property:()=>C60,positive:()=>q60,overwrite:()=>OX,normalize:()=>a_,nonpositive:()=>I60,nonnegative:()=>w60,negative:()=>N60,multipleOf:()=>WH,minSize:()=>dG,minLength:()=>uK,mime:()=>n_,maxSize:()=>HH,maxLength:()=>VM,lte:()=>sJ,lt:()=>mG,lowercase:()=>p_,length:()=>UM,includes:()=>c_,gte:()=>HB,gt:()=>pG,endsWith:()=>i_});var P60=o(()=>{NB()});var wH={};z2(wH,{time:()=>K_0,duration:()=>E_0,datetime:()=>V_0,date:()=>U_0,ZodISOTime:()=>k60,ZodISODuration:()=>S60,ZodISODateTime:()=>_60,ZodISODate:()=>T60});function V_0(A){return lR0(_60,A)}function U_0(A){return iR0(T60,A)}function K_0(A){return nR0(k60,A)}function E_0(A){return aR0(S60,A)}var _60,T60,k60,S60;var Zm=o(()=>{NB();Xm();_60=e0("ZodISODateTime",(A,Q)=>{cO0.init(A,Q),z3.init(A,Q)});T60=e0("ZodISODate",(A,Q)=>{lO0.init(A,Q),z3.init(A,Q)});k60=e0("ZodISOTime",(A,Q)=>{iO0.init(A,Q),z3.init(A,Q)});S60=e0("ZodISODuration",(A,Q)=>{nO0.init(A,Q),z3.init(A,Q)})});var Qo1=(A,Q)=>{hg.init(A,Q),A.name="ZodError",Object.defineProperties(A,{format:{value:(B)=>mg(A,B)},flatten:{value:(B)=>gg(A,B)},addIssue:{value:(B)=>{A.issues.push(B),A.message=JSON.stringify(A.issues,T_,2)}},addIssues:{value:(B)=>{A.issues.push(...B),A.message=JSON.stringify(A.issues,T_,2)}},isEmpty:{get(){return A.issues.length===0}}})},y56,x$;var z_0=o(()=>{NB();NB();JA();y56=e0("ZodError",Qo1),x$=e0("ZodError",Qo1,{Parent:Error})});var W_0,H_0,q_0,N_0,I_0,w_0,C_0,M_0,L_0,O_0,j_0,R_0;var P_0=o(()=>{NB();z_0();W_0=v_(x$),H_0=y_(x$),q_0=f_(x$),N_0=b_(x$),I_0=RA0(x$),w_0=PA0(x$),C_0=_A0(x$),M_0=TA0(x$),L_0=kA0(x$),O_0=SA0(x$),j_0=vA0(x$),R_0=yA0(x$)});var Fm={};z2(Fm,{xor:()=>po1,xid:()=>Eo1,void:()=>uo1,uuidv7:()=>Fo1,uuidv6:()=>Zo1,uuidv4:()=>Yo1,uuid:()=>Jo1,url:()=>x60,unknown:()=>W3,union:()=>Y3,undefined:()=>bo1,ulid:()=>Ko1,uint64:()=>fo1,uint32:()=>So1,tuple:()=>p_0,transform:()=>Q50,templateLiteral:()=>eo1,symbol:()=>xo1,superRefine:()=>ET0,success:()=>ro1,stringbool:()=>Zr1,stringFormat:()=>Oo1,string:()=>l0,strictObject:()=>mo1,set:()=>io1,refine:()=>KT0,record:()=>_3,readonly:()=>FT0,promise:()=>Ar1,preprocess:()=>Nm,prefault:()=>AT0,pipe:()=>Vm,partialRecord:()=>do1,optional:()=>h3,object:()=>w4,number:()=>Q5,nullish:()=>oo1,nullable:()=>Gm,null:()=>FT,nonoptional:()=>QT0,never:()=>A50,nativeEnum:()=>no1,nanoid:()=>Go1,nan:()=>so1,meta:()=>Jr1,map:()=>lo1,mac:()=>Ho1,looseRecord:()=>co1,looseObject:()=>C2,literal:()=>o4,lazy:()=>GT0,ksuid:()=>zo1,keyof:()=>go1,jwt:()=>Lo1,json:()=>Fr1,ipv6:()=>qo1,ipv4:()=>Wo1,intersection:()=>XT,int64:()=>yo1,int32:()=>ko1,int:()=>v60,instanceof:()=>Yr1,httpUrl:()=>Xo1,hostname:()=>jo1,hex:()=>Ro1,hash:()=>Po1,guid:()=>$o1,function:()=>Qr1,float64:()=>To1,float32:()=>_o1,file:()=>ao1,exactOptional:()=>o_0,enum:()=>y7,emoji:()=>Do1,email:()=>Bo1,e164:()=>Mo1,discriminatedUnion:()=>Wm,describe:()=>$r1,date:()=>ho1,custom:()=>Z50,cuid2:()=>Uo1,cuid:()=>Vo1,codec:()=>to1,cidrv6:()=>Io1,cidrv4:()=>No1,check:()=>Br1,catch:()=>JT0,boolean:()=>s5,bigint:()=>vo1,base64url:()=>Co1,base64:()=>wo1,array:()=>z4,any:()=>e60,_function:()=>Qr1,_default:()=>t_0,_ZodString:()=>y60,ZodXor:()=>u_0,ZodXID:()=>p60,ZodVoid:()=>x_0,ZodUnknown:()=>y_0,ZodUnion:()=>zm,ZodUndefined:()=>k_0,ZodUUID:()=>lG,ZodURL:()=>Um,ZodULID:()=>m60,ZodType:()=>z6,ZodTuple:()=>m_0,ZodTransform:()=>n_0,ZodTemplateLiteral:()=>XT0,ZodSymbol:()=>T_0,ZodSuccess:()=>BT0,ZodStringFormat:()=>z3,ZodString:()=>BT,ZodSet:()=>c_0,ZodRecord:()=>Hm,ZodReadonly:()=>ZT0,ZodPromise:()=>VT0,ZodPrefault:()=>e_0,ZodPipe:()=>J50,ZodOptional:()=>B50,ZodObject:()=>Em,ZodNumberFormat:()=>KM,ZodNumber:()=>JT,ZodNullable:()=>r_0,ZodNull:()=>S_0,ZodNonOptional:()=>$50,ZodNever:()=>f_0,ZodNanoID:()=>u60,ZodNaN:()=>YT0,ZodMap:()=>d_0,ZodMAC:()=>__0,ZodLiteral:()=>l_0,ZodLazy:()=>DT0,ZodKSUID:()=>d60,ZodJWT:()=>s60,ZodIntersection:()=>g_0,ZodIPv6:()=>l60,ZodIPv4:()=>c60,ZodGUID:()=>Dm,ZodFunction:()=>UT0,ZodFile:()=>i_0,ZodExactOptional:()=>a_0,ZodEnum:()=>QT,ZodEmoji:()=>b60,ZodEmail:()=>f60,ZodE164:()=>r60,ZodDiscriminatedUnion:()=>h_0,ZodDefault:()=>s_0,ZodDate:()=>Km,ZodCustomStringFormat:()=>$T,ZodCustom:()=>qm,ZodCodec:()=>Y50,ZodCatch:()=>$T0,ZodCUID2:()=>g60,ZodCUID:()=>h60,ZodCIDRv6:()=>n60,ZodCIDRv4:()=>i60,ZodBoolean:()=>YT,ZodBigIntFormat:()=>t60,ZodBigInt:()=>ZT,ZodBase64URL:()=>o60,ZodBase64:()=>a60,ZodArray:()=>b_0,ZodAny:()=>v_0});function l0(A){return mR0(BT,A)}function Bo1(A){return tA0(f60,A)}function $o1(A){return Bm(Dm,A)}function Jo1(A){return eA0(lG,A)}function Yo1(A){return A60(lG,A)}function Zo1(A){return Q60(lG,A)}function Fo1(A){return B60(lG,A)}function x60(A){return $m(Um,A)}function Xo1(A){return $m(Um,{protocol:/^https?$/,hostname:TZ.domain,...$4.normalizeParams(A)})}function Do1(A){return $60(b60,A)}function Go1(A){return J60(u60,A)}function Vo1(A){return Y60(h60,A)}function Uo1(A){return Z60(g60,A)}function Ko1(A){return F60(m60,A)}function Eo1(A){return X60(p60,A)}function zo1(A){return D60(d60,A)}function Wo1(A){return G60(c60,A)}function Ho1(A){return dR0(__0,A)}function qo1(A){return V60(l60,A)}function No1(A){return U60(i60,A)}function Io1(A){return K60(n60,A)}function wo1(A){return E60(a60,A)}function Co1(A){return z60(o60,A)}function Mo1(A){return W60(r60,A)}function Lo1(A){return H60(s60,A)}function Oo1(A,Q,B={}){return e_($T,A,Q,B)}function jo1(A){return e_($T,"hostname",TZ.hostname,A)}function Ro1(A){return e_($T,"hex",TZ.hex,A)}function Po1(A,Q){let B=Q?.enc??"hex",$=`${A}_${B}`,J=TZ[$];if(!J)throw Error(`Unrecognized hash format: ${$}`);return e_($T,$,J,Q)}function Q5(A){return oR0(JT,A)}function v60(A){return sR0(KM,A)}function _o1(A){return tR0(KM,A)}function To1(A){return eR0(KM,A)}function ko1(A){return AP0(KM,A)}function So1(A){return QP0(KM,A)}function s5(A){return BP0(YT,A)}function vo1(A){return JP0(ZT,A)}function yo1(A){return ZP0(t60,A)}function fo1(A){return FP0(t60,A)}function xo1(A){return XP0(T_0,A)}function bo1(A){return DP0(k_0,A)}function FT(A){return GP0(S_0,A)}function e60(){return VP0(v_0)}function W3(){return UP0(y_0)}function A50(A){return KP0(f_0,A)}function uo1(A){return EP0(x_0,A)}function ho1(A){return zP0(Km,A)}function z4(A,Q){return qP0(b_0,A,Q)}function go1(A){let Q=A._zod.def.shape;return y7(Object.keys(Q))}function w4(A,Q){let B={type:"object",shape:A??{},...$4.normalizeParams(Q)};return new Em(B)}function mo1(A,Q){return new Em({type:"object",shape:A,catchall:A50(),...$4.normalizeParams(Q)})}function C2(A,Q){return new Em({type:"object",shape:A,catchall:W3(),...$4.normalizeParams(Q)})}function Y3(A,Q){return new zm({type:"union",options:A,...$4.normalizeParams(Q)})}function po1(A,Q){return new u_0({type:"union",options:A,inclusive:!1,...$4.normalizeParams(Q)})}function Wm(A,Q,B){return new h_0({type:"union",options:Q,discriminator:A,...$4.normalizeParams(B)})}function XT(A,Q){return new g_0({type:"intersection",left:A,right:Q})}function p_0(A,Q,B){let $=Q instanceof nA,J=$?B:Q;return new m_0({type:"tuple",items:A,rest:$?Q:null,...$4.normalizeParams(J)})}function _3(A,Q,B){return new Hm({type:"record",keyType:A,valueType:Q,...$4.normalizeParams(B)})}function do1(A,Q,B){let $=WB(A);return $._zod.values=void 0,new Hm({type:"record",keyType:$,valueType:Q,...$4.normalizeParams(B)})}function co1(A,Q,B){return new Hm({type:"record",keyType:A,valueType:Q,mode:"loose",...$4.normalizeParams(B)})}function lo1(A,Q,B){return new d_0({type:"map",keyType:A,valueType:Q,...$4.normalizeParams(B)})}function io1(A,Q){return new c_0({type:"set",valueType:A,...$4.normalizeParams(Q)})}function y7(A,Q){let B=Array.isArray(A)?Object.fromEntries(A.map(($)=>[$,$])):A;return new QT({type:"enum",entries:B,...$4.normalizeParams(Q)})}function no1(A,Q){return new QT({type:"enum",entries:A,...$4.normalizeParams(Q)})}function o4(A,Q){return new l_0({type:"literal",values:Array.isArray(A)?A:[A],...$4.normalizeParams(Q)})}function ao1(A){return NP0(i_0,A)}function Q50(A){return new n_0({type:"transform",transform:A})}function h3(A){return new B50({type:"optional",innerType:A})}function o_0(A){return new a_0({type:"optional",innerType:A})}function Gm(A){return new r_0({type:"nullable",innerType:A})}function oo1(A){return h3(Gm(A))}function t_0(A,Q){return new s_0({type:"default",innerType:A,get defaultValue(){return typeof Q==="function"?Q():$4.shallowClone(Q)}})}function AT0(A,Q){return new e_0({type:"prefault",innerType:A,get defaultValue(){return typeof Q==="function"?Q():$4.shallowClone(Q)}})}function QT0(A,Q){return new $50({type:"nonoptional",innerType:A,...$4.normalizeParams(Q)})}function ro1(A){return new BT0({type:"success",innerType:A})}function JT0(A,Q){return new $T0({type:"catch",innerType:A,catchValue:typeof Q==="function"?Q:()=>Q})}function so1(A){return HP0(YT0,A)}function Vm(A,Q){return new J50({type:"pipe",in:A,out:Q})}function to1(A,Q,B){return new Y50({type:"pipe",in:A,out:Q,transform:B.decode,reverseTransform:B.encode})}function FT0(A){return new ZT0({type:"readonly",innerType:A})}function eo1(A,Q){return new XT0({type:"template_literal",parts:A,...$4.normalizeParams(Q)})}function GT0(A){return new DT0({type:"lazy",getter:A})}function Ar1(A){return new VT0({type:"promise",innerType:A})}function Qr1(A){return new UT0({type:"function",input:Array.isArray(A?.input)?p_0(A?.input):A?.input??z4(W3()),output:A?.output??W3()})}function Br1(A){let Q=new P3({check:"custom"});return Q._zod.check=A,Q}function Z50(A,Q){return IP0(qm,A??(()=>!0),Q)}function KT0(A,Q={}){return wP0(qm,A,Q)}function ET0(A){return CP0(A)}function Yr1(A,Q={}){let B=new qm({type:"custom",check:"custom",fn:($)=>$ instanceof A,abort:!0,...$4.normalizeParams(Q)});return B._zod.bag.Class=A,B._zod.check=($)=>{if(!($.value instanceof A))$.issues.push({code:"invalid_type",expected:A.name,input:$.value,inst:B,path:[...B._zod.def.path??[]]})},B}function Fr1(A){let Q=GT0(()=>{return Y3([l0(A),Q5(),s5(),FT(),z4(Q),_3(l0(),Q)])});return Q}function Nm(A,Q){return Vm(Q50(A),Q)}var z6,y60,BT,z3,f60,Dm,lG,Um,b60,u60,h60,g60,m60,p60,d60,c60,__0,l60,i60,n60,a60,o60,r60,s60,$T,JT,KM,YT,ZT,t60,T_0,k_0,S_0,v_0,y_0,f_0,x_0,Km,b_0,Em,zm,u_0,h_0,g_0,m_0,Hm,d_0,c_0,QT,l_0,i_0,n_0,B50,a_0,r_0,s_0,e_0,$50,BT0,$T0,YT0,J50,Y50,ZT0,XT0,DT0,VT0,UT0,qm,$r1,Jr1,Zr1=(...A)=>OP0({Codec:Y50,Boolean:YT,String:BT},...A);var Xm=o(()=>{NB();NB();Ym();Jm();P60();Zm();P_0();z6=e0("ZodType",(A,Q)=>{return nA.init(A,Q),Object.assign(A["~standard"],{jsonSchema:{input:AT(A,"input"),output:AT(A,"output")}}),A.toJSONSchema=jP0(A,{}),A.def=Q,A.type=Q.type,Object.defineProperty(A,"_def",{value:Q}),A.check=(...B)=>{return A.clone($4.mergeDefs(Q,{checks:[...Q.checks??[],...B.map(($)=>typeof $==="function"?{_zod:{check:$,def:{check:"custom"},onattach:[]}}:$)]}),{parent:!0})},A.with=A.check,A.clone=(B,$)=>WB(A,B,$),A.brand=()=>A,A.register=(B,$)=>{return B.add(A,$),A},A.parse=(B,$)=>W_0(A,B,$,{callee:A.parse}),A.safeParse=(B,$)=>q_0(A,B,$),A.parseAsync=async(B,$)=>H_0(A,B,$,{callee:A.parseAsync}),A.safeParseAsync=async(B,$)=>N_0(A,B,$),A.spa=A.safeParseAsync,A.encode=(B,$)=>I_0(A,B,$),A.decode=(B,$)=>w_0(A,B,$),A.encodeAsync=async(B,$)=>C_0(A,B,$),A.decodeAsync=async(B,$)=>M_0(A,B,$),A.safeEncode=(B,$)=>L_0(A,B,$),A.safeDecode=(B,$)=>O_0(A,B,$),A.safeEncodeAsync=async(B,$)=>j_0(A,B,$),A.safeDecodeAsync=async(B,$)=>R_0(A,B,$),A.refine=(B,$)=>A.check(KT0(B,$)),A.superRefine=(B)=>A.check(ET0(B)),A.overwrite=(B)=>A.check(OX(B)),A.optional=()=>h3(A),A.exactOptional=()=>o_0(A),A.nullable=()=>Gm(A),A.nullish=()=>h3(Gm(A)),A.nonoptional=(B)=>QT0(A,B),A.array=()=>z4(A),A.or=(B)=>Y3([A,B]),A.and=(B)=>XT(A,B),A.transform=(B)=>Vm(A,Q50(B)),A.default=(B)=>t_0(A,B),A.prefault=(B)=>AT0(A,B),A.catch=(B)=>JT0(A,B),A.pipe=(B)=>Vm(A,B),A.readonly=()=>FT0(A),A.describe=(B)=>{let $=A.clone();return v7.add($,{description:B}),$},Object.defineProperty(A,"description",{get(){return v7.get(A)?.description},configurable:!0}),A.meta=(...B)=>{if(B.length===0)return v7.get(A);let $=A.clone();return v7.add($,B[0]),$},A.isOptional=()=>A.safeParse(void 0).success,A.isNullable=()=>A.safeParse(null).success,A.apply=(B)=>B(A),A}),y60=e0("_ZodString",(A,Q)=>{DM.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=($,J,Y)=>RP0(A,$,J,Y);let B=A._zod.bag;A.format=B.format??null,A.minLength=B.minimum??null,A.maxLength=B.maximum??null,A.regex=(...$)=>A.check(m_(...$)),A.includes=(...$)=>A.check(c_(...$)),A.startsWith=(...$)=>A.check(l_(...$)),A.endsWith=(...$)=>A.check(i_(...$)),A.min=(...$)=>A.check(uK(...$)),A.max=(...$)=>A.check(VM(...$)),A.length=(...$)=>A.check(UM(...$)),A.nonempty=(...$)=>A.check(uK(1,...$)),A.lowercase=($)=>A.check(p_($)),A.uppercase=($)=>A.check(d_($)),A.trim=()=>A.check(o_()),A.normalize=(...$)=>A.check(a_(...$)),A.toLowerCase=()=>A.check(r_()),A.toUpperCase=()=>A.check(s_()),A.slugify=()=>A.check(t_())}),BT=e0("ZodString",(A,Q)=>{DM.init(A,Q),y60.init(A,Q),A.email=(B)=>A.check(tA0(f60,B)),A.url=(B)=>A.check($m(Um,B)),A.jwt=(B)=>A.check(H60(s60,B)),A.emoji=(B)=>A.check($60(b60,B)),A.guid=(B)=>A.check(Bm(Dm,B)),A.uuid=(B)=>A.check(eA0(lG,B)),A.uuidv4=(B)=>A.check(A60(lG,B)),A.uuidv6=(B)=>A.check(Q60(lG,B)),A.uuidv7=(B)=>A.check(B60(lG,B)),A.nanoid=(B)=>A.check(J60(u60,B)),A.guid=(B)=>A.check(Bm(Dm,B)),A.cuid=(B)=>A.check(Y60(h60,B)),A.cuid2=(B)=>A.check(Z60(g60,B)),A.ulid=(B)=>A.check(F60(m60,B)),A.base64=(B)=>A.check(E60(a60,B)),A.base64url=(B)=>A.check(z60(o60,B)),A.xid=(B)=>A.check(X60(p60,B)),A.ksuid=(B)=>A.check(D60(d60,B)),A.ipv4=(B)=>A.check(G60(c60,B)),A.ipv6=(B)=>A.check(V60(l60,B)),A.cidrv4=(B)=>A.check(U60(i60,B)),A.cidrv6=(B)=>A.check(K60(n60,B)),A.e164=(B)=>A.check(W60(r60,B)),A.datetime=(B)=>A.check(V_0(B)),A.date=(B)=>A.check(U_0(B)),A.time=(B)=>A.check(K_0(B)),A.duration=(B)=>A.check(E_0(B))});z3=e0("ZodStringFormat",(A,Q)=>{E3.init(A,Q),y60.init(A,Q)}),f60=e0("ZodEmail",(A,Q)=>{fO0.init(A,Q),z3.init(A,Q)});Dm=e0("ZodGUID",(A,Q)=>{vO0.init(A,Q),z3.init(A,Q)});lG=e0("ZodUUID",(A,Q)=>{yO0.init(A,Q),z3.init(A,Q)});Um=e0("ZodURL",(A,Q)=>{xO0.init(A,Q),z3.init(A,Q)});b60=e0("ZodEmoji",(A,Q)=>{bO0.init(A,Q),z3.init(A,Q)});u60=e0("ZodNanoID",(A,Q)=>{uO0.init(A,Q),z3.init(A,Q)});h60=e0("ZodCUID",(A,Q)=>{hO0.init(A,Q),z3.init(A,Q)});g60=e0("ZodCUID2",(A,Q)=>{gO0.init(A,Q),z3.init(A,Q)});m60=e0("ZodULID",(A,Q)=>{mO0.init(A,Q),z3.init(A,Q)});p60=e0("ZodXID",(A,Q)=>{pO0.init(A,Q),z3.init(A,Q)});d60=e0("ZodKSUID",(A,Q)=>{dO0.init(A,Q),z3.init(A,Q)});c60=e0("ZodIPv4",(A,Q)=>{aO0.init(A,Q),z3.init(A,Q)});__0=e0("ZodMAC",(A,Q)=>{rO0.init(A,Q),z3.init(A,Q)});l60=e0("ZodIPv6",(A,Q)=>{oO0.init(A,Q),z3.init(A,Q)});i60=e0("ZodCIDRv4",(A,Q)=>{sO0.init(A,Q),z3.init(A,Q)});n60=e0("ZodCIDRv6",(A,Q)=>{tO0.init(A,Q),z3.init(A,Q)});a60=e0("ZodBase64",(A,Q)=>{Aj0.init(A,Q),z3.init(A,Q)});o60=e0("ZodBase64URL",(A,Q)=>{Qj0.init(A,Q),z3.init(A,Q)});r60=e0("ZodE164",(A,Q)=>{Bj0.init(A,Q),z3.init(A,Q)});s60=e0("ZodJWT",(A,Q)=>{$j0.init(A,Q),z3.init(A,Q)});$T=e0("ZodCustomStringFormat",(A,Q)=>{Jj0.init(A,Q),z3.init(A,Q)});JT=e0("ZodNumber",(A,Q)=>{iA0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=($,J,Y)=>PP0(A,$,J,Y),A.gt=($,J)=>A.check(pG($,J)),A.gte=($,J)=>A.check(HB($,J)),A.min=($,J)=>A.check(HB($,J)),A.lt=($,J)=>A.check(mG($,J)),A.lte=($,J)=>A.check(sJ($,J)),A.max=($,J)=>A.check(sJ($,J)),A.int=($)=>A.check(v60($)),A.safe=($)=>A.check(v60($)),A.positive=($)=>A.check(pG(0,$)),A.nonnegative=($)=>A.check(HB(0,$)),A.negative=($)=>A.check(mG(0,$)),A.nonpositive=($)=>A.check(sJ(0,$)),A.multipleOf=($,J)=>A.check(WH($,J)),A.step=($,J)=>A.check(WH($,J)),A.finite=()=>A;let B=A._zod.bag;A.minValue=Math.max(B.minimum??Number.NEGATIVE_INFINITY,B.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,A.maxValue=Math.min(B.maximum??Number.POSITIVE_INFINITY,B.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,A.isInt=(B.format??"").includes("int")||Number.isSafeInteger(B.multipleOf??0.5),A.isFinite=!0,A.format=B.format??null});KM=e0("ZodNumberFormat",(A,Q)=>{Yj0.init(A,Q),JT.init(A,Q)});YT=e0("ZodBoolean",(A,Q)=>{ag.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>_P0(A,B,$,J)});ZT=e0("ZodBigInt",(A,Q)=>{nA0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=($,J,Y)=>TP0(A,$,J,Y),A.gte=($,J)=>A.check(HB($,J)),A.min=($,J)=>A.check(HB($,J)),A.gt=($,J)=>A.check(pG($,J)),A.gte=($,J)=>A.check(HB($,J)),A.min=($,J)=>A.check(HB($,J)),A.lt=($,J)=>A.check(mG($,J)),A.lte=($,J)=>A.check(sJ($,J)),A.max=($,J)=>A.check(sJ($,J)),A.positive=($)=>A.check(pG(BigInt(0),$)),A.negative=($)=>A.check(mG(BigInt(0),$)),A.nonpositive=($)=>A.check(sJ(BigInt(0),$)),A.nonnegative=($)=>A.check(HB(BigInt(0),$)),A.multipleOf=($,J)=>A.check(WH($,J));let B=A._zod.bag;A.minValue=B.minimum??null,A.maxValue=B.maximum??null,A.format=B.format??null});t60=e0("ZodBigIntFormat",(A,Q)=>{Zj0.init(A,Q),ZT.init(A,Q)});T_0=e0("ZodSymbol",(A,Q)=>{Fj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>kP0(A,B,$,J)});k_0=e0("ZodUndefined",(A,Q)=>{Xj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>vP0(A,B,$,J)});S_0=e0("ZodNull",(A,Q)=>{Dj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>SP0(A,B,$,J)});v_0=e0("ZodAny",(A,Q)=>{Gj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>xP0(A,B,$,J)});y_0=e0("ZodUnknown",(A,Q)=>{Vj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>bP0(A,B,$,J)});f_0=e0("ZodNever",(A,Q)=>{Uj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>fP0(A,B,$,J)});x_0=e0("ZodVoid",(A,Q)=>{Kj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>yP0(A,B,$,J)});Km=e0("ZodDate",(A,Q)=>{Ej0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=($,J,Y)=>uP0(A,$,J,Y),A.min=($,J)=>A.check(HB($,J)),A.max=($,J)=>A.check(sJ($,J));let B=A._zod.bag;A.minDate=B.minimum?new Date(B.minimum):null,A.maxDate=B.maximum?new Date(B.maximum):null});b_0=e0("ZodArray",(A,Q)=>{zj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>rP0(A,B,$,J),A.element=Q.element,A.min=(B,$)=>A.check(uK(B,$)),A.nonempty=(B)=>A.check(uK(1,B)),A.max=(B,$)=>A.check(VM(B,$)),A.length=(B,$)=>A.check(UM(B,$)),A.unwrap=()=>A.element});Em=e0("ZodObject",(A,Q)=>{Wj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>sP0(A,B,$,J),$4.defineLazy(A,"shape",()=>{return Q.shape}),A.keyof=()=>y7(Object.keys(A._zod.def.shape)),A.catchall=(B)=>A.clone({...A._zod.def,catchall:B}),A.passthrough=()=>A.clone({...A._zod.def,catchall:W3()}),A.loose=()=>A.clone({...A._zod.def,catchall:W3()}),A.strict=()=>A.clone({...A._zod.def,catchall:A50()}),A.strip=()=>A.clone({...A._zod.def,catchall:void 0}),A.extend=(B)=>{return $4.extend(A,B)},A.safeExtend=(B)=>{return $4.safeExtend(A,B)},A.merge=(B)=>$4.merge(A,B),A.pick=(B)=>$4.pick(A,B),A.omit=(B)=>$4.omit(A,B),A.partial=(...B)=>$4.partial(B50,A,B[0]),A.required=(...B)=>$4.required($50,A,B[0])});zm=e0("ZodUnion",(A,Q)=>{og.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>L60(A,B,$,J),A.options=Q.options});u_0=e0("ZodXor",(A,Q)=>{zm.init(A,Q),Hj0.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>L60(A,B,$,J),A.options=Q.options});h_0=e0("ZodDiscriminatedUnion",(A,Q)=>{zm.init(A,Q),qj0.init(A,Q)});g_0=e0("ZodIntersection",(A,Q)=>{Nj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>tP0(A,B,$,J)});m_0=e0("ZodTuple",(A,Q)=>{aA0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>eP0(A,B,$,J),A.rest=(B)=>A.clone({...A._zod.def,rest:B})});Hm=e0("ZodRecord",(A,Q)=>{Ij0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>A_0(A,B,$,J),A.keyType=Q.keyType,A.valueType=Q.valueType});d_0=e0("ZodMap",(A,Q)=>{wj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>aP0(A,B,$,J),A.keyType=Q.keyType,A.valueType=Q.valueType,A.min=(...B)=>A.check(dG(...B)),A.nonempty=(B)=>A.check(dG(1,B)),A.max=(...B)=>A.check(HH(...B)),A.size=(...B)=>A.check(GM(...B))});c_0=e0("ZodSet",(A,Q)=>{Cj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>oP0(A,B,$,J),A.min=(...B)=>A.check(dG(...B)),A.nonempty=(B)=>A.check(dG(1,B)),A.max=(...B)=>A.check(HH(...B)),A.size=(...B)=>A.check(GM(...B))});QT=e0("ZodEnum",(A,Q)=>{Mj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=($,J,Y)=>hP0(A,$,J,Y),A.enum=Q.entries,A.options=Object.values(Q.entries);let B=new Set(Object.keys(Q.entries));A.extract=($,J)=>{let Y={};for(let Z of $)if(B.has(Z))Y[Z]=Q.entries[Z];else throw Error(`Key ${Z} not found in enum`);return new QT({...Q,checks:[],...$4.normalizeParams(J),entries:Y})},A.exclude=($,J)=>{let Y={...Q.entries};for(let Z of $)if(B.has(Z))delete Y[Z];else throw Error(`Key ${Z} not found in enum`);return new QT({...Q,checks:[],...$4.normalizeParams(J),entries:Y})}});l_0=e0("ZodLiteral",(A,Q)=>{Lj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>gP0(A,B,$,J),A.values=new Set(Q.values),Object.defineProperty(A,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});i_0=e0("ZodFile",(A,Q)=>{Oj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>dP0(A,B,$,J),A.min=(B,$)=>A.check(dG(B,$)),A.max=(B,$)=>A.check(HH(B,$)),A.mime=(B,$)=>A.check(n_(Array.isArray(B)?B:[B],$))});n_0=e0("ZodTransform",(A,Q)=>{jj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>nP0(A,B,$,J),A._zod.parse=(B,$)=>{if($.direction==="backward")throw new ZM(A.constructor.name);B.addIssue=(Y)=>{if(typeof Y==="string")B.issues.push($4.issue(Y,B.value,Q));else{let Z=Y;if(Z.fatal)Z.continue=!1;Z.code??(Z.code="custom"),Z.input??(Z.input=B.value),Z.inst??(Z.inst=A),B.issues.push($4.issue(Z))}};let J=Q.transform(B.value,B);if(J instanceof Promise)return J.then((Y)=>{return B.value=Y,B});return B.value=J,B}});B50=e0("ZodOptional",(A,Q)=>{oA0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>O60(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});a_0=e0("ZodExactOptional",(A,Q)=>{Rj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>O60(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});r_0=e0("ZodNullable",(A,Q)=>{Pj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>Q_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});s_0=e0("ZodDefault",(A,Q)=>{_j0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>$_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType,A.removeDefault=A.unwrap});e_0=e0("ZodPrefault",(A,Q)=>{Tj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>J_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});$50=e0("ZodNonOptional",(A,Q)=>{kj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>B_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});BT0=e0("ZodSuccess",(A,Q)=>{Sj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>cP0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});$T0=e0("ZodCatch",(A,Q)=>{vj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>Y_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType,A.removeCatch=A.unwrap});YT0=e0("ZodNaN",(A,Q)=>{yj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>mP0(A,B,$,J)});J50=e0("ZodPipe",(A,Q)=>{fj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>Z_0(A,B,$,J),A.in=Q.in,A.out=Q.out});Y50=e0("ZodCodec",(A,Q)=>{J50.init(A,Q),rg.init(A,Q)});ZT0=e0("ZodReadonly",(A,Q)=>{xj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>F_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});XT0=e0("ZodTemplateLiteral",(A,Q)=>{bj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>pP0(A,B,$,J)});DT0=e0("ZodLazy",(A,Q)=>{gj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>D_0(A,B,$,J),A.unwrap=()=>A._zod.def.getter()});VT0=e0("ZodPromise",(A,Q)=>{hj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>X_0(A,B,$,J),A.unwrap=()=>A._zod.def.innerType});UT0=e0("ZodFunction",(A,Q)=>{uj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>iP0(A,B,$,J)});qm=e0("ZodCustom",(A,Q)=>{mj0.init(A,Q),z6.init(A,Q),A._zod.processJSONSchema=(B,$,J)=>lP0(A,B,$,J)});$r1=MP0,Jr1=LP0});function x56(A){w2({customError:A})}function b56(){return w2().customError}var WT0,zT0;var Xr1=o(()=>{NB();WT0={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};(function(A){})(zT0||(zT0={}))});function h56(A,Q){let B=A.$schema;if(B==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(B==="http://json-schema.org/draft-07/schema#")return"draft-7";if(B==="http://json-schema.org/draft-04/schema#")return"draft-4";return Q??"draft-2020-12"}function g56(A,Q){if(!A.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let B=A.slice(1).split("/").filter(Boolean);if(B.length===0)return Q.rootSchema;let $=Q.version==="draft-2020-12"?"$defs":"definitions";if(B[0]===$){let J=B[1];if(!J||!Q.defs[J])throw Error(`Reference not found: ${A}`);return Q.defs[J]}throw Error(`Reference not found: ${A}`)}function Dr1(A,Q){if(A.not!==void 0){if(typeof A.not==="object"&&Object.keys(A.not).length===0)return P4.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(A.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(A.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(A.if!==void 0||A.then!==void 0||A.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(A.dependentSchemas!==void 0||A.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(A.$ref){let J=A.$ref;if(Q.refs.has(J))return Q.refs.get(J);if(Q.processing.has(J))return P4.lazy(()=>{if(!Q.refs.has(J))throw Error(`Circular reference not resolved: ${J}`);return Q.refs.get(J)});Q.processing.add(J);let Y=g56(J,Q),Z=wQ(Y,Q);return Q.refs.set(J,Z),Q.processing.delete(J),Z}if(A.enum!==void 0){let J=A.enum;if(Q.version==="openapi-3.0"&&A.nullable===!0&&J.length===1&&J[0]===null)return P4.null();if(J.length===0)return P4.never();if(J.length===1)return P4.literal(J[0]);if(J.every((Z)=>typeof Z==="string"))return P4.enum(J);let Y=J.map((Z)=>P4.literal(Z));if(Y.length<2)return Y[0];return P4.union([Y[0],Y[1],...Y.slice(2)])}if(A.const!==void 0)return P4.literal(A.const);let B=A.type;if(Array.isArray(B)){let J=B.map((Y)=>{let Z={...A,type:Y};return Dr1(Z,Q)});if(J.length===0)return P4.never();if(J.length===1)return J[0];return P4.union(J)}if(!B)return P4.any();let $;switch(B){case"string":{let J=P4.string();if(A.format){let Y=A.format;if(Y==="email")J=J.check(P4.email());else if(Y==="uri"||Y==="uri-reference")J=J.check(P4.url());else if(Y==="uuid"||Y==="guid")J=J.check(P4.uuid());else if(Y==="date-time")J=J.check(P4.iso.datetime());else if(Y==="date")J=J.check(P4.iso.date());else if(Y==="time")J=J.check(P4.iso.time());else if(Y==="duration")J=J.check(P4.iso.duration());else if(Y==="ipv4")J=J.check(P4.ipv4());else if(Y==="ipv6")J=J.check(P4.ipv6());else if(Y==="mac")J=J.check(P4.mac());else if(Y==="cidr")J=J.check(P4.cidrv4());else if(Y==="cidr-v6")J=J.check(P4.cidrv6());else if(Y==="base64")J=J.check(P4.base64());else if(Y==="base64url")J=J.check(P4.base64url());else if(Y==="e164")J=J.check(P4.e164());else if(Y==="jwt")J=J.check(P4.jwt());else if(Y==="emoji")J=J.check(P4.emoji());else if(Y==="nanoid")J=J.check(P4.nanoid());else if(Y==="cuid")J=J.check(P4.cuid());else if(Y==="cuid2")J=J.check(P4.cuid2());else if(Y==="ulid")J=J.check(P4.ulid());else if(Y==="xid")J=J.check(P4.xid());else if(Y==="ksuid")J=J.check(P4.ksuid())}if(typeof A.minLength==="number")J=J.min(A.minLength);if(typeof A.maxLength==="number")J=J.max(A.maxLength);if(A.pattern)J=J.regex(new RegExp(A.pattern));$=J;break}case"number":case"integer":{let J=B==="integer"?P4.number().int():P4.number();if(typeof A.minimum==="number")J=J.min(A.minimum);if(typeof A.maximum==="number")J=J.max(A.maximum);if(typeof A.exclusiveMinimum==="number")J=J.gt(A.exclusiveMinimum);else if(A.exclusiveMinimum===!0&&typeof A.minimum==="number")J=J.gt(A.minimum);if(typeof A.exclusiveMaximum==="number")J=J.lt(A.exclusiveMaximum);else if(A.exclusiveMaximum===!0&&typeof A.maximum==="number")J=J.lt(A.maximum);if(typeof A.multipleOf==="number")J=J.multipleOf(A.multipleOf);$=J;break}case"boolean":{$=P4.boolean();break}case"null":{$=P4.null();break}case"object":{let J={},Y=A.properties||{},Z=new Set(A.required||[]);for(let[X,D]of Object.entries(Y)){let G=wQ(D,Q);J[X]=Z.has(X)?G:G.optional()}if(A.propertyNames){let X=wQ(A.propertyNames,Q),D=A.additionalProperties&&typeof A.additionalProperties==="object"?wQ(A.additionalProperties,Q):P4.any();if(Object.keys(J).length===0){$=P4.record(X,D);break}let G=P4.object(J).passthrough(),V=P4.looseRecord(X,D);$=P4.intersection(G,V);break}if(A.patternProperties){let X=A.patternProperties,D=Object.keys(X),G=[];for(let U of D){let K=wQ(X[U],Q),E=P4.string().regex(new RegExp(U));G.push(P4.looseRecord(E,K))}let V=[];if(Object.keys(J).length>0)V.push(P4.object(J).passthrough());if(V.push(...G),V.length===0)$=P4.object({}).passthrough();else if(V.length===1)$=V[0];else{let U=P4.intersection(V[0],V[1]);for(let K=2;K<V.length;K++)U=P4.intersection(U,V[K]);$=U}break}let F=P4.object(J);if(A.additionalProperties===!1)$=F.strict();else if(typeof A.additionalProperties==="object")$=F.catchall(wQ(A.additionalProperties,Q));else $=F.passthrough();break}case"array":{let{prefixItems:J,items:Y}=A;if(J&&Array.isArray(J)){let Z=J.map((X)=>wQ(X,Q)),F=Y&&typeof Y==="object"&&!Array.isArray(Y)?wQ(Y,Q):void 0;if(F)$=P4.tuple(Z).rest(F);else $=P4.tuple(Z);if(typeof A.minItems==="number")$=$.check(P4.minLength(A.minItems));if(typeof A.maxItems==="number")$=$.check(P4.maxLength(A.maxItems))}else if(Array.isArray(Y)){let Z=Y.map((X)=>wQ(X,Q)),F=A.additionalItems&&typeof A.additionalItems==="object"?wQ(A.additionalItems,Q):void 0;if(F)$=P4.tuple(Z).rest(F);else $=P4.tuple(Z);if(typeof A.minItems==="number")$=$.check(P4.minLength(A.minItems));if(typeof A.maxItems==="number")$=$.check(P4.maxLength(A.maxItems))}else if(Y!==void 0){let Z=wQ(Y,Q),F=P4.array(Z);if(typeof A.minItems==="number")F=F.min(A.minItems);if(typeof A.maxItems==="number")F=F.max(A.maxItems);$=F}else $=P4.array(P4.any());break}default:throw Error(`Unsupported type: ${B}`)}if(A.description)$=$.describe(A.description);if(A.default!==void 0)$=$.default(A.default);return $}function wQ(A,Q){if(typeof A==="boolean")return A?P4.any():P4.never();let B=Dr1(A,Q),$=A.type||A.enum!==void 0||A.const!==void 0;if(A.anyOf&&Array.isArray(A.anyOf)){let F=A.anyOf.map((D)=>wQ(D,Q)),X=P4.union(F);B=$?P4.intersection(B,X):X}if(A.oneOf&&Array.isArray(A.oneOf)){let F=A.oneOf.map((D)=>wQ(D,Q)),X=P4.xor(F);B=$?P4.intersection(B,X):X}if(A.allOf&&Array.isArray(A.allOf))if(A.allOf.length===0)B=$?B:P4.any();else{let F=$?B:wQ(A.allOf[0],Q),X=$?0:1;for(let D=X;D<A.allOf.length;D++)F=P4.intersection(F,wQ(A.allOf[D],Q));B=F}if(A.nullable===!0&&Q.version==="openapi-3.0")B=P4.nullable(B);if(A.readOnly===!0)B=P4.readonly(B);let J={},Y=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let F of Y)if(F in A)J[F]=A[F];let Z=["contentEncoding","contentMediaType","contentSchema"];for(let F of Z)if(F in A)J[F]=A[F];for(let F of Object.keys(A))if(!u56.has(F))J[F]=A[F];if(Object.keys(J).length>0)Q.registry.add(B,J);return B}function Gr1(A,Q){if(typeof A==="boolean")return A?P4.any():P4.never();let B=h56(A,Q?.defaultTarget),$=A.$defs||A.definitions||{},J={version:B,defs:$,refs:new Map,processing:new Set,rootSchema:A,registry:Q?.registry??v7};return wQ(A,J)}var P4,u56;var Vr1=o(()=>{Qm();P60();Zm();Xm();P4={...Fm,...R60,iso:wH},u56=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var Im={};z2(Im,{string:()=>m56,number:()=>p56,date:()=>l56,boolean:()=>d56,bigint:()=>c56});function m56(A){return pR0(BT,A)}function p56(A){return rR0(JT,A)}function d56(A){return $P0(YT,A)}function c56(A){return YP0(ZT,A)}function l56(A){return WP0(Km,A)}var Ur1=o(()=>{NB();Xm()});var x={};z2(x,{xor:()=>po1,xid:()=>Eo1,void:()=>uo1,uuidv7:()=>Fo1,uuidv6:()=>Zo1,uuidv4:()=>Yo1,uuid:()=>Jo1,util:()=>$4,url:()=>x60,uppercase:()=>d_,unknown:()=>W3,union:()=>Y3,undefined:()=>bo1,ulid:()=>Ko1,uint64:()=>fo1,uint32:()=>So1,tuple:()=>p_0,trim:()=>o_,treeifyError:()=>yL0,transform:()=>Q50,toUpperCase:()=>s_,toLowerCase:()=>r_,toJSONSchema:()=>j60,templateLiteral:()=>eo1,symbol:()=>xo1,superRefine:()=>ET0,success:()=>ro1,stringbool:()=>Zr1,stringFormat:()=>Oo1,string:()=>l0,strictObject:()=>mo1,startsWith:()=>l_,slugify:()=>t_,size:()=>GM,setErrorMap:()=>x56,set:()=>io1,safeParseAsync:()=>N_0,safeParse:()=>q_0,safeEncodeAsync:()=>j_0,safeEncode:()=>L_0,safeDecodeAsync:()=>R_0,safeDecode:()=>O_0,registry:()=>sA0,regexes:()=>TZ,regex:()=>m_,refine:()=>KT0,record:()=>_3,readonly:()=>FT0,property:()=>C60,promise:()=>Ar1,prettifyError:()=>fL0,preprocess:()=>Nm,prefault:()=>AT0,positive:()=>q60,pipe:()=>Vm,partialRecord:()=>do1,parseAsync:()=>H_0,parse:()=>W_0,overwrite:()=>OX,optional:()=>h3,object:()=>w4,number:()=>Q5,nullish:()=>oo1,nullable:()=>Gm,null:()=>FT,normalize:()=>a_,nonpositive:()=>I60,nonoptional:()=>QT0,nonnegative:()=>w60,never:()=>A50,negative:()=>N60,nativeEnum:()=>no1,nanoid:()=>Go1,nan:()=>so1,multipleOf:()=>WH,minSize:()=>dG,minLength:()=>uK,mime:()=>n_,meta:()=>Jr1,maxSize:()=>HH,maxLength:()=>VM,map:()=>lo1,mac:()=>Ho1,lte:()=>sJ,lt:()=>mG,lowercase:()=>p_,looseRecord:()=>co1,looseObject:()=>C2,locales:()=>g_,literal:()=>o4,length:()=>UM,lazy:()=>GT0,ksuid:()=>zo1,keyof:()=>go1,jwt:()=>Lo1,json:()=>Fr1,iso:()=>wH,ipv6:()=>qo1,ipv4:()=>Wo1,intersection:()=>XT,int64:()=>yo1,int32:()=>ko1,int:()=>v60,instanceof:()=>Yr1,includes:()=>c_,httpUrl:()=>Xo1,hostname:()=>jo1,hex:()=>Ro1,hash:()=>Po1,guid:()=>$o1,gte:()=>HB,gt:()=>pG,globalRegistry:()=>v7,getErrorMap:()=>b56,function:()=>Qr1,fromJSONSchema:()=>Gr1,formatError:()=>mg,float64:()=>To1,float32:()=>_o1,flattenError:()=>gg,file:()=>ao1,exactOptional:()=>o_0,enum:()=>y7,endsWith:()=>i_,encodeAsync:()=>C_0,encode:()=>I_0,emoji:()=>Do1,email:()=>Bo1,e164:()=>Mo1,discriminatedUnion:()=>Wm,describe:()=>$r1,decodeAsync:()=>M_0,decode:()=>w_0,date:()=>ho1,custom:()=>Z50,cuid2:()=>Uo1,cuid:()=>Vo1,core:()=>cG,config:()=>w2,coerce:()=>Im,codec:()=>to1,clone:()=>WB,cidrv6:()=>Io1,cidrv4:()=>No1,check:()=>Br1,catch:()=>JT0,boolean:()=>s5,bigint:()=>vo1,base64url:()=>Co1,base64:()=>wo1,array:()=>z4,any:()=>e60,_function:()=>Qr1,_default:()=>t_0,_ZodString:()=>y60,ZodXor:()=>u_0,ZodXID:()=>p60,ZodVoid:()=>x_0,ZodUnknown:()=>y_0,ZodUnion:()=>zm,ZodUndefined:()=>k_0,ZodUUID:()=>lG,ZodURL:()=>Um,ZodULID:()=>m60,ZodType:()=>z6,ZodTuple:()=>m_0,ZodTransform:()=>n_0,ZodTemplateLiteral:()=>XT0,ZodSymbol:()=>T_0,ZodSuccess:()=>BT0,ZodStringFormat:()=>z3,ZodString:()=>BT,ZodSet:()=>c_0,ZodRecord:()=>Hm,ZodRealError:()=>x$,ZodReadonly:()=>ZT0,ZodPromise:()=>VT0,ZodPrefault:()=>e_0,ZodPipe:()=>J50,ZodOptional:()=>B50,ZodObject:()=>Em,ZodNumberFormat:()=>KM,ZodNumber:()=>JT,ZodNullable:()=>r_0,ZodNull:()=>S_0,ZodNonOptional:()=>$50,ZodNever:()=>f_0,ZodNanoID:()=>u60,ZodNaN:()=>YT0,ZodMap:()=>d_0,ZodMAC:()=>__0,ZodLiteral:()=>l_0,ZodLazy:()=>DT0,ZodKSUID:()=>d60,ZodJWT:()=>s60,ZodIssueCode:()=>WT0,ZodIntersection:()=>g_0,ZodISOTime:()=>k60,ZodISODuration:()=>S60,ZodISODateTime:()=>_60,ZodISODate:()=>T60,ZodIPv6:()=>l60,ZodIPv4:()=>c60,ZodGUID:()=>Dm,ZodFunction:()=>UT0,ZodFirstPartyTypeKind:()=>zT0,ZodFile:()=>i_0,ZodExactOptional:()=>a_0,ZodError:()=>y56,ZodEnum:()=>QT,ZodEmoji:()=>b60,ZodEmail:()=>f60,ZodE164:()=>r60,ZodDiscriminatedUnion:()=>h_0,ZodDefault:()=>s_0,ZodDate:()=>Km,ZodCustomStringFormat:()=>$T,ZodCustom:()=>qm,ZodCodec:()=>Y50,ZodCatch:()=>$T0,ZodCUID2:()=>g60,ZodCUID:()=>h60,ZodCIDRv6:()=>n60,ZodCIDRv4:()=>i60,ZodBoolean:()=>YT,ZodBigIntFormat:()=>t60,ZodBigInt:()=>ZT,ZodBase64URL:()=>o60,ZodBase64:()=>a60,ZodArray:()=>b_0,ZodAny:()=>v_0,TimePrecision:()=>cR0,NEVER:()=>Sg,$output:()=>uR0,$input:()=>hR0,$brand:()=>LL0});var wm=o(()=>{NB();NB();sj0();NB();Ym();Vr1();rA0();Zm();Zm();Ur1();Xm();P60();z_0();P_0();Xr1();w2(sg())});var DT;var IB=o(()=>{wm();wm();DT=x});function Kr1(){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 Er1(A,Q){if(!A.scheme&&Q)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${A.authority}", path: "${A.path}", query: "${A.query}", fragment: "${A.fragment}"}`);if(A.scheme&&!i56.test(A.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(A.path){if(A.authority){if(!n56.test(A.path))throw Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a56.test(A.path))throw Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function o56(A,Q){if(!A&&!Q)return"file";return A}function r56(A,Q){switch(A){case"https":case"http":case"file":if(!Q)Q=jX;else if(Q[0]!==jX)Q=jX+Q;break}return Q}class p0{static isUri(A){if(A instanceof p0)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,Y=!1,Z){if(typeof A==="object")this.scheme=A.scheme||T3,this.authority=A.authority||T3,this.path=A.path||T3,this.query=A.query||T3,this.fragment=A.fragment||T3,this.platform=A.platform;else this.scheme=o56(A,Y),this.authority=Q||T3,this.path=r56(this.scheme,B||T3),this.query=$||T3,this.fragment=J||T3,this.platform=Z,Er1(this,Y)}get fsPath(){return Nr1(this,!1)}with(A){if(!A)return this;let{scheme:Q,authority:B,path:$,query:J,fragment:Y,platform:Z}=A;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=T3;if(B===void 0)B=this.authority;else if(B===null)B=T3;if($===void 0)$=this.path;else if($===null)$=T3;if(J===void 0)J=this.query;else if(J===null)J=T3;if(Y===void 0)Y=this.fragment;else if(Y===null)Y=T3;if(Z===void 0)Z=this.platform;else if(Z===null)Z=void 0;if(Q===this.scheme&&B===this.authority&&$===this.path&&J===this.query&&Y===this.fragment&&Z===this.platform)return this;return new EM(Q,B,$,J,Y,!1,Z)}static parse(A,Q=!1){let B=s56.exec(A);if(!B)return new EM(T3,T3,T3,T3,T3);return new EM(B[2]||T3,F50(B[4]||T3),F50(B[5]||T3),F50(B[7]||T3),F50(B[9]||T3),Q)}static file(A,Q=Kr1()){let B=T3;if(Q==="windows")A=A.replace(/\\/g,jX);if(A[0]===jX&&A[1]===jX){let $=A.indexOf(jX,2);if($===-1)B=A.substring(2),A=jX;else B=A.substring(2,$),A=A.substring($)||jX}return new EM("file",B,A,T3,T3,!1,Q)}static from(A){let Q=new EM(A.scheme,A.authority,A.path,A.query,A.fragment,!0,A.platform);return Er1(Q,!0),Q}toString(A=!1){return HT0(this,A)}toJSON(){return this}static revive(A){if(!A)return A;if(A instanceof p0)return A;let Q=new EM(A),B=A;return Q._formatted=B.external,Q._fsPath=B._sep===Hr1(Q.platform)?B.fsPath:null,Q}}function Hr1(A){return A==="windows"?1:void 0}function zr1(A,Q,B){let $;for(let J=0;J<A.length;J++){let Y=A.charCodeAt(J);if(Y>=97&&Y<=122||Y>=65&&Y<=90||Y>=48&&Y<=57||Y===45||Y===46||Y===95||Y===126||Q&&Y===47||B&&Y===91||B&&Y===93||B&&Y===58){if($!==void 0)$+=A.charAt(J)}else{if($===void 0)$=A.substring(0,J);let Z=qr1[Y];if(Z!==void 0)$+=Z;else $+=encodeURIComponent(A.charAt(J))}}return $!==void 0?$:A}function t56(A){let Q;for(let B=0;B<A.length;B++){let $=A.charCodeAt(B);if($===35||$===63){if(Q===void 0)Q=A.substring(0,B);Q+=qr1[$]}else if(Q!==void 0)Q+=A[B]}return Q!==void 0?Q:A}function Nr1(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 HT0(A,Q){let B=!Q?zr1:t56,$="",{scheme:J,authority:Y,path:Z,query:F,fragment:X}=A;if(J)$+=J,$+=":";if(Y||J==="file")$+=jX,$+=jX;if(Y){let D=Y.indexOf("@");if(D!==-1){let G=Y.substring(0,D);if(Y=Y.substring(D+1),D=G.lastIndexOf(":"),D===-1)$+=B(G,!1,!1);else $+=B(G.substring(0,D),!1,!1),$+=":",$+=B(G.substring(D+1),!1,!0);$+="@"}if(Y=Y.toLowerCase(),D=Y.lastIndexOf(":"),D===-1)$+=B(Y,!1,!0);else $+=B(Y.substring(0,D),!1,!0),$+=Y.substring(D)}if(Z){if(Z.length>=3&&Z.charCodeAt(0)===47&&Z.charCodeAt(2)===58){let D=Z.charCodeAt(1);if(D>=65&&D<=90)Z=`/${String.fromCharCode(D+32)}:${Z.substring(3)}`}else if(Z.length>=2&&Z.charCodeAt(1)===58){let D=Z.charCodeAt(0);if(D>=65&&D<=90)Z=`${String.fromCharCode(D+32)}:${Z.substring(2)}`}$+=B(Z,!0,!1)}if(F)$+="?",$+=B(F,!1,!1);if(X)$+="#",$+=!Q?zr1(X,!1,!1):X;return $}function Ir1(A){try{return decodeURIComponent(A)}catch{if(A.length>3)return A.substring(0,3)+Ir1(A.substring(3));else return A}}function F50(A){if(!A.match(Wr1))return A;return A.replace(Wr1,(Q)=>Ir1(Q))}function Cm(A){return A.scheme==="file"}function r8(A){return p0.parse(A)}function r1(A){return tJ.parse(A.toString())}function G6(A){if(typeof A==="string"||A instanceof URL)return p0.parse(A.toString());return A}var i56,n56,a56,T3="",jX="/",s56,EM,qr1,Wr1,tJ;var GT=o(()=>{IB();i56=/^\w[\w\d+.-]*$/,n56=/^\//,a56=/^\/\//;s56=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;EM=class EM extends p0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=Nr1(this,!1);return this._fsPath}toString(A=!1){if(!A){if(!this._formatted)this._formatted=HT0(this,!1);return this._formatted}return HT0(this,!0)}toJSON(){let A={};if(this._fsPath)A.fsPath=this._fsPath,A._sep=Hr1(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}};qr1={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"};Wr1=/(%[0-9A-Za-z][0-9A-Za-z])+/g;tJ=x.string().brand()});function qT0(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 wB(A){let Q=A.replace(/\/+$/,"");if(!Q)return"";let B=Q.lastIndexOf("/");return B===-1?Q:Q.slice(B+1)}function VT(...A){if(A.length===0)return".";let Q="";for(let Z of A)if(Z)if(Q)Q+="/"+Z;else Q=Z;if(!Q)return".";let B=Q.endsWith("/"),$=Q.split("/").filter(Boolean),J=[];for(let Z of $)if(Z===".."){if(J.length>0&&J[J.length-1]!=="..")J.pop();else if(!Q.startsWith("/"))J.push("..")}else if(Z!==".")J.push(Z);let Y=Q.startsWith("/")?"/"+J.join("/"):J.join("/");if(!Y)Y=Q.startsWith("/")?"/":".";if(B&&Y!=="/"&&Y!==".")Y+="/";return Y}function wr1(A,Q,B="/",$="/",J=!0){function Y(V,U){return J?V===U:V.toLowerCase()===U.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(Y(A,Q))return"";if(!A.startsWith(B)&&Q.startsWith(B))return Q;let Z=A===B?[""]:A.split(B),F=Q===B?[""]:Q.split(B),X=0;while(X<Z.length&&X<F.length&&Y(Z[X],F[X]))X++;let D=Z.length-X,G=[];for(let V=0;V<D;V++)G.push("..");return G.push(...F.slice(X)),G.join($)}function X50(A){let Q=wB(A.replace(/\/+$/,"")),B=Q.lastIndexOf(".");if(B===0||B===-1)return"";return Q.slice(B)}function p5(A){try{if(A=G6(A),A.scheme==="file")return A.fsPath}catch{}return A.toString()}var CH=o(()=>{GT()});function A36(A){if(A.startsWith(zM))return A;if(e56.test(A))return`${zM}${A.replace(/\\/g,zM)}`;return}function Q36(A,...Q){return A=G6(A),A.with({path:VT(A.path,...Q)})}function B36(A,...Q){let B=A.path,$=!1;if(B[0]!==zM)B=zM+B,$=!0;let J=B;for(let Y of Q){let Z=A36(Y);if(Z)J=VT(Z);else J=VT(J,Y)}if(J!=="/"&&J.endsWith("/"))J=J.replace(/\/+$/,"");if($&&J[0]===zM&&!A.authority)J=J.substring(1);return A.with({path:J})}function $36(A){if(A=G6(A),A.path.length===0||A.path===zM)return A;let Q=qT0(A.path);if(Q.length===1&&Q===".")Q="";return A.with({path:Q})}function J36(A,Q){if(Q.scheme!==A.scheme||(Q.authority??"")!==(A.authority??""))return!1;let B=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),$=B?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,J=B?A.path.slice(0,2).toUpperCase()+A.path.slice(2):A.path;return J===$||J.startsWith($.endsWith("/")?$:`${$}/`)||$.endsWith("/")&&J===$.slice(0,-1)}function Y36(A,Q){if(A.scheme!==Q.scheme||A.authority!==Q.authority||A.query!==Q.query||A.fragment!==Q.fragment)return null;let B=A.scheme==="file"&&/^\/[A-Za-z]:/.test(A.path)&&/^\/[A-Za-z]:/.test(Q.path);return wr1(A.path,Q.path,"/","/",!B)}function Z36(A,Q){let B=r1(A),$=r1(Q);if(B.startsWith("file:///")&&$.startsWith("file:///"))return Cr1(B)===Cr1($);return B===$}function Cr1(A){return A.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var zM="/",e56,$1;var NT0=o(()=>{CH();GT();e56=/^[A-Za-z]:[\\/]/;$1={joinPath:Q36,resolvePath:B36,dirname:$36,basename:(A)=>wB(G6(A).path),extname:(A)=>X50(G6(A).path),hasPrefix:J36,relativePath:Y36,equalURIs:Z36}});var s1=o(()=>{GT();NT0();CH()});function IT0(){let Q=iG.getLogger().contextLocalStorage?.getStore();if(Q==null)return[];let B=Q[F36];return Array.isArray(B)?B:[]}function D50(){let Q=iG.getLogger().contextLocalStorage?.getStore();if(Q==null)return{};let B={};for(let $ of Object.keys(Q))B[$]=Q[$];return B}var F36;var Mr1=o(()=>{G50();F36=Symbol.for("logtape.categoryPrefix")});function V50(A,Q){let B=Lr1.indexOf(A);if(B<0)throw TypeError(`Invalid log level: ${JSON.stringify(A)}.`);let $=Lr1.indexOf(Q);if($<0)throw TypeError(`Invalid log level: ${JSON.stringify(Q)}.`);return B-$}var Lr1;var Or1=o(()=>{Lr1=["trace","debug","info","warning","error","fatal"]});function Tr1(A){return A!=null&&typeof A==="object"&&jr1 in A&&A[jr1]===!0}function MH(A){let Q={};for(let B in A){let $=A[B];Q[B]=Tr1($)?$.getter():$}return Q}function X36(A){let Q=MH(A.properties),B=Object.getOwnPropertyDescriptors(A);return B.properties={value:Q,enumerable:!0,configurable:!0},Object.defineProperties({},B)}function CT0(A=[]){return iG.getLogger(A)}function Rr1(A){return A.length===2&&A[0]==="logtape"&&A[1]==="meta"}function V36(A){return A.includes(".")||A.includes("[")||A.includes("?.")}function U36(A,Q){if(Q==="__proto__"||Q==="prototype"||Q==="constructor")return;if((typeof A==="object"||typeof A==="function")&&A!==null)return Object.prototype.hasOwnProperty.call(A,Q)?A[Q]:void 0;return}function K36(A,Q){let B=A.length,$=Q;if($>=B)return null;let J;if(A[$]==="["){if($++,$>=B)return null;if(A[$]==='"'||A[$]==="'"){let Y=A[$];$++;let Z="";while($<B&&A[$]!==Y)if(A[$]==="\\"){if($++,$<B){let F=A[$];switch(F){case"n":Z+=`
|
|
214
214
|
`;break;case"t":Z+="\t";break;case"r":Z+="\r";break;case"b":Z+="\b";break;case"f":Z+="\f";break;case"v":Z+="\v";break;case"0":Z+="\x00";break;case"\\":Z+="\\";break;case'"':Z+='"';break;case"'":Z+="'";break;case"u":if($+4<B){let X=A.slice($+1,$+5),D=Number.parseInt(X,16);if(!Number.isNaN(D))Z+=String.fromCharCode(D),$+=4;else Z+=F}else Z+=F;break;default:Z+=F}$++}}else Z+=A[$],$++;if($>=B)return null;J=Z,$++}else{let Y=$;while($<B&&A[$]!=="]"&&A[$]!=="'"&&A[$]!=='"')$++;if($>=B)return null;let Z=A.slice(Y,$);if(Z.length===0)return null;let F=Number(Z);J=Number.isNaN(F)?Z:F}while($<B&&A[$]!=="]")$++;if($<B)$++}else{let Y=$;while($<B&&A[$]!=="."&&A[$]!=="["&&A[$]!=="?"&&A[$]!=="]")$++;if(J=A.slice(Y,$),J.length===0)return null}if($<B&&A[$]===".")$++;return{segment:J,nextIndex:$}}function E36(A,Q){if(typeof Q==="string")return U36(A,Q);if(Array.isArray(A)&&Q>=0&&Q<A.length)return A[Q];return}function z36(A,Q){if(A==null)return;if(Q.length===0||Q.endsWith("."))return;let B=A,$=0,J=Q.length;while($<J){if(Q.slice($,$+2)==="?."){if($+=2,B==null)return}else if(B==null)return;let Z=K36(Q,$);if(Z===null)return;let{segment:F,nextIndex:X}=Z;if($=X,B=E36(B,F),B===void 0)return}return B}function Pr1(A,Q){let B=A.length;if(B===0)return[""];if(!A.includes("{"))return[A];let $=[],J=0;for(let Z=0;Z<B;Z++){let F=A[Z];if(F==="{"){if((Z+1<B?A[Z+1]:"")==="{"){Z++;continue}let D=A.indexOf("}",Z+1);if(D===-1)continue;let G=A.slice(J,Z);$.push(G.replace(/{{/g,"{").replace(/}}/g,"}"));let V=A.slice(Z+1,D),U,K=V.trim();if(K==="*")U=V in Q?Q[V]:("*"in Q)?Q["*"]:Q;else{if(V!==K)U=V in Q?Q[V]:Q[K];else U=Q[V];if(U===void 0&&V36(K))U=z36(Q,K)}$.push(U),Z=D,J=Z+1}else if(F==="}"&&Z+1<B&&A[Z+1]==="}")Z++}let Y=A.slice(J);return $.push(Y.replace(/{{/g,"{").replace(/}}/g,"}")),$}function _r1(A,Q){let B=[];for(let $=0;$<A.length;$++)if(B.push(A[$]),$<Q.length)B.push(Q[$]);return B}var jr1,wT0,iG=class A{parent;children;category;sinks;parentSinks="inherit";filters;lowestLevel="trace";contextLocalStorage;static getLogger(Q=[]){let B=wT0 in globalThis?globalThis[wT0]??null:null;if(B==null)B=new A(null,[]),globalThis[wT0]=B;if(typeof Q==="string")return B.getChild(Q);if(Q.length===0)return B;return B.getChild(Q)}static getNearestExistingLogger(Q){let B=A.getLogger();for(let $ of Q){let J=B.children[$],Y=J instanceof A?J:J?.deref();if(Y==null)break;B=Y}return B}constructor(Q,B){this.parent=Q,this.children={},this.category=B,this.sinks=[],this.filters=[]}getChild(Q){let B=typeof Q==="string"?Q:Q[0],$=this.children[B],J=$ instanceof A?$:$?.deref();if(J==null)J=new A(this,[...this.category,B]),this.children[B]="WeakRef"in globalThis?new WeakRef(J):J;if(typeof Q==="string"||Q.length===1)return J;return J.getChild(Q.slice(1))}reset(){while(this.sinks.length>0)this.sinks.shift();this.parentSinks="inherit";while(this.filters.length>0)this.filters.shift();this.lowestLevel="trace"}resetDescendants(){for(let Q of Object.values(this.children)){let B=Q instanceof A?Q:Q.deref();if(B!=null)B.resetDescendants()}this.reset()}with(Q){return new D36(this,{...Q})}filter(Q){for(let B of this.filters)if(!B(Q))return!1;if(this.filters.length<1)return this.parent?.filter(Q)??!0;return!0}*getSinks(Q){if(this.lowestLevel===null||V50(Q,this.lowestLevel)<0)return;if(this.parent!=null&&this.parentSinks==="inherit")for(let B of this.parent.getSinks(Q))yield B;for(let B of this.sinks)yield B}isEnabledFor(Q){let B=Rr1(this.category)?[]:IT0();return(B.length>0?A.getNearestExistingLogger([...B,...this.category]):this).isEnabledForResolved(Q)}isEnabledForResolved(Q){if(this.lowestLevel===null||V50(Q,this.lowestLevel)<0)return!1;for(let B of this.getSinks(Q))return!0;return!1}emit(Q,B){let $="category"in Q?Q.category:this.category,J=Rr1($)?[]:IT0(),Y=J.length>0?[...J,...$]:$,Z=Object.getOwnPropertyDescriptors(Q);Z.category={value:Y,enumerable:!0,configurable:!0};let F=Object.defineProperties({},Z);(J.length>0?A.getNearestExistingLogger(Y):this).emitResolved(F,B)}emitResolved(Q,B){if(this.lowestLevel===null||V50(Q.level,this.lowestLevel)<0||!this.filter(Q))return;let $=[...this.getSinks(Q.level)];if($.length<1)return;let J,Y=!1;for(let Z of $){if(B?.has(Z))continue;try{if(J==null&&!Y)try{J=X36(Q)}catch{Y=!0,J=Q}Z(J??Q)}catch(F){let X=new Set(B);X.add(Z),G36.log("fatal","Failed to emit a log record to sink {sink}: {error}",{sink:Z,error:F,record:Q},X)}}}log(Q,B,$,J){let Y=D50(),Z=void 0,F=void 0,X=typeof $==="function"?{category:this.category,level:Q,timestamp:Date.now(),get message(){if(F==null)F=Pr1(B,this.properties);return F},rawMessage:B,get properties(){if(Z==null)Z=MH({...Y,...$()});return Z}}:{category:this.category,level:Q,timestamp:Date.now(),get message(){if(F==null)F=Pr1(B,this.properties);return F},rawMessage:B,get properties(){if(Z==null)Z=MH({...Y,...$});return Z}};this.emit(X,J)}logLazily(Q,B,$={}){let J=D50(),Y=void 0,Z=void 0;function F(){if(Z==null||Y==null){if(Z=B((X,...D)=>{return Y=X,_r1(X,D)}),Y==null)throw TypeError("No log record was made.")}return[Z,Y]}this.emit({category:this.category,level:Q,get message(){return F()[0]},get rawMessage(){return F()[1]},timestamp:Date.now(),properties:{...J,...$}})}logTemplate(Q,B,$,J={}){let Y=D50();this.emit({category:this.category,level:Q,message:_r1(B,$),rawMessage:B,timestamp:Date.now(),properties:{...Y,...J}})}trace(Q,...B){if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("trace"))return Promise.resolve();return $().then((Y)=>{this.log("trace",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("trace"))return Promise.resolve();return J.then((Y)=>{this.log("trace",Q,Y)})}this.log("trace",Q,J);return}this.log("trace",Q,$??{})}else if(typeof Q==="function")this.logLazily("trace",Q);else if(!Array.isArray(Q))this.log("trace","{*}",Q);else this.logTemplate("trace",Q,B)}debug(Q,...B){if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("debug"))return Promise.resolve();return $().then((Y)=>{this.log("debug",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("debug"))return Promise.resolve();return J.then((Y)=>{this.log("debug",Q,Y)})}this.log("debug",Q,J);return}this.log("debug",Q,$??{})}else if(typeof Q==="function")this.logLazily("debug",Q);else if(!Array.isArray(Q))this.log("debug","{*}",Q);else this.logTemplate("debug",Q,B)}info(Q,...B){if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("info"))return Promise.resolve();return $().then((Y)=>{this.log("info",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("info"))return Promise.resolve();return J.then((Y)=>{this.log("info",Q,Y)})}this.log("info",Q,J);return}this.log("info",Q,$??{})}else if(typeof Q==="function")this.logLazily("info",Q);else if(!Array.isArray(Q))this.log("info","{*}",Q);else this.logTemplate("info",Q,B)}warn(Q,...B){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("warning",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return $().then((Y)=>{this.log("warning",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return J.then((Y)=>{this.log("warning",Q,Y)})}this.log("warning",Q,J);return}this.log("warning",Q,$??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,B)}warning(Q,...B){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("warning",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return $().then((Y)=>{this.log("warning",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return J.then((Y)=>{this.log("warning",Q,Y)})}this.log("warning",Q,J);return}this.log("warning",Q,$??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,B)}error(Q,...B){if(Q instanceof Error)this.log("error","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("error",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("error"))return Promise.resolve();return $().then((Y)=>{this.log("error",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("error"))return Promise.resolve();return J.then((Y)=>{this.log("error",Q,Y)})}this.log("error",Q,J);return}this.log("error",Q,$??{})}else if(typeof Q==="function")this.logLazily("error",Q);else if(!Array.isArray(Q))this.log("error","{*}",Q);else this.logTemplate("error",Q,B)}fatal(Q,...B){if(Q instanceof Error)this.log("fatal","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("fatal",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("fatal"))return Promise.resolve();return $().then((Y)=>{this.log("fatal",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("fatal"))return Promise.resolve();return J.then((Y)=>{this.log("fatal",Q,Y)})}this.log("fatal",Q,J);return}this.log("fatal",Q,$??{})}else if(typeof Q==="function")this.logLazily("fatal",Q);else if(!Array.isArray(Q))this.log("fatal","{*}",Q);else this.logTemplate("fatal",Q,B)}},D36=class A{logger;properties;constructor(Q,B){this.logger=Q,this.properties=B}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(Q){return this.logger.getChild(Q).with(this.properties)}with(Q){return new A(this.logger,{...this.properties,...Q})}log(Q,B,$,J){let Y=this.properties;this.logger.log(Q,B,typeof $==="function"?()=>MH({...Y,...$()}):()=>MH({...Y,...$}),J)}logLazily(Q,B){this.logger.logLazily(Q,B,MH(this.properties))}logTemplate(Q,B,$){this.logger.logTemplate(Q,B,$,MH(this.properties))}emit(Q){let B={...Q,properties:MH({...this.properties,...Q.properties})};this.logger.emit(B)}isEnabledFor(Q){return this.logger.isEnabledFor(Q)}trace(Q,...B){if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("trace"))return Promise.resolve();return $().then((Y)=>{this.log("trace",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("trace"))return Promise.resolve();return J.then((Y)=>{this.log("trace",Q,Y)})}this.log("trace",Q,J);return}this.log("trace",Q,$??{})}else if(typeof Q==="function")this.logLazily("trace",Q);else if(!Array.isArray(Q))this.log("trace","{*}",Q);else this.logTemplate("trace",Q,B)}debug(Q,...B){if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("debug"))return Promise.resolve();return $().then((Y)=>{this.log("debug",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("debug"))return Promise.resolve();return J.then((Y)=>{this.log("debug",Q,Y)})}this.log("debug",Q,J);return}this.log("debug",Q,$??{})}else if(typeof Q==="function")this.logLazily("debug",Q);else if(!Array.isArray(Q))this.log("debug","{*}",Q);else this.logTemplate("debug",Q,B)}info(Q,...B){if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("info"))return Promise.resolve();return $().then((Y)=>{this.log("info",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("info"))return Promise.resolve();return J.then((Y)=>{this.log("info",Q,Y)})}this.log("info",Q,J);return}this.log("info",Q,$??{})}else if(typeof Q==="function")this.logLazily("info",Q);else if(!Array.isArray(Q))this.log("info","{*}",Q);else this.logTemplate("info",Q,B)}warn(Q,...B){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("warning",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return $().then((Y)=>{this.log("warning",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return J.then((Y)=>{this.log("warning",Q,Y)})}this.log("warning",Q,J);return}this.log("warning",Q,$??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,B)}warning(Q,...B){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("warning",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return $().then((Y)=>{this.log("warning",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return J.then((Y)=>{this.log("warning",Q,Y)})}this.log("warning",Q,J);return}this.log("warning",Q,$??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,B)}error(Q,...B){if(Q instanceof Error)this.log("error","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("error",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("error"))return Promise.resolve();return $().then((Y)=>{this.log("error",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("error"))return Promise.resolve();return J.then((Y)=>{this.log("error",Q,Y)})}this.log("error",Q,J);return}this.log("error",Q,$??{})}else if(typeof Q==="function")this.logLazily("error",Q);else if(!Array.isArray(Q))this.log("error","{*}",Q);else this.logTemplate("error",Q,B)}fatal(Q,...B){if(Q instanceof Error)this.log("fatal","{error.message}",{error:Q});else if(typeof Q==="string"&&B[0]instanceof Error)this.log("fatal",Q,{error:B[0]});else if(typeof Q==="string"){let $=B[0];if(typeof $==="function"){if($.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("fatal"))return Promise.resolve();return $().then((Y)=>{this.log("fatal",Q,Y)})}let J=$();if(J instanceof Promise){if(!this.isEnabledFor("fatal"))return Promise.resolve();return J.then((Y)=>{this.log("fatal",Q,Y)})}this.log("fatal",Q,J);return}this.log("fatal",Q,$??{})}else if(typeof Q==="function")this.logLazily("fatal",Q);else if(!Array.isArray(Q))this.log("fatal","{*}",Q);else this.logTemplate("fatal",Q,B)}},G36;var G50=o(()=>{Mr1();Or1();jr1=Symbol.for("logtape.lazy");wT0=Symbol.for("logtape.rootLogger");G36=iG.getLogger(["logtape","meta"])});var K50={};z2(K50,{inspect:()=>U50});import W36 from"node:util";function U50(A,Q){return W36.inspect(A,Q)}var kr1=()=>{};function g3(A){return A<10?`0${A}`:`${A}`}function UT(A){return A<10?`00${A}`:A<100?`0${A}`:`${A}`}function yr1(A){return A==="crlf"?`\r
|
|
215
215
|
`:`
|
|
216
|
-
`}function z50(A,Q){if(!(Q instanceof Error))return Q;let B={name:Q.name,message:Q.message};if(typeof Q.stack==="string")B.stack=Q.stack;let $=Q.cause;if($!==void 0)B.cause=$;if(typeof AggregateError<"u"&&Q instanceof AggregateError)B.errors=Q.errors;for(let J of Object.keys(Q))if(!(J in B))B[J]=Q[J];return B}function jT0(A={}){let Q=(()=>{let F=A.timestamp;if(F==null)return E50["date-time-timezone"];else if(F==="disabled")return E50.none;else if(typeof F==="string"&&F in E50)return E50[F];else return F})(),B=A.category??"·",$=A.value?(F)=>A.value(F,Sr1):Sr1,J=(()=>{let F=A.level;if(F==null||F==="ABBR")return(X)=>KT.ABBR[X];else if(F==="abbr")return(X)=>KT.abbr[X];else if(F==="FULL")return(X)=>KT.FULL[X];else if(F==="full")return(X)=>KT.full[X];else if(F==="L")return(X)=>KT.L[X];else if(F==="l")return(X)=>KT.l[X];else return F})(),Y=yr1(A.lineEnding),Z=A.format??(({timestamp:F,level:X,category:D,message:G})=>`${F?`${F} `:""}[${X}] ${D}: ${G}`);return(F)=>{let X=F.message,D=X.length,G;if(D===1)G=X[0];else if(D<=6){G="";for(let z=0;z<D;z++)G+=z%2===0?X[z]:$(X[z])}else{let z=Array(D);for(let W=0;W<D;W++)z[W]=W%2===0?X[W]:$(X[W]);G=z.join("")}let V=Q(F.timestamp),U=J(F.level),K=typeof B==="function"?B(F.category):F.category.join(B);return`${Z({timestamp:V,level:U,category:K,message:G,record:F})}${Y}`}}function fr1(A={}){let Q=A.format,B=typeof A.timestampStyle>"u"?"dim":A.timestampStyle,$=A.timestampColor??null,J=`${B==null?"":OT0[B]}${$==null?"":LT0[$]}`,Y=B==null&&$==null?"":MT0,Z=typeof A.levelStyle>"u"?"bold":A.levelStyle,F=A.levelColors??H36,X=typeof A.categoryStyle>"u"?"dim":A.categoryStyle,D=A.categoryColor??null,G=`${X==null?"":OT0[X]}${D==null?"":LT0[D]}`,V=X==null&&D==null?"":MT0;return jT0({timestamp:"date-time-tz",value(U,K){return K(U,{colors:!0})},...A,format({timestamp:U,level:K,category:E,message:z,record:W}){let H=F[W.level];return U=U==null?null:`${J}${U}${Y}`,K=`${Z==null?"":OT0[Z]}${H==null?"":LT0[H]}${K}${Z==null&&H==null?"":MT0}`,Q==null?`${U==null?"":`${U} `}${K} ${G}${E}:${V} ${z}`:Q({timestamp:U,level:K,category:`${G}${E}${V}`,message:z,record:W})}})}function H50(A={}){let Q=yr1(A.lineEnding);if(!A.categorySeparator&&!A.message&&!A.properties)return(F)=>{if(F.message.length===3)return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:F.message[0]+JSON.stringify(F.message[1])+F.message[2],logger:F.category.join("."),properties:F.properties},z50)+Q;if(F.message.length===1)return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:F.message[0],logger:F.category.join("."),properties:F.properties},z50)+Q;let X=F.message[0];for(let D=1;D<F.message.length;D++)X+=D&1?JSON.stringify(F.message[D]):F.message[D];return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:X,logger:F.category.join("."),properties:F.properties},z50)+Q};let B=A.message==="template",$=A.properties??"nest:properties",J;if(typeof A.categorySeparator==="function")J=A.categorySeparator;else{let F=A.categorySeparator??".";J=(X)=>X.join(F)}let Y;if($==="flatten")Y=(F)=>F;else if($.startsWith("prepend:")){let F=$.substring(8);if(F==="")throw TypeError(`Invalid properties option: ${JSON.stringify($)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);Y=(X)=>{let D={};for(let G in X)D[`${F}${G}`]=X[G];return D}}else if($.startsWith("nest:")){let F=$.substring(5);Y=(X)=>({[F]:X})}else throw TypeError(`Invalid properties option: ${JSON.stringify($)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let Z;if(B)Z=(F)=>{if(typeof F.rawMessage==="string")return F.rawMessage;let X="";for(let D=0;D<F.rawMessage.length;D++)X+=D%2<1?F.rawMessage[D]:"{}";return X};else Z=(F)=>{let X=F.message.length;if(X===1)return F.message[0];let D="";for(let G=0;G<X;G++)D+=G%2<1?F.message[G]:JSON.stringify(F.message[G]);return D};return(F)=>{return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:Z(F),logger:J(F.category),...Y(F.properties)},z50)+Q}}function Mm(A){let Q="",B=[];for(let Y=0;Y<A.message.length;Y++)if(Y%2===0)Q+=A.message[Y];else Q+="%o",B.push(A.message[Y]);let $=new Date(A.timestamp);return[`%c${`${$.getUTCHours().toString().padStart(2,"0")}:${$.getUTCMinutes().toString().padStart(2,"0")}:${$.getUTCSeconds().toString().padStart(2,"0")}.${$.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${vr1[A.level]}%c %c${A.category.join("·")} %c${Q}`,"color: gray;",I36[A.level],"background-color: default;","color: gray;","color: default;",...B]}var vr1,Sr1,E50,KT,W50,MT0="\x1B[0m",LT0,OT0,H36,q36,N36,I36;var RT0=o(()=>{kr1();vr1={trace:"TRC",debug:"DBG",info:"INF",warning:"WRN",error:"ERR",fatal:"FTL"},Sr1=typeof document<"u"||typeof navigator<"u"&&navigator.product==="ReactNative"?(A)=>JSON.stringify(A):("Deno"in globalThis)&&("inspect"in globalThis.Deno)&&typeof globalThis.Deno.inspect==="function"?(A,Q)=>globalThis.Deno.inspect(A,{strAbbreviateSize:1/0,iterableLimit:1/0,...Q}):K50!=null&&("inspect"in K50)&&typeof U50==="function"?(A,Q)=>U50(A,{maxArrayLength:1/0,maxStringLength:1/0,...Q}):(A)=>JSON.stringify(A);E50={"date-time-timezone":(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate()),Y=g3(Q.getUTCHours()),Z=g3(Q.getUTCMinutes()),F=g3(Q.getUTCSeconds()),X=UT(Q.getUTCMilliseconds());return`${B}-${$}-${J} ${Y}:${Z}:${F}.${X} +00:00`},"date-time-tz":(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate()),Y=g3(Q.getUTCHours()),Z=g3(Q.getUTCMinutes()),F=g3(Q.getUTCSeconds()),X=UT(Q.getUTCMilliseconds());return`${B}-${$}-${J} ${Y}:${Z}:${F}.${X} +00`},"date-time":(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate()),Y=g3(Q.getUTCHours()),Z=g3(Q.getUTCMinutes()),F=g3(Q.getUTCSeconds()),X=UT(Q.getUTCMilliseconds());return`${B}-${$}-${J} ${Y}:${Z}:${F}.${X}`},"time-timezone":(A)=>{let Q=new Date(A),B=g3(Q.getUTCHours()),$=g3(Q.getUTCMinutes()),J=g3(Q.getUTCSeconds()),Y=UT(Q.getUTCMilliseconds());return`${B}:${$}:${J}.${Y} +00:00`},"time-tz":(A)=>{let Q=new Date(A),B=g3(Q.getUTCHours()),$=g3(Q.getUTCMinutes()),J=g3(Q.getUTCSeconds()),Y=UT(Q.getUTCMilliseconds());return`${B}:${$}:${J}.${Y} +00`},time:(A)=>{let Q=new Date(A),B=g3(Q.getUTCHours()),$=g3(Q.getUTCMinutes()),J=g3(Q.getUTCSeconds()),Y=UT(Q.getUTCMilliseconds());return`${B}:${$}:${J}.${Y}`},date:(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate());return`${B}-${$}-${J}`},rfc3339:(A)=>new Date(A).toISOString(),none:()=>null},KT={ABBR:vr1,abbr:{trace:"trc",debug:"dbg",info:"inf",warning:"wrn",error:"err",fatal:"ftl"},FULL:{trace:"TRACE",debug:"DEBUG",info:"INFO",warning:"WARNING",error:"ERROR",fatal:"FATAL"},full:{trace:"trace",debug:"debug",info:"info",warning:"warning",error:"error",fatal:"fatal"},L:{trace:"T",debug:"D",info:"I",warning:"W",error:"E",fatal:"F"},l:{trace:"t",debug:"d",info:"i",warning:"w",error:"e",fatal:"f"}};W50=jT0(),LT0={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},OT0={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",strikethrough:"\x1B[9m"},H36={trace:null,debug:"blue",info:"green",warning:"yellow",error:"red",fatal:"magenta"};q36=fr1();N36=H50(),I36={trace:"background-color: gray; color: white;",debug:"background-color: gray; color: white;",info:"background-color: white; color: black;",warning:"background-color: orange; color: black;",error:"background-color: red; color: white;",fatal:"background-color: maroon; color: white;"}});function xr1(A){if(typeof A==="function")return A;return w36(A)}function w36(A){if(A==null)return()=>!1;if(A==="fatal")return(Q)=>Q.level==="fatal";else if(A==="error")return(Q)=>Q.level==="fatal"||Q.level==="error";else if(A==="warning")return(Q)=>Q.level==="fatal"||Q.level==="error"||Q.level==="warning";else if(A==="info")return(Q)=>Q.level==="fatal"||Q.level==="error"||Q.level==="warning"||Q.level==="info";else if(A==="debug")return(Q)=>Q.level==="fatal"||Q.level==="error"||Q.level==="warning"||Q.level==="info"||Q.level==="debug";else if(A==="trace")return()=>!0;throw TypeError(`Invalid log level: ${A}.`)}var br1=()=>{};function Lm(A={}){let Q=A.formatter??Mm,B={trace:"debug",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"error",...A.levelMap??{}},$=A.console??globalThis.console,J=(H)=>{let q=Q(H),N=B[H.level];if(N===void 0)throw TypeError(`Invalid log level: ${H.level}.`);if(typeof q==="string"){let I=q.replace(/\r?\n$/,"");$[N](I)}else $[N](...q)};if(!A.nonBlocking)return J;let Y=A.nonBlocking===!0?{}:A.nonBlocking,Z=Y.bufferSize??100,F=Y.flushInterval??100,X=[],D=null,G=!1,V=!1,U=Z*2;function K(){if(X.length===0)return;let H=X.splice(0);for(let q of H)try{J(q)}catch{}}function E(){if(V)return;V=!0,setTimeout(()=>{V=!1,K()},0)}function z(){if(D!==null||G)return;D=setInterval(()=>{K()},F)}let W=(H)=>{if(G)return;if(X.length>=U)X.shift();if(X.push(H),X.length>=Z)E();else if(D===null)z()};return W[Symbol.dispose]=()=>{if(G=!0,D!==null)clearInterval(D),D=null;K()},W}var PT0=o(()=>{RT0()});function C36(A){return A.category.length===0||A.category.length===1&&A.category[0]==="logtape"||A.category.length===2&&A.category[0]==="logtape"&&A.category[1]==="meta"}function M36(A){let Q=A?I50:w50;if(typeof globalThis.EdgeRuntime!=="string"&&"process"in globalThis&&!("Deno"in globalThis)){let $=globalThis.process,J=$?.on;if(typeof J==="function"){J.call($,"exit",Q);return}}let B=globalThis.addEventListener;if(typeof B!=="function")return;if("Deno"in globalThis)B.call(globalThis,"unload",Q);else B.call(globalThis,"pagehide",Q)}function jm(A){if(N50!=null&&!A.reset)throw new hK("Already configured; if you want to reset, turn on the reset flag.");if(Om.size>0)throw new hK("Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().");ET();try{L36(A,!1)}catch(Q){if(Q instanceof hK)ET();throw Q}}function L36(A,Q){N50=A;let B=!1,$=new Set;for(let Y of A.loggers){if(C36(Y))B=!0;let Z=Array.isArray(Y.category)?JSON.stringify(Y.category):JSON.stringify([Y.category]);if($.has(Z))throw new hK(`Duplicate logger configuration for category: ${Z}. Each category can only be configured once.`);$.add(Z);let F=iG.getLogger(Y.category);for(let X of Y.sinks??[]){let D=A.sinks[X];if(!D)throw new hK(`Sink not found: ${X}.`);F.sinks.push(D)}if(F.parentSinks=Y.parentSinks??"inherit",Y.lowestLevel!==void 0)F.lowestLevel=Y.lowestLevel;for(let X of Y.filters??[]){let D=A.filters?.[X];if(D===void 0)throw new hK(`Filter not found: ${X}.`);F.filters.push(xr1(D))}ur1.add(F)}iG.getLogger().contextLocalStorage=A.contextLocalStorage;for(let Y of Object.values(A.sinks)){if(Symbol.asyncDispose in Y)if(Q)Om.add(Y);else throw new hK("Async disposables cannot be used with configureSync().");if(Symbol.dispose in Y)q50.add(Y)}for(let Y of Object.values(A.filters??{})){if(Y==null||typeof Y==="string")continue;if(Symbol.asyncDispose in Y)if(Q)Om.add(Y);else throw new hK("Async disposables cannot be used with configureSync().");if(Symbol.dispose in Y)q50.add(Y)}M36(Q);let J=iG.getLogger(["logtape","meta"]);if(!B)J.sinks.push(Lm());J.info("LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger is used to log internal diagnostics such as sink exceptions. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.",{metaLoggerCategory:["logtape","meta"],dismissLevel:"info"})}function _T0(){return N50}function ET(){w50(),O36()}function O36(){let A=iG.getLogger([]);A.resetDescendants(),delete A.contextLocalStorage,ur1.clear(),N50=null}async function I50(){w50();let A=[];for(let Q of Om)A.push(Q[Symbol.asyncDispose]()),Om.delete(Q);await Promise.all(A)}function w50(){for(let A of q50)A[Symbol.dispose]();q50.clear()}var N50=null,ur1,q50,Om,hK;var hr1=o(()=>{br1();G50();PT0();ur1=new Set,q50=new Set,Om=new Set;hK=class extends Error{constructor(A){super(A);this.name="ConfigureError"}}});var C50=o(()=>{G50();RT0();PT0();hr1()});var gr1,j36,j;var d0=o(()=>{C50();IB();if(_T0()===null)jm({sinks:{console:Lm({formatter:(A)=>{let Q=Mm(A);return Object.keys(A.properties).length>0?[...Q,A.properties]:Q}})},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},{category:[],sinks:["console"]}]});gr1=DT.union([DT.literal("error"),DT.literal("warn"),DT.literal("info"),DT.literal("debug")]),j36=CT0(),j=j36});import T36 from"os";import M50 from"path";var LH,WM,OH,zT,bV3,uV3,hV3,k36,S36;var L50=o(()=>{LH=T36.homedir(),{env:WM}=process,OH=WM.XDG_DATA_HOME||(LH?M50.join(LH,".local","share"):void 0),zT=WM.XDG_CONFIG_HOME||(LH?M50.join(LH,".config"):void 0),bV3=WM.XDG_STATE_HOME||(LH?M50.join(LH,".local","state"):void 0),uV3=WM.XDG_CACHE_HOME||(LH?M50.join(LH,".cache"):void 0),hV3=WM.XDG_RUNTIME_DIR||void 0,k36=(WM.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(OH)k36.unshift(OH);S36=(WM.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(zT)S36.unshift(zT)});import{homedir as O50}from"node:os";import gK from"node:path";var mr1,v36,pr1,y36,WT,f36,Rm,x36,b$;var kZ=o(()=>{L50();mr1=gK.join(O50(),".local/share"),v36=process.platform==="win32"||process.platform==="darwin"?mr1:OH??mr1,pr1=gK.join(O50(),".config"),y36=process.platform==="win32"||process.platform==="darwin"?pr1:zT??pr1,WT=gK.join(v36,"amp"),f36=gK.join(y36,"amp"),Rm=gK.join(f36,"tools"),x36=process.platform==="win32"?gK.join(process.env.LOCALAPPDATA??gK.join(O50(),"AppData","Local"),"amp"):gK.join(process.env.XDG_CACHE_HOME??gK.join(O50(),".cache"),"amp"),b$=x36});function b36(A){return A.trim().toLowerCase()}function f7(A){let Q=b36(A);if(Q.length===0)return!1;if(Q.endsWith("@ampcode.com")||Q==="auth-bypass-user@example.com")return!0;return!1}function D4(A,Q,B=Q+"s"){return A===1?Q:B}var Z3=()=>{};function j50(A){Promise.resolve().then(()=>{try{A()}catch(Q){console.error(Q)}})}function lr1(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 vT0(A){A._observer=void 0,A._queue=void 0,A._state="closed"}function h36(A){let Q=A._queue;if(!Q)return;A._queue=void 0,A._state="ready";for(let B of Q)if(ir1(A,B.type,B.value),A._state==="closed")break}function ir1(A,Q,B){A._state="running";let $=A._observer;try{switch(Q){case"next":if($&&typeof $.next==="function")$.next(B);break;case"error":if(vT0(A),$&&typeof $.error==="function")$.error(B);else throw B;break;case"complete":if(vT0(A),$&&typeof $.complete==="function")$.complete();break}}catch(J){console.error("notifySubscription",J)}if(A._state==="closed")lr1(A);else if(A._state==="running")A._state="ready"}function ST0(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}],j50(()=>h36(A));return}ir1(A,Q,B)}class nr1{_cleanup;_observer;_queue;_state;constructor(A,Q){this._cleanup=void 0,this._observer=A,this._queue=void 0,this._state="initializing";let B=new ar1(this);try{this._cleanup=Q.call(void 0,B)}catch($){B.error($)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")vT0(this),lr1(this)}}class ar1{_subscription;constructor(A){this._subscription=A}get closed(){return this._subscription._state==="closed"}next(A){ST0(this._subscription,"next",A)}error(A){ST0(this._subscription,"error",A)}complete(){ST0(this._subscription,"complete")}}function J8(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=[],$=(Y)=>B.push(Y),J=Promise.resolve().then(async()=>{await Q,await A($),this._pendingPromises.delete(J);for(let Y of B)this._baseObserver.next(Y)}).catch((Y)=>{this._pendingPromises.delete(J),this._baseObserver.error(Y)});this._pendingPromises.add(J)}}var u0;var qT=o(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");u0=class u0{_subscriber;constructor(A){if(!(this instanceof u0))throw TypeError("Observable cannot be called as a function");if(typeof A!=="function")throw 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 nr1(A,this._subscriber)}pipe(A,...Q){let B=this;for(let $ of[A,...Q])B=$(B);return B}[Symbol.observable](){return this}static from(A){let Q=typeof u0==="function"?u0:u0;if(A==null)throw TypeError(A+" is not an object");let B=A[Symbol.observable];if(typeof B==="function"){let J=B.call(A);if(Object(J)!==J)throw TypeError(J+" is not an object");if(J instanceof u0)return J;return new Q((Y)=>J.subscribe(Y))}let $=A[Symbol.iterator];if(typeof $==="function")return new Q((J)=>{j50(()=>{if(J.closed)return;for(let Y of $.call(A))if(J.next(Y),J.closed)return;J.complete()})});if(Array.isArray(A))return new Q((J)=>{j50(()=>{if(J.closed)return;for(let Y of A)if(J.next(Y),J.closed)return;J.complete()})});throw TypeError(A+" is not observable")}static of(...A){return new(typeof u0==="function"?u0:u0)((B)=>{j50(()=>{if(B.closed)return;for(let $ of A)if(B.next($),B.closed)return;B.complete()})})}static get[Symbol.species](){return u0}}});var d4,n1;var R50=o(()=>{qT();d4=class d4 extends u0{_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()}};n1=class n1 extends d4{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 $={};if(A)$.next=A;if(Q)$.error=Q;if(B)$.complete=B;A=$}return A.next?.(this.currentValue),super.subscribe(A)}getValue(){return this.currentValue}}});var g36,yT0;var or1=o(()=>{qT();R50();g36=class g36 extends Set{subject=new n1(this);add(A){return super.add(A),this.subject.next(this),this}delete(A){let Q=super.delete(A);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return u0.from(this.subject)}dispose(){this.subject.complete()}};yT0=class yT0 extends Map{subject=new n1(this);set(A,Q){return super.set(A,Q),this.subject.next(this),this}delete(A){let Q=super.delete(A);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return u0.from(this.subject)}dispose(){this.subject.complete()}}});function P50(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),$=Array.isArray(Q);if(B!==$)return!1;if(B&&$)return A.length===Q.length&&A.every((Y,Z)=>P50(Y,Q[Z]));let J=new Set([...Object.keys(A),...Object.keys(Q)]);for(let Y of J)if(!P50(A[Y],Q[Y]))return!1;return!0}var _50;var fT0=o(()=>{_50={now:()=>Date.now(),schedule:(A,Q)=>{let B=setTimeout(A,Q);return()=>clearTimeout(B)}}});async function S1(A,Q){return new Promise((B,$)=>{let J,Y=()=>{J?.unsubscribe(),$(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",Y,{once:!0}),J=A.subscribe({next:(Z)=>{J?.unsubscribe(),Q?.removeEventListener("abort",Y),B(Z)},error:(Z)=>{Q?.removeEventListener("abort",Y),$(Z)},complete:()=>{Q?.removeEventListener("abort",Y),$("Observable completed without emitting a value")}})})}async function jH(A,Q){return new Promise((B,$)=>{let J,Y=!1,Z,F=()=>{Z?.unsubscribe(),$(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",F,{once:!0}),Z=A.subscribe({next:(X)=>{J=X,Y=!0},error:(X)=>{Q?.removeEventListener("abort",F),$(X)},complete:()=>{if(Q?.removeEventListener("abort",F),Y)B(J);else $("Observable completed without emitting a value")}})})}async function sr1(A,Q){return new Promise((B,$)=>{let J=A.subscribe({error:$,complete:()=>B()});Q?.addEventListener("abort",()=>{J.unsubscribe(),$(new DOMException("Aborted","AbortError"))},{once:!0})})}function z8(A){return new u0((Q)=>{A.then((B)=>{Q.next(B),Q.complete()}).catch((B)=>{Q.error(B)})})}function YA(A){return new u0((Q)=>{let B=!1,$=new AbortController,J=$.signal;return(async()=>{try{J?.throwIfAborted();let Z=await A(J);if(J?.throwIfAborted(),!B)Q.next(Z),Q.complete()}catch(Z){if(!B)if(J.aborted)Q.complete();else Q.error(Z)}})(),()=>{B=!0,$.abort()}})}function w1(A){return(Q)=>{return new u0((B)=>{let $=new HT(B),J=0,Y=Q.subscribe({complete(){$.complete()},error(Z){$.error(Z)},next(Z){$.schedule(async(F)=>{let X=await A(Z,J);J++,F(X)})}});return()=>J8(Y)})}}function NT(A,Q=_50){return new u0((B)=>{let $=0,J=null,Y=()=>{B.next($++),J=Q.schedule(Y,A)};return J=Q.schedule(Y,A),()=>{if(J)J()}})}function mK(...A){return new u0((Q)=>{let B=0,$=A.map((J)=>J.subscribe({next:(Y)=>Q.next(Y),error:(Y)=>Q.error(Y),complete:()=>{if(B++,B===A.length)Q.complete()}}));return()=>{tr1($)}})}function M6(...A){if(A.length===0)return _m;return new u0((Q)=>{let B=Array(A.length),$=Array(A.length).fill(0),J=Array(A.length).fill(!1),Y=0,Z=[],F=new HT(Q);for(let X=0;X<A.length;X++){let D=A[X];Z.push(D.subscribe({next(G){B[X]=G,J[X]=!0;let V=++$[X];if(J.every(Boolean))F.schedule(async(U)=>{if($[X]===V)U([...B])})},error(G){F.error(G)},complete(){if(Y++,Y===A.length)F.complete()}}))}return()=>{tr1(Z)}})}function rA(A){let B=A?.shouldCountRefs??!0,$=m36++,J=(Y,...Z)=>{};return(Y)=>{let Z=new d4,F=null,X=!1,D,G=0;return new u0((V)=>{if(G++,X)J("new subscriber, emitting buffered value",D),V.next(D);else J("new subscriber, no buffered value to emit");if(!F)F=Y.subscribe({next:(K)=>{X=!0,D=K,Z.next(K)},error:(K)=>Z.error(K),complete:()=>Z.complete()});let U=Z.subscribe(V);return()=>{if(G--,U.unsubscribe(),B&&G===0){if(F)J8(F),F=null;X=!1}}})}}function tr1(A){for(let Q of A)if(Q)J8(Q)}function pK(A){return(Q)=>{return new u0((B)=>{let $=Q.subscribe({next:(Y)=>B.next(Y),error:(Y)=>B.error(Y),complete:()=>B.complete()}),J=A.subscribe({next:()=>{B.complete(),$.unsubscribe(),J.unsubscribe()},error:(Y)=>{B.error(Y),$.unsubscribe()}});return()=>{$.unsubscribe(),J.unsubscribe()}})}}function RH(A){return(Q)=>{return new u0((B)=>{let $,J=Q.subscribe({next(Y){$=Y,B.next(Y)},error(Y){B.error(Y)},complete(){B.complete()}});return()=>{J8(J),A($)}})}}function T4(A=P50){return(Q)=>{return new u0((B)=>{let $=rr1,J=new HT(B),Y=Q.subscribe({complete(){J.complete()},error(Z){J.error(Z)},next(Z){J.schedule(async(F)=>{if($===rr1||!A($,Z))$=Z,F(Z)})}});return()=>J8(Y)})}}function IT(A){return p36(typeof A==="function"?{next:A}:A)}function p36(A){return(Q)=>new u0((B)=>{let $=typeof A==="function"?A():A,J=Q.subscribe({next(Y){if($.next)try{$.next(Y)}catch(Z){B.error(Z);return}B.next(Y)},error(Y){if($.error)try{$.error(Y)}catch(Z){B.error(Z);return}B.error(Y)},complete(){if($.complete)try{$.complete()}catch(Y){B.error(Y);return}B.complete()}});return()=>J8(J)})}function CB(A){return(Q)=>{return new u0((B)=>{let $=!1,J=Q.subscribe({next:(Z)=>{$=!0,clearTimeout(Y),B.next(Z)},error:(Z)=>{clearTimeout(Y),B.error(Z)},complete:()=>{clearTimeout(Y),B.complete()}}),Y=setTimeout(()=>{if(!$)J.unsubscribe(),B.error(new T50(`Operation timed out after ${A}ms`))},A);return()=>{clearTimeout(Y),J.unsubscribe()}})}}function W6(A){return(Q)=>new u0((B)=>{let $;try{B.next(A),$=Q.subscribe({next(J){B.next(J)},error(J){B.error(J)},complete(){B.complete()}})}catch(J){B.error(J)}return()=>{if($)J8($)}})}function M2(A){return(Q)=>new u0((B)=>{let $=0,J=Q.subscribe({next(Y){if($<A){if(B.next(Y),$++,$===A)B.complete(),J8(J)}},error(Y){B.error(Y)},complete(){B.complete()}});return()=>{J8(J)}})}function er1(A){return(Q)=>new u0((B)=>{let $=0,J=Q.subscribe({next(Y){if($>=A)B.next(Y);else $++},error(Y){B.error(Y)},complete(){B.complete()}});return()=>{J8(J)}})}function f4(A){return(Q)=>{return new u0((B)=>{let $=0,J=null,Y=!1,Z=()=>{if(Y&&!J)B.complete()},F=Q.subscribe({next(X){if(J)J8(J),J=null;let D;try{D=A(X,$++)}catch(G){B.error(G);return}J=D.subscribe({next(G){B.next(G)},error(G){B.error(G)},complete(){J=null,Z()}})},error(X){B.error(X)},complete(){Y=!0,Z()}});return()=>{if(J8(F),J)J8(J)}})}}function dK(A,Q){let B=Q?.scheduler??_50;return($)=>new u0((J)=>{let Y=null,Z=null,F=!1,X=$.subscribe({next:(D)=>{if(Z=D,F=!0,Y===null)Y=B.schedule(()=>{if(F)J.next(Z),F=!1;Y=null},A)},error:(D)=>J.error(D),complete:()=>{if(Y!==null)Y();if(F)J.next(Z);J.complete()}});return()=>{if(J8(X),Y!==null)Y()}})}function bT0(A,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");let B=Q.scheduler??_50;return($)=>new u0((J)=>{let Y=0,Z=null,F=null,X=!1,D=$.subscribe({next:(G)=>{let V=B.now();if(F=G,X=!0,V-Y>=A)J.next(G),Y=V,X=!1;else if(Z===null)Z=B.schedule(()=>{if(X)J.next(F),Y=B.now(),X=!1;Z=null},A-(V-Y));if(Y===0)J.next(G),Y=V,X=!1},error:(G)=>J.error(G),complete:()=>{if(Z!==null)Z();if(X)J.next(F);J.complete()}});return()=>{if(J8(D),Z!==null)Z()}})}function Tm(...A){return new u0((Q)=>{let B=0,$=null;function J(){if(B>=A.length){Q.complete();return}$=A[B].subscribe({next:(Z)=>Q.next(Z),error:(Z)=>Q.error(Z),complete:()=>{B++,J()}})}return J(),()=>{if($)J8($)}})}function PH(A){return(Q)=>new u0((B)=>{let $=0,J=!1,Y=null,Z=Q.subscribe({next(F){try{let X=A(F,$++);if(Y)J8(Y);Y=X.subscribe({next(D){B.next(D)},error(D){B.error(D)},complete(){if(Y=null,J&&!Y)B.complete()}})}catch(X){B.error(X)}},error(F){B.error(F)},complete(){if(J=!0,!Y)B.complete()}});return()=>{if(J8(Z),Y)J8(Y)}})}function km({onSubscribe:A,onUnsubscribe:Q}){return(B)=>new u0(($)=>{A?.();let J=B.subscribe($);return()=>{J8(J),Q?.()}})}function Sm(A){return(Q)=>u0.from(Q).pipe(f4((B)=>YA(($)=>A(B,$))))}function MB(A){return(Q)=>new u0((B)=>{let $,J=Q.subscribe({next(Y){B.next(Y)},error(Y){try{$=A(Y).subscribe({next(F){B.next(F)},error(F){B.error(F)},complete(){B.complete()}})}catch(Z){B.error(Z)}},complete(){B.complete()}});return()=>{if(J8(J),$)J8($)}})}function d5(A){return(Q)=>{return new u0((B)=>{let $=Q.subscribe({next(J){if(A(J))B.next(J)},error(J){B.error(J)},complete(){B.complete()}});return()=>J8($)})}}function As1(A,Q){return(B)=>{return new u0(($)=>{let J,Y=0,Z=new HT($),F=B.subscribe({complete(){Z.complete()},error(X){Z.error(X)},next(X){Z.schedule(async(D)=>{J=await A(Y===0?typeof Q>"u"?X:Q:J,X,Y++),D(J)})}});return()=>J8(F)})}}var _m,xT0,m36=0,rr1,T50;var uT0=o(()=>{qT();fT0();R50();_m=new u0((A)=>{A.complete()}),xT0=new u0(()=>{});rr1={};T50=class T50 extends Error{constructor(A="Timeout has occurred"){super(A);this.name="TimeoutError"}}});function wT(A,Q){return(B)=>{return u0.from(B).pipe(f4(($)=>$===nG?u0.of(nG):A($).pipe(MB((J)=>u0.of(J instanceof Error?J:Error(J))),W6(nG))),rA(Q))}}function hT0(){return(A)=>u0.from(A).pipe(d5((Q)=>Q!==nG))}async function Qs1(A,Q){let B=await S1(u0.from(A).pipe(hT0()),Q);if(B instanceof Error)throw B;return B}var nG;var Bs1=o(()=>{qT();uT0();nG=Symbol.for("@@pendingOperation")});var $s1=()=>{};var Js1=()=>{};var R1=o(()=>{or1();qT();Bs1();uT0();$s1();fT0();R50();Js1()});function r36(){let A=typeof process==="object"?process.env.ProgramData:void 0;return A?`${A}\\ampcode`:"C:\\ProgramData\\ampcode"}function aT0(A){switch(A){case"darwin":return"/Library/Application Support/ampcode";case"android":case"cygwin":case"freebsd":case"netbsd":case"openbsd":case"linux":return"/etc/ampcode";case"win32":return r36();case"aix":case"haiku":case"sunos":default:return null}}function Us1(A){return aT0(A)}function SZ(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),$=Array.isArray(Q);if(B!==$)return!1;if(B&&$)return A.length===Q.length&&A.every((Y,Z)=>SZ(Y,Q[Z]));let J=new Set([...Object.keys(A),...Object.keys(Q)]);for(let Y of J)if(!SZ(A[Y],Q[Y]))return!1;return!0}class AY{#A=!1;#Q=[];async acquire(){return new Promise((A)=>{if(!this.#A)this.#A=!0,A();else this.#Q.push(A)})}release(){if(this.#Q.length>0)this.#Q.shift()?.();else this.#A=!1}}var LB;var OT=o(()=>{LB={BITBUCKET_ENTERPRISE:"bitbucket-enterprise",CUSTOMER_MODEL_PROVIDER_KEYS:"customer-model-provider-keys",ACCEPT_ABUSE_DATA_RETENTION:"accept-abuse-data-retention",HARNESS_SYSTEM_PROMPT:"harness-system-prompt",NAMESPACE_REPOSITORIES_PAGE:"namespace-repositories-page",NAMESPACE_SKILLS_PAGE:"namespace-skills-page",OPENAI_REGIONAL_NONENT:"openai-regional-nonent",PAYMENT_METHOD_EXEMPT:"payment-method-exempt",PIERRE_DIFFS:"pierre-diffs",THREAD_ACTORS_TUI:"thread-actors-tui",THREAD_ACTORS_TRACES:"thread-actors-traces",V2:"v2",SERVER_PLUGINS:"server-plugins",THREAD_TIMING:"thread-timing",THREAD_TRACE_VIEWER:"thread-trace-viewer",USAGE_TOKEN_COUNT:"usage-token-count",WORKSPACE_ROLES:"workspace-roles"}});function kT(A){let Q=A.length;while(--Q>=0)A[Q]=0}function sT0(A,Q,B,$,J){this.static_tree=A,this.extra_bits=Q,this.extra_base=B,this.elems=$,this.max_length=J,this.has_stree=A&&A.length}function tT0(A,Q){this.dyn_tree=A,this.max_code=0,this.stat_desc=Q}function aG(A,Q,B,$,J){this.good_length=A,this.max_lazy=Q,this.nice_length=B,this.max_chain=$,this.func=J}function D26(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=l50,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(A26*2),this.dyn_dtree=new Uint16Array((2*t86+1)*2),this.bl_tree=new Uint16Array((2*e86+1)*2),TH(this.dyn_ltree),TH(this.dyn_dtree),TH(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Q26+1),this.heap=new Uint16Array(2*Kk0+1),TH(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Kk0+1),TH(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k26(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Ap(A){this.options=i50.assign({level:b26,method:h26,chunkSize:16384,windowBits:15,memLevel:8,strategy:u26},A||{});let Q=this.options;if(Q.raw&&Q.windowBits>0)Q.windowBits=-Q.windowBits;else if(Q.gzip&&Q.windowBits>0&&Q.windowBits<16)Q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ot1,this.strm.avail_out=0;let B=pm.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(B!==d50)throw Error(wM[B]);if(Q.header)pm.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){let $;if(typeof Q.dictionary==="string")$=rm.string2buf(Q.dictionary);else if(jt1.call(Q.dictionary)==="[object ArrayBuffer]")$=new Uint8Array(Q.dictionary);else $=Q.dictionary;if(B=pm.deflateSetDictionary(this.strm,$),B!==d50)throw Error(wM[B]);this._dict_set=!0}}function Lk0(A,Q){let B=new Ap(Q);if(B.push(A,!0),B.err)throw B.msg||wM[B.err];return B.result}function g26(A,Q){return Q=Q||{},Q.raw=!0,Lk0(A,Q)}function m26(A,Q){return Q=Q||{},Q.gzip=!0,Lk0(A,Q)}function G96(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function R96(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function Qp(A){this.options=i50.assign({chunkSize:65536,windowBits:15,to:""},A||{});let Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!(A&&A.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ot1,this.strm.avail_out=0;let B=iK.inflateInit2(this.strm,Q.windowBits);if(B!==sm)throw Error(wM[B]);if(this.header=new P96,iK.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=rm.string2buf(Q.dictionary);else if(ut1.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(B=iK.inflateSetDictionary(this.strm,Q.dictionary),B!==sm)throw Error(wM[B])}}}function Ok0(A,Q){let B=new Qp(Q);if(B.push(A),B.err)throw B.msg||wM[B.err];return B.result}function v96(A,Q){return Q=Q||{},Q.raw=!0,Ok0(A,Q)}var X86=0,Jt1=1,D86=2,G86=3,V86=258,Nk0=29,tm=256,cm,PT=30,Ik0=19,Yt1,qM=15,rT0=16,U86=7,wk0=256,Zt1=16,Ft1=17,Xt1=18,Gk0,m50,K86,Dt1,E86=512,lK,mm,lm,im,Ck0,p50,Gt1,Vt1,Ut1,Kt1=(A)=>{return A<256?lm[A]:lm[256+(A>>>7)]},nm=(A,Q)=>{A.pending_buf[A.pending++]=Q&255,A.pending_buf[A.pending++]=Q>>>8&255},u$=(A,Q,B)=>{if(A.bi_valid>rT0-B)A.bi_buf|=Q<<A.bi_valid&65535,nm(A,A.bi_buf),A.bi_buf=Q>>rT0-A.bi_valid,A.bi_valid+=B-rT0;else A.bi_buf|=Q<<A.bi_valid&65535,A.bi_valid+=B},oG=(A,Q,B)=>{u$(A,B[Q*2],B[Q*2+1])},Et1=(A,Q)=>{let B=0;do B|=A&1,A>>>=1,B<<=1;while(--Q>0);return B>>>1},z86=(A)=>{if(A.bi_valid===16)nm(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0;else if(A.bi_valid>=8)A.pending_buf[A.pending++]=A.bi_buf&255,A.bi_buf>>=8,A.bi_valid-=8},W86=(A,Q)=>{let{dyn_tree:B,max_code:$}=Q,J=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,Z=Q.stat_desc.extra_bits,F=Q.stat_desc.extra_base,X=Q.stat_desc.max_length,D,G,V,U,K,E,z=0;for(U=0;U<=qM;U++)A.bl_count[U]=0;B[A.heap[A.heap_max]*2+1]=0;for(D=A.heap_max+1;D<Yt1;D++){if(G=A.heap[D],U=B[B[G*2+1]*2+1]+1,U>X)U=X,z++;if(B[G*2+1]=U,G>$)continue;if(A.bl_count[U]++,K=0,G>=F)K=Z[G-F];if(E=B[G*2],A.opt_len+=E*(U+K),Y)A.static_len+=E*(J[G*2+1]+K)}if(z===0)return;do{U=X-1;while(A.bl_count[U]===0)U--;A.bl_count[U]--,A.bl_count[U+1]+=2,A.bl_count[X]--,z-=2}while(z>0);for(U=X;U!==0;U--){G=A.bl_count[U];while(G!==0){if(V=A.heap[--D],V>$)continue;if(B[V*2+1]!==U)A.opt_len+=(U-B[V*2+1])*B[V*2],B[V*2+1]=U;G--}}},zt1=(A,Q,B)=>{let $=Array(qM+1),J=0,Y,Z;for(Y=1;Y<=qM;Y++)J=J+B[Y-1]<<1,$[Y]=J;for(Z=0;Z<=Q;Z++){let F=A[Z*2+1];if(F===0)continue;A[Z*2]=Et1($[F]++,F)}},H86=()=>{let A,Q,B,$,J,Y=Array(qM+1);B=0;for($=0;$<Nk0-1;$++){Ck0[$]=B;for(A=0;A<1<<Gk0[$];A++)im[B++]=$}im[B-1]=$,J=0;for($=0;$<16;$++){p50[$]=J;for(A=0;A<1<<m50[$];A++)lm[J++]=$}J>>=7;for(;$<PT;$++){p50[$]=J<<7;for(A=0;A<1<<m50[$]-7;A++)lm[256+J++]=$}for(Q=0;Q<=qM;Q++)Y[Q]=0;A=0;while(A<=143)lK[A*2+1]=8,A++,Y[8]++;while(A<=255)lK[A*2+1]=9,A++,Y[9]++;while(A<=279)lK[A*2+1]=7,A++,Y[7]++;while(A<=287)lK[A*2+1]=8,A++,Y[8]++;zt1(lK,cm+1,Y);for(A=0;A<PT;A++)mm[A*2+1]=5,mm[A*2]=Et1(A,5);Gt1=new sT0(lK,Gk0,tm+1,cm,qM),Vt1=new sT0(mm,m50,0,PT,qM),Ut1=new sT0([],K86,0,Ik0,U86)},Wt1=(A)=>{let Q;for(Q=0;Q<cm;Q++)A.dyn_ltree[Q*2]=0;for(Q=0;Q<PT;Q++)A.dyn_dtree[Q*2]=0;for(Q=0;Q<Ik0;Q++)A.bl_tree[Q*2]=0;A.dyn_ltree[wk0*2]=1,A.opt_len=A.static_len=0,A.sym_next=A.matches=0},Ht1=(A)=>{if(A.bi_valid>8)nm(A,A.bi_buf);else if(A.bi_valid>0)A.pending_buf[A.pending++]=A.bi_buf;A.bi_buf=0,A.bi_valid=0},Is1=(A,Q,B,$)=>{let J=Q*2,Y=B*2;return A[J]<A[Y]||A[J]===A[Y]&&$[Q]<=$[B]},eT0=(A,Q,B)=>{let $=A.heap[B],J=B<<1;while(J<=A.heap_len){if(J<A.heap_len&&Is1(Q,A.heap[J+1],A.heap[J],A.depth))J++;if(Is1(Q,$,A.heap[J],A.depth))break;A.heap[B]=A.heap[J],B=J,J<<=1}A.heap[B]=$},ws1=(A,Q,B)=>{let $,J,Y=0,Z,F;if(A.sym_next!==0)do if($=A.pending_buf[A.sym_buf+Y++]&255,$+=(A.pending_buf[A.sym_buf+Y++]&255)<<8,J=A.pending_buf[A.sym_buf+Y++],$===0)oG(A,J,Q);else{if(Z=im[J],oG(A,Z+tm+1,Q),F=Gk0[Z],F!==0)J-=Ck0[Z],u$(A,J,F);if($--,Z=Kt1($),oG(A,Z,B),F=m50[Z],F!==0)$-=p50[Z],u$(A,$,F)}while(Y<A.sym_next);oG(A,wk0,Q)},Vk0=(A,Q)=>{let B=Q.dyn_tree,$=Q.stat_desc.static_tree,J=Q.stat_desc.has_stree,Y=Q.stat_desc.elems,Z,F,X=-1,D;A.heap_len=0,A.heap_max=Yt1;for(Z=0;Z<Y;Z++)if(B[Z*2]!==0)A.heap[++A.heap_len]=X=Z,A.depth[Z]=0;else B[Z*2+1]=0;while(A.heap_len<2)if(D=A.heap[++A.heap_len]=X<2?++X:0,B[D*2]=1,A.depth[D]=0,A.opt_len--,J)A.static_len-=$[D*2+1];Q.max_code=X;for(Z=A.heap_len>>1;Z>=1;Z--)eT0(A,B,Z);D=Y;do Z=A.heap[1],A.heap[1]=A.heap[A.heap_len--],eT0(A,B,1),F=A.heap[1],A.heap[--A.heap_max]=Z,A.heap[--A.heap_max]=F,B[D*2]=B[Z*2]+B[F*2],A.depth[D]=(A.depth[Z]>=A.depth[F]?A.depth[Z]:A.depth[F])+1,B[Z*2+1]=B[F*2+1]=D,A.heap[1]=D++,eT0(A,B,1);while(A.heap_len>=2);A.heap[--A.heap_max]=A.heap[1],W86(A,Q),zt1(B,X,A.bl_count)},Cs1=(A,Q,B)=>{let $,J=-1,Y,Z=Q[1],F=0,X=7,D=4;if(Z===0)X=138,D=3;Q[(B+1)*2+1]=65535;for($=0;$<=B;$++){if(Y=Z,Z=Q[($+1)*2+1],++F<X&&Y===Z)continue;else if(F<D)A.bl_tree[Y*2]+=F;else if(Y!==0){if(Y!==J)A.bl_tree[Y*2]++;A.bl_tree[Zt1*2]++}else if(F<=10)A.bl_tree[Ft1*2]++;else A.bl_tree[Xt1*2]++;if(F=0,J=Y,Z===0)X=138,D=3;else if(Y===Z)X=6,D=3;else X=7,D=4}},Ms1=(A,Q,B)=>{let $,J=-1,Y,Z=Q[1],F=0,X=7,D=4;if(Z===0)X=138,D=3;for($=0;$<=B;$++){if(Y=Z,Z=Q[($+1)*2+1],++F<X&&Y===Z)continue;else if(F<D)do oG(A,Y,A.bl_tree);while(--F!==0);else if(Y!==0){if(Y!==J)oG(A,Y,A.bl_tree),F--;oG(A,Zt1,A.bl_tree),u$(A,F-3,2)}else if(F<=10)oG(A,Ft1,A.bl_tree),u$(A,F-3,3);else oG(A,Xt1,A.bl_tree),u$(A,F-11,7);if(F=0,J=Y,Z===0)X=138,D=3;else if(Y===Z)X=6,D=3;else X=7,D=4}},q86=(A)=>{let Q;Cs1(A,A.dyn_ltree,A.l_desc.max_code),Cs1(A,A.dyn_dtree,A.d_desc.max_code),Vk0(A,A.bl_desc);for(Q=Ik0-1;Q>=3;Q--)if(A.bl_tree[Dt1[Q]*2+1]!==0)break;return A.opt_len+=3*(Q+1)+5+5+4,Q},N86=(A,Q,B,$)=>{let J;u$(A,Q-257,5),u$(A,B-1,5),u$(A,$-4,4);for(J=0;J<$;J++)u$(A,A.bl_tree[Dt1[J]*2+1],3);Ms1(A,A.dyn_ltree,Q-1),Ms1(A,A.dyn_dtree,B-1)},I86=(A)=>{let Q=4093624447,B;for(B=0;B<=31;B++,Q>>>=1)if(Q&1&&A.dyn_ltree[B*2]!==0)return 0;if(A.dyn_ltree[18]!==0||A.dyn_ltree[20]!==0||A.dyn_ltree[26]!==0)return 1;for(B=32;B<tm;B++)if(A.dyn_ltree[B*2]!==0)return 1;return 0},Ls1=!1,w86=(A)=>{if(!Ls1)H86(),Ls1=!0;A.l_desc=new tT0(A.dyn_ltree,Gt1),A.d_desc=new tT0(A.dyn_dtree,Vt1),A.bl_desc=new tT0(A.bl_tree,Ut1),A.bi_buf=0,A.bi_valid=0,Wt1(A)},qt1=(A,Q,B,$)=>{if(u$(A,(X86<<1)+($?1:0),3),Ht1(A),nm(A,B),nm(A,~B),B)A.pending_buf.set(A.window.subarray(Q,Q+B),A.pending);A.pending+=B},C86=(A)=>{u$(A,Jt1<<1,3),oG(A,wk0,lK),z86(A)},M86=(A,Q,B,$)=>{let J,Y,Z=0;if(A.level>0){if(A.strm.data_type===2)A.strm.data_type=I86(A);if(Vk0(A,A.l_desc),Vk0(A,A.d_desc),Z=q86(A),J=A.opt_len+3+7>>>3,Y=A.static_len+3+7>>>3,Y<=J)J=Y}else J=Y=B+5;if(B+4<=J&&Q!==-1)qt1(A,Q,B,$);else if(A.strategy===4||Y===J)u$(A,(Jt1<<1)+($?1:0),3),ws1(A,lK,mm);else u$(A,(D86<<1)+($?1:0),3),N86(A,A.l_desc.max_code+1,A.d_desc.max_code+1,Z+1),ws1(A,A.dyn_ltree,A.dyn_dtree);if(Wt1(A),$)Ht1(A)},L86=(A,Q,B)=>{if(A.pending_buf[A.sym_buf+A.sym_next++]=Q,A.pending_buf[A.sym_buf+A.sym_next++]=Q>>8,A.pending_buf[A.sym_buf+A.sym_next++]=B,Q===0)A.dyn_ltree[B*2]++;else A.matches++,Q--,A.dyn_ltree[(im[B]+tm+1)*2]++,A.dyn_dtree[Kt1(Q)*2]++;return A.sym_next===A.sym_end},O86,j86,R86,P86,_86,T86,k86=(A,Q,B,$)=>{let J=A&65535|0,Y=A>>>16&65535|0,Z=0;while(B!==0){Z=B>2000?2000:B,B-=Z;do J=J+Q[$++]|0,Y=Y+J|0;while(--Z);J%=65521,Y%=65521}return J|Y<<16|0},am,S86=()=>{let A,Q=[];for(var B=0;B<256;B++){A=B;for(var $=0;$<8;$++)A=A&1?3988292384^A>>>1:A>>>1;Q[B]=A}return Q},v86,y86=(A,Q,B,$)=>{let J=v86,Y=$+B;A^=-1;for(let Z=$;Z<Y;Z++)A=A>>>8^J[(A^Q[Z])&255];return A^-1},t9,wM,LM,f86,Uk0,x86,SH,b86,vH,u86,h86,vZ,Os1,x7,js1,rG,g86,Ak0,m86,p86,x50,d86,c86,l86,i86,l50,n86=9,a86=15,o86=8,r86=29,s86=256,Kk0,t86=30,e86=19,A26,Q26=15,B5=3,kH=258,sG,B26=32,_T=42,Mk0=57,Ek0=69,zk0=73,Wk0=91,Hk0=103,NM=113,hm=666,OB=1,ST=2,CM=3,vT=4,$26=3,IM=(A,Q)=>{return A.msg=wM[Q],Q},Rs1=(A)=>{return A*2-(A>4?9:0)},TH=(A)=>{let Q=A.length;while(--Q>=0)A[Q]=0},J26=(A)=>{let Q,B,$,J=A.w_size;Q=A.hash_size,$=Q;do B=A.head[--$],A.head[$]=B>=J?B-J:0;while(--Q);Q=J,$=Q;do B=A.prev[--$],A.prev[$]=B>=J?B-J:0;while(--Q)},Y26=(A,Q,B)=>(Q<<A.hash_shift^B)&A.hash_mask,yH,QY=(A)=>{let Q=A.state,B=Q.pending;if(B>A.avail_out)B=A.avail_out;if(B===0)return;if(A.output.set(Q.pending_buf.subarray(Q.pending_out,Q.pending_out+B),A.next_out),A.next_out+=B,Q.pending_out+=B,A.total_out+=B,A.avail_out-=B,Q.pending-=B,Q.pending===0)Q.pending_out=0},BY=(A,Q)=>{x86(A,A.block_start>=0?A.block_start:-1,A.strstart-A.block_start,Q),A.block_start=A.strstart,QY(A.strm)},c5=(A,Q)=>{A.pending_buf[A.pending++]=Q},um=(A,Q)=>{A.pending_buf[A.pending++]=Q>>>8&255,A.pending_buf[A.pending++]=Q&255},qk0=(A,Q,B,$)=>{let J=A.avail_in;if(J>$)J=$;if(J===0)return 0;if(A.avail_in-=J,Q.set(A.input.subarray(A.next_in,A.next_in+J),B),A.state.wrap===1)A.adler=am(A.adler,Q,J,B);else if(A.state.wrap===2)A.adler=t9(A.adler,Q,J,B);return A.next_in+=J,A.total_in+=J,J},Nt1=(A,Q)=>{let{max_chain_length:B,strstart:$}=A,J,Y,Z=A.prev_length,F=A.nice_match,X=A.strstart>A.w_size-sG?A.strstart-(A.w_size-sG):0,D=A.window,G=A.w_mask,V=A.prev,U=A.strstart+kH,K=D[$+Z-1],E=D[$+Z];if(A.prev_length>=A.good_match)B>>=2;if(F>A.lookahead)F=A.lookahead;do{if(J=Q,D[J+Z]!==E||D[J+Z-1]!==K||D[J]!==D[$]||D[++J]!==D[$+1])continue;$+=2,J++;do;while(D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&$<U);if(Y=kH-(U-$),$=U-kH,Y>Z){if(A.match_start=Q,Z=Y,Y>=F)break;K=D[$+Z-1],E=D[$+Z]}}while((Q=V[Q&G])>X&&--B!==0);if(Z<=A.lookahead)return Z;return A.lookahead},TT=(A)=>{let Q=A.w_size,B,$,J;do{if($=A.window_size-A.lookahead-A.strstart,A.strstart>=Q+(Q-sG)){if(A.window.set(A.window.subarray(Q,Q+Q-$),0),A.match_start-=Q,A.strstart-=Q,A.block_start-=Q,A.insert>A.strstart)A.insert=A.strstart;J26(A),$+=Q}if(A.strm.avail_in===0)break;if(B=qk0(A.strm,A.window,A.strstart+A.lookahead,$),A.lookahead+=B,A.lookahead+A.insert>=B5){J=A.strstart-A.insert,A.ins_h=A.window[J],A.ins_h=yH(A,A.ins_h,A.window[J+1]);while(A.insert)if(A.ins_h=yH(A,A.ins_h,A.window[J+B5-1]),A.prev[J&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=J,J++,A.insert--,A.lookahead+A.insert<B5)break}}while(A.lookahead<sG&&A.strm.avail_in!==0)},It1=(A,Q)=>{let B=A.pending_buf_size-5>A.w_size?A.w_size:A.pending_buf_size-5,$,J,Y,Z=0,F=A.strm.avail_in;do{if($=65535,Y=A.bi_valid+42>>3,A.strm.avail_out<Y)break;if(Y=A.strm.avail_out-Y,J=A.strstart-A.block_start,$>J+A.strm.avail_in)$=J+A.strm.avail_in;if($>Y)$=Y;if($<B&&($===0&&Q!==vZ||Q===vH||$!==J+A.strm.avail_in))break;if(Z=Q===vZ&&$===J+A.strm.avail_in?1:0,Uk0(A,0,0,Z),A.pending_buf[A.pending-4]=$,A.pending_buf[A.pending-3]=$>>8,A.pending_buf[A.pending-2]=~$,A.pending_buf[A.pending-1]=~$>>8,QY(A.strm),J){if(J>$)J=$;A.strm.output.set(A.window.subarray(A.block_start,A.block_start+J),A.strm.next_out),A.strm.next_out+=J,A.strm.avail_out-=J,A.strm.total_out+=J,A.block_start+=J,$-=J}if($)qk0(A.strm,A.strm.output,A.strm.next_out,$),A.strm.next_out+=$,A.strm.avail_out-=$,A.strm.total_out+=$}while(Z===0);if(F-=A.strm.avail_in,F){if(F>=A.w_size)A.matches=2,A.window.set(A.strm.input.subarray(A.strm.next_in-A.w_size,A.strm.next_in),0),A.strstart=A.w_size,A.insert=A.strstart;else{if(A.window_size-A.strstart<=F){if(A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2)A.matches++;if(A.insert>A.strstart)A.insert=A.strstart}A.window.set(A.strm.input.subarray(A.strm.next_in-F,A.strm.next_in),A.strstart),A.strstart+=F,A.insert+=F>A.w_size-A.insert?A.w_size-A.insert:F}A.block_start=A.strstart}if(A.high_water<A.strstart)A.high_water=A.strstart;if(Z)return vT;if(Q!==vH&&Q!==vZ&&A.strm.avail_in===0&&A.strstart===A.block_start)return ST;if(Y=A.window_size-A.strstart,A.strm.avail_in>Y&&A.block_start>=A.w_size){if(A.block_start-=A.w_size,A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2)A.matches++;if(Y+=A.w_size,A.insert>A.strstart)A.insert=A.strstart}if(Y>A.strm.avail_in)Y=A.strm.avail_in;if(Y)qk0(A.strm,A.window,A.strstart,Y),A.strstart+=Y,A.insert+=Y>A.w_size-A.insert?A.w_size-A.insert:Y;if(A.high_water<A.strstart)A.high_water=A.strstart;if(Y=A.bi_valid+42>>3,Y=A.pending_buf_size-Y>65535?65535:A.pending_buf_size-Y,B=Y>A.w_size?A.w_size:Y,J=A.strstart-A.block_start,J>=B||(J||Q===vZ)&&Q!==vH&&A.strm.avail_in===0&&J<=Y)$=J>Y?Y:J,Z=Q===vZ&&A.strm.avail_in===0&&$===J?1:0,Uk0(A,A.block_start,$,Z),A.block_start+=$,QY(A.strm);return Z?CM:OB},Qk0=(A,Q)=>{let B,$;for(;;){if(A.lookahead<sG){if(TT(A),A.lookahead<sG&&Q===vH)return OB;if(A.lookahead===0)break}if(B=0,A.lookahead>=B5)A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;if(B!==0&&A.strstart-B<=A.w_size-sG)A.match_length=Nt1(A,B);if(A.match_length>=B5)if($=SH(A,A.strstart-A.match_start,A.match_length-B5),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=B5){A.match_length--;do A.strstart++,A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;while(--A.match_length!==0);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=yH(A,A.ins_h,A.window[A.strstart+1]);else $=SH(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if($){if(BY(A,!1),A.strm.avail_out===0)return OB}}if(A.insert=A.strstart<B5-1?A.strstart:B5-1,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},jT=(A,Q)=>{let B,$,J;for(;;){if(A.lookahead<sG){if(TT(A),A.lookahead<sG&&Q===vH)return OB;if(A.lookahead===0)break}if(B=0,A.lookahead>=B5)A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;if(A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=B5-1,B!==0&&A.prev_length<A.max_lazy_match&&A.strstart-B<=A.w_size-sG){if(A.match_length=Nt1(A,B),A.match_length<=5&&(A.strategy===p86||A.match_length===B5&&A.strstart-A.match_start>4096))A.match_length=B5-1}if(A.prev_length>=B5&&A.match_length<=A.prev_length){J=A.strstart+A.lookahead-B5,$=SH(A,A.strstart-1-A.prev_match,A.prev_length-B5),A.lookahead-=A.prev_length-1,A.prev_length-=2;do if(++A.strstart<=J)A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;while(--A.prev_length!==0);if(A.match_available=0,A.match_length=B5-1,A.strstart++,$){if(BY(A,!1),A.strm.avail_out===0)return OB}}else if(A.match_available){if($=SH(A,0,A.window[A.strstart-1]),$)BY(A,!1);if(A.strstart++,A.lookahead--,A.strm.avail_out===0)return OB}else A.match_available=1,A.strstart++,A.lookahead--}if(A.match_available)$=SH(A,0,A.window[A.strstart-1]),A.match_available=0;if(A.insert=A.strstart<B5-1?A.strstart:B5-1,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},Z26=(A,Q)=>{let B,$,J,Y,Z=A.window;for(;;){if(A.lookahead<=kH){if(TT(A),A.lookahead<=kH&&Q===vH)return OB;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=B5&&A.strstart>0){if(J=A.strstart-1,$=Z[J],$===Z[++J]&&$===Z[++J]&&$===Z[++J]){Y=A.strstart+kH;do;while($===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&J<Y);if(A.match_length=kH-(Y-J),A.match_length>A.lookahead)A.match_length=A.lookahead}}if(A.match_length>=B5)B=SH(A,1,A.match_length-B5),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0;else B=SH(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(B){if(BY(A,!1),A.strm.avail_out===0)return OB}}if(A.insert=0,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},F26=(A,Q)=>{let B;for(;;){if(A.lookahead===0){if(TT(A),A.lookahead===0){if(Q===vH)return OB;break}}if(A.match_length=0,B=SH(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,B){if(BY(A,!1),A.strm.avail_out===0)return OB}}if(A.insert=0,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},gm,X26=(A)=>{A.window_size=2*A.w_size,TH(A.head),A.max_lazy_match=gm[A.level].max_lazy,A.good_match=gm[A.level].good_length,A.nice_match=gm[A.level].nice_length,A.max_chain_length=gm[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=B5-1,A.match_available=0,A.ins_h=0},em=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.status!==_T&&Q.status!==Mk0&&Q.status!==Ek0&&Q.status!==zk0&&Q.status!==Wk0&&Q.status!==Hk0&&Q.status!==NM&&Q.status!==hm)return 1;return 0},wt1=(A)=>{if(em(A))return IM(A,rG);A.total_in=A.total_out=0,A.data_type=i86;let Q=A.state;if(Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap===2?Mk0:Q.wrap?_T:NM,A.adler=Q.wrap===2?0:1,Q.last_flush=-2,f86(Q),x7},Ct1=(A)=>{let Q=wt1(A);if(Q===x7)X26(A.state);return Q},G26=(A,Q)=>{if(em(A)||A.state.wrap!==2)return rG;return A.state.gzhead=Q,x7},Mt1=(A,Q,B,$,J,Y)=>{if(!A)return rG;let Z=1;if(Q===m86)Q=6;if($<0)Z=0,$=-$;else if($>15)Z=2,$-=16;if(J<1||J>n86||B!==l50||$<8||$>15||Q<0||Q>9||Y<0||Y>c86||$===8&&Z!==1)return IM(A,rG);if($===8)$=9;let F=new D26;return A.state=F,F.strm=A,F.status=_T,F.wrap=Z,F.gzhead=null,F.w_bits=$,F.w_size=1<<F.w_bits,F.w_mask=F.w_size-1,F.hash_bits=J+7,F.hash_size=1<<F.hash_bits,F.hash_mask=F.hash_size-1,F.hash_shift=~~((F.hash_bits+B5-1)/B5),F.window=new Uint8Array(F.w_size*2),F.head=new Uint16Array(F.hash_size),F.prev=new Uint16Array(F.w_size),F.lit_bufsize=1<<J+6,F.pending_buf_size=F.lit_bufsize*4,F.pending_buf=new Uint8Array(F.pending_buf_size),F.sym_buf=F.lit_bufsize,F.sym_end=(F.lit_bufsize-1)*3,F.level=Q,F.strategy=Y,F.method=B,Ct1(A)},V26=(A,Q)=>{return Mt1(A,Q,l50,a86,o86,l86)},U26=(A,Q)=>{if(em(A)||Q>Os1||Q<0)return A?IM(A,rG):rG;let B=A.state;if(!A.output||A.avail_in!==0&&!A.input||B.status===hm&&Q!==vZ)return IM(A,A.avail_out===0?Ak0:rG);let $=B.last_flush;if(B.last_flush=Q,B.pending!==0){if(QY(A),A.avail_out===0)return B.last_flush=-1,x7}else if(A.avail_in===0&&Rs1(Q)<=Rs1($)&&Q!==vZ)return IM(A,Ak0);if(B.status===hm&&A.avail_in!==0)return IM(A,Ak0);if(B.status===_T&&B.wrap===0)B.status=NM;if(B.status===_T){let J=l50+(B.w_bits-8<<4)<<8,Y=-1;if(B.strategy>=x50||B.level<2)Y=0;else if(B.level<6)Y=1;else if(B.level===6)Y=2;else Y=3;if(J|=Y<<6,B.strstart!==0)J|=B26;if(J+=31-J%31,um(B,J),B.strstart!==0)um(B,A.adler>>>16),um(B,A.adler&65535);if(A.adler=1,B.status=NM,QY(A),B.pending!==0)return B.last_flush=-1,x7}if(B.status===Mk0)if(A.adler=0,c5(B,31),c5(B,139),c5(B,8),!B.gzhead){if(c5(B,0),c5(B,0),c5(B,0),c5(B,0),c5(B,0),c5(B,B.level===9?2:B.strategy>=x50||B.level<2?4:0),c5(B,$26),B.status=NM,QY(A),B.pending!==0)return B.last_flush=-1,x7}else{if(c5(B,(B.gzhead.text?1:0)+(B.gzhead.hcrc?2:0)+(!B.gzhead.extra?0:4)+(!B.gzhead.name?0:8)+(!B.gzhead.comment?0:16)),c5(B,B.gzhead.time&255),c5(B,B.gzhead.time>>8&255),c5(B,B.gzhead.time>>16&255),c5(B,B.gzhead.time>>24&255),c5(B,B.level===9?2:B.strategy>=x50||B.level<2?4:0),c5(B,B.gzhead.os&255),B.gzhead.extra&&B.gzhead.extra.length)c5(B,B.gzhead.extra.length&255),c5(B,B.gzhead.extra.length>>8&255);if(B.gzhead.hcrc)A.adler=t9(A.adler,B.pending_buf,B.pending,0);B.gzindex=0,B.status=Ek0}if(B.status===Ek0){if(B.gzhead.extra){let J=B.pending,Y=(B.gzhead.extra.length&65535)-B.gzindex;while(B.pending+Y>B.pending_buf_size){let F=B.pending_buf_size-B.pending;if(B.pending_buf.set(B.gzhead.extra.subarray(B.gzindex,B.gzindex+F),B.pending),B.pending=B.pending_buf_size,B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);if(B.gzindex+=F,QY(A),B.pending!==0)return B.last_flush=-1,x7;J=0,Y-=F}let Z=new Uint8Array(B.gzhead.extra);if(B.pending_buf.set(Z.subarray(B.gzindex,B.gzindex+Y),B.pending),B.pending+=Y,B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);B.gzindex=0}B.status=zk0}if(B.status===zk0){if(B.gzhead.name){let J=B.pending,Y;do{if(B.pending===B.pending_buf_size){if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);if(QY(A),B.pending!==0)return B.last_flush=-1,x7;J=0}if(B.gzindex<B.gzhead.name.length)Y=B.gzhead.name.charCodeAt(B.gzindex++)&255;else Y=0;c5(B,Y)}while(Y!==0);if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);B.gzindex=0}B.status=Wk0}if(B.status===Wk0){if(B.gzhead.comment){let J=B.pending,Y;do{if(B.pending===B.pending_buf_size){if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);if(QY(A),B.pending!==0)return B.last_flush=-1,x7;J=0}if(B.gzindex<B.gzhead.comment.length)Y=B.gzhead.comment.charCodeAt(B.gzindex++)&255;else Y=0;c5(B,Y)}while(Y!==0);if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J)}B.status=Hk0}if(B.status===Hk0){if(B.gzhead.hcrc){if(B.pending+2>B.pending_buf_size){if(QY(A),B.pending!==0)return B.last_flush=-1,x7}c5(B,A.adler&255),c5(B,A.adler>>8&255),A.adler=0}if(B.status=NM,QY(A),B.pending!==0)return B.last_flush=-1,x7}if(A.avail_in!==0||B.lookahead!==0||Q!==vH&&B.status!==hm){let J=B.level===0?It1(B,Q):B.strategy===x50?F26(B,Q):B.strategy===d86?Z26(B,Q):gm[B.level].func(B,Q);if(J===CM||J===vT)B.status=hm;if(J===OB||J===CM){if(A.avail_out===0)B.last_flush=-1;return x7}if(J===ST){if(Q===u86)b86(B);else if(Q!==Os1){if(Uk0(B,0,0,!1),Q===h86){if(TH(B.head),B.lookahead===0)B.strstart=0,B.block_start=0,B.insert=0}}if(QY(A),A.avail_out===0)return B.last_flush=-1,x7}}if(Q!==vZ)return x7;if(B.wrap<=0)return js1;if(B.wrap===2)c5(B,A.adler&255),c5(B,A.adler>>8&255),c5(B,A.adler>>16&255),c5(B,A.adler>>24&255),c5(B,A.total_in&255),c5(B,A.total_in>>8&255),c5(B,A.total_in>>16&255),c5(B,A.total_in>>24&255);else um(B,A.adler>>>16),um(B,A.adler&65535);if(QY(A),B.wrap>0)B.wrap=-B.wrap;return B.pending!==0?x7:js1},K26=(A)=>{if(em(A))return rG;let Q=A.state.status;return A.state=null,Q===NM?IM(A,g86):x7},E26=(A,Q)=>{let B=Q.length;if(em(A))return rG;let $=A.state,J=$.wrap;if(J===2||J===1&&$.status!==_T||$.lookahead)return rG;if(J===1)A.adler=am(A.adler,Q,B,0);if($.wrap=0,B>=$.w_size){if(J===0)TH($.head),$.strstart=0,$.block_start=0,$.insert=0;let X=new Uint8Array($.w_size);X.set(Q.subarray(B-$.w_size,B),0),Q=X,B=$.w_size}let{avail_in:Y,next_in:Z,input:F}=A;A.avail_in=B,A.next_in=0,A.input=Q,TT($);while($.lookahead>=B5){let X=$.strstart,D=$.lookahead-(B5-1);do $.ins_h=yH($,$.ins_h,$.window[X+B5-1]),$.prev[X&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=X,X++;while(--D);$.strstart=X,$.lookahead=B5-1,TT($)}return $.strstart+=$.lookahead,$.block_start=$.strstart,$.insert=$.lookahead,$.lookahead=0,$.match_length=$.prev_length=B5-1,$.match_available=0,A.next_in=Z,A.input=F,A.avail_in=Y,$.wrap=J,x7},z26,W26,H26,q26,N26,I26,w26,C26,M26="pako deflate (from Nodeca project)",pm,L26=(A,Q)=>{return Object.prototype.hasOwnProperty.call(A,Q)},O26=function(A){let Q=Array.prototype.slice.call(arguments,1);while(Q.length){let B=Q.shift();if(!B)continue;if(typeof B!=="object")throw TypeError(B+"must be non-object");for(let $ in B)if(L26(B,$))A[$]=B[$]}return A},j26=(A)=>{let Q=0;for(let $=0,J=A.length;$<J;$++)Q+=A[$].length;let B=new Uint8Array(Q);for(let $=0,J=0,Y=A.length;$<Y;$++){let Z=A[$];B.set(Z,J),J+=Z.length}return B},i50,Lt1=!0,om,R26=(A)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(A);let Q,B,$,J,Y,Z=A.length,F=0;for(J=0;J<Z;J++){if(B=A.charCodeAt(J),(B&64512)===55296&&J+1<Z){if($=A.charCodeAt(J+1),($&64512)===56320)B=65536+(B-55296<<10)+($-56320),J++}F+=B<128?1:B<2048?2:B<65536?3:4}Q=new Uint8Array(F);for(Y=0,J=0;Y<F;J++){if(B=A.charCodeAt(J),(B&64512)===55296&&J+1<Z){if($=A.charCodeAt(J+1),($&64512)===56320)B=65536+(B-55296<<10)+($-56320),J++}if(B<128)Q[Y++]=B;else if(B<2048)Q[Y++]=192|B>>>6,Q[Y++]=128|B&63;else if(B<65536)Q[Y++]=224|B>>>12,Q[Y++]=128|B>>>6&63,Q[Y++]=128|B&63;else Q[Y++]=240|B>>>18,Q[Y++]=128|B>>>12&63,Q[Y++]=128|B>>>6&63,Q[Y++]=128|B&63}return Q},P26=(A,Q)=>{if(Q<65534){if(A.subarray&&Lt1)return String.fromCharCode.apply(null,A.length===Q?A:A.subarray(0,Q))}let B="";for(let $=0;$<Q;$++)B+=String.fromCharCode(A[$]);return B},_26=(A,Q)=>{let B=Q||A.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(A.subarray(0,Q));let $,J,Y=Array(B*2);for(J=0,$=0;$<B;){let Z=A[$++];if(Z<128){Y[J++]=Z;continue}let F=om[Z];if(F>4){Y[J++]=65533,$+=F-1;continue}Z&=F===2?31:F===3?15:7;while(F>1&&$<B)Z=Z<<6|A[$++]&63,F--;if(F>1){Y[J++]=65533;continue}if(Z<65536)Y[J++]=Z;else Z-=65536,Y[J++]=55296|Z>>10&1023,Y[J++]=56320|Z&1023}return P26(Y,J)},T26=(A,Q)=>{if(Q=Q||A.length,Q>A.length)Q=A.length;let B=Q-1;while(B>=0&&(A[B]&192)===128)B--;if(B<0)return Q;if(B===0)return Q;return B+om[A[B]]>Q?B:Q},rm,Ot1,jt1,S26,v26,y26,f26,d50,x26,b26,u26,h26,p26,d26,c26,l26,i26,n26,b50=16209,a26=16191,o26=function(Q,B){let $,J,Y,Z,F,X,D,G,V,U,K,E,z,W,H,q,N,I,w,O,L,R,v,T,f=Q.state;$=Q.next_in,v=Q.input,J=$+(Q.avail_in-5),Y=Q.next_out,T=Q.output,Z=Y-(B-Q.avail_out),F=Y+(Q.avail_out-257),X=f.dmax,D=f.wsize,G=f.whave,V=f.wnext,U=f.window,K=f.hold,E=f.bits,z=f.lencode,W=f.distcode,H=(1<<f.lenbits)-1,q=(1<<f.distbits)-1;A:do{if(E<15)K+=v[$++]<<E,E+=8,K+=v[$++]<<E,E+=8;N=z[K&H];Q:for(;;){if(I=N>>>24,K>>>=I,E-=I,I=N>>>16&255,I===0)T[Y++]=N&65535;else if(I&16){if(w=N&65535,I&=15,I){if(E<I)K+=v[$++]<<E,E+=8;w+=K&(1<<I)-1,K>>>=I,E-=I}if(E<15)K+=v[$++]<<E,E+=8,K+=v[$++]<<E,E+=8;N=W[K&q];B:for(;;){if(I=N>>>24,K>>>=I,E-=I,I=N>>>16&255,I&16){if(O=N&65535,I&=15,E<I){if(K+=v[$++]<<E,E+=8,E<I)K+=v[$++]<<E,E+=8}if(O+=K&(1<<I)-1,O>X){Q.msg="invalid distance too far back",f.mode=b50;break A}if(K>>>=I,E-=I,I=Y-Z,O>I){if(I=O-I,I>G){if(f.sane){Q.msg="invalid distance too far back",f.mode=b50;break A}}if(L=0,R=U,V===0){if(L+=D-I,I<w){w-=I;do T[Y++]=U[L++];while(--I);L=Y-O,R=T}}else if(V<I){if(L+=D+V-I,I-=V,I<w){w-=I;do T[Y++]=U[L++];while(--I);if(L=0,V<w){I=V,w-=I;do T[Y++]=U[L++];while(--I);L=Y-O,R=T}}}else if(L+=V-I,I<w){w-=I;do T[Y++]=U[L++];while(--I);L=Y-O,R=T}while(w>2)T[Y++]=R[L++],T[Y++]=R[L++],T[Y++]=R[L++],w-=3;if(w){if(T[Y++]=R[L++],w>1)T[Y++]=R[L++]}}else{L=Y-O;do T[Y++]=T[L++],T[Y++]=T[L++],T[Y++]=T[L++],w-=3;while(w>2);if(w){if(T[Y++]=T[L++],w>1)T[Y++]=T[L++]}}}else if((I&64)===0){N=W[(N&65535)+(K&(1<<I)-1)];continue B}else{Q.msg="invalid distance code",f.mode=b50;break A}break}}else if((I&64)===0){N=z[(N&65535)+(K&(1<<I)-1)];continue Q}else if(I&32){f.mode=a26;break A}else{Q.msg="invalid literal/length code",f.mode=b50;break A}break}}while($<J&&Y<F);w=E>>3,$-=w,E-=w<<3,K&=(1<<E)-1,Q.next_in=$,Q.next_out=Y,Q.avail_in=$<J?5+(J-$):5-($-J),Q.avail_out=Y<F?257+(F-Y):257-(Y-F),f.hold=K,f.bits=E;return},RT=15,Ps1=852,_s1=592,Ts1=0,Bk0=1,ks1=2,r26,s26,t26,e26,A96=(A,Q,B,$,J,Y,Z,F)=>{let X=F.bits,D=0,G=0,V=0,U=0,K=0,E=0,z=0,W=0,H=0,q=0,N,I,w,O,L,R=null,v,T=new Uint16Array(RT+1),f=new Uint16Array(RT+1),g=null,u,k,b;for(D=0;D<=RT;D++)T[D]=0;for(G=0;G<$;G++)T[Q[B+G]]++;K=X;for(U=RT;U>=1;U--)if(T[U]!==0)break;if(K>U)K=U;if(U===0)return J[Y++]=20971520,J[Y++]=20971520,F.bits=1,0;for(V=1;V<U;V++)if(T[V]!==0)break;if(K<V)K=V;W=1;for(D=1;D<=RT;D++)if(W<<=1,W-=T[D],W<0)return-1;if(W>0&&(A===Ts1||U!==1))return-1;f[1]=0;for(D=1;D<RT;D++)f[D+1]=f[D]+T[D];for(G=0;G<$;G++)if(Q[B+G]!==0)Z[f[Q[B+G]]++]=G;if(A===Ts1)R=g=Z,v=20;else if(A===Bk0)R=r26,g=s26,v=257;else R=t26,g=e26,v=0;if(q=0,G=0,D=V,L=Y,E=K,z=0,w=-1,H=1<<K,O=H-1,A===Bk0&&H>Ps1||A===ks1&&H>_s1)return 1;for(;;){if(u=D-z,Z[G]+1<v)k=0,b=Z[G];else if(Z[G]>=v)k=g[Z[G]-v],b=R[Z[G]-v];else k=96,b=0;N=1<<D-z,I=1<<E,V=I;do I-=N,J[L+(q>>z)+I]=u<<24|k<<16|b|0;while(I!==0);N=1<<D-1;while(q&N)N>>=1;if(N!==0)q&=N-1,q+=N;else q=0;if(G++,--T[D]===0){if(D===U)break;D=Q[B+Z[G]]}if(D>K&&(q&O)!==w){if(z===0)z=K;L+=V,E=D-z,W=1<<E;while(E+z<U){if(W-=T[E+z],W<=0)break;E++,W<<=1}if(H+=1<<E,A===Bk0&&H>Ps1||A===ks1&&H>_s1)return 1;w=q&O,J[w]=K<<24|E<<16|L-Y|0}}if(q!==0)J[L+q]=D-z<<24|4194304|0;return F.bits=K,0},dm,Q96=0,Rt1=1,Pt1=2,Ss1,B96,u50,MM,$96,J96,yZ,_t1,Tt1,Y96,vs1,n50=16180,ys1=16181,fs1=16182,xs1=16183,bs1=16184,us1=16185,hs1=16186,gs1=16187,ms1=16188,ps1=16189,c50=16190,cK=16191,$k0=16192,ds1=16193,Jk0=16194,cs1=16195,ls1=16196,is1=16197,ns1=16198,h50=16199,g50=16200,as1=16201,os1=16202,rs1=16203,ss1=16204,ts1=16205,Yk0=16206,es1=16207,At1=16208,W8=16209,kt1=16210,St1=16211,Z96=852,F96=592,X96=15,D96,Qt1=(A)=>{return(A>>>24&255)+(A>>>8&65280)+((A&65280)<<8)+((A&255)<<24)},OM=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.mode<n50||Q.mode>St1)return 1;return 0},vt1=(A)=>{if(OM(A))return yZ;let Q=A.state;if(A.total_in=A.total_out=Q.total=0,A.msg="",Q.wrap)A.adler=Q.wrap&1;return Q.mode=n50,Q.last=0,Q.havedict=0,Q.flags=-1,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new Int32Array(Z96),Q.distcode=Q.distdyn=new Int32Array(F96),Q.sane=1,Q.back=-1,MM},yt1=(A)=>{if(OM(A))return yZ;let Q=A.state;return Q.wsize=0,Q.whave=0,Q.wnext=0,vt1(A)},ft1=(A,Q)=>{let B;if(OM(A))return yZ;let $=A.state;if(Q<0)B=0,Q=-Q;else if(B=(Q>>4)+5,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return yZ;if($.window!==null&&$.wbits!==Q)$.window=null;return $.wrap=B,$.wbits=Q,yt1(A)},xt1=(A,Q)=>{if(!A)return yZ;let B=new G96;A.state=B,B.strm=A,B.window=null,B.mode=n50;let $=ft1(A,Q);if($!==MM)A.state=null;return $},V96=(A)=>{return xt1(A,D96)},Bt1=!0,Zk0,Fk0,U96=(A)=>{if(Bt1){Zk0=new Int32Array(512),Fk0=new Int32Array(32);let Q=0;while(Q<144)A.lens[Q++]=8;while(Q<256)A.lens[Q++]=9;while(Q<280)A.lens[Q++]=7;while(Q<288)A.lens[Q++]=8;dm(Rt1,A.lens,0,288,Zk0,0,A.work,{bits:9}),Q=0;while(Q<32)A.lens[Q++]=5;dm(Pt1,A.lens,0,32,Fk0,0,A.work,{bits:5}),Bt1=!1}A.lencode=Zk0,A.lenbits=9,A.distcode=Fk0,A.distbits=5},bt1=(A,Q,B,$)=>{let J,Y=A.state;if(Y.window===null)Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new Uint8Array(Y.wsize);if($>=Y.wsize)Y.window.set(Q.subarray(B-Y.wsize,B),0),Y.wnext=0,Y.whave=Y.wsize;else{if(J=Y.wsize-Y.wnext,J>$)J=$;if(Y.window.set(Q.subarray(B-$,B-$+J),Y.wnext),$-=J,$)Y.window.set(Q.subarray(B-$,B),0),Y.wnext=$,Y.whave=Y.wsize;else{if(Y.wnext+=J,Y.wnext===Y.wsize)Y.wnext=0;if(Y.whave<Y.wsize)Y.whave+=J}}return 0},K96=(A,Q)=>{let B,$,J,Y,Z,F,X,D,G,V,U,K,E,z,W=0,H,q,N,I,w,O,L,R,v=new Uint8Array(4),T,f,g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(OM(A)||!A.output||!A.input&&A.avail_in!==0)return yZ;if(B=A.state,B.mode===cK)B.mode=$k0;Z=A.next_out,J=A.output,X=A.avail_out,Y=A.next_in,$=A.input,F=A.avail_in,D=B.hold,G=B.bits,V=F,U=X,R=MM;A:for(;;)switch(B.mode){case n50:if(B.wrap===0){B.mode=$k0;break}while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.wrap&2&&D===35615){if(B.wbits===0)B.wbits=15;B.check=0,v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0),D=0,G=0,B.mode=ys1;break}if(B.head)B.head.done=!1;if(!(B.wrap&1)||(((D&255)<<8)+(D>>8))%31){A.msg="incorrect header check",B.mode=W8;break}if((D&15)!==vs1){A.msg="unknown compression method",B.mode=W8;break}if(D>>>=4,G-=4,L=(D&15)+8,B.wbits===0)B.wbits=L;if(L>15||L>B.wbits){A.msg="invalid window size",B.mode=W8;break}B.dmax=1<<B.wbits,B.flags=0,A.adler=B.check=1,B.mode=D&512?ps1:cK,D=0,G=0;break;case ys1:while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.flags=D,(B.flags&255)!==vs1){A.msg="unknown compression method",B.mode=W8;break}if(B.flags&57344){A.msg="unknown header flags set",B.mode=W8;break}if(B.head)B.head.text=D>>8&1;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0);D=0,G=0,B.mode=fs1;case fs1:while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.head)B.head.time=D;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,v[2]=D>>>16&255,v[3]=D>>>24&255,B.check=t9(B.check,v,4,0);D=0,G=0,B.mode=xs1;case xs1:while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.head)B.head.xflags=D&255,B.head.os=D>>8;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0);D=0,G=0,B.mode=bs1;case bs1:if(B.flags&1024){while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.length=D,B.head)B.head.extra_len=D;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0);D=0,G=0}else if(B.head)B.head.extra=null;B.mode=us1;case us1:if(B.flags&1024){if(K=B.length,K>F)K=F;if(K){if(B.head){if(L=B.head.extra_len-B.length,!B.head.extra)B.head.extra=new Uint8Array(B.head.extra_len);B.head.extra.set($.subarray(Y,Y+K),L)}if(B.flags&512&&B.wrap&4)B.check=t9(B.check,$,K,Y);F-=K,Y+=K,B.length-=K}if(B.length)break A}B.length=0,B.mode=hs1;case hs1:if(B.flags&2048){if(F===0)break A;K=0;do if(L=$[Y+K++],B.head&&L&&B.length<65536)B.head.name+=String.fromCharCode(L);while(L&&K<F);if(B.flags&512&&B.wrap&4)B.check=t9(B.check,$,K,Y);if(F-=K,Y+=K,L)break A}else if(B.head)B.head.name=null;B.length=0,B.mode=gs1;case gs1:if(B.flags&4096){if(F===0)break A;K=0;do if(L=$[Y+K++],B.head&&L&&B.length<65536)B.head.comment+=String.fromCharCode(L);while(L&&K<F);if(B.flags&512&&B.wrap&4)B.check=t9(B.check,$,K,Y);if(F-=K,Y+=K,L)break A}else if(B.head)B.head.comment=null;B.mode=ms1;case ms1:if(B.flags&512){while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.wrap&4&&D!==(B.check&65535)){A.msg="header crc mismatch",B.mode=W8;break}D=0,G=0}if(B.head)B.head.hcrc=B.flags>>9&1,B.head.done=!0;A.adler=B.check=0,B.mode=cK;break;case ps1:while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}A.adler=B.check=Qt1(D),D=0,G=0,B.mode=c50;case c50:if(B.havedict===0)return A.next_out=Z,A.avail_out=X,A.next_in=Y,A.avail_in=F,B.hold=D,B.bits=G,J96;A.adler=B.check=1,B.mode=cK;case cK:if(Q===B96||Q===u50)break A;case $k0:if(B.last){D>>>=G&7,G-=G&7,B.mode=Yk0;break}while(G<3){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}switch(B.last=D&1,D>>>=1,G-=1,D&3){case 0:B.mode=ds1;break;case 1:if(U96(B),B.mode=h50,Q===u50){D>>>=2,G-=2;break A}break;case 2:B.mode=ls1;break;case 3:A.msg="invalid block type",B.mode=W8}D>>>=2,G-=2;break;case ds1:D>>>=G&7,G-=G&7;while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if((D&65535)!==(D>>>16^65535)){A.msg="invalid stored block lengths",B.mode=W8;break}if(B.length=D&65535,D=0,G=0,B.mode=Jk0,Q===u50)break A;case Jk0:B.mode=cs1;case cs1:if(K=B.length,K){if(K>F)K=F;if(K>X)K=X;if(K===0)break A;J.set($.subarray(Y,Y+K),Z),F-=K,Y+=K,X-=K,Z+=K,B.length-=K;break}B.mode=cK;break;case ls1:while(G<14){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.nlen=(D&31)+257,D>>>=5,G-=5,B.ndist=(D&31)+1,D>>>=5,G-=5,B.ncode=(D&15)+4,D>>>=4,G-=4,B.nlen>286||B.ndist>30){A.msg="too many length or distance symbols",B.mode=W8;break}B.have=0,B.mode=is1;case is1:while(B.have<B.ncode){while(G<3){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}B.lens[g[B.have++]]=D&7,D>>>=3,G-=3}while(B.have<19)B.lens[g[B.have++]]=0;if(B.lencode=B.lendyn,B.lenbits=7,T={bits:B.lenbits},R=dm(Q96,B.lens,0,19,B.lencode,0,B.work,T),B.lenbits=T.bits,R){A.msg="invalid code lengths set",B.mode=W8;break}B.have=0,B.mode=ns1;case ns1:while(B.have<B.nlen+B.ndist){for(;;){if(W=B.lencode[D&(1<<B.lenbits)-1],H=W>>>24,q=W>>>16&255,N=W&65535,H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(N<16)D>>>=H,G-=H,B.lens[B.have++]=N;else{if(N===16){f=H+2;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(D>>>=H,G-=H,B.have===0){A.msg="invalid bit length repeat",B.mode=W8;break}L=B.lens[B.have-1],K=3+(D&3),D>>>=2,G-=2}else if(N===17){f=H+3;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=H,G-=H,L=0,K=3+(D&7),D>>>=3,G-=3}else{f=H+7;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=H,G-=H,L=0,K=11+(D&127),D>>>=7,G-=7}if(B.have+K>B.nlen+B.ndist){A.msg="invalid bit length repeat",B.mode=W8;break}while(K--)B.lens[B.have++]=L}}if(B.mode===W8)break;if(B.lens[256]===0){A.msg="invalid code -- missing end-of-block",B.mode=W8;break}if(B.lenbits=9,T={bits:B.lenbits},R=dm(Rt1,B.lens,0,B.nlen,B.lencode,0,B.work,T),B.lenbits=T.bits,R){A.msg="invalid literal/lengths set",B.mode=W8;break}if(B.distbits=6,B.distcode=B.distdyn,T={bits:B.distbits},R=dm(Pt1,B.lens,B.nlen,B.ndist,B.distcode,0,B.work,T),B.distbits=T.bits,R){A.msg="invalid distances set",B.mode=W8;break}if(B.mode=h50,Q===u50)break A;case h50:B.mode=g50;case g50:if(F>=6&&X>=258){if(A.next_out=Z,A.avail_out=X,A.next_in=Y,A.avail_in=F,B.hold=D,B.bits=G,o26(A,U),Z=A.next_out,J=A.output,X=A.avail_out,Y=A.next_in,$=A.input,F=A.avail_in,D=B.hold,G=B.bits,B.mode===cK)B.back=-1;break}B.back=0;for(;;){if(W=B.lencode[D&(1<<B.lenbits)-1],H=W>>>24,q=W>>>16&255,N=W&65535,H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(q&&(q&240)===0){I=H,w=q,O=N;for(;;){if(W=B.lencode[O+((D&(1<<I+w)-1)>>I)],H=W>>>24,q=W>>>16&255,N=W&65535,I+H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=I,G-=I,B.back+=I}if(D>>>=H,G-=H,B.back+=H,B.length=N,q===0){B.mode=ts1;break}if(q&32){B.back=-1,B.mode=cK;break}if(q&64){A.msg="invalid literal/length code",B.mode=W8;break}B.extra=q&15,B.mode=as1;case as1:if(B.extra){f=B.extra;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}B.length+=D&(1<<B.extra)-1,D>>>=B.extra,G-=B.extra,B.back+=B.extra}B.was=B.length,B.mode=os1;case os1:for(;;){if(W=B.distcode[D&(1<<B.distbits)-1],H=W>>>24,q=W>>>16&255,N=W&65535,H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if((q&240)===0){I=H,w=q,O=N;for(;;){if(W=B.distcode[O+((D&(1<<I+w)-1)>>I)],H=W>>>24,q=W>>>16&255,N=W&65535,I+H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=I,G-=I,B.back+=I}if(D>>>=H,G-=H,B.back+=H,q&64){A.msg="invalid distance code",B.mode=W8;break}B.offset=N,B.extra=q&15,B.mode=rs1;case rs1:if(B.extra){f=B.extra;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}B.offset+=D&(1<<B.extra)-1,D>>>=B.extra,G-=B.extra,B.back+=B.extra}if(B.offset>B.dmax){A.msg="invalid distance too far back",B.mode=W8;break}B.mode=ss1;case ss1:if(X===0)break A;if(K=U-X,B.offset>K){if(K=B.offset-K,K>B.whave){if(B.sane){A.msg="invalid distance too far back",B.mode=W8;break}}if(K>B.wnext)K-=B.wnext,E=B.wsize-K;else E=B.wnext-K;if(K>B.length)K=B.length;z=B.window}else z=J,E=Z-B.offset,K=B.length;if(K>X)K=X;X-=K,B.length-=K;do J[Z++]=z[E++];while(--K);if(B.length===0)B.mode=g50;break;case ts1:if(X===0)break A;J[Z++]=B.length,X--,B.mode=g50;break;case Yk0:if(B.wrap){while(G<32){if(F===0)break A;F--,D|=$[Y++]<<G,G+=8}if(U-=X,A.total_out+=U,B.total+=U,B.wrap&4&&U)A.adler=B.check=B.flags?t9(B.check,J,U,Z-U):am(B.check,J,U,Z-U);if(U=X,B.wrap&4&&(B.flags?D:Qt1(D))!==B.check){A.msg="incorrect data check",B.mode=W8;break}D=0,G=0}B.mode=es1;case es1:if(B.wrap&&B.flags){while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.wrap&4&&D!==(B.total&4294967295)){A.msg="incorrect length check",B.mode=W8;break}D=0,G=0}B.mode=At1;case At1:R=$96;break A;case W8:R=_t1;break A;case kt1:return Tt1;case St1:default:return yZ}if(A.next_out=Z,A.avail_out=X,A.next_in=Y,A.avail_in=F,B.hold=D,B.bits=G,B.wsize||U!==A.avail_out&&B.mode<W8&&(B.mode<Yk0||Q!==Ss1)){if(bt1(A,A.output,A.next_out,U-A.avail_out));}if(V-=A.avail_in,U-=A.avail_out,A.total_in+=V,A.total_out+=U,B.total+=U,B.wrap&4&&U)A.adler=B.check=B.flags?t9(B.check,J,U,A.next_out-U):am(B.check,J,U,A.next_out-U);if(A.data_type=B.bits+(B.last?64:0)+(B.mode===cK?128:0)+(B.mode===h50||B.mode===Jk0?256:0),(V===0&&U===0||Q===Ss1)&&R===MM)R=Y96;return R},E96=(A)=>{if(OM(A))return yZ;let Q=A.state;if(Q.window)Q.window=null;return A.state=null,MM},z96=(A,Q)=>{if(OM(A))return yZ;let B=A.state;if((B.wrap&2)===0)return yZ;return B.head=Q,Q.done=!1,MM},W96=(A,Q)=>{let B=Q.length,$,J,Y;if(OM(A))return yZ;if($=A.state,$.wrap!==0&&$.mode!==c50)return yZ;if($.mode===c50){if(J=1,J=am(J,Q,B,0),J!==$.check)return _t1}if(Y=bt1(A,Q,B,B),Y)return $.mode=kt1,Tt1;return $.havedict=1,MM},H96,q96,N96,I96,w96,C96,M96,L96,O96,j96="pako inflate (from Nodeca project)",iK,P96,ut1,_96,T96,sm,Xk0,Dk0,k96,$t1,S96,y96,f96,x96,b96,u96,h96,g96,m96,p96,d96,c96,l96,i96,n96,a96,o96,r96,s96,t96,e96,A76,Q76,B76,ht1;var gt1=o(()=>{/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */cm=tm+1+Nk0,Yt1=2*cm+1,Gk0=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),m50=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),K86=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Dt1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lK=Array((cm+2)*2);kT(lK);mm=Array(PT*2);kT(mm);lm=Array(E86);kT(lm);im=Array(V86-G86+1);kT(im);Ck0=Array(Nk0);kT(Ck0);p50=Array(PT);kT(p50);O86=w86,j86=qt1,R86=M86,P86=L86,_86=C86,T86={_tr_init:O86,_tr_stored_block:j86,_tr_flush_block:R86,_tr_tally:P86,_tr_align:_86},am=k86,v86=new Uint32Array(S86()),t9=y86,wM={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},LM={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:f86,_tr_stored_block:Uk0,_tr_flush_block:x86,_tr_tally:SH,_tr_align:b86}=T86,{Z_NO_FLUSH:vH,Z_PARTIAL_FLUSH:u86,Z_FULL_FLUSH:h86,Z_FINISH:vZ,Z_BLOCK:Os1,Z_OK:x7,Z_STREAM_END:js1,Z_STREAM_ERROR:rG,Z_DATA_ERROR:g86,Z_BUF_ERROR:Ak0,Z_DEFAULT_COMPRESSION:m86,Z_FILTERED:p86,Z_HUFFMAN_ONLY:x50,Z_RLE:d86,Z_FIXED:c86,Z_DEFAULT_STRATEGY:l86,Z_UNKNOWN:i86,Z_DEFLATED:l50}=LM,Kk0=s86+1+r86,A26=2*Kk0+1,sG=kH+B5+1,yH=Y26;gm=[new aG(0,0,0,0,It1),new aG(4,4,8,4,Qk0),new aG(4,5,16,8,Qk0),new aG(4,6,32,32,Qk0),new aG(4,4,16,16,jT),new aG(8,16,32,32,jT),new aG(8,16,128,128,jT),new aG(8,32,128,256,jT),new aG(32,128,258,1024,jT),new aG(32,258,258,4096,jT)];z26=V26,W26=Mt1,H26=Ct1,q26=wt1,N26=G26,I26=U26,w26=K26,C26=E26,pm={deflateInit:z26,deflateInit2:W26,deflateReset:H26,deflateResetKeep:q26,deflateSetHeader:N26,deflate:I26,deflateEnd:w26,deflateSetDictionary:C26,deflateInfo:M26},i50={assign:O26,flattenChunks:j26};try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(A){Lt1=!1}om=new Uint8Array(256);for(let A=0;A<256;A++)om[A]=A>=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;om[254]=om[254]=1;rm={string2buf:R26,buf2string:_26,utf8border:T26};Ot1=k26,jt1=Object.prototype.toString,{Z_NO_FLUSH:S26,Z_SYNC_FLUSH:v26,Z_FULL_FLUSH:y26,Z_FINISH:f26,Z_OK:d50,Z_STREAM_END:x26,Z_DEFAULT_COMPRESSION:b26,Z_DEFAULT_STRATEGY:u26,Z_DEFLATED:h26}=LM;Ap.prototype.push=function(A,Q){let B=this.strm,$=this.options.chunkSize,J,Y;if(this.ended)return!1;if(Q===~~Q)Y=Q;else Y=Q===!0?f26:S26;if(typeof A==="string")B.input=rm.string2buf(A);else if(jt1.call(A)==="[object ArrayBuffer]")B.input=new Uint8Array(A);else B.input=A;B.next_in=0,B.avail_in=B.input.length;for(;;){if(B.avail_out===0)B.output=new Uint8Array($),B.next_out=0,B.avail_out=$;if((Y===v26||Y===y26)&&B.avail_out<=6){this.onData(B.output.subarray(0,B.next_out)),B.avail_out=0;continue}if(J=pm.deflate(B,Y),J===x26){if(B.next_out>0)this.onData(B.output.subarray(0,B.next_out));return J=pm.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===d50}if(B.avail_out===0){this.onData(B.output);continue}if(Y>0&&B.next_out>0){this.onData(B.output.subarray(0,B.next_out)),B.avail_out=0;continue}if(B.avail_in===0)break}return!0};Ap.prototype.onData=function(A){this.chunks.push(A)};Ap.prototype.onEnd=function(A){if(A===d50)this.result=i50.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};p26=Ap,d26=Lk0,c26=g26,l26=m26,i26=LM,n26={Deflate:p26,deflate:d26,deflateRaw:c26,gzip:l26,constants:i26},r26=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),s26=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),t26=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),e26=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),dm=A96,{Z_FINISH:Ss1,Z_BLOCK:B96,Z_TREES:u50,Z_OK:MM,Z_STREAM_END:$96,Z_NEED_DICT:J96,Z_STREAM_ERROR:yZ,Z_DATA_ERROR:_t1,Z_MEM_ERROR:Tt1,Z_BUF_ERROR:Y96,Z_DEFLATED:vs1}=LM,D96=X96;H96=yt1,q96=ft1,N96=vt1,I96=V96,w96=xt1,C96=K96,M96=E96,L96=z96,O96=W96,iK={inflateReset:H96,inflateReset2:q96,inflateResetKeep:N96,inflateInit:I96,inflateInit2:w96,inflate:C96,inflateEnd:M96,inflateGetHeader:L96,inflateSetDictionary:O96,inflateInfo:j96};P96=R96,ut1=Object.prototype.toString,{Z_NO_FLUSH:_96,Z_FINISH:T96,Z_OK:sm,Z_STREAM_END:Xk0,Z_NEED_DICT:Dk0,Z_STREAM_ERROR:k96,Z_DATA_ERROR:$t1,Z_MEM_ERROR:S96}=LM;Qp.prototype.push=function(A,Q){let B=this.strm,$=this.options.chunkSize,J=this.options.dictionary,Y,Z,F;if(this.ended)return!1;if(Q===~~Q)Z=Q;else Z=Q===!0?T96:_96;if(ut1.call(A)==="[object ArrayBuffer]")B.input=new Uint8Array(A);else B.input=A;B.next_in=0,B.avail_in=B.input.length;for(;;){if(B.avail_out===0)B.output=new Uint8Array($),B.next_out=0,B.avail_out=$;if(Y=iK.inflate(B,Z),Y===Dk0&&J){if(Y=iK.inflateSetDictionary(B,J),Y===sm)Y=iK.inflate(B,Z);else if(Y===$t1)Y=Dk0}while(B.avail_in>0&&Y===Xk0&&B.state.wrap>0&&A[B.next_in]!==0)iK.inflateReset(B),Y=iK.inflate(B,Z);switch(Y){case k96:case $t1:case Dk0:case S96:return this.onEnd(Y),this.ended=!0,!1}if(F=B.avail_out,B.next_out){if(B.avail_out===0||Y===Xk0)if(this.options.to==="string"){let X=rm.utf8border(B.output,B.next_out),D=B.next_out-X,G=rm.buf2string(B.output,X);if(B.next_out=D,B.avail_out=$-D,D)B.output.set(B.output.subarray(X,X+D),0);this.onData(G)}else this.onData(B.output.length===B.next_out?B.output:B.output.subarray(0,B.next_out))}if(Y===sm&&F===0)continue;if(Y===Xk0)return Y=iK.inflateEnd(this.strm),this.onEnd(Y),this.ended=!0,!0;if(B.avail_in===0)break}return!0};Qp.prototype.onData=function(A){this.chunks.push(A)};Qp.prototype.onEnd=function(A){if(A===sm)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=i50.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};y96=Qp,f96=Ok0,x96=v96,b96=Ok0,u96=LM,h96={Inflate:y96,inflate:f96,inflateRaw:x96,ungzip:b96,constants:u96},{Deflate:g96,deflate:m96,deflateRaw:p96,gzip:d96}=n26,{Inflate:c96,inflate:l96,inflateRaw:i96,ungzip:n96}=h96,a96=g96,o96=m96,r96=p96,s96=d96,t96=c96,e96=l96,A76=i96,Q76=n96,B76=LM,ht1={Deflate:a96,deflate:o96,deflateRaw:r96,gzip:s96,Inflate:t96,inflate:e96,inflateRaw:A76,ungzip:Q76,constants:B76}});import{randomFillSync as $76}from"crypto";function r50(){if(a50>o50.length-16)$76(o50),a50=0;return o50.slice(a50,a50+=16)}var o50,a50;var mt1=o(()=>{o50=new Uint8Array(256),a50=o50.length});function pt1(A,Q=0){return(b7[A[Q+0]]+b7[A[Q+1]]+b7[A[Q+2]]+b7[A[Q+3]]+"-"+b7[A[Q+4]]+b7[A[Q+5]]+"-"+b7[A[Q+6]]+b7[A[Q+7]]+"-"+b7[A[Q+8]]+b7[A[Q+9]]+"-"+b7[A[Q+10]]+b7[A[Q+11]]+b7[A[Q+12]]+b7[A[Q+13]]+b7[A[Q+14]]+b7[A[Q+15]]).toLowerCase()}var b7;var dt1=o(()=>{b7=[];for(let A=0;A<256;++A)b7.push((A+256).toString(16).slice(1))});function J76(A,Q,B){let $;if(A)$=ct1(A.random??A.rng?.()??r50(),A.msecs,A.seq,Q,B);else{let J=Date.now(),Y=r50();Y76(jk0,J,Y),$=ct1(Y,jk0.msecs,jk0.seq,Q,B)}return Q??pt1($)}function Y76(A,Q,B){if(A.msecs??=-1/0,A.seq??=0,Q>A.msecs)A.seq=B[6]<<23|B[7]<<16|B[8]<<8|B[9],A.msecs=Q;else if(A.seq=A.seq+1|0,A.seq===0)A.msecs++;return A}function ct1(A,Q,B,$,J=0){if(A.length<16)throw Error("Random bytes length must be >= 16");if(!$)$=new Uint8Array(16),J=0;else if(J<0||J+16>$.length)throw RangeError(`UUID byte range ${J}:${J+15} is out of buffer bounds`);return Q??=Date.now(),B??=A[6]*127<<24|A[7]<<16|A[8]<<8|A[9],$[J++]=Q/1099511627776&255,$[J++]=Q/4294967296&255,$[J++]=Q/16777216&255,$[J++]=Q/65536&255,$[J++]=Q/256&255,$[J++]=Q&255,$[J++]=112|B>>>28&15,$[J++]=B>>>20&255,$[J++]=128|B>>>14&63,$[J++]=B>>>6&255,$[J++]=B<<2&255|A[10]&3,$[J++]=A[11],$[J++]=A[12],$[J++]=A[13],$[J++]=A[14],$[J++]=A[15],$}var jk0,yT;var lt1=o(()=>{mt1();dt1();jk0={};yT=J76});var Rk0=o(()=>{lt1()});function Z76(A){let Q=0,B=[];while(Q<A.length){let $=A[Q];if($==="\\"){Q++;continue}if($==="{"){B.push({type:"brace",value:"{"}),Q++;continue}if($==="}"){B.push({type:"brace",value:"}"}),Q++;continue}if($==="["){B.push({type:"paren",value:"["}),Q++;continue}if($==="]"){B.push({type:"paren",value:"]"}),Q++;continue}if($===":"){B.push({type:"separator",value:":"}),Q++;continue}if($===","){B.push({type:"delimiter",value:","}),Q++;continue}if($==='"'){let F="",X=!1;$=A[++Q];while($!=='"'){if(Q===A.length){X=!0;break}if($==="\\"){if(Q++,Q===A.length){X=!0;break}F+=$+A[Q],$=A[++Q]}else F+=$,$=A[++Q]}if($=A[++Q],!X)B.push({type:"string",value:F});continue}if($&&/\s/.test($)){Q++;continue}let Y=/[0-9]/;if($&&Y.test($)||$==="-"||$==="."){let F="";if($==="-")F+=$,$=A[++Q];while($&&Y.test($)||$===".")F+=$,$=A[++Q];B.push({type:"number",value:F});continue}let Z=/[a-z]/i;if($&&Z.test($)){let F="";while($&&Z.test($)){if(Q===A.length)break;F+=$,$=A[++Q]}if(F==="true"||F==="false"||F==="null")B.push({type:"name",value:F});else{Q++;continue}continue}Q++}return B}function fT(A){if(A.length===0)return A;let Q=A[A.length-1];if(!Q)return A;switch(Q.type){case"separator":return fT(A.slice(0,A.length-1));case"number":{let B=Q.value[Q.value.length-1];if(B==="."||B==="-")return fT(A.slice(0,A.length-1));break}case"string":{let B=A[A.length-2];if(B?.type==="delimiter")return fT(A.slice(0,A.length-1));else if(B?.type==="brace"&&B.value==="{")return fT(A.slice(0,A.length-1));break}case"delimiter":return fT(A.slice(0,A.length-1))}return A}function F76(A){let Q=[];for(let B of A){if(B.type==="brace")if(B.value==="{")Q.push("}");else{let $=Q.lastIndexOf("}");if($!==-1)Q.splice($,1)}if(B.type==="paren")if(B.value==="[")Q.push("]");else{let $=Q.lastIndexOf("]");if($!==-1)Q.splice($,1)}}if(Q.length>0){Q.reverse();for(let B of Q)if(B==="}")A.push({type:"brace",value:"}"});else if(B==="]")A.push({type:"paren",value:"]"})}return A}function X76(A){let Q="";for(let B of A)switch(B.type){case"string":Q+='"'+B.value+'"';break;default:Q+=B.value;break}return Q}function s50(A){let Q=X76(F76(fT(Z76(A))));return JSON.parse(Q)}function t50(A){try{let Q=s50(A);if(Q!==null&&typeof Q==="object"&&!Array.isArray(Q))return Q;return{}}catch{return{}}}function e50(A,Q,B="..."){if(A.length<=Q)return A;return A.slice(0,Math.max(0,Q-B.length))+B}function D76(A){let Q=A.match(/^(?:cat\s+)?<<['"]?(\w+)['"]?\s*\n([\s\S]*?)\n\1\s*$/);if(Q)return Q[2];return A}function G76(A,Q){let B=A[Q];if(!B)return null;let $=B.match(/^\*\*\* Add File: (.+)$/);if($)return{filePath:$[1],nextIdx:Q+1};let J=B.match(/^\*\*\* Delete File: (.+)$/);if(J)return{filePath:J[1],nextIdx:Q+1};let Y=B.match(/^\*\*\* Update File: (.+)$/);if(Y){let Z,F=Q+1,X=A[F];if(X){let D=X.match(/^\*\*\* Move to: (.+)$/);if(D)Z=D[1],F++}return{filePath:Y[1],movePath:Z,nextIdx:F}}return null}function Pk0(A){return A.startsWith("*** Add File:")||A.startsWith("*** Update File:")||A.startsWith("*** Delete File:")||A.trim()==="*** End Patch"}function V76(A,Q){let B=[],$=Q;while($<A.length){let J=A[$];if(Pk0(J))break;if(J.startsWith("+"))B.push(J.slice(1));else if(J==="")B.push("");else throw Error(`Invalid patch format: Add File lines must start with '+', got: "${J.slice(0,20)}${J.length>20?"...":""}"`);$++}return{content:B.join(`
|
|
216
|
+
`}function z50(A,Q){if(!(Q instanceof Error))return Q;let B={name:Q.name,message:Q.message};if(typeof Q.stack==="string")B.stack=Q.stack;let $=Q.cause;if($!==void 0)B.cause=$;if(typeof AggregateError<"u"&&Q instanceof AggregateError)B.errors=Q.errors;for(let J of Object.keys(Q))if(!(J in B))B[J]=Q[J];return B}function jT0(A={}){let Q=(()=>{let F=A.timestamp;if(F==null)return E50["date-time-timezone"];else if(F==="disabled")return E50.none;else if(typeof F==="string"&&F in E50)return E50[F];else return F})(),B=A.category??"·",$=A.value?(F)=>A.value(F,Sr1):Sr1,J=(()=>{let F=A.level;if(F==null||F==="ABBR")return(X)=>KT.ABBR[X];else if(F==="abbr")return(X)=>KT.abbr[X];else if(F==="FULL")return(X)=>KT.FULL[X];else if(F==="full")return(X)=>KT.full[X];else if(F==="L")return(X)=>KT.L[X];else if(F==="l")return(X)=>KT.l[X];else return F})(),Y=yr1(A.lineEnding),Z=A.format??(({timestamp:F,level:X,category:D,message:G})=>`${F?`${F} `:""}[${X}] ${D}: ${G}`);return(F)=>{let X=F.message,D=X.length,G;if(D===1)G=X[0];else if(D<=6){G="";for(let z=0;z<D;z++)G+=z%2===0?X[z]:$(X[z])}else{let z=Array(D);for(let W=0;W<D;W++)z[W]=W%2===0?X[W]:$(X[W]);G=z.join("")}let V=Q(F.timestamp),U=J(F.level),K=typeof B==="function"?B(F.category):F.category.join(B);return`${Z({timestamp:V,level:U,category:K,message:G,record:F})}${Y}`}}function fr1(A={}){let Q=A.format,B=typeof A.timestampStyle>"u"?"dim":A.timestampStyle,$=A.timestampColor??null,J=`${B==null?"":OT0[B]}${$==null?"":LT0[$]}`,Y=B==null&&$==null?"":MT0,Z=typeof A.levelStyle>"u"?"bold":A.levelStyle,F=A.levelColors??H36,X=typeof A.categoryStyle>"u"?"dim":A.categoryStyle,D=A.categoryColor??null,G=`${X==null?"":OT0[X]}${D==null?"":LT0[D]}`,V=X==null&&D==null?"":MT0;return jT0({timestamp:"date-time-tz",value(U,K){return K(U,{colors:!0})},...A,format({timestamp:U,level:K,category:E,message:z,record:W}){let H=F[W.level];return U=U==null?null:`${J}${U}${Y}`,K=`${Z==null?"":OT0[Z]}${H==null?"":LT0[H]}${K}${Z==null&&H==null?"":MT0}`,Q==null?`${U==null?"":`${U} `}${K} ${G}${E}:${V} ${z}`:Q({timestamp:U,level:K,category:`${G}${E}${V}`,message:z,record:W})}})}function H50(A={}){let Q=yr1(A.lineEnding);if(!A.categorySeparator&&!A.message&&!A.properties)return(F)=>{if(F.message.length===3)return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:F.message[0]+JSON.stringify(F.message[1])+F.message[2],logger:F.category.join("."),properties:F.properties},z50)+Q;if(F.message.length===1)return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:F.message[0],logger:F.category.join("."),properties:F.properties},z50)+Q;let X=F.message[0];for(let D=1;D<F.message.length;D++)X+=D&1?JSON.stringify(F.message[D]):F.message[D];return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:X,logger:F.category.join("."),properties:F.properties},z50)+Q};let B=A.message==="template",$=A.properties??"nest:properties",J;if(typeof A.categorySeparator==="function")J=A.categorySeparator;else{let F=A.categorySeparator??".";J=(X)=>X.join(F)}let Y;if($==="flatten")Y=(F)=>F;else if($.startsWith("prepend:")){let F=$.substring(8);if(F==="")throw TypeError(`Invalid properties option: ${JSON.stringify($)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);Y=(X)=>{let D={};for(let G in X)D[`${F}${G}`]=X[G];return D}}else if($.startsWith("nest:")){let F=$.substring(5);Y=(X)=>({[F]:X})}else throw TypeError(`Invalid properties option: ${JSON.stringify($)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let Z;if(B)Z=(F)=>{if(typeof F.rawMessage==="string")return F.rawMessage;let X="";for(let D=0;D<F.rawMessage.length;D++)X+=D%2<1?F.rawMessage[D]:"{}";return X};else Z=(F)=>{let X=F.message.length;if(X===1)return F.message[0];let D="";for(let G=0;G<X;G++)D+=G%2<1?F.message[G]:JSON.stringify(F.message[G]);return D};return(F)=>{return JSON.stringify({"@timestamp":new Date(F.timestamp).toISOString(),level:F.level==="warning"?"WARN":F.level.toUpperCase(),message:Z(F),logger:J(F.category),...Y(F.properties)},z50)+Q}}function Mm(A){let Q="",B=[];for(let Y=0;Y<A.message.length;Y++)if(Y%2===0)Q+=A.message[Y];else Q+="%o",B.push(A.message[Y]);let $=new Date(A.timestamp);return[`%c${`${$.getUTCHours().toString().padStart(2,"0")}:${$.getUTCMinutes().toString().padStart(2,"0")}:${$.getUTCSeconds().toString().padStart(2,"0")}.${$.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${vr1[A.level]}%c %c${A.category.join("·")} %c${Q}`,"color: gray;",I36[A.level],"background-color: default;","color: gray;","color: default;",...B]}var vr1,Sr1,E50,KT,W50,MT0="\x1B[0m",LT0,OT0,H36,q36,N36,I36;var RT0=o(()=>{kr1();vr1={trace:"TRC",debug:"DBG",info:"INF",warning:"WRN",error:"ERR",fatal:"FTL"},Sr1=typeof document<"u"||typeof navigator<"u"&&navigator.product==="ReactNative"?(A)=>JSON.stringify(A):("Deno"in globalThis)&&("inspect"in globalThis.Deno)&&typeof globalThis.Deno.inspect==="function"?(A,Q)=>globalThis.Deno.inspect(A,{strAbbreviateSize:1/0,iterableLimit:1/0,...Q}):K50!=null&&("inspect"in K50)&&typeof U50==="function"?(A,Q)=>U50(A,{maxArrayLength:1/0,maxStringLength:1/0,...Q}):(A)=>JSON.stringify(A);E50={"date-time-timezone":(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate()),Y=g3(Q.getUTCHours()),Z=g3(Q.getUTCMinutes()),F=g3(Q.getUTCSeconds()),X=UT(Q.getUTCMilliseconds());return`${B}-${$}-${J} ${Y}:${Z}:${F}.${X} +00:00`},"date-time-tz":(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate()),Y=g3(Q.getUTCHours()),Z=g3(Q.getUTCMinutes()),F=g3(Q.getUTCSeconds()),X=UT(Q.getUTCMilliseconds());return`${B}-${$}-${J} ${Y}:${Z}:${F}.${X} +00`},"date-time":(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate()),Y=g3(Q.getUTCHours()),Z=g3(Q.getUTCMinutes()),F=g3(Q.getUTCSeconds()),X=UT(Q.getUTCMilliseconds());return`${B}-${$}-${J} ${Y}:${Z}:${F}.${X}`},"time-timezone":(A)=>{let Q=new Date(A),B=g3(Q.getUTCHours()),$=g3(Q.getUTCMinutes()),J=g3(Q.getUTCSeconds()),Y=UT(Q.getUTCMilliseconds());return`${B}:${$}:${J}.${Y} +00:00`},"time-tz":(A)=>{let Q=new Date(A),B=g3(Q.getUTCHours()),$=g3(Q.getUTCMinutes()),J=g3(Q.getUTCSeconds()),Y=UT(Q.getUTCMilliseconds());return`${B}:${$}:${J}.${Y} +00`},time:(A)=>{let Q=new Date(A),B=g3(Q.getUTCHours()),$=g3(Q.getUTCMinutes()),J=g3(Q.getUTCSeconds()),Y=UT(Q.getUTCMilliseconds());return`${B}:${$}:${J}.${Y}`},date:(A)=>{let Q=new Date(A),B=Q.getUTCFullYear(),$=g3(Q.getUTCMonth()+1),J=g3(Q.getUTCDate());return`${B}-${$}-${J}`},rfc3339:(A)=>new Date(A).toISOString(),none:()=>null},KT={ABBR:vr1,abbr:{trace:"trc",debug:"dbg",info:"inf",warning:"wrn",error:"err",fatal:"ftl"},FULL:{trace:"TRACE",debug:"DEBUG",info:"INFO",warning:"WARNING",error:"ERROR",fatal:"FATAL"},full:{trace:"trace",debug:"debug",info:"info",warning:"warning",error:"error",fatal:"fatal"},L:{trace:"T",debug:"D",info:"I",warning:"W",error:"E",fatal:"F"},l:{trace:"t",debug:"d",info:"i",warning:"w",error:"e",fatal:"f"}};W50=jT0(),LT0={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},OT0={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",strikethrough:"\x1B[9m"},H36={trace:null,debug:"blue",info:"green",warning:"yellow",error:"red",fatal:"magenta"};q36=fr1();N36=H50(),I36={trace:"background-color: gray; color: white;",debug:"background-color: gray; color: white;",info:"background-color: white; color: black;",warning:"background-color: orange; color: black;",error:"background-color: red; color: white;",fatal:"background-color: maroon; color: white;"}});function xr1(A){if(typeof A==="function")return A;return w36(A)}function w36(A){if(A==null)return()=>!1;if(A==="fatal")return(Q)=>Q.level==="fatal";else if(A==="error")return(Q)=>Q.level==="fatal"||Q.level==="error";else if(A==="warning")return(Q)=>Q.level==="fatal"||Q.level==="error"||Q.level==="warning";else if(A==="info")return(Q)=>Q.level==="fatal"||Q.level==="error"||Q.level==="warning"||Q.level==="info";else if(A==="debug")return(Q)=>Q.level==="fatal"||Q.level==="error"||Q.level==="warning"||Q.level==="info"||Q.level==="debug";else if(A==="trace")return()=>!0;throw TypeError(`Invalid log level: ${A}.`)}var br1=()=>{};function Lm(A={}){let Q=A.formatter??Mm,B={trace:"debug",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"error",...A.levelMap??{}},$=A.console??globalThis.console,J=(H)=>{let q=Q(H),N=B[H.level];if(N===void 0)throw TypeError(`Invalid log level: ${H.level}.`);if(typeof q==="string"){let I=q.replace(/\r?\n$/,"");$[N](I)}else $[N](...q)};if(!A.nonBlocking)return J;let Y=A.nonBlocking===!0?{}:A.nonBlocking,Z=Y.bufferSize??100,F=Y.flushInterval??100,X=[],D=null,G=!1,V=!1,U=Z*2;function K(){if(X.length===0)return;let H=X.splice(0);for(let q of H)try{J(q)}catch{}}function E(){if(V)return;V=!0,setTimeout(()=>{V=!1,K()},0)}function z(){if(D!==null||G)return;D=setInterval(()=>{K()},F)}let W=(H)=>{if(G)return;if(X.length>=U)X.shift();if(X.push(H),X.length>=Z)E();else if(D===null)z()};return W[Symbol.dispose]=()=>{if(G=!0,D!==null)clearInterval(D),D=null;K()},W}var PT0=o(()=>{RT0()});function C36(A){return A.category.length===0||A.category.length===1&&A.category[0]==="logtape"||A.category.length===2&&A.category[0]==="logtape"&&A.category[1]==="meta"}function M36(A){let Q=A?I50:w50;if(typeof globalThis.EdgeRuntime!=="string"&&"process"in globalThis&&!("Deno"in globalThis)){let $=globalThis.process,J=$?.on;if(typeof J==="function"){J.call($,"exit",Q);return}}let B=globalThis.addEventListener;if(typeof B!=="function")return;if("Deno"in globalThis)B.call(globalThis,"unload",Q);else B.call(globalThis,"pagehide",Q)}function jm(A){if(N50!=null&&!A.reset)throw new hK("Already configured; if you want to reset, turn on the reset flag.");if(Om.size>0)throw new hK("Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().");ET();try{L36(A,!1)}catch(Q){if(Q instanceof hK)ET();throw Q}}function L36(A,Q){N50=A;let B=!1,$=new Set;for(let Y of A.loggers){if(C36(Y))B=!0;let Z=Array.isArray(Y.category)?JSON.stringify(Y.category):JSON.stringify([Y.category]);if($.has(Z))throw new hK(`Duplicate logger configuration for category: ${Z}. Each category can only be configured once.`);$.add(Z);let F=iG.getLogger(Y.category);for(let X of Y.sinks??[]){let D=A.sinks[X];if(!D)throw new hK(`Sink not found: ${X}.`);F.sinks.push(D)}if(F.parentSinks=Y.parentSinks??"inherit",Y.lowestLevel!==void 0)F.lowestLevel=Y.lowestLevel;for(let X of Y.filters??[]){let D=A.filters?.[X];if(D===void 0)throw new hK(`Filter not found: ${X}.`);F.filters.push(xr1(D))}ur1.add(F)}iG.getLogger().contextLocalStorage=A.contextLocalStorage;for(let Y of Object.values(A.sinks)){if(Symbol.asyncDispose in Y)if(Q)Om.add(Y);else throw new hK("Async disposables cannot be used with configureSync().");if(Symbol.dispose in Y)q50.add(Y)}for(let Y of Object.values(A.filters??{})){if(Y==null||typeof Y==="string")continue;if(Symbol.asyncDispose in Y)if(Q)Om.add(Y);else throw new hK("Async disposables cannot be used with configureSync().");if(Symbol.dispose in Y)q50.add(Y)}M36(Q);let J=iG.getLogger(["logtape","meta"]);if(!B)J.sinks.push(Lm());J.info("LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger is used to log internal diagnostics such as sink exceptions. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.",{metaLoggerCategory:["logtape","meta"],dismissLevel:"info"})}function _T0(){return N50}function ET(){w50(),O36()}function O36(){let A=iG.getLogger([]);A.resetDescendants(),delete A.contextLocalStorage,ur1.clear(),N50=null}async function I50(){w50();let A=[];for(let Q of Om)A.push(Q[Symbol.asyncDispose]()),Om.delete(Q);await Promise.all(A)}function w50(){for(let A of q50)A[Symbol.dispose]();q50.clear()}var N50=null,ur1,q50,Om,hK;var hr1=o(()=>{br1();G50();PT0();ur1=new Set,q50=new Set,Om=new Set;hK=class extends Error{constructor(A){super(A);this.name="ConfigureError"}}});var C50=o(()=>{G50();RT0();PT0();hr1()});var gr1,j36,j;var d0=o(()=>{C50();IB();if(_T0()===null)jm({sinks:{console:Lm({formatter:(A)=>{let Q=Mm(A);return Object.keys(A.properties).length>0?[...Q,A.properties]:Q}})},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},{category:[],sinks:["console"]}]});gr1=DT.union([DT.literal("error"),DT.literal("warn"),DT.literal("info"),DT.literal("debug")]),j36=CT0(),j=j36});import T36 from"os";import M50 from"path";var LH,WM,OH,zT,bV3,uV3,hV3,k36,S36;var L50=o(()=>{LH=T36.homedir(),{env:WM}=process,OH=WM.XDG_DATA_HOME||(LH?M50.join(LH,".local","share"):void 0),zT=WM.XDG_CONFIG_HOME||(LH?M50.join(LH,".config"):void 0),bV3=WM.XDG_STATE_HOME||(LH?M50.join(LH,".local","state"):void 0),uV3=WM.XDG_CACHE_HOME||(LH?M50.join(LH,".cache"):void 0),hV3=WM.XDG_RUNTIME_DIR||void 0,k36=(WM.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(OH)k36.unshift(OH);S36=(WM.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(zT)S36.unshift(zT)});import{homedir as O50}from"node:os";import gK from"node:path";var mr1,v36,pr1,y36,WT,f36,Rm,x36,b$;var kZ=o(()=>{L50();mr1=gK.join(O50(),".local/share"),v36=process.platform==="win32"||process.platform==="darwin"?mr1:OH??mr1,pr1=gK.join(O50(),".config"),y36=process.platform==="win32"||process.platform==="darwin"?pr1:zT??pr1,WT=gK.join(v36,"amp"),f36=gK.join(y36,"amp"),Rm=gK.join(f36,"tools"),x36=process.platform==="win32"?gK.join(process.env.LOCALAPPDATA??gK.join(O50(),"AppData","Local"),"amp"):gK.join(process.env.XDG_CACHE_HOME??gK.join(O50(),".cache"),"amp"),b$=x36});function b36(A){return A.trim().toLowerCase()}function f7(A){let Q=b36(A);if(Q.length===0)return!1;if(Q.endsWith("@ampcode.com")||Q==="auth-bypass-user@example.com")return!0;return!1}function D4(A,Q,B=Q+"s"){return A===1?Q:B}var Z3=()=>{};function j50(A){Promise.resolve().then(()=>{try{A()}catch(Q){console.error(Q)}})}function lr1(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 vT0(A){A._observer=void 0,A._queue=void 0,A._state="closed"}function h36(A){let Q=A._queue;if(!Q)return;A._queue=void 0,A._state="ready";for(let B of Q)if(ir1(A,B.type,B.value),A._state==="closed")break}function ir1(A,Q,B){A._state="running";let $=A._observer;try{switch(Q){case"next":if($&&typeof $.next==="function")$.next(B);break;case"error":if(vT0(A),$&&typeof $.error==="function")$.error(B);else throw B;break;case"complete":if(vT0(A),$&&typeof $.complete==="function")$.complete();break}}catch(J){console.error("notifySubscription",J)}if(A._state==="closed")lr1(A);else if(A._state==="running")A._state="ready"}function ST0(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}],j50(()=>h36(A));return}ir1(A,Q,B)}class nr1{_cleanup;_observer;_queue;_state;constructor(A,Q){this._cleanup=void 0,this._observer=A,this._queue=void 0,this._state="initializing";let B=new ar1(this);try{this._cleanup=Q.call(void 0,B)}catch($){B.error($)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")vT0(this),lr1(this)}}class ar1{_subscription;constructor(A){this._subscription=A}get closed(){return this._subscription._state==="closed"}next(A){ST0(this._subscription,"next",A)}error(A){ST0(this._subscription,"error",A)}complete(){ST0(this._subscription,"complete")}}function J8(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=[],$=(Y)=>B.push(Y),J=Promise.resolve().then(async()=>{await Q,await A($),this._pendingPromises.delete(J);for(let Y of B)this._baseObserver.next(Y)}).catch((Y)=>{this._pendingPromises.delete(J),this._baseObserver.error(Y)});this._pendingPromises.add(J)}}var u0;var qT=o(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");u0=class u0{_subscriber;constructor(A){if(!(this instanceof u0))throw TypeError("Observable cannot be called as a function");if(typeof A!=="function")throw 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 nr1(A,this._subscriber)}pipe(A,...Q){let B=this;for(let $ of[A,...Q])B=$(B);return B}[Symbol.observable](){return this}static from(A){let Q=typeof u0==="function"?u0:u0;if(A==null)throw TypeError(A+" is not an object");let B=A[Symbol.observable];if(typeof B==="function"){let J=B.call(A);if(Object(J)!==J)throw TypeError(J+" is not an object");if(J instanceof u0)return J;return new Q((Y)=>J.subscribe(Y))}let $=A[Symbol.iterator];if(typeof $==="function")return new Q((J)=>{j50(()=>{if(J.closed)return;for(let Y of $.call(A))if(J.next(Y),J.closed)return;J.complete()})});if(Array.isArray(A))return new Q((J)=>{j50(()=>{if(J.closed)return;for(let Y of A)if(J.next(Y),J.closed)return;J.complete()})});throw TypeError(A+" is not observable")}static of(...A){return new(typeof u0==="function"?u0:u0)((B)=>{j50(()=>{if(B.closed)return;for(let $ of A)if(B.next($),B.closed)return;B.complete()})})}static get[Symbol.species](){return u0}}});var d4,n1;var R50=o(()=>{qT();d4=class d4 extends u0{_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()}};n1=class n1 extends d4{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 $={};if(A)$.next=A;if(Q)$.error=Q;if(B)$.complete=B;A=$}return A.next?.(this.currentValue),super.subscribe(A)}getValue(){return this.currentValue}}});var g36,yT0;var or1=o(()=>{qT();R50();g36=class g36 extends Set{subject=new n1(this);add(A){return super.add(A),this.subject.next(this),this}delete(A){let Q=super.delete(A);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return u0.from(this.subject)}dispose(){this.subject.complete()}};yT0=class yT0 extends Map{subject=new n1(this);set(A,Q){return super.set(A,Q),this.subject.next(this),this}delete(A){let Q=super.delete(A);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return u0.from(this.subject)}dispose(){this.subject.complete()}}});function P50(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),$=Array.isArray(Q);if(B!==$)return!1;if(B&&$)return A.length===Q.length&&A.every((Y,Z)=>P50(Y,Q[Z]));let J=new Set([...Object.keys(A),...Object.keys(Q)]);for(let Y of J)if(!P50(A[Y],Q[Y]))return!1;return!0}var _50;var fT0=o(()=>{_50={now:()=>Date.now(),schedule:(A,Q)=>{let B=setTimeout(A,Q);return()=>clearTimeout(B)}}});async function S1(A,Q){return new Promise((B,$)=>{let J,Y=()=>{J?.unsubscribe(),$(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",Y,{once:!0}),J=A.subscribe({next:(Z)=>{J?.unsubscribe(),Q?.removeEventListener("abort",Y),B(Z)},error:(Z)=>{Q?.removeEventListener("abort",Y),$(Z)},complete:()=>{Q?.removeEventListener("abort",Y),$("Observable completed without emitting a value")}})})}async function jH(A,Q){return new Promise((B,$)=>{let J,Y=!1,Z,F=()=>{Z?.unsubscribe(),$(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",F,{once:!0}),Z=A.subscribe({next:(X)=>{J=X,Y=!0},error:(X)=>{Q?.removeEventListener("abort",F),$(X)},complete:()=>{if(Q?.removeEventListener("abort",F),Y)B(J);else $("Observable completed without emitting a value")}})})}async function sr1(A,Q){return new Promise((B,$)=>{let J=A.subscribe({error:$,complete:()=>B()});Q?.addEventListener("abort",()=>{J.unsubscribe(),$(new DOMException("Aborted","AbortError"))},{once:!0})})}function z8(A){return new u0((Q)=>{A.then((B)=>{Q.next(B),Q.complete()}).catch((B)=>{Q.error(B)})})}function YA(A){return new u0((Q)=>{let B=!1,$=new AbortController,J=$.signal;return(async()=>{try{J?.throwIfAborted();let Z=await A(J);if(J?.throwIfAborted(),!B)Q.next(Z),Q.complete()}catch(Z){if(!B)if(J.aborted)Q.complete();else Q.error(Z)}})(),()=>{B=!0,$.abort()}})}function w1(A){return(Q)=>{return new u0((B)=>{let $=new HT(B),J=0,Y=Q.subscribe({complete(){$.complete()},error(Z){$.error(Z)},next(Z){$.schedule(async(F)=>{let X=await A(Z,J);J++,F(X)})}});return()=>J8(Y)})}}function NT(A,Q=_50){return new u0((B)=>{let $=0,J=null,Y=()=>{B.next($++),J=Q.schedule(Y,A)};return J=Q.schedule(Y,A),()=>{if(J)J()}})}function mK(...A){return new u0((Q)=>{let B=0,$=A.map((J)=>J.subscribe({next:(Y)=>Q.next(Y),error:(Y)=>Q.error(Y),complete:()=>{if(B++,B===A.length)Q.complete()}}));return()=>{tr1($)}})}function M6(...A){if(A.length===0)return _m;return new u0((Q)=>{let B=Array(A.length),$=Array(A.length).fill(0),J=Array(A.length).fill(!1),Y=0,Z=[],F=new HT(Q);for(let X=0;X<A.length;X++){let D=A[X];Z.push(D.subscribe({next(G){B[X]=G,J[X]=!0;let V=++$[X];if(J.every(Boolean))F.schedule(async(U)=>{if($[X]===V)U([...B])})},error(G){F.error(G)},complete(){if(Y++,Y===A.length)F.complete()}}))}return()=>{tr1(Z)}})}function rA(A){let B=A?.shouldCountRefs??!0,$=m36++,J=(Y,...Z)=>{};return(Y)=>{let Z=new d4,F=null,X=!1,D,G=0;return new u0((V)=>{if(G++,X)J("new subscriber, emitting buffered value",D),V.next(D);else J("new subscriber, no buffered value to emit");if(!F)F=Y.subscribe({next:(K)=>{X=!0,D=K,Z.next(K)},error:(K)=>Z.error(K),complete:()=>Z.complete()});let U=Z.subscribe(V);return()=>{if(G--,U.unsubscribe(),B&&G===0){if(F)J8(F),F=null;X=!1}}})}}function tr1(A){for(let Q of A)if(Q)J8(Q)}function pK(A){return(Q)=>{return new u0((B)=>{let $=Q.subscribe({next:(Y)=>B.next(Y),error:(Y)=>B.error(Y),complete:()=>B.complete()}),J=A.subscribe({next:()=>{B.complete(),$.unsubscribe(),J.unsubscribe()},error:(Y)=>{B.error(Y),$.unsubscribe()}});return()=>{$.unsubscribe(),J.unsubscribe()}})}}function RH(A){return(Q)=>{return new u0((B)=>{let $,J=Q.subscribe({next(Y){$=Y,B.next(Y)},error(Y){B.error(Y)},complete(){B.complete()}});return()=>{J8(J),A($)}})}}function T4(A=P50){return(Q)=>{return new u0((B)=>{let $=rr1,J=new HT(B),Y=Q.subscribe({complete(){J.complete()},error(Z){J.error(Z)},next(Z){J.schedule(async(F)=>{if($===rr1||!A($,Z))$=Z,F(Z)})}});return()=>J8(Y)})}}function IT(A){return p36(typeof A==="function"?{next:A}:A)}function p36(A){return(Q)=>new u0((B)=>{let $=typeof A==="function"?A():A,J=Q.subscribe({next(Y){if($.next)try{$.next(Y)}catch(Z){B.error(Z);return}B.next(Y)},error(Y){if($.error)try{$.error(Y)}catch(Z){B.error(Z);return}B.error(Y)},complete(){if($.complete)try{$.complete()}catch(Y){B.error(Y);return}B.complete()}});return()=>J8(J)})}function CB(A){return(Q)=>{return new u0((B)=>{let $=!1,J=Q.subscribe({next:(Z)=>{$=!0,clearTimeout(Y),B.next(Z)},error:(Z)=>{clearTimeout(Y),B.error(Z)},complete:()=>{clearTimeout(Y),B.complete()}}),Y=setTimeout(()=>{if(!$)J.unsubscribe(),B.error(new T50(`Operation timed out after ${A}ms`))},A);return()=>{clearTimeout(Y),J.unsubscribe()}})}}function W6(A){return(Q)=>new u0((B)=>{let $;try{B.next(A),$=Q.subscribe({next(J){B.next(J)},error(J){B.error(J)},complete(){B.complete()}})}catch(J){B.error(J)}return()=>{if($)J8($)}})}function M2(A){return(Q)=>new u0((B)=>{let $=0,J=Q.subscribe({next(Y){if($<A){if(B.next(Y),$++,$===A)B.complete(),J8(J)}},error(Y){B.error(Y)},complete(){B.complete()}});return()=>{J8(J)}})}function er1(A){return(Q)=>new u0((B)=>{let $=0,J=Q.subscribe({next(Y){if($>=A)B.next(Y);else $++},error(Y){B.error(Y)},complete(){B.complete()}});return()=>{J8(J)}})}function f4(A){return(Q)=>{return new u0((B)=>{let $=0,J=null,Y=!1,Z=()=>{if(Y&&!J)B.complete()},F=Q.subscribe({next(X){if(J)J8(J),J=null;let D;try{D=A(X,$++)}catch(G){B.error(G);return}J=D.subscribe({next(G){B.next(G)},error(G){B.error(G)},complete(){J=null,Z()}})},error(X){B.error(X)},complete(){Y=!0,Z()}});return()=>{if(J8(F),J)J8(J)}})}}function dK(A,Q){let B=Q?.scheduler??_50;return($)=>new u0((J)=>{let Y=null,Z=null,F=!1,X=$.subscribe({next:(D)=>{if(Z=D,F=!0,Y===null)Y=B.schedule(()=>{if(F)J.next(Z),F=!1;Y=null},A)},error:(D)=>J.error(D),complete:()=>{if(Y!==null)Y();if(F)J.next(Z);J.complete()}});return()=>{if(J8(X),Y!==null)Y()}})}function bT0(A,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");let B=Q.scheduler??_50;return($)=>new u0((J)=>{let Y=0,Z=null,F=null,X=!1,D=$.subscribe({next:(G)=>{let V=B.now();if(F=G,X=!0,V-Y>=A)J.next(G),Y=V,X=!1;else if(Z===null)Z=B.schedule(()=>{if(X)J.next(F),Y=B.now(),X=!1;Z=null},A-(V-Y));if(Y===0)J.next(G),Y=V,X=!1},error:(G)=>J.error(G),complete:()=>{if(Z!==null)Z();if(X)J.next(F);J.complete()}});return()=>{if(J8(D),Z!==null)Z()}})}function Tm(...A){return new u0((Q)=>{let B=0,$=null;function J(){if(B>=A.length){Q.complete();return}$=A[B].subscribe({next:(Z)=>Q.next(Z),error:(Z)=>Q.error(Z),complete:()=>{B++,J()}})}return J(),()=>{if($)J8($)}})}function PH(A){return(Q)=>new u0((B)=>{let $=0,J=!1,Y=null,Z=Q.subscribe({next(F){try{let X=A(F,$++);if(Y)J8(Y);Y=X.subscribe({next(D){B.next(D)},error(D){B.error(D)},complete(){if(Y=null,J&&!Y)B.complete()}})}catch(X){B.error(X)}},error(F){B.error(F)},complete(){if(J=!0,!Y)B.complete()}});return()=>{if(J8(Z),Y)J8(Y)}})}function km({onSubscribe:A,onUnsubscribe:Q}){return(B)=>new u0(($)=>{A?.();let J=B.subscribe($);return()=>{J8(J),Q?.()}})}function Sm(A){return(Q)=>u0.from(Q).pipe(f4((B)=>YA(($)=>A(B,$))))}function MB(A){return(Q)=>new u0((B)=>{let $,J=Q.subscribe({next(Y){B.next(Y)},error(Y){try{$=A(Y).subscribe({next(F){B.next(F)},error(F){B.error(F)},complete(){B.complete()}})}catch(Z){B.error(Z)}},complete(){B.complete()}});return()=>{if(J8(J),$)J8($)}})}function d5(A){return(Q)=>{return new u0((B)=>{let $=Q.subscribe({next(J){if(A(J))B.next(J)},error(J){B.error(J)},complete(){B.complete()}});return()=>J8($)})}}function As1(A,Q){return(B)=>{return new u0(($)=>{let J,Y=0,Z=new HT($),F=B.subscribe({complete(){Z.complete()},error(X){Z.error(X)},next(X){Z.schedule(async(D)=>{J=await A(Y===0?typeof Q>"u"?X:Q:J,X,Y++),D(J)})}});return()=>J8(F)})}}var _m,xT0,m36=0,rr1,T50;var uT0=o(()=>{qT();fT0();R50();_m=new u0((A)=>{A.complete()}),xT0=new u0(()=>{});rr1={};T50=class T50 extends Error{constructor(A="Timeout has occurred"){super(A);this.name="TimeoutError"}}});function wT(A,Q){return(B)=>{return u0.from(B).pipe(f4(($)=>$===nG?u0.of(nG):A($).pipe(MB((J)=>u0.of(J instanceof Error?J:Error(J))),W6(nG))),rA(Q))}}function hT0(){return(A)=>u0.from(A).pipe(d5((Q)=>Q!==nG))}async function Qs1(A,Q){let B=await S1(u0.from(A).pipe(hT0()),Q);if(B instanceof Error)throw B;return B}var nG;var Bs1=o(()=>{qT();uT0();nG=Symbol.for("@@pendingOperation")});var $s1=()=>{};var Js1=()=>{};var R1=o(()=>{or1();qT();Bs1();uT0();$s1();fT0();R50();Js1()});function r36(){let A=typeof process==="object"?process.env.ProgramData:void 0;return A?`${A}\\ampcode`:"C:\\ProgramData\\ampcode"}function aT0(A){switch(A){case"darwin":return"/Library/Application Support/ampcode";case"android":case"cygwin":case"freebsd":case"netbsd":case"openbsd":case"linux":return"/etc/ampcode";case"win32":return r36();case"aix":case"haiku":case"sunos":default:return null}}function Us1(A){return aT0(A)}function SZ(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),$=Array.isArray(Q);if(B!==$)return!1;if(B&&$)return A.length===Q.length&&A.every((Y,Z)=>SZ(Y,Q[Z]));let J=new Set([...Object.keys(A),...Object.keys(Q)]);for(let Y of J)if(!SZ(A[Y],Q[Y]))return!1;return!0}class AY{#A=!1;#Q=[];async acquire(){return new Promise((A)=>{if(!this.#A)this.#A=!0,A();else this.#Q.push({resolve:A})})}async acquireWithTimeout(A,Q=`Mutex acquire timed out after ${A}ms`){return new Promise((B,$)=>{if(!this.#A){this.#A=!0,B();return}let J=!1,Y,Z={resolve:()=>{if(J)return;J=!0,clearTimeout(Y),B()}};Y=setTimeout(()=>{if(J)return;J=!0;let F=this.#Q.indexOf(Z);if(F!==-1)this.#Q.splice(F,1);$(Error(Q))},A),this.#Q.push(Z)})}release(){if(this.#Q.length>0)this.#Q.shift()?.resolve();else this.#A=!1}}var LB;var OT=o(()=>{LB={BITBUCKET_ENTERPRISE:"bitbucket-enterprise",CUSTOMER_MODEL_PROVIDER_KEYS:"customer-model-provider-keys",ACCEPT_ABUSE_DATA_RETENTION:"accept-abuse-data-retention",HARNESS_SYSTEM_PROMPT:"harness-system-prompt",NAMESPACE_REPOSITORIES_PAGE:"namespace-repositories-page",NAMESPACE_SKILLS_PAGE:"namespace-skills-page",OPENAI_REGIONAL_NONENT:"openai-regional-nonent",PAYMENT_METHOD_EXEMPT:"payment-method-exempt",PIERRE_DIFFS:"pierre-diffs",THREAD_ACTORS_TUI:"thread-actors-tui",THREAD_ACTORS_TRACES:"thread-actors-traces",V2:"v2",SERVER_PLUGINS:"server-plugins",THREAD_TIMING:"thread-timing",THREAD_TRACE_VIEWER:"thread-trace-viewer",USAGE_TOKEN_COUNT:"usage-token-count",WORKSPACE_ROLES:"workspace-roles"}});function kT(A){let Q=A.length;while(--Q>=0)A[Q]=0}function sT0(A,Q,B,$,J){this.static_tree=A,this.extra_bits=Q,this.extra_base=B,this.elems=$,this.max_length=J,this.has_stree=A&&A.length}function tT0(A,Q){this.dyn_tree=A,this.max_code=0,this.stat_desc=Q}function aG(A,Q,B,$,J){this.good_length=A,this.max_lazy=Q,this.nice_length=B,this.max_chain=$,this.func=J}function D26(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=l50,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(A26*2),this.dyn_dtree=new Uint16Array((2*t86+1)*2),this.bl_tree=new Uint16Array((2*e86+1)*2),TH(this.dyn_ltree),TH(this.dyn_dtree),TH(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Q26+1),this.heap=new Uint16Array(2*Kk0+1),TH(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Kk0+1),TH(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k26(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Ap(A){this.options=i50.assign({level:b26,method:h26,chunkSize:16384,windowBits:15,memLevel:8,strategy:u26},A||{});let Q=this.options;if(Q.raw&&Q.windowBits>0)Q.windowBits=-Q.windowBits;else if(Q.gzip&&Q.windowBits>0&&Q.windowBits<16)Q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ot1,this.strm.avail_out=0;let B=pm.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(B!==d50)throw Error(wM[B]);if(Q.header)pm.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){let $;if(typeof Q.dictionary==="string")$=rm.string2buf(Q.dictionary);else if(jt1.call(Q.dictionary)==="[object ArrayBuffer]")$=new Uint8Array(Q.dictionary);else $=Q.dictionary;if(B=pm.deflateSetDictionary(this.strm,$),B!==d50)throw Error(wM[B]);this._dict_set=!0}}function Lk0(A,Q){let B=new Ap(Q);if(B.push(A,!0),B.err)throw B.msg||wM[B.err];return B.result}function g26(A,Q){return Q=Q||{},Q.raw=!0,Lk0(A,Q)}function m26(A,Q){return Q=Q||{},Q.gzip=!0,Lk0(A,Q)}function G96(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function R96(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function Qp(A){this.options=i50.assign({chunkSize:65536,windowBits:15,to:""},A||{});let Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!(A&&A.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ot1,this.strm.avail_out=0;let B=iK.inflateInit2(this.strm,Q.windowBits);if(B!==sm)throw Error(wM[B]);if(this.header=new P96,iK.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=rm.string2buf(Q.dictionary);else if(ut1.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(B=iK.inflateSetDictionary(this.strm,Q.dictionary),B!==sm)throw Error(wM[B])}}}function Ok0(A,Q){let B=new Qp(Q);if(B.push(A),B.err)throw B.msg||wM[B.err];return B.result}function v96(A,Q){return Q=Q||{},Q.raw=!0,Ok0(A,Q)}var X86=0,Jt1=1,D86=2,G86=3,V86=258,Nk0=29,tm=256,cm,PT=30,Ik0=19,Yt1,qM=15,rT0=16,U86=7,wk0=256,Zt1=16,Ft1=17,Xt1=18,Gk0,m50,K86,Dt1,E86=512,lK,mm,lm,im,Ck0,p50,Gt1,Vt1,Ut1,Kt1=(A)=>{return A<256?lm[A]:lm[256+(A>>>7)]},nm=(A,Q)=>{A.pending_buf[A.pending++]=Q&255,A.pending_buf[A.pending++]=Q>>>8&255},u$=(A,Q,B)=>{if(A.bi_valid>rT0-B)A.bi_buf|=Q<<A.bi_valid&65535,nm(A,A.bi_buf),A.bi_buf=Q>>rT0-A.bi_valid,A.bi_valid+=B-rT0;else A.bi_buf|=Q<<A.bi_valid&65535,A.bi_valid+=B},oG=(A,Q,B)=>{u$(A,B[Q*2],B[Q*2+1])},Et1=(A,Q)=>{let B=0;do B|=A&1,A>>>=1,B<<=1;while(--Q>0);return B>>>1},z86=(A)=>{if(A.bi_valid===16)nm(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0;else if(A.bi_valid>=8)A.pending_buf[A.pending++]=A.bi_buf&255,A.bi_buf>>=8,A.bi_valid-=8},W86=(A,Q)=>{let{dyn_tree:B,max_code:$}=Q,J=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,Z=Q.stat_desc.extra_bits,F=Q.stat_desc.extra_base,X=Q.stat_desc.max_length,D,G,V,U,K,E,z=0;for(U=0;U<=qM;U++)A.bl_count[U]=0;B[A.heap[A.heap_max]*2+1]=0;for(D=A.heap_max+1;D<Yt1;D++){if(G=A.heap[D],U=B[B[G*2+1]*2+1]+1,U>X)U=X,z++;if(B[G*2+1]=U,G>$)continue;if(A.bl_count[U]++,K=0,G>=F)K=Z[G-F];if(E=B[G*2],A.opt_len+=E*(U+K),Y)A.static_len+=E*(J[G*2+1]+K)}if(z===0)return;do{U=X-1;while(A.bl_count[U]===0)U--;A.bl_count[U]--,A.bl_count[U+1]+=2,A.bl_count[X]--,z-=2}while(z>0);for(U=X;U!==0;U--){G=A.bl_count[U];while(G!==0){if(V=A.heap[--D],V>$)continue;if(B[V*2+1]!==U)A.opt_len+=(U-B[V*2+1])*B[V*2],B[V*2+1]=U;G--}}},zt1=(A,Q,B)=>{let $=Array(qM+1),J=0,Y,Z;for(Y=1;Y<=qM;Y++)J=J+B[Y-1]<<1,$[Y]=J;for(Z=0;Z<=Q;Z++){let F=A[Z*2+1];if(F===0)continue;A[Z*2]=Et1($[F]++,F)}},H86=()=>{let A,Q,B,$,J,Y=Array(qM+1);B=0;for($=0;$<Nk0-1;$++){Ck0[$]=B;for(A=0;A<1<<Gk0[$];A++)im[B++]=$}im[B-1]=$,J=0;for($=0;$<16;$++){p50[$]=J;for(A=0;A<1<<m50[$];A++)lm[J++]=$}J>>=7;for(;$<PT;$++){p50[$]=J<<7;for(A=0;A<1<<m50[$]-7;A++)lm[256+J++]=$}for(Q=0;Q<=qM;Q++)Y[Q]=0;A=0;while(A<=143)lK[A*2+1]=8,A++,Y[8]++;while(A<=255)lK[A*2+1]=9,A++,Y[9]++;while(A<=279)lK[A*2+1]=7,A++,Y[7]++;while(A<=287)lK[A*2+1]=8,A++,Y[8]++;zt1(lK,cm+1,Y);for(A=0;A<PT;A++)mm[A*2+1]=5,mm[A*2]=Et1(A,5);Gt1=new sT0(lK,Gk0,tm+1,cm,qM),Vt1=new sT0(mm,m50,0,PT,qM),Ut1=new sT0([],K86,0,Ik0,U86)},Wt1=(A)=>{let Q;for(Q=0;Q<cm;Q++)A.dyn_ltree[Q*2]=0;for(Q=0;Q<PT;Q++)A.dyn_dtree[Q*2]=0;for(Q=0;Q<Ik0;Q++)A.bl_tree[Q*2]=0;A.dyn_ltree[wk0*2]=1,A.opt_len=A.static_len=0,A.sym_next=A.matches=0},Ht1=(A)=>{if(A.bi_valid>8)nm(A,A.bi_buf);else if(A.bi_valid>0)A.pending_buf[A.pending++]=A.bi_buf;A.bi_buf=0,A.bi_valid=0},Is1=(A,Q,B,$)=>{let J=Q*2,Y=B*2;return A[J]<A[Y]||A[J]===A[Y]&&$[Q]<=$[B]},eT0=(A,Q,B)=>{let $=A.heap[B],J=B<<1;while(J<=A.heap_len){if(J<A.heap_len&&Is1(Q,A.heap[J+1],A.heap[J],A.depth))J++;if(Is1(Q,$,A.heap[J],A.depth))break;A.heap[B]=A.heap[J],B=J,J<<=1}A.heap[B]=$},ws1=(A,Q,B)=>{let $,J,Y=0,Z,F;if(A.sym_next!==0)do if($=A.pending_buf[A.sym_buf+Y++]&255,$+=(A.pending_buf[A.sym_buf+Y++]&255)<<8,J=A.pending_buf[A.sym_buf+Y++],$===0)oG(A,J,Q);else{if(Z=im[J],oG(A,Z+tm+1,Q),F=Gk0[Z],F!==0)J-=Ck0[Z],u$(A,J,F);if($--,Z=Kt1($),oG(A,Z,B),F=m50[Z],F!==0)$-=p50[Z],u$(A,$,F)}while(Y<A.sym_next);oG(A,wk0,Q)},Vk0=(A,Q)=>{let B=Q.dyn_tree,$=Q.stat_desc.static_tree,J=Q.stat_desc.has_stree,Y=Q.stat_desc.elems,Z,F,X=-1,D;A.heap_len=0,A.heap_max=Yt1;for(Z=0;Z<Y;Z++)if(B[Z*2]!==0)A.heap[++A.heap_len]=X=Z,A.depth[Z]=0;else B[Z*2+1]=0;while(A.heap_len<2)if(D=A.heap[++A.heap_len]=X<2?++X:0,B[D*2]=1,A.depth[D]=0,A.opt_len--,J)A.static_len-=$[D*2+1];Q.max_code=X;for(Z=A.heap_len>>1;Z>=1;Z--)eT0(A,B,Z);D=Y;do Z=A.heap[1],A.heap[1]=A.heap[A.heap_len--],eT0(A,B,1),F=A.heap[1],A.heap[--A.heap_max]=Z,A.heap[--A.heap_max]=F,B[D*2]=B[Z*2]+B[F*2],A.depth[D]=(A.depth[Z]>=A.depth[F]?A.depth[Z]:A.depth[F])+1,B[Z*2+1]=B[F*2+1]=D,A.heap[1]=D++,eT0(A,B,1);while(A.heap_len>=2);A.heap[--A.heap_max]=A.heap[1],W86(A,Q),zt1(B,X,A.bl_count)},Cs1=(A,Q,B)=>{let $,J=-1,Y,Z=Q[1],F=0,X=7,D=4;if(Z===0)X=138,D=3;Q[(B+1)*2+1]=65535;for($=0;$<=B;$++){if(Y=Z,Z=Q[($+1)*2+1],++F<X&&Y===Z)continue;else if(F<D)A.bl_tree[Y*2]+=F;else if(Y!==0){if(Y!==J)A.bl_tree[Y*2]++;A.bl_tree[Zt1*2]++}else if(F<=10)A.bl_tree[Ft1*2]++;else A.bl_tree[Xt1*2]++;if(F=0,J=Y,Z===0)X=138,D=3;else if(Y===Z)X=6,D=3;else X=7,D=4}},Ms1=(A,Q,B)=>{let $,J=-1,Y,Z=Q[1],F=0,X=7,D=4;if(Z===0)X=138,D=3;for($=0;$<=B;$++){if(Y=Z,Z=Q[($+1)*2+1],++F<X&&Y===Z)continue;else if(F<D)do oG(A,Y,A.bl_tree);while(--F!==0);else if(Y!==0){if(Y!==J)oG(A,Y,A.bl_tree),F--;oG(A,Zt1,A.bl_tree),u$(A,F-3,2)}else if(F<=10)oG(A,Ft1,A.bl_tree),u$(A,F-3,3);else oG(A,Xt1,A.bl_tree),u$(A,F-11,7);if(F=0,J=Y,Z===0)X=138,D=3;else if(Y===Z)X=6,D=3;else X=7,D=4}},q86=(A)=>{let Q;Cs1(A,A.dyn_ltree,A.l_desc.max_code),Cs1(A,A.dyn_dtree,A.d_desc.max_code),Vk0(A,A.bl_desc);for(Q=Ik0-1;Q>=3;Q--)if(A.bl_tree[Dt1[Q]*2+1]!==0)break;return A.opt_len+=3*(Q+1)+5+5+4,Q},N86=(A,Q,B,$)=>{let J;u$(A,Q-257,5),u$(A,B-1,5),u$(A,$-4,4);for(J=0;J<$;J++)u$(A,A.bl_tree[Dt1[J]*2+1],3);Ms1(A,A.dyn_ltree,Q-1),Ms1(A,A.dyn_dtree,B-1)},I86=(A)=>{let Q=4093624447,B;for(B=0;B<=31;B++,Q>>>=1)if(Q&1&&A.dyn_ltree[B*2]!==0)return 0;if(A.dyn_ltree[18]!==0||A.dyn_ltree[20]!==0||A.dyn_ltree[26]!==0)return 1;for(B=32;B<tm;B++)if(A.dyn_ltree[B*2]!==0)return 1;return 0},Ls1=!1,w86=(A)=>{if(!Ls1)H86(),Ls1=!0;A.l_desc=new tT0(A.dyn_ltree,Gt1),A.d_desc=new tT0(A.dyn_dtree,Vt1),A.bl_desc=new tT0(A.bl_tree,Ut1),A.bi_buf=0,A.bi_valid=0,Wt1(A)},qt1=(A,Q,B,$)=>{if(u$(A,(X86<<1)+($?1:0),3),Ht1(A),nm(A,B),nm(A,~B),B)A.pending_buf.set(A.window.subarray(Q,Q+B),A.pending);A.pending+=B},C86=(A)=>{u$(A,Jt1<<1,3),oG(A,wk0,lK),z86(A)},M86=(A,Q,B,$)=>{let J,Y,Z=0;if(A.level>0){if(A.strm.data_type===2)A.strm.data_type=I86(A);if(Vk0(A,A.l_desc),Vk0(A,A.d_desc),Z=q86(A),J=A.opt_len+3+7>>>3,Y=A.static_len+3+7>>>3,Y<=J)J=Y}else J=Y=B+5;if(B+4<=J&&Q!==-1)qt1(A,Q,B,$);else if(A.strategy===4||Y===J)u$(A,(Jt1<<1)+($?1:0),3),ws1(A,lK,mm);else u$(A,(D86<<1)+($?1:0),3),N86(A,A.l_desc.max_code+1,A.d_desc.max_code+1,Z+1),ws1(A,A.dyn_ltree,A.dyn_dtree);if(Wt1(A),$)Ht1(A)},L86=(A,Q,B)=>{if(A.pending_buf[A.sym_buf+A.sym_next++]=Q,A.pending_buf[A.sym_buf+A.sym_next++]=Q>>8,A.pending_buf[A.sym_buf+A.sym_next++]=B,Q===0)A.dyn_ltree[B*2]++;else A.matches++,Q--,A.dyn_ltree[(im[B]+tm+1)*2]++,A.dyn_dtree[Kt1(Q)*2]++;return A.sym_next===A.sym_end},O86,j86,R86,P86,_86,T86,k86=(A,Q,B,$)=>{let J=A&65535|0,Y=A>>>16&65535|0,Z=0;while(B!==0){Z=B>2000?2000:B,B-=Z;do J=J+Q[$++]|0,Y=Y+J|0;while(--Z);J%=65521,Y%=65521}return J|Y<<16|0},am,S86=()=>{let A,Q=[];for(var B=0;B<256;B++){A=B;for(var $=0;$<8;$++)A=A&1?3988292384^A>>>1:A>>>1;Q[B]=A}return Q},v86,y86=(A,Q,B,$)=>{let J=v86,Y=$+B;A^=-1;for(let Z=$;Z<Y;Z++)A=A>>>8^J[(A^Q[Z])&255];return A^-1},t9,wM,LM,f86,Uk0,x86,SH,b86,vH,u86,h86,vZ,Os1,x7,js1,rG,g86,Ak0,m86,p86,x50,d86,c86,l86,i86,l50,n86=9,a86=15,o86=8,r86=29,s86=256,Kk0,t86=30,e86=19,A26,Q26=15,B5=3,kH=258,sG,B26=32,_T=42,Mk0=57,Ek0=69,zk0=73,Wk0=91,Hk0=103,NM=113,hm=666,OB=1,ST=2,CM=3,vT=4,$26=3,IM=(A,Q)=>{return A.msg=wM[Q],Q},Rs1=(A)=>{return A*2-(A>4?9:0)},TH=(A)=>{let Q=A.length;while(--Q>=0)A[Q]=0},J26=(A)=>{let Q,B,$,J=A.w_size;Q=A.hash_size,$=Q;do B=A.head[--$],A.head[$]=B>=J?B-J:0;while(--Q);Q=J,$=Q;do B=A.prev[--$],A.prev[$]=B>=J?B-J:0;while(--Q)},Y26=(A,Q,B)=>(Q<<A.hash_shift^B)&A.hash_mask,yH,QY=(A)=>{let Q=A.state,B=Q.pending;if(B>A.avail_out)B=A.avail_out;if(B===0)return;if(A.output.set(Q.pending_buf.subarray(Q.pending_out,Q.pending_out+B),A.next_out),A.next_out+=B,Q.pending_out+=B,A.total_out+=B,A.avail_out-=B,Q.pending-=B,Q.pending===0)Q.pending_out=0},BY=(A,Q)=>{x86(A,A.block_start>=0?A.block_start:-1,A.strstart-A.block_start,Q),A.block_start=A.strstart,QY(A.strm)},c5=(A,Q)=>{A.pending_buf[A.pending++]=Q},um=(A,Q)=>{A.pending_buf[A.pending++]=Q>>>8&255,A.pending_buf[A.pending++]=Q&255},qk0=(A,Q,B,$)=>{let J=A.avail_in;if(J>$)J=$;if(J===0)return 0;if(A.avail_in-=J,Q.set(A.input.subarray(A.next_in,A.next_in+J),B),A.state.wrap===1)A.adler=am(A.adler,Q,J,B);else if(A.state.wrap===2)A.adler=t9(A.adler,Q,J,B);return A.next_in+=J,A.total_in+=J,J},Nt1=(A,Q)=>{let{max_chain_length:B,strstart:$}=A,J,Y,Z=A.prev_length,F=A.nice_match,X=A.strstart>A.w_size-sG?A.strstart-(A.w_size-sG):0,D=A.window,G=A.w_mask,V=A.prev,U=A.strstart+kH,K=D[$+Z-1],E=D[$+Z];if(A.prev_length>=A.good_match)B>>=2;if(F>A.lookahead)F=A.lookahead;do{if(J=Q,D[J+Z]!==E||D[J+Z-1]!==K||D[J]!==D[$]||D[++J]!==D[$+1])continue;$+=2,J++;do;while(D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&D[++$]===D[++J]&&$<U);if(Y=kH-(U-$),$=U-kH,Y>Z){if(A.match_start=Q,Z=Y,Y>=F)break;K=D[$+Z-1],E=D[$+Z]}}while((Q=V[Q&G])>X&&--B!==0);if(Z<=A.lookahead)return Z;return A.lookahead},TT=(A)=>{let Q=A.w_size,B,$,J;do{if($=A.window_size-A.lookahead-A.strstart,A.strstart>=Q+(Q-sG)){if(A.window.set(A.window.subarray(Q,Q+Q-$),0),A.match_start-=Q,A.strstart-=Q,A.block_start-=Q,A.insert>A.strstart)A.insert=A.strstart;J26(A),$+=Q}if(A.strm.avail_in===0)break;if(B=qk0(A.strm,A.window,A.strstart+A.lookahead,$),A.lookahead+=B,A.lookahead+A.insert>=B5){J=A.strstart-A.insert,A.ins_h=A.window[J],A.ins_h=yH(A,A.ins_h,A.window[J+1]);while(A.insert)if(A.ins_h=yH(A,A.ins_h,A.window[J+B5-1]),A.prev[J&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=J,J++,A.insert--,A.lookahead+A.insert<B5)break}}while(A.lookahead<sG&&A.strm.avail_in!==0)},It1=(A,Q)=>{let B=A.pending_buf_size-5>A.w_size?A.w_size:A.pending_buf_size-5,$,J,Y,Z=0,F=A.strm.avail_in;do{if($=65535,Y=A.bi_valid+42>>3,A.strm.avail_out<Y)break;if(Y=A.strm.avail_out-Y,J=A.strstart-A.block_start,$>J+A.strm.avail_in)$=J+A.strm.avail_in;if($>Y)$=Y;if($<B&&($===0&&Q!==vZ||Q===vH||$!==J+A.strm.avail_in))break;if(Z=Q===vZ&&$===J+A.strm.avail_in?1:0,Uk0(A,0,0,Z),A.pending_buf[A.pending-4]=$,A.pending_buf[A.pending-3]=$>>8,A.pending_buf[A.pending-2]=~$,A.pending_buf[A.pending-1]=~$>>8,QY(A.strm),J){if(J>$)J=$;A.strm.output.set(A.window.subarray(A.block_start,A.block_start+J),A.strm.next_out),A.strm.next_out+=J,A.strm.avail_out-=J,A.strm.total_out+=J,A.block_start+=J,$-=J}if($)qk0(A.strm,A.strm.output,A.strm.next_out,$),A.strm.next_out+=$,A.strm.avail_out-=$,A.strm.total_out+=$}while(Z===0);if(F-=A.strm.avail_in,F){if(F>=A.w_size)A.matches=2,A.window.set(A.strm.input.subarray(A.strm.next_in-A.w_size,A.strm.next_in),0),A.strstart=A.w_size,A.insert=A.strstart;else{if(A.window_size-A.strstart<=F){if(A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2)A.matches++;if(A.insert>A.strstart)A.insert=A.strstart}A.window.set(A.strm.input.subarray(A.strm.next_in-F,A.strm.next_in),A.strstart),A.strstart+=F,A.insert+=F>A.w_size-A.insert?A.w_size-A.insert:F}A.block_start=A.strstart}if(A.high_water<A.strstart)A.high_water=A.strstart;if(Z)return vT;if(Q!==vH&&Q!==vZ&&A.strm.avail_in===0&&A.strstart===A.block_start)return ST;if(Y=A.window_size-A.strstart,A.strm.avail_in>Y&&A.block_start>=A.w_size){if(A.block_start-=A.w_size,A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2)A.matches++;if(Y+=A.w_size,A.insert>A.strstart)A.insert=A.strstart}if(Y>A.strm.avail_in)Y=A.strm.avail_in;if(Y)qk0(A.strm,A.window,A.strstart,Y),A.strstart+=Y,A.insert+=Y>A.w_size-A.insert?A.w_size-A.insert:Y;if(A.high_water<A.strstart)A.high_water=A.strstart;if(Y=A.bi_valid+42>>3,Y=A.pending_buf_size-Y>65535?65535:A.pending_buf_size-Y,B=Y>A.w_size?A.w_size:Y,J=A.strstart-A.block_start,J>=B||(J||Q===vZ)&&Q!==vH&&A.strm.avail_in===0&&J<=Y)$=J>Y?Y:J,Z=Q===vZ&&A.strm.avail_in===0&&$===J?1:0,Uk0(A,A.block_start,$,Z),A.block_start+=$,QY(A.strm);return Z?CM:OB},Qk0=(A,Q)=>{let B,$;for(;;){if(A.lookahead<sG){if(TT(A),A.lookahead<sG&&Q===vH)return OB;if(A.lookahead===0)break}if(B=0,A.lookahead>=B5)A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;if(B!==0&&A.strstart-B<=A.w_size-sG)A.match_length=Nt1(A,B);if(A.match_length>=B5)if($=SH(A,A.strstart-A.match_start,A.match_length-B5),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=B5){A.match_length--;do A.strstart++,A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;while(--A.match_length!==0);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=yH(A,A.ins_h,A.window[A.strstart+1]);else $=SH(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if($){if(BY(A,!1),A.strm.avail_out===0)return OB}}if(A.insert=A.strstart<B5-1?A.strstart:B5-1,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},jT=(A,Q)=>{let B,$,J;for(;;){if(A.lookahead<sG){if(TT(A),A.lookahead<sG&&Q===vH)return OB;if(A.lookahead===0)break}if(B=0,A.lookahead>=B5)A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;if(A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=B5-1,B!==0&&A.prev_length<A.max_lazy_match&&A.strstart-B<=A.w_size-sG){if(A.match_length=Nt1(A,B),A.match_length<=5&&(A.strategy===p86||A.match_length===B5&&A.strstart-A.match_start>4096))A.match_length=B5-1}if(A.prev_length>=B5&&A.match_length<=A.prev_length){J=A.strstart+A.lookahead-B5,$=SH(A,A.strstart-1-A.prev_match,A.prev_length-B5),A.lookahead-=A.prev_length-1,A.prev_length-=2;do if(++A.strstart<=J)A.ins_h=yH(A,A.ins_h,A.window[A.strstart+B5-1]),B=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;while(--A.prev_length!==0);if(A.match_available=0,A.match_length=B5-1,A.strstart++,$){if(BY(A,!1),A.strm.avail_out===0)return OB}}else if(A.match_available){if($=SH(A,0,A.window[A.strstart-1]),$)BY(A,!1);if(A.strstart++,A.lookahead--,A.strm.avail_out===0)return OB}else A.match_available=1,A.strstart++,A.lookahead--}if(A.match_available)$=SH(A,0,A.window[A.strstart-1]),A.match_available=0;if(A.insert=A.strstart<B5-1?A.strstart:B5-1,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},Z26=(A,Q)=>{let B,$,J,Y,Z=A.window;for(;;){if(A.lookahead<=kH){if(TT(A),A.lookahead<=kH&&Q===vH)return OB;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=B5&&A.strstart>0){if(J=A.strstart-1,$=Z[J],$===Z[++J]&&$===Z[++J]&&$===Z[++J]){Y=A.strstart+kH;do;while($===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&$===Z[++J]&&J<Y);if(A.match_length=kH-(Y-J),A.match_length>A.lookahead)A.match_length=A.lookahead}}if(A.match_length>=B5)B=SH(A,1,A.match_length-B5),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0;else B=SH(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(B){if(BY(A,!1),A.strm.avail_out===0)return OB}}if(A.insert=0,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},F26=(A,Q)=>{let B;for(;;){if(A.lookahead===0){if(TT(A),A.lookahead===0){if(Q===vH)return OB;break}}if(A.match_length=0,B=SH(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,B){if(BY(A,!1),A.strm.avail_out===0)return OB}}if(A.insert=0,Q===vZ){if(BY(A,!0),A.strm.avail_out===0)return CM;return vT}if(A.sym_next){if(BY(A,!1),A.strm.avail_out===0)return OB}return ST},gm,X26=(A)=>{A.window_size=2*A.w_size,TH(A.head),A.max_lazy_match=gm[A.level].max_lazy,A.good_match=gm[A.level].good_length,A.nice_match=gm[A.level].nice_length,A.max_chain_length=gm[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=B5-1,A.match_available=0,A.ins_h=0},em=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.status!==_T&&Q.status!==Mk0&&Q.status!==Ek0&&Q.status!==zk0&&Q.status!==Wk0&&Q.status!==Hk0&&Q.status!==NM&&Q.status!==hm)return 1;return 0},wt1=(A)=>{if(em(A))return IM(A,rG);A.total_in=A.total_out=0,A.data_type=i86;let Q=A.state;if(Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap===2?Mk0:Q.wrap?_T:NM,A.adler=Q.wrap===2?0:1,Q.last_flush=-2,f86(Q),x7},Ct1=(A)=>{let Q=wt1(A);if(Q===x7)X26(A.state);return Q},G26=(A,Q)=>{if(em(A)||A.state.wrap!==2)return rG;return A.state.gzhead=Q,x7},Mt1=(A,Q,B,$,J,Y)=>{if(!A)return rG;let Z=1;if(Q===m86)Q=6;if($<0)Z=0,$=-$;else if($>15)Z=2,$-=16;if(J<1||J>n86||B!==l50||$<8||$>15||Q<0||Q>9||Y<0||Y>c86||$===8&&Z!==1)return IM(A,rG);if($===8)$=9;let F=new D26;return A.state=F,F.strm=A,F.status=_T,F.wrap=Z,F.gzhead=null,F.w_bits=$,F.w_size=1<<F.w_bits,F.w_mask=F.w_size-1,F.hash_bits=J+7,F.hash_size=1<<F.hash_bits,F.hash_mask=F.hash_size-1,F.hash_shift=~~((F.hash_bits+B5-1)/B5),F.window=new Uint8Array(F.w_size*2),F.head=new Uint16Array(F.hash_size),F.prev=new Uint16Array(F.w_size),F.lit_bufsize=1<<J+6,F.pending_buf_size=F.lit_bufsize*4,F.pending_buf=new Uint8Array(F.pending_buf_size),F.sym_buf=F.lit_bufsize,F.sym_end=(F.lit_bufsize-1)*3,F.level=Q,F.strategy=Y,F.method=B,Ct1(A)},V26=(A,Q)=>{return Mt1(A,Q,l50,a86,o86,l86)},U26=(A,Q)=>{if(em(A)||Q>Os1||Q<0)return A?IM(A,rG):rG;let B=A.state;if(!A.output||A.avail_in!==0&&!A.input||B.status===hm&&Q!==vZ)return IM(A,A.avail_out===0?Ak0:rG);let $=B.last_flush;if(B.last_flush=Q,B.pending!==0){if(QY(A),A.avail_out===0)return B.last_flush=-1,x7}else if(A.avail_in===0&&Rs1(Q)<=Rs1($)&&Q!==vZ)return IM(A,Ak0);if(B.status===hm&&A.avail_in!==0)return IM(A,Ak0);if(B.status===_T&&B.wrap===0)B.status=NM;if(B.status===_T){let J=l50+(B.w_bits-8<<4)<<8,Y=-1;if(B.strategy>=x50||B.level<2)Y=0;else if(B.level<6)Y=1;else if(B.level===6)Y=2;else Y=3;if(J|=Y<<6,B.strstart!==0)J|=B26;if(J+=31-J%31,um(B,J),B.strstart!==0)um(B,A.adler>>>16),um(B,A.adler&65535);if(A.adler=1,B.status=NM,QY(A),B.pending!==0)return B.last_flush=-1,x7}if(B.status===Mk0)if(A.adler=0,c5(B,31),c5(B,139),c5(B,8),!B.gzhead){if(c5(B,0),c5(B,0),c5(B,0),c5(B,0),c5(B,0),c5(B,B.level===9?2:B.strategy>=x50||B.level<2?4:0),c5(B,$26),B.status=NM,QY(A),B.pending!==0)return B.last_flush=-1,x7}else{if(c5(B,(B.gzhead.text?1:0)+(B.gzhead.hcrc?2:0)+(!B.gzhead.extra?0:4)+(!B.gzhead.name?0:8)+(!B.gzhead.comment?0:16)),c5(B,B.gzhead.time&255),c5(B,B.gzhead.time>>8&255),c5(B,B.gzhead.time>>16&255),c5(B,B.gzhead.time>>24&255),c5(B,B.level===9?2:B.strategy>=x50||B.level<2?4:0),c5(B,B.gzhead.os&255),B.gzhead.extra&&B.gzhead.extra.length)c5(B,B.gzhead.extra.length&255),c5(B,B.gzhead.extra.length>>8&255);if(B.gzhead.hcrc)A.adler=t9(A.adler,B.pending_buf,B.pending,0);B.gzindex=0,B.status=Ek0}if(B.status===Ek0){if(B.gzhead.extra){let J=B.pending,Y=(B.gzhead.extra.length&65535)-B.gzindex;while(B.pending+Y>B.pending_buf_size){let F=B.pending_buf_size-B.pending;if(B.pending_buf.set(B.gzhead.extra.subarray(B.gzindex,B.gzindex+F),B.pending),B.pending=B.pending_buf_size,B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);if(B.gzindex+=F,QY(A),B.pending!==0)return B.last_flush=-1,x7;J=0,Y-=F}let Z=new Uint8Array(B.gzhead.extra);if(B.pending_buf.set(Z.subarray(B.gzindex,B.gzindex+Y),B.pending),B.pending+=Y,B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);B.gzindex=0}B.status=zk0}if(B.status===zk0){if(B.gzhead.name){let J=B.pending,Y;do{if(B.pending===B.pending_buf_size){if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);if(QY(A),B.pending!==0)return B.last_flush=-1,x7;J=0}if(B.gzindex<B.gzhead.name.length)Y=B.gzhead.name.charCodeAt(B.gzindex++)&255;else Y=0;c5(B,Y)}while(Y!==0);if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);B.gzindex=0}B.status=Wk0}if(B.status===Wk0){if(B.gzhead.comment){let J=B.pending,Y;do{if(B.pending===B.pending_buf_size){if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J);if(QY(A),B.pending!==0)return B.last_flush=-1,x7;J=0}if(B.gzindex<B.gzhead.comment.length)Y=B.gzhead.comment.charCodeAt(B.gzindex++)&255;else Y=0;c5(B,Y)}while(Y!==0);if(B.gzhead.hcrc&&B.pending>J)A.adler=t9(A.adler,B.pending_buf,B.pending-J,J)}B.status=Hk0}if(B.status===Hk0){if(B.gzhead.hcrc){if(B.pending+2>B.pending_buf_size){if(QY(A),B.pending!==0)return B.last_flush=-1,x7}c5(B,A.adler&255),c5(B,A.adler>>8&255),A.adler=0}if(B.status=NM,QY(A),B.pending!==0)return B.last_flush=-1,x7}if(A.avail_in!==0||B.lookahead!==0||Q!==vH&&B.status!==hm){let J=B.level===0?It1(B,Q):B.strategy===x50?F26(B,Q):B.strategy===d86?Z26(B,Q):gm[B.level].func(B,Q);if(J===CM||J===vT)B.status=hm;if(J===OB||J===CM){if(A.avail_out===0)B.last_flush=-1;return x7}if(J===ST){if(Q===u86)b86(B);else if(Q!==Os1){if(Uk0(B,0,0,!1),Q===h86){if(TH(B.head),B.lookahead===0)B.strstart=0,B.block_start=0,B.insert=0}}if(QY(A),A.avail_out===0)return B.last_flush=-1,x7}}if(Q!==vZ)return x7;if(B.wrap<=0)return js1;if(B.wrap===2)c5(B,A.adler&255),c5(B,A.adler>>8&255),c5(B,A.adler>>16&255),c5(B,A.adler>>24&255),c5(B,A.total_in&255),c5(B,A.total_in>>8&255),c5(B,A.total_in>>16&255),c5(B,A.total_in>>24&255);else um(B,A.adler>>>16),um(B,A.adler&65535);if(QY(A),B.wrap>0)B.wrap=-B.wrap;return B.pending!==0?x7:js1},K26=(A)=>{if(em(A))return rG;let Q=A.state.status;return A.state=null,Q===NM?IM(A,g86):x7},E26=(A,Q)=>{let B=Q.length;if(em(A))return rG;let $=A.state,J=$.wrap;if(J===2||J===1&&$.status!==_T||$.lookahead)return rG;if(J===1)A.adler=am(A.adler,Q,B,0);if($.wrap=0,B>=$.w_size){if(J===0)TH($.head),$.strstart=0,$.block_start=0,$.insert=0;let X=new Uint8Array($.w_size);X.set(Q.subarray(B-$.w_size,B),0),Q=X,B=$.w_size}let{avail_in:Y,next_in:Z,input:F}=A;A.avail_in=B,A.next_in=0,A.input=Q,TT($);while($.lookahead>=B5){let X=$.strstart,D=$.lookahead-(B5-1);do $.ins_h=yH($,$.ins_h,$.window[X+B5-1]),$.prev[X&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=X,X++;while(--D);$.strstart=X,$.lookahead=B5-1,TT($)}return $.strstart+=$.lookahead,$.block_start=$.strstart,$.insert=$.lookahead,$.lookahead=0,$.match_length=$.prev_length=B5-1,$.match_available=0,A.next_in=Z,A.input=F,A.avail_in=Y,$.wrap=J,x7},z26,W26,H26,q26,N26,I26,w26,C26,M26="pako deflate (from Nodeca project)",pm,L26=(A,Q)=>{return Object.prototype.hasOwnProperty.call(A,Q)},O26=function(A){let Q=Array.prototype.slice.call(arguments,1);while(Q.length){let B=Q.shift();if(!B)continue;if(typeof B!=="object")throw TypeError(B+"must be non-object");for(let $ in B)if(L26(B,$))A[$]=B[$]}return A},j26=(A)=>{let Q=0;for(let $=0,J=A.length;$<J;$++)Q+=A[$].length;let B=new Uint8Array(Q);for(let $=0,J=0,Y=A.length;$<Y;$++){let Z=A[$];B.set(Z,J),J+=Z.length}return B},i50,Lt1=!0,om,R26=(A)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(A);let Q,B,$,J,Y,Z=A.length,F=0;for(J=0;J<Z;J++){if(B=A.charCodeAt(J),(B&64512)===55296&&J+1<Z){if($=A.charCodeAt(J+1),($&64512)===56320)B=65536+(B-55296<<10)+($-56320),J++}F+=B<128?1:B<2048?2:B<65536?3:4}Q=new Uint8Array(F);for(Y=0,J=0;Y<F;J++){if(B=A.charCodeAt(J),(B&64512)===55296&&J+1<Z){if($=A.charCodeAt(J+1),($&64512)===56320)B=65536+(B-55296<<10)+($-56320),J++}if(B<128)Q[Y++]=B;else if(B<2048)Q[Y++]=192|B>>>6,Q[Y++]=128|B&63;else if(B<65536)Q[Y++]=224|B>>>12,Q[Y++]=128|B>>>6&63,Q[Y++]=128|B&63;else Q[Y++]=240|B>>>18,Q[Y++]=128|B>>>12&63,Q[Y++]=128|B>>>6&63,Q[Y++]=128|B&63}return Q},P26=(A,Q)=>{if(Q<65534){if(A.subarray&&Lt1)return String.fromCharCode.apply(null,A.length===Q?A:A.subarray(0,Q))}let B="";for(let $=0;$<Q;$++)B+=String.fromCharCode(A[$]);return B},_26=(A,Q)=>{let B=Q||A.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(A.subarray(0,Q));let $,J,Y=Array(B*2);for(J=0,$=0;$<B;){let Z=A[$++];if(Z<128){Y[J++]=Z;continue}let F=om[Z];if(F>4){Y[J++]=65533,$+=F-1;continue}Z&=F===2?31:F===3?15:7;while(F>1&&$<B)Z=Z<<6|A[$++]&63,F--;if(F>1){Y[J++]=65533;continue}if(Z<65536)Y[J++]=Z;else Z-=65536,Y[J++]=55296|Z>>10&1023,Y[J++]=56320|Z&1023}return P26(Y,J)},T26=(A,Q)=>{if(Q=Q||A.length,Q>A.length)Q=A.length;let B=Q-1;while(B>=0&&(A[B]&192)===128)B--;if(B<0)return Q;if(B===0)return Q;return B+om[A[B]]>Q?B:Q},rm,Ot1,jt1,S26,v26,y26,f26,d50,x26,b26,u26,h26,p26,d26,c26,l26,i26,n26,b50=16209,a26=16191,o26=function(Q,B){let $,J,Y,Z,F,X,D,G,V,U,K,E,z,W,H,q,N,I,w,O,L,R,v,T,f=Q.state;$=Q.next_in,v=Q.input,J=$+(Q.avail_in-5),Y=Q.next_out,T=Q.output,Z=Y-(B-Q.avail_out),F=Y+(Q.avail_out-257),X=f.dmax,D=f.wsize,G=f.whave,V=f.wnext,U=f.window,K=f.hold,E=f.bits,z=f.lencode,W=f.distcode,H=(1<<f.lenbits)-1,q=(1<<f.distbits)-1;A:do{if(E<15)K+=v[$++]<<E,E+=8,K+=v[$++]<<E,E+=8;N=z[K&H];Q:for(;;){if(I=N>>>24,K>>>=I,E-=I,I=N>>>16&255,I===0)T[Y++]=N&65535;else if(I&16){if(w=N&65535,I&=15,I){if(E<I)K+=v[$++]<<E,E+=8;w+=K&(1<<I)-1,K>>>=I,E-=I}if(E<15)K+=v[$++]<<E,E+=8,K+=v[$++]<<E,E+=8;N=W[K&q];B:for(;;){if(I=N>>>24,K>>>=I,E-=I,I=N>>>16&255,I&16){if(O=N&65535,I&=15,E<I){if(K+=v[$++]<<E,E+=8,E<I)K+=v[$++]<<E,E+=8}if(O+=K&(1<<I)-1,O>X){Q.msg="invalid distance too far back",f.mode=b50;break A}if(K>>>=I,E-=I,I=Y-Z,O>I){if(I=O-I,I>G){if(f.sane){Q.msg="invalid distance too far back",f.mode=b50;break A}}if(L=0,R=U,V===0){if(L+=D-I,I<w){w-=I;do T[Y++]=U[L++];while(--I);L=Y-O,R=T}}else if(V<I){if(L+=D+V-I,I-=V,I<w){w-=I;do T[Y++]=U[L++];while(--I);if(L=0,V<w){I=V,w-=I;do T[Y++]=U[L++];while(--I);L=Y-O,R=T}}}else if(L+=V-I,I<w){w-=I;do T[Y++]=U[L++];while(--I);L=Y-O,R=T}while(w>2)T[Y++]=R[L++],T[Y++]=R[L++],T[Y++]=R[L++],w-=3;if(w){if(T[Y++]=R[L++],w>1)T[Y++]=R[L++]}}else{L=Y-O;do T[Y++]=T[L++],T[Y++]=T[L++],T[Y++]=T[L++],w-=3;while(w>2);if(w){if(T[Y++]=T[L++],w>1)T[Y++]=T[L++]}}}else if((I&64)===0){N=W[(N&65535)+(K&(1<<I)-1)];continue B}else{Q.msg="invalid distance code",f.mode=b50;break A}break}}else if((I&64)===0){N=z[(N&65535)+(K&(1<<I)-1)];continue Q}else if(I&32){f.mode=a26;break A}else{Q.msg="invalid literal/length code",f.mode=b50;break A}break}}while($<J&&Y<F);w=E>>3,$-=w,E-=w<<3,K&=(1<<E)-1,Q.next_in=$,Q.next_out=Y,Q.avail_in=$<J?5+(J-$):5-($-J),Q.avail_out=Y<F?257+(F-Y):257-(Y-F),f.hold=K,f.bits=E;return},RT=15,Ps1=852,_s1=592,Ts1=0,Bk0=1,ks1=2,r26,s26,t26,e26,A96=(A,Q,B,$,J,Y,Z,F)=>{let X=F.bits,D=0,G=0,V=0,U=0,K=0,E=0,z=0,W=0,H=0,q=0,N,I,w,O,L,R=null,v,T=new Uint16Array(RT+1),f=new Uint16Array(RT+1),g=null,u,k,b;for(D=0;D<=RT;D++)T[D]=0;for(G=0;G<$;G++)T[Q[B+G]]++;K=X;for(U=RT;U>=1;U--)if(T[U]!==0)break;if(K>U)K=U;if(U===0)return J[Y++]=20971520,J[Y++]=20971520,F.bits=1,0;for(V=1;V<U;V++)if(T[V]!==0)break;if(K<V)K=V;W=1;for(D=1;D<=RT;D++)if(W<<=1,W-=T[D],W<0)return-1;if(W>0&&(A===Ts1||U!==1))return-1;f[1]=0;for(D=1;D<RT;D++)f[D+1]=f[D]+T[D];for(G=0;G<$;G++)if(Q[B+G]!==0)Z[f[Q[B+G]]++]=G;if(A===Ts1)R=g=Z,v=20;else if(A===Bk0)R=r26,g=s26,v=257;else R=t26,g=e26,v=0;if(q=0,G=0,D=V,L=Y,E=K,z=0,w=-1,H=1<<K,O=H-1,A===Bk0&&H>Ps1||A===ks1&&H>_s1)return 1;for(;;){if(u=D-z,Z[G]+1<v)k=0,b=Z[G];else if(Z[G]>=v)k=g[Z[G]-v],b=R[Z[G]-v];else k=96,b=0;N=1<<D-z,I=1<<E,V=I;do I-=N,J[L+(q>>z)+I]=u<<24|k<<16|b|0;while(I!==0);N=1<<D-1;while(q&N)N>>=1;if(N!==0)q&=N-1,q+=N;else q=0;if(G++,--T[D]===0){if(D===U)break;D=Q[B+Z[G]]}if(D>K&&(q&O)!==w){if(z===0)z=K;L+=V,E=D-z,W=1<<E;while(E+z<U){if(W-=T[E+z],W<=0)break;E++,W<<=1}if(H+=1<<E,A===Bk0&&H>Ps1||A===ks1&&H>_s1)return 1;w=q&O,J[w]=K<<24|E<<16|L-Y|0}}if(q!==0)J[L+q]=D-z<<24|4194304|0;return F.bits=K,0},dm,Q96=0,Rt1=1,Pt1=2,Ss1,B96,u50,MM,$96,J96,yZ,_t1,Tt1,Y96,vs1,n50=16180,ys1=16181,fs1=16182,xs1=16183,bs1=16184,us1=16185,hs1=16186,gs1=16187,ms1=16188,ps1=16189,c50=16190,cK=16191,$k0=16192,ds1=16193,Jk0=16194,cs1=16195,ls1=16196,is1=16197,ns1=16198,h50=16199,g50=16200,as1=16201,os1=16202,rs1=16203,ss1=16204,ts1=16205,Yk0=16206,es1=16207,At1=16208,W8=16209,kt1=16210,St1=16211,Z96=852,F96=592,X96=15,D96,Qt1=(A)=>{return(A>>>24&255)+(A>>>8&65280)+((A&65280)<<8)+((A&255)<<24)},OM=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.mode<n50||Q.mode>St1)return 1;return 0},vt1=(A)=>{if(OM(A))return yZ;let Q=A.state;if(A.total_in=A.total_out=Q.total=0,A.msg="",Q.wrap)A.adler=Q.wrap&1;return Q.mode=n50,Q.last=0,Q.havedict=0,Q.flags=-1,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new Int32Array(Z96),Q.distcode=Q.distdyn=new Int32Array(F96),Q.sane=1,Q.back=-1,MM},yt1=(A)=>{if(OM(A))return yZ;let Q=A.state;return Q.wsize=0,Q.whave=0,Q.wnext=0,vt1(A)},ft1=(A,Q)=>{let B;if(OM(A))return yZ;let $=A.state;if(Q<0)B=0,Q=-Q;else if(B=(Q>>4)+5,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return yZ;if($.window!==null&&$.wbits!==Q)$.window=null;return $.wrap=B,$.wbits=Q,yt1(A)},xt1=(A,Q)=>{if(!A)return yZ;let B=new G96;A.state=B,B.strm=A,B.window=null,B.mode=n50;let $=ft1(A,Q);if($!==MM)A.state=null;return $},V96=(A)=>{return xt1(A,D96)},Bt1=!0,Zk0,Fk0,U96=(A)=>{if(Bt1){Zk0=new Int32Array(512),Fk0=new Int32Array(32);let Q=0;while(Q<144)A.lens[Q++]=8;while(Q<256)A.lens[Q++]=9;while(Q<280)A.lens[Q++]=7;while(Q<288)A.lens[Q++]=8;dm(Rt1,A.lens,0,288,Zk0,0,A.work,{bits:9}),Q=0;while(Q<32)A.lens[Q++]=5;dm(Pt1,A.lens,0,32,Fk0,0,A.work,{bits:5}),Bt1=!1}A.lencode=Zk0,A.lenbits=9,A.distcode=Fk0,A.distbits=5},bt1=(A,Q,B,$)=>{let J,Y=A.state;if(Y.window===null)Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new Uint8Array(Y.wsize);if($>=Y.wsize)Y.window.set(Q.subarray(B-Y.wsize,B),0),Y.wnext=0,Y.whave=Y.wsize;else{if(J=Y.wsize-Y.wnext,J>$)J=$;if(Y.window.set(Q.subarray(B-$,B-$+J),Y.wnext),$-=J,$)Y.window.set(Q.subarray(B-$,B),0),Y.wnext=$,Y.whave=Y.wsize;else{if(Y.wnext+=J,Y.wnext===Y.wsize)Y.wnext=0;if(Y.whave<Y.wsize)Y.whave+=J}}return 0},K96=(A,Q)=>{let B,$,J,Y,Z,F,X,D,G,V,U,K,E,z,W=0,H,q,N,I,w,O,L,R,v=new Uint8Array(4),T,f,g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(OM(A)||!A.output||!A.input&&A.avail_in!==0)return yZ;if(B=A.state,B.mode===cK)B.mode=$k0;Z=A.next_out,J=A.output,X=A.avail_out,Y=A.next_in,$=A.input,F=A.avail_in,D=B.hold,G=B.bits,V=F,U=X,R=MM;A:for(;;)switch(B.mode){case n50:if(B.wrap===0){B.mode=$k0;break}while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.wrap&2&&D===35615){if(B.wbits===0)B.wbits=15;B.check=0,v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0),D=0,G=0,B.mode=ys1;break}if(B.head)B.head.done=!1;if(!(B.wrap&1)||(((D&255)<<8)+(D>>8))%31){A.msg="incorrect header check",B.mode=W8;break}if((D&15)!==vs1){A.msg="unknown compression method",B.mode=W8;break}if(D>>>=4,G-=4,L=(D&15)+8,B.wbits===0)B.wbits=L;if(L>15||L>B.wbits){A.msg="invalid window size",B.mode=W8;break}B.dmax=1<<B.wbits,B.flags=0,A.adler=B.check=1,B.mode=D&512?ps1:cK,D=0,G=0;break;case ys1:while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.flags=D,(B.flags&255)!==vs1){A.msg="unknown compression method",B.mode=W8;break}if(B.flags&57344){A.msg="unknown header flags set",B.mode=W8;break}if(B.head)B.head.text=D>>8&1;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0);D=0,G=0,B.mode=fs1;case fs1:while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.head)B.head.time=D;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,v[2]=D>>>16&255,v[3]=D>>>24&255,B.check=t9(B.check,v,4,0);D=0,G=0,B.mode=xs1;case xs1:while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.head)B.head.xflags=D&255,B.head.os=D>>8;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0);D=0,G=0,B.mode=bs1;case bs1:if(B.flags&1024){while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.length=D,B.head)B.head.extra_len=D;if(B.flags&512&&B.wrap&4)v[0]=D&255,v[1]=D>>>8&255,B.check=t9(B.check,v,2,0);D=0,G=0}else if(B.head)B.head.extra=null;B.mode=us1;case us1:if(B.flags&1024){if(K=B.length,K>F)K=F;if(K){if(B.head){if(L=B.head.extra_len-B.length,!B.head.extra)B.head.extra=new Uint8Array(B.head.extra_len);B.head.extra.set($.subarray(Y,Y+K),L)}if(B.flags&512&&B.wrap&4)B.check=t9(B.check,$,K,Y);F-=K,Y+=K,B.length-=K}if(B.length)break A}B.length=0,B.mode=hs1;case hs1:if(B.flags&2048){if(F===0)break A;K=0;do if(L=$[Y+K++],B.head&&L&&B.length<65536)B.head.name+=String.fromCharCode(L);while(L&&K<F);if(B.flags&512&&B.wrap&4)B.check=t9(B.check,$,K,Y);if(F-=K,Y+=K,L)break A}else if(B.head)B.head.name=null;B.length=0,B.mode=gs1;case gs1:if(B.flags&4096){if(F===0)break A;K=0;do if(L=$[Y+K++],B.head&&L&&B.length<65536)B.head.comment+=String.fromCharCode(L);while(L&&K<F);if(B.flags&512&&B.wrap&4)B.check=t9(B.check,$,K,Y);if(F-=K,Y+=K,L)break A}else if(B.head)B.head.comment=null;B.mode=ms1;case ms1:if(B.flags&512){while(G<16){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.wrap&4&&D!==(B.check&65535)){A.msg="header crc mismatch",B.mode=W8;break}D=0,G=0}if(B.head)B.head.hcrc=B.flags>>9&1,B.head.done=!0;A.adler=B.check=0,B.mode=cK;break;case ps1:while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}A.adler=B.check=Qt1(D),D=0,G=0,B.mode=c50;case c50:if(B.havedict===0)return A.next_out=Z,A.avail_out=X,A.next_in=Y,A.avail_in=F,B.hold=D,B.bits=G,J96;A.adler=B.check=1,B.mode=cK;case cK:if(Q===B96||Q===u50)break A;case $k0:if(B.last){D>>>=G&7,G-=G&7,B.mode=Yk0;break}while(G<3){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}switch(B.last=D&1,D>>>=1,G-=1,D&3){case 0:B.mode=ds1;break;case 1:if(U96(B),B.mode=h50,Q===u50){D>>>=2,G-=2;break A}break;case 2:B.mode=ls1;break;case 3:A.msg="invalid block type",B.mode=W8}D>>>=2,G-=2;break;case ds1:D>>>=G&7,G-=G&7;while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if((D&65535)!==(D>>>16^65535)){A.msg="invalid stored block lengths",B.mode=W8;break}if(B.length=D&65535,D=0,G=0,B.mode=Jk0,Q===u50)break A;case Jk0:B.mode=cs1;case cs1:if(K=B.length,K){if(K>F)K=F;if(K>X)K=X;if(K===0)break A;J.set($.subarray(Y,Y+K),Z),F-=K,Y+=K,X-=K,Z+=K,B.length-=K;break}B.mode=cK;break;case ls1:while(G<14){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.nlen=(D&31)+257,D>>>=5,G-=5,B.ndist=(D&31)+1,D>>>=5,G-=5,B.ncode=(D&15)+4,D>>>=4,G-=4,B.nlen>286||B.ndist>30){A.msg="too many length or distance symbols",B.mode=W8;break}B.have=0,B.mode=is1;case is1:while(B.have<B.ncode){while(G<3){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}B.lens[g[B.have++]]=D&7,D>>>=3,G-=3}while(B.have<19)B.lens[g[B.have++]]=0;if(B.lencode=B.lendyn,B.lenbits=7,T={bits:B.lenbits},R=dm(Q96,B.lens,0,19,B.lencode,0,B.work,T),B.lenbits=T.bits,R){A.msg="invalid code lengths set",B.mode=W8;break}B.have=0,B.mode=ns1;case ns1:while(B.have<B.nlen+B.ndist){for(;;){if(W=B.lencode[D&(1<<B.lenbits)-1],H=W>>>24,q=W>>>16&255,N=W&65535,H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(N<16)D>>>=H,G-=H,B.lens[B.have++]=N;else{if(N===16){f=H+2;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(D>>>=H,G-=H,B.have===0){A.msg="invalid bit length repeat",B.mode=W8;break}L=B.lens[B.have-1],K=3+(D&3),D>>>=2,G-=2}else if(N===17){f=H+3;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=H,G-=H,L=0,K=3+(D&7),D>>>=3,G-=3}else{f=H+7;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=H,G-=H,L=0,K=11+(D&127),D>>>=7,G-=7}if(B.have+K>B.nlen+B.ndist){A.msg="invalid bit length repeat",B.mode=W8;break}while(K--)B.lens[B.have++]=L}}if(B.mode===W8)break;if(B.lens[256]===0){A.msg="invalid code -- missing end-of-block",B.mode=W8;break}if(B.lenbits=9,T={bits:B.lenbits},R=dm(Rt1,B.lens,0,B.nlen,B.lencode,0,B.work,T),B.lenbits=T.bits,R){A.msg="invalid literal/lengths set",B.mode=W8;break}if(B.distbits=6,B.distcode=B.distdyn,T={bits:B.distbits},R=dm(Pt1,B.lens,B.nlen,B.ndist,B.distcode,0,B.work,T),B.distbits=T.bits,R){A.msg="invalid distances set",B.mode=W8;break}if(B.mode=h50,Q===u50)break A;case h50:B.mode=g50;case g50:if(F>=6&&X>=258){if(A.next_out=Z,A.avail_out=X,A.next_in=Y,A.avail_in=F,B.hold=D,B.bits=G,o26(A,U),Z=A.next_out,J=A.output,X=A.avail_out,Y=A.next_in,$=A.input,F=A.avail_in,D=B.hold,G=B.bits,B.mode===cK)B.back=-1;break}B.back=0;for(;;){if(W=B.lencode[D&(1<<B.lenbits)-1],H=W>>>24,q=W>>>16&255,N=W&65535,H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(q&&(q&240)===0){I=H,w=q,O=N;for(;;){if(W=B.lencode[O+((D&(1<<I+w)-1)>>I)],H=W>>>24,q=W>>>16&255,N=W&65535,I+H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=I,G-=I,B.back+=I}if(D>>>=H,G-=H,B.back+=H,B.length=N,q===0){B.mode=ts1;break}if(q&32){B.back=-1,B.mode=cK;break}if(q&64){A.msg="invalid literal/length code",B.mode=W8;break}B.extra=q&15,B.mode=as1;case as1:if(B.extra){f=B.extra;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}B.length+=D&(1<<B.extra)-1,D>>>=B.extra,G-=B.extra,B.back+=B.extra}B.was=B.length,B.mode=os1;case os1:for(;;){if(W=B.distcode[D&(1<<B.distbits)-1],H=W>>>24,q=W>>>16&255,N=W&65535,H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if((q&240)===0){I=H,w=q,O=N;for(;;){if(W=B.distcode[O+((D&(1<<I+w)-1)>>I)],H=W>>>24,q=W>>>16&255,N=W&65535,I+H<=G)break;if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}D>>>=I,G-=I,B.back+=I}if(D>>>=H,G-=H,B.back+=H,q&64){A.msg="invalid distance code",B.mode=W8;break}B.offset=N,B.extra=q&15,B.mode=rs1;case rs1:if(B.extra){f=B.extra;while(G<f){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}B.offset+=D&(1<<B.extra)-1,D>>>=B.extra,G-=B.extra,B.back+=B.extra}if(B.offset>B.dmax){A.msg="invalid distance too far back",B.mode=W8;break}B.mode=ss1;case ss1:if(X===0)break A;if(K=U-X,B.offset>K){if(K=B.offset-K,K>B.whave){if(B.sane){A.msg="invalid distance too far back",B.mode=W8;break}}if(K>B.wnext)K-=B.wnext,E=B.wsize-K;else E=B.wnext-K;if(K>B.length)K=B.length;z=B.window}else z=J,E=Z-B.offset,K=B.length;if(K>X)K=X;X-=K,B.length-=K;do J[Z++]=z[E++];while(--K);if(B.length===0)B.mode=g50;break;case ts1:if(X===0)break A;J[Z++]=B.length,X--,B.mode=g50;break;case Yk0:if(B.wrap){while(G<32){if(F===0)break A;F--,D|=$[Y++]<<G,G+=8}if(U-=X,A.total_out+=U,B.total+=U,B.wrap&4&&U)A.adler=B.check=B.flags?t9(B.check,J,U,Z-U):am(B.check,J,U,Z-U);if(U=X,B.wrap&4&&(B.flags?D:Qt1(D))!==B.check){A.msg="incorrect data check",B.mode=W8;break}D=0,G=0}B.mode=es1;case es1:if(B.wrap&&B.flags){while(G<32){if(F===0)break A;F--,D+=$[Y++]<<G,G+=8}if(B.wrap&4&&D!==(B.total&4294967295)){A.msg="incorrect length check",B.mode=W8;break}D=0,G=0}B.mode=At1;case At1:R=$96;break A;case W8:R=_t1;break A;case kt1:return Tt1;case St1:default:return yZ}if(A.next_out=Z,A.avail_out=X,A.next_in=Y,A.avail_in=F,B.hold=D,B.bits=G,B.wsize||U!==A.avail_out&&B.mode<W8&&(B.mode<Yk0||Q!==Ss1)){if(bt1(A,A.output,A.next_out,U-A.avail_out));}if(V-=A.avail_in,U-=A.avail_out,A.total_in+=V,A.total_out+=U,B.total+=U,B.wrap&4&&U)A.adler=B.check=B.flags?t9(B.check,J,U,A.next_out-U):am(B.check,J,U,A.next_out-U);if(A.data_type=B.bits+(B.last?64:0)+(B.mode===cK?128:0)+(B.mode===h50||B.mode===Jk0?256:0),(V===0&&U===0||Q===Ss1)&&R===MM)R=Y96;return R},E96=(A)=>{if(OM(A))return yZ;let Q=A.state;if(Q.window)Q.window=null;return A.state=null,MM},z96=(A,Q)=>{if(OM(A))return yZ;let B=A.state;if((B.wrap&2)===0)return yZ;return B.head=Q,Q.done=!1,MM},W96=(A,Q)=>{let B=Q.length,$,J,Y;if(OM(A))return yZ;if($=A.state,$.wrap!==0&&$.mode!==c50)return yZ;if($.mode===c50){if(J=1,J=am(J,Q,B,0),J!==$.check)return _t1}if(Y=bt1(A,Q,B,B),Y)return $.mode=kt1,Tt1;return $.havedict=1,MM},H96,q96,N96,I96,w96,C96,M96,L96,O96,j96="pako inflate (from Nodeca project)",iK,P96,ut1,_96,T96,sm,Xk0,Dk0,k96,$t1,S96,y96,f96,x96,b96,u96,h96,g96,m96,p96,d96,c96,l96,i96,n96,a96,o96,r96,s96,t96,e96,A76,Q76,B76,ht1;var gt1=o(()=>{/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */cm=tm+1+Nk0,Yt1=2*cm+1,Gk0=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),m50=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),K86=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Dt1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lK=Array((cm+2)*2);kT(lK);mm=Array(PT*2);kT(mm);lm=Array(E86);kT(lm);im=Array(V86-G86+1);kT(im);Ck0=Array(Nk0);kT(Ck0);p50=Array(PT);kT(p50);O86=w86,j86=qt1,R86=M86,P86=L86,_86=C86,T86={_tr_init:O86,_tr_stored_block:j86,_tr_flush_block:R86,_tr_tally:P86,_tr_align:_86},am=k86,v86=new Uint32Array(S86()),t9=y86,wM={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},LM={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:f86,_tr_stored_block:Uk0,_tr_flush_block:x86,_tr_tally:SH,_tr_align:b86}=T86,{Z_NO_FLUSH:vH,Z_PARTIAL_FLUSH:u86,Z_FULL_FLUSH:h86,Z_FINISH:vZ,Z_BLOCK:Os1,Z_OK:x7,Z_STREAM_END:js1,Z_STREAM_ERROR:rG,Z_DATA_ERROR:g86,Z_BUF_ERROR:Ak0,Z_DEFAULT_COMPRESSION:m86,Z_FILTERED:p86,Z_HUFFMAN_ONLY:x50,Z_RLE:d86,Z_FIXED:c86,Z_DEFAULT_STRATEGY:l86,Z_UNKNOWN:i86,Z_DEFLATED:l50}=LM,Kk0=s86+1+r86,A26=2*Kk0+1,sG=kH+B5+1,yH=Y26;gm=[new aG(0,0,0,0,It1),new aG(4,4,8,4,Qk0),new aG(4,5,16,8,Qk0),new aG(4,6,32,32,Qk0),new aG(4,4,16,16,jT),new aG(8,16,32,32,jT),new aG(8,16,128,128,jT),new aG(8,32,128,256,jT),new aG(32,128,258,1024,jT),new aG(32,258,258,4096,jT)];z26=V26,W26=Mt1,H26=Ct1,q26=wt1,N26=G26,I26=U26,w26=K26,C26=E26,pm={deflateInit:z26,deflateInit2:W26,deflateReset:H26,deflateResetKeep:q26,deflateSetHeader:N26,deflate:I26,deflateEnd:w26,deflateSetDictionary:C26,deflateInfo:M26},i50={assign:O26,flattenChunks:j26};try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(A){Lt1=!1}om=new Uint8Array(256);for(let A=0;A<256;A++)om[A]=A>=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;om[254]=om[254]=1;rm={string2buf:R26,buf2string:_26,utf8border:T26};Ot1=k26,jt1=Object.prototype.toString,{Z_NO_FLUSH:S26,Z_SYNC_FLUSH:v26,Z_FULL_FLUSH:y26,Z_FINISH:f26,Z_OK:d50,Z_STREAM_END:x26,Z_DEFAULT_COMPRESSION:b26,Z_DEFAULT_STRATEGY:u26,Z_DEFLATED:h26}=LM;Ap.prototype.push=function(A,Q){let B=this.strm,$=this.options.chunkSize,J,Y;if(this.ended)return!1;if(Q===~~Q)Y=Q;else Y=Q===!0?f26:S26;if(typeof A==="string")B.input=rm.string2buf(A);else if(jt1.call(A)==="[object ArrayBuffer]")B.input=new Uint8Array(A);else B.input=A;B.next_in=0,B.avail_in=B.input.length;for(;;){if(B.avail_out===0)B.output=new Uint8Array($),B.next_out=0,B.avail_out=$;if((Y===v26||Y===y26)&&B.avail_out<=6){this.onData(B.output.subarray(0,B.next_out)),B.avail_out=0;continue}if(J=pm.deflate(B,Y),J===x26){if(B.next_out>0)this.onData(B.output.subarray(0,B.next_out));return J=pm.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===d50}if(B.avail_out===0){this.onData(B.output);continue}if(Y>0&&B.next_out>0){this.onData(B.output.subarray(0,B.next_out)),B.avail_out=0;continue}if(B.avail_in===0)break}return!0};Ap.prototype.onData=function(A){this.chunks.push(A)};Ap.prototype.onEnd=function(A){if(A===d50)this.result=i50.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};p26=Ap,d26=Lk0,c26=g26,l26=m26,i26=LM,n26={Deflate:p26,deflate:d26,deflateRaw:c26,gzip:l26,constants:i26},r26=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),s26=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),t26=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),e26=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),dm=A96,{Z_FINISH:Ss1,Z_BLOCK:B96,Z_TREES:u50,Z_OK:MM,Z_STREAM_END:$96,Z_NEED_DICT:J96,Z_STREAM_ERROR:yZ,Z_DATA_ERROR:_t1,Z_MEM_ERROR:Tt1,Z_BUF_ERROR:Y96,Z_DEFLATED:vs1}=LM,D96=X96;H96=yt1,q96=ft1,N96=vt1,I96=V96,w96=xt1,C96=K96,M96=E96,L96=z96,O96=W96,iK={inflateReset:H96,inflateReset2:q96,inflateResetKeep:N96,inflateInit:I96,inflateInit2:w96,inflate:C96,inflateEnd:M96,inflateGetHeader:L96,inflateSetDictionary:O96,inflateInfo:j96};P96=R96,ut1=Object.prototype.toString,{Z_NO_FLUSH:_96,Z_FINISH:T96,Z_OK:sm,Z_STREAM_END:Xk0,Z_NEED_DICT:Dk0,Z_STREAM_ERROR:k96,Z_DATA_ERROR:$t1,Z_MEM_ERROR:S96}=LM;Qp.prototype.push=function(A,Q){let B=this.strm,$=this.options.chunkSize,J=this.options.dictionary,Y,Z,F;if(this.ended)return!1;if(Q===~~Q)Z=Q;else Z=Q===!0?T96:_96;if(ut1.call(A)==="[object ArrayBuffer]")B.input=new Uint8Array(A);else B.input=A;B.next_in=0,B.avail_in=B.input.length;for(;;){if(B.avail_out===0)B.output=new Uint8Array($),B.next_out=0,B.avail_out=$;if(Y=iK.inflate(B,Z),Y===Dk0&&J){if(Y=iK.inflateSetDictionary(B,J),Y===sm)Y=iK.inflate(B,Z);else if(Y===$t1)Y=Dk0}while(B.avail_in>0&&Y===Xk0&&B.state.wrap>0&&A[B.next_in]!==0)iK.inflateReset(B),Y=iK.inflate(B,Z);switch(Y){case k96:case $t1:case Dk0:case S96:return this.onEnd(Y),this.ended=!0,!1}if(F=B.avail_out,B.next_out){if(B.avail_out===0||Y===Xk0)if(this.options.to==="string"){let X=rm.utf8border(B.output,B.next_out),D=B.next_out-X,G=rm.buf2string(B.output,X);if(B.next_out=D,B.avail_out=$-D,D)B.output.set(B.output.subarray(X,X+D),0);this.onData(G)}else this.onData(B.output.length===B.next_out?B.output:B.output.subarray(0,B.next_out))}if(Y===sm&&F===0)continue;if(Y===Xk0)return Y=iK.inflateEnd(this.strm),this.onEnd(Y),this.ended=!0,!0;if(B.avail_in===0)break}return!0};Qp.prototype.onData=function(A){this.chunks.push(A)};Qp.prototype.onEnd=function(A){if(A===sm)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=i50.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};y96=Qp,f96=Ok0,x96=v96,b96=Ok0,u96=LM,h96={Inflate:y96,inflate:f96,inflateRaw:x96,ungzip:b96,constants:u96},{Deflate:g96,deflate:m96,deflateRaw:p96,gzip:d96}=n26,{Inflate:c96,inflate:l96,inflateRaw:i96,ungzip:n96}=h96,a96=g96,o96=m96,r96=p96,s96=d96,t96=c96,e96=l96,A76=i96,Q76=n96,B76=LM,ht1={Deflate:a96,deflate:o96,deflateRaw:r96,gzip:s96,Inflate:t96,inflate:e96,inflateRaw:A76,ungzip:Q76,constants:B76}});import{randomFillSync as $76}from"crypto";function r50(){if(a50>o50.length-16)$76(o50),a50=0;return o50.slice(a50,a50+=16)}var o50,a50;var mt1=o(()=>{o50=new Uint8Array(256),a50=o50.length});function pt1(A,Q=0){return(b7[A[Q+0]]+b7[A[Q+1]]+b7[A[Q+2]]+b7[A[Q+3]]+"-"+b7[A[Q+4]]+b7[A[Q+5]]+"-"+b7[A[Q+6]]+b7[A[Q+7]]+"-"+b7[A[Q+8]]+b7[A[Q+9]]+"-"+b7[A[Q+10]]+b7[A[Q+11]]+b7[A[Q+12]]+b7[A[Q+13]]+b7[A[Q+14]]+b7[A[Q+15]]).toLowerCase()}var b7;var dt1=o(()=>{b7=[];for(let A=0;A<256;++A)b7.push((A+256).toString(16).slice(1))});function J76(A,Q,B){let $;if(A)$=ct1(A.random??A.rng?.()??r50(),A.msecs,A.seq,Q,B);else{let J=Date.now(),Y=r50();Y76(jk0,J,Y),$=ct1(Y,jk0.msecs,jk0.seq,Q,B)}return Q??pt1($)}function Y76(A,Q,B){if(A.msecs??=-1/0,A.seq??=0,Q>A.msecs)A.seq=B[6]<<23|B[7]<<16|B[8]<<8|B[9],A.msecs=Q;else if(A.seq=A.seq+1|0,A.seq===0)A.msecs++;return A}function ct1(A,Q,B,$,J=0){if(A.length<16)throw Error("Random bytes length must be >= 16");if(!$)$=new Uint8Array(16),J=0;else if(J<0||J+16>$.length)throw RangeError(`UUID byte range ${J}:${J+15} is out of buffer bounds`);return Q??=Date.now(),B??=A[6]*127<<24|A[7]<<16|A[8]<<8|A[9],$[J++]=Q/1099511627776&255,$[J++]=Q/4294967296&255,$[J++]=Q/16777216&255,$[J++]=Q/65536&255,$[J++]=Q/256&255,$[J++]=Q&255,$[J++]=112|B>>>28&15,$[J++]=B>>>20&255,$[J++]=128|B>>>14&63,$[J++]=B>>>6&255,$[J++]=B<<2&255|A[10]&3,$[J++]=A[11],$[J++]=A[12],$[J++]=A[13],$[J++]=A[14],$[J++]=A[15],$}var jk0,yT;var lt1=o(()=>{mt1();dt1();jk0={};yT=J76});var Rk0=o(()=>{lt1()});function Z76(A){let Q=0,B=[];while(Q<A.length){let $=A[Q];if($==="\\"){Q++;continue}if($==="{"){B.push({type:"brace",value:"{"}),Q++;continue}if($==="}"){B.push({type:"brace",value:"}"}),Q++;continue}if($==="["){B.push({type:"paren",value:"["}),Q++;continue}if($==="]"){B.push({type:"paren",value:"]"}),Q++;continue}if($===":"){B.push({type:"separator",value:":"}),Q++;continue}if($===","){B.push({type:"delimiter",value:","}),Q++;continue}if($==='"'){let F="",X=!1;$=A[++Q];while($!=='"'){if(Q===A.length){X=!0;break}if($==="\\"){if(Q++,Q===A.length){X=!0;break}F+=$+A[Q],$=A[++Q]}else F+=$,$=A[++Q]}if($=A[++Q],!X)B.push({type:"string",value:F});continue}if($&&/\s/.test($)){Q++;continue}let Y=/[0-9]/;if($&&Y.test($)||$==="-"||$==="."){let F="";if($==="-")F+=$,$=A[++Q];while($&&Y.test($)||$===".")F+=$,$=A[++Q];B.push({type:"number",value:F});continue}let Z=/[a-z]/i;if($&&Z.test($)){let F="";while($&&Z.test($)){if(Q===A.length)break;F+=$,$=A[++Q]}if(F==="true"||F==="false"||F==="null")B.push({type:"name",value:F});else{Q++;continue}continue}Q++}return B}function fT(A){if(A.length===0)return A;let Q=A[A.length-1];if(!Q)return A;switch(Q.type){case"separator":return fT(A.slice(0,A.length-1));case"number":{let B=Q.value[Q.value.length-1];if(B==="."||B==="-")return fT(A.slice(0,A.length-1));break}case"string":{let B=A[A.length-2];if(B?.type==="delimiter")return fT(A.slice(0,A.length-1));else if(B?.type==="brace"&&B.value==="{")return fT(A.slice(0,A.length-1));break}case"delimiter":return fT(A.slice(0,A.length-1))}return A}function F76(A){let Q=[];for(let B of A){if(B.type==="brace")if(B.value==="{")Q.push("}");else{let $=Q.lastIndexOf("}");if($!==-1)Q.splice($,1)}if(B.type==="paren")if(B.value==="[")Q.push("]");else{let $=Q.lastIndexOf("]");if($!==-1)Q.splice($,1)}}if(Q.length>0){Q.reverse();for(let B of Q)if(B==="}")A.push({type:"brace",value:"}"});else if(B==="]")A.push({type:"paren",value:"]"})}return A}function X76(A){let Q="";for(let B of A)switch(B.type){case"string":Q+='"'+B.value+'"';break;default:Q+=B.value;break}return Q}function s50(A){let Q=X76(F76(fT(Z76(A))));return JSON.parse(Q)}function t50(A){try{let Q=s50(A);if(Q!==null&&typeof Q==="object"&&!Array.isArray(Q))return Q;return{}}catch{return{}}}function e50(A,Q,B="..."){if(A.length<=Q)return A;return A.slice(0,Math.max(0,Q-B.length))+B}function D76(A){let Q=A.match(/^(?:cat\s+)?<<['"]?(\w+)['"]?\s*\n([\s\S]*?)\n\1\s*$/);if(Q)return Q[2];return A}function G76(A,Q){let B=A[Q];if(!B)return null;let $=B.match(/^\*\*\* Add File: (.+)$/);if($)return{filePath:$[1],nextIdx:Q+1};let J=B.match(/^\*\*\* Delete File: (.+)$/);if(J)return{filePath:J[1],nextIdx:Q+1};let Y=B.match(/^\*\*\* Update File: (.+)$/);if(Y){let Z,F=Q+1,X=A[F];if(X){let D=X.match(/^\*\*\* Move to: (.+)$/);if(D)Z=D[1],F++}return{filePath:Y[1],movePath:Z,nextIdx:F}}return null}function Pk0(A){return A.startsWith("*** Add File:")||A.startsWith("*** Update File:")||A.startsWith("*** Delete File:")||A.trim()==="*** End Patch"}function V76(A,Q){let B=[],$=Q;while($<A.length){let J=A[$];if(Pk0(J))break;if(J.startsWith("+"))B.push(J.slice(1));else if(J==="")B.push("");else throw Error(`Invalid patch format: Add File lines must start with '+', got: "${J.slice(0,20)}${J.length>20?"...":""}"`);$++}return{content:B.join(`
|
|
217
217
|
`),nextIdx:$}}function it1(A){return A.startsWith("+")||A.startsWith("-")||A.startsWith(" ")}function U76(A,Q){let B=[],$=Q;while($<A.length){let J=A[$];if(Pk0(J))break;if(J.trim()==="*** End of File"){$++;continue}if(J.startsWith("@@")||it1(J)){let{chunk:Y,nextIdx:Z}=K76(A,$);B.push(Y),$=Z;continue}throw Error(`Invalid patch format: unexpected line in Update File: "${J.slice(0,30)}..."`)}return{chunks:B,nextIdx:$}}function K76(A,Q){let B=Q,$=[],J=[],Y=!1,Z=[];while(B<A.length&&A[B].startsWith("@@")){let D=A[B].slice(2).trimStart();if(D)Z.push(D);B++}while(B<A.length){let X=A[B];if(X.trim()==="*** End of File"){Y=!0,B++;break}if(X.startsWith("@@")||Pk0(X))break;if(!it1(X))throw Error(`Invalid patch format: hunk lines must start with ' ', '-', or '+', got: "${X.slice(0,20)}..."`);if(X.startsWith("-"))$.push(X.slice(1));else if(X.startsWith("+"))J.push(X.slice(1));else if(X.startsWith(" "))$.push(X.slice(1)),J.push(X.slice(1));B++}let F=Z.length>0?Z.filter(Boolean).join(`
|
|
218
218
|
`):void 0;return{chunk:{oldLines:$,newLines:J,changeContext:F,isEndOfFile:Y},nextIdx:B}}function tG(A){let B=D76(A.trim()).split(`
|
|
219
219
|
`),$=[],J=[],Y="*** Begin Patch",Z="*** End Patch",F=B.findIndex((K)=>K.trim()==="*** Begin Patch"),X=B.findIndex((K)=>K.trim()==="*** End Patch");if(F===-1&&X===-1)throw Error(`Invalid patch format: missing *** Begin Patch and *** End Patch markers.
|
|
@@ -5354,12 +5354,12 @@ ${z}`))}},error:(E)=>{if(!K)K=!0,D(Error(`Failed to spawn brew: ${E.message}`))}
|
|
|
5354
5354
|
${z}`;if(Z==="pnpm"&&z.includes("Unable to find the global bin directory"))W+=`
|
|
5355
5355
|
|
|
5356
5356
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
5357
|
-
npm install -g ${Y}`;D(Error(W))}},error:(E)=>{if(!U)U=!0,D(Error(`Failed to spawn ${Z}: ${E.message}`))},complete:()=>{if(!U)U=!0,X()}})})}d0();d0();Az();var fq5="@ampcode/cli";async function lF0(A,Q,B=fq5){let J=`${Q||"https://registry.npmjs.org"}/${B}/latest`,Y=new AbortController,Z=setTimeout(()=>Y.abort(),5000);try{let F=await fetch(J,{signal:Y.signal});if(!F.ok)return{hasUpdate:!1,currentVersion:A,source:"npm"};let X=await F.json(),D=X.version??X["dist-tags"]?.latest;if(!D)return{hasUpdate:!1,currentVersion:A,source:"npm"};let G=Wo(A,D),V=G<0,U,K;if(X.time){let E=X.time[A],z=X.time[D],W=Date.now();if(E)U=Math.floor((W-new Date(E).getTime())/3600000);if(z)K=Math.floor((W-new Date(z).getTime())/3600000)}return j.info("NPM version comparison",{currentVersion:A,latestVersion:D,compareResult:G,hasUpdate:V,currentVersionAge:U,latestVersionAge:K}),{hasUpdate:V,latestVersion:D,currentVersion:A,currentVersionAge:U,latestVersionAge:K,source:"npm"}}catch(F){return j.debug("Error checking npm version",{error:F}),{hasUpdate:!1,currentVersion:A,source:"npm"}}finally{clearTimeout(Z)}}var xq5="https://static.ampcode.com/cli/cli-version.txt";async function iF0(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),5000);try{let $=await fetch(`${xq5}?t=${Date.now()}`,{signal:Q.signal,cache:"no-store"});if(!$.ok)return{hasUpdate:!1,currentVersion:A,source:"bin"};let J=(await $.text()).trim();if(!J||!/^\d+\.\d+\.\d+/.test(J))return{hasUpdate:!1,currentVersion:A,source:"bin"};let Y=Wo(A,J),Z=Y<0;return j.info("Bin version comparison",{currentVersion:A,latestVersion:J,compareResult:Y,hasUpdate:Z}),{hasUpdate:Z,latestVersion:J,currentVersion:A,source:"bin"}}catch($){return j.debug("Error checking bin version",{error:$}),{hasUpdate:!1,currentVersion:A,source:"bin"}}finally{clearTimeout(B)}}var bq5=604800000;function Lx4(A){if(!A)return null;let Q=typeof A==="number"?A:new Date(A).getTime();if(isNaN(Q))return null;let B=Date.now()-Q;if(B>bq5)return{ageMs:B};return null}function Wo(A,Q){let B=(Z)=>{let[F,X]=Z.split("-");return{parts:F?.split(".").map(Number)||[],label:X}},$=B(A),J=B(Q),Y=Math.max($.parts.length,J.parts.length);for(let Z=0;Z<Y;Z++){let F=$.parts[Z]||0,X=J.parts[Z]||0;if(F<X)return-1;if(F>X)return 1}if($.label===J.label)return 0;if(!$.label&&J.label)return 1;if($.label&&!J.label)return-1;if($.label&&J.label)return $.label<J.label?-1:1;return 0}function Ho(A){try{let Q=A.match(/^0\.0\.(\d+)(?:-(.+))?/);if(!Q)return null;let B=parseInt(Q[1],10),$=B!==0?B*1000:void 0,Y=Q[2]?.match(/^g?([a-f0-9]+)$/)?.[1],Z=$!==void 0?EF($):void 0;return{sha:Y,timestamp:$,age:Z}}catch{return null}}R1();d0();import{readFile as uq5,realpath as hq5}from"node:fs/promises";import{dirname as Ox4,join as gq5}from"node:path";async function jx4(A){switch(A){case"binary":case"brew":return mq5(Eo());case"npm":case"pnpm":case"yarn":case"bun":return pq5()}}async function mq5(A){let Q=await JI(A,["--version"],5000);if(Q.reason!=="success")return j.debug("failed to read version from binary",{binaryPath:A,result:Q}),null;return Q.output.trim().split(/\s+/)[0]||null}async function pq5(){try{let A=process.argv[1];if(!A)return null;let Q=await hq5(A),B=Ox4(Ox4(Q));return await dq5(gq5(B,"package.json"))}catch(A){return j.debug("failed to read installed version from package.json",{error:A}),null}}async function dq5(A){let Q=await uq5(A,"utf8"),B=JSON.parse(Q);if(!B.name||!Mt0(B.name))return j.debug("package.json name mismatch",{pkgJsonPath:A,name:B.name}),null;return B.version||null}d0();import{spawn as cq5}from"node:child_process";function Tt0(A){if(A=A.replace(/\/$/,""),!A.startsWith("http://")&&!A.startsWith("https://"))A=`https://${A}`;try{return new URL(A),A}catch{return j.warn(`Invalid registry URL: ${A}, falling back to npmjs.org`),"https://registry.npmjs.org"}}var nF0=null,qo=null;function Rx4(A){return new Promise((Q)=>{let B=cq5("npm",["config","get",A],{stdio:["ignore","pipe","ignore"],timeout:5000,shell:process.platform==="win32"}),$="";B.stdout.on("data",(J)=>{$+=J.toString()}),B.on("close",(J,Y)=>{if(J!==0||Y==="SIGTERM"){Q(null);return}let Z=$.trim();Q(Z&&Z!=="undefined"?Z:null)}),B.on("error",()=>{Q(null)})})}async function aF0(){if(nF0)return nF0;if(qo)return qo;qo=(async()=>{let A=process.env.NPM_CONFIG_REGISTRY??process.env.npm_config_registry;if(A)return Tt0(A);let Q=await Rx4("@sourcegraph:registry");if(Q)return Tt0(Q);let B=await Rx4("registry");if(B)return Tt0(B);return"https://registry.npmjs.org"})();try{return nF0=await qo,nF0}finally{qo=null}}var lq5=3600000,iq5=5000;function oF0(A,Q,B={}){let $=new d4,J=$.pipe(rA({shouldCountRefs:!1})),Y=B.startDelayMs??0,Z=B.checkIntervalMs??lq5,F=!1,X=()=>{F=!0};return setImmediate(async()=>{let D=j.getChild("update");if(Y>0){if(await nV(Y),F)return}let G=J.subscribe({next:(U)=>{D.debug("emit new state",U)}}),V=A;try{while(!F){let U=await nq5(V,Q,D,$);if(U.stop)return;if(U.updatedTo)V=U.updatedTo;if(U.emittedVisibleState){if(await nV(iq5),F)return;$.next("hidden")}if(Z<=0)return;let K=1000,E=Z;while(E>0&&!F){let z=Math.min(K,E);await nV(z),E-=z}}}finally{G.unsubscribe(),$.complete()}}),{state:J,dispose:X}}async function nq5(A,Q,B,$){let J={stop:!1,emittedVisibleState:!1};try{if(process.env.AMP_SKIP_UPDATE_CHECK==="1")return B.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable"),J.stop=!0,J;let Y=await Q.get("updates.mode");if(Y==="disabled")return B.debug("checking disabled"),J.stop=!0,J;let Z=await IU(),F=Z==="binary"||Z==="brew",X=F?void 0:await YI();B.debug("checking",{currentVersion:A,mode:Y,packageManager:Z,isBinaryDistribution:F,npmPackageName:X});let D;if(F)D=await iF0(A);else{let U=await aF0();D=await lF0(A,U,X)}if(!(D.latestVersion&&D.hasUpdate))return B.debug("no update available"),J;let G=(U)=>{$.next(U),J.emittedVisibleState=!0};if(Z){let U=await jx4(Z);if(U&&Wo(U,D.latestVersion)>=0){if(B.debug("on-disk version already up to date",{currentVersion:A,installedVersion:U,latestVersion:D.latestVersion}),J.updatedTo=U,Wo(A,U)<0){let K=await Rz(U),E={from:A,to:U,externallyUpdated:!0,...K};if(K.status==="same")B.info("on-disk already updated by another instance",E),G("updated");else B.warn("on-disk already updated by another instance, with PATH warning",E),G("updated-with-warning")}return J}}let V=()=>{if(D.currentVersionAge!==void 0&&D.latestVersionAge!==void 0){let U=D.currentVersionAge-D.latestVersionAge,K=0.5;if(Math.abs(U)<0.5)return B.debug("versions too close together, suppressing update warning",{currentVersionAge:D.currentVersionAge,latestVersionAge:D.latestVersionAge,ageDifferenceHours:U}),!0}return!1};if(!Y)Y=Z==="pnpm"?"warn":"auto",B.debug("no configured update mode; selected default based on package manager",{packageManager:Z,mode:Y});if(Z==="brew"){if(!V())G("update-available-brew");return J}if(Z==="binary"&&process.execPath!==Eo()){if(B.debug("non-standard binary path, showing warning"),!V())G("update-available-unrecognized-path");return J}if(Y==="warn"){if(!V())G("update-available");return J}if(!Z){if(B.debug("auto-update not supported, falling back to warn mode"),!V())G("update-available");return J}try{await zo(D.latestVersion,Z),J.updatedTo=D.latestVersion;let U=await Rz(D.latestVersion),K={from:D.currentVersion,to:D.latestVersion,...U};if(U.status==="same")B.info("success",K),G("updated");else B.warn("success with warning",K),G("updated-with-warning")}catch(U){G("update-error")}return J}catch(Y){return B.debug("check failed",{error:Y}),J}}Az();import{stderr as RD}from"node:process";function Px4(A){let Q=new uN().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async($)=>{await wt0($.force||!1,$.verbose||!1,"0.0.
|
|
5357
|
+
npm install -g ${Y}`;D(Error(W))}},error:(E)=>{if(!U)U=!0,D(Error(`Failed to spawn ${Z}: ${E.message}`))},complete:()=>{if(!U)U=!0,X()}})})}d0();d0();Az();var fq5="@ampcode/cli";async function lF0(A,Q,B=fq5){let J=`${Q||"https://registry.npmjs.org"}/${B}/latest`,Y=new AbortController,Z=setTimeout(()=>Y.abort(),5000);try{let F=await fetch(J,{signal:Y.signal});if(!F.ok)return{hasUpdate:!1,currentVersion:A,source:"npm"};let X=await F.json(),D=X.version??X["dist-tags"]?.latest;if(!D)return{hasUpdate:!1,currentVersion:A,source:"npm"};let G=Wo(A,D),V=G<0,U,K;if(X.time){let E=X.time[A],z=X.time[D],W=Date.now();if(E)U=Math.floor((W-new Date(E).getTime())/3600000);if(z)K=Math.floor((W-new Date(z).getTime())/3600000)}return j.info("NPM version comparison",{currentVersion:A,latestVersion:D,compareResult:G,hasUpdate:V,currentVersionAge:U,latestVersionAge:K}),{hasUpdate:V,latestVersion:D,currentVersion:A,currentVersionAge:U,latestVersionAge:K,source:"npm"}}catch(F){return j.debug("Error checking npm version",{error:F}),{hasUpdate:!1,currentVersion:A,source:"npm"}}finally{clearTimeout(Z)}}var xq5="https://static.ampcode.com/cli/cli-version.txt";async function iF0(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),5000);try{let $=await fetch(`${xq5}?t=${Date.now()}`,{signal:Q.signal,cache:"no-store"});if(!$.ok)return{hasUpdate:!1,currentVersion:A,source:"bin"};let J=(await $.text()).trim();if(!J||!/^\d+\.\d+\.\d+/.test(J))return{hasUpdate:!1,currentVersion:A,source:"bin"};let Y=Wo(A,J),Z=Y<0;return j.info("Bin version comparison",{currentVersion:A,latestVersion:J,compareResult:Y,hasUpdate:Z}),{hasUpdate:Z,latestVersion:J,currentVersion:A,source:"bin"}}catch($){return j.debug("Error checking bin version",{error:$}),{hasUpdate:!1,currentVersion:A,source:"bin"}}finally{clearTimeout(B)}}var bq5=604800000;function Lx4(A){if(!A)return null;let Q=typeof A==="number"?A:new Date(A).getTime();if(isNaN(Q))return null;let B=Date.now()-Q;if(B>bq5)return{ageMs:B};return null}function Wo(A,Q){let B=(Z)=>{let[F,X]=Z.split("-");return{parts:F?.split(".").map(Number)||[],label:X}},$=B(A),J=B(Q),Y=Math.max($.parts.length,J.parts.length);for(let Z=0;Z<Y;Z++){let F=$.parts[Z]||0,X=J.parts[Z]||0;if(F<X)return-1;if(F>X)return 1}if($.label===J.label)return 0;if(!$.label&&J.label)return 1;if($.label&&!J.label)return-1;if($.label&&J.label)return $.label<J.label?-1:1;return 0}function Ho(A){try{let Q=A.match(/^0\.0\.(\d+)(?:-(.+))?/);if(!Q)return null;let B=parseInt(Q[1],10),$=B!==0?B*1000:void 0,Y=Q[2]?.match(/^g?([a-f0-9]+)$/)?.[1],Z=$!==void 0?EF($):void 0;return{sha:Y,timestamp:$,age:Z}}catch{return null}}R1();d0();import{readFile as uq5,realpath as hq5}from"node:fs/promises";import{dirname as Ox4,join as gq5}from"node:path";async function jx4(A){switch(A){case"binary":case"brew":return mq5(Eo());case"npm":case"pnpm":case"yarn":case"bun":return pq5()}}async function mq5(A){let Q=await JI(A,["--version"],5000);if(Q.reason!=="success")return j.debug("failed to read version from binary",{binaryPath:A,result:Q}),null;return Q.output.trim().split(/\s+/)[0]||null}async function pq5(){try{let A=process.argv[1];if(!A)return null;let Q=await hq5(A),B=Ox4(Ox4(Q));return await dq5(gq5(B,"package.json"))}catch(A){return j.debug("failed to read installed version from package.json",{error:A}),null}}async function dq5(A){let Q=await uq5(A,"utf8"),B=JSON.parse(Q);if(!B.name||!Mt0(B.name))return j.debug("package.json name mismatch",{pkgJsonPath:A,name:B.name}),null;return B.version||null}d0();import{spawn as cq5}from"node:child_process";function Tt0(A){if(A=A.replace(/\/$/,""),!A.startsWith("http://")&&!A.startsWith("https://"))A=`https://${A}`;try{return new URL(A),A}catch{return j.warn(`Invalid registry URL: ${A}, falling back to npmjs.org`),"https://registry.npmjs.org"}}var nF0=null,qo=null;function Rx4(A){return new Promise((Q)=>{let B=cq5("npm",["config","get",A],{stdio:["ignore","pipe","ignore"],timeout:5000,shell:process.platform==="win32"}),$="";B.stdout.on("data",(J)=>{$+=J.toString()}),B.on("close",(J,Y)=>{if(J!==0||Y==="SIGTERM"){Q(null);return}let Z=$.trim();Q(Z&&Z!=="undefined"?Z:null)}),B.on("error",()=>{Q(null)})})}async function aF0(){if(nF0)return nF0;if(qo)return qo;qo=(async()=>{let A=process.env.NPM_CONFIG_REGISTRY??process.env.npm_config_registry;if(A)return Tt0(A);let Q=await Rx4("@sourcegraph:registry");if(Q)return Tt0(Q);let B=await Rx4("registry");if(B)return Tt0(B);return"https://registry.npmjs.org"})();try{return nF0=await qo,nF0}finally{qo=null}}var lq5=3600000,iq5=5000;function oF0(A,Q,B={}){let $=new d4,J=$.pipe(rA({shouldCountRefs:!1})),Y=B.startDelayMs??0,Z=B.checkIntervalMs??lq5,F=!1,X=()=>{F=!0};return setImmediate(async()=>{let D=j.getChild("update");if(Y>0){if(await nV(Y),F)return}let G=J.subscribe({next:(U)=>{D.debug("emit new state",U)}}),V=A;try{while(!F){let U=await nq5(V,Q,D,$);if(U.stop)return;if(U.updatedTo)V=U.updatedTo;if(U.emittedVisibleState){if(await nV(iq5),F)return;$.next("hidden")}if(Z<=0)return;let K=1000,E=Z;while(E>0&&!F){let z=Math.min(K,E);await nV(z),E-=z}}}finally{G.unsubscribe(),$.complete()}}),{state:J,dispose:X}}async function nq5(A,Q,B,$){let J={stop:!1,emittedVisibleState:!1};try{if(process.env.AMP_SKIP_UPDATE_CHECK==="1")return B.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable"),J.stop=!0,J;let Y=await Q.get("updates.mode");if(Y==="disabled")return B.debug("checking disabled"),J.stop=!0,J;let Z=await IU(),F=Z==="binary"||Z==="brew",X=F?void 0:await YI();B.debug("checking",{currentVersion:A,mode:Y,packageManager:Z,isBinaryDistribution:F,npmPackageName:X});let D;if(F)D=await iF0(A);else{let U=await aF0();D=await lF0(A,U,X)}if(!(D.latestVersion&&D.hasUpdate))return B.debug("no update available"),J;let G=(U)=>{$.next(U),J.emittedVisibleState=!0};if(Z){let U=await jx4(Z);if(U&&Wo(U,D.latestVersion)>=0){if(B.debug("on-disk version already up to date",{currentVersion:A,installedVersion:U,latestVersion:D.latestVersion}),J.updatedTo=U,Wo(A,U)<0){let K=await Rz(U),E={from:A,to:U,externallyUpdated:!0,...K};if(K.status==="same")B.info("on-disk already updated by another instance",E),G("updated");else B.warn("on-disk already updated by another instance, with PATH warning",E),G("updated-with-warning")}return J}}let V=()=>{if(D.currentVersionAge!==void 0&&D.latestVersionAge!==void 0){let U=D.currentVersionAge-D.latestVersionAge,K=0.5;if(Math.abs(U)<0.5)return B.debug("versions too close together, suppressing update warning",{currentVersionAge:D.currentVersionAge,latestVersionAge:D.latestVersionAge,ageDifferenceHours:U}),!0}return!1};if(!Y)Y=Z==="pnpm"?"warn":"auto",B.debug("no configured update mode; selected default based on package manager",{packageManager:Z,mode:Y});if(Z==="brew"){if(!V())G("update-available-brew");return J}if(Z==="binary"&&process.execPath!==Eo()){if(B.debug("non-standard binary path, showing warning"),!V())G("update-available-unrecognized-path");return J}if(Y==="warn"){if(!V())G("update-available");return J}if(!Z){if(B.debug("auto-update not supported, falling back to warn mode"),!V())G("update-available");return J}try{await zo(D.latestVersion,Z),J.updatedTo=D.latestVersion;let U=await Rz(D.latestVersion),K={from:D.currentVersion,to:D.latestVersion,...U};if(U.status==="same")B.info("success",K),G("updated");else B.warn("success with warning",K),G("updated-with-warning")}catch(U){G("update-error")}return J}catch(Y){return B.debug("check failed",{error:Y}),J}}Az();import{stderr as RD}from"node:process";function Px4(A){let Q=new uN().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async($)=>{await wt0($.force||!1,$.verbose||!1,"0.0.1779083535-g196e66"),process.exit()});A.addCommand(Q,{hidden:!0});let B=new uN("update").alias("up").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async($)=>{await oq5($.targetVersion)});A.addCommand(B)}function aq5(A){let Q=Boolean(A.isTTY),B=0,$=!1;function J(){if(!Q||!$)return;A.write(`
|
|
5358
5358
|
`),$=!1,B=0}function Y(Z){if(!Q)return;let F=Z.padEnd(B," ");A.write(`\r${F}`),$=!0,B=F.length}return{flushProgressLine:J,renderProgress:Y}}async function oq5(A){let B=process.platform==="win32"&&Hj()?{currentExecutablePath:process.execPath}:void 0,{flushProgressLine:$,renderProgress:J}=aq5(RD);if(process.env.AMP_SKIP_UPDATE_CHECK==="1")RD.write(t0.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
5359
5359
|
|
|
5360
5360
|
`));try{if(!A){RD.write(t0.blue(`Checking for updates...
|
|
5361
|
-
`));let F=!1,X;if(Hj()){let D=await iF0("0.0.
|
|
5362
|
-
`));let V=await Rz("0.0.
|
|
5361
|
+
`));let F=!1,X;if(Hj()){let D=await iF0("0.0.1779083535-g196e66");F=D.hasUpdate,X=D.latestVersion}else{let D=await aF0(),G=await YI(),V=await lF0("0.0.1779083535-g196e66",D,G);F=V.hasUpdate,X=V.latestVersion}if(!F){let D=Ho("0.0.1779083535-g196e66"),G=D?.age?`released ${D.age} ago`:`built ${EF(new Date("2026-05-18T05:57:03.595Z"))} ago`;RD.write(t0.green(`✓ Amp is already up to date on version ${"0.0.1779083535-g196e66"} (${G})
|
|
5362
|
+
`));let V=await Rz("0.0.1779083535-g196e66",B);if(V.warning)RD.write(`
|
|
5363
5363
|
`+t0.yellow(V.warning)+`
|
|
5364
5364
|
`);process.exit(0)}if(!X)RD.write(t0.yellow("[WARN] could not find latest version")),process.exit(0);A=X}RD.write(t0.blue(`Updating to version ${A}...
|
|
5365
5365
|
`)),await zo(A,void 0,(F)=>{$(),RD.write(t0.dim(`Running: ${F}
|
|
@@ -5785,7 +5785,7 @@ ${$}`).join(`
|
|
|
5785
5785
|
`).length,J=new p({text:new C(A,new S({color:B}))});if($<=qG0)return J;return new U0({width:1/0,height:qG0,child:new u2({autofocus:!1,controller:Q,child:J})})}function Fy5(){return new Map([[N1.key("PageUp"),new NG0],[N1.key("PageDown"),new w41],[N1.ctrl("u"),new NG0],[N1.shift("Home"),new C41],[N1.shift("End"),new M41]])}function Xy5(A,Q,B){return Math.max(Q,Math.min(A,B))}var L41=8,qi4=1,Ni4=L41-1;class O41 extends I4{}class j41 extends I4{}class IG0 extends I4{}class wG0 extends I4{}class R41 extends I4{}class P41 extends I4{}class _41 extends _0{props;constructor(A){super(A.key===void 0?{}:{key:A.key});this.props=A}createState(){return new Ii4}}class Ii4 extends P0{messageScroll=new yA;initState(){super.initState(),this.messageScroll.followMode=!1,this.messageScroll.jumpTo(0)}dispose(){this.messageScroll.dispose(),super.dispose()}build(A){let Q=this.widget.props,B=Dy5(Q,this.messageScroll),$=Gy5(Q.options.message),J=$?new m4({actions:this.buildScrollActions(),child:new p6({debugLabel:"NeoSelectDialogScrollShortcuts",shortcuts:Uy5(),child:B})}):B,Y=[{keys:["↑/↓","j/k"],label:"move"},{keys:["Enter"],label:"select"}];if($)Y.push({keys:["Ctrl+E","Ctrl+Y"],label:"scroll"});return Y.push({keys:["Esc"],label:"cancel"}),new wA({header:Q.options.title,minWidth:64,maxWidth:80,footer:Y,autofocus:!1,onDismiss:Q.onCancel,child:J})}buildScrollActions(){let A=(Q)=>{let B=Ky5(this.messageScroll.offset+Q,0,this.messageScroll.maxScrollExtent);this.messageScroll.jumpTo(B)};return new Map([[O41,new b1(()=>A(-qi4))],[j41,new b1(()=>A(qi4))],[IG0,new b1(()=>A(-Ni4))],[wG0,new b1(()=>A(Ni4))],[R41,new b1(()=>this.messageScroll.jumpTo(0))],[P41,new b1(()=>this.messageScroll.jumpTo(this.messageScroll.maxScrollExtent))]])}}function Dy5(A,Q){let B=A.options.options.map((J)=>({value:J,label:J})),$=Math.max(0,B.findIndex((J)=>J.value===A.options.initialValue));return new G2({options:B,selectedIndex:$,body:Vy5(A.options.message,Q),onSelect:(J)=>{if(J===null){A.onCancel();return}A.onSelect(J)},padding:K0.all(0),showBorder:!1,showDismissalMessage:!1,enableMouseInteraction:!1})}function Gy5(A){if(A===void 0)return!1;return A.split(`
|
|
5786
5786
|
`).length>L41}function Vy5(A,Q){if(A===void 0)return;let B=A.split(`
|
|
5787
5787
|
`).length,$=Math.min(B,L41);return new U0({width:1/0,height:$,child:new u2({autofocus:!1,controller:Q,child:new p({text:new C(A)})})})}function Uy5(){return new Map([[N1.key("PageUp"),new IG0],[N1.key("PageDown"),new wG0],[N1.ctrl("u"),new IG0],[N1.ctrl("d"),new wG0],[N1.ctrl("y"),new O41],[N1.ctrl("e"),new j41],[N1.shift("Home"),new R41],[N1.shift("End"),new P41]])}function Ky5(A,Q,B){return Math.max(Q,Math.min(A,B))}var Ey5=3,zy5=new RA("NeoPluginDialogOverlay");class T41{options;unregisterPluginCommands=null;pluginCommandSubscriptions=[];pluginErrorToastKeys=new Set;activeDialog=null;queuedDialogs=[];resolvingDialog=null;statusItems=new Map;disposed=!1;constructor(A){this.options=A}init(){this.disposed=!1,this.configurePluginPlatform(),this.subscribePluginCommands()}dispose(){this.disposed=!0,this.unregisterPluginCommands?.(),this.unregisterPluginCommands=null;for(let A of this.pluginCommandSubscriptions)A.unsubscribe();this.pluginCommandSubscriptions=[],this.cancelPendingDialogs(),this.statusItems.clear(),this.clearPluginPlatformStatusHandlers()}hasBlockingDialog(){return this.activeDialog!==null}buildDialogLayers(){let A=this.activeDialog;if(!A)return[];return[new u4({key:zy5,debugLabel:"PluginDialogOverlay",autofocus:!1,canRequestFocus:!0,child:this.buildActiveDialog(A)})]}buildActiveDialog(A){switch(A.kind){case"input":return new Bs({key:new Tz(A),header:A.options.title??"Input",helpText:A.options.helpText,initialValue:A.options.initialValue,isRequired:!1,onSubmit:(Q)=>this.resolveInputDialog(A,Q),onDismiss:()=>this.resolveInputDialog(A,void 0)});case"confirm":return new I41({key:new Tz(A),options:A.options,onConfirm:()=>this.resolveConfirmDialog(A,!0),onCancel:()=>this.resolveConfirmDialog(A,!1)});case"select":return new _41({key:new Tz(A),options:A.options,onSelect:(Q)=>this.resolveSelectDialog(A,Q),onCancel:()=>this.resolveSelectDialog(A,void 0)})}}getStatusItems(){return[...this.statusItems.values()].flatMap((A)=>A.value===void 0?[]:[{pluginURI:A.pluginURI,id:A.id,value:A.value}])}configurePluginPlatform(){let A=this.options.neoContext.pluginPlatform;if(!A)return;A.showToast=(Q)=>this.options.toastController.show(Q,"success"),A.showOpenedURLToast=(Q)=>{this.options.toastController.show(`Opened URL: ${Q}`,"success",8000)},A.appendToThreadHandler=this.options.neoContext.observerOnly?async()=>{throw Error("thread.append is only available from an executor-owned plugin runtime")}:this.options.appendToThread,A.showInputDialog=this.showInputDialog,A.showConfirmDialog=this.showConfirmDialog,A.showSelectDialog=this.showSelectDialog,A.createStatusItemHandler=this.createStatusItem,A.updateStatusItemHandler=this.updateStatusItem,A.removeStatusItemHandler=this.removeStatusItem}clearPluginPlatformStatusHandlers(){let A=this.options.neoContext.pluginPlatform;if(!A)return;if(A.createStatusItemHandler===this.createStatusItem)A.createStatusItemHandler=null;if(A.updateStatusItemHandler===this.updateStatusItem)A.updateStatusItemHandler=null;if(A.removeStatusItemHandler===this.removeStatusItem)A.removeStatusItemHandler=null}subscribePluginCommands(){let A=this.options.neoContext.pluginService;if(!A)return;this.refreshPluginCommands(A.commands.list()),this.pluginCommandSubscriptions=[A.plugins.subscribe((Q)=>{this.removeInactivePluginStatusItems(Q),this.showNewPluginErrorToasts(Q),this.refreshPluginCommands(A.commands.list())}),A.commands.changed.subscribe(()=>{this.refreshPluginCommands(A.commands.list())})]}refreshPluginCommands(A){this.unregisterPluginCommands?.();let B=A.map(($)=>this.createPluginCommand($)).map(($)=>this.options.commandRegistry.register($));this.unregisterPluginCommands=()=>{for(let $ of B)$()}}showNewPluginErrorToasts(A){let Q=new Set;for(let B of A){if(B.status!=="error")continue;if(dd(B.errorMessage))continue;let $=`${B.uri.toString()}
|
|
5788
|
-
${B.errorMessage??""}`;if(Q.add($),this.pluginErrorToastKeys.has($))continue;this.options.toastController.show(this.formatPluginErrorToast(B),"error",8000)}this.pluginErrorToastKeys=Q}removeInactivePluginStatusItems(A){let Q=new Set(A.filter(($)=>$.status==="active").map(($)=>$.uri.toString())),B=[];for(let[$,J]of this.statusItems){if(Q.has(J.pluginURI))continue;B.push($)}if(B.length===0)return;this.updateStatusItemState(()=>{for(let $ of B)this.statusItems.delete($)})}formatPluginErrorToast(A){let Q=A.uri.toString();return`Plugin failed: ${Q.split("/").pop()??Q}. See logs: ${this.options.neoContext.logFilePath}`}createPluginCommand(A){return{id:A.id,noun:A.category,verb:A.title,description:A.description??`Run plugin command ${A.category}: ${A.title}`,keywords:["plugin",A.pluginName,A.id],status:A.availability,run:async(Q,B,$)=>{$();try{await this.options.neoContext.pluginService?.commands.execute(A.pluginName,A.id,{threadID:this.options.getActiveThreadID()})}catch(J){j.error("Neo plugin command failed",{error:J,command:A}),this.options.toastController.show(J instanceof Error?J.message:String(J),"error",5000)}}}}showInputDialog=(A)=>{return new Promise((Q)=>{if(this.disposed||!this.options.state.mounted){Q(void 0);return}this.enqueueDialog({kind:"input",options:A,resolve:Q})})};showConfirmDialog=(A)=>{return new Promise((Q)=>{if(this.disposed||!this.options.state.mounted){Q(!1);return}this.enqueueDialog({kind:"confirm",options:A,resolve:Q})})};showSelectDialog=(A)=>{return new Promise((Q)=>{if(this.disposed||!this.options.state.mounted){Q(void 0);return}this.enqueueDialog({kind:"select",options:A,resolve:Q})})};createStatusItem=(A,Q,B)=>{if(this.disposed)return;this.updateStatusItemState(()=>{let $=this.statusItemKey(A,Q),J={pluginURI:A,id:Q};if(B!==void 0)J.value=B;this.statusItems.set($,J)})};updateStatusItem=(A,Q,B)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.set(this.statusItemKey(A,Q),{pluginURI:A,id:Q,value:B})})};removeStatusItem=(A,Q)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.delete(this.statusItemKey(A,Q))})};updateStatusItemState(A){if(this.options.state.mounted)this.options.state.setState(A);else A()}statusItemKey(A,Q){return`${A}\x00${Q}`}cancelPendingDialogs(){let A=[];if(this.activeDialog)A.push(this.activeDialog);A.push(...this.queuedDialogs),this.activeDialog=null,this.queuedDialogs=[],this.resolvingDialog=null;for(let Q of A)this.cancelDialog(Q)}cancelDialog(A){switch(A.kind){case"input":A.resolve(void 0);return;case"confirm":A.resolve(!1);return;case"select":A.resolve(void 0);return}}enqueueDialog(A){if(this.activeDialog){if(this.queuedDialogs.push(A),this.resolvingDialog===this.activeDialog)this.advanceResolvingDialog(this.activeDialog);return}this.options.commandPalette.disable(),this.options.state.setState(()=>{this.activeDialog=A})}resolveInputDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveConfirmDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveSelectDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveDialog(A,Q){if(this.activeDialog!==A||this.resolvingDialog===A)return;this.resolvingDialog=A,Q(),this.scheduleResolvingDialogAdvance(A,Ey5)}scheduleResolvingDialogAdvance(A,Q){lA.instance.addPostFrameCallback(()=>{if(this.activeDialog!==A)return;if(this.queuedDialogs.length>0||Q<=1){this.advanceResolvingDialog(A);return}this.scheduleResolvingDialogAdvance(A,Q-1)},"NeoPluginIntegration.advanceDialog")}advanceResolvingDialog(A){if(this.resolvingDialog===A)this.resolvingDialog=null;if(this.activeDialog!==A)return;this.advanceDialog()}advanceDialog(){this.updateDialogState(()=>{this.activeDialog=this.queuedDialogs.shift()??null})}updateDialogState(A){if(this.options.state.mounted)this.options.state.setState(A);else A()}}var Wy5=48;class k41{visible=!1;onClick=void 0;listeners=new Set;show(A){this.visible=!0,this.onClick=A,this.notifyListeners()}activate(){this.onClick?.()}get isVisible(){return this.visible}dismiss(){this.visible=!1,this.onClick=void 0,this.notifyListeners()}addListener(A){this.listeners.add(A)}removeListener(A){this.listeners.delete(A)}buildComplexToast(){if(!this.visible||!this.onClick)return null;return new tr({width:Wy5,title:"Relaunch to Update Amp",message:"Your threads will resume.",variant:"success",mouseBehavior:"click-anywhere",action:{keyboardShortcut:"Ctrl+o, relaunch, Enter",label:"relaunch",onAction:()=>this.activate()}})}notifyListeners(){for(let A of this.listeners)A()}}d0();import{spawnSync as Hy5}from"node:child_process";import vI from"node:process";function $s(A){let Q=A.getRelaunchThreadIDs();if(A.onRelaunchRequested?.(Q),A.stop)A.stop();else H4.instance.stop()}function wi4(A){return{noun:"amp",verb:"Relaunch (Quit, then Reopen & Resume Thread)",description:"Quit, reopen Amp, and resume active threads",keywords:["restart","update","resume","reopen"],shortcut:vI.env.NODE_ENV==="development"&&vI.platform==="darwin"?N1.meta("r"):void 0,status:{type:"enabled"},sortBoost:90,run:(Q,B,$)=>{$(),$s(A)}}}function qy5(A,Q){j.info("Relaunching Amp; threads will be resumed",{threadIDs:A});let{command:B,args:$}=Ny5(A),J=Hy5(B,$,{cwd:Q,env:vI.env,stdio:"inherit"});if(J.error)return j.error("Failed to relaunch Amp",{error:J.error}),1;return J.status??1}class S41{relaunchRequested=!1;requestedThreadIDs=[];request=(A)=>{j.info("Relaunch requested; threads will be resumed",{threadIDs:A}),this.relaunchRequested=!0,this.requestedThreadIDs=A};get shouldShowExitSummary(){return!this.relaunchRequested}relaunchIfRequested(A){if(!this.relaunchRequested)return;return qy5(this.requestedThreadIDs,A)}}function Ny5(A){let Q=A.length>0?["threads","continue",...A]:[],B=wy5();if(B)return{command:B.command,args:[...B.args,...Q]};let $=vI.argv[1],J=$&&Iy5($)?[$]:[];return{command:vI.execPath,args:[...J,...Q]}}function Iy5(A){return A!==vI.execPath&&!A.startsWith("/$bunfs/")}function wy5(){if(vI.env.NODE_ENV!=="development")return null;let A=vI.env.AMP_DEV_RELAUNCH_COMMAND?.trim();if(!A)return null;let Q=Cy5(A),B=Q[0];if(!B)return null;return{command:B,args:Q.slice(1)}}function Cy5(A){if(A.startsWith("["))try{let Q=JSON.parse(A);if(Array.isArray(Q)&&Q.every((B)=>typeof B==="string"))return Q}catch{return[]}return A.split(/\s+/).filter(Boolean)}var My5=18000000;class v41{options;subscription=null;relaunchNotificationShown=!1;relaunchNotificationPending=!1;relaunchNotificationTimer=null;openedAt=Date.now();constructor(A){this.options=A}init(){if(this.subscription=this.options.updateService?.state.subscribe((A)=>{this.handleUpdateState(A)})??null,process.env.DEV_SHOW_RELAUNCH_NOTIF_ON_STARTUP==="1")this.showUpdateRelaunchNotification(!0)}dispose(){if(this.subscription?.unsubscribe(),this.subscription=null,this.relaunchNotificationTimer)clearTimeout(this.relaunchNotificationTimer),this.relaunchNotificationTimer=null}handleUpdateState(A){if(A!=="updated")return;this.showUpdateRelaunchNotification()}showUpdateRelaunchNotification(A=!1){if(this.relaunchNotificationShown)return;let B=(this.options.minimumOpenDurationMs??My5)-(Date.now()-this.openedAt);if(B>0&&!A){if(this.relaunchNotificationPending=!0,!this.relaunchNotificationTimer)this.relaunchNotificationTimer=setTimeout(()=>{if(this.relaunchNotificationTimer=null,!this.relaunchNotificationPending)return;this.relaunchNotificationPending=!1,this.showUpdateRelaunchNotification()},B),this.relaunchNotificationTimer.unref();return}this.relaunchNotificationPending=!1,this.relaunchNotificationShown=!0,this.options.relaunchNotificationController.show(()=>$s(this.options))}}Wl();s8();import{readFile as Ly5}from"node:fs/promises";import y41 from"node:os";function Oy5(A=new Date){return A.toISOString().replaceAll("-","").replaceAll(":","").slice(0,15)+"Z"}async function Ci4(A,Q){try{return{path:Q,contents:fh0(await Ly5(A,"utf8"))}}catch{return null}}async function CG0(A,Q){let B=[],$=Oy5(),J=await r4.getThread({thread:Q},{config:A.configService}),Y=J.ok?J.result.thread.data:null;B.push({path:`${$}/thread.json`,contents:JSON.stringify(BJ(Y),null,2)});let Z=await Ci4(gy(Q),`${$}/logs/${Q}.log`);if(Z)B.push(Z);let F=await Ci4(A.settingsFilePath,`${$}/settings/global.json`);if(F)B.push(F);let X=await IU()??"unknown",D=await r4.sendReport({threadID:Q,files:B,metadata:{clientVersion:"0.0.1779081543-gea23bb",clientOS:`${y41.platform()} ${y41.release()} ${y41.arch()}`,installMethod:X}},{config:A.configService});if(!D.ok)throw Error(`Failed to submit report: ${D.error.message}`);return D.result.reportID}class f41{backStack=[];forwardStack=[];canNavigateBack(){return this.backStack.length>0}canNavigateForward(){return this.forwardStack.length>0}recordNavigation(A){if(!A)return;this.backStack.push(A),this.forwardStack.length=0}startBackNavigation(A){let Q=this.backStack.pop();if(!Q)return null;let B=Boolean(A);if(A)this.forwardStack.push(A);return{targetThreadID:Q,rollback:()=>{if(B)this.forwardStack.pop();this.backStack.push(Q)}}}startForwardNavigation(A){let Q=this.forwardStack.pop();if(!Q)return null;let B=Boolean(A);if(A)this.backStack.push(A);return{targetThreadID:Q,rollback:()=>{if(B)this.backStack.pop();this.forwardStack.push(Q)}}}}class MG0 extends C5{offstage;constructor({key:A,offstage:Q=!0,child:B}){super({key:A,child:B});this.offstage=Q}createRenderObject(){return new x41(this.offstage)}updateRenderObject(A){if(A instanceof x41)A.offstage=this.offstage}}class x41 extends Y4{_offstage;constructor(A){super();this._offstage=A}get offstage(){return this._offstage}set offstage(A){if(A===this._offstage)return;this._offstage=A,this.markNeedsLayout()}getMinIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicWidth(A)??0}getMaxIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicWidth(A)??0}getMinIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicHeight(A)??0}getMaxIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicHeight(A)??0}performLayout(){let A=this._lastConstraints;N4(!!A,"performLayout called without constraints");let Q=this.children[0];if(this._offstage){if(this.setSize(0,0),Q)Q.layout(A),Q.setOffset(0,0)}else if(Q){Q.layout(A);let B=A.constrain(Q.size.width,Q.size.height);this.setSize(B.width,B.height),Q.setOffset(0,0)}else{let B=A.smallest;this.setSize(B.width,B.height)}super.performLayout()}paint(A,Q,B){if(this._offstage)return;super.paint(A,Q,B)}hitTest(A,Q,B,$){if(this._offstage)return!1;return super.hitTest(A,Q,B,$)}}class Js{_state=null;_attach(A){this._state=A}_detach(){this._state=null}push(A){this._state?.push(A)}pushWithDismiss(A){this._state?.pushWithDismiss(A)}pop(){return this._state?.pop()??!1}get canPop(){return this._state?.canPop??!1}}class b41 extends _0{root;controller;constructor(A){super();this.root=A.root,this.controller=A.controller}createState(){return new Mi4}}class Mi4 extends P0{entries=[];initState(){this.widget.controller._attach(this)}didUpdateWidget(A){if(A.controller!==this.widget.controller)A.controller._detach(),this.widget.controller._attach(this)}dispose(){this.widget.controller._detach(),super.dispose()}push(A){let Q=new Mj,B=this.makeScopedDismiss(Q);this.setState(()=>{this.entries.push({key:Q,widget:A,dismiss:B})})}pushWithDismiss(A){let Q=new Mj,B=this.makeScopedDismiss(Q),$=A(B);this.setState(()=>{this.entries.push({key:Q,widget:$,dismiss:B})})}pop(){if(this.entries.length===0)return!1;return this.setState(()=>{this.entries.pop()}),!0}get canPop(){return this.entries.length>0}makeScopedDismiss(A){return()=>{if(!this.mounted)return;let Q=this.entries[this.entries.length-1];if(!Q||Q.key!==A)return;this.setState(()=>{this.entries.pop()})}}build(A){let Q=[];Q.push(new MG0({offstage:this.entries.length>0,child:this.widget.root}));for(let B=0;B<this.entries.length;B++){let $=this.entries[B],J=B===this.entries.length-1,Y=J?new u4({autofocus:!0,debugLabel:`ModalStackEntry[${B}]`,onKey:(Z)=>{if(Z.key!=="Escape")return"ignored";return $.dismiss(),"handled"},child:$.widget}):$.widget;Q.push(new MG0({key:$.key,offstage:!J,child:Y}))}return new t4({fit:"expand",children:Q})}}import Li4 from"node:process";class h41 extends q1{props;constructor(A){super();this.props=A}build(A){let Q=this.props.commands.filter(($)=>$.status.type!=="hidden"),B=jy5(Q);return new wA({header:"Command Palette",autofocus:!1,barrierOpaque:!1,chromePadding:K0.only({left:1,top:1,right:1}),footer:"none",onDismiss:this.props.onDismiss,child:new d6({items:Q,showBorder:!1,getLabel:($)=>{let J=u41($);return $.keywords&&$.keywords.length>0?`${J} ${$.keywords.join(" ").toLowerCase()}`:J},sortItems:($,J,Y)=>{if(Y===""){let G=$.item.status.type==="disabled"?1:0,V=J.item.status.type==="disabled"?1:0;if(G!==V)return G-V;let U=$.item.sortBoost??0,K=J.item.sortBoost??0;if(U!==K)return K-U;let E=$.item.noun?.toLowerCase()??"",z=J.item.noun?.toLowerCase()??"";if(E!==z)return E<z?-1:1;return 0}let Z=dj($.item.verb.toLowerCase(),Y),F=dj(J.item.verb.toLowerCase(),Y);if(Z!==F)return F-Z;let X=dj(u41($.item),Y),D=dj(u41(J.item),Y);if(X!==D)return D-X;return J.score-$.score},isItemDisabled:($)=>$.status.type==="disabled",buildDisabledReasonWidget:($,J)=>{if($.status.type!=="disabled")return;let{colors:Y}=j0.of(J);return new p({text:new C($.status.reason,new S({color:Y.mutedForeground,dim:!0})),textAlign:"center"})},renderItem:($,J,Y,Z)=>new Oi4({command:$,isSelected:J,isDisabled:Y,categoryWidth:B,buildContext:Z}),onAccept:($)=>{this.props.onAccept($)},onDismiss:this.props.onDismiss})})}}class Oi4 extends q1{props;constructor(A){super();this.props=A}build(A){let{command:Q,isSelected:B,isDisabled:$,categoryWidth:J,buildContext:Y}=this.props,Z=j0.of(Y),{colors:F,app:X}=Z,D=B?X.selectionBackground:void 0,G=B?X.selectionForeground:F.foreground,V=B?G:F.mutedForeground,U=new p({text:new C(Q.noun?.toLowerCase()??"",new S({color:V,dim:$||!B})),textAlign:"right"}),K=[new C(Q.verb.toLowerCase(),new S({color:G,bold:!0,dim:$}))];if($)K.push(new C(" (unavailable)",new S({color:G,dim:!0})));let E=p.spans(K),z=[{child:U,fixedWidth:J},{child:E,expanded:!0}];if(Q.shortcut)z.push({child:Ry5(Q.shortcut,Z,$)});return new ji4({columns:z,padding:K0.horizontal(1),backgroundColor:D})}}function u41(A){return A.noun?`${A.noun.toLowerCase()} ${A.verb.toLowerCase()}`:A.verb.toLowerCase()}function jy5(A){return A.reduce((Q,B)=>{return B.noun?Math.max(Q,j4(B.noun)):Q},0)}function Ry5(A,Q,B){let{colors:$,app:J}=Q,Y=new S({color:$.mutedForeground,dim:B}),Z=[];for(let F of A.modifiers()){if(Z.length>0)Z.push(new C(" ",Y));Z.push(new C(Py5(F),new S({color:J.keybind,bold:!0,dim:B})))}if(Z.length>0)Z.push(new C(" ",Y));return Z.push(new C(_y5(A),new S({color:J.keybind,bold:!0,dim:B}))),p.spans(Z)}function Py5(A){return A==="Meta"&&Li4.platform==="darwin"?"Cmd":A}function _y5(A){return A.meta&&Li4.platform==="darwin"?A.key.toUpperCase():A.key}class ji4 extends q1{props;constructor(A){super();this.props=A}build(A){let{columns:Q,gap:B=2,padding:$,backgroundColor:J}=this.props,Y=[];for(let F=0;F<Q.length;F++){let X=Q[F];if(F>0&&B>0)Y.push(new U0({width:B}));if(X.fixedWidth!==void 0)Y.push(new U0({width:X.fixedWidth,child:X.child}));else if(X.expanded)Y.push(new P1({child:X.child}));else Y.push(X.child)}let Z=new r0({crossAxisAlignment:"start",children:Y});if(!$&&!J)return Z;return new b0({decoration:J?{color:J}:void 0,padding:$,child:Z})}}class g41{#A=[];#Q=new Set;get commands(){return this.#A}register(A){return this.#A.push(A),this.#B(),()=>{let Q=this.#A.indexOf(A);if(Q===-1)return;this.#A.splice(Q,1),this.#B()}}findByID(A){return this.#A.find((Q)=>Q.id===A)}runByID(A,Q){let B=this.findByID(A);if(!B||B.status.type!=="enabled")return!1;return B.run(new Js,Q,()=>{}),!0}addListener(A){this.#Q.add(A)}removeListener(A){this.#Q.delete(A)}#B(){for(let A of this.#Q)A()}}class z9 extends U6{commandRegistry;constructor({commandRegistry:A,child:Q}){super({child:Q});this.commandRegistry=A}updateShouldNotify(A){return!1}static of(A){let Q=z9.maybeOf(A);if(!Q)throw Error("No NeoCommandRegistryProvider found in widget tree");return Q}static maybeOf(A){return A.dependOnInheritedWidgetOfExactType(z9)?.commandRegistry??null}}class m41 extends _0{onDismiss;constructor(A){super();this.onDismiss=A.onDismiss}createState(){return new Ri4}}class Ri4 extends P0{modalStack=new Js;commandRegistry=null;initState(){super.initState(),queueMicrotask(()=>{if(!this.mounted)return;let A=z9.of(this.context);this.commandRegistry=A,A.addListener(this.onCommandsChanged)})}dispose(){this.commandRegistry?.removeListener(this.onCommandsChanged),this.commandRegistry=null,super.dispose()}onCommandsChanged=()=>{this.setState()};build(A){let Q=z9.of(A).commands,B=new h41({commands:Q,onAccept:($)=>{$.run(this.modalStack,A,this.widget.onDismiss)},onDismiss:()=>{if(this.modalStack.canPop)this.modalStack.pop();else this.widget.onDismiss()}});return new b41({root:B,controller:this.modalStack})}}var p41=[{description:"Move cursor up/down",methods:[{keys:["↑"]},{keys:["↓"]}]},{description:"Move cursor left/right",methods:[{keys:["←"]},{keys:["→"]},{input:"B",keys:["Ctrl"]},{input:"F",keys:["Ctrl"]}]},{description:"Insert newline",methods:[{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!0},{description:"Insert newline",methods:[{keys:["Enter"]},{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!1},{description:"Submit message",methods:[{keys:["Enter"]}],submitOnEnterOnly:!0},{description:"Submit message",methods:[{keys:["Ctrl/Cmd","Enter"]}],submitOnEnterOnly:!1},{description:"Clear input",methods:[{keys:["Escape"]}]},{description:"Edit prompt in $EDITOR",methods:[{input:"G",keys:["Ctrl"]}]},{description:"Navigate history (previous/next)",methods:[{input:"P",keys:["Ctrl"]},{input:"N",keys:["Ctrl"]}]},{description:"Jump to start of line",methods:[{keys:["Cmd","←"]},{input:"A",keys:["Ctrl"]}]},{description:"Jump to end of line",methods:[{keys:["Cmd","→"]},{input:"E",keys:["Ctrl"]}]},{description:"Jump to previous word",methods:[{keys:["Alt","←"]},{keys:["Ctrl","←"]},{input:"B",keys:["Alt"]}]},{description:"Jump to next word",methods:[{keys:["Alt","→"]},{keys:["Ctrl","→"]},{input:"F",keys:["Alt"]}]},{description:"Delete character backward",methods:[{keys:["Backspace"]},{input:"H",keys:["Ctrl"]}]},{description:"Delete word backward",methods:[{keys:["Alt","Backspace"]},{input:"W",keys:["Ctrl"]}]},{description:"Delete character forward",methods:[{keys:["Delete"]},{input:"D",keys:["Ctrl"]}]},{description:"Delete to start of line",methods:[{keys:["Cmd","Backspace"]},{input:"U",keys:["Ctrl"]}]},{description:"Delete to end of line",methods:[{input:"K",keys:["Ctrl"]}]},{description:"Yank (paste deleted text)",methods:[{input:"Y",keys:["Ctrl"]}]},{description:"Paste image from clipboard",methods:[{input:"V",keys:["Ctrl"]}]},{description:"Switch agent mode",methods:[{input:"S",keys:["Ctrl"]}]},{description:"Toggle reasoning effort",methods:[{input:"D",keys:["Alt"]}]},{description:"Open command palette",methods:[{input:"O",keys:["Ctrl"]}]},{description:"Mention files",methods:[{keys:["@"]}]},{description:"Mention threads",methods:[{keys:["@@"]}]},{description:"Show prompt history",methods:[{input:"R",keys:["Ctrl"]}]},{description:"Toggle inline shortcuts help",methods:[{keys:["?"]}]},{description:"Toggle thinking/dense view",methods:[{input:"T",keys:["Alt"]}]}],d41=[{description:"Page scroll",methods:[{keys:["Pg Up"]},{keys:["Pg Down"]}]},{description:"Half-page scroll",methods:[{input:"K",keys:["Alt"]},{input:"J",keys:["Alt"]}]},{description:"Mouse wheel scroll",methods:[{keys:["Mouse Wheel"]}]},{description:"Jump to first message",methods:[{keys:["Home"]}]},{description:"Jump to bottom of screen",methods:[{keys:["End"]}]},{description:"Navigate to previous messages",methods:[{keys:["Tab"]},{keys:["Shift","Tab"]}]}];class LG0 extends q1{items;renderRow;constructor({items:A,renderRow:Q}){super();this.items=A,this.renderRow=Q}build(A){let B=t1.of(A).size.width,$=50,J=B<50,Y=[];for(let Z of this.items){let[F,X]=this.renderRow(Z),D;if(J)D=new y0({crossAxisAlignment:"start",mainAxisSize:"min",children:[F,new f0({padding:K0.only({left:4}),child:X})]});else D=new r0({crossAxisAlignment:"start",children:[new P1({flex:1,child:F}),new U0({width:1}),new P1({flex:1,child:X})]});Y.push(new f0({padding:K0.horizontal(6),child:D}))}return new y0({crossAxisAlignment:"start",mainAxisSize:"min",children:Y})}}class c41 extends _0{commands;submitOnEnter;constructor({key:A,commands:Q,submitOnEnter:B}){super(A?{key:A}:{});this.commands=Q,this.submitOnEnter=B??!0}createState(){return new Pi4}}class Pi4 extends P0{scrollController;initState(){this.scrollController=new yA,this.scrollController.disableFollowMode(),this.scrollController.jumpTo(0)}dispose(){}build(A){let B=L1.of(A).colorScheme,J=j0.of(A).app,Y=t1.of(A),Z=new S({color:B.primary,bold:!0}),F=new S({color:B.secondary,bold:!0}),X=new S({color:J.keybind}),D=new S({color:J.command}),G=new S({color:B.foreground}),V=new S({color:B.foreground}),U=Y.size.width,K=Y.size.height,E=U-4,z=K-4,W=Math.max(40,Math.min(80,E)),H=new Set(["permissions-disable"]),N=[...this.widget.commands.filter((L)=>{let R=L.noun?.toLowerCase();return R!=="dev"&&R!=="debug"&&!L.id.startsWith("debug-")&&!H.has(L.id)})].sort((L,R)=>{let v=(L.noun??"").toLowerCase(),T=(R.noun??"").toLowerCase(),f=v.localeCompare(T);if(f!==0)return f;let g=L.verb.toLowerCase(),u=R.verb.toLowerCase(),k=g.localeCompare(u);if(k!==0)return k;return L.id.localeCompare(R.id)}),I=new fA({autofocus:!0,controller:this.scrollController,child:new b0({constraints:new M1(W,W,0,Number.POSITIVE_INFINITY),child:new y0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new Q4({child:new p({text:new C(`Amp CLI - Help & Keyboard Shortcuts
|
|
5788
|
+
${B.errorMessage??""}`;if(Q.add($),this.pluginErrorToastKeys.has($))continue;this.options.toastController.show(this.formatPluginErrorToast(B),"error",8000)}this.pluginErrorToastKeys=Q}removeInactivePluginStatusItems(A){let Q=new Set(A.filter(($)=>$.status==="active").map(($)=>$.uri.toString())),B=[];for(let[$,J]of this.statusItems){if(Q.has(J.pluginURI))continue;B.push($)}if(B.length===0)return;this.updateStatusItemState(()=>{for(let $ of B)this.statusItems.delete($)})}formatPluginErrorToast(A){let Q=A.uri.toString();return`Plugin failed: ${Q.split("/").pop()??Q}. See logs: ${this.options.neoContext.logFilePath}`}createPluginCommand(A){return{id:A.id,noun:A.category,verb:A.title,description:A.description??`Run plugin command ${A.category}: ${A.title}`,keywords:["plugin",A.pluginName,A.id],status:A.availability,run:async(Q,B,$)=>{$();try{await this.options.neoContext.pluginService?.commands.execute(A.pluginName,A.id,{threadID:this.options.getActiveThreadID()})}catch(J){j.error("Neo plugin command failed",{error:J,command:A}),this.options.toastController.show(J instanceof Error?J.message:String(J),"error",5000)}}}}showInputDialog=(A)=>{return new Promise((Q)=>{if(this.disposed||!this.options.state.mounted){Q(void 0);return}this.enqueueDialog({kind:"input",options:A,resolve:Q})})};showConfirmDialog=(A)=>{return new Promise((Q)=>{if(this.disposed||!this.options.state.mounted){Q(!1);return}this.enqueueDialog({kind:"confirm",options:A,resolve:Q})})};showSelectDialog=(A)=>{return new Promise((Q)=>{if(this.disposed||!this.options.state.mounted){Q(void 0);return}this.enqueueDialog({kind:"select",options:A,resolve:Q})})};createStatusItem=(A,Q,B)=>{if(this.disposed)return;this.updateStatusItemState(()=>{let $=this.statusItemKey(A,Q),J={pluginURI:A,id:Q};if(B!==void 0)J.value=B;this.statusItems.set($,J)})};updateStatusItem=(A,Q,B)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.set(this.statusItemKey(A,Q),{pluginURI:A,id:Q,value:B})})};removeStatusItem=(A,Q)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.delete(this.statusItemKey(A,Q))})};updateStatusItemState(A){if(this.options.state.mounted)this.options.state.setState(A);else A()}statusItemKey(A,Q){return`${A}\x00${Q}`}cancelPendingDialogs(){let A=[];if(this.activeDialog)A.push(this.activeDialog);A.push(...this.queuedDialogs),this.activeDialog=null,this.queuedDialogs=[],this.resolvingDialog=null;for(let Q of A)this.cancelDialog(Q)}cancelDialog(A){switch(A.kind){case"input":A.resolve(void 0);return;case"confirm":A.resolve(!1);return;case"select":A.resolve(void 0);return}}enqueueDialog(A){if(this.activeDialog){if(this.queuedDialogs.push(A),this.resolvingDialog===this.activeDialog)this.advanceResolvingDialog(this.activeDialog);return}this.options.commandPalette.disable(),this.options.state.setState(()=>{this.activeDialog=A})}resolveInputDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveConfirmDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveSelectDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveDialog(A,Q){if(this.activeDialog!==A||this.resolvingDialog===A)return;this.resolvingDialog=A,Q(),this.scheduleResolvingDialogAdvance(A,Ey5)}scheduleResolvingDialogAdvance(A,Q){lA.instance.addPostFrameCallback(()=>{if(this.activeDialog!==A)return;if(this.queuedDialogs.length>0||Q<=1){this.advanceResolvingDialog(A);return}this.scheduleResolvingDialogAdvance(A,Q-1)},"NeoPluginIntegration.advanceDialog")}advanceResolvingDialog(A){if(this.resolvingDialog===A)this.resolvingDialog=null;if(this.activeDialog!==A)return;this.advanceDialog()}advanceDialog(){this.updateDialogState(()=>{this.activeDialog=this.queuedDialogs.shift()??null})}updateDialogState(A){if(this.options.state.mounted)this.options.state.setState(A);else A()}}var Wy5=48;class k41{visible=!1;onClick=void 0;listeners=new Set;show(A){this.visible=!0,this.onClick=A,this.notifyListeners()}activate(){this.onClick?.()}get isVisible(){return this.visible}dismiss(){this.visible=!1,this.onClick=void 0,this.notifyListeners()}addListener(A){this.listeners.add(A)}removeListener(A){this.listeners.delete(A)}buildComplexToast(){if(!this.visible||!this.onClick)return null;return new tr({width:Wy5,title:"Relaunch to Update Amp",message:"Your threads will resume.",variant:"success",mouseBehavior:"click-anywhere",action:{keyboardShortcut:"Ctrl+o, relaunch, Enter",label:"relaunch",onAction:()=>this.activate()}})}notifyListeners(){for(let A of this.listeners)A()}}d0();import{spawnSync as Hy5}from"node:child_process";import vI from"node:process";function $s(A){let Q=A.getRelaunchThreadIDs();if(A.onRelaunchRequested?.(Q),A.stop)A.stop();else H4.instance.stop()}function wi4(A){return{noun:"amp",verb:"Relaunch (Quit, then Reopen & Resume Thread)",description:"Quit, reopen Amp, and resume active threads",keywords:["restart","update","resume","reopen"],shortcut:vI.env.NODE_ENV==="development"&&vI.platform==="darwin"?N1.meta("r"):void 0,status:{type:"enabled"},sortBoost:90,run:(Q,B,$)=>{$(),$s(A)}}}function qy5(A,Q){j.info("Relaunching Amp; threads will be resumed",{threadIDs:A});let{command:B,args:$}=Ny5(A),J=Hy5(B,$,{cwd:Q,env:vI.env,stdio:"inherit"});if(J.error)return j.error("Failed to relaunch Amp",{error:J.error}),1;return J.status??1}class S41{relaunchRequested=!1;requestedThreadIDs=[];request=(A)=>{j.info("Relaunch requested; threads will be resumed",{threadIDs:A}),this.relaunchRequested=!0,this.requestedThreadIDs=A};get shouldShowExitSummary(){return!this.relaunchRequested}relaunchIfRequested(A){if(!this.relaunchRequested)return;return qy5(this.requestedThreadIDs,A)}}function Ny5(A){let Q=A.length>0?["threads","continue",...A]:[],B=wy5();if(B)return{command:B.command,args:[...B.args,...Q]};let $=vI.argv[1],J=$&&Iy5($)?[$]:[];return{command:vI.execPath,args:[...J,...Q]}}function Iy5(A){return A!==vI.execPath&&!A.startsWith("/$bunfs/")}function wy5(){if(vI.env.NODE_ENV!=="development")return null;let A=vI.env.AMP_DEV_RELAUNCH_COMMAND?.trim();if(!A)return null;let Q=Cy5(A),B=Q[0];if(!B)return null;return{command:B,args:Q.slice(1)}}function Cy5(A){if(A.startsWith("["))try{let Q=JSON.parse(A);if(Array.isArray(Q)&&Q.every((B)=>typeof B==="string"))return Q}catch{return[]}return A.split(/\s+/).filter(Boolean)}var My5=18000000;class v41{options;subscription=null;relaunchNotificationShown=!1;relaunchNotificationPending=!1;relaunchNotificationTimer=null;openedAt=Date.now();constructor(A){this.options=A}init(){if(this.subscription=this.options.updateService?.state.subscribe((A)=>{this.handleUpdateState(A)})??null,process.env.DEV_SHOW_RELAUNCH_NOTIF_ON_STARTUP==="1")this.showUpdateRelaunchNotification(!0)}dispose(){if(this.subscription?.unsubscribe(),this.subscription=null,this.relaunchNotificationTimer)clearTimeout(this.relaunchNotificationTimer),this.relaunchNotificationTimer=null}handleUpdateState(A){if(A!=="updated")return;this.showUpdateRelaunchNotification()}showUpdateRelaunchNotification(A=!1){if(this.relaunchNotificationShown)return;let B=(this.options.minimumOpenDurationMs??My5)-(Date.now()-this.openedAt);if(B>0&&!A){if(this.relaunchNotificationPending=!0,!this.relaunchNotificationTimer)this.relaunchNotificationTimer=setTimeout(()=>{if(this.relaunchNotificationTimer=null,!this.relaunchNotificationPending)return;this.relaunchNotificationPending=!1,this.showUpdateRelaunchNotification()},B),this.relaunchNotificationTimer.unref();return}this.relaunchNotificationPending=!1,this.relaunchNotificationShown=!0,this.options.relaunchNotificationController.show(()=>$s(this.options))}}Wl();s8();import{readFile as Ly5}from"node:fs/promises";import y41 from"node:os";function Oy5(A=new Date){return A.toISOString().replaceAll("-","").replaceAll(":","").slice(0,15)+"Z"}async function Ci4(A,Q){try{return{path:Q,contents:fh0(await Ly5(A,"utf8"))}}catch{return null}}async function CG0(A,Q){let B=[],$=Oy5(),J=await r4.getThread({thread:Q},{config:A.configService}),Y=J.ok?J.result.thread.data:null;B.push({path:`${$}/thread.json`,contents:JSON.stringify(BJ(Y),null,2)});let Z=await Ci4(gy(Q),`${$}/logs/${Q}.log`);if(Z)B.push(Z);let F=await Ci4(A.settingsFilePath,`${$}/settings/global.json`);if(F)B.push(F);let X=await IU()??"unknown",D=await r4.sendReport({threadID:Q,files:B,metadata:{clientVersion:"0.0.1779083535-g196e66",clientOS:`${y41.platform()} ${y41.release()} ${y41.arch()}`,installMethod:X}},{config:A.configService});if(!D.ok)throw Error(`Failed to submit report: ${D.error.message}`);return D.result.reportID}class f41{backStack=[];forwardStack=[];canNavigateBack(){return this.backStack.length>0}canNavigateForward(){return this.forwardStack.length>0}recordNavigation(A){if(!A)return;this.backStack.push(A),this.forwardStack.length=0}startBackNavigation(A){let Q=this.backStack.pop();if(!Q)return null;let B=Boolean(A);if(A)this.forwardStack.push(A);return{targetThreadID:Q,rollback:()=>{if(B)this.forwardStack.pop();this.backStack.push(Q)}}}startForwardNavigation(A){let Q=this.forwardStack.pop();if(!Q)return null;let B=Boolean(A);if(A)this.backStack.push(A);return{targetThreadID:Q,rollback:()=>{if(B)this.backStack.pop();this.forwardStack.push(Q)}}}}class MG0 extends C5{offstage;constructor({key:A,offstage:Q=!0,child:B}){super({key:A,child:B});this.offstage=Q}createRenderObject(){return new x41(this.offstage)}updateRenderObject(A){if(A instanceof x41)A.offstage=this.offstage}}class x41 extends Y4{_offstage;constructor(A){super();this._offstage=A}get offstage(){return this._offstage}set offstage(A){if(A===this._offstage)return;this._offstage=A,this.markNeedsLayout()}getMinIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicWidth(A)??0}getMaxIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicWidth(A)??0}getMinIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicHeight(A)??0}getMaxIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicHeight(A)??0}performLayout(){let A=this._lastConstraints;N4(!!A,"performLayout called without constraints");let Q=this.children[0];if(this._offstage){if(this.setSize(0,0),Q)Q.layout(A),Q.setOffset(0,0)}else if(Q){Q.layout(A);let B=A.constrain(Q.size.width,Q.size.height);this.setSize(B.width,B.height),Q.setOffset(0,0)}else{let B=A.smallest;this.setSize(B.width,B.height)}super.performLayout()}paint(A,Q,B){if(this._offstage)return;super.paint(A,Q,B)}hitTest(A,Q,B,$){if(this._offstage)return!1;return super.hitTest(A,Q,B,$)}}class Js{_state=null;_attach(A){this._state=A}_detach(){this._state=null}push(A){this._state?.push(A)}pushWithDismiss(A){this._state?.pushWithDismiss(A)}pop(){return this._state?.pop()??!1}get canPop(){return this._state?.canPop??!1}}class b41 extends _0{root;controller;constructor(A){super();this.root=A.root,this.controller=A.controller}createState(){return new Mi4}}class Mi4 extends P0{entries=[];initState(){this.widget.controller._attach(this)}didUpdateWidget(A){if(A.controller!==this.widget.controller)A.controller._detach(),this.widget.controller._attach(this)}dispose(){this.widget.controller._detach(),super.dispose()}push(A){let Q=new Mj,B=this.makeScopedDismiss(Q);this.setState(()=>{this.entries.push({key:Q,widget:A,dismiss:B})})}pushWithDismiss(A){let Q=new Mj,B=this.makeScopedDismiss(Q),$=A(B);this.setState(()=>{this.entries.push({key:Q,widget:$,dismiss:B})})}pop(){if(this.entries.length===0)return!1;return this.setState(()=>{this.entries.pop()}),!0}get canPop(){return this.entries.length>0}makeScopedDismiss(A){return()=>{if(!this.mounted)return;let Q=this.entries[this.entries.length-1];if(!Q||Q.key!==A)return;this.setState(()=>{this.entries.pop()})}}build(A){let Q=[];Q.push(new MG0({offstage:this.entries.length>0,child:this.widget.root}));for(let B=0;B<this.entries.length;B++){let $=this.entries[B],J=B===this.entries.length-1,Y=J?new u4({autofocus:!0,debugLabel:`ModalStackEntry[${B}]`,onKey:(Z)=>{if(Z.key!=="Escape")return"ignored";return $.dismiss(),"handled"},child:$.widget}):$.widget;Q.push(new MG0({key:$.key,offstage:!J,child:Y}))}return new t4({fit:"expand",children:Q})}}import Li4 from"node:process";class h41 extends q1{props;constructor(A){super();this.props=A}build(A){let Q=this.props.commands.filter(($)=>$.status.type!=="hidden"),B=jy5(Q);return new wA({header:"Command Palette",autofocus:!1,barrierOpaque:!1,chromePadding:K0.only({left:1,top:1,right:1}),footer:"none",onDismiss:this.props.onDismiss,child:new d6({items:Q,showBorder:!1,getLabel:($)=>{let J=u41($);return $.keywords&&$.keywords.length>0?`${J} ${$.keywords.join(" ").toLowerCase()}`:J},sortItems:($,J,Y)=>{if(Y===""){let G=$.item.status.type==="disabled"?1:0,V=J.item.status.type==="disabled"?1:0;if(G!==V)return G-V;let U=$.item.sortBoost??0,K=J.item.sortBoost??0;if(U!==K)return K-U;let E=$.item.noun?.toLowerCase()??"",z=J.item.noun?.toLowerCase()??"";if(E!==z)return E<z?-1:1;return 0}let Z=dj($.item.verb.toLowerCase(),Y),F=dj(J.item.verb.toLowerCase(),Y);if(Z!==F)return F-Z;let X=dj(u41($.item),Y),D=dj(u41(J.item),Y);if(X!==D)return D-X;return J.score-$.score},isItemDisabled:($)=>$.status.type==="disabled",buildDisabledReasonWidget:($,J)=>{if($.status.type!=="disabled")return;let{colors:Y}=j0.of(J);return new p({text:new C($.status.reason,new S({color:Y.mutedForeground,dim:!0})),textAlign:"center"})},renderItem:($,J,Y,Z)=>new Oi4({command:$,isSelected:J,isDisabled:Y,categoryWidth:B,buildContext:Z}),onAccept:($)=>{this.props.onAccept($)},onDismiss:this.props.onDismiss})})}}class Oi4 extends q1{props;constructor(A){super();this.props=A}build(A){let{command:Q,isSelected:B,isDisabled:$,categoryWidth:J,buildContext:Y}=this.props,Z=j0.of(Y),{colors:F,app:X}=Z,D=B?X.selectionBackground:void 0,G=B?X.selectionForeground:F.foreground,V=B?G:F.mutedForeground,U=new p({text:new C(Q.noun?.toLowerCase()??"",new S({color:V,dim:$||!B})),textAlign:"right"}),K=[new C(Q.verb.toLowerCase(),new S({color:G,bold:!0,dim:$}))];if($)K.push(new C(" (unavailable)",new S({color:G,dim:!0})));let E=p.spans(K),z=[{child:U,fixedWidth:J},{child:E,expanded:!0}];if(Q.shortcut)z.push({child:Ry5(Q.shortcut,Z,$)});return new ji4({columns:z,padding:K0.horizontal(1),backgroundColor:D})}}function u41(A){return A.noun?`${A.noun.toLowerCase()} ${A.verb.toLowerCase()}`:A.verb.toLowerCase()}function jy5(A){return A.reduce((Q,B)=>{return B.noun?Math.max(Q,j4(B.noun)):Q},0)}function Ry5(A,Q,B){let{colors:$,app:J}=Q,Y=new S({color:$.mutedForeground,dim:B}),Z=[];for(let F of A.modifiers()){if(Z.length>0)Z.push(new C(" ",Y));Z.push(new C(Py5(F),new S({color:J.keybind,bold:!0,dim:B})))}if(Z.length>0)Z.push(new C(" ",Y));return Z.push(new C(_y5(A),new S({color:J.keybind,bold:!0,dim:B}))),p.spans(Z)}function Py5(A){return A==="Meta"&&Li4.platform==="darwin"?"Cmd":A}function _y5(A){return A.meta&&Li4.platform==="darwin"?A.key.toUpperCase():A.key}class ji4 extends q1{props;constructor(A){super();this.props=A}build(A){let{columns:Q,gap:B=2,padding:$,backgroundColor:J}=this.props,Y=[];for(let F=0;F<Q.length;F++){let X=Q[F];if(F>0&&B>0)Y.push(new U0({width:B}));if(X.fixedWidth!==void 0)Y.push(new U0({width:X.fixedWidth,child:X.child}));else if(X.expanded)Y.push(new P1({child:X.child}));else Y.push(X.child)}let Z=new r0({crossAxisAlignment:"start",children:Y});if(!$&&!J)return Z;return new b0({decoration:J?{color:J}:void 0,padding:$,child:Z})}}class g41{#A=[];#Q=new Set;get commands(){return this.#A}register(A){return this.#A.push(A),this.#B(),()=>{let Q=this.#A.indexOf(A);if(Q===-1)return;this.#A.splice(Q,1),this.#B()}}findByID(A){return this.#A.find((Q)=>Q.id===A)}runByID(A,Q){let B=this.findByID(A);if(!B||B.status.type!=="enabled")return!1;return B.run(new Js,Q,()=>{}),!0}addListener(A){this.#Q.add(A)}removeListener(A){this.#Q.delete(A)}#B(){for(let A of this.#Q)A()}}class z9 extends U6{commandRegistry;constructor({commandRegistry:A,child:Q}){super({child:Q});this.commandRegistry=A}updateShouldNotify(A){return!1}static of(A){let Q=z9.maybeOf(A);if(!Q)throw Error("No NeoCommandRegistryProvider found in widget tree");return Q}static maybeOf(A){return A.dependOnInheritedWidgetOfExactType(z9)?.commandRegistry??null}}class m41 extends _0{onDismiss;constructor(A){super();this.onDismiss=A.onDismiss}createState(){return new Ri4}}class Ri4 extends P0{modalStack=new Js;commandRegistry=null;initState(){super.initState(),queueMicrotask(()=>{if(!this.mounted)return;let A=z9.of(this.context);this.commandRegistry=A,A.addListener(this.onCommandsChanged)})}dispose(){this.commandRegistry?.removeListener(this.onCommandsChanged),this.commandRegistry=null,super.dispose()}onCommandsChanged=()=>{this.setState()};build(A){let Q=z9.of(A).commands,B=new h41({commands:Q,onAccept:($)=>{$.run(this.modalStack,A,this.widget.onDismiss)},onDismiss:()=>{if(this.modalStack.canPop)this.modalStack.pop();else this.widget.onDismiss()}});return new b41({root:B,controller:this.modalStack})}}var p41=[{description:"Move cursor up/down",methods:[{keys:["↑"]},{keys:["↓"]}]},{description:"Move cursor left/right",methods:[{keys:["←"]},{keys:["→"]},{input:"B",keys:["Ctrl"]},{input:"F",keys:["Ctrl"]}]},{description:"Insert newline",methods:[{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!0},{description:"Insert newline",methods:[{keys:["Enter"]},{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!1},{description:"Submit message",methods:[{keys:["Enter"]}],submitOnEnterOnly:!0},{description:"Submit message",methods:[{keys:["Ctrl/Cmd","Enter"]}],submitOnEnterOnly:!1},{description:"Clear input",methods:[{keys:["Escape"]}]},{description:"Edit prompt in $EDITOR",methods:[{input:"G",keys:["Ctrl"]}]},{description:"Navigate history (previous/next)",methods:[{input:"P",keys:["Ctrl"]},{input:"N",keys:["Ctrl"]}]},{description:"Jump to start of line",methods:[{keys:["Cmd","←"]},{input:"A",keys:["Ctrl"]}]},{description:"Jump to end of line",methods:[{keys:["Cmd","→"]},{input:"E",keys:["Ctrl"]}]},{description:"Jump to previous word",methods:[{keys:["Alt","←"]},{keys:["Ctrl","←"]},{input:"B",keys:["Alt"]}]},{description:"Jump to next word",methods:[{keys:["Alt","→"]},{keys:["Ctrl","→"]},{input:"F",keys:["Alt"]}]},{description:"Delete character backward",methods:[{keys:["Backspace"]},{input:"H",keys:["Ctrl"]}]},{description:"Delete word backward",methods:[{keys:["Alt","Backspace"]},{input:"W",keys:["Ctrl"]}]},{description:"Delete character forward",methods:[{keys:["Delete"]},{input:"D",keys:["Ctrl"]}]},{description:"Delete to start of line",methods:[{keys:["Cmd","Backspace"]},{input:"U",keys:["Ctrl"]}]},{description:"Delete to end of line",methods:[{input:"K",keys:["Ctrl"]}]},{description:"Yank (paste deleted text)",methods:[{input:"Y",keys:["Ctrl"]}]},{description:"Paste image from clipboard",methods:[{input:"V",keys:["Ctrl"]}]},{description:"Switch agent mode",methods:[{input:"S",keys:["Ctrl"]}]},{description:"Toggle reasoning effort",methods:[{input:"D",keys:["Alt"]}]},{description:"Open command palette",methods:[{input:"O",keys:["Ctrl"]}]},{description:"Mention files",methods:[{keys:["@"]}]},{description:"Mention threads",methods:[{keys:["@@"]}]},{description:"Show prompt history",methods:[{input:"R",keys:["Ctrl"]}]},{description:"Toggle inline shortcuts help",methods:[{keys:["?"]}]},{description:"Toggle thinking/dense view",methods:[{input:"T",keys:["Alt"]}]}],d41=[{description:"Page scroll",methods:[{keys:["Pg Up"]},{keys:["Pg Down"]}]},{description:"Half-page scroll",methods:[{input:"K",keys:["Alt"]},{input:"J",keys:["Alt"]}]},{description:"Mouse wheel scroll",methods:[{keys:["Mouse Wheel"]}]},{description:"Jump to first message",methods:[{keys:["Home"]}]},{description:"Jump to bottom of screen",methods:[{keys:["End"]}]},{description:"Navigate to previous messages",methods:[{keys:["Tab"]},{keys:["Shift","Tab"]}]}];class LG0 extends q1{items;renderRow;constructor({items:A,renderRow:Q}){super();this.items=A,this.renderRow=Q}build(A){let B=t1.of(A).size.width,$=50,J=B<50,Y=[];for(let Z of this.items){let[F,X]=this.renderRow(Z),D;if(J)D=new y0({crossAxisAlignment:"start",mainAxisSize:"min",children:[F,new f0({padding:K0.only({left:4}),child:X})]});else D=new r0({crossAxisAlignment:"start",children:[new P1({flex:1,child:F}),new U0({width:1}),new P1({flex:1,child:X})]});Y.push(new f0({padding:K0.horizontal(6),child:D}))}return new y0({crossAxisAlignment:"start",mainAxisSize:"min",children:Y})}}class c41 extends _0{commands;submitOnEnter;constructor({key:A,commands:Q,submitOnEnter:B}){super(A?{key:A}:{});this.commands=Q,this.submitOnEnter=B??!0}createState(){return new Pi4}}class Pi4 extends P0{scrollController;initState(){this.scrollController=new yA,this.scrollController.disableFollowMode(),this.scrollController.jumpTo(0)}dispose(){}build(A){let B=L1.of(A).colorScheme,J=j0.of(A).app,Y=t1.of(A),Z=new S({color:B.primary,bold:!0}),F=new S({color:B.secondary,bold:!0}),X=new S({color:J.keybind}),D=new S({color:J.command}),G=new S({color:B.foreground}),V=new S({color:B.foreground}),U=Y.size.width,K=Y.size.height,E=U-4,z=K-4,W=Math.max(40,Math.min(80,E)),H=new Set(["permissions-disable"]),N=[...this.widget.commands.filter((L)=>{let R=L.noun?.toLowerCase();return R!=="dev"&&R!=="debug"&&!L.id.startsWith("debug-")&&!H.has(L.id)})].sort((L,R)=>{let v=(L.noun??"").toLowerCase(),T=(R.noun??"").toLowerCase(),f=v.localeCompare(T);if(f!==0)return f;let g=L.verb.toLowerCase(),u=R.verb.toLowerCase(),k=g.localeCompare(u);if(k!==0)return k;return L.id.localeCompare(R.id)}),I=new fA({autofocus:!0,controller:this.scrollController,child:new b0({constraints:new M1(W,W,0,Number.POSITIVE_INFINITY),child:new y0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new Q4({child:new p({text:new C(`Amp CLI - Help & Keyboard Shortcuts
|
|
5789
5789
|
`,Z)})}),new U0({height:1}),new f0({padding:K0.horizontal(2),child:new p({text:new C(`Editor Shortcuts
|
|
5790
5790
|
`,F)})}),new LG0({items:p41.filter((L)=>L.submitOnEnterOnly===void 0||L.submitOnEnterOnly===this.widget.submitOnEnter),renderRow:(L)=>{let R=[];for(let T of L.methods){let f=this.buildCleanKeyCombination(T);R.push(f)}let v=R.join(", ");return[new p({text:new C(v,X)}),new p({text:new C(L.description,G)})]}}),new U0({height:1}),new f0({padding:K0.horizontal(2),child:new p({text:new C(`Scrolling & Navigation
|
|
5791
5791
|
`,F)})}),new LG0({items:d41,renderRow:(L)=>{let R=[];for(let T of L.methods){let f=this.buildCleanKeyCombination(T);R.push(f)}let v=R.join(", ");return[new p({text:new C(v,X)}),new p({text:new C(L.description,G)})]}}),new U0({height:1}),new f0({padding:K0.horizontal(2),child:new p({text:new C(`Command Palette Commands
|
|
@@ -5875,7 +5875,7 @@ Ctrl-X, Y, Z to unlock`;if(this.widget.centerContent)g=this.widget.centerContent
|
|
|
5875
5875
|
`))}return Z}function ch5(A,Q,B){let{colors:$,app:J}=B,Y=lh5(Q.status,B);if(A.push(new C(` ${Y.icon} `,new S({color:Y.color}))),A.push(new C(Q.name,new S({color:Q.status==="pending"?$.warning:J.command}))),Q.status==="pending")A.push(new C(" discovering...",new S({color:$.foreground,dim:!0})));else if(Q.description)A.push(new C(` ${Zr4(Q.description,50)}`,new S({color:$.foreground,dim:!0})));if(Q.error)A.push(new C(` ${Zr4(Q.error,40)}`,new S({color:J.toolError})));A.push(new C(`
|
|
5876
5876
|
`))}function lh5(A,Q){let{colors:B,app:$}=Q;switch(A){case"pending":return{icon:"◌",color:B.warning};case"registered":return{icon:"•",color:B.mutedForeground};case"failed":return{icon:"✗",color:$.toolError};case"duplicate":return{icon:"◇",color:B.warning};default:return{icon:"?",color:B.foreground}}}function Zr4(A,Q){let B=A.replace(/\s+/g," ").trim();if(j4(B)<=Q)return B;let $="...",J=j4($);if(Q<=J)return KJ($,Q);return`${KJ(B,Q-J,!0,"")}${$}`}var T61="https://ampcode.com/news/neo",k61=[{title:"Meet the new Amp CLI",body:[]},{title:"Rebuilt From The Ground Up",body:["Same close-up terminal workflow. Completely different underneath."]},{title:"Just Keep Typing",body:["Context is summarized automatically at ~90%.","No handoff flow. No context percentage to babysit."]},{title:"Queueing and Steering",body:["Sending a message now queues by default instead of cancelling tools.","Use steering when you want the agent to see something sooner."]},{title:"Remote Control",body:["Start a thread in the CLI, then keep going from ampcode.com.","Watch live updates and queue follow-ups from any device."]},{title:"Customize Amp with Amp",body:[{text:"Amp now has a ",linkText:"complete plugin API",href:"https://ampcode.com/manual/plugin-api",textAfter:"."},"Add tools, commands, control UI, and hook into events."]},{title:"Permissions",body:[{text:"By default (when no ",highlightText:"amp.permissions",textAfterHighlight:" setting is present), Amp no longer asks for confirmation before running any tools and commands. And you can now implement your own custom permission logic with ",linkText:"plugins",href:"https://ampcode.com/manual/plugin-api",textAfter:"."}]},{title:null,body:["Check out the full news post for more:",{text:T61,href:T61},"","",{text:"Need old Amp for a bit? Use ",keybind:"amp --take-me-back"}]}];function ih5(A){return[{title:"Upgrade your Amp CLI",body:[{text:"This npm-based distribution of Amp CLI has been deprecated. To use the ",linkText:"new Amp CLI",href:T61,textAfter:" you'll need to switch to the binary install:",linkWidget:!0},"",{codeBlock:["npm uninstall -g @sourcegraph/amp",A]}]}]}function nh5(){if(process.platform==="win32")return'powershell -c "irm https://ampcode.com/install.ps1 | iex"';return"curl -fsSL https://ampcode.com/install.sh | bash"}var Tx=50,ZR=40,P61=1000,ah5=420,oh5=760,rh5=-250,sh5=1100,AV0=33,Gr4=0.999,th5=2.1,eh5=720,Ag5=420,qr4="Meet the new",Nr4="Amp",Ir4="CLI",S61=C4(qr4).length,Qg5=C4(Nr4).length,Bg5=C4(Ir4).length,QV0={primary:{r:140,g:38,b:0},secondary:{r:255,g:225,b:102}},Vr4={primary:{r:10,g:42,b:18},secondary:{r:200,g:230,b:68}},Ur4={primary:{r:18,g:0,b:107},secondary:{r:103,g:255,b:168}},Kr4=[QV0,Vr4,Ur4,QV0,Vr4,Ur4,QV0],$g5=QV0;class v61 extends _0{onDismiss;onQuit;animationProgress;animationsEnabled;variant;binaryInstallCommand;introStages;dismissible;constructor(A){super();this.onDismiss=A.onDismiss,this.onQuit=A.onQuit,this.animationProgress=A.animationProgress,this.animationsEnabled=A.animationsEnabled??!0,this.variant=A.variant??"intro",this.binaryInstallCommand=A.binaryInstallCommand??nh5(),this.introStages=this.variant==="npm-migration"?ih5(this.binaryInstallCommand):k61,this.dismissible=this.variant!=="npm-migration"}createState(){return new wr4}}class wr4 extends P0{startedAt=performance.now();animationTimer=null;stageTransitionTimer=null;firstStageTitleTimer=null;firstStageHintTimer=null;firstStageRevealTimer=null;firstStageTitleRevealStartedAt=null;firstStageHintRevealStartedAt=null;stageTransitionStartedAt=performance.now();animationStartProgress=0;animationTargetProgress=1;animationDurationMs=P61;onAnimationComplete=null;animationProgress=0;introStage=0;previousIntroStage=null;stageTransitionProgress=1;stageTransitionDirection=1;firstStageTitleVisible=!1;firstStageHintVisible=!1;firstStageTitleRevealProgress=0;firstStageHintRevealProgress=0;dismissTimer=null;dismissStartedAt=performance.now();dismissProgress=0;isDismissing=!1;splashOrbGlow=new u9(42);initState(){super.initState(),this.startAnimationIfNeeded()}didUpdateWidget(A){if(super.didUpdateWidget(A),A.animationProgress!==this.widget.animationProgress||A.animationsEnabled!==this.widget.animationsEnabled)this.startAnimationIfNeeded()}dispose(){this.stopAnimation(),this.stopStageTransitionTimer(),this.stopFirstStageRevealTimers(),this.stopDismissAnimation(),super.dispose()}startAnimationIfNeeded(){if(this.stopAnimation(),this.stopFirstStageRevealTimers(),this.widget.animationProgress!==void 0){this.animationProgress=nY(this.widget.animationProgress),this.firstStageTitleVisible=this.animationProgress>=Gr4,this.firstStageHintVisible=this.animationProgress>=Gr4,this.firstStageTitleRevealProgress=this.firstStageTitleVisible?1:0,this.firstStageHintRevealProgress=this.firstStageHintVisible?1:0;return}if(!this.widget.animationsEnabled){this.stopStageTransitionTimer(),this.stopDismissAnimation(),this.animationProgress=1,this.isDismissing=!1,this.dismissProgress=0,this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1,this.previousIntroStage=null,this.stageTransitionProgress=1;return}if(this.firstStageTitleVisible=!1,this.firstStageHintVisible=!1,this.firstStageTitleRevealProgress=0,this.firstStageHintRevealProgress=0,this.startProgressAnimation({from:0,to:1,durationMs:P61,onComplete:()=>{if(!this.widget.dismissible)this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1})}}),this.widget.dismissible)this.startFirstStageRevealSequence()}startDismissAnimation(){if(this.isDismissing)return;if(!this.widget.animationsEnabled){this.widget.onDismiss();return}this.stopFirstStageRevealTimers(),this.stopStageTransitionTimer(),this.dismissStartedAt=performance.now(),this.setState(()=>{this.isDismissing=!0,this.dismissProgress=0}),this.dismissTimer=setInterval(()=>{let A=performance.now()-this.dismissStartedAt,Q=nY(A/oh5);if(this.setState(()=>{this.dismissProgress=Q}),Q>=1)this.stopDismissAnimation(),this.widget.onDismiss()},AV0)}canNavigateIntroStage(){if(this.isDismissing)return!1;if(!this.firstStageHintVisible)return!1;if(this.introStage===0&&this.firstStageHintRevealProgress<1)return!1;return!0}advanceIntroStage(){if(!this.canNavigateIntroStage())return;if(this.isFinalIntroStage()){if(this.widget.dismissible)this.startDismissAnimation();return}this.moveIntroStage(1)}dismissFromFinalIntroStage(){if(!this.widget.dismissible||!this.canNavigateIntroStage()||!this.isFinalIntroStage())return!1;return this.startDismissAnimation(),!0}nextIntroStage(){if(!this.canNavigateIntroStage()||this.isFinalIntroStage())return;this.moveIntroStage(1)}goToPreviousIntroStage(){if(!this.canNavigateIntroStage()||this.introStage<=0)return;this.moveIntroStage(-1)}isFinalIntroStage(){return this.introStage>=this.widget.introStages.length-1}moveIntroStage(A){let Q=this.introStage+A;if(this.stopStageTransitionTimer(),this.stageTransitionStartedAt=performance.now(),this.setState(()=>{this.previousIntroStage=this.introStage,this.introStage=Q,this.stageTransitionDirection=A}),this.widget.animationProgress!==void 0||!this.widget.animationsEnabled){this.setState(()=>{this.previousIntroStage=null,this.stageTransitionProgress=1});return}this.setState(()=>{this.stageTransitionProgress=0}),this.stageTransitionTimer=setInterval(()=>{let B=performance.now()-this.stageTransitionStartedAt,$=nY(B/ah5);if(this.setState(()=>{if(this.stageTransitionProgress=$,$>=1)this.previousIntroStage=null}),$>=1)this.stopStageTransitionTimer()},AV0)}startProgressAnimation({from:A,to:Q,durationMs:B,onComplete:$}){this.stopAnimation(),this.startedAt=performance.now(),this.animationStartProgress=A,this.animationTargetProgress=Q,this.animationDurationMs=B,this.onAnimationComplete=$,this.animationProgress=A,this.animationTimer=setInterval(()=>{let J=performance.now()-this.startedAt,Y=nY(J/this.animationDurationMs),Z=this.animationStartProgress+(this.animationTargetProgress-this.animationStartProgress)*kx(Y);if(this.setState(()=>{this.animationProgress=Z}),Y>=1)this.stopAnimation(),this.onAnimationComplete?.(),this.onAnimationComplete=null},AV0)}stopAnimation(){if(this.animationTimer)clearInterval(this.animationTimer),this.animationTimer=null}stopStageTransitionTimer(){if(this.stageTransitionTimer)clearInterval(this.stageTransitionTimer),this.stageTransitionTimer=null}startFirstStageRevealSequence(){if(this.stopFirstStageRevealTimers(),!this.widget.animationsEnabled){this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1});return}this.setState(()=>{this.firstStageTitleVisible=!1,this.firstStageHintVisible=!1,this.firstStageTitleRevealProgress=0,this.firstStageHintRevealProgress=0});let A=Math.max(0,P61+rh5),Q=A+sh5;this.firstStageTitleTimer=setTimeout(()=>{this.firstStageTitleRevealStartedAt=performance.now(),this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageTitleRevealProgress=0}),this.startFirstStageRevealTimer()},A),this.firstStageHintTimer=setTimeout(()=>{this.firstStageHintRevealStartedAt=performance.now(),this.setState(()=>{this.firstStageHintVisible=!0,this.firstStageHintRevealProgress=0}),this.startFirstStageRevealTimer()},Q)}startFirstStageRevealTimer(){if(this.firstStageRevealTimer)return;this.firstStageRevealTimer=setInterval(()=>{let A=performance.now(),Q=this.firstStageTitleRevealStartedAt?nY((A-this.firstStageTitleRevealStartedAt)/eh5):this.firstStageTitleRevealProgress,B=this.firstStageHintRevealStartedAt?nY((A-this.firstStageHintRevealStartedAt)/Ag5):this.firstStageHintRevealProgress;if(this.setState(()=>{this.firstStageTitleRevealProgress=Q,this.firstStageHintRevealProgress=B}),Q>=1&&B>=1)this.stopFirstStageRevealTimer()},AV0)}stopFirstStageRevealTimers(){if(this.stopFirstStageRevealTimer(),this.firstStageTitleRevealStartedAt=null,this.firstStageHintRevealStartedAt=null,this.firstStageTitleTimer)clearTimeout(this.firstStageTitleTimer),this.firstStageTitleTimer=null;if(this.firstStageHintTimer)clearTimeout(this.firstStageHintTimer),this.firstStageHintTimer=null}stopFirstStageRevealTimer(){if(this.firstStageRevealTimer)clearInterval(this.firstStageRevealTimer),this.firstStageRevealTimer=null}stopDismissAnimation(){if(this.dismissTimer)clearInterval(this.dismissTimer),this.dismissTimer=null}currentOrbPalette(){let A=Er4(this.introStage),Q=this.previousIntroStage===null||this.stageTransitionProgress>=1?A:zr4(Er4(this.previousIntroStage),A,kx(this.stageTransitionProgress));return this.dismissProgress>0?zr4(Q,$g5,kx(this.dismissProgress)):Q}build(A){let Q=L1.of(A).colorScheme,B=j0.of(A),$=this.currentOrbPalette(),J=oQ(1,"frontier",$),Y=t1.of(A).size,F=this.widget.animationProgress??this.animationProgress,X=Math.max(Y.width/Tx,Y.height/ZR)*th5,D=X+(1-X)*F,G=kx(this.dismissProgress),V=Math.max(Tx,Math.round(Tx*D)),U=Math.max(ZR,Math.round(ZR*D)),K=Math.round((Y.width-V)/2),E=Math.round((Y.height-U)/2),z=Math.max(0,Math.floor((Y.width-Tx)/2)),W=-Math.floor(ZR/2),H=Math.round(K+(z-K)*F),q=Math.round(E+(W-E)*F),N=H+V/2,I=q+U/2,w=Jg5({dismissProgress:this.dismissProgress,easedDismissProgress:G,introOrbScale:D,normalOrbCenterX:N,normalOrbCenterY:I,size:Y}),O=Math.max(Tx,Math.round(Tx*w.orbScale)),L=Math.max(ZR,Math.round(ZR*w.orbScale)),R=w.orbCenterX,v=w.orbCenterY,T=Math.round(R-O/2),f=Math.round(v-L/2),g=Math.max(3,Math.min(Y.height-5,Math.floor(ZR/2)+2)),u=Math.max(g+3,Y.height-3),k=w.textDissolveProgress,b=this.isFinalIntroStage()?w.backdropDissolveProgress:0,d=this.firstStageTitleVisible&&k<1,c=d&&this.firstStageHintVisible,h=c&&this.widget.dismissible&&this.introStage>0&&!this.isFinalIntroStage(),i=this.introStage===0?this.firstStageTitleRevealProgress:1,r=this.introStage===0?this.firstStageHintRevealProgress:1,Q0=Math.max(24,Math.min(74,Y.width-4)),w0=Math.min(12,Math.max(8,Y.height-g-6)),X0=Math.max(0,Math.floor((Y.width-Q0)/2)),H0=Math.max(0,Math.min(Y.height-w0,Math.floor(Y.height*0.55-w0/2))),R0=this.widget.animationProgress!==void 0||!this.widget.animationsEnabled?new If({width:O,height:L,agentMode:"frontier",visualStyle:"neo",neoGlyphSet:"dotField",backgroundColor:Q.background,primaryColor:$.primary,secondaryColor:$.secondary,glow:this.splashOrbGlow,seed:42,fps:0,onClick:()=>{}}):new If({width:O,height:L,agentMode:"frontier",visualStyle:"neo",neoGlyphSet:"dotField",backgroundColor:Q.background,primaryColor:$.primary,secondaryColor:$.secondary,glow:this.splashOrbGlow,onClick:()=>{}});return new u4({autofocus:!0,canRequestFocus:!0,debugLabel:"NeoWelcomeTakeover",onKey:(B0)=>{if(B0.key==="Enter")return this.advanceIntroStage(),"handled";if(!this.widget.dismissible&&B0.key==="c"&&B0.ctrlKey)return this.widget.onQuit?.(),"handled";if(!this.widget.dismissible&&B0.key==="q")return this.widget.onQuit?.(),"handled";if((B0.key===" "||B0.key==="Space")&&!this.isFinalIntroStage())return this.advanceIntroStage(),"handled";if(B0.key==="Escape"||B0.key==="Esc"){if(!this.widget.dismissible)return this.widget.onQuit?.(),"handled";return this.dismissFromFinalIntroStage()?"handled":"ignored"}if(B0.key==="ArrowRight")return this.nextIntroStage(),"handled";if(B0.key==="ArrowLeft")return this.goToPreviousIntroStage(),"handled";return"ignored"},child:new t4({fit:"expand",children:[new Cr4({color:Q.background,dissolveProgress:b}),new t4({fit:"expand",children:[new T1({onClick:()=>{},child:U0.expand()}),new GA({left:T,top:f,width:O,height:L,child:R0}),...d?[new GA({left:X0,top:H0,width:Q0,height:w0,child:Zg5({introStages:this.widget.introStages,stage:this.introStage,previousStage:this.previousIntroStage,progress:this.stageTransitionProgress,direction:this.stageTransitionDirection,width:Q0,height:w0,foreground:Q.foreground,mutedForeground:Q.mutedForeground,accent:J,link:B.app.link,keybind:B.app.keybind,titleRevealProgress:i,dissolveProgress:k,context:A})})]:[],...c?[...h?[new GA({left:X0,top:Math.max(0,u-1),width:Q0,height:1,child:new p({text:Ug5({stage:this.introStage,featureStageCount:Math.max(0,this.widget.introStages.length-2),foreground:Q.mutedForeground,dissolveProgress:k}),textAlign:"center"})})]:[],new GA({left:X0,top:u,width:Q0,height:1,child:Eg5({finalStage:this.isFinalIntroStage(),dismissible:this.widget.dismissible,foreground:Q.mutedForeground,keybind:B.app.keybind,revealProgress:r,dissolveProgress:k,context:A})})]:[]]})]})})}}class Cr4 extends V8{color;dissolveProgress;constructor({color:A,dissolveProgress:Q}){super();this.color=A,this.dissolveProgress=Q}createRenderObject(){return new Mr4(this.color,this.dissolveProgress)}updateRenderObject(A){A.update(this.color,this.dissolveProgress)}}class Mr4 extends Y4{color;dissolveProgress;constructor(A,Q){super();this.color=A,this.dissolveProgress=Q}update(A,Q){this.color=A,this.dissolveProgress=Q,this.markNeedsPaint()}performLayout(){let A=this._lastConstraints;N4(!!A,"performLayout called without constraints");let Q=A.constrain(A.biggest.width,A.biggest.height);this.setSize(Q.width,Q.height),super.performLayout()}paint(A,Q=0,B=0){let $=Math.floor(Q+this.offset.x),J=Math.floor(B+this.offset.y),Y=Math.floor(this.size.width),Z=Math.floor(this.size.height),F={bg:this.color},X=nY(this.dissolveProgress);if(X<=0){A.fill($,J,Y,Z," ",F);return}if(X>=1)return;for(let D=0;D<Z;D++)for(let G=0;G<Y;G++)if(!Yg5(G,D,Y,Z,X))A.fill($+G,J+D,1,1," ",F)}}function nY(A){return Math.min(1,Math.max(0,A))}function kx(A){return 1-(1-A)**3}function Er4(A){return Kr4[A]??Kr4[0]}function zr4(A,Q,B){return{primary:Lj(A.primary,Q.primary,B),secondary:Lj(A.secondary,Q.secondary,B)}}function Jg5({dismissProgress:A,easedDismissProgress:Q,introOrbScale:B,normalOrbCenterX:$,normalOrbCenterY:J,size:Y}){return{orbScale:B+(B*0.86-B)*Q,orbCenterX:$+(Y.width*0.54-$)*Q,orbCenterY:J-Y.height*0.44*Q,textDissolveProgress:nY(A/0.52),backdropDissolveProgress:kx(nY((A-0.12)/0.88))}}function Yg5(A,Q,B,$,J){let Y=$<=1?0:Q/($-1),Z=Lr4(A+Q*Math.max(1,B));return(1-Y)*0.72+Z*0.28<J}function Zg5({introStages:A,stage:Q,previousStage:B,progress:$,direction:J,width:Y,height:Z,foreground:F,mutedForeground:X,accent:D,link:G,keybind:V,titleRevealProgress:U,dissolveProgress:K,context:E}){if(B===null||$>=1)return _61({introStages:A,stage:Q,foreground:F,mutedForeground:X,accent:D,link:G,keybind:V,titleRevealProgress:U,dissolveProgress:K,context:E});let z=kx($),W=J*Math.round((1-z)*Y),H=-J*Math.round(z*Y);return new yz(new t4({fit:"expand",children:[new GA({left:H,top:0,width:Y,height:Z,child:_61({introStages:A,stage:B,foreground:F,mutedForeground:X,accent:D,link:G,keybind:V,titleRevealProgress:B===0?1:U,dissolveProgress:K,context:E})}),new GA({left:W,top:0,width:Y,height:Z,child:_61({introStages:A,stage:Q,foreground:F,mutedForeground:X,accent:D,link:G,keybind:V,titleRevealProgress:U,dissolveProgress:K,context:E})})]}))}function _61({introStages:A,stage:Q,foreground:B,mutedForeground:$,accent:J,link:Y,keybind:Z,titleRevealProgress:F,dissolveProgress:X,context:D}){let G=A[Q]??A[0]??k61[0],V=new S({color:J,bold:!0}),U=new S({color:B}),K=A===k61&&Q===0,E=[...G.title===null?[]:[new p({text:K?BV0(Dg5({progress:F,foreground:J,pulseColor:J}),X):new C(F$(G.title,X),V),textAlign:"center"})],...G.body.length>0?[Fg5()]:[],...G.body.map((z)=>Xg5(z,U,$,Y,Z,X,D))];return new Q4({child:new f0({padding:K0.horizontal(1),child:new y0({crossAxisAlignment:"stretch",mainAxisAlignment:"center",mainAxisSize:"min",children:E})})})}function Fg5(){return U0.height(1)}function Xg5(A,Q,B,$,J,Y,Z){if(typeof A==="string")return new p({text:new C(F$(A,Y),Q),textAlign:"center"});if("codeBlock"in A)return new X3({onCopy:(F,X)=>{if(X)u5.success(Z,"Copied to clipboard",2000)},child:new y0({mainAxisSize:"min",children:A.codeBlock.map((F)=>new p({text:new C(F$(F,Y),new S({color:J})),textAlign:"center",selectable:!0}))})});if("keybind"in A){let F=new p({text:new C("",void 0,[new C(F$(A.text,Y),new S({color:B,dim:!0})),new C(F$(A.keybind,Y,C4(A.text).length),new S({color:J}))]),textAlign:"center",selectable:"selectable"in A?A.selectable:!1});if("selectable"in A)return new Q4({child:new X3({child:F})});return F}if("highlightText"in A){let F=kA.createSpan(A.href,A.linkText,new S({color:$,underline:!0})),X=pD.of(Z),D=new C("",void 0,[new C(A.text,Q),new C(A.highlightText,new S({color:J})),new C(A.textAfterHighlight,Q),new C(F.text,F.style,F.children,F.hyperlink,()=>{iA(Z,A.href,{forceExternal:!1,onShowImagePreview:X})}),new C(A.textAfter,Q)]);return new p({text:BV0(D,Y),textAlign:"center"})}if("linkText"in A){if(A.linkWidget)return new y0({mainAxisSize:"min",children:[new p({text:new C(F$(A.text,Y),Q),textAlign:"center"}),new Q4({child:new r0({mainAxisSize:"min",children:[kA.createWidget(Z,A.href,F$(A.linkText,Y),new S({color:$,underline:!0})),new p({text:new C(F$(A.textAfter,Y),Q)})]})})]});let F=kA.createSpan(A.href,A.linkText,new S({color:$,underline:!0})),X=pD.of(Z),D=new C("",void 0,[new C(A.text,Q),new C(F.text,F.style,F.children,F.hyperlink,()=>{iA(Z,A.href,{forceExternal:!1,onShowImagePreview:X})}),new C(A.textAfter,Q)]);return new p({text:BV0(D,Y),textAlign:"center"})}if(Y>0)return new p({text:new C(F$(A.text,Y),new S({color:$,underline:!0})),textAlign:"center"});return new Q4({child:kA.createWidget(Z,A.href,A.text,new S({color:$,underline:!0}))})}function Dg5({progress:A,foreground:Q,pulseColor:B}){let $=new S({color:Q,bold:!0}),J=new S({color:Vg5({progress:A,foreground:Q,pulseColor:B}),bold:!0});return new C("",void 0,[new C(Gg5(A).padEnd(S61," "),$),new C(" ",$),new C(Wr4(Nr4,Qg5,A,0.72),$),new C(" ",$),new C(Wr4(Ir4,Bg5,A,0.88),J)])}function Gg5(A){let Q=C4(qr4),B=Math.min(S61,Math.ceil(nY(A/0.62)*S61));return Q.slice(0,B).join("")}function Wr4(A,Q,B,$){return B>=$?A:"".padEnd(Q," ")}function Vg5({progress:A,foreground:Q,pulseColor:B}){if(A<0.88||A>=1)return Q;let $=nY((A-0.88)/0.12);return Math.cos($*Math.PI*4)*(1-$)>0.12?B:Q}function Ug5({stage:A,featureStageCount:Q,foreground:B,dissolveProgress:$}){return new C(F$(`${A}/${Q}`,$),new S({color:B,dim:!0}))}function Kg5({finalStage:A,dismissible:Q,foreground:B,keybind:$,revealProgress:J,dissolveProgress:Y}){let Z=new S({color:$}),F=new S({color:B,dim:!0}),X=Q?A?"Enter":"Space":"Esc",D=Q?A?" to get started":" to continue":" to quit, or use ",G=Q?"":"amp --take-me-back",V=Q?"":" to use the old version",U=`${D}${G}${V}`;if(!Q)return new C("",void 0,[new C(X,Z),new C(D,F),new C(G,Z),new C(V,F)]);let K=Hr4(X,J),E=Hr4(U,nY((J*(C4(X).length+C4(U).length)-C4(X).length)/C4(U).length));return new C("",void 0,[new C(F$(K,Y),Z),new C(F$(E.slice(0,D.length),Y),F),new C(F$(E.slice(D.length,D.length+G.length),Y),Z),new C(F$(E.slice(D.length+G.length),Y),F)])}function Eg5({finalStage:A,dismissible:Q,foreground:B,keybind:$,revealProgress:J,dissolveProgress:Y,context:Z}){if(Q)return new p({text:Kg5({finalStage:A,dismissible:Q,foreground:B,keybind:$,revealProgress:J,dissolveProgress:Y}),textAlign:"center"});let F=new S({color:$}),X=new S({color:B,dim:!0});return new X3({onCopy:(D,G)=>{if(G)u5.success(Z,"Copied to clipboard",2000)},child:new p({text:new C("",void 0,[new C("q",F),new C(" to quit, or use ",X),new C("amp --take-me-back",F),new C(" to use the old version",X)]),textAlign:"center",selectable:!0})})}function Hr4(A,Q){let B=C4(A),$=Math.min(B.length,Math.ceil(nY(Q)*B.length));return B.slice(0,$).join("").padEnd(B.length," ")}function BV0(A,Q,B=0){if(Q<=0)return A;let $=B+C4(A.text??"").length,J=A.children?.map((Y)=>{let Z=BV0(Y,Q,$);return $+=C4(Y.toPlainText()).length,Z});return new C(A.text?F$(A.text,Q,B):A.text,A.style,J,A.hyperlink,A.onClick)}function F$(A,Q,B=0){if(Q<=0)return A;return C4(A).map((J,Y)=>{if(J.trim()==="")return J;return Lr4(B+Y)<Q?" ":J}).join("")}function Lr4(A){let Q=Math.sin((A+1)*12.9898)*43758.5453;return Q-Math.floor(Q)}d0();s8();function dI(A,Q){let{colors:B,dim:$}=Q,J=[];if(A.totalCostUSD===null)return J;let Y=A.costBreakdown,Z=Y?.freeUSD??0,F=Y?.paidUSD??0;if(Z===0&&F===0)return J;let D={decimalPlaces:"more-if-tiny",intent:"cost"};if(F===0)J.push(new C(uU(Z,D),new S({color:B.foreground,dim:$}))),J.push(new C(" (free)",new S({color:B.foreground,dim:$})));else if(Z>0)J.push(new C(uU(Z,D),new S({color:B.foreground,dim:$}))),J.push(new C(" (free)",new S({color:B.foreground,dim:$}))),J.push(new C(" + ",new S({color:B.foreground,dim:$}))),J.push(new C(uU(F,D),new S({color:B.foreground,dim:$,bold:!$})));else J.push(new C(uU(F,D),new S({color:B.foreground,dim:$,bold:!$})));return J}class y61 extends I4{}class f61 extends I4{}function zg5(A,Q){if(Q.code==="auth-required")return"You must be logged in to view thread usage. Run `amp login` first.";if(Q.code==="thread-not-found")return`Thread ${A} not found.`;return`Failed to load thread usage: ${Q.message??Q.code}`}function Wg5(A,Q){let B=j0.of(Q),{colors:$}=B,J=dI(A,{colors:{foreground:$.foreground}}),Y=[];if(J.length>0)Y.push(new C("Total: ",new S({color:$.mutedForeground}))),Y.push(...J);else if(A.totalCostUSD===null)Y.push(new C("Usage information is currently unavailable."));else Y.push(new C("No usage recorded for this thread yet."));if(A.costBreakdownURL)Y.push(new C(`
|
|
5877
5877
|
|
|
5878
|
-
`)),Y.push(new C("Details: ",new S({color:$.mutedForeground}))),Y.push(new C(A.costBreakdownURL,new S({color:B.app.link})));return new p({text:new C("",void 0,Y)})}function Hg5(A,Q,B){let $=Wg5(A,Q);if(!A.costBreakdownURL)return new wA({header:"Thread Cost",minWidth:80,maxWidth:100,onDismiss:B,child:$});let J=A.costBreakdownURL,Y=new b1(()=>{return m4.maybeInvoke(Q,new p9(J,"Cost breakdown URL copied to clipboard","Failed to copy cost breakdown URL")),"handled"}),Z=new b1(()=>{return iA(Q,J),"handled"});return new wA({header:"Thread Cost",minWidth:80,maxWidth:100,autofocus:!1,footer:[{keys:["Esc"],label:"close"},{keys:["o"],label:"open in browser"},{keys:["y"],label:"copy url"}],onDismiss:B,child:new m4({actions:new Map([[y61,Y],[f61,Z]]),child:new p6({debugLabel:"ThreadCostShortcuts",shortcuts:new Map([[N1.key("o"),new f61],[N1.key("y"),new y61]]),child:new p4({autofocus:!0,debugLabel:"ThreadCostBody",child:$})})})})}function Or4(A){return{noun:"thread",verb:"show cost",description:"Show usage cost for the active thread",keywords:["usage","credits","billing","spend"],get status(){return A.getActiveThreadID()?{type:"enabled"}:{type:"disabled",reason:"No active thread"}},run:async(Q,B,$)=>{let J=A.getActiveThreadID();if(!J)return;try{let Y=await r4.threadDisplayCostInfo({threadID:J},{config:A.configService});if(!Y.ok){A.toastController.show(zg5(J,Y.error),"error",5000),$();return}Q.push(Hg5(Y.result,B,$))}catch(Y){j.error("Failed to load Neo thread cost",{error:Y,threadID:J}),A.toastController.show(`Failed to show thread cost: ${Y instanceof Error?Y.message:String(Y)}`,"error",5000),$()}}}}d0();s1();var qg5=36,Ng5=24,Ig5=72;function jr4(A){return A.replace(/ ago$/,"")}function Rr4(A){return Math.max(Ng5,Math.min(A,Ig5))}class x61 extends I4{}class b61{options;visibility;width=qg5;constructor(A){this.options=A;this.visibility=new Qr(A.state)}isVisible(){return this.visibility.isEnabled()}buildBody(A){return new r0({crossAxisAlignment:"stretch",children:[this.buildSlot(),new P1({child:A})]})}buildSlot(){if(!this.options.isAvailable()||this.visibility.isDisabled())return new U0({width:0});return new U0({width:this.width,child:new u4({debugLabel:"ThreadListSidebar",child:new Pr4({activeThreadID:this.options.getActiveThreadID(),currentWorkspaceURI:r1(p0.file(this.options.getWorkspaceRoot())),width:this.width,loadThreads:this.options.loadThreads,onSelectThread:this.options.onSelectThread,onDismiss:this.close,onResizeWidth:this.resize})})})}commands(){if(!this.options.isAvailable())return[];return[{noun:"thread",verb:"toggle sidebar",description:"Show or hide the thread sidebar",keywords:["sidebar","recent","history","threads"],shortcut:N1.alt("s"),status:{type:"enabled"},run:(A,Q,B)=>{B(),this.toggle()}}]}shortcutEntries(){return this.options.isAvailable()?[[N1.alt("s"),new GG0]]:[]}actionEntries(){if(!this.options.isAvailable())return[];return[[GG0,new b1(()=>this.toggle())]]}toggle=()=>{if(!this.options.isAvailable())return"ignored";if(this.visibility.isDisabled()&&this.options.isBlocked())return"ignored";return this.visibility.toggle(),"handled"};close=()=>{this.visibility.disable()};resize=(A)=>{let Q=Rr4(A);if(Q===this.width)return;this.options.state.setState(()=>{this.width=Q})}}class Pr4 extends _0{props;constructor(A){super();this.props=A}createState(){return new _r4}}class _r4 extends P0{threads=[];isLoading=!0;isSwitchingThread=!1;hasError=!1;filterByWorkspace=!0;timeColWidth=0;resizeSession=null;isResizeHandleHovered=!1;shortcuts=new Map([[N1.alt("w"),new x61]]);actions=new Map([[x61,new b1(()=>{return this.setState(()=>{this.filterByWorkspace=!this.filterByWorkspace}),"handled"})]]);get isBusy(){return this.isLoading||this.isSwitchingThread}get isResizeActive(){return this.resizeSession!==null||this.isResizeHandleHovered}initState(){super.initState(),this.loadThreadSummaries()}async loadThreadSummaries(){try{let A=await this.widget.props.loadThreads(),Q=RA1(A);if(!this.mounted)return;this.setState(()=>{this.threads=Q,this.timeColWidth=Q.reduce((B,$)=>Math.max(B,j4(jr4($.description.timeAgo))),0),this.isLoading=!1,this.hasError=!1})}catch(A){if(j.error("Failed to load threads for Neo sidebar",{error:A}),!this.mounted)return;this.setState(()=>{this.isLoading=!1,this.hasError=!0})}}handleSelectThread=async(A)=>{if(this.isSwitchingThread)return;this.setState(()=>{this.isSwitchingThread=!0});try{await this.widget.props.onSelectThread(A),this.widget.props.onDismiss()}catch(Q){j.error("Failed to switch thread from Neo sidebar",{error:Q,threadID:A})}finally{if(this.mounted)this.setState(()=>{this.isSwitchingThread=!1})}};getThreadsForDisplay(){return this.filterByWorkspace?this.threads.filter((A)=>!A.workspaceURI||A.workspaceURI===this.widget.props.currentWorkspaceURI):this.threads}buildThreadItem(A,Q,B,$){let J=j0.of($),{app:Y,colors:Z}=J,F=!Q,X=Q?Y.selectionForeground:Z.foreground,D=Q?Y.selectionForeground:Z.mutedForeground,V=A.id===this.widget.props.activeThreadID?new p({text:new C("*",new S({color:Q?Y.selectionForeground:Z.success,dim:F}))}):void 0,U=jr4(A.description.timeAgo);return new b0({padding:K0.symmetric(1,0),child:new r0({children:[new U0({width:2,child:V}),new P1({child:new p({text:new C(A.title,new S({color:X,dim:F})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),new U0({width:B,child:r0.end([new p({text:new C(U,new S({color:D,dim:F}))})])})]})})}handleResizeHandlePress=(A)=>{if(A.button!=="left")return;this.setState(()=>{this.resizeSession={baseWidthColumns:this.widget.props.width,startColumn:Math.floor(A.position.x)}})};handleResizeHandleDrag=(A)=>{if(A.button!=="left"||this.resizeSession===null)return;let Q=Math.floor(A.position.x)-this.resizeSession.startColumn,B=Rr4(this.resizeSession.baseWidthColumns+Q);if(B!==this.widget.props.width)this.widget.props.onResizeWidth(B)};handleResizeHandleRelease=(A)=>{if(A.button!=="left"||this.resizeSession===null)return;this.setState(()=>{this.resizeSession=null})};handleResizeHandleEnter=()=>{if(this.isResizeHandleHovered)return;this.setState(()=>{this.isResizeHandleHovered=!0})};handleResizeHandleExit=()=>{if(!this.isResizeHandleHovered)return;this.setState(()=>{this.isResizeHandleHovered=!1})};buildResizeHandle(){return new GA({top:0,right:0,bottom:0,width:1,child:new T1({cursor:F6.EW_RESIZE,onClick:this.handleResizeHandlePress,onDrag:this.handleResizeHandleDrag,onRelease:this.handleResizeHandleRelease,onEnter:this.handleResizeHandleEnter,onExit:this.handleResizeHandleExit,child:new U0({width:1})})})}build(A){let Q=j0.of(A),B=this.getThreadsForDisplay(),$=this.hasError?[]:B,J=this.isSwitchingThread?"Switching thread...":"Loading threads...",Y=this.hasError?"Failed to load threads":"No threads match your filter",Z=this.isResizeActive?2:1,F=new p1(void 0,new d1(Q.colors.border,Z),void 0,void 0);return new b0({width:this.widget.props.width,child:new t4({fit:"expand",children:[new b0({decoration:new k4(Q.colors.background,F),child:new m4({actions:this.actions,child:new p6({shortcuts:this.shortcuts,debugLabel:"ThreadListSidebarFilter",child:new d6({items:$,getLabel:(X)=>`${X.title} ${X.id}`,onAccept:(X)=>void this.handleSelectThread(X.id),onDismiss:this.widget.props.onDismiss,renderItem:(X,D,G,V)=>this.buildThreadItem(X,D,this.timeColWidth,V),enabled:!this.isBusy,isLoading:this.isBusy,hidePromptWhenLoading:!0,loadingText:J,emptyStateText:Y,maxRenderItems:200,showBorder:!1})})})}),this.buildResizeHandle()]})})}}class u61 extends _0{listSkillsForThread;clientPool;completionBuilder;history;ideManager;configService;updateService;initialThreadIDs;showNeoWelcome;neoWelcomeVariant;onNeoWelcomeDismissed;notificationService;mcpTrustHandler;onThreadArchived;onActiveThreadChange;onRelaunchRequested;onFirstFrame;initialUserInput;getDefaultNewThreadVisibility;openThreadPickerOnStart;workspaceSettingsFilePath;neoContext;constructor(A){super();this.listSkillsForThread=A.listSkillsForThread,this.clientPool=A.clientPool,this.completionBuilder=A.completionBuilder,this.history=A.history,this.ideManager=A.ideManager,this.configService=A.configService,this.updateService=A.updateService,this.initialThreadIDs=A.initialThreadIDs??[],this.showNeoWelcome=A.showNeoWelcome??!1,this.neoWelcomeVariant=A.neoWelcomeVariant??"intro",this.onNeoWelcomeDismissed=A.onNeoWelcomeDismissed,this.notificationService=A.notificationService,this.mcpTrustHandler=A.mcpTrustHandler,this.onThreadArchived=A.onThreadArchived,this.onActiveThreadChange=A.onActiveThreadChange,this.onRelaunchRequested=A.onRelaunchRequested,this.onFirstFrame=A.onFirstFrame,this.initialUserInput=A.initialUserInput,this.getDefaultNewThreadVisibility=A.getDefaultNewThreadVisibility,this.openThreadPickerOnStart=A.openThreadPickerOnStart??!1,this.workspaceSettingsFilePath=A.workspaceSettingsFilePath,this.neoContext=A.neoContext}createState(){return new kr4}}class kr4 extends P0{editorController=new P8;commandPalette=new Qr(this);commandRegistry=new g41;toastController=new Q01;relaunchNotificationController=new k41;exitHintTimer=new Ar(this,1000);ideStatus=new D2(this,{});threadNavigationHistory=new f41;draftThreadSettings={};draftThreadSettingsSeed={};hasDraftThreadSettingsSeed=!1;draftThreadSettingsInitPromise=null;activeThreadContext=null;activeThreadIDSubscription=null;connectionErrorsSubscription=null;configSubscription=null;connectingToThreadID=null;executorAlreadyConnectedDialog=null;switchThreadPickerVisible=!1;neoWelcomeVisible=!1;debugOverlayVisible=!1;focusDebugVisible=!1;unregisterCommands=null;pluginIntegration=null;mcpTrustIntegration=null;updateRelaunchIntegration=null;noticesPollingTimeout=null;notices;loadThreads=async()=>{return this.widget.neoContext.listThreads()};analyzeContextForThread=async(A,Q)=>{return eh4({ampURL:this.widget.neoContext.ampURL,configService:this.widget.configService,threadID:A,signal:Q})};onSwitchThread=(A)=>{return this.connectToExistingThread(A,{recordNavigation:!0,rethrowError:!0})};threadListSidebar=new b61({state:this,isAvailable:()=>this.widget.neoContext.isInternalUser,isBlocked:()=>this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal(),getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,getWorkspaceRoot:()=>this.widget.neoContext.workspaceRoot,loadThreads:this.loadThreads,onSelectThread:this.onSwitchThread});sendFeedbackReport=async(A)=>CG0({configService:this.widget.configService,settingsFilePath:this.widget.neoContext.settingsFilePath},A);archiveThread=async(A)=>{let Q=await Zd4({configService:this.widget.configService},A);if(Q===null)this.widget.onThreadArchived?.(A);return Q};addThreadLabel=async(A,Q)=>{let B=await Fd4({configService:this.widget.configService},A,Q);if(B instanceof Error)return B;return this.toastController.show(B.message,B.type,2000),null};removeThreadLabel=async(A,Q)=>{let B=await Xd4({configService:this.widget.configService},A,Q);if(B instanceof Error)return B;return this.toastController.show(B.message,B.type,2000),null};initState(){if(eB.getInstance().interceptConsole(),this.notices=new H41(this.widget.configService,(B)=>this.setState(B)),lA.instance.addPostFrameCallback(()=>{setTimeout(()=>this.widget.onFirstFrame?.(),0),this.noticesPollingTimeout=setTimeout(()=>{this.noticesPollingTimeout=null,this.notices.startPolling()},500)},"Neo notices polling"),this.widget.showNeoWelcome)this.neoWelcomeVisible=!0;if(this.connectionErrorsSubscription=this.widget.clientPool.connectionErrors$.subscribe(({threadID:B,error:$})=>{if(j.error("Neo failed to connect to thread",{threadID:B,error:$}),!B)this.toastController.show(`Connection failed: ${$.message}`,"error",4000)}),this.configSubscription=this.widget.configService.config.subscribe((B)=>{this.applyDraftThreadSettingsSeed(this.applySessionDefaultsToThreadSettings(M30(B.settings)))}),this.updateRelaunchIntegration=new v41({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested,relaunchNotificationController:this.relaunchNotificationController,updateService:this.widget.updateService}),this.updateRelaunchIntegration.init(),this.ideStatus.subscribe(this.widget.ideManager.status),this.widget.openThreadPickerOnStart)this.switchThreadPickerVisible=!0;this.ensureDraftThreadSettingsInitialized();let A=this.widget.initialUserInput,Q=this.widget.initialThreadIDs[0];if(Q){let B={};if(A)B.initialUserInput=A;this.connectToInitialThreads(Q,B)}else if(A)this.onNewThread([{type:"text",text:A}],this.widget.neoContext.sessionAgentMode);this.pluginIntegration=new T41({state:this,commandPalette:this.commandPalette,commandRegistry:this.commandRegistry,toastController:this.toastController,neoContext:this.widget.neoContext,getActiveThreadID:this.getActiveThreadID,appendToThread:this.appendPluginMessagesToThread}),this.pluginIntegration.init(),this.mcpTrustIntegration=new W41({state:this,mcpTrustHandler:this.widget.mcpTrustHandler,toastController:this.toastController,workspaceSettingsFilePath:this.widget.workspaceSettingsFilePath}),this.mcpTrustIntegration.init(),this.unregisterCommands=this.registerAppCommands(),queueMicrotask(()=>{if(!this.mounted)return;this.replayEarlyInputToEditor()})}replayEarlyInputToEditor(){let A=H4.instance.tuiInstance.getEarlyInputText();if(!A)return;this.editorController.insertText(A)}registerAppCommands(){let A=this,Q=this.widget.neoContext.pluginService?Ei4({pluginService:this.widget.neoContext.pluginService,workspaceRoot:this.widget.neoContext.workspaceRoot,logFilePath:this.widget.neoContext.logFilePath,toastController:this.toastController}):[],$=[wi4({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),{noun:"thread",verb:"switch",description:"Switch to existing thread",keywords:["recent","history","open","resume","change"],status:{type:"enabled"},sortBoost:100,run:(J,Y,Z)=>{J.pushWithDismiss((F)=>PA1({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,onSelectThread:this.onSwitchThread,onDismiss:F,onThreadSelected:Z}))}},...this.threadListSidebar.commands(),{noun:"thread",verb:"switch to previous",description:"Switch to previous thread",keywords:["back"],get status(){return A.threadNavigationHistory.canNavigateBack()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to previous with no previous thread"}},run:(J,Y,Z)=>{A.navigateBack(),Z()}},Or4({configService:this.widget.configService,getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??void 0,toastController:this.toastController}),{noun:"thread",verb:"switch to next",description:"Switch to next thread",keywords:["forward"],get status(){return A.threadNavigationHistory.canNavigateForward()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to next with no next thread"}},run:(J,Y,Z)=>{A.navigateForward(),Z()}},{noun:"mcp",verb:"info",description:"Show MCP servers and tools",keywords:["servers","tools","plugins","integrations"],status:{type:"enabled"},run:(J,Y,Z)=>{J.push(new t41({mcpServers:this.widget.neoContext.mcpServers,onDismiss:Z}))}},{noun:"toolbox",verb:"list",description:"List all toolboxes and their tools",keywords:["tools","toolbox"],status:{type:"enabled"},run:(J)=>{J.pushWithDismiss((Y)=>new R61({toolboxes:this.widget.neoContext.toolboxes,onDismiss:Y}))}},{noun:"news",verb:"open",description:"Open Amp Chronicle in browser",keywords:["chronicle","updates","blog","announcements"],status:{type:"enabled"},run:async(J,Y,Z)=>{try{await iA(Y,"https://ampcode.com/chronicle")}finally{Z()}}},{noun:"settings",verb:"open in editor",description:"Open CLI settings in $EDITOR",keywords:["config","preferences","edit"],status:{type:"enabled"},run:()=>{sQ(this.widget.neoContext.settingsFilePath).catch((J)=>{j.error("Failed to open settings file in editor",{error:J})})}},{noun:"IDE",verb:"connect",description:"Connect to an IDE",keywords:["vscode","cursor","jetbrains","editor","attach"],status:{type:"enabled"},run:(J,Y,Z)=>{J.pushWithDismiss((F)=>new r41({onCancel:F,onSelect:(X)=>{this.handleIdeSelection(X),Z()}}))}},{noun:"amp",verb:"help",description:"Show help & keyboard shortcuts",keywords:["shortcuts","keybindings","docs","manual","?"],status:{type:"enabled"},run:(J,Y,Z)=>{J.push(new l41({commands:z9.of(Y).commands,onDismiss:Z}))}},{noun:"amp",verb:"show welcome",description:"Show the welcome message again",keywords:["intro","onboarding","getting started"],status:{type:"enabled"},run:(J,Y,Z)=>{Z(),A.showNeoWelcome()}},{noun:"amp",verb:"show version",description:"Show current Amp version",keywords:["about","release","build"],status:{type:"enabled"},run:(J,Y,Z)=>{J.push(new wA({header:"Amp Version",maxWidth:72,onDismiss:Z,child:new p({text:new C(pX0({version:"0.0.1779081543-gea23bb",buildTimestamp:"2026-05-18T05:23:43.197Z",buildType:"release"}))})}))}},{noun:"amp",verb:"quit",description:"Exit application",keywords:["exit","close","leave","bye"],shortcut:N1.ctrl("c"),status:{type:"enabled"},run:(J,Y)=>{m4.maybeInvoke(Y,new Kx)}},...Q,...rl4(this.widget.neoContext.logFilePath)].map((J)=>this.commandRegistry.register(J));return()=>{for(let J of $)J()}}build(A){let Q=this.buildHints(),B=this.ideStatus.getValue(),$=this.notices.current,J=new j61({initialAgentMode:this.widget.neoContext.sessionAgentMode,analyzeContextForThread:this.analyzeContextForThread,listSkillsForThread:this.widget.listSkillsForThread,threadContext:this.activeThreadContext,draftThreadSettings:this.draftThreadSettings,editorController:this.editorController,history:this.widget.history,updateDraftThreadSettings:this.updateDraftThreadSettings,onNewThread:this.onNewThread,sendFeedbackReport:this.sendFeedbackReport,archiveThread:this.archiveThread,addThreadLabel:this.addThreadLabel,removeThreadLabel:this.removeThreadLabel,configService:this.widget.configService,hints:Q,ideStatus:B,statusItems:this.pluginIntegration?.getStatusItems()??[],notificationService:this.widget.notificationService,notice:this.activeThreadContext||this.neoWelcomeVisible?null:$,onDismissNotice:(G)=>this.notices.dismiss(G)}),Y=t1.of(A),Z=Y.capabilities.animationSupport!=="disabled",X=[new b0({constraints:M1.tight(Y.size.width,Y.size.height),child:this.threadListSidebar.buildBody(J)})];if(this.commandPalette.isEnabled())X.push(new u4({debugLabel:"CommandPaletteOverlay",onFocusChange:this.closeCommandPaletteOnFocusLoss,child:new m41({onDismiss:this.commandPalette.disable})}));if(this.switchThreadPickerVisible&&!this.neoWelcomeVisible)X.push(PA1({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,onSelectThread:this.onSwitchThread,onDismiss:this.closeSwitchThreadPicker,onThreadSelected:this.closeSwitchThreadPicker}));if(this.neoWelcomeVisible)X.push(new u4({debugLabel:"NeoWelcomeDialogOverlay",child:new v61({onDismiss:this.dismissNeoWelcome,onQuit:()=>H4.instance.stop(),animationsEnabled:Z,variant:this.widget.neoWelcomeVariant})}));let D=this.executorAlreadyConnectedDialog;if(D)X.push(new u4({debugLabel:"NeoExecutorAlreadyConnectedDialogOverlay",child:new a41({existingExecutorPid:D.existingExecutorPid,onChoice:this.handleExecutorAlreadyConnectedChoice})}));if(X.push(...this.mcpTrustIntegration?.buildDialogLayers()??[]),X.push(...this.pluginIntegration?.buildDialogLayers()??[]),this.widget.neoContext.isInternalUser)X.push(new n41({top:this.focusDebugVisible?33:1,visible:this.debugOverlayVisible,pid:$V0.pid,activeThreadID:this.activeThreadContext?.client.getThreadId()??null,connectionInfo$:this.activeThreadContext?.observer.connectionInfo()??null}));if(this.focusDebugVisible)X.push(new o41);return new A8({neoContext:this.widget.neoContext,child:new z9({commandRegistry:this.commandRegistry,child:new Wx({completionBuilder:this.widget.completionBuilder,child:new u5({controller:this.toastController,child:new m4({actions:this.buildActions(),child:new p6({debugLabel:"NeoAppShortcuts",shortcuts:this.buildShortcuts(),child:new p4({debugLabel:"AppShellFocus",child:new B01({controller:this.toastController,complexToastControllers:[this.relaunchNotificationController,...$&&this.activeThreadContext&&!this.neoWelcomeVisible?[this.notices]:[]],child:new i41({configReloadEvents:this.widget.configService.configReloadEvents,toastController:this.toastController,child:new t4({children:X})})})})})})})})})})}buildShortcuts(){let A=new Map([[N1.ctrl("c"),new YG0],[N1.ctrl("o"),new FG0],[N1.alt("i"),new DG0],[N1.alt("p"),new WI],[N1.ctrl("."),new UG0],[N1.ctrl("t"),new zG0],...this.threadListSidebar.shortcutEntries()]);if($V0.env.NODE_ENV==="development"&&$V0.platform==="darwin")A.set(N1.meta("r"),new ZG0);return A}buildActions(){let A=new b1(()=>{if(HJ.hasAnyCopyableSelection())return HJ.tryCopyAnyActiveSelection(),"handled";return this.onExitPressed(),"handled"}),Q=new b1(()=>{if(!this.commandPalette.isEnabled()&&this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.toggle(),"handled"}),B=new b1(()=>{if(this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.enable(),"handled"}),$=new b1(()=>{return this.startNewDraftThread(),"handled"}),J=new b1(()=>{return H4.instance.stop(),"handled"}),Y=new b1(()=>{return $s({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),"handled"}),Z=new b1((U)=>{if(!U.text)return"ignored";return H4.instance.tuiInstance.clipboard.writeText(U.text).then((K)=>{if(K.ok)this.toastController.show(U.successMessage,"success",2000);else this.toastController.show(`${U.failureMessage}: ${K.userFacingErrorMessage}`,"error",4000)}).catch((K)=>{j.error("Failed to copy Neo text to clipboard",{error:K}),this.toastController.show(U.failureMessage,"error",2000)}),"handled"}),F=new b1(()=>{return H4.instance.toggleFrameStatsOverlay(),"handled"}),X=new b1(()=>this.notices.dismissCurrent()?"handled":"ignored"),D=new b1(()=>{if(!this.widget.neoContext.isInternalUser)return"ignored";return this.setState(()=>{this.debugOverlayVisible=!this.debugOverlayVisible}),"handled"}),G=Si4({getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,neoContext:this.widget.neoContext,toastController:this.toastController,startNewDraftThread:this.startNewDraftThread,sendFeedbackReport:this.sendFeedbackReport}),V=new b1(()=>{return this.setState(()=>{this.focusDebugVisible=!this.focusDebugVisible}),"handled"});return new Map([[YG0,A],[ar,$],[Kx,J],[ZG0,Y],[p9,Z],[sr,B],[FG0,Q],[DG0,D],...this.threadListSidebar.actionEntries(),[UG0,X],...G,[WI,F],[zG0,V]])}startNewDraftThread(A={}){let Q=this.activeThreadContext?.client.getThreadId();if(this.commandPalette.disable(),this.threadNavigationHistory.recordNavigation(Q),this.setState(()=>{if(this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.activeThreadContext=null,this.connectingToThreadID=null,A.hideDebugOverlay)this.debugOverlayVisible=!1}),this.widget.onActiveThreadChange?.(null),A.prompt!==void 0)this.editorController.text=A.prompt}closeCommandPaletteOnFocusLoss=(A)=>{if(A||!this.commandPalette.isEnabled())return;this.commandPalette.disable()};ensureDraftThreadSettingsInitialized(){if(this.hasDraftThreadSettingsSeed)return Promise.resolve();if(!this.draftThreadSettingsInitPromise)this.draftThreadSettingsInitPromise=this.initDraftThreadSettings();return this.draftThreadSettingsInitPromise}async initDraftThreadSettings(){try{let A=this.applySessionDefaultsToThreadSettings(await Rf(this.widget.configService));this.applyDraftThreadSettingsSeed(A)}catch(A){j.warn("Failed to initialize Neo draft thread settings",{error:A instanceof Error?A.message:String(A)})}}applySessionDefaultsToThreadSettings(A){let Q=this.widget.neoContext.sessionAgentMode,B=A,$=A$(Q),J=_X0(this.widget.neoContext,Q);if($!==void 0&&J!==void 0)B={...B,[$]:J};return PX0(B,{agentMode:Q,explicitEffort:this.widget.neoContext.explicitReasoningEffort,sessionState:this.widget.neoContext})}applyDraftThreadSettingsSeed(A){if(!this.mounted)return;if(!this.hasDraftThreadSettingsSeed){this.setState(()=>{this.hasDraftThreadSettingsSeed=!0,this.draftThreadSettings=Tr4(this.draftThreadSettings,{},A),this.draftThreadSettingsSeed={...A}});return}if(SZ(this.draftThreadSettingsSeed,A))return;this.setState(()=>{this.draftThreadSettings=Tr4(this.draftThreadSettings,this.draftThreadSettingsSeed,A),this.draftThreadSettingsSeed={...A}})}buildHints(){let A=new Set;if(this.connectingToThreadID)A.add(SI);if(this.exitHintTimer.isActive())A.add(Xx);return A}onExitPressed=()=>{if(this.exitHintTimer.isActive())this.exitHintTimer.clear(),H4.instance.stop();else this.exitHintTimer.activate()};dismissNeoWelcome=()=>{if(!this.neoWelcomeVisible)return;this.setState(()=>{this.neoWelcomeVisible=!1}),this.widget.onNeoWelcomeDismissed?.()};showNeoWelcome=()=>{if(this.neoWelcomeVisible)return;this.setState(()=>{this.neoWelcomeVisible=!0})};promptExecutorAlreadyConnected(A){return new Promise((Q)=>{this.setState(()=>{this.executorAlreadyConnectedDialog={existingExecutorPid:A.existingExecutorPid,resolve:(B)=>{Q(B==="watch"?"observe":"disconnect")}}})})}handleExecutorAlreadyConnectedChoice=(A)=>{if(this.resolveExecutorAlreadyConnectedDialog(A),A==="exit")H4.instance.stop()};resolveExecutorAlreadyConnectedDialog(A){let Q=this.executorAlreadyConnectedDialog;if(!Q)return;this.setState(()=>{this.executorAlreadyConnectedDialog=null}),Q.resolve(A)}closeSwitchThreadPicker=()=>{if(!this.switchThreadPickerVisible)return;this.setState(()=>{this.switchThreadPickerVisible=!1})};updateDraftThreadSettings=(A)=>{this.setState(()=>{this.draftThreadSettings=A(this.draftThreadSettings)})};onNewThread=async(A,Q,B=null,$)=>{await this.ensureDraftThreadSettingsInitialized();let J=this.activeThreadContext?.client.getThreadId(),Y=A.find(E30);if(Y)this.widget.history.add(Y.text,$V0.cwd()),this.widget.history.reset();let Z=B?void 0:await this.widget.getDefaultNewThreadVisibility?.(),F=B??Z??null,X=this.widget.clientPool.createNewThread(Q,this.draftThreadSettings,F??void 0);this.sendUserMessage(X,A,Q,$),this.rememberSessionDefaultsForNewMessage(Q,this.draftThreadSettings),this.threadNavigationHistory.recordNavigation(J),this.setActiveClient(X)};rememberSessionDefaultsForNewMessage(A,Q){this.widget.neoContext.sessionAgentMode=A;let B=Q["reasoning.effort"];if(B!==void 0)this.widget.neoContext.lastReasoningEffortByMode={...this.widget.neoContext.lastReasoningEffortByMode??{},[A]:B};let $=A$(A),J=$?Q[$]:void 0;if(J!==void 0)this.widget.neoContext.lastSpeedByMode={...this.widget.neoContext.lastSpeedByMode??{},[A]:J};rQ((Y)=>{let Z={...Y,agentMode:A};if(B!==void 0)Z={...Z,lastReasoningEffortByMode:{...Z.lastReasoningEffortByMode??{},[A]:B}};if(J!==void 0)Z={...Z,lastSpeedByMode:{...Z.lastSpeedByMode??{},[A]:J}};return Z}).catch((Y)=>{j.warn("Failed to persist Neo session defaults for new message",{error:Y instanceof Error?Y.message:String(Y)})})}sendUserMessage(A,Q,B,$){let J=NY0(this.ideStatus.getValue());if($===void 0){A.client.sendUserMessage(Q,B,{userState:J});return}A.client.sendUserMessage(Q,B,{reasoningEffort:$,userState:J})}getActiveThreadID=()=>{return this.activeThreadContext?.client.getThreadId()??void 0};getRelaunchThreadIDs=()=>{let A=new Set,Q=this.getActiveThreadID();if(Q)A.add(Q);for(let B of this.widget.clientPool.activeThreadIDs)A.add(B);return[...A]};appendPluginMessagesToThread=async(A,Q)=>{let B=this.activeThreadContext;if(!B)throw Error("appendToThread is not available - no active thread");let $=B.client.getThreadId();if(Q&&$!==Q)throw Error("thread.append is only available for the active executor thread");for(let J of A)this.sendUserMessage(B,[{type:"text",text:J.content}])};async connectToExistingThread(A,Q={}){let B=this.activeThreadContext?.client.getThreadId();this.setState(()=>{this.connectingToThreadID=A});try{let $=await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.neoContext.observerOnly,onExecutorAlreadyConnected:(J)=>this.promptExecutorAlreadyConnected(J)});if(this.setActiveClient($),Q.recordNavigation&&B!==A)this.threadNavigationHistory.recordNavigation(B);if(Q.initialUserInput)this.sendUserMessage($,[{type:"text",text:Q.initialUserInput}])}catch($){if(j.error("Failed to load thread",{error:$,threadID:A}),this.toastController.show(`Failed to load ${A}: ${$ instanceof Error?$.message:String($)}`,"error",4000),Q.rethrowError)throw $}finally{this.setState(()=>{this.connectingToThreadID=null})}}async connectToInitialThreads(A,Q={}){await this.connectToExistingThread(A,Q);let B=this.widget.initialThreadIDs.filter(($)=>$!==A);await Promise.all(B.map(($)=>this.resumeBackgroundThread($)))}async resumeBackgroundThread(A){try{await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.neoContext.observerOnly,onExecutorAlreadyConnected:async()=>"observe"})}catch(Q){j.error("Failed to resume background thread",{error:Q,threadID:A}),this.toastController.show(`Failed to resume ${A}: ${Q instanceof Error?Q.message:String(Q)}`,"error",4000)}}async navigateBack(){let A=this.threadNavigationHistory.startBackNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateForward(){let A=this.threadNavigationHistory.startForwardNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateToThread(A){try{await this.connectToExistingThread(A.targetThreadID,{rethrowError:!0})}catch{A.rollback()}}setActiveClient({client:A,observer:Q}){this.setState(()=>{this.activeThreadContext={client:A,observer:Q}}),this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=Q.threadID().subscribe((B)=>{this.widget.onActiveThreadChange?.(B)})}handleIdeSelection=async(A)=>{try{await this.widget.ideManager.connect(A)}catch(Q){j.error("Failed to connect to IDE",{error:Q});let B=Q instanceof Error?Q.message:String(Q);this.toastController.show(`IDE connection failed: ${B}`,"error",4000)}};dispose(){if(this.unregisterCommands?.(),this.unregisterCommands=null,this.pluginIntegration?.dispose(),this.pluginIntegration=null,this.mcpTrustIntegration?.dispose(),this.mcpTrustIntegration=null,this.updateRelaunchIntegration?.dispose(),this.updateRelaunchIntegration=null,this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.noticesPollingTimeout)clearTimeout(this.noticesPollingTimeout),this.noticesPollingTimeout=null;this.connectionErrorsSubscription?.unsubscribe(),this.configSubscription?.unsubscribe(),this.configSubscription=null,this.notices.dispose(),this.widget.notificationService.detach(),this.toastController.dispose(),super.dispose()}hasBlockingTopLevelModal(){return this.switchThreadPickerVisible||this.executorAlreadyConnectedDialog!==null||this.neoWelcomeVisible||(this.mcpTrustIntegration?.hasBlockingDialog()??!1)||(this.pluginIntegration?.hasBlockingDialog()??!1)}}function Tr4(A,Q,B){let $={...A};for(let J of wg5(Q,B)){if(!SZ(A[J],Q[J]))continue;let Y=B[J];if(Y===void 0)delete $[J];else $[J]=Y}return $}function wg5(...A){return Array.from(new Set(A.flatMap((Q)=>Object.keys(Q))))}n4();function Sr4(A,Q,B,$){let J=cT(A),Y="\x1B[0m",Z="\x1B[34m",F="\x1B[90m",X="\x1B[2m",D=[];if(A.archived)D.push("\x1B[90m\x1B[2mArchived\x1B[0m");D.push(`${J}`),D.push(`\x1B[34m${Q}\x1B[0m`),D.push(`\x1B[90mamp threads continue ${A.id}\x1B[0m`);let G=14,V=7,U=new gY(G,V),K=new u9(42),E=new VI(G,V,G,V,G,V,0,A.agentMode??"smart","intensity","classic","braille",void 0,void 0,E0.default(),K);E.layout(M1.tight(G,V)),E.paint(U,0,0);let z=U.getBuffer().getCells(),W=0;for(let R=0;R<V;R++)if(z[R].some((v)=>v.char!==" ")){W=R;break}let H=V-1;for(let R=V-1;R>=0;R--)if(z[R].some((v)=>v.char!==" ")){H=R;break}function q(R,v){if(!R)return"";if(R.type==="rgb"){let{r:T,g:f,b:g}=R.value;if(B.getColorDepth()>=24)return`\x1B[${v?38:48};2;${T};${f};${g}m`;let u=wj(T,f,g);return`\x1B[${v?38:48};5;${u}m`}return""}let N=[];if(H>=W)for(let R=W;R<=H;R++){let v="";for(let T=0;T<G;T++){let f=z[R][T],g=f.char,u=q(f.style.fg,!0);v+=u+g+"\x1B[0m"}N.push(v)}let I=N.length,w=Math.max(I,D.length),O=Math.floor((w-I)/2),L=Math.floor((w-D.length)/2);for(let R=0;R<w;R++){let v=" ".repeat(G);if(R>=O&&R<O+I)v=N[R-O];let T=" ",f="";if(R>=L&&R<L+D.length)f=D[R-L];B.write(v+T+f+`
|
|
5878
|
+
`)),Y.push(new C("Details: ",new S({color:$.mutedForeground}))),Y.push(new C(A.costBreakdownURL,new S({color:B.app.link})));return new p({text:new C("",void 0,Y)})}function Hg5(A,Q,B){let $=Wg5(A,Q);if(!A.costBreakdownURL)return new wA({header:"Thread Cost",minWidth:80,maxWidth:100,onDismiss:B,child:$});let J=A.costBreakdownURL,Y=new b1(()=>{return m4.maybeInvoke(Q,new p9(J,"Cost breakdown URL copied to clipboard","Failed to copy cost breakdown URL")),"handled"}),Z=new b1(()=>{return iA(Q,J),"handled"});return new wA({header:"Thread Cost",minWidth:80,maxWidth:100,autofocus:!1,footer:[{keys:["Esc"],label:"close"},{keys:["o"],label:"open in browser"},{keys:["y"],label:"copy url"}],onDismiss:B,child:new m4({actions:new Map([[y61,Y],[f61,Z]]),child:new p6({debugLabel:"ThreadCostShortcuts",shortcuts:new Map([[N1.key("o"),new f61],[N1.key("y"),new y61]]),child:new p4({autofocus:!0,debugLabel:"ThreadCostBody",child:$})})})})}function Or4(A){return{noun:"thread",verb:"show cost",description:"Show usage cost for the active thread",keywords:["usage","credits","billing","spend"],get status(){return A.getActiveThreadID()?{type:"enabled"}:{type:"disabled",reason:"No active thread"}},run:async(Q,B,$)=>{let J=A.getActiveThreadID();if(!J)return;try{let Y=await r4.threadDisplayCostInfo({threadID:J},{config:A.configService});if(!Y.ok){A.toastController.show(zg5(J,Y.error),"error",5000),$();return}Q.push(Hg5(Y.result,B,$))}catch(Y){j.error("Failed to load Neo thread cost",{error:Y,threadID:J}),A.toastController.show(`Failed to show thread cost: ${Y instanceof Error?Y.message:String(Y)}`,"error",5000),$()}}}}d0();s1();var qg5=36,Ng5=24,Ig5=72;function jr4(A){return A.replace(/ ago$/,"")}function Rr4(A){return Math.max(Ng5,Math.min(A,Ig5))}class x61 extends I4{}class b61{options;visibility;width=qg5;constructor(A){this.options=A;this.visibility=new Qr(A.state)}isVisible(){return this.visibility.isEnabled()}buildBody(A){return new r0({crossAxisAlignment:"stretch",children:[this.buildSlot(),new P1({child:A})]})}buildSlot(){if(!this.options.isAvailable()||this.visibility.isDisabled())return new U0({width:0});return new U0({width:this.width,child:new u4({debugLabel:"ThreadListSidebar",child:new Pr4({activeThreadID:this.options.getActiveThreadID(),currentWorkspaceURI:r1(p0.file(this.options.getWorkspaceRoot())),width:this.width,loadThreads:this.options.loadThreads,onSelectThread:this.options.onSelectThread,onDismiss:this.close,onResizeWidth:this.resize})})})}commands(){if(!this.options.isAvailable())return[];return[{noun:"thread",verb:"toggle sidebar",description:"Show or hide the thread sidebar",keywords:["sidebar","recent","history","threads"],shortcut:N1.alt("s"),status:{type:"enabled"},run:(A,Q,B)=>{B(),this.toggle()}}]}shortcutEntries(){return this.options.isAvailable()?[[N1.alt("s"),new GG0]]:[]}actionEntries(){if(!this.options.isAvailable())return[];return[[GG0,new b1(()=>this.toggle())]]}toggle=()=>{if(!this.options.isAvailable())return"ignored";if(this.visibility.isDisabled()&&this.options.isBlocked())return"ignored";return this.visibility.toggle(),"handled"};close=()=>{this.visibility.disable()};resize=(A)=>{let Q=Rr4(A);if(Q===this.width)return;this.options.state.setState(()=>{this.width=Q})}}class Pr4 extends _0{props;constructor(A){super();this.props=A}createState(){return new _r4}}class _r4 extends P0{threads=[];isLoading=!0;isSwitchingThread=!1;hasError=!1;filterByWorkspace=!0;timeColWidth=0;resizeSession=null;isResizeHandleHovered=!1;shortcuts=new Map([[N1.alt("w"),new x61]]);actions=new Map([[x61,new b1(()=>{return this.setState(()=>{this.filterByWorkspace=!this.filterByWorkspace}),"handled"})]]);get isBusy(){return this.isLoading||this.isSwitchingThread}get isResizeActive(){return this.resizeSession!==null||this.isResizeHandleHovered}initState(){super.initState(),this.loadThreadSummaries()}async loadThreadSummaries(){try{let A=await this.widget.props.loadThreads(),Q=RA1(A);if(!this.mounted)return;this.setState(()=>{this.threads=Q,this.timeColWidth=Q.reduce((B,$)=>Math.max(B,j4(jr4($.description.timeAgo))),0),this.isLoading=!1,this.hasError=!1})}catch(A){if(j.error("Failed to load threads for Neo sidebar",{error:A}),!this.mounted)return;this.setState(()=>{this.isLoading=!1,this.hasError=!0})}}handleSelectThread=async(A)=>{if(this.isSwitchingThread)return;this.setState(()=>{this.isSwitchingThread=!0});try{await this.widget.props.onSelectThread(A),this.widget.props.onDismiss()}catch(Q){j.error("Failed to switch thread from Neo sidebar",{error:Q,threadID:A})}finally{if(this.mounted)this.setState(()=>{this.isSwitchingThread=!1})}};getThreadsForDisplay(){return this.filterByWorkspace?this.threads.filter((A)=>!A.workspaceURI||A.workspaceURI===this.widget.props.currentWorkspaceURI):this.threads}buildThreadItem(A,Q,B,$){let J=j0.of($),{app:Y,colors:Z}=J,F=!Q,X=Q?Y.selectionForeground:Z.foreground,D=Q?Y.selectionForeground:Z.mutedForeground,V=A.id===this.widget.props.activeThreadID?new p({text:new C("*",new S({color:Q?Y.selectionForeground:Z.success,dim:F}))}):void 0,U=jr4(A.description.timeAgo);return new b0({padding:K0.symmetric(1,0),child:new r0({children:[new U0({width:2,child:V}),new P1({child:new p({text:new C(A.title,new S({color:X,dim:F})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),new U0({width:B,child:r0.end([new p({text:new C(U,new S({color:D,dim:F}))})])})]})})}handleResizeHandlePress=(A)=>{if(A.button!=="left")return;this.setState(()=>{this.resizeSession={baseWidthColumns:this.widget.props.width,startColumn:Math.floor(A.position.x)}})};handleResizeHandleDrag=(A)=>{if(A.button!=="left"||this.resizeSession===null)return;let Q=Math.floor(A.position.x)-this.resizeSession.startColumn,B=Rr4(this.resizeSession.baseWidthColumns+Q);if(B!==this.widget.props.width)this.widget.props.onResizeWidth(B)};handleResizeHandleRelease=(A)=>{if(A.button!=="left"||this.resizeSession===null)return;this.setState(()=>{this.resizeSession=null})};handleResizeHandleEnter=()=>{if(this.isResizeHandleHovered)return;this.setState(()=>{this.isResizeHandleHovered=!0})};handleResizeHandleExit=()=>{if(!this.isResizeHandleHovered)return;this.setState(()=>{this.isResizeHandleHovered=!1})};buildResizeHandle(){return new GA({top:0,right:0,bottom:0,width:1,child:new T1({cursor:F6.EW_RESIZE,onClick:this.handleResizeHandlePress,onDrag:this.handleResizeHandleDrag,onRelease:this.handleResizeHandleRelease,onEnter:this.handleResizeHandleEnter,onExit:this.handleResizeHandleExit,child:new U0({width:1})})})}build(A){let Q=j0.of(A),B=this.getThreadsForDisplay(),$=this.hasError?[]:B,J=this.isSwitchingThread?"Switching thread...":"Loading threads...",Y=this.hasError?"Failed to load threads":"No threads match your filter",Z=this.isResizeActive?2:1,F=new p1(void 0,new d1(Q.colors.border,Z),void 0,void 0);return new b0({width:this.widget.props.width,child:new t4({fit:"expand",children:[new b0({decoration:new k4(Q.colors.background,F),child:new m4({actions:this.actions,child:new p6({shortcuts:this.shortcuts,debugLabel:"ThreadListSidebarFilter",child:new d6({items:$,getLabel:(X)=>`${X.title} ${X.id}`,onAccept:(X)=>void this.handleSelectThread(X.id),onDismiss:this.widget.props.onDismiss,renderItem:(X,D,G,V)=>this.buildThreadItem(X,D,this.timeColWidth,V),enabled:!this.isBusy,isLoading:this.isBusy,hidePromptWhenLoading:!0,loadingText:J,emptyStateText:Y,maxRenderItems:200,showBorder:!1})})})}),this.buildResizeHandle()]})})}}class u61 extends _0{listSkillsForThread;clientPool;completionBuilder;history;ideManager;configService;updateService;initialThreadIDs;showNeoWelcome;neoWelcomeVariant;onNeoWelcomeDismissed;notificationService;mcpTrustHandler;onThreadArchived;onActiveThreadChange;onRelaunchRequested;onFirstFrame;initialUserInput;getDefaultNewThreadVisibility;openThreadPickerOnStart;workspaceSettingsFilePath;neoContext;constructor(A){super();this.listSkillsForThread=A.listSkillsForThread,this.clientPool=A.clientPool,this.completionBuilder=A.completionBuilder,this.history=A.history,this.ideManager=A.ideManager,this.configService=A.configService,this.updateService=A.updateService,this.initialThreadIDs=A.initialThreadIDs??[],this.showNeoWelcome=A.showNeoWelcome??!1,this.neoWelcomeVariant=A.neoWelcomeVariant??"intro",this.onNeoWelcomeDismissed=A.onNeoWelcomeDismissed,this.notificationService=A.notificationService,this.mcpTrustHandler=A.mcpTrustHandler,this.onThreadArchived=A.onThreadArchived,this.onActiveThreadChange=A.onActiveThreadChange,this.onRelaunchRequested=A.onRelaunchRequested,this.onFirstFrame=A.onFirstFrame,this.initialUserInput=A.initialUserInput,this.getDefaultNewThreadVisibility=A.getDefaultNewThreadVisibility,this.openThreadPickerOnStart=A.openThreadPickerOnStart??!1,this.workspaceSettingsFilePath=A.workspaceSettingsFilePath,this.neoContext=A.neoContext}createState(){return new kr4}}class kr4 extends P0{editorController=new P8;commandPalette=new Qr(this);commandRegistry=new g41;toastController=new Q01;relaunchNotificationController=new k41;exitHintTimer=new Ar(this,1000);ideStatus=new D2(this,{});threadNavigationHistory=new f41;draftThreadSettings={};draftThreadSettingsSeed={};hasDraftThreadSettingsSeed=!1;draftThreadSettingsInitPromise=null;activeThreadContext=null;activeThreadIDSubscription=null;connectionErrorsSubscription=null;configSubscription=null;connectingToThreadID=null;executorAlreadyConnectedDialog=null;switchThreadPickerVisible=!1;neoWelcomeVisible=!1;debugOverlayVisible=!1;focusDebugVisible=!1;unregisterCommands=null;pluginIntegration=null;mcpTrustIntegration=null;updateRelaunchIntegration=null;noticesPollingTimeout=null;notices;loadThreads=async()=>{return this.widget.neoContext.listThreads()};analyzeContextForThread=async(A,Q)=>{return eh4({ampURL:this.widget.neoContext.ampURL,configService:this.widget.configService,threadID:A,signal:Q})};onSwitchThread=(A)=>{return this.connectToExistingThread(A,{recordNavigation:!0,rethrowError:!0})};threadListSidebar=new b61({state:this,isAvailable:()=>this.widget.neoContext.isInternalUser,isBlocked:()=>this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal(),getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,getWorkspaceRoot:()=>this.widget.neoContext.workspaceRoot,loadThreads:this.loadThreads,onSelectThread:this.onSwitchThread});sendFeedbackReport=async(A)=>CG0({configService:this.widget.configService,settingsFilePath:this.widget.neoContext.settingsFilePath},A);archiveThread=async(A)=>{let Q=await Zd4({configService:this.widget.configService},A);if(Q===null)this.widget.onThreadArchived?.(A);return Q};addThreadLabel=async(A,Q)=>{let B=await Fd4({configService:this.widget.configService},A,Q);if(B instanceof Error)return B;return this.toastController.show(B.message,B.type,2000),null};removeThreadLabel=async(A,Q)=>{let B=await Xd4({configService:this.widget.configService},A,Q);if(B instanceof Error)return B;return this.toastController.show(B.message,B.type,2000),null};initState(){if(eB.getInstance().interceptConsole(),this.notices=new H41(this.widget.configService,(B)=>this.setState(B)),lA.instance.addPostFrameCallback(()=>{setTimeout(()=>this.widget.onFirstFrame?.(),0),this.noticesPollingTimeout=setTimeout(()=>{this.noticesPollingTimeout=null,this.notices.startPolling()},500)},"Neo notices polling"),this.widget.showNeoWelcome)this.neoWelcomeVisible=!0;if(this.connectionErrorsSubscription=this.widget.clientPool.connectionErrors$.subscribe(({threadID:B,error:$})=>{if(j.error("Neo failed to connect to thread",{threadID:B,error:$}),!B)this.toastController.show(`Connection failed: ${$.message}`,"error",4000)}),this.configSubscription=this.widget.configService.config.subscribe((B)=>{this.applyDraftThreadSettingsSeed(this.applySessionDefaultsToThreadSettings(M30(B.settings)))}),this.updateRelaunchIntegration=new v41({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested,relaunchNotificationController:this.relaunchNotificationController,updateService:this.widget.updateService}),this.updateRelaunchIntegration.init(),this.ideStatus.subscribe(this.widget.ideManager.status),this.widget.openThreadPickerOnStart)this.switchThreadPickerVisible=!0;this.ensureDraftThreadSettingsInitialized();let A=this.widget.initialUserInput,Q=this.widget.initialThreadIDs[0];if(Q){let B={};if(A)B.initialUserInput=A;this.connectToInitialThreads(Q,B)}else if(A)this.onNewThread([{type:"text",text:A}],this.widget.neoContext.sessionAgentMode);this.pluginIntegration=new T41({state:this,commandPalette:this.commandPalette,commandRegistry:this.commandRegistry,toastController:this.toastController,neoContext:this.widget.neoContext,getActiveThreadID:this.getActiveThreadID,appendToThread:this.appendPluginMessagesToThread}),this.pluginIntegration.init(),this.mcpTrustIntegration=new W41({state:this,mcpTrustHandler:this.widget.mcpTrustHandler,toastController:this.toastController,workspaceSettingsFilePath:this.widget.workspaceSettingsFilePath}),this.mcpTrustIntegration.init(),this.unregisterCommands=this.registerAppCommands(),queueMicrotask(()=>{if(!this.mounted)return;this.replayEarlyInputToEditor()})}replayEarlyInputToEditor(){let A=H4.instance.tuiInstance.getEarlyInputText();if(!A)return;this.editorController.insertText(A)}registerAppCommands(){let A=this,Q=this.widget.neoContext.pluginService?Ei4({pluginService:this.widget.neoContext.pluginService,workspaceRoot:this.widget.neoContext.workspaceRoot,logFilePath:this.widget.neoContext.logFilePath,toastController:this.toastController}):[],$=[wi4({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),{noun:"thread",verb:"switch",description:"Switch to existing thread",keywords:["recent","history","open","resume","change"],status:{type:"enabled"},sortBoost:100,run:(J,Y,Z)=>{J.pushWithDismiss((F)=>PA1({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,onSelectThread:this.onSwitchThread,onDismiss:F,onThreadSelected:Z}))}},...this.threadListSidebar.commands(),{noun:"thread",verb:"switch to previous",description:"Switch to previous thread",keywords:["back"],get status(){return A.threadNavigationHistory.canNavigateBack()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to previous with no previous thread"}},run:(J,Y,Z)=>{A.navigateBack(),Z()}},Or4({configService:this.widget.configService,getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??void 0,toastController:this.toastController}),{noun:"thread",verb:"switch to next",description:"Switch to next thread",keywords:["forward"],get status(){return A.threadNavigationHistory.canNavigateForward()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to next with no next thread"}},run:(J,Y,Z)=>{A.navigateForward(),Z()}},{noun:"mcp",verb:"info",description:"Show MCP servers and tools",keywords:["servers","tools","plugins","integrations"],status:{type:"enabled"},run:(J,Y,Z)=>{J.push(new t41({mcpServers:this.widget.neoContext.mcpServers,onDismiss:Z}))}},{noun:"toolbox",verb:"list",description:"List all toolboxes and their tools",keywords:["tools","toolbox"],status:{type:"enabled"},run:(J)=>{J.pushWithDismiss((Y)=>new R61({toolboxes:this.widget.neoContext.toolboxes,onDismiss:Y}))}},{noun:"news",verb:"open",description:"Open Amp Chronicle in browser",keywords:["chronicle","updates","blog","announcements"],status:{type:"enabled"},run:async(J,Y,Z)=>{try{await iA(Y,"https://ampcode.com/chronicle")}finally{Z()}}},{noun:"settings",verb:"open in editor",description:"Open CLI settings in $EDITOR",keywords:["config","preferences","edit"],status:{type:"enabled"},run:()=>{sQ(this.widget.neoContext.settingsFilePath).catch((J)=>{j.error("Failed to open settings file in editor",{error:J})})}},{noun:"IDE",verb:"connect",description:"Connect to an IDE",keywords:["vscode","cursor","jetbrains","editor","attach"],status:{type:"enabled"},run:(J,Y,Z)=>{J.pushWithDismiss((F)=>new r41({onCancel:F,onSelect:(X)=>{this.handleIdeSelection(X),Z()}}))}},{noun:"amp",verb:"help",description:"Show help & keyboard shortcuts",keywords:["shortcuts","keybindings","docs","manual","?"],status:{type:"enabled"},run:(J,Y,Z)=>{J.push(new l41({commands:z9.of(Y).commands,onDismiss:Z}))}},{noun:"amp",verb:"show welcome",description:"Show the welcome message again",keywords:["intro","onboarding","getting started"],status:{type:"enabled"},run:(J,Y,Z)=>{Z(),A.showNeoWelcome()}},{noun:"amp",verb:"show version",description:"Show current Amp version",keywords:["about","release","build"],status:{type:"enabled"},run:(J,Y,Z)=>{J.push(new wA({header:"Amp Version",maxWidth:72,onDismiss:Z,child:new p({text:new C(pX0({version:"0.0.1779083535-g196e66",buildTimestamp:"2026-05-18T05:57:03.595Z",buildType:"release"}))})}))}},{noun:"amp",verb:"quit",description:"Exit application",keywords:["exit","close","leave","bye"],shortcut:N1.ctrl("c"),status:{type:"enabled"},run:(J,Y)=>{m4.maybeInvoke(Y,new Kx)}},...Q,...rl4(this.widget.neoContext.logFilePath)].map((J)=>this.commandRegistry.register(J));return()=>{for(let J of $)J()}}build(A){let Q=this.buildHints(),B=this.ideStatus.getValue(),$=this.notices.current,J=new j61({initialAgentMode:this.widget.neoContext.sessionAgentMode,analyzeContextForThread:this.analyzeContextForThread,listSkillsForThread:this.widget.listSkillsForThread,threadContext:this.activeThreadContext,draftThreadSettings:this.draftThreadSettings,editorController:this.editorController,history:this.widget.history,updateDraftThreadSettings:this.updateDraftThreadSettings,onNewThread:this.onNewThread,sendFeedbackReport:this.sendFeedbackReport,archiveThread:this.archiveThread,addThreadLabel:this.addThreadLabel,removeThreadLabel:this.removeThreadLabel,configService:this.widget.configService,hints:Q,ideStatus:B,statusItems:this.pluginIntegration?.getStatusItems()??[],notificationService:this.widget.notificationService,notice:this.activeThreadContext||this.neoWelcomeVisible?null:$,onDismissNotice:(G)=>this.notices.dismiss(G)}),Y=t1.of(A),Z=Y.capabilities.animationSupport!=="disabled",X=[new b0({constraints:M1.tight(Y.size.width,Y.size.height),child:this.threadListSidebar.buildBody(J)})];if(this.commandPalette.isEnabled())X.push(new u4({debugLabel:"CommandPaletteOverlay",onFocusChange:this.closeCommandPaletteOnFocusLoss,child:new m41({onDismiss:this.commandPalette.disable})}));if(this.switchThreadPickerVisible&&!this.neoWelcomeVisible)X.push(PA1({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,onSelectThread:this.onSwitchThread,onDismiss:this.closeSwitchThreadPicker,onThreadSelected:this.closeSwitchThreadPicker}));if(this.neoWelcomeVisible)X.push(new u4({debugLabel:"NeoWelcomeDialogOverlay",child:new v61({onDismiss:this.dismissNeoWelcome,onQuit:()=>H4.instance.stop(),animationsEnabled:Z,variant:this.widget.neoWelcomeVariant})}));let D=this.executorAlreadyConnectedDialog;if(D)X.push(new u4({debugLabel:"NeoExecutorAlreadyConnectedDialogOverlay",child:new a41({existingExecutorPid:D.existingExecutorPid,onChoice:this.handleExecutorAlreadyConnectedChoice})}));if(X.push(...this.mcpTrustIntegration?.buildDialogLayers()??[]),X.push(...this.pluginIntegration?.buildDialogLayers()??[]),this.widget.neoContext.isInternalUser)X.push(new n41({top:this.focusDebugVisible?33:1,visible:this.debugOverlayVisible,pid:$V0.pid,activeThreadID:this.activeThreadContext?.client.getThreadId()??null,connectionInfo$:this.activeThreadContext?.observer.connectionInfo()??null}));if(this.focusDebugVisible)X.push(new o41);return new A8({neoContext:this.widget.neoContext,child:new z9({commandRegistry:this.commandRegistry,child:new Wx({completionBuilder:this.widget.completionBuilder,child:new u5({controller:this.toastController,child:new m4({actions:this.buildActions(),child:new p6({debugLabel:"NeoAppShortcuts",shortcuts:this.buildShortcuts(),child:new p4({debugLabel:"AppShellFocus",child:new B01({controller:this.toastController,complexToastControllers:[this.relaunchNotificationController,...$&&this.activeThreadContext&&!this.neoWelcomeVisible?[this.notices]:[]],child:new i41({configReloadEvents:this.widget.configService.configReloadEvents,toastController:this.toastController,child:new t4({children:X})})})})})})})})})})}buildShortcuts(){let A=new Map([[N1.ctrl("c"),new YG0],[N1.ctrl("o"),new FG0],[N1.alt("i"),new DG0],[N1.alt("p"),new WI],[N1.ctrl("."),new UG0],[N1.ctrl("t"),new zG0],...this.threadListSidebar.shortcutEntries()]);if($V0.env.NODE_ENV==="development"&&$V0.platform==="darwin")A.set(N1.meta("r"),new ZG0);return A}buildActions(){let A=new b1(()=>{if(HJ.hasAnyCopyableSelection())return HJ.tryCopyAnyActiveSelection(),"handled";return this.onExitPressed(),"handled"}),Q=new b1(()=>{if(!this.commandPalette.isEnabled()&&this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.toggle(),"handled"}),B=new b1(()=>{if(this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.enable(),"handled"}),$=new b1(()=>{return this.startNewDraftThread(),"handled"}),J=new b1(()=>{return H4.instance.stop(),"handled"}),Y=new b1(()=>{return $s({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),"handled"}),Z=new b1((U)=>{if(!U.text)return"ignored";return H4.instance.tuiInstance.clipboard.writeText(U.text).then((K)=>{if(K.ok)this.toastController.show(U.successMessage,"success",2000);else this.toastController.show(`${U.failureMessage}: ${K.userFacingErrorMessage}`,"error",4000)}).catch((K)=>{j.error("Failed to copy Neo text to clipboard",{error:K}),this.toastController.show(U.failureMessage,"error",2000)}),"handled"}),F=new b1(()=>{return H4.instance.toggleFrameStatsOverlay(),"handled"}),X=new b1(()=>this.notices.dismissCurrent()?"handled":"ignored"),D=new b1(()=>{if(!this.widget.neoContext.isInternalUser)return"ignored";return this.setState(()=>{this.debugOverlayVisible=!this.debugOverlayVisible}),"handled"}),G=Si4({getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,neoContext:this.widget.neoContext,toastController:this.toastController,startNewDraftThread:this.startNewDraftThread,sendFeedbackReport:this.sendFeedbackReport}),V=new b1(()=>{return this.setState(()=>{this.focusDebugVisible=!this.focusDebugVisible}),"handled"});return new Map([[YG0,A],[ar,$],[Kx,J],[ZG0,Y],[p9,Z],[sr,B],[FG0,Q],[DG0,D],...this.threadListSidebar.actionEntries(),[UG0,X],...G,[WI,F],[zG0,V]])}startNewDraftThread(A={}){let Q=this.activeThreadContext?.client.getThreadId();if(this.commandPalette.disable(),this.threadNavigationHistory.recordNavigation(Q),this.setState(()=>{if(this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.activeThreadContext=null,this.connectingToThreadID=null,A.hideDebugOverlay)this.debugOverlayVisible=!1}),this.widget.onActiveThreadChange?.(null),A.prompt!==void 0)this.editorController.text=A.prompt}closeCommandPaletteOnFocusLoss=(A)=>{if(A||!this.commandPalette.isEnabled())return;this.commandPalette.disable()};ensureDraftThreadSettingsInitialized(){if(this.hasDraftThreadSettingsSeed)return Promise.resolve();if(!this.draftThreadSettingsInitPromise)this.draftThreadSettingsInitPromise=this.initDraftThreadSettings();return this.draftThreadSettingsInitPromise}async initDraftThreadSettings(){try{let A=this.applySessionDefaultsToThreadSettings(await Rf(this.widget.configService));this.applyDraftThreadSettingsSeed(A)}catch(A){j.warn("Failed to initialize Neo draft thread settings",{error:A instanceof Error?A.message:String(A)})}}applySessionDefaultsToThreadSettings(A){let Q=this.widget.neoContext.sessionAgentMode,B=A,$=A$(Q),J=_X0(this.widget.neoContext,Q);if($!==void 0&&J!==void 0)B={...B,[$]:J};return PX0(B,{agentMode:Q,explicitEffort:this.widget.neoContext.explicitReasoningEffort,sessionState:this.widget.neoContext})}applyDraftThreadSettingsSeed(A){if(!this.mounted)return;if(!this.hasDraftThreadSettingsSeed){this.setState(()=>{this.hasDraftThreadSettingsSeed=!0,this.draftThreadSettings=Tr4(this.draftThreadSettings,{},A),this.draftThreadSettingsSeed={...A}});return}if(SZ(this.draftThreadSettingsSeed,A))return;this.setState(()=>{this.draftThreadSettings=Tr4(this.draftThreadSettings,this.draftThreadSettingsSeed,A),this.draftThreadSettingsSeed={...A}})}buildHints(){let A=new Set;if(this.connectingToThreadID)A.add(SI);if(this.exitHintTimer.isActive())A.add(Xx);return A}onExitPressed=()=>{if(this.exitHintTimer.isActive())this.exitHintTimer.clear(),H4.instance.stop();else this.exitHintTimer.activate()};dismissNeoWelcome=()=>{if(!this.neoWelcomeVisible)return;this.setState(()=>{this.neoWelcomeVisible=!1}),this.widget.onNeoWelcomeDismissed?.()};showNeoWelcome=()=>{if(this.neoWelcomeVisible)return;this.setState(()=>{this.neoWelcomeVisible=!0})};promptExecutorAlreadyConnected(A){return new Promise((Q)=>{this.setState(()=>{this.executorAlreadyConnectedDialog={existingExecutorPid:A.existingExecutorPid,resolve:(B)=>{Q(B==="watch"?"observe":"disconnect")}}})})}handleExecutorAlreadyConnectedChoice=(A)=>{if(this.resolveExecutorAlreadyConnectedDialog(A),A==="exit")H4.instance.stop()};resolveExecutorAlreadyConnectedDialog(A){let Q=this.executorAlreadyConnectedDialog;if(!Q)return;this.setState(()=>{this.executorAlreadyConnectedDialog=null}),Q.resolve(A)}closeSwitchThreadPicker=()=>{if(!this.switchThreadPickerVisible)return;this.setState(()=>{this.switchThreadPickerVisible=!1})};updateDraftThreadSettings=(A)=>{this.setState(()=>{this.draftThreadSettings=A(this.draftThreadSettings)})};onNewThread=async(A,Q,B=null,$)=>{await this.ensureDraftThreadSettingsInitialized();let J=this.activeThreadContext?.client.getThreadId(),Y=A.find(E30);if(Y)this.widget.history.add(Y.text,$V0.cwd()),this.widget.history.reset();let Z=B?void 0:await this.widget.getDefaultNewThreadVisibility?.(),F=B??Z??null,X=this.widget.clientPool.createNewThread(Q,this.draftThreadSettings,F??void 0);this.sendUserMessage(X,A,Q,$),this.rememberSessionDefaultsForNewMessage(Q,this.draftThreadSettings),this.threadNavigationHistory.recordNavigation(J),this.setActiveClient(X)};rememberSessionDefaultsForNewMessage(A,Q){this.widget.neoContext.sessionAgentMode=A;let B=Q["reasoning.effort"];if(B!==void 0)this.widget.neoContext.lastReasoningEffortByMode={...this.widget.neoContext.lastReasoningEffortByMode??{},[A]:B};let $=A$(A),J=$?Q[$]:void 0;if(J!==void 0)this.widget.neoContext.lastSpeedByMode={...this.widget.neoContext.lastSpeedByMode??{},[A]:J};rQ((Y)=>{let Z={...Y,agentMode:A};if(B!==void 0)Z={...Z,lastReasoningEffortByMode:{...Z.lastReasoningEffortByMode??{},[A]:B}};if(J!==void 0)Z={...Z,lastSpeedByMode:{...Z.lastSpeedByMode??{},[A]:J}};return Z}).catch((Y)=>{j.warn("Failed to persist Neo session defaults for new message",{error:Y instanceof Error?Y.message:String(Y)})})}sendUserMessage(A,Q,B,$){let J=NY0(this.ideStatus.getValue());if($===void 0){A.client.sendUserMessage(Q,B,{userState:J});return}A.client.sendUserMessage(Q,B,{reasoningEffort:$,userState:J})}getActiveThreadID=()=>{return this.activeThreadContext?.client.getThreadId()??void 0};getRelaunchThreadIDs=()=>{let A=new Set,Q=this.getActiveThreadID();if(Q)A.add(Q);for(let B of this.widget.clientPool.activeThreadIDs)A.add(B);return[...A]};appendPluginMessagesToThread=async(A,Q)=>{let B=this.activeThreadContext;if(!B)throw Error("appendToThread is not available - no active thread");let $=B.client.getThreadId();if(Q&&$!==Q)throw Error("thread.append is only available for the active executor thread");for(let J of A)this.sendUserMessage(B,[{type:"text",text:J.content}])};async connectToExistingThread(A,Q={}){let B=this.activeThreadContext?.client.getThreadId();this.setState(()=>{this.connectingToThreadID=A});try{let $=await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.neoContext.observerOnly,onExecutorAlreadyConnected:(J)=>this.promptExecutorAlreadyConnected(J)});if(this.setActiveClient($),Q.recordNavigation&&B!==A)this.threadNavigationHistory.recordNavigation(B);if(Q.initialUserInput)this.sendUserMessage($,[{type:"text",text:Q.initialUserInput}])}catch($){if(j.error("Failed to load thread",{error:$,threadID:A}),this.toastController.show(`Failed to load ${A}: ${$ instanceof Error?$.message:String($)}`,"error",4000),Q.rethrowError)throw $}finally{this.setState(()=>{this.connectingToThreadID=null})}}async connectToInitialThreads(A,Q={}){await this.connectToExistingThread(A,Q);let B=this.widget.initialThreadIDs.filter(($)=>$!==A);await Promise.all(B.map(($)=>this.resumeBackgroundThread($)))}async resumeBackgroundThread(A){try{await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.neoContext.observerOnly,onExecutorAlreadyConnected:async()=>"observe"})}catch(Q){j.error("Failed to resume background thread",{error:Q,threadID:A}),this.toastController.show(`Failed to resume ${A}: ${Q instanceof Error?Q.message:String(Q)}`,"error",4000)}}async navigateBack(){let A=this.threadNavigationHistory.startBackNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateForward(){let A=this.threadNavigationHistory.startForwardNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateToThread(A){try{await this.connectToExistingThread(A.targetThreadID,{rethrowError:!0})}catch{A.rollback()}}setActiveClient({client:A,observer:Q}){this.setState(()=>{this.activeThreadContext={client:A,observer:Q}}),this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=Q.threadID().subscribe((B)=>{this.widget.onActiveThreadChange?.(B)})}handleIdeSelection=async(A)=>{try{await this.widget.ideManager.connect(A)}catch(Q){j.error("Failed to connect to IDE",{error:Q});let B=Q instanceof Error?Q.message:String(Q);this.toastController.show(`IDE connection failed: ${B}`,"error",4000)}};dispose(){if(this.unregisterCommands?.(),this.unregisterCommands=null,this.pluginIntegration?.dispose(),this.pluginIntegration=null,this.mcpTrustIntegration?.dispose(),this.mcpTrustIntegration=null,this.updateRelaunchIntegration?.dispose(),this.updateRelaunchIntegration=null,this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.noticesPollingTimeout)clearTimeout(this.noticesPollingTimeout),this.noticesPollingTimeout=null;this.connectionErrorsSubscription?.unsubscribe(),this.configSubscription?.unsubscribe(),this.configSubscription=null,this.notices.dispose(),this.widget.notificationService.detach(),this.toastController.dispose(),super.dispose()}hasBlockingTopLevelModal(){return this.switchThreadPickerVisible||this.executorAlreadyConnectedDialog!==null||this.neoWelcomeVisible||(this.mcpTrustIntegration?.hasBlockingDialog()??!1)||(this.pluginIntegration?.hasBlockingDialog()??!1)}}function Tr4(A,Q,B){let $={...A};for(let J of wg5(Q,B)){if(!SZ(A[J],Q[J]))continue;let Y=B[J];if(Y===void 0)delete $[J];else $[J]=Y}return $}function wg5(...A){return Array.from(new Set(A.flatMap((Q)=>Object.keys(Q))))}n4();function Sr4(A,Q,B,$){let J=cT(A),Y="\x1B[0m",Z="\x1B[34m",F="\x1B[90m",X="\x1B[2m",D=[];if(A.archived)D.push("\x1B[90m\x1B[2mArchived\x1B[0m");D.push(`${J}`),D.push(`\x1B[34m${Q}\x1B[0m`),D.push(`\x1B[90mamp threads continue ${A.id}\x1B[0m`);let G=14,V=7,U=new gY(G,V),K=new u9(42),E=new VI(G,V,G,V,G,V,0,A.agentMode??"smart","intensity","classic","braille",void 0,void 0,E0.default(),K);E.layout(M1.tight(G,V)),E.paint(U,0,0);let z=U.getBuffer().getCells(),W=0;for(let R=0;R<V;R++)if(z[R].some((v)=>v.char!==" ")){W=R;break}let H=V-1;for(let R=V-1;R>=0;R--)if(z[R].some((v)=>v.char!==" ")){H=R;break}function q(R,v){if(!R)return"";if(R.type==="rgb"){let{r:T,g:f,b:g}=R.value;if(B.getColorDepth()>=24)return`\x1B[${v?38:48};2;${T};${f};${g}m`;let u=wj(T,f,g);return`\x1B[${v?38:48};5;${u}m`}return""}let N=[];if(H>=W)for(let R=W;R<=H;R++){let v="";for(let T=0;T<G;T++){let f=z[R][T],g=f.char,u=q(f.style.fg,!0);v+=u+g+"\x1B[0m"}N.push(v)}let I=N.length,w=Math.max(I,D.length),O=Math.floor((w-I)/2),L=Math.floor((w-D.length)/2);for(let R=0;R<w;R++){let v=" ".repeat(G);if(R>=O&&R<O+I)v=N[R-O];let T=" ",f="";if(R>=L&&R<L+D.length)f=D[R-L];B.write(v+T+f+`
|
|
5879
5879
|
`)}if($)B.write(`
|
|
5880
5880
|
\x1B[90m${$}\x1B[0m
|
|
5881
5881
|
`)}d0();hX0();var Cg5=2000,Mg5="Agent is ready",Lg5="Waiting for approval";function vr4(A){let Q=!0,B=!0,$=A.configService.config.subscribe((z)=>{Q=z.settings["notifications.enabled"]??!0,B=z.settings["notifications.system.enabled"]!==!1}),J=0,Y=(z)=>{if(!Q)return;let W=Date.now();if(W-J<Cg5)return;if(J=W,_j())return;if(uF0())hF0();else tY0(z)},Z=(z)=>{if(!Q||!B)return;if(_j()&&!io()&&!Hf())return;process.stdout.write(_D(`\x1B]777;notify;Amp;${z}\x1B\\`))},F=()=>{Y("idle"),Z(Mg5)},X=()=>{Y("requires-user-input"),Z(Lg5)},D=(z)=>z?.attempt===void 0||z.attempt===0,G=null,V=null,U=null,K=()=>{G?.unsubscribe(),V?.unsubscribe(),G=null,V=null,U=null};return{attach:(z,W)=>{if(K(),W)V=W.subscribe({next:(H)=>{if(H===null)return;if(!D(H))return;F()},error:(H)=>{j.debug("Neo notification active error stream errored",{error:H})}});G=z.subscribe({next:(H)=>{try{let q=U!==null&&hQ(U),N=U==="awaiting_approval",I=q||N;if(H==="awaiting_approval"&&!N)X();else if(H==="idle"&&I)F()}catch(q){j.debug("Neo notification handling failed",{error:q})}finally{U=H}},error:(H)=>{j.debug("Neo notification agent state stream errored",{error:H})}})},detach:K,unsubscribe(){K(),$.unsubscribe()}}}function Og5({initialUserInput:A,showNeoWelcome:Q,hideNeoWelcome:B,neoWelcomeVariant:$,neoWelcomeDismissed:J}){if(B)return{show:!1,markDismissedOnDismiss:!1};if($==="npm-migration")return{show:!0,markDismissedOnDismiss:!1};if(Q)return{show:!0,markDismissedOnDismiss:!0};let Y=!A&&!J;return{show:Y,markDismissedOnDismiss:Y}}async function jg5(A){await rQ((Q)=>_f(Q,A,"interactive"))}async function yr4(A,Q={}){let{initialThreadIDs:B=[],initialUserInput:$,getDefaultNewThreadVisibility:J,openThreadPickerOnStart:Y=!1,observerOnly:Z=!1,initialAgentMode:F,initialReasoningEffort:X,onFirstFrame:D,showNeoWelcome:G=!1,hideNeoWelcome:V=!1,neoWelcomeVariant:U="intro"}=Q,K=U==="npm-migration";if(B.length>1)j.info("Resuming multiple initial threads",{threadIDs:B});let E=async(T)=>{let f=await A.getThreadFromServer(T);if(!f)return null;return MF0(f)},z=async(T)=>{let f=await A.getThreadFromServer(T);if(!f)throw Error(`Thread ${T} not found`);let g=await f9(T,A.configService,A.apiKey,{usesThreadActors:!0}),b=await qU({endpoint:A.rivetEndpoint,poolName:g.poolName}).threadActor.getOrCreate([T],{params:{wsToken:g.wsToken},createWithInput:{threadId:g.threadId,threadVersion:g.threadVersion,ownerUserId:g.ownerUserId,...g.agentMode?{agentMode:g.agentMode}:{}}}).fetch("/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({thread:zy4(f)}),skipReadyWait:!0});if(!b.ok&&b.status!==409)throw Error(`Thread import failed (${b.status}): ${await b.text()}`);try{await dy4(T,A.configService,A.apiKey,{executorType:"local-client"})}catch(d){j.warn("failed to mark thread as imported on server",{threadID:T,error:d instanceof Error?d.message:String(d)})}},W=new Pe0(A.rivetEndpoint,A.apiKey,A.configService,{clientID:pN.parse(`neo-${crypto.randomUUID()}`),toolService:A.toolService,skillService:A.skillService,requestPluginToolCall:(T)=>A.pluginService.event.toolCall(T),requestPluginToolResult:(T)=>A.pluginService.event.toolResult(T),pluginService:A.pluginService,invokeTool:async(T,f)=>{let g=typeof f.args==="object"&&f.args!==null?f.args:{},u=await AI({toolName:f.toolName,configService:A.configService,toolService:A.toolService,mcpService:A.mcpService,skillService:A.skillService,toolUseID:f.toolCallId,threadId:T});return A.toolService.invokeTool(f.toolName,{args:g},u)},persistLastThreadID:jg5,readFileSystemDirectory:A.readFileSystemDirectory},E,z),H=await vz(),q=Og5({initialUserInput:$,showNeoWelcome:G,hideNeoWelcome:V,neoWelcomeVariant:U,neoWelcomeDismissed:H.neoWelcomeDismissed}),N={ampURL:A.ampURL,configService:A.configService,getThreadMarkdown:async(T)=>{let f=await A.getThreadFromServer(T);return f?PV(f):null},isInternalUser:A.isInternalUser,listThreads:A.listThreads,logFilePath:Ha,mcpServers:A.mcpService.servers,pluginPlatform:A.pluginPlatform,pluginService:A.pluginService,toolboxes:A.toolboxes,observerOnly:K?!1:Z,sessionAgentMode:F??H.agentMode,explicitReasoningEffort:X,lastReasoningEffortByMode:H.lastReasoningEffortByMode,lastSpeedByMode:H.lastSpeedByMode,settingsFilePath:A.settingsFilePath,splashOrbVisualStyle:Q.splashOrbVisualStyle??"neo",workspaceRoot:A.workspaceRoot},I=(T,f)=>{return Yh4({ampURL:A.ampURL,configService:A.configService,threadID:T,signal:f})},w=new ae0,O=vr4({configService:A.configService}),L=await A.configService.getLatest();H4.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:L.settings["terminal.animation"]===!1}});let R=new Set,v=new S41;try{await no(new u61({clientPool:W,listSkillsForThread:I,completionBuilder:A.completionBuilder,history:new Bo,ideManager:w,configService:A.configService,updateService:A.updateService,initialThreadIDs:K?[]:B,notificationService:O,mcpTrustHandler:A.mcpTrustHandler,initialUserInput:K?void 0:$,getDefaultNewThreadVisibility:J,openThreadPickerOnStart:K?!1:Y,workspaceSettingsFilePath:A.workspaceSettingsFilePath,neoContext:N,showNeoWelcome:q.show,neoWelcomeVariant:U,onActiveThreadChange:A.setActiveThreadID,onRelaunchRequested:v.request,onNeoWelcomeDismissed:q.markDismissedOnDismiss?()=>{rQ(Xh4).catch((f)=>{j.warn("Failed to mark Neo welcome as dismissed",{error:f})})}:void 0,onThreadArchived:(f)=>{R.add(f)},onFirstFrame:D}));let T=W.lastActiveObservingClient;if(T&&v.shouldShowExitSummary){let{client:f,observer:g}=T,u=f.getThreadId();if(u){let k={id:u,title:g.title().getValue(),agentMode:g.agentMode,archived:R.has(u)},b=`${A.ampURL.replace(/\/$/,"")}/threads/${u}`;Sr4(k,b,process.stdout)}}}finally{process.stdout.write(XI("")),O.unsubscribe(),W.dispose(),await A.dispose?.()}process.exit(v.relaunchIfRequested(A.workspaceRoot)??0)}Z3();function Sx(A){let Q=[],B={meta:{visibility:"private",sharedGroupIDs:[]}};if(A.workspace?.disablePrivateThreads)B.disabledReason="Disabled by workspace policy";if(Q.push(B),A.workspace?.groups&&A.workspace.groups.length>0){let Z={meta:{visibility:"private",shareWithAllCreatorGroups:!0}};if(A.creatorIsViewer===!1)Z.disabledReason="Can only be set by thread creator";Q.push(Z)}if(A.workspace)Q.push({meta:{visibility:"thread_workspace_shared"}});let $=A.workspace?.disablePublicSharing?"Disabled by workspace policy":void 0,J={meta:{visibility:"public_unlisted"}},Y={meta:{visibility:"public_discoverable"}};if($)J.disabledReason=$,Y.disabledReason=$;return Q.push(J,Y),Q}function fr4(A){if(A.visibility!=="private")return!0;if("shareWithAllCreatorGroups"in A&&A.shareWithAllCreatorGroups)return!0;return"sharedGroupIDs"in A&&A.sharedGroupIDs.length>0}function FR(A,Q={}){switch(A.visibility){case"thread_workspace_shared":return{text:"Workspace",description:"Visible to all members of the workspace"};case"public_discoverable":return{text:"Public",description:"Visible on public profile & publicly searchable"};case"public_unlisted":return{text:"Unlisted",description:"Visible to anyone on the Internet who has the link"};case"private":{let B="shareWithAllCreatorGroups"in A&&A.shareWithAllCreatorGroups,J=(B?Q.workspace?.groups.map((Y)=>Y.id)??[]:("sharedGroupIDs"in A)?A.sharedGroupIDs:[]).reduce((Y,Z)=>{let F=Q.workspace?.groups.find((X)=>X.id===Z)?.name;if(F)Y.push(`'${F}'`);return Y},[]);if(J.length>0)return{text:"Group",description:`Shared with ${D4(J.length,"group")} ${J.join(", ")} and workspace admins`};if(B)return{text:"Group",description:"Shared with creator groups and workspace admins"};return{text:"Private",description:Q.workspace?"Only visible to you and workspace admins":"Only you can see this thread"}}}}function JV0(A){if(A.visibility==="private")return"shareWithAllCreatorGroups"in A?"group":"private";if(A.visibility==="thread_workspace_shared")return"workspace";if(A.visibility==="public_unlisted")return"unlisted";return"public"}function vx(A,Q=null){let B=A!==null&&typeof A==="object"&&"visibility"in A?A.visibility:void 0;if(!B||typeof B!=="string")return;let J=Sx({workspace:Q?.team??void 0}).filter((Y)=>!Y.disabledReason).map((Y)=>JV0(Y.meta));if(J.includes(B))return Rg5(B);if(B==="group"&&!J.includes("group")){if(Q?.team?.groups!==void 0)return Error(`Group visibility is not available. You are not a member of any group in this workspace.
|
|
@@ -7637,7 +7637,7 @@ ${J}`,Q);this.line=B,this.column=$,this.codeblock=J}}/*!
|
|
|
7637
7637
|
`),Y=[];for(let Z=0;Z<J.length;Z++){let D=J[Z].replace(/\b(SELECT|FROM|WHERE|GROUP BY|ORDER BY|HAVING|LIMIT|JOIN|LEFT JOIN|RIGHT JOIN|INNER JOIN|ON|AND|OR|AS|IN|NOT|NULL|IS|BETWEEN|LIKE|EXISTS|UNION|DISTINCT|COUNT|SUM|AVG|MIN|MAX|DATE|TIMESTAMP_TRUNC|TIMESTAMP_SUB|CURRENT_TIMESTAMP|INTERVAL|CASE|WHEN|THEN|ELSE|END|WITH|INSERT|UPDATE|DELETE|SET|VALUES|INTO|CREATE|ALTER|DROP|TRUE|FALSE|ASC|DESC)\b/gi,"\x00$1\x01").split(/(\x00[^\x01]+\x01)/);for(let G of D)if(G.startsWith("\x00")&&G.endsWith("\x01"))Y.push(new C(G.slice(1,-1),new S({color:$.app.keybind,bold:!0})));else Y.push(new C(G,new S({color:B.colorScheme.foreground})));if(Z<J.length-1)Y.push(new C(`
|
|
7638
7638
|
`))}return new b0({decoration:{color:B.colorScheme.background,border:p1.all(new d1($.app.keybind,1,"rounded"))},child:new f0({padding:K0.symmetric(0,1),child:new p({text:new C(void 0,void 0,Y)})})})}}class a51 extends V8{chartData;highlightIndex;showAxes;colors;constructor({key:A,chartData:Q,highlightIndex:B=null,showAxes:$=!0,colors:J=IU0}){super(A?{key:A}:{});this.chartData=Q,this.highlightIndex=B,this.showAxes=$,this.colors=J}createRenderObject(){return new i51({chartData:this.chartData,highlightIndex:this.highlightIndex,showAxes:this.showAxes,colors:this.colors})}updateRenderObject(A){let Q=A;Q.chartData=this.chartData,Q.highlightIndex=this.highlightIndex,Q.showAxes=this.showAxes,Q.colors=this.colors,Q.markNeedsLayout()}}function K0A(A,Q,B,$,J,Y,Z){if(Y<=0)return null;switch(A){case"horizontal-bar":{let F=B;return F>=0&&F<Y?F:null}case"bar":case"stacked-bar":{let F=Z?c8:0,X=$-F;if(X<=0)return null;let D=Q-F;if(D<0||D>=X)return null;let G=Math.max(1,Math.floor(X/Y)),V=Math.floor(D/G);return V>=0&&V<Y?V:null}case"line":case"sparkline":case"stacked-area":{let F=Z?c8:0,X=$-F;if(X<=0)return null;let D=Math.max(0,Math.min(X-1,Q-F));if(Y===1)return 0;let G=X/(Y-1),V=Math.round(D/G);return Math.max(0,Math.min(Y-1,V))}default:return null}}function ni5(A,Q,B,$,J,Y,Z,F){if(J<=0||Q<0||Q>=J)return null;let X=2;switch(A){case"horizontal-bar":return{x:Math.floor(B/2),y:Q};case"bar":case"stacked-bar":{let D=Y?c8:0,G=B-D,V=$-(Y?X:0);if(G<=0||V<=0)return null;let U=Math.max(1,Math.floor(G/J)),K=D+Q*U+Math.floor(U/2),E=F>0?Z/F:0,z=Math.round((1-E)*(V-1));return{x:K,y:z}}case"line":case"sparkline":case"stacked-area":{let D=Y?c8:0,G=B-D,V=$-(Y?X:0);if(G<=0||V<=0)return null;let U=J>1?D+Math.round(Q/(J-1)*(G-1)):D+Math.floor(G/2),K=F>0?Z/F:0,E=Math.round((1-K)*(V-1));return{x:U,y:E}}default:return null}}function ai5(A){let Q=0;for(let B of A)for(let $ of B.points)if($.value>Q)Q=$.value;return Q||1}function oi5(A,Q,B,$,J){if(B.length<=1){let F=$(A.value),X=A.meta?` (${A.meta})`:"";return A.label.length+2+F.length+X.length}let Y=A.label.length,Z=0;for(let F of B){let X=F.points[Q];if(!X)continue;Z+=X.value;let D=2+F.name.length+2+$(X.value).length;Y=Math.max(Y,D)}if(J){let F=9+$(Z).length;Y=Math.max(Y,F)}return Y}function ri5(A,Q,B,$,J,Y,Z){let F;try{let E=L1.of(A),z=j0.of(A);F={foreground:E.colorScheme.foreground,background:E.colorScheme.background,border:z.app.keybind}}catch{F={foreground:{type:"index",value:15},background:{type:"index",value:0},border:{type:"index",value:7}}}let X=new S({color:F.foreground,bold:!0}),D=new S({color:F.foreground}),G=new S({color:F.foreground,dim:!0}),V=[],U=new S({color:F.foreground,underline:!0}),K=(E,z)=>new C(z,U,void 0,Pz(E),()=>{iA(A,E)});if($.length<=1){if(V.push(new C(`${Q.label}: `,X)),Q.link)V.push(K(Q.link,Y(Q.value)));else V.push(new C(Y(Q.value),D));if(Q.meta)V.push(new C(` (${Q.meta})`,G))}else{let E=Z==="stacked-bar"||Z==="stacked-area";V.push(new C(`${Q.label}
|
|
7639
7639
|
`,X));let z=0;for(let W=0;W<$.length;W++){let H=$[W],q=H.points[B];if(!q)continue;z+=q.value;let N=H.color??J[W%J.length]??F.foreground;if(V.push(new C("● ",new S({color:N}))),V.push(new C(`${H.name}: `,G)),q.link)V.push(K(q.link,Y(q.value)));else V.push(new C(Y(q.value),D));if(W<$.length-1||E)V.push(new C(`
|
|
7640
|
-
`))}if(E)V.push(new C(" ",G)),V.push(new C("Total: ",G)),V.push(new C(Y(z),D))}return new b0({decoration:{color:F.background,border:p1.all(new d1(F.border,1,"rounded"))},child:new p({text:new C(void 0,void 0,V)})})}d0();function E0A(A){return A.length===0?A:A[0].toLowerCase()+A.slice(1)}Z3();c3();k3();_B();Q7();s8();OQ();bq();n4();bS();GT();R1();d0();Q7();class o51{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(A,Q){this.enabled=A;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let A=Array.from(this.commandCounts.entries()).map(([Q,B])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1779081543-gea23bb"},parameters:{metadata:{count:B}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(A);await q30(Q,this.configService)}catch(Q){j.error("Failed to export command telemetry events",Q)}}async submit(A){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(A)||0;this.commandCounts.set(A,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class Bw extends _0{props;constructor(A){super();this.props=A}createState(){return new z0A}}class z0A extends P0{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(A){let Q=(B)=>{this.setState(()=>{this._state=B(this._state)})};return this.widget.props.builder(A,Q,this._state)}}class W0A extends P0{controller=new P8;focusNode=new Q6({debugLabel:"CommandArgumentPrompt",onKey:(A)=>{if(A.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(A){let Q=j0.of(A),{colors:B,app:$}=Q,J=this.widget.props.isRequiredArg??!0,Y=this.controller.text.trim().length>0,Z=!J||Y,F=p1.all(new d1(B.foreground,1,"solid")),X=new B$({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(K)=>{let E=K.trim();if(J&&E.length===0)return;this.widget.props.onSubmit(E)},autofocus:!0,style:{textColor:B.foreground,border:null},maxLines:1}),D=new r0({children:[new b0({decoration:{color:B.background},child:new p({text:new C(">",new S({color:B.foreground}))})}),new P1({child:X})]}),G=new b0({padding:K0.symmetric(1,0),child:new p({text:this.widget.props.title?new C(this.widget.props.title,new S({color:$.command,bold:!0})):new C("",void 0,[new C("Command: ",new S({color:B.foreground})),new C(this.widget.props.commandName,new S({color:$.command,bold:!0}))])})}),V=[];if(Z)V.push(new C("Enter",new S({color:$.keybind}))),V.push(new C(" to submit, ",new S({color:B.foreground,dim:!0})));V.push(new C("Esc",new S({color:$.keybind}))),V.push(new C(" to cancel",new S({color:B.foreground,dim:!0})));let U=new b0({padding:K0.symmetric(1,0),child:new p({text:new C("",void 0,V)})});return new b0({decoration:{border:F,color:B.background},padding:K0.all(1),child:new y0({children:[G,new U0({height:1}),D,new G5,U]})})}}class hs extends _0{props;constructor(A){super();this.props=A}createState(){return new W0A}}OQ();class H0A extends P0{controller=new P8;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new Q6({debugLabel:"CommandMultilinePrompt",onKey:(A)=>{if(A.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=async(A)=>{if(this.imageAttachments.length>=C9)return!1;let Q=await fU(A);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,A]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(A){let Q=j0.of(A),{colors:B,app:$}=Q,Y=t1.of(A).size.height,Z=Math.max(Math.floor(Y*0.5),10),F=new cz({controller:this.controller,triggers:[new lF],completionBuilder:this.widget.props.completionBuilder,onSubmitted:(K)=>{this.widget.props.onSubmit(K.trim(),this.imageAttachments)},theme:B,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:H4.instance.tuiInstance.clipboard,autoOverlayPosition:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),X=new p4({debugLabel:"CommandMultilinePrompt",focusNode:this.focusNode,child:F}),D=new b0({constraints:new M1({maxHeight:Z}),padding:K0.symmetric(1,0),child:X}),G=new b0({padding:K0.symmetric(1,0),child:new p({text:new C("",void 0,[new C("Command: ",new S({color:B.foreground})),new C(this.widget.props.commandName,new S({color:$.command,bold:!0}))])})}),V=new b0({padding:K0.symmetric(1,0),child:new p({text:this.isConfirmingClearInput?new C("",void 0,[new C("Esc",new S({color:$.keybind})),new C(" again to clear input",new S({color:B.foreground,dim:!0}))]):new C("",void 0,[new C("Press ",new S({color:B.foreground,dim:!0})),new C("Enter",new S({color:$.keybind})),new C(" to submit, ",new S({color:B.foreground,dim:!0})),new C("Esc",new S({color:$.keybind})),new C(" to clear",new S({color:B.foreground,dim:!0}))])})}),U=[G,new U0({height:1}),new P1({child:D}),new U0({height:1}),V];return new b0({decoration:{border:p1.all(new d1(B.foreground,1,"solid")),color:B.background},padding:K0.all(1),child:new y0({children:U})})}}class r51 extends _0{props;constructor(A){super();this.props=A}createState(){return new H0A}}function q0A(A){let B=new Date().getTime()-A.getTime(),$=Math.floor(B/60000),J=Math.floor(B/3600000),Y=Math.floor(B/86400000);if($<1)return"just now";if($<60)return`${$}m ago`;if(J<24)return`${J}h ago`;if(Y<7)return`${Y}d ago`;return A.toLocaleDateString()}class s51 extends q1{props;debugLabel="NewsFeedPicker";constructor(A){super();this.props=A}build(A){let Q=[...this.props.entries].sort((J,Y)=>Y.pubDate.getTime()-J.pubDate.getTime()),B=Math.max(0,...Q.map((J)=>q0A(J.pubDate).length));return new d6({items:Q,getLabel:(J)=>J.title,onAccept:(J)=>this.props.onSelect?.(J),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No news entries available",maxRenderItems:100,renderItem:(J,Y,Z,F)=>{let X=j0.of(F),{colors:D}=X,G=X.app,V=Y?G.selectionBackground:void 0,U=Y?G.selectionForeground:D.foreground,K=D.mutedForeground,E=(z,W)=>new U0({width:W,child:r0.end([new p({text:new C(z,new S({color:K}))})])});return new b0({decoration:V?{color:V}:void 0,padding:K0.symmetric(2,0),child:new r0({children:[new P1({child:new p({text:new C(J.title,new S({color:U})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),E(q0A(J.pubDate),B)]})})}})}}class FB{static _instance=null;_allExpanded=!1;_listeners=new Set;static get instance(){if(!FB._instance)FB._instance=new FB;return FB._instance}get allExpanded(){return this._allExpanded}setAllExpanded(A){if(this._allExpanded===A)return;this._allExpanded=A,this._notifyListeners()}toggleAll(){this.setAllExpanded(!this._allExpanded)}addListener(A){return this._listeners.add(A),()=>this.removeListener(A)}removeListener(A){this._listeners.delete(A)}_notifyListeners(){for(let A of this._listeners)A()}}d0();class N0A extends P0{labels=[];isLoading=!0;currentQuery="";initState(){this.loadLabels()}async loadLabels(){try{let A=await this.widget.props.internalAPIClient.getUserLabels({query:""},{config:this.widget.props.configService});if(!A.ok){j.error("Failed to load labels",A.error),this.isLoading=!1,this.labels=[],this.setState();return}this.labels=A.result,this.isLoading=!1,this.setState()}catch(A){j.error("Failed to load labels",A),this.isLoading=!1,this.labels=[],this.setState()}}getValidationError(A){let Q=A.trim().toLowerCase();if(Q.length===0)return null;if(Q.length>32)return"Label name cannot exceed 32 characters";if(!/^[a-z0-9][a-z0-9-]*$/.test(Q))return"Label must be alphanumeric with hyphens, starting with a letter or number";return null}isValidLabelName(A){return this.getValidationError(A)===null&&A.length>0}getAvailableLabels(){let A=this.widget.props.currentLabels||[];return this.labels.filter((Q)=>!A.includes(Q.name))}shouldShowCreateMarker(A){if(A.length===0||this.isLoading)return!1;let Q=A.trim().toLowerCase();if(!this.isValidLabelName(Q))return!1;let B=this.widget.props.currentLabels||[],$=this.labels.some((Y)=>Y.name===Q),J=B.includes(Q);return!$&&!J}build(A){let Q=j0.of(A),{app:B,colors:$}=Q,J=this.currentQuery.trim().toLowerCase(),Y=J.length>0?this.getValidationError(J):null,Z=this.getAvailableLabels(),X=[{id:"__create__",name:"__create_placeholder__",createdAt:"",__isCreateMarker:!0},...Z];return new d6({title:"Add Label",items:X,getLabel:(D)=>{if("__isCreateMarker"in D)return this.currentQuery.trim().toLowerCase();return D.name},onAccept:(D)=>{if("__isCreateMarker"in D)this.widget.props.onSelect(this.currentQuery.trim().toLowerCase());else this.widget.props.onSelect(D.name)},onDismiss:this.widget.props.onDismiss,isLoading:this.isLoading,loadingText:"Loading labels...",emptyStateText:Y||"Type to create a new label",renderItem:(D,G,V,U)=>{let K=G?B.selectionBackground:void 0,E=G?B.selectionForeground:$.foreground;if("__isCreateMarker"in D&&D.__isCreateMarker){let W=this.currentQuery.trim().toLowerCase();return new b0({decoration:K?{color:K}:void 0,padding:K0.symmetric(2,0),child:new p({text:new C("",void 0,[new C("Create new label: ",new S({color:E})),new C(W,new S({color:E,bold:!0}))])})})}return new b0({decoration:K?{color:K}:void 0,padding:K0.symmetric(2,0),child:new p({text:new C(D.name,new S({color:E}))})})},filterItem:(D,G)=>{if(this.currentQuery!==G)this.currentQuery=G,setTimeout(()=>this.setState(),0);if("__isCreateMarker"in D&&D.__isCreateMarker)return this.shouldShowCreateMarker(G);let U=G.trim().toLowerCase();return U.length===0||D.name.includes(U)},sortItems:(D,G,V)=>{let U="__isCreateMarker"in D.item&&D.item.__isCreateMarker,K="__isCreateMarker"in G.item&&G.item.__isCreateMarker;if(U&&!K)return-1;if(!U&&K)return 1;return G.score-D.score}})}}class t51 extends _0{props;constructor(A){super();this.props=A}createState(){return new N0A}}class nD extends _0{props;constructor(A){super();this.props=A}createState(){return new I0A}}class I0A extends P0{_spinner=new q6;animationInterval=null;initState(){super.initState(),this.animationInterval=setInterval(()=>{this._spinner.step(),this.setState(()=>{})},100)}dispose(){if(this.animationInterval)clearInterval(this.animationInterval),this.animationInterval=null;super.dispose()}build(A){let Q=j0.of(A),{colors:B,app:$}=Q,J=p1.all(new d1(B.foreground,1,"solid")),Y=this._spinner.toBraille(),Z=new p({textAlign:"center",text:new C("",void 0,[new C(Y,new S({color:$.processing})),new C(" ",void 0),new C(this.widget.props.message,new S({color:B.foreground}))])}),X=[new P1({child:new y0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)X.push(new U0({height:2,child:new b0({padding:K0.symmetric(2,0),child:new p({text:new C("",new S({dim:!0}),[new C("Press ",new S({color:B.foreground})),new C("Esc",new S({color:B.info})),new C(" to cancel",new S({color:B.foreground}))])})})}));let D=new b0({decoration:new k4(B.background,J),child:new U0({width:60,height:7,child:new y0({mainAxisAlignment:"start",children:X})})});if(this.widget.props.onAbort)return new u4({debugLabel:"LoadingDialog",child:new p4({debugLabel:"LoadingDialog",autofocus:!0,onKey:(G)=>{if(G.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:D})});return D}}class mU extends _0{props;constructor(A){super();this.props=A}createState(){return new w0A}}class w0A extends P0{scrollController=new yA;scrollAreaKey=new F2("message-dialog-scroll-area");viewportHeight=20;initState(){super.initState(),this.scrollController.followMode=!1,this.scrollController.addListener(()=>{this.setState()})}dispose(){this.scrollController.dispose(),super.dispose()}isWidgetMessage(A){return A instanceof b2}resolveFooterStyle(A){if(this.isWidgetMessage(A))return A.footerStyle;return"default"}getViewportHeight(){let Q=this.scrollAreaKey.currentElement?.renderObject;if(Q&&"size"in Q){let B=Q.size;if(typeof B.height==="number"&&B.height>0)return this.viewportHeight=B.height,B.height}return this.viewportHeight}build(A){let Q=j0.of(A),B=this.widget.props.message,$=(()=>{if(this.isWidgetMessage(B))return{title:B.title,type:B.type};if(B instanceof Error&&B.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:B.message};if(B instanceof Error&&B.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:B.message};let G=ND0(B);return{title:G.title,type:G.type,description:G.description}})(),J=$.type==="error"?Q.app.toolError:Q.app.command,Y=p1.all(new d1(Q.colors.border,1,"solid")),Z=new b0({padding:K0.symmetric(1,0),child:new p({text:new C($.title,new S({color:J,bold:!0}))})}),F=this.isWidgetMessage(B)?B.widget:new p({text:new C($.description,new S({color:Q.colors.foreground})),selectable:!0}),X=new P1({child:new X3({child:new b0({padding:K0.symmetric(1,0),child:new r0({key:this.scrollAreaKey,crossAxisAlignment:"stretch",children:[new P1({child:new fA({controller:this.scrollController,autofocus:!0,child:F})}),new U2({controller:this.scrollController,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack,getScrollInfo:()=>{let G=this.scrollController.maxScrollExtent,V=this.scrollController.offset,U=this.getViewportHeight(),K=G+U;return{totalContentHeight:Math.max(K,0),viewportHeight:Math.max(U,1),scrollOffset:Math.max(V,0)}}})]})})})}),D=new b0({padding:K0.symmetric(1,0),child:new p({text:(()=>{if(this.widget.props.onRetry)return new C("",void 0,[new C("Press ",new S({color:Q.colors.foreground,dim:!0})),new C("R",new S({color:Q.app.keybind})),new C(" to retry, ",new S({color:Q.colors.foreground,dim:!0})),new C("Esc",new S({color:Q.app.keybind})),new C(" to cancel",new S({color:Q.colors.foreground,dim:!0}))]);let G=this.resolveFooterStyle(this.widget.props.message);if(G==="none")return new C("",new S({color:Q.colors.foreground,dim:!0}));if(G==="help"){let V=new S({color:Q.app.keybind}),U=new S({color:Q.colors.foreground,dim:!0});return new C("",U,[new C("Press ",U),new C("Escape",V),new C(" to close • Use ",U),new C("↑↓",V),new C(" or ",U),new C("j/k",V),new C(" to scroll",U)])}return new C("Press any key to close",new S({color:Q.colors.foreground,dim:!0,italic:!0}))})()})});return new u4({debugLabel:"MessageDialog",child:new t4({fit:"expand",children:[new T1({onClick:()=>{},child:new U0}),new p4({onKey:(G)=>{if(this.widget.props.onRetry&&G.key==="r")return this.widget.props.onRetry(),"handled";if(G.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!1,child:new b0({decoration:{border:Y,color:Q.colors.background},padding:K0.all(1),child:new y0({mainAxisAlignment:"center",children:[Z,new U0({height:1}),X,D]})})})]})})}}Z3();s1();class C0A extends _0{props;constructor(A){super();this.props=A}createState(){return new M0A}}class M0A extends P0{plugins=[];subscription=null;initState(){this.subscription=this.widget.props.pluginService.plugins.subscribe((A)=>{this.plugins=A,this.setState(()=>{})})}dispose(){this.subscription?.unsubscribe(),super.dispose()}getRelativePath(A){let Q=p0.file(this.widget.props.cwd),B=$1.relativePath(Q,G6(A));if(B!==null&&B!==""&&B!==".."&&!B.startsWith("../"))return B;return p5(A)}statusIcon(A){let Q=p8.default(),{colors:B,app:$}=Q;switch(A){case"loading":return{icon:"◌",color:B.warning};case"active":return{icon:"✓",color:$.toolSuccess};case"error":return{icon:"✗",color:$.toolError}}}build(A){let Q=j0.of(A),{app:B}=Q;if(this.plugins.length===0)return new p({text:new C("No plugins found.",new S({dim:!0}))});let $=[],J=this.plugins.length,Y=this.plugins.filter((X)=>X.status==="active").length,Z=this.plugins.reduce((X,D)=>X+D.registeredCommands.length,0),F=this.plugins.reduce((X,D)=>X+D.registeredTools.length,0);if($.push(new C(`${Y}/${J} ${D4(J,"plugin")} active`,new S({bold:!0}))),Z>0||F>0)$.push(new C(` (${Z} ${D4(Z,"command")}, ${F} ${D4(F,"tool")})`,new S({dim:!0})));$.push(new C(`
|
|
7640
|
+
`))}if(E)V.push(new C(" ",G)),V.push(new C("Total: ",G)),V.push(new C(Y(z),D))}return new b0({decoration:{color:F.background,border:p1.all(new d1(F.border,1,"rounded"))},child:new p({text:new C(void 0,void 0,V)})})}d0();function E0A(A){return A.length===0?A:A[0].toLowerCase()+A.slice(1)}Z3();c3();k3();_B();Q7();s8();OQ();bq();n4();bS();GT();R1();d0();Q7();class o51{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(A,Q){this.enabled=A;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let A=Array.from(this.commandCounts.entries()).map(([Q,B])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1779083535-g196e66"},parameters:{metadata:{count:B}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(A);await q30(Q,this.configService)}catch(Q){j.error("Failed to export command telemetry events",Q)}}async submit(A){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(A)||0;this.commandCounts.set(A,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class Bw extends _0{props;constructor(A){super();this.props=A}createState(){return new z0A}}class z0A extends P0{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(A){let Q=(B)=>{this.setState(()=>{this._state=B(this._state)})};return this.widget.props.builder(A,Q,this._state)}}class W0A extends P0{controller=new P8;focusNode=new Q6({debugLabel:"CommandArgumentPrompt",onKey:(A)=>{if(A.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(A){let Q=j0.of(A),{colors:B,app:$}=Q,J=this.widget.props.isRequiredArg??!0,Y=this.controller.text.trim().length>0,Z=!J||Y,F=p1.all(new d1(B.foreground,1,"solid")),X=new B$({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(K)=>{let E=K.trim();if(J&&E.length===0)return;this.widget.props.onSubmit(E)},autofocus:!0,style:{textColor:B.foreground,border:null},maxLines:1}),D=new r0({children:[new b0({decoration:{color:B.background},child:new p({text:new C(">",new S({color:B.foreground}))})}),new P1({child:X})]}),G=new b0({padding:K0.symmetric(1,0),child:new p({text:this.widget.props.title?new C(this.widget.props.title,new S({color:$.command,bold:!0})):new C("",void 0,[new C("Command: ",new S({color:B.foreground})),new C(this.widget.props.commandName,new S({color:$.command,bold:!0}))])})}),V=[];if(Z)V.push(new C("Enter",new S({color:$.keybind}))),V.push(new C(" to submit, ",new S({color:B.foreground,dim:!0})));V.push(new C("Esc",new S({color:$.keybind}))),V.push(new C(" to cancel",new S({color:B.foreground,dim:!0})));let U=new b0({padding:K0.symmetric(1,0),child:new p({text:new C("",void 0,V)})});return new b0({decoration:{border:F,color:B.background},padding:K0.all(1),child:new y0({children:[G,new U0({height:1}),D,new G5,U]})})}}class hs extends _0{props;constructor(A){super();this.props=A}createState(){return new W0A}}OQ();class H0A extends P0{controller=new P8;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new Q6({debugLabel:"CommandMultilinePrompt",onKey:(A)=>{if(A.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=async(A)=>{if(this.imageAttachments.length>=C9)return!1;let Q=await fU(A);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,A]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(A){let Q=j0.of(A),{colors:B,app:$}=Q,Y=t1.of(A).size.height,Z=Math.max(Math.floor(Y*0.5),10),F=new cz({controller:this.controller,triggers:[new lF],completionBuilder:this.widget.props.completionBuilder,onSubmitted:(K)=>{this.widget.props.onSubmit(K.trim(),this.imageAttachments)},theme:B,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:H4.instance.tuiInstance.clipboard,autoOverlayPosition:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),X=new p4({debugLabel:"CommandMultilinePrompt",focusNode:this.focusNode,child:F}),D=new b0({constraints:new M1({maxHeight:Z}),padding:K0.symmetric(1,0),child:X}),G=new b0({padding:K0.symmetric(1,0),child:new p({text:new C("",void 0,[new C("Command: ",new S({color:B.foreground})),new C(this.widget.props.commandName,new S({color:$.command,bold:!0}))])})}),V=new b0({padding:K0.symmetric(1,0),child:new p({text:this.isConfirmingClearInput?new C("",void 0,[new C("Esc",new S({color:$.keybind})),new C(" again to clear input",new S({color:B.foreground,dim:!0}))]):new C("",void 0,[new C("Press ",new S({color:B.foreground,dim:!0})),new C("Enter",new S({color:$.keybind})),new C(" to submit, ",new S({color:B.foreground,dim:!0})),new C("Esc",new S({color:$.keybind})),new C(" to clear",new S({color:B.foreground,dim:!0}))])})}),U=[G,new U0({height:1}),new P1({child:D}),new U0({height:1}),V];return new b0({decoration:{border:p1.all(new d1(B.foreground,1,"solid")),color:B.background},padding:K0.all(1),child:new y0({children:U})})}}class r51 extends _0{props;constructor(A){super();this.props=A}createState(){return new H0A}}function q0A(A){let B=new Date().getTime()-A.getTime(),$=Math.floor(B/60000),J=Math.floor(B/3600000),Y=Math.floor(B/86400000);if($<1)return"just now";if($<60)return`${$}m ago`;if(J<24)return`${J}h ago`;if(Y<7)return`${Y}d ago`;return A.toLocaleDateString()}class s51 extends q1{props;debugLabel="NewsFeedPicker";constructor(A){super();this.props=A}build(A){let Q=[...this.props.entries].sort((J,Y)=>Y.pubDate.getTime()-J.pubDate.getTime()),B=Math.max(0,...Q.map((J)=>q0A(J.pubDate).length));return new d6({items:Q,getLabel:(J)=>J.title,onAccept:(J)=>this.props.onSelect?.(J),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No news entries available",maxRenderItems:100,renderItem:(J,Y,Z,F)=>{let X=j0.of(F),{colors:D}=X,G=X.app,V=Y?G.selectionBackground:void 0,U=Y?G.selectionForeground:D.foreground,K=D.mutedForeground,E=(z,W)=>new U0({width:W,child:r0.end([new p({text:new C(z,new S({color:K}))})])});return new b0({decoration:V?{color:V}:void 0,padding:K0.symmetric(2,0),child:new r0({children:[new P1({child:new p({text:new C(J.title,new S({color:U})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),E(q0A(J.pubDate),B)]})})}})}}class FB{static _instance=null;_allExpanded=!1;_listeners=new Set;static get instance(){if(!FB._instance)FB._instance=new FB;return FB._instance}get allExpanded(){return this._allExpanded}setAllExpanded(A){if(this._allExpanded===A)return;this._allExpanded=A,this._notifyListeners()}toggleAll(){this.setAllExpanded(!this._allExpanded)}addListener(A){return this._listeners.add(A),()=>this.removeListener(A)}removeListener(A){this._listeners.delete(A)}_notifyListeners(){for(let A of this._listeners)A()}}d0();class N0A extends P0{labels=[];isLoading=!0;currentQuery="";initState(){this.loadLabels()}async loadLabels(){try{let A=await this.widget.props.internalAPIClient.getUserLabels({query:""},{config:this.widget.props.configService});if(!A.ok){j.error("Failed to load labels",A.error),this.isLoading=!1,this.labels=[],this.setState();return}this.labels=A.result,this.isLoading=!1,this.setState()}catch(A){j.error("Failed to load labels",A),this.isLoading=!1,this.labels=[],this.setState()}}getValidationError(A){let Q=A.trim().toLowerCase();if(Q.length===0)return null;if(Q.length>32)return"Label name cannot exceed 32 characters";if(!/^[a-z0-9][a-z0-9-]*$/.test(Q))return"Label must be alphanumeric with hyphens, starting with a letter or number";return null}isValidLabelName(A){return this.getValidationError(A)===null&&A.length>0}getAvailableLabels(){let A=this.widget.props.currentLabels||[];return this.labels.filter((Q)=>!A.includes(Q.name))}shouldShowCreateMarker(A){if(A.length===0||this.isLoading)return!1;let Q=A.trim().toLowerCase();if(!this.isValidLabelName(Q))return!1;let B=this.widget.props.currentLabels||[],$=this.labels.some((Y)=>Y.name===Q),J=B.includes(Q);return!$&&!J}build(A){let Q=j0.of(A),{app:B,colors:$}=Q,J=this.currentQuery.trim().toLowerCase(),Y=J.length>0?this.getValidationError(J):null,Z=this.getAvailableLabels(),X=[{id:"__create__",name:"__create_placeholder__",createdAt:"",__isCreateMarker:!0},...Z];return new d6({title:"Add Label",items:X,getLabel:(D)=>{if("__isCreateMarker"in D)return this.currentQuery.trim().toLowerCase();return D.name},onAccept:(D)=>{if("__isCreateMarker"in D)this.widget.props.onSelect(this.currentQuery.trim().toLowerCase());else this.widget.props.onSelect(D.name)},onDismiss:this.widget.props.onDismiss,isLoading:this.isLoading,loadingText:"Loading labels...",emptyStateText:Y||"Type to create a new label",renderItem:(D,G,V,U)=>{let K=G?B.selectionBackground:void 0,E=G?B.selectionForeground:$.foreground;if("__isCreateMarker"in D&&D.__isCreateMarker){let W=this.currentQuery.trim().toLowerCase();return new b0({decoration:K?{color:K}:void 0,padding:K0.symmetric(2,0),child:new p({text:new C("",void 0,[new C("Create new label: ",new S({color:E})),new C(W,new S({color:E,bold:!0}))])})})}return new b0({decoration:K?{color:K}:void 0,padding:K0.symmetric(2,0),child:new p({text:new C(D.name,new S({color:E}))})})},filterItem:(D,G)=>{if(this.currentQuery!==G)this.currentQuery=G,setTimeout(()=>this.setState(),0);if("__isCreateMarker"in D&&D.__isCreateMarker)return this.shouldShowCreateMarker(G);let U=G.trim().toLowerCase();return U.length===0||D.name.includes(U)},sortItems:(D,G,V)=>{let U="__isCreateMarker"in D.item&&D.item.__isCreateMarker,K="__isCreateMarker"in G.item&&G.item.__isCreateMarker;if(U&&!K)return-1;if(!U&&K)return 1;return G.score-D.score}})}}class t51 extends _0{props;constructor(A){super();this.props=A}createState(){return new N0A}}class nD extends _0{props;constructor(A){super();this.props=A}createState(){return new I0A}}class I0A extends P0{_spinner=new q6;animationInterval=null;initState(){super.initState(),this.animationInterval=setInterval(()=>{this._spinner.step(),this.setState(()=>{})},100)}dispose(){if(this.animationInterval)clearInterval(this.animationInterval),this.animationInterval=null;super.dispose()}build(A){let Q=j0.of(A),{colors:B,app:$}=Q,J=p1.all(new d1(B.foreground,1,"solid")),Y=this._spinner.toBraille(),Z=new p({textAlign:"center",text:new C("",void 0,[new C(Y,new S({color:$.processing})),new C(" ",void 0),new C(this.widget.props.message,new S({color:B.foreground}))])}),X=[new P1({child:new y0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)X.push(new U0({height:2,child:new b0({padding:K0.symmetric(2,0),child:new p({text:new C("",new S({dim:!0}),[new C("Press ",new S({color:B.foreground})),new C("Esc",new S({color:B.info})),new C(" to cancel",new S({color:B.foreground}))])})})}));let D=new b0({decoration:new k4(B.background,J),child:new U0({width:60,height:7,child:new y0({mainAxisAlignment:"start",children:X})})});if(this.widget.props.onAbort)return new u4({debugLabel:"LoadingDialog",child:new p4({debugLabel:"LoadingDialog",autofocus:!0,onKey:(G)=>{if(G.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:D})});return D}}class mU extends _0{props;constructor(A){super();this.props=A}createState(){return new w0A}}class w0A extends P0{scrollController=new yA;scrollAreaKey=new F2("message-dialog-scroll-area");viewportHeight=20;initState(){super.initState(),this.scrollController.followMode=!1,this.scrollController.addListener(()=>{this.setState()})}dispose(){this.scrollController.dispose(),super.dispose()}isWidgetMessage(A){return A instanceof b2}resolveFooterStyle(A){if(this.isWidgetMessage(A))return A.footerStyle;return"default"}getViewportHeight(){let Q=this.scrollAreaKey.currentElement?.renderObject;if(Q&&"size"in Q){let B=Q.size;if(typeof B.height==="number"&&B.height>0)return this.viewportHeight=B.height,B.height}return this.viewportHeight}build(A){let Q=j0.of(A),B=this.widget.props.message,$=(()=>{if(this.isWidgetMessage(B))return{title:B.title,type:B.type};if(B instanceof Error&&B.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:B.message};if(B instanceof Error&&B.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:B.message};let G=ND0(B);return{title:G.title,type:G.type,description:G.description}})(),J=$.type==="error"?Q.app.toolError:Q.app.command,Y=p1.all(new d1(Q.colors.border,1,"solid")),Z=new b0({padding:K0.symmetric(1,0),child:new p({text:new C($.title,new S({color:J,bold:!0}))})}),F=this.isWidgetMessage(B)?B.widget:new p({text:new C($.description,new S({color:Q.colors.foreground})),selectable:!0}),X=new P1({child:new X3({child:new b0({padding:K0.symmetric(1,0),child:new r0({key:this.scrollAreaKey,crossAxisAlignment:"stretch",children:[new P1({child:new fA({controller:this.scrollController,autofocus:!0,child:F})}),new U2({controller:this.scrollController,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack,getScrollInfo:()=>{let G=this.scrollController.maxScrollExtent,V=this.scrollController.offset,U=this.getViewportHeight(),K=G+U;return{totalContentHeight:Math.max(K,0),viewportHeight:Math.max(U,1),scrollOffset:Math.max(V,0)}}})]})})})}),D=new b0({padding:K0.symmetric(1,0),child:new p({text:(()=>{if(this.widget.props.onRetry)return new C("",void 0,[new C("Press ",new S({color:Q.colors.foreground,dim:!0})),new C("R",new S({color:Q.app.keybind})),new C(" to retry, ",new S({color:Q.colors.foreground,dim:!0})),new C("Esc",new S({color:Q.app.keybind})),new C(" to cancel",new S({color:Q.colors.foreground,dim:!0}))]);let G=this.resolveFooterStyle(this.widget.props.message);if(G==="none")return new C("",new S({color:Q.colors.foreground,dim:!0}));if(G==="help"){let V=new S({color:Q.app.keybind}),U=new S({color:Q.colors.foreground,dim:!0});return new C("",U,[new C("Press ",U),new C("Escape",V),new C(" to close • Use ",U),new C("↑↓",V),new C(" or ",U),new C("j/k",V),new C(" to scroll",U)])}return new C("Press any key to close",new S({color:Q.colors.foreground,dim:!0,italic:!0}))})()})});return new u4({debugLabel:"MessageDialog",child:new t4({fit:"expand",children:[new T1({onClick:()=>{},child:new U0}),new p4({onKey:(G)=>{if(this.widget.props.onRetry&&G.key==="r")return this.widget.props.onRetry(),"handled";if(G.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!1,child:new b0({decoration:{border:Y,color:Q.colors.background},padding:K0.all(1),child:new y0({mainAxisAlignment:"center",children:[Z,new U0({height:1}),X,D]})})})]})})}}Z3();s1();class C0A extends _0{props;constructor(A){super();this.props=A}createState(){return new M0A}}class M0A extends P0{plugins=[];subscription=null;initState(){this.subscription=this.widget.props.pluginService.plugins.subscribe((A)=>{this.plugins=A,this.setState(()=>{})})}dispose(){this.subscription?.unsubscribe(),super.dispose()}getRelativePath(A){let Q=p0.file(this.widget.props.cwd),B=$1.relativePath(Q,G6(A));if(B!==null&&B!==""&&B!==".."&&!B.startsWith("../"))return B;return p5(A)}statusIcon(A){let Q=p8.default(),{colors:B,app:$}=Q;switch(A){case"loading":return{icon:"◌",color:B.warning};case"active":return{icon:"✓",color:$.toolSuccess};case"error":return{icon:"✗",color:$.toolError}}}build(A){let Q=j0.of(A),{app:B}=Q;if(this.plugins.length===0)return new p({text:new C("No plugins found.",new S({dim:!0}))});let $=[],J=this.plugins.length,Y=this.plugins.filter((X)=>X.status==="active").length,Z=this.plugins.reduce((X,D)=>X+D.registeredCommands.length,0),F=this.plugins.reduce((X,D)=>X+D.registeredTools.length,0);if($.push(new C(`${Y}/${J} ${D4(J,"plugin")} active`,new S({bold:!0}))),Z>0||F>0)$.push(new C(` (${Z} ${D4(Z,"command")}, ${F} ${D4(F,"tool")})`,new S({dim:!0})));$.push(new C(`
|
|
7641
7641
|
|
|
7642
7642
|
`));for(let X of this.plugins){let{icon:D,color:G}=this.statusIcon(X.status),V=this.getRelativePath(X.uri);if($.push(new C(`${D} `,new S({color:G}))),$.push(new C(V,new S({bold:!0}))),$.push(new C(` ${X.status}`,new S({dim:!0}))),$.push(new C(`
|
|
7643
7643
|
`)),X.status==="active"&&X.registeredEvents.length>0)$.push(new C(" Events: ",new S({dim:!0}))),$.push(new C(X.registeredEvents.join(", "),new S({color:B.link}))),$.push(new C(`
|
|
@@ -7815,7 +7815,7 @@ ${t.content||""}`:t.content||"",g0=[],c0=t.baseDir.startsWith("file://")?aU0(t.b
|
|
|
7815
7815
|
`)}function JAA(A,Q){A.command("usage").description("Show your current Amp usage and credit balance").action(async(B,$)=>{let J=$.optsWithGlobals(),Y=await Q(J),Z=await Y.settings.get("proxy"),F=E04({settings:{url:Y.ampURL,proxy:Z},secrets:{getToken:(D,G)=>Y.secrets.get(D,G)}}),X=await r4.userDisplayBalanceInfo({},{config:F});if(!X.ok){if(X.error.code==="auth-required")process.stderr.write(t0.red("Error: ")+"You must be logged in to view usage. Run `amp login` first.\n"),process.exit(1);process.stderr.write(t0.red("Error: ")+X.error.message+`
|
|
7816
7816
|
`),process.exit(1)}process.stdout.write(await Hr5(X.result.displayText)+`
|
|
7817
7817
|
`),process.exit(0)})}var h03=Mt.join(b$,"logs","headless.log"),Q91=Mt.join(Kp,"device-id.json"),g03=`cli-tui-${S3A(16).toString("hex")}`;async function m03(){let A=await Promise.all(fM.map(async(Q)=>{try{return{query:Q,hasConfigs:(await Q.listConfigs()).length>0}}catch(B){return j.debug("Failed to detect query-based IDE integration",{ideName:Q.ideName,error:B}),{query:Q,hasConfigs:!1}}}));for(let Q of A)if(Q.hasConfigs)return Q.query;return}function y3A(){m03().then((A)=>{if(A){let Q=h30(A.ideName);if(Q)RM(Q)}})}try{if(process.platform==="win32")await Promise.resolve().then(() => y4(Cb(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(A){XB.write(`Failed to change directory to ${process.env.AMP_PWD}: ${A}
|
|
7818
|
-
`)}function p03(A){process.emitWarning=(Q,B,$,J)=>{let Y=typeof Q==="string"?Q:Q.message||String(Q),Z=B||"Warning",F=!1;A.warn(Y,{name:Z,code:$})}}function p2(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")FY("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("mode")==="cli")FY("experimental.agentMode",Q.mode);if(A.getOptionValueSourceWithGlobals("model")==="cli"&&Q.model)FY("internal.model",l03(Q.model))}function O3A(A){let Q=A.indexOf(":");if(Q===-1)throw new l1(`Invalid model format "${A}". Expected "provider:model" (e.g., "anthropic:claude-sonnet-4-20250514").`,1);let B=A.slice(0,Q).trim(),$=A.slice(Q+1).trim();if(!B||!$)throw new l1(`Invalid model format "${A}". Both provider and model must be non-empty (e.g., "anthropic:claude-sonnet-4-20250514").`,1)}function d03(A){if(A===void 0)return;let Q=A.trim();if(ne1(Q))return Q;throw new l1(`Invalid effort "${A}". Expected one of: none, minimal, low, medium, high, xhigh, max.`,1)}function c03(A,Q){if(I8(A,Q))return;let B=d$(A)?.levels,$=B?` Allowed for ${A}: ${B.join(", ")}.`:"";throw new l1(`Reasoning effort "${Q}" is not available for ${A} mode.${$}`,1)}function l03(A){if(!A.includes("="))return O3A(A),A;let Q={};for(let B of A.split(",")){let $=B.trim();if(!$)continue;let J=$.indexOf("=");if(J===-1)throw new l1(`Invalid mode-specific model entry "${$}". Expected "mode=provider:model" (e.g., "smart=anthropic:claude-sonnet-4-20250514").`,1);let Y=$.slice(0,J).trim(),Z=$.slice(J+1).trim();if(!Y)throw new l1(`Missing mode name in "${$}". Expected "mode=provider:model".`,1);if(!Z)throw new l1(`Missing model value for mode "${Y}". Expected "${Y}=provider:model".`,1);O3A(Z),Q[Y]=Z}if(Object.keys(Q).length===0)throw new l1("No valid model overrides found in --model flag value.",1);return Q}function i03(A,Q){if(A.getOptionValueSourceWithGlobals("sp")==="cli"&&Q.sp)return Q.sp;if(A.getOptionValueSourceWithGlobals("systemPrompt")==="cli"&&Q.systemPrompt)return Q.systemPrompt;return}async function n03(A){try{return await v3A(A,"utf-8")}catch{return A}}async function B91(A,Q,B){let $=i03(A,Q);if(!$)return;let J=tA(B)?B.features:[],Y=tA(B)?B.user.email:void 0;if(!jt(J,LB.HARNESS_SYSTEM_PROMPT)&&!(Y&&f7(Y)))throw new l1("You are not allowed to do this.",1);FY("systemPrompt",await n03($))}function jt(A,Q){return A?.some((B)=>B.name===Q&&B.enabled)??!1}function a03(A){return A!=="pending"}function VW(A){if(!tA(A))return null;return{...A.user,features:A.features??[],team:A.workspace??void 0}}function o03(A){let Q=VW(A);if(Q)return Q.id;if(TX(A))throw Error(A.error.message);throw Error("unreachable")}function r03(A){try{let Q=new URL(A);return Q.hostname==="localhost"||Q.hostname==="127.0.0.1"}catch{return A.includes("localhost")||A.includes("127.0.0.1")}}function s03(A){let $=r03(A)?"Run `pnpm dev` to start the local server, then try again.":"Check your network connection or the server URL and try again.";return new l1(`Couldn't connect to the Amp server at ${A}.`,1,$)}function Lt(A,Q){let B=ko0(Error(A.error.message));if(B.message===K7.networkOffline||B.message===K7.networkTimeout)return s03(Q);if(B.message!==K7.internalBug)return new l1(B.message,1,B.suggestion);return new l1(A.error.message.replace(/^Error: /,""),1)}async function t03(){if(process.versions.bun)return!1;try{return await IU()==="npm"}catch(A){return j.debug("Failed to detect package manager for Neo npm migration welcome",{error:A}),!1}}var j3A=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} notification alerts (audio locally, terminal bell over SSH or with AMP_FORCE_BEL; 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)`},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??SX,description:`Custom settings file path (overrides the default location ${SX})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(j).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Ha})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","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:K9(),description:(A)=>A?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(A)=>A?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(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:"mode",long:"mode",short:"m",type:"option",default:SM.SMART.key,description:`Set the agent mode (${p$({}).map((A)=>A.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:Array.from(new Set(p$().map((A)=>A.mode))),hiddenChoices:["frontier"]},{name:"effort",long:"effort",type:"option",description:"Set reasoning effort for the new thread, when supported by the selected mode",choices:["none","minimal","low","medium","high","xhigh","max"]},{name:"takeMeBack",long:"take-me-back",type:"switch",description:"Disable thread-actors mode and use the legacy worker runtime",hidden:!0},{name:"neoOrb",long:"neo-orb",type:"switch",description:"Use the experimental Neo splash orb",hidden:!0},{name:"hideWelcome",long:"hide-welcome",type:"switch",description:"Skip the welcome experience on startup",hidden:!0},{name:"showWelcome",long:"show-welcome",type:"switch",description:"Show the welcome experience on startup",hidden:!0},{name:"observe",long:"observe",type:"option",description:"Open the Neo TUI as an observer of an existing thread (thread ID or URL)",hidden:!0},{name:"headless",long:"headless",type:"optional-option",description:"Run headless thread-actor executor (no TUI). Optionally provide a thread ID to connect to existing thread, otherwise create one.",hidden:!0},{name:"sp",long:"sp",type:"option",description:"Custom system prompt text or file path",hidden:!0},{name:"systemPrompt",long:"system-prompt",type:"option",description:"Custom system prompt text",hidden:!0},{name:"model",long:"model",type:"option",description:'Override the model. Use "provider:model" for all modes, or "mode=provider:model,mode=provider:model" for mode-specific overrides',hidden:!0}],R3A=(A)=>("deprecated"in A)&&A.deprecated===!0,e03=(A)=>("hidden"in A)&&A.hidden===!0,A13=(A)=>("default"in A),Q13=(A)=>("default"in A)?A.default:void 0;function bK0(A,Q){if(A.getOptionValueSourceWithGlobals("effort")!=="cli")return;let B=d03(Q.effort);if(B!==void 0)c03(Q.mode,B);return B}function B13(A,Q){let B=Q.args[0],$=Q.commands.map((Y)=>Y.name());if(B&&!B.includes(" ")&&B.length<30&&!/[./\\]/.test(B)){let Y=$.filter((F)=>B.includes(F)||F.includes(B)),Z="Run amp --help for a list of available commands.";if(Y.length>0)Z=`Did you mean: ${Y.join(", ")}? Or run amp --help for all commands.`;throw new l1(K7.unknownCommand(B),1,Z)}}async function gK0(A){return{...A,getThreadEnvironment:Hz,getEnvironmentData:(Q,B)=>fE(Q,B),skillService:A.skillService,fileChangeTrackerStorage:new NL,generateThreadTitle:WF4,deleteThread:(Q)=>A.threadService.delete(Q),getServerStatus:()=>bZ(A.configService),pluginService:A.pluginService}}function f3A(A){return{toolService:A.toolService,configService:A.configService,skillService:A.skillService,getThreadEnvironment:Hz,getEnvironmentData:(Q,B)=>fE(Q,B)}}var uK0=p0.file(u03.homedir()),$91=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):$1.joinPath(uK0,".config");function $13(A){return UR4({playNotificationSound:async(Q)=>{if(A.useNotificationsForService){if(uF0())hF0();else tY0(Q);let B=_j(),$=io();if((!B||$||Hf())&&A.config.settings["notifications.system.enabled"]!==!1){if(Q==="idle")process.stdout.write(_D("\x1B]777;notify;Amp;Agent is ready\x1B\\"));else if(Q==="requires-user-input")process.stdout.write(_D("\x1B]777;notify;Amp;Waiting for approval\x1B\\"))}}},windowFocused:()=>Promise.resolve(_j()),threadService:A.threadService,configService:A.configService,threadViewStates$:A.threadViewStates$})}async function l8(A,Q,B){let $=B?.deferAuth??!1,J=B?.skipToolProviders??!1;ue1("0.0.
|
|
7818
|
+
`)}function p03(A){process.emitWarning=(Q,B,$,J)=>{let Y=typeof Q==="string"?Q:Q.message||String(Q),Z=B||"Warning",F=!1;A.warn(Y,{name:Z,code:$})}}function p2(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")FY("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("mode")==="cli")FY("experimental.agentMode",Q.mode);if(A.getOptionValueSourceWithGlobals("model")==="cli"&&Q.model)FY("internal.model",l03(Q.model))}function O3A(A){let Q=A.indexOf(":");if(Q===-1)throw new l1(`Invalid model format "${A}". Expected "provider:model" (e.g., "anthropic:claude-sonnet-4-20250514").`,1);let B=A.slice(0,Q).trim(),$=A.slice(Q+1).trim();if(!B||!$)throw new l1(`Invalid model format "${A}". Both provider and model must be non-empty (e.g., "anthropic:claude-sonnet-4-20250514").`,1)}function d03(A){if(A===void 0)return;let Q=A.trim();if(ne1(Q))return Q;throw new l1(`Invalid effort "${A}". Expected one of: none, minimal, low, medium, high, xhigh, max.`,1)}function c03(A,Q){if(I8(A,Q))return;let B=d$(A)?.levels,$=B?` Allowed for ${A}: ${B.join(", ")}.`:"";throw new l1(`Reasoning effort "${Q}" is not available for ${A} mode.${$}`,1)}function l03(A){if(!A.includes("="))return O3A(A),A;let Q={};for(let B of A.split(",")){let $=B.trim();if(!$)continue;let J=$.indexOf("=");if(J===-1)throw new l1(`Invalid mode-specific model entry "${$}". Expected "mode=provider:model" (e.g., "smart=anthropic:claude-sonnet-4-20250514").`,1);let Y=$.slice(0,J).trim(),Z=$.slice(J+1).trim();if(!Y)throw new l1(`Missing mode name in "${$}". Expected "mode=provider:model".`,1);if(!Z)throw new l1(`Missing model value for mode "${Y}". Expected "${Y}=provider:model".`,1);O3A(Z),Q[Y]=Z}if(Object.keys(Q).length===0)throw new l1("No valid model overrides found in --model flag value.",1);return Q}function i03(A,Q){if(A.getOptionValueSourceWithGlobals("sp")==="cli"&&Q.sp)return Q.sp;if(A.getOptionValueSourceWithGlobals("systemPrompt")==="cli"&&Q.systemPrompt)return Q.systemPrompt;return}async function n03(A){try{return await v3A(A,"utf-8")}catch{return A}}async function B91(A,Q,B){let $=i03(A,Q);if(!$)return;let J=tA(B)?B.features:[],Y=tA(B)?B.user.email:void 0;if(!jt(J,LB.HARNESS_SYSTEM_PROMPT)&&!(Y&&f7(Y)))throw new l1("You are not allowed to do this.",1);FY("systemPrompt",await n03($))}function jt(A,Q){return A?.some((B)=>B.name===Q&&B.enabled)??!1}function a03(A){return A!=="pending"}function VW(A){if(!tA(A))return null;return{...A.user,features:A.features??[],team:A.workspace??void 0}}function o03(A){let Q=VW(A);if(Q)return Q.id;if(TX(A))throw Error(A.error.message);throw Error("unreachable")}function r03(A){try{let Q=new URL(A);return Q.hostname==="localhost"||Q.hostname==="127.0.0.1"}catch{return A.includes("localhost")||A.includes("127.0.0.1")}}function s03(A){let $=r03(A)?"Run `pnpm dev` to start the local server, then try again.":"Check your network connection or the server URL and try again.";return new l1(`Couldn't connect to the Amp server at ${A}.`,1,$)}function Lt(A,Q){let B=ko0(Error(A.error.message));if(B.message===K7.networkOffline||B.message===K7.networkTimeout)return s03(Q);if(B.message!==K7.internalBug)return new l1(B.message,1,B.suggestion);return new l1(A.error.message.replace(/^Error: /,""),1)}async function t03(){if(process.versions.bun)return!1;try{return await IU()==="npm"}catch(A){return j.debug("Failed to detect package manager for Neo npm migration welcome",{error:A}),!1}}var j3A=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} notification alerts (audio locally, terminal bell over SSH or with AMP_FORCE_BEL; 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)`},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??SX,description:`Custom settings file path (overrides the default location ${SX})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(j).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Ha})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","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:K9(),description:(A)=>A?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(A)=>A?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(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:"mode",long:"mode",short:"m",type:"option",default:SM.SMART.key,description:`Set the agent mode (${p$({}).map((A)=>A.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:Array.from(new Set(p$().map((A)=>A.mode))),hiddenChoices:["frontier"]},{name:"effort",long:"effort",type:"option",description:"Set reasoning effort for the new thread, when supported by the selected mode",choices:["none","minimal","low","medium","high","xhigh","max"]},{name:"takeMeBack",long:"take-me-back",type:"switch",description:"Disable thread-actors mode and use the legacy worker runtime",hidden:!0},{name:"neoOrb",long:"neo-orb",type:"switch",description:"Use the experimental Neo splash orb",hidden:!0},{name:"hideWelcome",long:"hide-welcome",type:"switch",description:"Skip the welcome experience on startup",hidden:!0},{name:"showWelcome",long:"show-welcome",type:"switch",description:"Show the welcome experience on startup",hidden:!0},{name:"observe",long:"observe",type:"option",description:"Open the Neo TUI as an observer of an existing thread (thread ID or URL)",hidden:!0},{name:"headless",long:"headless",type:"optional-option",description:"Run headless thread-actor executor (no TUI). Optionally provide a thread ID to connect to existing thread, otherwise create one.",hidden:!0},{name:"sp",long:"sp",type:"option",description:"Custom system prompt text or file path",hidden:!0},{name:"systemPrompt",long:"system-prompt",type:"option",description:"Custom system prompt text",hidden:!0},{name:"model",long:"model",type:"option",description:'Override the model. Use "provider:model" for all modes, or "mode=provider:model,mode=provider:model" for mode-specific overrides',hidden:!0}],R3A=(A)=>("deprecated"in A)&&A.deprecated===!0,e03=(A)=>("hidden"in A)&&A.hidden===!0,A13=(A)=>("default"in A),Q13=(A)=>("default"in A)?A.default:void 0;function bK0(A,Q){if(A.getOptionValueSourceWithGlobals("effort")!=="cli")return;let B=d03(Q.effort);if(B!==void 0)c03(Q.mode,B);return B}function B13(A,Q){let B=Q.args[0],$=Q.commands.map((Y)=>Y.name());if(B&&!B.includes(" ")&&B.length<30&&!/[./\\]/.test(B)){let Y=$.filter((F)=>B.includes(F)||F.includes(B)),Z="Run amp --help for a list of available commands.";if(Y.length>0)Z=`Did you mean: ${Y.join(", ")}? Or run amp --help for all commands.`;throw new l1(K7.unknownCommand(B),1,Z)}}async function gK0(A){return{...A,getThreadEnvironment:Hz,getEnvironmentData:(Q,B)=>fE(Q,B),skillService:A.skillService,fileChangeTrackerStorage:new NL,generateThreadTitle:WF4,deleteThread:(Q)=>A.threadService.delete(Q),getServerStatus:()=>bZ(A.configService),pluginService:A.pluginService}}function f3A(A){return{toolService:A.toolService,configService:A.configService,skillService:A.skillService,getThreadEnvironment:Hz,getEnvironmentData:(Q,B)=>fE(Q,B)}}var uK0=p0.file(u03.homedir()),$91=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):$1.joinPath(uK0,".config");function $13(A){return UR4({playNotificationSound:async(Q)=>{if(A.useNotificationsForService){if(uF0())hF0();else tY0(Q);let B=_j(),$=io();if((!B||$||Hf())&&A.config.settings["notifications.system.enabled"]!==!1){if(Q==="idle")process.stdout.write(_D("\x1B]777;notify;Amp;Agent is ready\x1B\\"));else if(Q==="requires-user-input")process.stdout.write(_D("\x1B]777;notify;Amp;Waiting for approval\x1B\\"))}}},windowFocused:()=>Promise.resolve(_j()),threadService:A.threadService,configService:A.configService,threadViewStates$:A.threadViewStates$})}async function l8(A,Q,B){let $=B?.deferAuth??!1,J=B?.skipToolProviders??!1;ue1("0.0.1779083535-g196e66");let Y=k30({storage:A.settings,secretStorage:A.secrets,workspaceRoot:u0.of(p0.file(process.cwd())),defaultAmpURL:A.ampURL,homeDir:uK0,userConfigDir:$91}),Z=A.secrets.get("apiKey",A.ampURL),F=bZ(Y),X=null,D=()=>{return},G=new Promise((B0)=>{D=B0}),V=Z.then(async(B0)=>{if(!B0&&!$)await G;return X??=F.subscribe(()=>{}),S1(F.pipe(d5(a03)))});V.catch(()=>{return}),Ws4(Y);let U=await Y.getLatest();j.debug("Global configuration initialized",{settingsKeys:Object.keys(U.settings)});let K=!1;{let B0=await Z;if(K=Boolean(B0),j.info("API key lookup before login",{found:Boolean(B0),ampURL:A.ampURL,deferAuth:$}),!B0)if($)j.info("No API key found, continuing startup with deferred auth");else{t6.write(`No API key found. Starting login flow...
|
|
7819
7819
|
`);let M0=await J13(A),n=await A.secrets.get("apiKey",A.ampURL);if(j.info("Login flow completed",{success:M0,storedKeyPresent:Boolean(n),ampURL:A.ampURL}),!M0)await Wz(),process.exit(1);K=!0,D()}}{let B0=await Y.getLatest(),M0=B0.settings.url,n=B0.secrets.isSet?.[M0];j.info("Config secrets state after login",{configURL:M0,apiKeySet:n?.apiKey??!1})}let E=$?"pending":await V;if(!$)j.info("Server status resolved",{status:"ready",isAuthenticated:tA(E),isError:TX(E),errorMessage:TX(E)?E.error.message:void 0});let z=V.then((B0)=>o03(B0));z.catch(()=>{return});let W=!Q.takeMeBack&&tA(E)&&jt(E.features,LB.THREAD_ACTORS_TUI),H=!1;if(process.env.AMP_DISABLE_PLUGINS==="1")j.warn("Ignoring AMP_DISABLE_PLUGINS outside development");let q=H?"off":W?"all":process.env.PLUGINS??"permissions",{toolService:N,dispose:I}=FR4({configService:Y}),w=new Map,O=()=>w.clear(),L=new fx0(Y,A.settings.getWorkspaceRootPath()),R=iJ4({configService:Y}),v=T74({configService:Y,trustStore:L,skillMCPServers:R.skillMCPServers,uploadImageAttachments:W,createOAuthProvider:async(B0,M0,n)=>{let a=`${B0}:${M0}`,t=w.get(a);if(t)return j.debug("Reusing existing OAuth provider for server",{serverName:B0,serverUrl:M0}),t;j.debug("Creating OAuth provider for server",{serverName:B0,serverUrl:M0});let e=(async()=>{let Z0=new mM(A.secrets),Y0=await Z0.getClientInfo(B0,M0),I0=n?.scopes??Y0?.scopes,C0=Pf4();j.info("OAuth headless mode check",{useHeadless:C0,executeMode:A.executeMode,envVar:process.env.AMP_HEADLESS_OAUTH,isTTY:t6.isTTY});let T0;if(C0)T0=A.executeMode?Rf4():jf4(B0);let G0=new lS0({storage:Z0,serverName:B0,serverUrl:M0,clientId:n?.clientId??Y0?.clientId,clientSecret:n?.clientSecret??Y0?.clientSecret,authUrl:n?.authUrl??Y0?.authUrl,tokenUrl:n?.tokenUrl??Y0?.tokenUrl,scopes:I0,headlessAuthHandler:T0});return j.debug("OAuth provider created",{serverName:B0,serverUrl:M0,hasManualClientId:!!(n?.clientId??Y0?.clientId),willUseDCR:!(n?.clientId??Y0?.clientId),scopes:I0,headlessMode:C0,executeMode:A.executeMode}),G0})();return w.set(a,e),e}}),T=bn0({configService:Y,spawn:LY0}),f=Q.headless?pr4():void 0,g=f??new YV0({configService:Y}),u=g instanceof YV0?g:void 0;if(u)u.pluginExecutorKind="local";let k=new n1(null),b=null,d=W&&!H?[...lr4(U.settings)?[{name:"permissions",entryPoint:p61}]:[],{name:"thread-visibility",entryPoint:ar4(Y,()=>V.then(VW),()=>b,(B0)=>{b=B0}),alwaysLoad:!0}]:[],c=rx0({configService:Y,platform:g,loadGlobalPlugins:$t0(Y),pluginFilter:q,activeThread$:k,internalPlugins:d}),h=MQ4(c),i=[v,T,h],r;if(J)r=new Map;else if(A.executeMode){let B0=await zO4({toolService:N,providers:i,initialTimeout:15000});r=B0.registrations;for(let[M0,n]of B0.initErrors)j.warn(`${M0} provider initialization slow or failed:`,n)}else r=un0({toolService:N,providers:i});if(Q.jetbrains)RM("JetBrains");else if(Q.ide&&ef4())RM("VS Code");else if(Q.ide&&Ax4())RM("Neovim");else if(Q.ide&&(!W||A.executeMode||Q.takeMeBack))y3A();if(A.executeMode)he1(!0);let Q0,w0=l3.status.pipe(w1((B0)=>Boolean(B0.connected&&B0.authenticated&&B0.ideName&&d04(B0.ideName))),T4()).subscribe((B0)=>{if(B0){if(!Q0)Q0=N.registerTool(EO4)}else Q0?.dispose(),Q0=void 0}),X0;if(!A.executeMode){let B0=await A.settings.get("fuzzy.alwaysIncludePaths")??[];X0=new fF0(process.cwd(),{alwaysIncludePaths:B0},!0)}else X0=new class extends fF0{async start(){}async query(){return[]}async queryCompletions(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};let H0=new th0(jl(Y,{usesThreadActors:!1}),{maxThreads:200});j.info("Starting Amp background services");let A0=new a61,R0={configService:Y,toolService:N,mcpService:v,skillService:R,toolboxService:T,trustStore:L,threadService:H0,secretStorage:A.secrets,settingsStorage:A.settings,fuzzyServer:X0,terminal:A0,pluginService:c,pluginPlatform:u,headlessPluginPlatform:f,activeThread$:k,serverStatus:E,serverStatusPromise:V,viewerUserIDPromise:z,hasAPIKeyAtStartup:K,consumeDraftNewThreadVisibility:()=>{let B0=b;return b=null,B0}};return{...R0,async asyncDispose(){if(R0.mcpService.hasAuthenticatingClients())j.info("Waiting for OAuth authentication to complete before exit..."),await R0.mcpService.waitForAuthentication();for(let B0 of r.values())B0.dispose();await R0.mcpService.dispose(),O(),await R0.threadService.asyncDispose(),R0.configService.unsubscribe(),X?.unsubscribe(),I(),R0.fuzzyServer.dispose(),R0.settingsStorage[Symbol.dispose](),w0.unsubscribe(),Q0?.dispose(),await R0.pluginService.dispose()}}}async function J13(A){if(!A.executeMode){if(!await OX0("Would you like to log in to Amp? [(y)es, (n)o]: "))return t6.write(`Login cancelled. Run the command again to retry.
|
|
7820
7820
|
`),!1}return await x3A(A)}async function x3A(A){let Q=S3A(32).toString("hex"),B=await jf(A.ampURL,Q),$=new AbortController;try{await RX(B,$.signal)}catch(Y){j.error("Error opening browser",{error:Y})}let J=await jf(A.ampURL,Q,!1);t6.write(`If your browser does not open automatically, visit:
|
|
7821
7821
|
|
|
@@ -7823,7 +7823,7 @@ ${t0.blue.bold(J)}
|
|
|
7823
7823
|
|
|
7824
7824
|
`);try{return await Ku4(A.ampURL,Q,A.secrets,$),t6.write("\nLogin successful! Run `amp` to get started.\n"),!0}catch(Y){return j.error("Login failed",{error:Y}),XB.write(`
|
|
7825
7825
|
Login failed: ${Y instanceof Error?Y.message:String(Y)}
|
|
7826
|
-
`),!1}}async function Y13(A,Q,B){let $=await Q.get("apiKey",A);if(!$)throw new l1("No Amp API key found. Run `amp login` first.",1);let J=f03("curl",["-H",`Authorization: Bearer ${$}`,...B],{stdio:"inherit"});process.exitCode=await new Promise((Y,Z)=>{J.on("error",Z),J.on("close",(F)=>Y(F??1))})}function Z13(A){let Q=new uN().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});Q.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)oO(),process.exit(0);let H=W.originalError??W;RT4(H)}),Qg4(Q,{version:"0.0.
|
|
7826
|
+
`),!1}}async function Y13(A,Q,B){let $=await Q.get("apiKey",A);if(!$)throw new l1("No Amp API key found. Run `amp login` first.",1);let J=f03("curl",["-H",`Authorization: Bearer ${$}`,...B],{stdio:"inherit"});process.exitCode=await new Promise((Y,Z)=>{J.on("error",Z),J.on("close",(F)=>Y(F??1))})}function Z13(A){let Q=new uN().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});Q.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)oO(),process.exit(0);let H=W.originalError??W;RT4(H)}),Qg4(Q,{version:"0.0.1779083535-g196e66",buildTimestamp:"2026-05-18T05:57:03.595Z",buildType:"release"}),Q.addHelpText("after",rf4()),Q.configureHelp({formatHelp:sf4}),Q.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let q=H.optsWithGlobals(),N=await a5(q);await W13(N)}),Q.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(W,H)=>{let q=H.optsWithGlobals(),N=await a5(q);await z13(N,await c61(q,N.settings))}),LT4(Q,a5);let $=Q.command("internal",{hidden:!0}).description("Internal commands").command("curl [args...]").description("Internal: run curl with the current Amp API key as a bearer token").allowUnknownOption(!0).allowExcessArguments(!0).action(async(...W)=>{let H=W.find((w)=>typeof w==="object"&&w!==null&&typeof w.optsWithGlobals==="function")??$,q=W.filter((w)=>w!==H).flatMap((w)=>Array.isArray(w)?w:typeof w==="string"?[w]:[]),N=H.optsWithGlobals(),I=await a5(N);await Y13(I.ampURL,I.secrets,q),process.exit(process.exitCode??0)});Q.command("git-credential-helper [action]",{hidden:!0}).summary("Git credential helper for GitHub").description("Internal: implements the git credential helper protocol. Used inside sandboxes to authenticate git operations with GitHub.").action(async(W,H,q)=>{let N=q.optsWithGlobals(),I=await a5(N);await qf4(W??"get",I.ampURL,I.secrets),process.exit(process.exitCode??0)}),Q.command("sign-commit",{hidden:!0}).summary("Git commit signing helper").description("Internal: implements the gpg signing interface for git commit signing. Used inside sandboxes as gpg.program.").allowUnknownOption().action(async(W,H)=>{let q=H.optsWithGlobals(),N=await a5(q);await Nf4(N.ampURL,N.secrets),process.exit(process.exitCode??0)}),Q.command("keyboard-tester",{hidden:!0}).summary("Keyboard input tester").description("Internal: stream parsed terminal input events as JSONL.").option("--raw","Log raw incoming terminal bytes before parsing").action(async(W)=>{await Ub4({raw:W.raw===!0}),process.exit(process.exitCode??0)}),Q.command("live-sync [threadIDOrURL]",{hidden:!0}).summary("Mirror live DTW thread changes into the current checkout").description("Experimental: watch a v2 thread URL or ID and mirror its live working-tree changes into your local checkout, or apply the current snapshot once and exit.").addHelpText("after",["","Examples:"," amp live-sync T-5928a90d-d53b-488f-a829-4e36442142ee"," amp live-sync --apply T-5928a90d-d53b-488f-a829-4e36442142ee"," amp live-sync https://ampcode.com/threads/T-5928a90d-d53b-488f-a829-4e36442142ee"].join(`
|
|
7827
7827
|
`)).option("--apply <threadIDOrURL>","Apply the current DTW thread snapshot once and exit").option("--checkout","Automatically check out the thread commit when it differs").option("--skip-checkout","Skip the startup checkout prompt when commits differ").action(async(W,H,q)=>{if(W&&H.apply)throw new l1("Choose either a positional thread ID/URL or --apply <thread-id>, not both.",1);let N=H.apply??W;if(!N||N.trim().length===0)t6.write(`live-sync watches a v2 thread and mirrors its live changes locally. Use --apply <thread-id> to materialize the current snapshot once and exit.
|
|
7828
7828
|
|
|
7829
7829
|
`),q.outputHelp(),process.exit(0);let I=L2(N)??oB(N),w=q.optsWithGlobals(),O=await a5(w);p2(q,w);let L=await l8(O,w),R=!1;try{if(H.checkout&&H.skipCheckout)throw new l1("Choose either --checkout or --skip-checkout, not both.",1);if(TX(L.serverStatus))throw Lt(L.serverStatus,O.ampURL);let v=tA(L.serverStatus)?L.serverStatus.features:void 0;if(!jt(v,LB.V2))throw new l1("live-sync is not enabled for your user",1);await Bu4({ampURL:O.ampURL,threadId:I,configService:L.configService,threadService:L.threadService,apiKey:process.env.AMP_API_KEY,applyOnce:typeof H.apply==="string",checkoutMode:H.checkout?"always":H.skipCheckout?"never":"prompt",promptForYesNo:OX0}),R=!0}finally{if(await L.asyncDispose(),R)process.exit(0)}});let J=async(W,H,q)=>{k30({storage:H.settings,secretStorage:H.secrets,workspaceRoot:u0.of(p0.file(process.cwd())),defaultAmpURL:H.ampURL,homeDir:uK0,userConfigDir:$91});let N={...H,executeMode:!1};await hK0(N,{...W,openThreadSwitcher:!0},q,A)},Y=Q.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").option("--include-archived","Include archived threads in the list").action(async(W,H)=>{let q=H.optsWithGlobals(),N=await a5(q);await k3A(q,N,H)});Y.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(W,H)=>{let q=H.optsWithGlobals(),N=await a5(q);await _13(q,N,H)}),Y.command("continue [threadIDOrURLs...]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, interactive mode shows a picker. Use --last to continue the last thread for the current mode directly. When multiple thread are given, all are resumed and the first is shown in the foreground.").option("--last","Continue the last thread for the current mode directly").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(W,H,q)=>{let N=q.optsWithGlobals(),I=await a5(N),w=Array.isArray(W)?W:[];if(H.pick)XB.write(`${t0.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
@@ -7856,8 +7856,8 @@ ${O}
|
|
|
7856
7856
|
`))}),H.args.length>0)B13(N,H);await hK0(N,q,H,A)}),Px4(Q),Q}async function Ot(A,Q){await rQ((B)=>_f(B,A,Q))}async function P3A(A,Q,B){let $=Date.now(),[J,Y]=await Promise.all([r4.getThreadLinkInfo({thread:A},{config:Q}),B]);if(j.getChild("fetchAndStartThread").info(`Ownership check in ${Date.now()-$}ms`),J.ok){let Z=J.result.creatorUserID;if(Z&&Z!==Y&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new l1(`Cannot resume thread created by another user.
|
|
7857
7857
|
|
|
7858
7858
|
This thread belongs to a different user and cannot be continued for security reasons. Set AMP_RESUME_OTHER_USER_THREADS_INSECURE=1 to bypass this check.`)}}async function b3A(A){if(A.streamJsonInput)return{userInput:"",stdinInput:null};if(typeof A.execute==="string"){let Q=(await GV0()).trimEnd();return{userInput:A.execute,stdinInput:Q||null}}return{userInput:(await GV0()).trimEnd(),stdinInput:null}}function u3A(A,Q,B){if(A.streamJson&&!Q)throw new l1("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(A.streamJsonInput&&!Q)throw new l1("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(A.streamJsonInput&&!A.streamJson)throw new l1("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if(A.stats&&A.streamJson)throw new l1("The --stats and --stream-json flags are mutually exclusive output formats",1,'Use one or the other: amp --execute "your message" --stats OR amp --execute "your message" --stream-json');if(A.stats&&!Q)throw new l1("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(A.archive&&!Q)throw new l1("The --archive flag requires --execute mode",1,'Use: amp --execute "your message" --archive');if(A.streamJsonInput&&typeof A.execute==="string"&&A.execute.trim()!=="")throw new l1("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"},{"type":"image","source":{"type":"base64","media_type":"image/png","data":"..."}}]}}' | amp --execute --stream-json --stream-json-input`);if(Q&&B===""&&!A.streamJsonInput&&!A.headless)throw new l1("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
|
|
7859
|
-
Or pipe via stdin: echo "your message" | amp --execute`)}function F13(){kA4([P30.parse({tool:"*",action:"allow"})]),DA4({bypass:!0})}function X13(A){if(A.threadId&&!I9(A.threadId))delete A.threadId}async function hK0(A,Q,B,$){if(Q.headless)return D13(A,Q,B);let J=await l8(A,Q),Y=await J.serverStatusPromise,Z=tA(Y)&&jt(Y.features,LB.THREAD_ACTORS_TUI),F=Z&&!Q.takeMeBack;if(Q.showWelcome&&Q.hideWelcome)throw await J.asyncDispose(),new l1("Cannot use --show-welcome and --hide-welcome together",1);if(Q.showWelcome&&!Z)throw await J.asyncDispose(),new l1("--show-welcome is only available with the new Amp CLI feature flag",1);if(F){let X=!A.executeMode&&await t03();return F13(),X13(Q),G13(A,Q,B,J,{showNpmMigrationWelcome:X})}else{if(Q.threadId&&I9(Q.threadId)){let X=await r4.getThreadLinkInfo({thread:Q.threadId},{config:J.configService}).catch(()=>null);if(X?.ok&&X.result.usesThreadActors)throw await J.asyncDispose(),new l1(`Thread ${Q.threadId} was created with the Neo TUI and cannot be continued in the legacy CLI.`,1,"Re-run without --take-me-back to continue this thread.")}return V13(A,Q,B,$,{dependencies:J})}}async function D13(A,Q,B){let $=(H,q)=>{let N=Number(process.hrtime.bigint()-q)/1e6,I=wo0();j.info("Startup phase",{phase:H,phaseMs:Math.round(N),sinceMainMs:I===null?void 0:Math.round(I)})};p2(B,Q);let J=process.hrtime.bigint(),Y=await l8(A,Q);$("runMainThread:createThreadDependencies",J);let{serverStatus:Z}=Y;if(TX(Z))throw Lt(Z,A.ampURL);let F=tA(Z)?Z:null,X=F?.user.email;await B91(B,Q,Z);let D=VW(Z),G=vx(Q,D);if(G instanceof Error)j5(G.message);if(F&&!kM(Q.mode,X))throw new l1(`Agent mode '${Q.mode}' is only available for Amp employees`,1);if(process.env.AMP_EXECUTOR!=="1"&&(!X||!f7(X)))throw new l1("Headless executor mode is only available for Amp employees",1);vZ0();let U=await Y.secretStorage.get("apiKey",A.ampURL);if(!U)throw new l1("API key required for headless mode. Please run `amp login` first.",1);let K=typeof Q.headless==="string"&&Q.headless!=="true"?Q.headless:void 0;if(K&&!I9(K))throw new l1(`Invalid thread ID: ${K}`,1);let E=K?void 0:await R13({dependencies:Y,apiKey:U,visibility:G??void 0}),z=K??E?.threadId;if(!z)throw new l1("Failed to resolve headless thread ID",1);let W=await Sf4(z);if(W.status==="already-running")await Y.asyncDispose(),await Wz(),process.exit(0);try{await Mf4({ampURL:A.ampURL,apiKey:U,workspaceRoot:process.cwd(),threadId:z,ownerUserId:E?.ownerUserId,threadVersion:E?.threadVersion,agentMode:E?.agentMode,initialToolDiscovery:Promise.all([Y.mcpService.initialized,Y.toolboxService.initialized,Y.pluginService.initialized]).then(()=>{return}),configService:Y.configService,mcpService:Y.mcpService,toolService:Y.toolService,skillService:Y.skillService,pluginService:Y.pluginService,pluginPlatform:Y.headlessPluginPlatform})}finally{await W.release(),await Y.asyncDispose()}await Wz(),process.exit(0)}async function G13(A,Q,B,$,J){let{userInput:Y,stdinInput:Z}=await b3A(Q),F=!!Q.streamJson||!!Q.streamJsonThinking;u3A({...Q,streamJson:F},A.executeMode,Y),p2(B,Q),UT4(),vZ0();let X=Q.threadId,D=Q.resumeThreadIDs??(X?[X]:[]),G=Q.observe?L2(Q.observe)??oB(Q.observe):void 0,V=await $.serverStatusPromise;if(TX(V))throw Lt(V,A.ampURL);let U=VW(V),K=vx(Q,U);if(K instanceof Error)j5(K.message);let E=null,z=async()=>{let q=$.consumeDraftNewThreadVisibility();if(q!==null)return q;return E??=(async()=>{let N=await qa(A.settings,process.cwd(),U,K);if(N instanceof Error)j5(N.message);return N})(),E},W=await $.secretStorage.get("apiKey",A.ampURL);if(!W)throw new l1("API key required. Please run `amp login` first.",1);let H=tA(V)&&f7(V.user.email);if(A.executeMode){if(D.length>1)throw new l1("Execute mode can only resume one thread.",1);Ge0($.mcpService,A.settings);try{let q=bK0(B,Q),N=await vz(),I=X?q:RX0({agentMode:Q.mode,explicitEffort:q,sessionState:N}),w=X?void 0:PX0(await Rf($.configService),{agentMode:Q.mode,explicitEffort:q,sessionState:N}),O=X?void 0:await z(),L=await ry4({apiKey:W,ampURL:A.ampURL,workspaceRoot:process.cwd(),dependencies:$,userInput:Y,stdinInput:Z,stats:!!Q.stats,streamJson:F,streamJsonThinking:!!Q.streamJsonThinking,streamJsonInput:!!Q.streamJsonInput,stdin:process.stdin,agentMode:Q.mode,reasoningEffort:I,labels:Q.label,initialThreadID:X,initialThreadMeta:O,initialSettings:w});if(await Ot(L,"execute"),Q.archive)await $.threadService.archive(L,!0)}finally{await $.asyncDispose()}await Wz(),process.exit(0)}else{let q=bK0(B,Q),N=J.showNpmMigrationWelcome?"npm-migration":"intro",I=oF0("0.0.1779081543-gea23bb",$.settingsStorage,{startDelayMs:3000}),w=new jX0($.mcpService,A.settings.getWorkspaceRootPath()),O=jl($.configService),L=new gs($.fuzzyServer),R=process.cwd();await yr4({ampURL:A.ampURL,apiKey:W,rivetEndpoint:process.env.RIVET_PUBLIC_ENDPOINT??vF(A.ampURL),configService:$.configService,toolService:$.toolService,pluginPlatform:$.pluginPlatform,pluginService:$.pluginService,skillService:$.skillService,mcpService:$.mcpService,readFileSystemDirectory:({uri:v})=>Ff({workspaceRoot:R},v),completionBuilder:L,updateService:I,workspaceRoot:R,listThreads:()=>O.listThreads(),getThreadFromServer:(v)=>O.getThread(v),toolboxes:$.toolboxService.toolboxes,isInternalUser:H,settingsFilePath:$.settingsStorage.getSettingsFilePath(),workspaceSettingsFilePath:$.settingsStorage.getWorkspaceSettingsPath(),mcpTrustHandler:w,setActiveThreadID:(v)=>$.activeThread$.next(v),dispose:()=>{return w.dispose(),I.dispose(),$.asyncDispose()}},{initialThreadIDs:G?[G]:D,initialUserInput:Y||void 0,getDefaultNewThreadVisibility:z,onFirstFrame:Q.ide?y3A:void 0,openThreadPickerOnStart:Q.openThreadSwitcher,observerOnly:!!G,splashOrbVisualStyle:"neo",hideNeoWelcome:!!Q.hideWelcome,showNeoWelcome:Q.showWelcome,neoWelcomeVariant:N,initialAgentMode:B.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0,initialReasoningEffort:q}),process.exit(0)}}async function V13(A,Q,B,$,J){let Y=process.hrtime.bigint(),Z=(A0,R0)=>{let B0=Number(process.hrtime.bigint()-R0)/1e6,M0=wo0();j.info("Startup phase",{phase:A0,phaseMs:Math.round(B0),sinceMainMs:M0===null?void 0:Math.round(M0)})},{userInput:F,stdinInput:X}=await b3A(Q),D=!!Q.streamJson||!!Q.streamJsonThinking;u3A({...Q,streamJson:D},A.executeMode,F),p2(B,Q);let G=process.hrtime.bigint(),V=J?.dependencies??await l8(A,Q),U=V.hasAPIKeyAtStartup,K=V.serverStatus==="pending";if(j.info("Interactive auth startup mode",{deferInteractiveAuth:K,hasAPIKeyAtStartup:U,executeMode:A.executeMode,headless:Boolean(Q.headless)}),!J)Z("runMainThread:createThreadDependencies",G);let{serverStatus:E}=V;if(!K&&TX(E))throw Lt(E,A.ampURL);let z=tA(E)?E:null,W=z?.user.email,H=!!(W&&f7(W));if(H)vZ0();if(!K)await B91(B,Q,E);let q=VW(E),N=q?.features??[],I=q?.team??null,w=vx(Q,q);if(w instanceof Error)j5(w.message);if(z&&!kM(Q.mode,W))throw new l1(`Agent mode '${Q.mode}' is only available for Amp employees`,1);let O=Q.threadId&&I9(Q.threadId)?Q.threadId:void 0;G=process.hrtime.bigint();let L=await gK0(V);Z("runMainThread:createWorkerDeps",G);let R=A.executeMode?void 0:async(A0)=>Ot(A0,"interactive"),v={threadService:V.threadService,workerDeps:L,createThread:async(A0)=>{let R0=K?await V.serverStatusPromise:E,B0=await qa(A.settings,process.cwd(),VW(R0),w);if(B0 instanceof Error)j5(B0.message);return P81(L,{threadMeta:B0,agentMode:A0??Q.mode,onFirstAssistantMessage:R})},validateThreadOwnership:async(A0,R0)=>{if(R0?.nonBlockingOwnershipCheck){P3A(A0,V.configService,V.viewerUserIDPromise).catch((B0)=>{if(B0 instanceof l1){if(R0.onOwnershipError){R0.onOwnershipError(B0,A0);return}qz(B0,A0);return}j.warn("Failed to validate thread ownership in CLI, allowing to open",{error:B0})});return}try{await P3A(A0,V.configService,V.viewerUserIDPromise)}catch(B0){if(B0 instanceof l1)throw B0;j.warn("Failed to validate thread ownership in CLI, allowing to open",{error:B0})}},switchThreadVisibility:w,switchThreadAgentMode:Q.mode,onFirstAssistantMessage:R,handleError:qz},T=async()=>{try{return AAA(v,Q.threadId,{nonBlockingOwnershipCheck:Q.nonBlockingThreadOwnershipCheck})}catch(A0){if(A0 instanceof l1)throw A0;throw await qz(A0,Q.threadId),Error("handleError should have called process.exit()")}},f=(async()=>{if(K){j.info("Skipping initial free tier status fetch until auth is complete");return}try{let A0=await V.configService.getLatest(),R0=Pm(A0),B0=await r4.getUserFreeTierStatus({},{config:V.configService,signal:AbortSignal.timeout(R0)});if(B0.ok)return j.info("User free tier status:",B0),B0.result;return}catch(A0){j.error("Failed to fetch free tier status:",A0);return}})(),u=!A.executeMode?new e61:null,k,b=null;if(u)k=u,b=(async()=>{let A0=K?await V.serverStatusPromise:V.serverStatus;if(TX(A0))throw Lt(A0,A.ampURL);await B91(B,Q,A0);let R0=process.hrtime.bigint(),B0=await T();if(Z("runMainThread:createThreadPool",R0),u.attach(B0),F){let M0=await S1(B0.threadHandles$);if(!M0)throw new l1("No active thread is available yet.",1);await M0.sendMessage({content:[{type:"text",text:F}]})}})(),b.catch(async(A0)=>{let R0=A0 instanceof Error?A0:Error(String(A0));u.setInitError(R0),await qz(A0,Q.threadId)});else G=process.hrtime.bigint(),k=await T(),Z("runMainThread:createThreadPool",G);let d=Q.notifications!==void 0?Q.notifications:!A.executeMode;G=process.hrtime.bigint();let c=await V.configService.getLatest();if(Z("runMainThread:configService.getLatest",G),G=process.hrtime.bigint(),$13({configService:V.configService,threadService:V.threadService,config:c,useNotificationsForService:d,threadViewStates$:()=>k.threadHandles$.pipe(f4((A0)=>{if(!A0)return u0.of({});return M6(A0.thread$,A0.threadViewState$).pipe(w1(([R0,B0])=>({[R0.id]:B0})))}))}),Z("runMainThread:createCliNotificationService",G),A.executeMode){Ge0(V.mcpService,A.settings);let A0=bK0(B,Q),R0=await vz(),B0=O?A0:RX0({agentMode:Q.mode,explicitEffort:A0,sessionState:R0}),M0={userInput:F,stdinInput:X,dependencies:V,streamJson:D,streamJsonInput:!!Q.streamJsonInput,streamJsonThinking:!!Q.streamJsonThinking,stats:!!Q.stats,ampURL:A.ampURL,isInternalUser:H,agentMode:Q.mode,reasoningEffort:B0,labels:Q.label},n=await aT4({threadPool:k,...M0});if(await Ot(n,"execute"),Q.archive)await V.threadService.archive(n,!0);await V.asyncDispose(),process.exit(0)}let h=!1,i=!1;if(Q.jetbrains||Q.ide){await m30();let A0=await yX({jetbrainsOnly:Q.jetbrains});if(A0.length===0){if(Q.jetbrains)h=!await V.configService.get("jetbrains.skipInstall")}else if(A0.length===1){let R0=A0[0];if(R0)l3.selectConfig(R0)}else i=!0}G=process.hrtime.bigint();let r=oF0("0.0.1779081543-gea23bb",V.settingsStorage,{startDelayMs:3000});Z("runMainThread:createUpdateService",G),G=process.hrtime.bigint();let Q0=new jX0(V.mcpService,A.settings.getWorkspaceRootPath());if(Z("runMainThread:createMcpTrustHandler",G),F&&A.executeMode){let A0=await S1(k.threadHandles$);if(!A0)throw new l1("No active thread is available yet.",1);await A0.sendMessage({content:[{type:"text",text:F}]})}G=process.hrtime.bigint();let w0=await vz();Z("runMainThread:loadSessionState",G),j.info("Loaded session state:",w0);let X0=bK0(B,Q),H0={...w0,launchCount:w0.launchCount+1,lastReasoningEffortByMode:X0?{...w0.lastReasoningEffortByMode,[Q.mode]:X0}:w0.lastReasoningEffortByMode};rQ((A0)=>({...A0,launchCount:A0.launchCount+1}));try{if(G=process.hrtime.bigint(),await Kt4({history:new Bo,fuzzyServer:V.fuzzyServer,settingsStorage:V.settingsStorage,threadService:V.threadService,skillService:V.skillService,configService:V.configService,secretStorage:V.secretStorage,internalAPIClient:r4,threadPool:k,createSystemPromptDeps:async()=>f3A(V),ideClient:l3,mcpService:V.mcpService,toolboxService:V.toolboxService,mcpTrustHandler:Q0,updateService:r,pluginPlatform:V.pluginPlatform,pluginService:V.pluginService},{initialServerStatus:V.serverStatus,stdout:process.stdout,hasAPIKeyAtStartup:V.hasAPIKeyAtStartup,ampURL:A.ampURL,startupThreadID:O,showJetBrainsInstaller:h,showIdePickerHint:i,openThreadSwitcher:Q.openThreadSwitcher,jetbrainsMode:Q.jetbrains,clientId:g03,logFile:{path:$},sessionState:H0,freeTierStatusPromise:f,workspace:I??null,features:N,isInternalUser:H,initialAgentMode:B.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0,splashOrbVisualStyle:Q.neoOrb?"neo":"classic",buildTimestamp:"2026-05-18T05:23:43.197Z"},(A0)=>new Z51({...A0,threadPool:A0.threadPool},(R0)=>new j81({...R0,threadState:R0.threadState}))),Z("runMainThread:mountApp-returned",G),b)await b}finally{await k.dispose().catch((A0)=>{j.error("Failed to dispose thread pool during shutdown",A0)})}await V.asyncDispose(),Z("runMainThread:dependencies.asyncDispose",Y),process.exit(0)}async function a5(A){if(j.info("Initializing CLI context",{argv:process.argv,nodeEnv:"production",hasAmpURL:Boolean(process.env.AMP_URL),hasAmpAPIKey:Boolean(process.env.AMP_API_KEY),hasSettingsFile:Boolean(process.env.AMP_SETTINGS_FILE)}),A.interactive)XB.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
7860
|
-
`);let Q=!!A.execute||!process.stdout.isTTY&&!A.streamJson,B=process.stdout.isTTY&&process.stderr.isTTY;j.info("Execution mode resolved",{executeMode:Q,stdoutTTY:process.stdout.isTTY,stderrTTY:process.stderr.isTTY,streamJson:A.streamJson,executeFlag:A.execute});let $=await f74({get:async(F)=>{if(F!==fd)return;try{let X=await v3A(Q91,"utf-8");return JSON.parse(X).installationID}catch{return}},set:async(F,X)=>{if(F!==fd)return;await x03(Mt.dirname(Q91),{recursive:!0}),await b03(Q91,JSON.stringify({installationID:X},null,2),{mode:384})}},{clientType:"cli",platform:X90()});ge1($);let J=await Us4({...A,workspaceTrust:{current:!0,changes:_m},getHook:process.env.AMP_URL?(F,X)=>{if(F==="url")return Promise.resolve(process.env.AMP_URL);return X()}:void 0});if(A.mcpConfig){let F=await Mu4(A.mcpConfig);J=Lu4(J,F)}let Y=Mt.dirname(J.getSettingsFilePath());VR4(Kp,Y),J=Es1(J);let Z=await J.get("url","admin")??await J.get("url","global");if(!Z)Z=h7;if(j.info("Resolved Amp URL",{ampURL:Z,settingsFile:J.getSettingsFilePath(),workspaceRoot:J.getWorkspaceRootPath()}),!bH(Z))j.info("Targeting custom Amp server",{ampURL:Z});return{executeMode:Q,isTTY:B,ampURL:Z,settings:J,secrets:Zs4(await c61(A,J))}}function U13(A){let Q={};for(let B=0;B<A.length;B++){let $=A[B];if($?.startsWith("--")){let Y=$.slice(2).replace(/-([a-z])/g,(F,X)=>X.toUpperCase()),Z=A[B+1];if(Z&&!Z.startsWith("--"))Q[Y]=Z,B++}}return Q}function K13(A,Q){let B=A.includes("--headless")||A.some((J)=>J.startsWith("--headless=")),$=Mt.resolve(Q.logFile??process.env.AMP_LOG_FILE??(B?h03:Ha));return{logLevel:Q.logLevel??process.env.AMP_LOG_LEVEL??"info",logFile:$}}async function E13(){ZT4();let A=U13(process.argv),Q=K13(process.argv,A),B=KT4(Q);OZ0("silent");let $=process.argv.includes("--no-color"),J=process.argv.includes("--color"),Y=process.stdout.isTTY&&process.stderr.isTTY;if($||!J&&!Y)t0.level=0;if(p03(j),j.info("Starting Amp CLI.",{version:"0.0.
|
|
7859
|
+
Or pipe via stdin: echo "your message" | amp --execute`)}function F13(){kA4([P30.parse({tool:"*",action:"allow"})]),DA4({bypass:!0})}function X13(A){if(A.threadId&&!I9(A.threadId))delete A.threadId}async function hK0(A,Q,B,$){if(Q.headless)return D13(A,Q,B);let J=await l8(A,Q),Y=await J.serverStatusPromise,Z=tA(Y)&&jt(Y.features,LB.THREAD_ACTORS_TUI),F=Z&&!Q.takeMeBack;if(Q.showWelcome&&Q.hideWelcome)throw await J.asyncDispose(),new l1("Cannot use --show-welcome and --hide-welcome together",1);if(Q.showWelcome&&!Z)throw await J.asyncDispose(),new l1("--show-welcome is only available with the new Amp CLI feature flag",1);if(F){let X=!A.executeMode&&await t03();return F13(),X13(Q),G13(A,Q,B,J,{showNpmMigrationWelcome:X})}else{if(Q.threadId&&I9(Q.threadId)){let X=await r4.getThreadLinkInfo({thread:Q.threadId},{config:J.configService}).catch(()=>null);if(X?.ok&&X.result.usesThreadActors)throw await J.asyncDispose(),new l1(`Thread ${Q.threadId} was created with the Neo TUI and cannot be continued in the legacy CLI.`,1,"Re-run without --take-me-back to continue this thread.")}return V13(A,Q,B,$,{dependencies:J})}}async function D13(A,Q,B){let $=(H,q)=>{let N=Number(process.hrtime.bigint()-q)/1e6,I=wo0();j.info("Startup phase",{phase:H,phaseMs:Math.round(N),sinceMainMs:I===null?void 0:Math.round(I)})};p2(B,Q);let J=process.hrtime.bigint(),Y=await l8(A,Q);$("runMainThread:createThreadDependencies",J);let{serverStatus:Z}=Y;if(TX(Z))throw Lt(Z,A.ampURL);let F=tA(Z)?Z:null,X=F?.user.email;await B91(B,Q,Z);let D=VW(Z),G=vx(Q,D);if(G instanceof Error)j5(G.message);if(F&&!kM(Q.mode,X))throw new l1(`Agent mode '${Q.mode}' is only available for Amp employees`,1);if(process.env.AMP_EXECUTOR!=="1"&&(!X||!f7(X)))throw new l1("Headless executor mode is only available for Amp employees",1);vZ0();let U=await Y.secretStorage.get("apiKey",A.ampURL);if(!U)throw new l1("API key required for headless mode. Please run `amp login` first.",1);let K=typeof Q.headless==="string"&&Q.headless!=="true"?Q.headless:void 0;if(K&&!I9(K))throw new l1(`Invalid thread ID: ${K}`,1);let E=K?void 0:await R13({dependencies:Y,apiKey:U,visibility:G??void 0}),z=K??E?.threadId;if(!z)throw new l1("Failed to resolve headless thread ID",1);let W=await Sf4(z);if(W.status==="already-running")await Y.asyncDispose(),await Wz(),process.exit(0);try{await Mf4({ampURL:A.ampURL,apiKey:U,workspaceRoot:process.cwd(),threadId:z,ownerUserId:E?.ownerUserId,threadVersion:E?.threadVersion,agentMode:E?.agentMode,initialToolDiscovery:Promise.all([Y.mcpService.initialized,Y.toolboxService.initialized,Y.pluginService.initialized]).then(()=>{return}),configService:Y.configService,mcpService:Y.mcpService,toolService:Y.toolService,skillService:Y.skillService,pluginService:Y.pluginService,pluginPlatform:Y.headlessPluginPlatform})}finally{await W.release(),await Y.asyncDispose()}await Wz(),process.exit(0)}async function G13(A,Q,B,$,J){let{userInput:Y,stdinInput:Z}=await b3A(Q),F=!!Q.streamJson||!!Q.streamJsonThinking;u3A({...Q,streamJson:F},A.executeMode,Y),p2(B,Q),UT4(),vZ0();let X=Q.threadId,D=Q.resumeThreadIDs??(X?[X]:[]),G=Q.observe?L2(Q.observe)??oB(Q.observe):void 0,V=await $.serverStatusPromise;if(TX(V))throw Lt(V,A.ampURL);let U=VW(V),K=vx(Q,U);if(K instanceof Error)j5(K.message);let E=null,z=async()=>{let q=$.consumeDraftNewThreadVisibility();if(q!==null)return q;return E??=(async()=>{let N=await qa(A.settings,process.cwd(),U,K);if(N instanceof Error)j5(N.message);return N})(),E},W=await $.secretStorage.get("apiKey",A.ampURL);if(!W)throw new l1("API key required. Please run `amp login` first.",1);let H=tA(V)&&f7(V.user.email);if(A.executeMode){if(D.length>1)throw new l1("Execute mode can only resume one thread.",1);Ge0($.mcpService,A.settings);try{let q=bK0(B,Q),N=await vz(),I=X?q:RX0({agentMode:Q.mode,explicitEffort:q,sessionState:N}),w=X?void 0:PX0(await Rf($.configService),{agentMode:Q.mode,explicitEffort:q,sessionState:N}),O=X?void 0:await z(),L=await ry4({apiKey:W,ampURL:A.ampURL,workspaceRoot:process.cwd(),dependencies:$,userInput:Y,stdinInput:Z,stats:!!Q.stats,streamJson:F,streamJsonThinking:!!Q.streamJsonThinking,streamJsonInput:!!Q.streamJsonInput,stdin:process.stdin,agentMode:Q.mode,reasoningEffort:I,labels:Q.label,initialThreadID:X,initialThreadMeta:O,initialSettings:w});if(await Ot(L,"execute"),Q.archive)await $.threadService.archive(L,!0)}finally{await $.asyncDispose()}await Wz(),process.exit(0)}else{let q=bK0(B,Q),N=J.showNpmMigrationWelcome?"npm-migration":"intro",I=oF0("0.0.1779083535-g196e66",$.settingsStorage,{startDelayMs:3000}),w=new jX0($.mcpService,A.settings.getWorkspaceRootPath()),O=jl($.configService),L=new gs($.fuzzyServer),R=process.cwd();await yr4({ampURL:A.ampURL,apiKey:W,rivetEndpoint:process.env.RIVET_PUBLIC_ENDPOINT??vF(A.ampURL),configService:$.configService,toolService:$.toolService,pluginPlatform:$.pluginPlatform,pluginService:$.pluginService,skillService:$.skillService,mcpService:$.mcpService,readFileSystemDirectory:({uri:v})=>Ff({workspaceRoot:R},v),completionBuilder:L,updateService:I,workspaceRoot:R,listThreads:()=>O.listThreads(),getThreadFromServer:(v)=>O.getThread(v),toolboxes:$.toolboxService.toolboxes,isInternalUser:H,settingsFilePath:$.settingsStorage.getSettingsFilePath(),workspaceSettingsFilePath:$.settingsStorage.getWorkspaceSettingsPath(),mcpTrustHandler:w,setActiveThreadID:(v)=>$.activeThread$.next(v),dispose:()=>{return w.dispose(),I.dispose(),$.asyncDispose()}},{initialThreadIDs:G?[G]:D,initialUserInput:Y||void 0,getDefaultNewThreadVisibility:z,onFirstFrame:Q.ide?y3A:void 0,openThreadPickerOnStart:Q.openThreadSwitcher,observerOnly:!!G,splashOrbVisualStyle:"neo",hideNeoWelcome:!!Q.hideWelcome,showNeoWelcome:Q.showWelcome,neoWelcomeVariant:N,initialAgentMode:B.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0,initialReasoningEffort:q}),process.exit(0)}}async function V13(A,Q,B,$,J){let Y=process.hrtime.bigint(),Z=(A0,R0)=>{let B0=Number(process.hrtime.bigint()-R0)/1e6,M0=wo0();j.info("Startup phase",{phase:A0,phaseMs:Math.round(B0),sinceMainMs:M0===null?void 0:Math.round(M0)})},{userInput:F,stdinInput:X}=await b3A(Q),D=!!Q.streamJson||!!Q.streamJsonThinking;u3A({...Q,streamJson:D},A.executeMode,F),p2(B,Q);let G=process.hrtime.bigint(),V=J?.dependencies??await l8(A,Q),U=V.hasAPIKeyAtStartup,K=V.serverStatus==="pending";if(j.info("Interactive auth startup mode",{deferInteractiveAuth:K,hasAPIKeyAtStartup:U,executeMode:A.executeMode,headless:Boolean(Q.headless)}),!J)Z("runMainThread:createThreadDependencies",G);let{serverStatus:E}=V;if(!K&&TX(E))throw Lt(E,A.ampURL);let z=tA(E)?E:null,W=z?.user.email,H=!!(W&&f7(W));if(H)vZ0();if(!K)await B91(B,Q,E);let q=VW(E),N=q?.features??[],I=q?.team??null,w=vx(Q,q);if(w instanceof Error)j5(w.message);if(z&&!kM(Q.mode,W))throw new l1(`Agent mode '${Q.mode}' is only available for Amp employees`,1);let O=Q.threadId&&I9(Q.threadId)?Q.threadId:void 0;G=process.hrtime.bigint();let L=await gK0(V);Z("runMainThread:createWorkerDeps",G);let R=A.executeMode?void 0:async(A0)=>Ot(A0,"interactive"),v={threadService:V.threadService,workerDeps:L,createThread:async(A0)=>{let R0=K?await V.serverStatusPromise:E,B0=await qa(A.settings,process.cwd(),VW(R0),w);if(B0 instanceof Error)j5(B0.message);return P81(L,{threadMeta:B0,agentMode:A0??Q.mode,onFirstAssistantMessage:R})},validateThreadOwnership:async(A0,R0)=>{if(R0?.nonBlockingOwnershipCheck){P3A(A0,V.configService,V.viewerUserIDPromise).catch((B0)=>{if(B0 instanceof l1){if(R0.onOwnershipError){R0.onOwnershipError(B0,A0);return}qz(B0,A0);return}j.warn("Failed to validate thread ownership in CLI, allowing to open",{error:B0})});return}try{await P3A(A0,V.configService,V.viewerUserIDPromise)}catch(B0){if(B0 instanceof l1)throw B0;j.warn("Failed to validate thread ownership in CLI, allowing to open",{error:B0})}},switchThreadVisibility:w,switchThreadAgentMode:Q.mode,onFirstAssistantMessage:R,handleError:qz},T=async()=>{try{return AAA(v,Q.threadId,{nonBlockingOwnershipCheck:Q.nonBlockingThreadOwnershipCheck})}catch(A0){if(A0 instanceof l1)throw A0;throw await qz(A0,Q.threadId),Error("handleError should have called process.exit()")}},f=(async()=>{if(K){j.info("Skipping initial free tier status fetch until auth is complete");return}try{let A0=await V.configService.getLatest(),R0=Pm(A0),B0=await r4.getUserFreeTierStatus({},{config:V.configService,signal:AbortSignal.timeout(R0)});if(B0.ok)return j.info("User free tier status:",B0),B0.result;return}catch(A0){j.error("Failed to fetch free tier status:",A0);return}})(),u=!A.executeMode?new e61:null,k,b=null;if(u)k=u,b=(async()=>{let A0=K?await V.serverStatusPromise:V.serverStatus;if(TX(A0))throw Lt(A0,A.ampURL);await B91(B,Q,A0);let R0=process.hrtime.bigint(),B0=await T();if(Z("runMainThread:createThreadPool",R0),u.attach(B0),F){let M0=await S1(B0.threadHandles$);if(!M0)throw new l1("No active thread is available yet.",1);await M0.sendMessage({content:[{type:"text",text:F}]})}})(),b.catch(async(A0)=>{let R0=A0 instanceof Error?A0:Error(String(A0));u.setInitError(R0),await qz(A0,Q.threadId)});else G=process.hrtime.bigint(),k=await T(),Z("runMainThread:createThreadPool",G);let d=Q.notifications!==void 0?Q.notifications:!A.executeMode;G=process.hrtime.bigint();let c=await V.configService.getLatest();if(Z("runMainThread:configService.getLatest",G),G=process.hrtime.bigint(),$13({configService:V.configService,threadService:V.threadService,config:c,useNotificationsForService:d,threadViewStates$:()=>k.threadHandles$.pipe(f4((A0)=>{if(!A0)return u0.of({});return M6(A0.thread$,A0.threadViewState$).pipe(w1(([R0,B0])=>({[R0.id]:B0})))}))}),Z("runMainThread:createCliNotificationService",G),A.executeMode){Ge0(V.mcpService,A.settings);let A0=bK0(B,Q),R0=await vz(),B0=O?A0:RX0({agentMode:Q.mode,explicitEffort:A0,sessionState:R0}),M0={userInput:F,stdinInput:X,dependencies:V,streamJson:D,streamJsonInput:!!Q.streamJsonInput,streamJsonThinking:!!Q.streamJsonThinking,stats:!!Q.stats,ampURL:A.ampURL,isInternalUser:H,agentMode:Q.mode,reasoningEffort:B0,labels:Q.label},n=await aT4({threadPool:k,...M0});if(await Ot(n,"execute"),Q.archive)await V.threadService.archive(n,!0);await V.asyncDispose(),process.exit(0)}let h=!1,i=!1;if(Q.jetbrains||Q.ide){await m30();let A0=await yX({jetbrainsOnly:Q.jetbrains});if(A0.length===0){if(Q.jetbrains)h=!await V.configService.get("jetbrains.skipInstall")}else if(A0.length===1){let R0=A0[0];if(R0)l3.selectConfig(R0)}else i=!0}G=process.hrtime.bigint();let r=oF0("0.0.1779083535-g196e66",V.settingsStorage,{startDelayMs:3000});Z("runMainThread:createUpdateService",G),G=process.hrtime.bigint();let Q0=new jX0(V.mcpService,A.settings.getWorkspaceRootPath());if(Z("runMainThread:createMcpTrustHandler",G),F&&A.executeMode){let A0=await S1(k.threadHandles$);if(!A0)throw new l1("No active thread is available yet.",1);await A0.sendMessage({content:[{type:"text",text:F}]})}G=process.hrtime.bigint();let w0=await vz();Z("runMainThread:loadSessionState",G),j.info("Loaded session state:",w0);let X0=bK0(B,Q),H0={...w0,launchCount:w0.launchCount+1,lastReasoningEffortByMode:X0?{...w0.lastReasoningEffortByMode,[Q.mode]:X0}:w0.lastReasoningEffortByMode};rQ((A0)=>({...A0,launchCount:A0.launchCount+1}));try{if(G=process.hrtime.bigint(),await Kt4({history:new Bo,fuzzyServer:V.fuzzyServer,settingsStorage:V.settingsStorage,threadService:V.threadService,skillService:V.skillService,configService:V.configService,secretStorage:V.secretStorage,internalAPIClient:r4,threadPool:k,createSystemPromptDeps:async()=>f3A(V),ideClient:l3,mcpService:V.mcpService,toolboxService:V.toolboxService,mcpTrustHandler:Q0,updateService:r,pluginPlatform:V.pluginPlatform,pluginService:V.pluginService},{initialServerStatus:V.serverStatus,stdout:process.stdout,hasAPIKeyAtStartup:V.hasAPIKeyAtStartup,ampURL:A.ampURL,startupThreadID:O,showJetBrainsInstaller:h,showIdePickerHint:i,openThreadSwitcher:Q.openThreadSwitcher,jetbrainsMode:Q.jetbrains,clientId:g03,logFile:{path:$},sessionState:H0,freeTierStatusPromise:f,workspace:I??null,features:N,isInternalUser:H,initialAgentMode:B.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0,splashOrbVisualStyle:Q.neoOrb?"neo":"classic",buildTimestamp:"2026-05-18T05:57:03.595Z"},(A0)=>new Z51({...A0,threadPool:A0.threadPool},(R0)=>new j81({...R0,threadState:R0.threadState}))),Z("runMainThread:mountApp-returned",G),b)await b}finally{await k.dispose().catch((A0)=>{j.error("Failed to dispose thread pool during shutdown",A0)})}await V.asyncDispose(),Z("runMainThread:dependencies.asyncDispose",Y),process.exit(0)}async function a5(A){if(j.info("Initializing CLI context",{argv:process.argv,nodeEnv:"production",hasAmpURL:Boolean(process.env.AMP_URL),hasAmpAPIKey:Boolean(process.env.AMP_API_KEY),hasSettingsFile:Boolean(process.env.AMP_SETTINGS_FILE)}),A.interactive)XB.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
7860
|
+
`);let Q=!!A.execute||!process.stdout.isTTY&&!A.streamJson,B=process.stdout.isTTY&&process.stderr.isTTY;j.info("Execution mode resolved",{executeMode:Q,stdoutTTY:process.stdout.isTTY,stderrTTY:process.stderr.isTTY,streamJson:A.streamJson,executeFlag:A.execute});let $=await f74({get:async(F)=>{if(F!==fd)return;try{let X=await v3A(Q91,"utf-8");return JSON.parse(X).installationID}catch{return}},set:async(F,X)=>{if(F!==fd)return;await x03(Mt.dirname(Q91),{recursive:!0}),await b03(Q91,JSON.stringify({installationID:X},null,2),{mode:384})}},{clientType:"cli",platform:X90()});ge1($);let J=await Us4({...A,workspaceTrust:{current:!0,changes:_m},getHook:process.env.AMP_URL?(F,X)=>{if(F==="url")return Promise.resolve(process.env.AMP_URL);return X()}:void 0});if(A.mcpConfig){let F=await Mu4(A.mcpConfig);J=Lu4(J,F)}let Y=Mt.dirname(J.getSettingsFilePath());VR4(Kp,Y),J=Es1(J);let Z=await J.get("url","admin")??await J.get("url","global");if(!Z)Z=h7;if(j.info("Resolved Amp URL",{ampURL:Z,settingsFile:J.getSettingsFilePath(),workspaceRoot:J.getWorkspaceRootPath()}),!bH(Z))j.info("Targeting custom Amp server",{ampURL:Z});return{executeMode:Q,isTTY:B,ampURL:Z,settings:J,secrets:Zs4(await c61(A,J))}}function U13(A){let Q={};for(let B=0;B<A.length;B++){let $=A[B];if($?.startsWith("--")){let Y=$.slice(2).replace(/-([a-z])/g,(F,X)=>X.toUpperCase()),Z=A[B+1];if(Z&&!Z.startsWith("--"))Q[Y]=Z,B++}}return Q}function K13(A,Q){let B=A.includes("--headless")||A.some((J)=>J.startsWith("--headless=")),$=Mt.resolve(Q.logFile??process.env.AMP_LOG_FILE??(B?h03:Ha));return{logLevel:Q.logLevel??process.env.AMP_LOG_LEVEL??"info",logFile:$}}async function E13(){ZT4();let A=U13(process.argv),Q=K13(process.argv,A),B=KT4(Q);OZ0("silent");let $=process.argv.includes("--no-color"),J=process.argv.includes("--color"),Y=process.stdout.isTTY&&process.stderr.isTTY;if($||!J&&!Y)t0.level=0;if(p03(j),j.info("Starting Amp CLI.",{version:"0.0.1779083535-g196e66",buildTimestamp:"2026-05-18T05:57:03.595Z"}),process.platform==="win32"&&Hj())Cx4();if(parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new l1(K7.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await Z13(B).parseAsync(process.argv)}DR4().startActiveSpan("main",async(A)=>{process.on("exit",()=>A.end()),await E13().catch(qz)});async function z13(A,Q){let B=A.ampURL.includes("localhost")||A.ampURL.includes("127.0.0.1");if(process.env.AMP_URL&&!B)await A.settings.set("url",process.env.AMP_URL,"global"),t6.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
7861
7861
|
`);else if(!bH(A.ampURL))t6.write(`Logging in to ${new URL(A.ampURL).hostname}
|
|
7862
7862
|
`);let $=process.env.AMP_API_KEY;if($)t6.write(`API key found in environment variable, storing...
|
|
7863
7863
|
`),await Q.set("apiKey",$,A.ampURL),t6.write(`API key successfully stored.
|