@sourcegraph/amp 0.0.1780162602-gb8f27a → 0.0.1780172352-gac8e8a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +11 -11
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -213,7 +213,7 @@ ${E}
213
213
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of A.seen.entries()){let U=J[1];if(Q===J[0]){D(J);continue}if(A.external){let Z=A.external.registry.get(J[0])?.id;if(Q!==J[0]&&Z){D(J);continue}}if(A.metadataRegistry.get(J[0])?.id){D(J);continue}if(U.cycle){D(J);continue}if(U.count>1){if(A.reused==="ref"){D(J);continue}}}}function qG(A,Q){let $=A.seen.get(Q);if(!$)throw Error("Unprocessed schema. This is a bug in Zod.");let B=(J)=>{let U=A.seen.get(J);if(U.ref===null)return;let Y=U.def??U.schema,Z={...Y},F=U.ref;if(U.ref=null,F){B(F);let I=A.seen.get(F),G=I.schema;if(G.$ref&&(A.target==="draft-07"||A.target==="draft-04"||A.target==="openapi-3.0"))Y.allOf=Y.allOf??[],Y.allOf.push(G);else Object.assign(Y,G);if(Object.assign(Y,Z),J._zod.parent===F)for(let z in Y){if(z==="$ref"||z==="allOf")continue;if(!(z in Z))delete Y[z]}if(G.$ref&&I.def)for(let z in Y){if(z==="$ref"||z==="allOf")continue;if(z in I.def&&JSON.stringify(Y[z])===JSON.stringify(I.def[z]))delete Y[z]}}let X=J._zod.parent;if(X&&X!==F){B(X);let I=A.seen.get(X);if(I?.schema.$ref){if(Y.$ref=I.schema.$ref,I.def)for(let G in Y){if(G==="$ref"||G==="allOf")continue;if(G in I.def&&JSON.stringify(Y[G])===JSON.stringify(I.def[G]))delete Y[G]}}}A.override({zodSchema:J,jsonSchema:Y,path:U.path??[]})};for(let J of[...A.seen.entries()].reverse())B(J[0]);let E={};if(A.target==="draft-2020-12")E.$schema="https://json-schema.org/draft/2020-12/schema";else if(A.target==="draft-07")E.$schema="http://json-schema.org/draft-07/schema#";else if(A.target==="draft-04")E.$schema="http://json-schema.org/draft-04/schema#";else if(A.target==="openapi-3.0");if(A.external?.uri){let J=A.external.registry.get(Q)?.id;if(!J)throw Error("Schema is missing an `id` property");E.$id=A.external.uri(J)}Object.assign(E,$.def??$.schema);let D=A.external?.defs??{};for(let J of A.seen.entries()){let U=J[1];if(U.def&&U.defId)D[U.defId]=U.def}if(A.external);else if(Object.keys(D).length>0)if(A.target==="draft-2020-12")E.$defs=D;else E.definitions=D;try{let J=JSON.parse(JSON.stringify(E));return Object.defineProperty(J,"~standard",{value:{...Q["~standard"],jsonSchema:{input:rM(Q,"input",A.processors),output:rM(Q,"output",A.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function w7(A,Q){let $=Q??{seen:new Set};if($.seen.has(A))return!1;$.seen.add(A);let B=A._zod.def;if(B.type==="transform")return!0;if(B.type==="array")return w7(B.element,$);if(B.type==="set")return w7(B.valueType,$);if(B.type==="lazy")return w7(B.getter(),$);if(B.type==="promise"||B.type==="optional"||B.type==="nonoptional"||B.type==="nullable"||B.type==="readonly"||B.type==="default"||B.type==="prefault")return w7(B.innerType,$);if(B.type==="intersection")return w7(B.left,$)||w7(B.right,$);if(B.type==="record"||B.type==="map")return w7(B.keyType,$)||w7(B.valueType,$);if(B.type==="pipe")return w7(B.in,$)||w7(B.out,$);if(B.type==="object"){for(let E in B.shape)if(w7(B.shape[E],$))return!0;return!1}if(B.type==="union"){for(let E of B.options)if(w7(E,$))return!0;return!1}if(B.type==="tuple"){for(let E of B.items)if(w7(E,$))return!0;if(B.rest&&w7(B.rest,$))return!0;return!1}return!1}var kK0=(A,Q={})=>($)=>{let B=HG({...$,processors:Q});return Y6(A,B),NG(B,A),qG(B,A)},rM=(A,Q,$={})=>(B)=>{let{libraryOptions:E,target:D}=B??{},J=HG({...E??{},target:D,io:Q,processors:$});return Y6(A,J),NG(J,A),qG(J,A)};var Py=C0(()=>{cf()});function sM(A,Q){if("_idmap"in A){let B=A,E=HG({...Q,processors:Et}),D={};for(let Y of B._idmap.entries()){let[Z,F]=Y;Y6(F,E)}let J={},U={registry:B,uri:Q?.uri,defs:D};E.external=U;for(let Y of B._idmap.entries()){let[Z,F]=Y;NG(E,F),J[Z]=qG(E,F)}if(Object.keys(D).length>0){let Y=E.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[Y]:D}}return{schemas:J}}let $=HG({...Q,processors:Et});return Y6(A,$),NG($,A),qG($,A)}var __1,fK0=(A,Q,$,B)=>{let E=$;E.type="string";let{minimum:D,maximum:J,format:U,patterns:Y,contentEncoding:Z}=A._zod.bag;if(typeof D==="number")E.minLength=D;if(typeof J==="number")E.maxLength=J;if(U){if(E.format=__1[U]??U,E.format==="")delete E.format;if(U==="time")delete E.format}if(Z)E.contentEncoding=Z;if(Y&&Y.size>0){let F=[...Y];if(F.length===1)E.pattern=F[0].source;else if(F.length>1)E.allOf=[...F.map((X)=>({...Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},yK0=(A,Q,$,B)=>{let E=$,{minimum:D,maximum:J,format:U,multipleOf:Y,exclusiveMaximum:Z,exclusiveMinimum:F}=A._zod.bag;if(typeof U==="string"&&U.includes("int"))E.type="integer";else E.type="number";if(typeof F==="number")if(Q.target==="draft-04"||Q.target==="openapi-3.0")E.minimum=F,E.exclusiveMinimum=!0;else E.exclusiveMinimum=F;if(typeof D==="number"){if(E.minimum=D,typeof F==="number"&&Q.target!=="draft-04")if(F>=D)delete E.minimum;else delete E.exclusiveMinimum}if(typeof Z==="number")if(Q.target==="draft-04"||Q.target==="openapi-3.0")E.maximum=Z,E.exclusiveMaximum=!0;else E.exclusiveMaximum=Z;if(typeof J==="number"){if(E.maximum=J,typeof Z==="number"&&Q.target!=="draft-04")if(Z<=J)delete E.maximum;else delete E.exclusiveMaximum}if(typeof Y==="number")E.multipleOf=Y},xK0=(A,Q,$,B)=>{$.type="boolean"},bK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},hK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},gK0=(A,Q,$,B)=>{if(Q.target==="openapi-3.0")$.type="string",$.nullable=!0,$.enum=[null];else $.type="null"},mK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},dK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},cK0=(A,Q,$,B)=>{$.not={}},pK0=(A,Q,$,B)=>{},lK0=(A,Q,$,B)=>{},iK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},nK0=(A,Q,$,B)=>{let E=A._zod.def,D=Hk(E.entries);if(D.every((J)=>typeof J==="number"))$.type="number";if(D.every((J)=>typeof J==="string"))$.type="string";$.enum=D},aK0=(A,Q,$,B)=>{let E=A._zod.def,D=[];for(let J of E.values)if(J===void 0){if(Q.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(Q.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else D.push(Number(J));else D.push(J);if(D.length===0);else if(D.length===1){let J=D[0];if($.type=J===null?"null":typeof J,Q.target==="draft-04"||Q.target==="openapi-3.0")$.enum=[J];else $.const=J}else{if(D.every((J)=>typeof J==="number"))$.type="number";if(D.every((J)=>typeof J==="string"))$.type="string";if(D.every((J)=>typeof J==="boolean"))$.type="boolean";if(D.every((J)=>J===null))$.type="null";$.enum=D}},oK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},rK0=(A,Q,$,B)=>{let E=$,D=A._zod.pattern;if(!D)throw Error("Pattern not found in template literal");E.type="string",E.pattern=D.source},sK0=(A,Q,$,B)=>{let E=$,D={type:"string",format:"binary",contentEncoding:"binary"},{minimum:J,maximum:U,mime:Y}=A._zod.bag;if(J!==void 0)D.minLength=J;if(U!==void 0)D.maxLength=U;if(Y)if(Y.length===1)D.contentMediaType=Y[0],Object.assign(E,D);else Object.assign(E,D),E.anyOf=Y.map((Z)=>({contentMediaType:Z}));else Object.assign(E,D)},tK0=(A,Q,$,B)=>{$.type="boolean"},eK0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},AW0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},QW0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},$W0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},BW0=(A,Q,$,B)=>{if(Q.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},EW0=(A,Q,$,B)=>{let E=$,D=A._zod.def,{minimum:J,maximum:U}=A._zod.bag;if(typeof J==="number")E.minItems=J;if(typeof U==="number")E.maxItems=U;E.type="array",E.items=Y6(D.element,Q,{...B,path:[...B.path,"items"]})},DW0=(A,Q,$,B)=>{let E=$,D=A._zod.def;E.type="object",E.properties={};let J=D.shape;for(let Z in J)E.properties[Z]=Y6(J[Z],Q,{...B,path:[...B.path,"properties",Z]});let U=new Set(Object.keys(J)),Y=new Set([...U].filter((Z)=>{let F=D.shape[Z]._zod;if(Q.io==="input")return F.optin===void 0;else return F.optout===void 0}));if(Y.size>0)E.required=Array.from(Y);if(D.catchall?._zod.def.type==="never")E.additionalProperties=!1;else if(!D.catchall){if(Q.io==="output")E.additionalProperties=!1}else if(D.catchall)E.additionalProperties=Y6(D.catchall,Q,{...B,path:[...B.path,"additionalProperties"]})},Dt=(A,Q,$,B)=>{let E=A._zod.def,D=E.inclusive===!1,J=E.options.map((U,Y)=>Y6(U,Q,{...B,path:[...B.path,D?"oneOf":"anyOf",Y]}));if(D)$.oneOf=J;else $.anyOf=J},JW0=(A,Q,$,B)=>{let E=A._zod.def,D=Y6(E.left,Q,{...B,path:[...B.path,"allOf",0]}),J=Y6(E.right,Q,{...B,path:[...B.path,"allOf",1]}),U=(Z)=>("allOf"in Z)&&Object.keys(Z).length===1,Y=[...U(D)?D.allOf:[D],...U(J)?J.allOf:[J]];$.allOf=Y},UW0=(A,Q,$,B)=>{let E=$,D=A._zod.def;E.type="array";let J=Q.target==="draft-2020-12"?"prefixItems":"items",U=Q.target==="draft-2020-12"?"items":Q.target==="openapi-3.0"?"items":"additionalItems",Y=D.items.map((I,G)=>Y6(I,Q,{...B,path:[...B.path,J,G]})),Z=D.rest?Y6(D.rest,Q,{...B,path:[...B.path,U,...Q.target==="openapi-3.0"?[D.items.length]:[]]}):null;if(Q.target==="draft-2020-12"){if(E.prefixItems=Y,Z)E.items=Z}else if(Q.target==="openapi-3.0"){if(E.items={anyOf:Y},Z)E.items.anyOf.push(Z);if(E.minItems=Y.length,!Z)E.maxItems=Y.length}else if(E.items=Y,Z)E.additionalItems=Z;let{minimum:F,maximum:X}=A._zod.bag;if(typeof F==="number")E.minItems=F;if(typeof X==="number")E.maxItems=X},YW0=(A,Q,$,B)=>{let E=$,D=A._zod.def;E.type="object";let J=D.keyType,Y=J._zod.bag?.patterns;if(D.mode==="loose"&&Y&&Y.size>0){let F=Y6(D.valueType,Q,{...B,path:[...B.path,"patternProperties","*"]});E.patternProperties={};for(let X of Y)E.patternProperties[X.source]=F}else{if(Q.target==="draft-07"||Q.target==="draft-2020-12")E.propertyNames=Y6(D.keyType,Q,{...B,path:[...B.path,"propertyNames"]});E.additionalProperties=Y6(D.valueType,Q,{...B,path:[...B.path,"additionalProperties"]})}let Z=J._zod.values;if(Z){let F=[...Z].filter((X)=>typeof X==="string"||typeof X==="number");if(F.length>0)E.required=F}},ZW0=(A,Q,$,B)=>{let E=A._zod.def,D=Y6(E.innerType,Q,B),J=Q.seen.get(A);if(Q.target==="openapi-3.0")J.ref=E.innerType,$.nullable=!0;else $.anyOf=[D,{type:"null"}]},FW0=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);D.ref=E.innerType},XW0=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);D.ref=E.innerType,$.default=JSON.parse(JSON.stringify(E.defaultValue))},IW0=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);if(D.ref=E.innerType,Q.io==="input")$._prefault=JSON.parse(JSON.stringify(E.defaultValue))},GW0=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);D.ref=E.innerType;let J;try{J=E.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}$.default=J},VW0=(A,Q,$,B)=>{let E=A._zod.def,D=Q.io==="input"?E.in._zod.def.type==="transform"?E.out:E.in:E.out;Y6(D,Q,B);let J=Q.seen.get(A);J.ref=D},zW0=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);D.ref=E.innerType,$.readOnly=!0},KW0=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);D.ref=E.innerType},Jt=(A,Q,$,B)=>{let E=A._zod.def;Y6(E.innerType,Q,B);let D=Q.seen.get(A);D.ref=E.innerType},WW0=(A,Q,$,B)=>{let E=A._zod.innerType;Y6(E,Q,B);let D=Q.seen.get(A);D.ref=E},Et;var tM=C0(()=>{Py();_4();__1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Et={string:fK0,number:yK0,boolean:xK0,bigint:bK0,symbol:hK0,null:gK0,undefined:mK0,void:dK0,never:cK0,any:pK0,unknown:lK0,date:iK0,enum:nK0,literal:aK0,nan:oK0,template_literal:rK0,file:sK0,success:tK0,custom:eK0,function:AW0,transform:QW0,map:$W0,set:BW0,array:EW0,object:DW0,union:Dt,intersection:JW0,tuple:UW0,record:YW0,nullable:ZW0,nonoptional:FW0,default:XW0,prefault:IW0,catch:GW0,pipe:VW0,readonly:zW0,promise:KW0,optional:Jt,lazy:WW0}});class CW0{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=HG({processors:Et,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 Y6(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}NG(this.ctx,A);let $=qG(this.ctx,A),{"~standard":B,...E}=$;return E}}var qTA=C0(()=>{tM();Py()});var uTA={};var wTA=()=>{};var R8={};YB(R8,{version:()=>Tz0,util:()=>RA,treeifyError:()=>Ok,toJSONSchema:()=>sM,toDotPath:()=>AvA,safeParseAsync:()=>JG,safeParse:()=>XF,safeEncodeAsync:()=>yV0,safeEncode:()=>kV0,safeDecodeAsync:()=>xV0,safeDecode:()=>fV0,registry:()=>wM,regexes:()=>A3,process:()=>Y6,prettifyError:()=>Lk,parseAsync:()=>DG,parse:()=>EG,meta:()=>jy,locales:()=>KC,isValidJWT:()=>HvA,isValidBase64URL:()=>CvA,isValidBase64:()=>kz0,initializeContext:()=>HG,globalRegistry:()=>Q3,globalConfig:()=>Kk,formatError:()=>XC,flattenError:()=>FC,finalize:()=>qG,extractDefs:()=>NG,encodeAsync:()=>_V0,encode:()=>vV0,describe:()=>Ly,decodeAsync:()=>SV0,decode:()=>TV0,createToJSONSchemaMethod:()=>kK0,createStandardJSONSchemaMethod:()=>rM,config:()=>h$,clone:()=>_B,_xor:()=>F_1,_xid:()=>kM,_void:()=>Cy,_uuidv7:()=>RM,_uuidv6:()=>jM,_uuidv4:()=>LM,_uuid:()=>OM,_url:()=>UG,_uppercase:()=>FG,_unknown:()=>Ky,_union:()=>Z_1,_undefined:()=>Gy,_ulid:()=>SM,_uint64:()=>Xy,_uint32:()=>Dy,_tuple:()=>G_1,_trim:()=>KG,_transform:()=>N_1,_toUpperCase:()=>CG,_toLowerCase:()=>WG,_templateLiteral:()=>P_1,_symbol:()=>Iy,_superRefine:()=>Oy,_success:()=>O_1,_stringbool:()=>Ry,_stringFormat:()=>dJ,_string:()=>pf,_startsWith:()=>IG,_slugify:()=>oM,_size:()=>GF,_set:()=>K_1,_safeParseAsync:()=>KM,_safeParse:()=>zM,_safeEncodeAsync:()=>cs,_safeEncode:()=>ms,_safeDecodeAsync:()=>ps,_safeDecode:()=>ds,_regex:()=>YG,_refine:()=>My,_record:()=>V_1,_readonly:()=>R_1,_property:()=>aM,_promise:()=>T_1,_positive:()=>pM,_pipe:()=>j_1,_parseAsync:()=>VM,_parse:()=>GM,_overwrite:()=>m9,_optional:()=>q_1,_number:()=>ef,_nullable:()=>u_1,_null:()=>Vy,_normalize:()=>zG,_nonpositive:()=>iM,_nonoptional:()=>M_1,_nonnegative:()=>nM,_never:()=>Wy,_negative:()=>lM,_nativeEnum:()=>C_1,_nanoid:()=>vM,_nan:()=>qy,_multipleOf:()=>mU,_minSize:()=>FD,_minLength:()=>mJ,_min:()=>j3,_mime:()=>VG,_maxSize:()=>dU,_maxLength:()=>VF,_max:()=>m5,_map:()=>z_1,_mac:()=>nf,_lte:()=>m5,_lt:()=>YD,_lowercase:()=>ZG,_literal:()=>H_1,_length:()=>zF,_lazy:()=>v_1,_ksuid:()=>fM,_jwt:()=>cM,_isoTime:()=>sf,_isoDuration:()=>tf,_isoDateTime:()=>of,_isoDate:()=>rf,_ipv6:()=>xM,_ipv4:()=>yM,_intersection:()=>I_1,_int64:()=>Fy,_int32:()=>Ey,_int:()=>Qy,_includes:()=>XG,_guid:()=>WC,_gte:()=>j3,_gt:()=>ZD,_float64:()=>By,_float32:()=>$y,_file:()=>uy,_enum:()=>W_1,_endsWith:()=>GG,_encodeAsync:()=>hs,_encode:()=>xs,_emoji:()=>PM,_email:()=>MM,_e164:()=>dM,_discriminatedUnion:()=>X_1,_default:()=>w_1,_decodeAsync:()=>gs,_decode:()=>bs,_date:()=>Hy,_custom:()=>wy,_cuid2:()=>_M,_cuid:()=>TM,_coercedString:()=>lf,_coercedNumber:()=>Ay,_coercedDate:()=>Ny,_coercedBoolean:()=>Uy,_coercedBigint:()=>Zy,_cidrv6:()=>hM,_cidrv4:()=>bM,_check:()=>HTA,_catch:()=>L_1,_boolean:()=>Jy,_bigint:()=>Yy,_base64url:()=>mM,_base64:()=>gM,_array:()=>SK0,_any:()=>zy,TimePrecision:()=>af,NEVER:()=>UC,JSONSchemaGenerator:()=>CW0,JSONSchema:()=>uTA,Doc:()=>rs,$output:()=>mf,$input:()=>df,$constructor:()=>M0,$brand:()=>Wk,$ZodXor:()=>If,$ZodXID:()=>hk,$ZodVoid:()=>Zf,$ZodUnknown:()=>Uf,$ZodUnion:()=>VC,$ZodUndefined:()=>Ef,$ZodUUID:()=>Tk,$ZodURL:()=>Sk,$ZodULID:()=>bk,$ZodType:()=>z1,$ZodTuple:()=>NM,$ZodTransform:()=>qf,$ZodTemplateLiteral:()=>_f,$ZodSymbol:()=>Bf,$ZodSuccess:()=>jf,$ZodStringFormat:()=>U6,$ZodString:()=>IF,$ZodSet:()=>Wf,$ZodRegistry:()=>_K0,$ZodRecord:()=>zf,$ZodRealError:()=>j8,$ZodReadonly:()=>Tf,$ZodPromise:()=>kf,$ZodPrefault:()=>Of,$ZodPipe:()=>vf,$ZodOptional:()=>qM,$ZodObjectJIT:()=>fz0,$ZodObject:()=>$t,$ZodNumberFormat:()=>Qf,$ZodNumber:()=>CM,$ZodNullable:()=>wf,$ZodNull:()=>Df,$ZodNonOptional:()=>Lf,$ZodNever:()=>Yf,$ZodNanoID:()=>fk,$ZodNaN:()=>Pf,$ZodMap:()=>Kf,$ZodMAC:()=>nk,$ZodLiteral:()=>Hf,$ZodLazy:()=>ff,$ZodKSUID:()=>gk,$ZodJWT:()=>ek,$ZodIntersection:()=>Vf,$ZodISOTime:()=>ck,$ZodISODuration:()=>pk,$ZodISODateTime:()=>mk,$ZodISODate:()=>dk,$ZodIPv6:()=>ik,$ZodIPv4:()=>lk,$ZodGUID:()=>vk,$ZodFunction:()=>Sf,$ZodFile:()=>Nf,$ZodExactOptional:()=>uf,$ZodError:()=>Mk,$ZodEnum:()=>Cf,$ZodEncodeError:()=>YC,$ZodEmoji:()=>kk,$ZodEmail:()=>_k,$ZodE164:()=>tk,$ZodDiscriminatedUnion:()=>Gf,$ZodDefault:()=>Mf,$ZodDate:()=>Ff,$ZodCustomStringFormat:()=>Af,$ZodCustom:()=>yf,$ZodCodec:()=>zC,$ZodCheckUpperCase:()=>Mz0,$ZodCheckStringFormat:()=>WM,$ZodCheckStartsWith:()=>Lz0,$ZodCheckSizeEquals:()=>Cz0,$ZodCheckRegex:()=>uz0,$ZodCheckProperty:()=>Rz0,$ZodCheckOverwrite:()=>vz0,$ZodCheckNumberFormat:()=>Vz0,$ZodCheckMultipleOf:()=>Gz0,$ZodCheckMinSize:()=>Wz0,$ZodCheckMinLength:()=>Nz0,$ZodCheckMimeType:()=>Pz0,$ZodCheckMaxSize:()=>Kz0,$ZodCheckMaxLength:()=>Hz0,$ZodCheckLowerCase:()=>wz0,$ZodCheckLessThan:()=>ns,$ZodCheckLengthEquals:()=>qz0,$ZodCheckIncludes:()=>Oz0,$ZodCheckGreaterThan:()=>as,$ZodCheckEndsWith:()=>jz0,$ZodCheckBigIntFormat:()=>zz0,$ZodCheck:()=>C6,$ZodCatch:()=>Rf,$ZodCUID2:()=>xk,$ZodCUID:()=>yk,$ZodCIDRv6:()=>ok,$ZodCIDRv4:()=>ak,$ZodBoolean:()=>GC,$ZodBigIntFormat:()=>$f,$ZodBigInt:()=>HM,$ZodBase64URL:()=>sk,$ZodBase64:()=>rk,$ZodAsyncError:()=>gU,$ZodArray:()=>Xf,$ZodAny:()=>Jf});var SB=C0(()=>{_4();is();Bt();tM();qTA();wTA();YM();bV0();PV0();yz0();os();_z0();cf();NTA();Py()});var Ut={};YB(Ut,{uppercase:()=>FG,trim:()=>KG,toUpperCase:()=>CG,toLowerCase:()=>WG,startsWith:()=>IG,slugify:()=>oM,size:()=>GF,regex:()=>YG,property:()=>aM,positive:()=>pM,overwrite:()=>m9,normalize:()=>zG,nonpositive:()=>iM,nonnegative:()=>nM,negative:()=>lM,multipleOf:()=>mU,minSize:()=>FD,minLength:()=>mJ,mime:()=>VG,maxSize:()=>dU,maxLength:()=>VF,lte:()=>m5,lt:()=>YD,lowercase:()=>ZG,length:()=>zF,includes:()=>XG,gte:()=>j3,gt:()=>ZD,endsWith:()=>GG});var Yt=C0(()=>{SB()});var uG={};YB(uG,{time:()=>qW0,duration:()=>uW0,datetime:()=>HW0,date:()=>NW0,ZodISOTime:()=>Xt,ZodISODuration:()=>It,ZodISODateTime:()=>Zt,ZodISODate:()=>Ft});function HW0(A){return of(Zt,A)}function NW0(A){return rf(Ft,A)}function qW0(A){return sf(Xt,A)}function uW0(A){return tf(It,A)}var Zt,Ft,Xt,It;var vy=C0(()=>{SB();_y();Zt=M0("ZodISODateTime",(A,Q)=>{mk.init(A,Q),_6.init(A,Q)});Ft=M0("ZodISODate",(A,Q)=>{dk.init(A,Q),_6.init(A,Q)});Xt=M0("ZodISOTime",(A,Q)=>{ck.init(A,Q),_6.init(A,Q)});It=M0("ZodISODuration",(A,Q)=>{pk.init(A,Q),_6.init(A,Q)})});var MTA=(A,Q)=>{Mk.init(A,Q),A.name="ZodError",Object.defineProperties(A,{format:{value:($)=>XC(A,$)},flatten:{value:($)=>FC(A,$)},addIssue:{value:($)=>{A.issues.push($),A.message=JSON.stringify(A.issues,ZM,2)}},addIssues:{value:($)=>{A.issues.push(...$),A.message=JSON.stringify(A.issues,ZM,2)}},isEmpty:{get(){return A.issues.length===0}}})},k_1,P8;var wW0=C0(()=>{SB();SB();_4();k_1=M0("ZodError",MTA),P8=M0("ZodError",MTA,{Parent:Error})});var MW0,OW0,LW0,jW0,RW0,PW0,vW0,TW0,_W0,SW0,kW0,fW0;var yW0=C0(()=>{SB();wW0();MW0=GM(P8),OW0=VM(P8),LW0=zM(P8),jW0=KM(P8),RW0=xs(P8),PW0=bs(P8),vW0=hs(P8),TW0=gs(P8),_W0=ms(P8),SW0=ds(P8),kW0=cs(P8),fW0=ps(P8)});var Ty={};YB(Ty,{xor:()=>X_A,xid:()=>xTA,void:()=>U_A,uuidv7:()=>vTA,uuidv6:()=>PTA,uuidv4:()=>RTA,uuid:()=>jTA,url:()=>Kt,unknown:()=>S6,union:()=>H6,undefined:()=>J_A,ulid:()=>yTA,uint64:()=>E_A,uint32:()=>Q_A,tuple:()=>rW0,transform:()=>ft,templateLiteral:()=>u_A,symbol:()=>D_A,superRefine:()=>uC0,success:()=>H_A,stringbool:()=>P_A,stringFormat:()=>aTA,string:()=>P0,strictObject:()=>F_A,set:()=>z_A,refine:()=>qC0,record:()=>c6,readonly:()=>zC0,promise:()=>w_A,preprocess:()=>cy,prefault:()=>YC0,pipe:()=>fy,partialRecord:()=>I_A,optional:()=>s6,object:()=>oA,number:()=>qQ,nullish:()=>C_A,nullable:()=>ky,null:()=>DO,nonoptional:()=>ZC0,never:()=>kt,nativeEnum:()=>K_A,nanoid:()=>STA,nan:()=>N_A,meta:()=>j_A,map:()=>V_A,mac:()=>gTA,looseRecord:()=>G_A,looseObject:()=>VB,literal:()=>O4,lazy:()=>CC0,ksuid:()=>bTA,keyof:()=>Z_A,jwt:()=>nTA,json:()=>v_A,ipv6:()=>mTA,ipv4:()=>hTA,intersection:()=>JO,int64:()=>B_A,int32:()=>A_A,int:()=>Gt,instanceof:()=>R_A,httpUrl:()=>TTA,hostname:()=>oTA,hex:()=>rTA,hash:()=>sTA,guid:()=>LTA,function:()=>M_A,float64:()=>eTA,float32:()=>tTA,file:()=>W_A,exactOptional:()=>BC0,enum:()=>$5,emoji:()=>_TA,email:()=>OTA,e164:()=>iTA,discriminatedUnion:()=>gy,describe:()=>L_A,date:()=>Y_A,custom:()=>gt,cuid2:()=>fTA,cuid:()=>kTA,codec:()=>q_A,cidrv6:()=>cTA,cidrv4:()=>dTA,check:()=>O_A,catch:()=>IC0,boolean:()=>Z6,bigint:()=>$_A,base64url:()=>lTA,base64:()=>pTA,array:()=>mA,any:()=>St,_function:()=>M_A,_default:()=>JC0,_ZodString:()=>Vt,ZodXor:()=>iW0,ZodXID:()=>ut,ZodVoid:()=>pW0,ZodUnknown:()=>dW0,ZodUnion:()=>hy,ZodUndefined:()=>hW0,ZodUUID:()=>cU,ZodURL:()=>yy,ZodULID:()=>qt,ZodType:()=>b1,ZodTuple:()=>oW0,ZodTransform:()=>QC0,ZodTemplateLiteral:()=>KC0,ZodSymbol:()=>bW0,ZodSuccess:()=>FC0,ZodStringFormat:()=>_6,ZodString:()=>AO,ZodSet:()=>tW0,ZodRecord:()=>my,ZodReadonly:()=>VC0,ZodPromise:()=>HC0,ZodPrefault:()=>UC0,ZodPipe:()=>bt,ZodOptional:()=>yt,ZodObject:()=>by,ZodNumberFormat:()=>CC,ZodNumber:()=>$O,ZodNullable:()=>EC0,ZodNull:()=>gW0,ZodNonOptional:()=>xt,ZodNever:()=>cW0,ZodNanoID:()=>Ct,ZodNaN:()=>GC0,ZodMap:()=>sW0,ZodMAC:()=>xW0,ZodLiteral:()=>eW0,ZodLazy:()=>WC0,ZodKSUID:()=>wt,ZodJWT:()=>Tt,ZodIntersection:()=>aW0,ZodIPv6:()=>Ot,ZodIPv4:()=>Mt,ZodGUID:()=>Sy,ZodFunction:()=>NC0,ZodFile:()=>AC0,ZodExactOptional:()=>$C0,ZodEnum:()=>eM,ZodEmoji:()=>Wt,ZodEmail:()=>zt,ZodE164:()=>vt,ZodDiscriminatedUnion:()=>nW0,ZodDefault:()=>DC0,ZodDate:()=>xy,ZodCustomStringFormat:()=>QO,ZodCustom:()=>dy,ZodCodec:()=>ht,ZodCatch:()=>XC0,ZodCUID2:()=>Nt,ZodCUID:()=>Ht,ZodCIDRv6:()=>jt,ZodCIDRv4:()=>Lt,ZodBoolean:()=>BO,ZodBigIntFormat:()=>_t,ZodBigInt:()=>EO,ZodBase64URL:()=>Pt,ZodBase64:()=>Rt,ZodArray:()=>lW0,ZodAny:()=>mW0});function P0(A){return pf(AO,A)}function OTA(A){return MM(zt,A)}function LTA(A){return WC(Sy,A)}function jTA(A){return OM(cU,A)}function RTA(A){return LM(cU,A)}function PTA(A){return jM(cU,A)}function vTA(A){return RM(cU,A)}function Kt(A){return UG(yy,A)}function TTA(A){return UG(yy,{protocol:/^https?$/,hostname:A3.domain,...RA.normalizeParams(A)})}function _TA(A){return PM(Wt,A)}function STA(A){return vM(Ct,A)}function kTA(A){return TM(Ht,A)}function fTA(A){return _M(Nt,A)}function yTA(A){return SM(qt,A)}function xTA(A){return kM(ut,A)}function bTA(A){return fM(wt,A)}function hTA(A){return yM(Mt,A)}function gTA(A){return nf(xW0,A)}function mTA(A){return xM(Ot,A)}function dTA(A){return bM(Lt,A)}function cTA(A){return hM(jt,A)}function pTA(A){return gM(Rt,A)}function lTA(A){return mM(Pt,A)}function iTA(A){return dM(vt,A)}function nTA(A){return cM(Tt,A)}function aTA(A,Q,$={}){return dJ(QO,A,Q,$)}function oTA(A){return dJ(QO,"hostname",A3.hostname,A)}function rTA(A){return dJ(QO,"hex",A3.hex,A)}function sTA(A,Q){let $=Q?.enc??"hex",B=`${A}_${$}`,E=A3[B];if(!E)throw Error(`Unrecognized hash format: ${B}`);return dJ(QO,B,E,Q)}function qQ(A){return ef($O,A)}function Gt(A){return Qy(CC,A)}function tTA(A){return $y(CC,A)}function eTA(A){return By(CC,A)}function A_A(A){return Ey(CC,A)}function Q_A(A){return Dy(CC,A)}function Z6(A){return Jy(BO,A)}function $_A(A){return Yy(EO,A)}function B_A(A){return Fy(_t,A)}function E_A(A){return Xy(_t,A)}function D_A(A){return Iy(bW0,A)}function J_A(A){return Gy(hW0,A)}function DO(A){return Vy(gW0,A)}function St(){return zy(mW0)}function S6(){return Ky(dW0)}function kt(A){return Wy(cW0,A)}function U_A(A){return Cy(pW0,A)}function Y_A(A){return Hy(xy,A)}function mA(A,Q){return SK0(lW0,A,Q)}function Z_A(A){let Q=A._zod.def.shape;return $5(Object.keys(Q))}function oA(A,Q){let $={type:"object",shape:A??{},...RA.normalizeParams(Q)};return new by($)}function F_A(A,Q){return new by({type:"object",shape:A,catchall:kt(),...RA.normalizeParams(Q)})}function VB(A,Q){return new by({type:"object",shape:A,catchall:S6(),...RA.normalizeParams(Q)})}function H6(A,Q){return new hy({type:"union",options:A,...RA.normalizeParams(Q)})}function X_A(A,Q){return new iW0({type:"union",options:A,inclusive:!1,...RA.normalizeParams(Q)})}function gy(A,Q,$){return new nW0({type:"union",options:Q,discriminator:A,...RA.normalizeParams($)})}function JO(A,Q){return new aW0({type:"intersection",left:A,right:Q})}function rW0(A,Q,$){let B=Q instanceof z1,E=B?$:Q;return new oW0({type:"tuple",items:A,rest:B?Q:null,...RA.normalizeParams(E)})}function c6(A,Q,$){return new my({type:"record",keyType:A,valueType:Q,...RA.normalizeParams($)})}function I_A(A,Q,$){let B=_B(A);return B._zod.values=void 0,new my({type:"record",keyType:B,valueType:Q,...RA.normalizeParams($)})}function G_A(A,Q,$){return new my({type:"record",keyType:A,valueType:Q,mode:"loose",...RA.normalizeParams($)})}function V_A(A,Q,$){return new sW0({type:"map",keyType:A,valueType:Q,...RA.normalizeParams($)})}function z_A(A,Q){return new tW0({type:"set",valueType:A,...RA.normalizeParams(Q)})}function $5(A,Q){let $=Array.isArray(A)?Object.fromEntries(A.map((B)=>[B,B])):A;return new eM({type:"enum",entries:$,...RA.normalizeParams(Q)})}function K_A(A,Q){return new eM({type:"enum",entries:A,...RA.normalizeParams(Q)})}function O4(A,Q){return new eW0({type:"literal",values:Array.isArray(A)?A:[A],...RA.normalizeParams(Q)})}function W_A(A){return uy(AC0,A)}function ft(A){return new QC0({type:"transform",transform:A})}function s6(A){return new yt({type:"optional",innerType:A})}function BC0(A){return new $C0({type:"optional",innerType:A})}function ky(A){return new EC0({type:"nullable",innerType:A})}function C_A(A){return s6(ky(A))}function JC0(A,Q){return new DC0({type:"default",innerType:A,get defaultValue(){return typeof Q==="function"?Q():RA.shallowClone(Q)}})}function YC0(A,Q){return new UC0({type:"prefault",innerType:A,get defaultValue(){return typeof Q==="function"?Q():RA.shallowClone(Q)}})}function ZC0(A,Q){return new xt({type:"nonoptional",innerType:A,...RA.normalizeParams(Q)})}function H_A(A){return new FC0({type:"success",innerType:A})}function IC0(A,Q){return new XC0({type:"catch",innerType:A,catchValue:typeof Q==="function"?Q:()=>Q})}function N_A(A){return qy(GC0,A)}function fy(A,Q){return new bt({type:"pipe",in:A,out:Q})}function q_A(A,Q,$){return new ht({type:"pipe",in:A,out:Q,transform:$.decode,reverseTransform:$.encode})}function zC0(A){return new VC0({type:"readonly",innerType:A})}function u_A(A,Q){return new KC0({type:"template_literal",parts:A,...RA.normalizeParams(Q)})}function CC0(A){return new WC0({type:"lazy",getter:A})}function w_A(A){return new HC0({type:"promise",innerType:A})}function M_A(A){return new NC0({type:"function",input:Array.isArray(A?.input)?rW0(A?.input):A?.input??mA(S6()),output:A?.output??S6()})}function O_A(A){let Q=new C6({check:"custom"});return Q._zod.check=A,Q}function gt(A,Q){return wy(dy,A??(()=>!0),Q)}function qC0(A,Q={}){return My(dy,A,Q)}function uC0(A){return Oy(A)}function R_A(A,Q={}){let $=new dy({type:"custom",check:"custom",fn:(B)=>B instanceof A,abort:!0,...RA.normalizeParams(Q)});return $._zod.bag.Class=A,$._zod.check=(B)=>{if(!(B.value instanceof A))B.issues.push({code:"invalid_type",expected:A.name,input:B.value,inst:$,path:[...$._zod.def.path??[]]})},$}function v_A(A){let Q=CC0(()=>{return H6([P0(A),qQ(),Z6(),DO(),mA(Q),c6(P0(),Q)])});return Q}function cy(A,Q){return fy(ft(A),Q)}var b1,Vt,AO,_6,zt,Sy,cU,yy,Wt,Ct,Ht,Nt,qt,ut,wt,Mt,xW0,Ot,Lt,jt,Rt,Pt,vt,Tt,QO,$O,CC,BO,EO,_t,bW0,hW0,gW0,mW0,dW0,cW0,pW0,xy,lW0,by,hy,iW0,nW0,aW0,oW0,my,sW0,tW0,eM,eW0,AC0,QC0,yt,$C0,EC0,DC0,UC0,xt,FC0,XC0,GC0,bt,ht,VC0,KC0,WC0,HC0,NC0,dy,L_A,j_A,P_A=(...A)=>Ry({Codec:ht,Boolean:BO,String:AO},...A);var _y=C0(()=>{SB();SB();tM();Py();Yt();vy();yW0();b1=M0("ZodType",(A,Q)=>{return z1.init(A,Q),Object.assign(A["~standard"],{jsonSchema:{input:rM(A,"input"),output:rM(A,"output")}}),A.toJSONSchema=kK0(A,{}),A.def=Q,A.type=Q.type,Object.defineProperty(A,"_def",{value:Q}),A.check=(...$)=>{return A.clone(RA.mergeDefs(Q,{checks:[...Q.checks??[],...$.map((B)=>typeof B==="function"?{_zod:{check:B,def:{check:"custom"},onattach:[]}}:B)]}),{parent:!0})},A.with=A.check,A.clone=($,B)=>_B(A,$,B),A.brand=()=>A,A.register=($,B)=>{return $.add(A,B),A},A.parse=($,B)=>MW0(A,$,B,{callee:A.parse}),A.safeParse=($,B)=>LW0(A,$,B),A.parseAsync=async($,B)=>OW0(A,$,B,{callee:A.parseAsync}),A.safeParseAsync=async($,B)=>jW0(A,$,B),A.spa=A.safeParseAsync,A.encode=($,B)=>RW0(A,$,B),A.decode=($,B)=>PW0(A,$,B),A.encodeAsync=async($,B)=>vW0(A,$,B),A.decodeAsync=async($,B)=>TW0(A,$,B),A.safeEncode=($,B)=>_W0(A,$,B),A.safeDecode=($,B)=>SW0(A,$,B),A.safeEncodeAsync=async($,B)=>kW0(A,$,B),A.safeDecodeAsync=async($,B)=>fW0(A,$,B),A.refine=($,B)=>A.check(qC0($,B)),A.superRefine=($)=>A.check(uC0($)),A.overwrite=($)=>A.check(m9($)),A.optional=()=>s6(A),A.exactOptional=()=>BC0(A),A.nullable=()=>ky(A),A.nullish=()=>s6(ky(A)),A.nonoptional=($)=>ZC0(A,$),A.array=()=>mA(A),A.or=($)=>H6([A,$]),A.and=($)=>JO(A,$),A.transform=($)=>fy(A,ft($)),A.default=($)=>JC0(A,$),A.prefault=($)=>YC0(A,$),A.catch=($)=>IC0(A,$),A.pipe=($)=>fy(A,$),A.readonly=()=>zC0(A),A.describe=($)=>{let B=A.clone();return Q3.add(B,{description:$}),B},Object.defineProperty(A,"description",{get(){return Q3.get(A)?.description},configurable:!0}),A.meta=(...$)=>{if($.length===0)return Q3.get(A);let B=A.clone();return Q3.add(B,$[0]),B},A.isOptional=()=>A.safeParse(void 0).success,A.isNullable=()=>A.safeParse(null).success,A.apply=($)=>$(A),A}),Vt=M0("_ZodString",(A,Q)=>{IF.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=(B,E,D)=>fK0(A,B,E,D);let $=A._zod.bag;A.format=$.format??null,A.minLength=$.minimum??null,A.maxLength=$.maximum??null,A.regex=(...B)=>A.check(YG(...B)),A.includes=(...B)=>A.check(XG(...B)),A.startsWith=(...B)=>A.check(IG(...B)),A.endsWith=(...B)=>A.check(GG(...B)),A.min=(...B)=>A.check(mJ(...B)),A.max=(...B)=>A.check(VF(...B)),A.length=(...B)=>A.check(zF(...B)),A.nonempty=(...B)=>A.check(mJ(1,...B)),A.lowercase=(B)=>A.check(ZG(B)),A.uppercase=(B)=>A.check(FG(B)),A.trim=()=>A.check(KG()),A.normalize=(...B)=>A.check(zG(...B)),A.toLowerCase=()=>A.check(WG()),A.toUpperCase=()=>A.check(CG()),A.slugify=()=>A.check(oM())}),AO=M0("ZodString",(A,Q)=>{IF.init(A,Q),Vt.init(A,Q),A.email=($)=>A.check(MM(zt,$)),A.url=($)=>A.check(UG(yy,$)),A.jwt=($)=>A.check(cM(Tt,$)),A.emoji=($)=>A.check(PM(Wt,$)),A.guid=($)=>A.check(WC(Sy,$)),A.uuid=($)=>A.check(OM(cU,$)),A.uuidv4=($)=>A.check(LM(cU,$)),A.uuidv6=($)=>A.check(jM(cU,$)),A.uuidv7=($)=>A.check(RM(cU,$)),A.nanoid=($)=>A.check(vM(Ct,$)),A.guid=($)=>A.check(WC(Sy,$)),A.cuid=($)=>A.check(TM(Ht,$)),A.cuid2=($)=>A.check(_M(Nt,$)),A.ulid=($)=>A.check(SM(qt,$)),A.base64=($)=>A.check(gM(Rt,$)),A.base64url=($)=>A.check(mM(Pt,$)),A.xid=($)=>A.check(kM(ut,$)),A.ksuid=($)=>A.check(fM(wt,$)),A.ipv4=($)=>A.check(yM(Mt,$)),A.ipv6=($)=>A.check(xM(Ot,$)),A.cidrv4=($)=>A.check(bM(Lt,$)),A.cidrv6=($)=>A.check(hM(jt,$)),A.e164=($)=>A.check(dM(vt,$)),A.datetime=($)=>A.check(HW0($)),A.date=($)=>A.check(NW0($)),A.time=($)=>A.check(qW0($)),A.duration=($)=>A.check(uW0($))});_6=M0("ZodStringFormat",(A,Q)=>{U6.init(A,Q),Vt.init(A,Q)}),zt=M0("ZodEmail",(A,Q)=>{_k.init(A,Q),_6.init(A,Q)});Sy=M0("ZodGUID",(A,Q)=>{vk.init(A,Q),_6.init(A,Q)});cU=M0("ZodUUID",(A,Q)=>{Tk.init(A,Q),_6.init(A,Q)});yy=M0("ZodURL",(A,Q)=>{Sk.init(A,Q),_6.init(A,Q)});Wt=M0("ZodEmoji",(A,Q)=>{kk.init(A,Q),_6.init(A,Q)});Ct=M0("ZodNanoID",(A,Q)=>{fk.init(A,Q),_6.init(A,Q)});Ht=M0("ZodCUID",(A,Q)=>{yk.init(A,Q),_6.init(A,Q)});Nt=M0("ZodCUID2",(A,Q)=>{xk.init(A,Q),_6.init(A,Q)});qt=M0("ZodULID",(A,Q)=>{bk.init(A,Q),_6.init(A,Q)});ut=M0("ZodXID",(A,Q)=>{hk.init(A,Q),_6.init(A,Q)});wt=M0("ZodKSUID",(A,Q)=>{gk.init(A,Q),_6.init(A,Q)});Mt=M0("ZodIPv4",(A,Q)=>{lk.init(A,Q),_6.init(A,Q)});xW0=M0("ZodMAC",(A,Q)=>{nk.init(A,Q),_6.init(A,Q)});Ot=M0("ZodIPv6",(A,Q)=>{ik.init(A,Q),_6.init(A,Q)});Lt=M0("ZodCIDRv4",(A,Q)=>{ak.init(A,Q),_6.init(A,Q)});jt=M0("ZodCIDRv6",(A,Q)=>{ok.init(A,Q),_6.init(A,Q)});Rt=M0("ZodBase64",(A,Q)=>{rk.init(A,Q),_6.init(A,Q)});Pt=M0("ZodBase64URL",(A,Q)=>{sk.init(A,Q),_6.init(A,Q)});vt=M0("ZodE164",(A,Q)=>{tk.init(A,Q),_6.init(A,Q)});Tt=M0("ZodJWT",(A,Q)=>{ek.init(A,Q),_6.init(A,Q)});QO=M0("ZodCustomStringFormat",(A,Q)=>{Af.init(A,Q),_6.init(A,Q)});$O=M0("ZodNumber",(A,Q)=>{CM.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=(B,E,D)=>yK0(A,B,E,D),A.gt=(B,E)=>A.check(ZD(B,E)),A.gte=(B,E)=>A.check(j3(B,E)),A.min=(B,E)=>A.check(j3(B,E)),A.lt=(B,E)=>A.check(YD(B,E)),A.lte=(B,E)=>A.check(m5(B,E)),A.max=(B,E)=>A.check(m5(B,E)),A.int=(B)=>A.check(Gt(B)),A.safe=(B)=>A.check(Gt(B)),A.positive=(B)=>A.check(ZD(0,B)),A.nonnegative=(B)=>A.check(j3(0,B)),A.negative=(B)=>A.check(YD(0,B)),A.nonpositive=(B)=>A.check(m5(0,B)),A.multipleOf=(B,E)=>A.check(mU(B,E)),A.step=(B,E)=>A.check(mU(B,E)),A.finite=()=>A;let $=A._zod.bag;A.minValue=Math.max($.minimum??Number.NEGATIVE_INFINITY,$.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,A.maxValue=Math.min($.maximum??Number.POSITIVE_INFINITY,$.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,A.isInt=($.format??"").includes("int")||Number.isSafeInteger($.multipleOf??0.5),A.isFinite=!0,A.format=$.format??null});CC=M0("ZodNumberFormat",(A,Q)=>{Qf.init(A,Q),$O.init(A,Q)});BO=M0("ZodBoolean",(A,Q)=>{GC.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>xK0(A,$,B,E)});EO=M0("ZodBigInt",(A,Q)=>{HM.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=(B,E,D)=>bK0(A,B,E,D),A.gte=(B,E)=>A.check(j3(B,E)),A.min=(B,E)=>A.check(j3(B,E)),A.gt=(B,E)=>A.check(ZD(B,E)),A.gte=(B,E)=>A.check(j3(B,E)),A.min=(B,E)=>A.check(j3(B,E)),A.lt=(B,E)=>A.check(YD(B,E)),A.lte=(B,E)=>A.check(m5(B,E)),A.max=(B,E)=>A.check(m5(B,E)),A.positive=(B)=>A.check(ZD(BigInt(0),B)),A.negative=(B)=>A.check(YD(BigInt(0),B)),A.nonpositive=(B)=>A.check(m5(BigInt(0),B)),A.nonnegative=(B)=>A.check(j3(BigInt(0),B)),A.multipleOf=(B,E)=>A.check(mU(B,E));let $=A._zod.bag;A.minValue=$.minimum??null,A.maxValue=$.maximum??null,A.format=$.format??null});_t=M0("ZodBigIntFormat",(A,Q)=>{$f.init(A,Q),EO.init(A,Q)});bW0=M0("ZodSymbol",(A,Q)=>{Bf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>hK0(A,$,B,E)});hW0=M0("ZodUndefined",(A,Q)=>{Ef.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>mK0(A,$,B,E)});gW0=M0("ZodNull",(A,Q)=>{Df.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>gK0(A,$,B,E)});mW0=M0("ZodAny",(A,Q)=>{Jf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>pK0(A,$,B,E)});dW0=M0("ZodUnknown",(A,Q)=>{Uf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>lK0(A,$,B,E)});cW0=M0("ZodNever",(A,Q)=>{Yf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>cK0(A,$,B,E)});pW0=M0("ZodVoid",(A,Q)=>{Zf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>dK0(A,$,B,E)});xy=M0("ZodDate",(A,Q)=>{Ff.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=(B,E,D)=>iK0(A,B,E,D),A.min=(B,E)=>A.check(j3(B,E)),A.max=(B,E)=>A.check(m5(B,E));let $=A._zod.bag;A.minDate=$.minimum?new Date($.minimum):null,A.maxDate=$.maximum?new Date($.maximum):null});lW0=M0("ZodArray",(A,Q)=>{Xf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>EW0(A,$,B,E),A.element=Q.element,A.min=($,B)=>A.check(mJ($,B)),A.nonempty=($)=>A.check(mJ(1,$)),A.max=($,B)=>A.check(VF($,B)),A.length=($,B)=>A.check(zF($,B)),A.unwrap=()=>A.element});by=M0("ZodObject",(A,Q)=>{fz0.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>DW0(A,$,B,E),RA.defineLazy(A,"shape",()=>{return Q.shape}),A.keyof=()=>$5(Object.keys(A._zod.def.shape)),A.catchall=($)=>A.clone({...A._zod.def,catchall:$}),A.passthrough=()=>A.clone({...A._zod.def,catchall:S6()}),A.loose=()=>A.clone({...A._zod.def,catchall:S6()}),A.strict=()=>A.clone({...A._zod.def,catchall:kt()}),A.strip=()=>A.clone({...A._zod.def,catchall:void 0}),A.extend=($)=>{return RA.extend(A,$)},A.safeExtend=($)=>{return RA.safeExtend(A,$)},A.merge=($)=>RA.merge(A,$),A.pick=($)=>RA.pick(A,$),A.omit=($)=>RA.omit(A,$),A.partial=(...$)=>RA.partial(yt,A,$[0]),A.required=(...$)=>RA.required(xt,A,$[0])});hy=M0("ZodUnion",(A,Q)=>{VC.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>Dt(A,$,B,E),A.options=Q.options});iW0=M0("ZodXor",(A,Q)=>{hy.init(A,Q),If.init(A,Q),A._zod.processJSONSchema=($,B,E)=>Dt(A,$,B,E),A.options=Q.options});nW0=M0("ZodDiscriminatedUnion",(A,Q)=>{hy.init(A,Q),Gf.init(A,Q)});aW0=M0("ZodIntersection",(A,Q)=>{Vf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>JW0(A,$,B,E)});oW0=M0("ZodTuple",(A,Q)=>{NM.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>UW0(A,$,B,E),A.rest=($)=>A.clone({...A._zod.def,rest:$})});my=M0("ZodRecord",(A,Q)=>{zf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>YW0(A,$,B,E),A.keyType=Q.keyType,A.valueType=Q.valueType});sW0=M0("ZodMap",(A,Q)=>{Kf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>$W0(A,$,B,E),A.keyType=Q.keyType,A.valueType=Q.valueType,A.min=(...$)=>A.check(FD(...$)),A.nonempty=($)=>A.check(FD(1,$)),A.max=(...$)=>A.check(dU(...$)),A.size=(...$)=>A.check(GF(...$))});tW0=M0("ZodSet",(A,Q)=>{Wf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>BW0(A,$,B,E),A.min=(...$)=>A.check(FD(...$)),A.nonempty=($)=>A.check(FD(1,$)),A.max=(...$)=>A.check(dU(...$)),A.size=(...$)=>A.check(GF(...$))});eM=M0("ZodEnum",(A,Q)=>{Cf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=(B,E,D)=>nK0(A,B,E,D),A.enum=Q.entries,A.options=Object.values(Q.entries);let $=new Set(Object.keys(Q.entries));A.extract=(B,E)=>{let D={};for(let J of B)if($.has(J))D[J]=Q.entries[J];else throw Error(`Key ${J} not found in enum`);return new eM({...Q,checks:[],...RA.normalizeParams(E),entries:D})},A.exclude=(B,E)=>{let D={...Q.entries};for(let J of B)if($.has(J))delete D[J];else throw Error(`Key ${J} not found in enum`);return new eM({...Q,checks:[],...RA.normalizeParams(E),entries:D})}});eW0=M0("ZodLiteral",(A,Q)=>{Hf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>aK0(A,$,B,E),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]}})});AC0=M0("ZodFile",(A,Q)=>{Nf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>sK0(A,$,B,E),A.min=($,B)=>A.check(FD($,B)),A.max=($,B)=>A.check(dU($,B)),A.mime=($,B)=>A.check(VG(Array.isArray($)?$:[$],B))});QC0=M0("ZodTransform",(A,Q)=>{qf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>QW0(A,$,B,E),A._zod.parse=($,B)=>{if(B.direction==="backward")throw new YC(A.constructor.name);$.addIssue=(D)=>{if(typeof D==="string")$.issues.push(RA.issue(D,$.value,Q));else{let J=D;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=$.value),J.inst??(J.inst=A),$.issues.push(RA.issue(J))}};let E=Q.transform($.value,$);if(E instanceof Promise)return E.then((D)=>{return $.value=D,$});return $.value=E,$}});yt=M0("ZodOptional",(A,Q)=>{qM.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>Jt(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});$C0=M0("ZodExactOptional",(A,Q)=>{uf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>Jt(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});EC0=M0("ZodNullable",(A,Q)=>{wf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>ZW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});DC0=M0("ZodDefault",(A,Q)=>{Mf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>XW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType,A.removeDefault=A.unwrap});UC0=M0("ZodPrefault",(A,Q)=>{Of.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>IW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});xt=M0("ZodNonOptional",(A,Q)=>{Lf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>FW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});FC0=M0("ZodSuccess",(A,Q)=>{jf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>tK0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});XC0=M0("ZodCatch",(A,Q)=>{Rf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>GW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType,A.removeCatch=A.unwrap});GC0=M0("ZodNaN",(A,Q)=>{Pf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>oK0(A,$,B,E)});bt=M0("ZodPipe",(A,Q)=>{vf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>VW0(A,$,B,E),A.in=Q.in,A.out=Q.out});ht=M0("ZodCodec",(A,Q)=>{bt.init(A,Q),zC.init(A,Q)});VC0=M0("ZodReadonly",(A,Q)=>{Tf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>zW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});KC0=M0("ZodTemplateLiteral",(A,Q)=>{_f.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>rK0(A,$,B,E)});WC0=M0("ZodLazy",(A,Q)=>{ff.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>WW0(A,$,B,E),A.unwrap=()=>A._zod.def.getter()});HC0=M0("ZodPromise",(A,Q)=>{kf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>KW0(A,$,B,E),A.unwrap=()=>A._zod.def.innerType});NC0=M0("ZodFunction",(A,Q)=>{Sf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>AW0(A,$,B,E)});dy=M0("ZodCustom",(A,Q)=>{yf.init(A,Q),b1.init(A,Q),A._zod.processJSONSchema=($,B,E)=>eK0(A,$,B,E)});L_A=Ly,j_A=jy});function y_1(A){h$({customError:A})}function x_1(){return h$().customError}var MC0,wC0;var T_A=C0(()=>{SB();MC0={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){})(wC0||(wC0={}))});function h_1(A,Q){let $=A.$schema;if($==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if($==="http://json-schema.org/draft-07/schema#")return"draft-7";if($==="http://json-schema.org/draft-04/schema#")return"draft-4";return Q??"draft-2020-12"}function g_1(A,Q){if(!A.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let $=A.slice(1).split("/").filter(Boolean);if($.length===0)return Q.rootSchema;let B=Q.version==="draft-2020-12"?"$defs":"definitions";if($[0]===B){let E=$[1];if(!E||!Q.defs[E])throw Error(`Reference not found: ${A}`);return Q.defs[E]}throw Error(`Reference not found: ${A}`)}function __A(A,Q){if(A.not!==void 0){if(typeof A.not==="object"&&Object.keys(A.not).length===0)return B4.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 E=A.$ref;if(Q.refs.has(E))return Q.refs.get(E);if(Q.processing.has(E))return B4.lazy(()=>{if(!Q.refs.has(E))throw Error(`Circular reference not resolved: ${E}`);return Q.refs.get(E)});Q.processing.add(E);let D=g_1(E,Q),J=d5(D,Q);return Q.refs.set(E,J),Q.processing.delete(E),J}if(A.enum!==void 0){let E=A.enum;if(Q.version==="openapi-3.0"&&A.nullable===!0&&E.length===1&&E[0]===null)return B4.null();if(E.length===0)return B4.never();if(E.length===1)return B4.literal(E[0]);if(E.every((J)=>typeof J==="string"))return B4.enum(E);let D=E.map((J)=>B4.literal(J));if(D.length<2)return D[0];return B4.union([D[0],D[1],...D.slice(2)])}if(A.const!==void 0)return B4.literal(A.const);let $=A.type;if(Array.isArray($)){let E=$.map((D)=>{let J={...A,type:D};return __A(J,Q)});if(E.length===0)return B4.never();if(E.length===1)return E[0];return B4.union(E)}if(!$)return B4.any();let B;switch($){case"string":{let E=B4.string();if(A.format){let D=A.format;if(D==="email")E=E.check(B4.email());else if(D==="uri"||D==="uri-reference")E=E.check(B4.url());else if(D==="uuid"||D==="guid")E=E.check(B4.uuid());else if(D==="date-time")E=E.check(B4.iso.datetime());else if(D==="date")E=E.check(B4.iso.date());else if(D==="time")E=E.check(B4.iso.time());else if(D==="duration")E=E.check(B4.iso.duration());else if(D==="ipv4")E=E.check(B4.ipv4());else if(D==="ipv6")E=E.check(B4.ipv6());else if(D==="mac")E=E.check(B4.mac());else if(D==="cidr")E=E.check(B4.cidrv4());else if(D==="cidr-v6")E=E.check(B4.cidrv6());else if(D==="base64")E=E.check(B4.base64());else if(D==="base64url")E=E.check(B4.base64url());else if(D==="e164")E=E.check(B4.e164());else if(D==="jwt")E=E.check(B4.jwt());else if(D==="emoji")E=E.check(B4.emoji());else if(D==="nanoid")E=E.check(B4.nanoid());else if(D==="cuid")E=E.check(B4.cuid());else if(D==="cuid2")E=E.check(B4.cuid2());else if(D==="ulid")E=E.check(B4.ulid());else if(D==="xid")E=E.check(B4.xid());else if(D==="ksuid")E=E.check(B4.ksuid())}if(typeof A.minLength==="number")E=E.min(A.minLength);if(typeof A.maxLength==="number")E=E.max(A.maxLength);if(A.pattern)E=E.regex(new RegExp(A.pattern));B=E;break}case"number":case"integer":{let E=$==="integer"?B4.number().int():B4.number();if(typeof A.minimum==="number")E=E.min(A.minimum);if(typeof A.maximum==="number")E=E.max(A.maximum);if(typeof A.exclusiveMinimum==="number")E=E.gt(A.exclusiveMinimum);else if(A.exclusiveMinimum===!0&&typeof A.minimum==="number")E=E.gt(A.minimum);if(typeof A.exclusiveMaximum==="number")E=E.lt(A.exclusiveMaximum);else if(A.exclusiveMaximum===!0&&typeof A.maximum==="number")E=E.lt(A.maximum);if(typeof A.multipleOf==="number")E=E.multipleOf(A.multipleOf);B=E;break}case"boolean":{B=B4.boolean();break}case"null":{B=B4.null();break}case"object":{let E={},D=A.properties||{},J=new Set(A.required||[]);for(let[Y,Z]of Object.entries(D)){let F=d5(Z,Q);E[Y]=J.has(Y)?F:F.optional()}if(A.propertyNames){let Y=d5(A.propertyNames,Q),Z=A.additionalProperties&&typeof A.additionalProperties==="object"?d5(A.additionalProperties,Q):B4.any();if(Object.keys(E).length===0){B=B4.record(Y,Z);break}let F=B4.object(E).passthrough(),X=B4.looseRecord(Y,Z);B=B4.intersection(F,X);break}if(A.patternProperties){let Y=A.patternProperties,Z=Object.keys(Y),F=[];for(let I of Z){let G=d5(Y[I],Q),V=B4.string().regex(new RegExp(I));F.push(B4.looseRecord(V,G))}let X=[];if(Object.keys(E).length>0)X.push(B4.object(E).passthrough());if(X.push(...F),X.length===0)B=B4.object({}).passthrough();else if(X.length===1)B=X[0];else{let I=B4.intersection(X[0],X[1]);for(let G=2;G<X.length;G++)I=B4.intersection(I,X[G]);B=I}break}let U=B4.object(E);if(A.additionalProperties===!1)B=U.strict();else if(typeof A.additionalProperties==="object")B=U.catchall(d5(A.additionalProperties,Q));else B=U.passthrough();break}case"array":{let{prefixItems:E,items:D}=A;if(E&&Array.isArray(E)){let J=E.map((Y)=>d5(Y,Q)),U=D&&typeof D==="object"&&!Array.isArray(D)?d5(D,Q):void 0;if(U)B=B4.tuple(J).rest(U);else B=B4.tuple(J);if(typeof A.minItems==="number")B=B.check(B4.minLength(A.minItems));if(typeof A.maxItems==="number")B=B.check(B4.maxLength(A.maxItems))}else if(Array.isArray(D)){let J=D.map((Y)=>d5(Y,Q)),U=A.additionalItems&&typeof A.additionalItems==="object"?d5(A.additionalItems,Q):void 0;if(U)B=B4.tuple(J).rest(U);else B=B4.tuple(J);if(typeof A.minItems==="number")B=B.check(B4.minLength(A.minItems));if(typeof A.maxItems==="number")B=B.check(B4.maxLength(A.maxItems))}else if(D!==void 0){let J=d5(D,Q),U=B4.array(J);if(typeof A.minItems==="number")U=U.min(A.minItems);if(typeof A.maxItems==="number")U=U.max(A.maxItems);B=U}else B=B4.array(B4.any());break}default:throw Error(`Unsupported type: ${$}`)}if(A.description)B=B.describe(A.description);if(A.default!==void 0)B=B.default(A.default);return B}function d5(A,Q){if(typeof A==="boolean")return A?B4.any():B4.never();let $=__A(A,Q),B=A.type||A.enum!==void 0||A.const!==void 0;if(A.anyOf&&Array.isArray(A.anyOf)){let U=A.anyOf.map((Z)=>d5(Z,Q)),Y=B4.union(U);$=B?B4.intersection($,Y):Y}if(A.oneOf&&Array.isArray(A.oneOf)){let U=A.oneOf.map((Z)=>d5(Z,Q)),Y=B4.xor(U);$=B?B4.intersection($,Y):Y}if(A.allOf&&Array.isArray(A.allOf))if(A.allOf.length===0)$=B?$:B4.any();else{let U=B?$:d5(A.allOf[0],Q),Y=B?0:1;for(let Z=Y;Z<A.allOf.length;Z++)U=B4.intersection(U,d5(A.allOf[Z],Q));$=U}if(A.nullable===!0&&Q.version==="openapi-3.0")$=B4.nullable($);if(A.readOnly===!0)$=B4.readonly($);let E={},D=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let U of D)if(U in A)E[U]=A[U];let J=["contentEncoding","contentMediaType","contentSchema"];for(let U of J)if(U in A)E[U]=A[U];for(let U of Object.keys(A))if(!b_1.has(U))E[U]=A[U];if(Object.keys(E).length>0)Q.registry.add($,E);return $}function S_A(A,Q){if(typeof A==="boolean")return A?B4.any():B4.never();let $=h_1(A,Q?.defaultTarget),B=A.$defs||A.definitions||{},E={version:$,defs:B,refs:new Map,processing:new Set,rootSchema:A,registry:Q?.registry??Q3};return d5(A,E)}var B4,b_1;var k_A=C0(()=>{cf();Yt();vy();_y();B4={...Ty,...Ut,iso:uG},b_1=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 py={};YB(py,{string:()=>m_1,number:()=>d_1,date:()=>l_1,boolean:()=>c_1,bigint:()=>p_1});function m_1(A){return lf(AO,A)}function d_1(A){return Ay($O,A)}function c_1(A){return Uy(BO,A)}function p_1(A){return Zy(EO,A)}function l_1(A){return Ny(xy,A)}var f_A=C0(()=>{SB();_y()});var j={};YB(j,{xor:()=>X_A,xid:()=>xTA,void:()=>U_A,uuidv7:()=>vTA,uuidv6:()=>PTA,uuidv4:()=>RTA,uuid:()=>jTA,util:()=>RA,url:()=>Kt,uppercase:()=>FG,unknown:()=>S6,union:()=>H6,undefined:()=>J_A,ulid:()=>yTA,uint64:()=>E_A,uint32:()=>Q_A,tuple:()=>rW0,trim:()=>KG,treeifyError:()=>Ok,transform:()=>ft,toUpperCase:()=>CG,toLowerCase:()=>WG,toJSONSchema:()=>sM,templateLiteral:()=>u_A,symbol:()=>D_A,superRefine:()=>uC0,success:()=>H_A,stringbool:()=>P_A,stringFormat:()=>aTA,string:()=>P0,strictObject:()=>F_A,startsWith:()=>IG,slugify:()=>oM,size:()=>GF,setErrorMap:()=>y_1,set:()=>z_A,safeParseAsync:()=>jW0,safeParse:()=>LW0,safeEncodeAsync:()=>kW0,safeEncode:()=>_W0,safeDecodeAsync:()=>fW0,safeDecode:()=>SW0,registry:()=>wM,regexes:()=>A3,regex:()=>YG,refine:()=>qC0,record:()=>c6,readonly:()=>zC0,property:()=>aM,promise:()=>w_A,prettifyError:()=>Lk,preprocess:()=>cy,prefault:()=>YC0,positive:()=>pM,pipe:()=>fy,partialRecord:()=>I_A,parseAsync:()=>OW0,parse:()=>MW0,overwrite:()=>m9,optional:()=>s6,object:()=>oA,number:()=>qQ,nullish:()=>C_A,nullable:()=>ky,null:()=>DO,normalize:()=>zG,nonpositive:()=>iM,nonoptional:()=>ZC0,nonnegative:()=>nM,never:()=>kt,negative:()=>lM,nativeEnum:()=>K_A,nanoid:()=>STA,nan:()=>N_A,multipleOf:()=>mU,minSize:()=>FD,minLength:()=>mJ,mime:()=>VG,meta:()=>j_A,maxSize:()=>dU,maxLength:()=>VF,map:()=>V_A,mac:()=>gTA,lte:()=>m5,lt:()=>YD,lowercase:()=>ZG,looseRecord:()=>G_A,looseObject:()=>VB,locales:()=>KC,literal:()=>O4,length:()=>zF,lazy:()=>CC0,ksuid:()=>bTA,keyof:()=>Z_A,jwt:()=>nTA,json:()=>v_A,iso:()=>uG,ipv6:()=>mTA,ipv4:()=>hTA,intersection:()=>JO,int64:()=>B_A,int32:()=>A_A,int:()=>Gt,instanceof:()=>R_A,includes:()=>XG,httpUrl:()=>TTA,hostname:()=>oTA,hex:()=>rTA,hash:()=>sTA,guid:()=>LTA,gte:()=>j3,gt:()=>ZD,globalRegistry:()=>Q3,getErrorMap:()=>x_1,function:()=>M_A,fromJSONSchema:()=>S_A,formatError:()=>XC,float64:()=>eTA,float32:()=>tTA,flattenError:()=>FC,file:()=>W_A,exactOptional:()=>BC0,enum:()=>$5,endsWith:()=>GG,encodeAsync:()=>vW0,encode:()=>RW0,emoji:()=>_TA,email:()=>OTA,e164:()=>iTA,discriminatedUnion:()=>gy,describe:()=>L_A,decodeAsync:()=>TW0,decode:()=>PW0,date:()=>Y_A,custom:()=>gt,cuid2:()=>fTA,cuid:()=>kTA,core:()=>R8,config:()=>h$,coerce:()=>py,codec:()=>q_A,clone:()=>_B,cidrv6:()=>cTA,cidrv4:()=>dTA,check:()=>O_A,catch:()=>IC0,boolean:()=>Z6,bigint:()=>$_A,base64url:()=>lTA,base64:()=>pTA,array:()=>mA,any:()=>St,_function:()=>M_A,_default:()=>JC0,_ZodString:()=>Vt,ZodXor:()=>iW0,ZodXID:()=>ut,ZodVoid:()=>pW0,ZodUnknown:()=>dW0,ZodUnion:()=>hy,ZodUndefined:()=>hW0,ZodUUID:()=>cU,ZodURL:()=>yy,ZodULID:()=>qt,ZodType:()=>b1,ZodTuple:()=>oW0,ZodTransform:()=>QC0,ZodTemplateLiteral:()=>KC0,ZodSymbol:()=>bW0,ZodSuccess:()=>FC0,ZodStringFormat:()=>_6,ZodString:()=>AO,ZodSet:()=>tW0,ZodRecord:()=>my,ZodRealError:()=>P8,ZodReadonly:()=>VC0,ZodPromise:()=>HC0,ZodPrefault:()=>UC0,ZodPipe:()=>bt,ZodOptional:()=>yt,ZodObject:()=>by,ZodNumberFormat:()=>CC,ZodNumber:()=>$O,ZodNullable:()=>EC0,ZodNull:()=>gW0,ZodNonOptional:()=>xt,ZodNever:()=>cW0,ZodNanoID:()=>Ct,ZodNaN:()=>GC0,ZodMap:()=>sW0,ZodMAC:()=>xW0,ZodLiteral:()=>eW0,ZodLazy:()=>WC0,ZodKSUID:()=>wt,ZodJWT:()=>Tt,ZodIssueCode:()=>MC0,ZodIntersection:()=>aW0,ZodISOTime:()=>Xt,ZodISODuration:()=>It,ZodISODateTime:()=>Zt,ZodISODate:()=>Ft,ZodIPv6:()=>Ot,ZodIPv4:()=>Mt,ZodGUID:()=>Sy,ZodFunction:()=>NC0,ZodFirstPartyTypeKind:()=>wC0,ZodFile:()=>AC0,ZodExactOptional:()=>$C0,ZodError:()=>k_1,ZodEnum:()=>eM,ZodEmoji:()=>Wt,ZodEmail:()=>zt,ZodE164:()=>vt,ZodDiscriminatedUnion:()=>nW0,ZodDefault:()=>DC0,ZodDate:()=>xy,ZodCustomStringFormat:()=>QO,ZodCustom:()=>dy,ZodCodec:()=>ht,ZodCatch:()=>XC0,ZodCUID2:()=>Nt,ZodCUID:()=>Ht,ZodCIDRv6:()=>jt,ZodCIDRv4:()=>Lt,ZodBoolean:()=>BO,ZodBigIntFormat:()=>_t,ZodBigInt:()=>EO,ZodBase64URL:()=>Pt,ZodBase64:()=>Rt,ZodArray:()=>lW0,ZodAny:()=>mW0,TimePrecision:()=>af,NEVER:()=>UC,$output:()=>mf,$input:()=>df,$brand:()=>Wk});var ly=C0(()=>{SB();SB();lz0();SB();tM();k_A();Bt();vy();vy();f_A();_y();Yt();wW0();yW0();T_A();h$(xf())});var UO;var M7=C0(()=>{ly();ly();UO=j});function y_A(){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 x_A(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&&!i_1.test(A.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(A.path){if(A.authority){if(!n_1.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(a_1.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 o_1(A,Q){if(!A&&!Q)return"file";return A}function r_1(A,Q){switch(A){case"https":case"http":case"file":if(!Q)Q=cJ;else if(Q[0]!==cJ)Q=cJ+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,E,D=!1,J){if(typeof A==="object")this.scheme=A.scheme||p6,this.authority=A.authority||p6,this.path=A.path||p6,this.query=A.query||p6,this.fragment=A.fragment||p6,this.platform=A.platform;else this.scheme=o_1(A,D),this.authority=Q||p6,this.path=r_1(this.scheme,$||p6),this.query=B||p6,this.fragment=E||p6,this.platform=J,x_A(this,D)}get fsPath(){return d_A(this,!1)}with(A){if(!A)return this;let{scheme:Q,authority:$,path:B,query:E,fragment:D,platform:J}=A;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=p6;if($===void 0)$=this.authority;else if($===null)$=p6;if(B===void 0)B=this.path;else if(B===null)B=p6;if(E===void 0)E=this.query;else if(E===null)E=p6;if(D===void 0)D=this.fragment;else if(D===null)D=p6;if(J===void 0)J=this.platform;else if(J===null)J=void 0;if(Q===this.scheme&&$===this.authority&&B===this.path&&E===this.query&&D===this.fragment&&J===this.platform)return this;return new HC(Q,$,B,E,D,!1,J)}static parse(A,Q=!1){let $=s_1.exec(A);if(!$)return new HC(p6,p6,p6,p6,p6);return new HC($[2]||p6,mt($[4]||p6),mt($[5]||p6),mt($[7]||p6),mt($[9]||p6),Q)}static file(A,Q=y_A()){let $=p6;if(Q==="windows")A=A.replace(/\\/g,cJ);if(A[0]===cJ&&A[1]===cJ){let B=A.indexOf(cJ,2);if(B===-1)$=A.substring(2),A=cJ;else $=A.substring(2,B),A=A.substring(B)||cJ}return new HC("file",$,A,p6,p6,!1,Q)}static from(A){let Q=new HC(A.scheme,A.authority,A.path,A.query,A.fragment,!0,A.platform);return x_A(Q,!0),Q}toString(A=!1){return OC0(this,A)}toJSON(){return this}static revive(A){if(!A)return A;if(A instanceof p0)return A;let Q=new HC(A),$=A;return Q._formatted=$.external,Q._fsPath=$._sep===g_A(Q.platform)?$.fsPath:null,Q}}function g_A(A){return A==="windows"?1:void 0}function b_A(A,Q,$){let B;for(let E=0;E<A.length;E++){let D=A.charCodeAt(E);if(D>=97&&D<=122||D>=65&&D<=90||D>=48&&D<=57||D===45||D===46||D===95||D===126||Q&&D===47||$&&D===91||$&&D===93||$&&D===58){if(B!==void 0)B+=A.charAt(E)}else{if(B===void 0)B=A.substring(0,E);let J=m_A[D];if(J!==void 0)B+=J;else B+=encodeURIComponent(A.charAt(E))}}return B!==void 0?B:A}function t_1(A){let Q;for(let $=0;$<A.length;$++){let B=A.charCodeAt($);if(B===35||B===63){if(Q===void 0)Q=A.substring(0,$);Q+=m_A[B]}else if(Q!==void 0)Q+=A[$]}return Q!==void 0?Q:A}function d_A(A,Q){let $;if(A.authority&&A.path.length>1&&A.scheme==="file")$=`//${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)$=A.path[1].toLowerCase()+A.path.substring(2);else $=A.path.substring(1);else $=A.path;if(A.platform==="windows")$=$.replace(/\//g,"\\");return $}function OC0(A,Q){let $=!Q?b_A:t_1,B="",{scheme:E,authority:D,path:J,query:U,fragment:Y}=A;if(E)B+=E,B+=":";if(D||E==="file")B+=cJ,B+=cJ;if(D){let Z=D.indexOf("@");if(Z!==-1){let F=D.substring(0,Z);if(D=D.substring(Z+1),Z=F.lastIndexOf(":"),Z===-1)B+=$(F,!1,!1);else B+=$(F.substring(0,Z),!1,!1),B+=":",B+=$(F.substring(Z+1),!1,!0);B+="@"}if(D=D.toLowerCase(),Z=D.lastIndexOf(":"),Z===-1)B+=$(D,!1,!0);else B+=$(D.substring(0,Z),!1,!0),B+=D.substring(Z)}if(J){if(J.length>=3&&J.charCodeAt(0)===47&&J.charCodeAt(2)===58){let Z=J.charCodeAt(1);if(Z>=65&&Z<=90)J=`/${String.fromCharCode(Z+32)}:${J.substring(3)}`}else if(J.length>=2&&J.charCodeAt(1)===58){let Z=J.charCodeAt(0);if(Z>=65&&Z<=90)J=`${String.fromCharCode(Z+32)}:${J.substring(2)}`}B+=$(J,!0,!1)}if(U)B+="?",B+=$(U,!1,!1);if(Y)B+="#",B+=!Q?b_A(Y,!1,!1):Y;return B}function c_A(A){try{return decodeURIComponent(A)}catch{if(A.length>3)return A.substring(0,3)+c_A(A.substring(3));else return A}}function mt(A){if(!A.match(h_A))return A;return A.replace(h_A,(Q)=>c_A(Q))}function iy(A){return A.scheme==="file"}function d9(A){return p0.parse(A)}function E4(A){return pJ.parse(A.toString())}function iQ(A){if(typeof A==="string"||A instanceof URL)return p0.parse(A.toString());return A}var i_1,n_1,a_1,p6="",cJ="/",s_1,HC,m_A,h_A,pJ;var dt=C0(()=>{M7();i_1=/^\w[\w\d+.-]*$/,n_1=/^\//,a_1=/^\/\//;s_1=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;HC=class HC extends p0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=d_A(this,!1);return this._fsPath}toString(A=!1){if(!A){if(!this._formatted)this._formatted=OC0(this,!1);return this._formatted}return OC0(this,!0)}toJSON(){let A={};if(this._fsPath)A.fsPath=this._fsPath,A._sep=g_A(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}};m_A={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"};h_A=/(%[0-9A-Za-z][0-9A-Za-z])+/g;pJ=j.string().brand()});function LC0(A){if(A==="/")return"/";if(A==="")return".";let Q=A.replace(/\/+$/,"");if(!Q)return".";let $=Q.lastIndexOf("/");if($===-1)return".";if($===0)return"/";return Q.slice(0,$)}function O7(A){let Q=A.replace(/\/+$/,"");if(!Q)return"";let $=Q.lastIndexOf("/");return $===-1?Q:Q.slice($+1)}function YO(...A){if(A.length===0)return".";let Q="";for(let J of A)if(J)if(Q)Q+="/"+J;else Q=J;if(!Q)return".";let $=Q.endsWith("/"),B=Q.split("/").filter(Boolean),E=[];for(let J of B)if(J===".."){if(E.length>0&&E[E.length-1]!=="..")E.pop();else if(!Q.startsWith("/"))E.push("..")}else if(J!==".")E.push(J);let D=Q.startsWith("/")?"/"+E.join("/"):E.join("/");if(!D)D=Q.startsWith("/")?"/":".";if($&&D!=="/"&&D!==".")D+="/";return D}function p_A(A,Q,$="/",B="/",E=!0){function D(X,I){return E?X===I:X.toLowerCase()===I.toLowerCase()}if($==="/")A=A.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else A=A.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(A!==$&&A.endsWith($))A=A.slice(0,-1);if(Q!==$&&Q.endsWith($))Q=Q.slice(0,-1);if(D(A,Q))return"";if(!A.startsWith($)&&Q.startsWith($))return Q;let J=A===$?[""]:A.split($),U=Q===$?[""]:Q.split($),Y=0;while(Y<J.length&&Y<U.length&&D(J[Y],U[Y]))Y++;let Z=J.length-Y,F=[];for(let X=0;X<Z;X++)F.push("..");return F.push(...U.slice(Y)),F.join(B)}function ct(A){let Q=O7(A.replace(/\/+$/,"")),$=Q.lastIndexOf(".");if($===0||$===-1)return"";return Q.slice($)}function R3(A){try{if(A=iQ(A),A.scheme==="file")return A.fsPath}catch{}return A.toString()}var wG=C0(()=>{dt()});function AS1(A){if(A.startsWith(NC))return A;if(e_1.test(A))return`${NC}${A.replace(/\\/g,NC)}`;return}function QS1(A,...Q){return A=iQ(A),A.with({path:YO(A.path,...Q)})}function $S1(A,...Q){let $=A.path,B=!1;if($[0]!==NC)$=NC+$,B=!0;let E=$;for(let D of Q){let J=AS1(D);if(J)E=YO(J);else E=YO(E,D)}if(E!=="/"&&E.endsWith("/"))E=E.replace(/\/+$/,"");if(B&&E[0]===NC&&!A.authority)E=E.substring(1);return A.with({path:E})}function BS1(A){if(A=iQ(A),A.path.length===0||A.path===NC)return A;let Q=LC0(A.path);if(Q.length===1&&Q===".")Q="";return A.with({path:Q})}function ES1(A,Q){if(Q.scheme!==A.scheme||(Q.authority??"")!==(A.authority??""))return!1;let $=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),B=$?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,E=$?A.path.slice(0,2).toUpperCase()+A.path.slice(2):A.path;return E===B||E.startsWith(B.endsWith("/")?B:`${B}/`)||B.endsWith("/")&&E===B.slice(0,-1)}function DS1(A,Q){if(A.scheme!==Q.scheme||A.authority!==Q.authority||A.query!==Q.query||A.fragment!==Q.fragment)return null;let $=A.scheme==="file"&&/^\/[A-Za-z]:/.test(A.path)&&/^\/[A-Za-z]:/.test(Q.path);return p_A(A.path,Q.path,"/","/",!$)}function JS1(A,Q){let $=E4(A),B=E4(Q);if($.startsWith("file:///")&&B.startsWith("file:///"))return l_A($)===l_A(B);return $===B}function l_A(A){return A.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var NC="/",e_1,BA;var jC0=C0(()=>{wG();dt();e_1=/^[A-Za-z]:[\\/]/;BA={joinPath:QS1,resolvePath:$S1,dirname:BS1,basename:(A)=>O7(iQ(A).path),extname:(A)=>ct(iQ(A).path),hasPrefix:ES1,relativePath:DS1,equalURIs:JS1}});var D4=C0(()=>{dt();jC0();wG()});function RC0(){let Q=pU.getLogger().contextLocalStorage?.getStore();if(Q==null)return[];let $=Q[US1];return Array.isArray($)?$:[]}function pt(){let Q=pU.getLogger().contextLocalStorage?.getStore();if(Q==null)return{};let $={};for(let B of Object.keys(Q))$[B]=Q[B];return $}var US1;var i_A=C0(()=>{lt();US1=Symbol.for("logtape.categoryPrefix")});function it(A,Q){let $=n_A.indexOf(A);if($<0)throw TypeError(`Invalid log level: ${JSON.stringify(A)}.`);let B=n_A.indexOf(Q);if(B<0)throw TypeError(`Invalid log level: ${JSON.stringify(Q)}.`);return $-B}var n_A;var a_A=C0(()=>{n_A=["trace","debug","info","warning","error","fatal"]});function e_A(A){return A!=null&&typeof A==="object"&&o_A in A&&A[o_A]===!0}function MG(A){let Q={};for(let $ in A){let B=A[$];Q[$]=e_A(B)?B.getter():B}return Q}function YS1(A){let Q=MG(A.properties),$=Object.getOwnPropertyDescriptors(A);return $.properties={value:Q,enumerable:!0,configurable:!0},Object.defineProperties({},$)}function vC0(A=[]){return pU.getLogger(A)}function r_A(A){return A.length===2&&A[0]==="logtape"&&A[1]==="meta"}function XS1(A){return A.includes(".")||A.includes("[")||A.includes("?.")}function IS1(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 GS1(A,Q){let $=A.length,B=Q;if(B>=$)return null;let E;if(A[B]==="["){if(B++,B>=$)return null;if(A[B]==='"'||A[B]==="'"){let D=A[B];B++;let J="";while(B<$&&A[B]!==D)if(A[B]==="\\"){if(B++,B<$){let U=A[B];switch(U){case"n":J+=`
214
214
  `;break;case"t":J+="\t";break;case"r":J+="\r";break;case"b":J+="\b";break;case"f":J+="\f";break;case"v":J+="\v";break;case"0":J+="\x00";break;case"\\":J+="\\";break;case'"':J+='"';break;case"'":J+="'";break;case"u":if(B+4<$){let Y=A.slice(B+1,B+5),Z=Number.parseInt(Y,16);if(!Number.isNaN(Z))J+=String.fromCharCode(Z),B+=4;else J+=U}else J+=U;break;default:J+=U}B++}}else J+=A[B],B++;if(B>=$)return null;E=J,B++}else{let D=B;while(B<$&&A[B]!=="]"&&A[B]!=="'"&&A[B]!=='"')B++;if(B>=$)return null;let J=A.slice(D,B);if(J.length===0)return null;let U=Number(J);E=Number.isNaN(U)?J:U}while(B<$&&A[B]!=="]")B++;if(B<$)B++}else{let D=B;while(B<$&&A[B]!=="."&&A[B]!=="["&&A[B]!=="?"&&A[B]!=="]")B++;if(E=A.slice(D,B),E.length===0)return null}if(B<$&&A[B]===".")B++;return{segment:E,nextIndex:B}}function VS1(A,Q){if(typeof Q==="string")return IS1(A,Q);if(Array.isArray(A)&&Q>=0&&Q<A.length)return A[Q];return}function zS1(A,Q){if(A==null)return;if(Q.length===0||Q.endsWith("."))return;let $=A,B=0,E=Q.length;while(B<E){if(Q.slice(B,B+2)==="?."){if(B+=2,$==null)return}else if($==null)return;let J=GS1(Q,B);if(J===null)return;let{segment:U,nextIndex:Y}=J;if(B=Y,$=VS1($,U),$===void 0)return}return $}function s_A(A,Q){let $=A.length;if($===0)return[""];if(!A.includes("{"))return[A];let B=[],E=0;for(let J=0;J<$;J++){let U=A[J];if(U==="{"){if((J+1<$?A[J+1]:"")==="{"){J++;continue}let Z=A.indexOf("}",J+1);if(Z===-1)continue;let F=A.slice(E,J);B.push(F.replace(/{{/g,"{").replace(/}}/g,"}"));let X=A.slice(J+1,Z),I,G=X.trim();if(G==="*")I=X in Q?Q[X]:("*"in Q)?Q["*"]:Q;else{if(X!==G)I=X in Q?Q[X]:Q[G];else I=Q[X];if(I===void 0&&XS1(G))I=zS1(Q,G)}B.push(I),J=Z,E=J+1}else if(U==="}"&&J+1<$&&A[J+1]==="}")J++}let D=A.slice(E);return B.push(D.replace(/{{/g,"{").replace(/}}/g,"}")),B}function t_A(A,Q){let $=[];for(let B=0;B<A.length;B++)if($.push(A[B]),B<Q.length)$.push(Q[B]);return $}var o_A,PC0,pU=class A{parent;children;category;sinks;parentSinks="inherit";filters;lowestLevel="trace";contextLocalStorage;static getLogger(Q=[]){let $=PC0 in globalThis?globalThis[PC0]??null:null;if($==null)$=new A(null,[]),globalThis[PC0]=$;if(typeof Q==="string")return $.getChild(Q);if(Q.length===0)return $;return $.getChild(Q)}static getNearestExistingLogger(Q){let $=A.getLogger();for(let B of Q){let E=$.children[B],D=E instanceof A?E:E?.deref();if(D==null)break;$=D}return $}constructor(Q,$){this.parent=Q,this.children={},this.category=$,this.sinks=[],this.filters=[]}getChild(Q){let $=typeof Q==="string"?Q:Q[0],B=this.children[$],E=B instanceof A?B:B?.deref();if(E==null)E=new A(this,[...this.category,$]),this.children[$]="WeakRef"in globalThis?new WeakRef(E):E;if(typeof Q==="string"||Q.length===1)return E;return E.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 $=Q instanceof A?Q:Q.deref();if($!=null)$.resetDescendants()}this.reset()}with(Q){return new ZS1(this,{...Q})}filter(Q){for(let $ of this.filters)if(!$(Q))return!1;if(this.filters.length<1)return this.parent?.filter(Q)??!0;return!0}*getSinks(Q){if(this.lowestLevel===null||it(Q,this.lowestLevel)<0)return;if(this.parent!=null&&this.parentSinks==="inherit")for(let $ of this.parent.getSinks(Q))yield $;for(let $ of this.sinks)yield $}isEnabledFor(Q){let $=r_A(this.category)?[]:RC0();return($.length>0?A.getNearestExistingLogger([...$,...this.category]):this).isEnabledForResolved(Q)}isEnabledForResolved(Q){if(this.lowestLevel===null||it(Q,this.lowestLevel)<0)return!1;for(let $ of this.getSinks(Q))return!0;return!1}emit(Q,$){let B="category"in Q?Q.category:this.category,E=r_A(B)?[]:RC0(),D=E.length>0?[...E,...B]:B,J=Object.getOwnPropertyDescriptors(Q);J.category={value:D,enumerable:!0,configurable:!0};let U=Object.defineProperties({},J);(E.length>0?A.getNearestExistingLogger(D):this).emitResolved(U,$)}emitResolved(Q,$){if(this.lowestLevel===null||it(Q.level,this.lowestLevel)<0||!this.filter(Q))return;let B=[...this.getSinks(Q.level)];if(B.length<1)return;let E,D=!1;for(let J of B){if($?.has(J))continue;try{if(E==null&&!D)try{E=YS1(Q)}catch{D=!0,E=Q}J(E??Q)}catch(U){let Y=new Set($);Y.add(J),FS1.log("fatal","Failed to emit a log record to sink {sink}: {error}",{sink:J,error:U,record:Q},Y)}}}log(Q,$,B,E){let D=pt(),J=void 0,U=void 0,Y=typeof B==="function"?{category:this.category,level:Q,timestamp:Date.now(),get message(){if(U==null)U=s_A($,this.properties);return U},rawMessage:$,get properties(){if(J==null)J=MG({...D,...B()});return J}}:{category:this.category,level:Q,timestamp:Date.now(),get message(){if(U==null)U=s_A($,this.properties);return U},rawMessage:$,get properties(){if(J==null)J=MG({...D,...B});return J}};this.emit(Y,E)}logLazily(Q,$,B={}){let E=pt(),D=void 0,J=void 0;function U(){if(J==null||D==null){if(J=$((Y,...Z)=>{return D=Y,t_A(Y,Z)}),D==null)throw TypeError("No log record was made.")}return[J,D]}this.emit({category:this.category,level:Q,get message(){return U()[0]},get rawMessage(){return U()[1]},timestamp:Date.now(),properties:{...E,...B}})}logTemplate(Q,$,B,E={}){let D=pt();this.emit({category:this.category,level:Q,message:t_A($,B),rawMessage:$,timestamp:Date.now(),properties:{...D,...E}})}trace(Q,...$){if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("trace"))return Promise.resolve();return B().then((D)=>{this.log("trace",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("trace"))return Promise.resolve();return E.then((D)=>{this.log("trace",Q,D)})}this.log("trace",Q,E);return}this.log("trace",Q,B??{})}else if(typeof Q==="function")this.logLazily("trace",Q);else if(!Array.isArray(Q))this.log("trace","{*}",Q);else this.logTemplate("trace",Q,$)}debug(Q,...$){if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("debug"))return Promise.resolve();return B().then((D)=>{this.log("debug",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("debug"))return Promise.resolve();return E.then((D)=>{this.log("debug",Q,D)})}this.log("debug",Q,E);return}this.log("debug",Q,B??{})}else if(typeof Q==="function")this.logLazily("debug",Q);else if(!Array.isArray(Q))this.log("debug","{*}",Q);else this.logTemplate("debug",Q,$)}info(Q,...$){if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("info"))return Promise.resolve();return B().then((D)=>{this.log("info",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("info"))return Promise.resolve();return E.then((D)=>{this.log("info",Q,D)})}this.log("info",Q,E);return}this.log("info",Q,B??{})}else if(typeof Q==="function")this.logLazily("info",Q);else if(!Array.isArray(Q))this.log("info","{*}",Q);else this.logTemplate("info",Q,$)}warn(Q,...$){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("warning",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return B().then((D)=>{this.log("warning",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return E.then((D)=>{this.log("warning",Q,D)})}this.log("warning",Q,E);return}this.log("warning",Q,B??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,$)}warning(Q,...$){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("warning",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return B().then((D)=>{this.log("warning",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return E.then((D)=>{this.log("warning",Q,D)})}this.log("warning",Q,E);return}this.log("warning",Q,B??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,$)}error(Q,...$){if(Q instanceof Error)this.log("error","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("error",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("error"))return Promise.resolve();return B().then((D)=>{this.log("error",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("error"))return Promise.resolve();return E.then((D)=>{this.log("error",Q,D)})}this.log("error",Q,E);return}this.log("error",Q,B??{})}else if(typeof Q==="function")this.logLazily("error",Q);else if(!Array.isArray(Q))this.log("error","{*}",Q);else this.logTemplate("error",Q,$)}fatal(Q,...$){if(Q instanceof Error)this.log("fatal","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("fatal",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("fatal"))return Promise.resolve();return B().then((D)=>{this.log("fatal",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("fatal"))return Promise.resolve();return E.then((D)=>{this.log("fatal",Q,D)})}this.log("fatal",Q,E);return}this.log("fatal",Q,B??{})}else if(typeof Q==="function")this.logLazily("fatal",Q);else if(!Array.isArray(Q))this.log("fatal","{*}",Q);else this.logTemplate("fatal",Q,$)}},ZS1=class A{logger;properties;constructor(Q,$){this.logger=Q,this.properties=$}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,E){let D=this.properties;this.logger.log(Q,$,typeof B==="function"?()=>MG({...D,...B()}):()=>MG({...D,...B}),E)}logLazily(Q,$){this.logger.logLazily(Q,$,MG(this.properties))}logTemplate(Q,$,B){this.logger.logTemplate(Q,$,B,MG(this.properties))}emit(Q){let $={...Q,properties:MG({...this.properties,...Q.properties})};this.logger.emit($)}isEnabledFor(Q){return this.logger.isEnabledFor(Q)}trace(Q,...$){if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("trace"))return Promise.resolve();return B().then((D)=>{this.log("trace",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("trace"))return Promise.resolve();return E.then((D)=>{this.log("trace",Q,D)})}this.log("trace",Q,E);return}this.log("trace",Q,B??{})}else if(typeof Q==="function")this.logLazily("trace",Q);else if(!Array.isArray(Q))this.log("trace","{*}",Q);else this.logTemplate("trace",Q,$)}debug(Q,...$){if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("debug"))return Promise.resolve();return B().then((D)=>{this.log("debug",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("debug"))return Promise.resolve();return E.then((D)=>{this.log("debug",Q,D)})}this.log("debug",Q,E);return}this.log("debug",Q,B??{})}else if(typeof Q==="function")this.logLazily("debug",Q);else if(!Array.isArray(Q))this.log("debug","{*}",Q);else this.logTemplate("debug",Q,$)}info(Q,...$){if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("info"))return Promise.resolve();return B().then((D)=>{this.log("info",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("info"))return Promise.resolve();return E.then((D)=>{this.log("info",Q,D)})}this.log("info",Q,E);return}this.log("info",Q,B??{})}else if(typeof Q==="function")this.logLazily("info",Q);else if(!Array.isArray(Q))this.log("info","{*}",Q);else this.logTemplate("info",Q,$)}warn(Q,...$){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("warning",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return B().then((D)=>{this.log("warning",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return E.then((D)=>{this.log("warning",Q,D)})}this.log("warning",Q,E);return}this.log("warning",Q,B??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,$)}warning(Q,...$){if(Q instanceof Error)this.log("warning","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("warning",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("warning"))return Promise.resolve();return B().then((D)=>{this.log("warning",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("warning"))return Promise.resolve();return E.then((D)=>{this.log("warning",Q,D)})}this.log("warning",Q,E);return}this.log("warning",Q,B??{})}else if(typeof Q==="function")this.logLazily("warning",Q);else if(!Array.isArray(Q))this.log("warning","{*}",Q);else this.logTemplate("warning",Q,$)}error(Q,...$){if(Q instanceof Error)this.log("error","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("error",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("error"))return Promise.resolve();return B().then((D)=>{this.log("error",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("error"))return Promise.resolve();return E.then((D)=>{this.log("error",Q,D)})}this.log("error",Q,E);return}this.log("error",Q,B??{})}else if(typeof Q==="function")this.logLazily("error",Q);else if(!Array.isArray(Q))this.log("error","{*}",Q);else this.logTemplate("error",Q,$)}fatal(Q,...$){if(Q instanceof Error)this.log("fatal","{error.message}",{error:Q});else if(typeof Q==="string"&&$[0]instanceof Error)this.log("fatal",Q,{error:$[0]});else if(typeof Q==="string"){let B=$[0];if(typeof B==="function"){if(B.constructor.name==="AsyncFunction"){if(!this.isEnabledFor("fatal"))return Promise.resolve();return B().then((D)=>{this.log("fatal",Q,D)})}let E=B();if(E instanceof Promise){if(!this.isEnabledFor("fatal"))return Promise.resolve();return E.then((D)=>{this.log("fatal",Q,D)})}this.log("fatal",Q,E);return}this.log("fatal",Q,B??{})}else if(typeof Q==="function")this.logLazily("fatal",Q);else if(!Array.isArray(Q))this.log("fatal","{*}",Q);else this.logTemplate("fatal",Q,$)}},FS1;var lt=C0(()=>{i_A();a_A();o_A=Symbol.for("logtape.lazy");PC0=Symbol.for("logtape.rootLogger");FS1=pU.getLogger(["logtape","meta"])});var at={};YB(at,{inspect:()=>nt});import KS1 from"node:util";function nt(A,Q){return KS1.inspect(A,Q)}var ASA=()=>{};function t6(A){return A<10?`0${A}`:`${A}`}function ZO(A){return A<10?`00${A}`:A<100?`0${A}`:`${A}`}function BSA(A){return A==="crlf"?`\r
215
215
  `:`
216
- `}function rt(A,Q){if(!(Q instanceof Error))return Q;let $={name:Q.name,message:Q.message};if(typeof Q.stack==="string")$.stack=Q.stack;let B=Q.cause;if(B!==void 0)$.cause=B;if(typeof AggregateError<"u"&&Q instanceof AggregateError)$.errors=Q.errors;for(let E of Object.keys(Q))if(!(E in $))$[E]=Q[E];return $}function kC0(A={}){let Q=(()=>{let U=A.timestamp;if(U==null)return ot["date-time-timezone"];else if(U==="disabled")return ot.none;else if(typeof U==="string"&&U in ot)return ot[U];else return U})(),$=A.category??"·",B=A.value?(U)=>A.value(U,QSA):QSA,E=(()=>{let U=A.level;if(U==null||U==="ABBR")return(Y)=>FO.ABBR[Y];else if(U==="abbr")return(Y)=>FO.abbr[Y];else if(U==="FULL")return(Y)=>FO.FULL[Y];else if(U==="full")return(Y)=>FO.full[Y];else if(U==="L")return(Y)=>FO.L[Y];else if(U==="l")return(Y)=>FO.l[Y];else return U})(),D=BSA(A.lineEnding),J=A.format??(({timestamp:U,level:Y,category:Z,message:F})=>`${U?`${U} `:""}[${Y}] ${Z}: ${F}`);return(U)=>{let Y=U.message,Z=Y.length,F;if(Z===1)F=Y[0];else if(Z<=6){F="";for(let z=0;z<Z;z++)F+=z%2===0?Y[z]:B(Y[z])}else{let z=Array(Z);for(let K=0;K<Z;K++)z[K]=K%2===0?Y[K]:B(Y[K]);F=z.join("")}let X=Q(U.timestamp),I=E(U.level),G=typeof $==="function"?$(U.category):U.category.join($);return`${J({timestamp:X,level:I,category:G,message:F,record:U})}${D}`}}function ESA(A={}){let Q=A.format,$=typeof A.timestampStyle>"u"?"dim":A.timestampStyle,B=A.timestampColor??null,E=`${$==null?"":SC0[$]}${B==null?"":_C0[B]}`,D=$==null&&B==null?"":TC0,J=typeof A.levelStyle>"u"?"bold":A.levelStyle,U=A.levelColors??WS1,Y=typeof A.categoryStyle>"u"?"dim":A.categoryStyle,Z=A.categoryColor??null,F=`${Y==null?"":SC0[Y]}${Z==null?"":_C0[Z]}`,X=Y==null&&Z==null?"":TC0;return kC0({timestamp:"date-time-tz",value(I,G){return G(I,{colors:!0})},...A,format({timestamp:I,level:G,category:V,message:z,record:K}){let W=U[K.level];return I=I==null?null:`${E}${I}${D}`,G=`${J==null?"":SC0[J]}${W==null?"":_C0[W]}${G}${J==null&&W==null?"":TC0}`,Q==null?`${I==null?"":`${I} `}${G} ${F}${V}:${X} ${z}`:Q({timestamp:I,level:G,category:`${F}${V}${X}`,message:z,record:K})}})}function tt(A={}){let Q=BSA(A.lineEnding);if(!A.categorySeparator&&!A.message&&!A.properties)return(U)=>{if(U.message.length===3)return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:U.message[0]+JSON.stringify(U.message[1])+U.message[2],logger:U.category.join("."),properties:U.properties},rt)+Q;if(U.message.length===1)return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:U.message[0],logger:U.category.join("."),properties:U.properties},rt)+Q;let Y=U.message[0];for(let Z=1;Z<U.message.length;Z++)Y+=Z&1?JSON.stringify(U.message[Z]):U.message[Z];return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:Y,logger:U.category.join("."),properties:U.properties},rt)+Q};let $=A.message==="template",B=A.properties??"nest:properties",E;if(typeof A.categorySeparator==="function")E=A.categorySeparator;else{let U=A.categorySeparator??".";E=(Y)=>Y.join(U)}let D;if(B==="flatten")D=(U)=>U;else if(B.startsWith("prepend:")){let U=B.substring(8);if(U==="")throw TypeError(`Invalid properties option: ${JSON.stringify(B)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);D=(Y)=>{let Z={};for(let F in Y)Z[`${U}${F}`]=Y[F];return Z}}else if(B.startsWith("nest:")){let U=B.substring(5);D=(Y)=>({[U]:Y})}else throw TypeError(`Invalid properties option: ${JSON.stringify(B)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let J;if($)J=(U)=>{if(typeof U.rawMessage==="string")return U.rawMessage;let Y="";for(let Z=0;Z<U.rawMessage.length;Z++)Y+=Z%2<1?U.rawMessage[Z]:"{}";return Y};else J=(U)=>{let Y=U.message.length;if(Y===1)return U.message[0];let Z="";for(let F=0;F<Y;F++)Z+=F%2<1?U.message[F]:JSON.stringify(U.message[F]);return Z};return(U)=>{return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:J(U),logger:E(U.category),...D(U.properties)},rt)+Q}}function ny(A){let Q="",$=[];for(let D=0;D<A.message.length;D++)if(D%2===0)Q+=A.message[D];else Q+="%o",$.push(A.message[D]);let B=new Date(A.timestamp);return[`%c${`${B.getUTCHours().toString().padStart(2,"0")}:${B.getUTCMinutes().toString().padStart(2,"0")}:${B.getUTCSeconds().toString().padStart(2,"0")}.${B.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${$SA[A.level]}%c %c${A.category.join("·")} %c${Q}`,"color: gray;",NS1[A.level],"background-color: default;","color: gray;","color: default;",...$]}var $SA,QSA,ot,FO,st,TC0="\x1B[0m",_C0,SC0,WS1,CS1,HS1,NS1;var fC0=C0(()=>{ASA();$SA={trace:"TRC",debug:"DBG",info:"INF",warning:"WRN",error:"ERR",fatal:"FTL"},QSA=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}):at!=null&&("inspect"in at)&&typeof nt==="function"?(A,Q)=>nt(A,{maxArrayLength:1/0,maxStringLength:1/0,...Q}):(A)=>JSON.stringify(A);ot={"date-time-timezone":(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate()),D=t6(Q.getUTCHours()),J=t6(Q.getUTCMinutes()),U=t6(Q.getUTCSeconds()),Y=ZO(Q.getUTCMilliseconds());return`${$}-${B}-${E} ${D}:${J}:${U}.${Y} +00:00`},"date-time-tz":(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate()),D=t6(Q.getUTCHours()),J=t6(Q.getUTCMinutes()),U=t6(Q.getUTCSeconds()),Y=ZO(Q.getUTCMilliseconds());return`${$}-${B}-${E} ${D}:${J}:${U}.${Y} +00`},"date-time":(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate()),D=t6(Q.getUTCHours()),J=t6(Q.getUTCMinutes()),U=t6(Q.getUTCSeconds()),Y=ZO(Q.getUTCMilliseconds());return`${$}-${B}-${E} ${D}:${J}:${U}.${Y}`},"time-timezone":(A)=>{let Q=new Date(A),$=t6(Q.getUTCHours()),B=t6(Q.getUTCMinutes()),E=t6(Q.getUTCSeconds()),D=ZO(Q.getUTCMilliseconds());return`${$}:${B}:${E}.${D} +00:00`},"time-tz":(A)=>{let Q=new Date(A),$=t6(Q.getUTCHours()),B=t6(Q.getUTCMinutes()),E=t6(Q.getUTCSeconds()),D=ZO(Q.getUTCMilliseconds());return`${$}:${B}:${E}.${D} +00`},time:(A)=>{let Q=new Date(A),$=t6(Q.getUTCHours()),B=t6(Q.getUTCMinutes()),E=t6(Q.getUTCSeconds()),D=ZO(Q.getUTCMilliseconds());return`${$}:${B}:${E}.${D}`},date:(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate());return`${$}-${B}-${E}`},rfc3339:(A)=>new Date(A).toISOString(),none:()=>null},FO={ABBR:$SA,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"}};st=kC0(),_C0={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},SC0={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",strikethrough:"\x1B[9m"},WS1={trace:null,debug:"blue",info:"green",warning:"yellow",error:"red",fatal:"magenta"};CS1=ESA();HS1=tt(),NS1={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 DSA(A){if(typeof A==="function")return A;return qS1(A)}function qS1(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 JSA=()=>{};function ay(A={}){let Q=A.formatter??ny,$={trace:"debug",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"error",...A.levelMap??{}},B=A.console??globalThis.console,E=(W)=>{let C=Q(W),H=$[W.level];if(H===void 0)throw TypeError(`Invalid log level: ${W.level}.`);if(typeof C==="string"){let N=C.replace(/\r?\n$/,"");B[H](N)}else B[H](...C)};if(!A.nonBlocking)return E;let D=A.nonBlocking===!0?{}:A.nonBlocking,J=D.bufferSize??100,U=D.flushInterval??100,Y=[],Z=null,F=!1,X=!1,I=J*2;function G(){if(Y.length===0)return;let W=Y.splice(0);for(let C of W)try{E(C)}catch{}}function V(){if(X)return;X=!0,setTimeout(()=>{X=!1,G()},0)}function z(){if(Z!==null||F)return;Z=setInterval(()=>{G()},U)}let K=(W)=>{if(F)return;if(Y.length>=I)Y.shift();if(Y.push(W),Y.length>=J)V();else if(Z===null)z()};return K[Symbol.dispose]=()=>{if(F=!0,Z!==null)clearInterval(Z),Z=null;G()},K}var yC0=C0(()=>{fC0()});function uS1(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 wS1(A){let Q=A?Qe:$e;if(typeof globalThis.EdgeRuntime!=="string"&&"process"in globalThis&&!("Deno"in globalThis)){let B=globalThis.process,E=B?.on;if(typeof E==="function"){E.call(B,"exit",Q);return}}let $=globalThis.addEventListener;if(typeof $!=="function")return;if("Deno"in globalThis)$.call(globalThis,"unload",Q);else $.call(globalThis,"pagehide",Q)}function ry(A){if(Ae!=null&&!A.reset)throw new KF("Already configured; if you want to reset, turn on the reset flag.");if(oy.size>0)throw new KF("Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().");XO();try{MS1(A,!1)}catch(Q){if(Q instanceof KF)XO();throw Q}}function MS1(A,Q){Ae=A;let $=!1,B=new Set;for(let D of A.loggers){if(uS1(D))$=!0;let J=Array.isArray(D.category)?JSON.stringify(D.category):JSON.stringify([D.category]);if(B.has(J))throw new KF(`Duplicate logger configuration for category: ${J}. Each category can only be configured once.`);B.add(J);let U=pU.getLogger(D.category);for(let Y of D.sinks??[]){let Z=A.sinks[Y];if(!Z)throw new KF(`Sink not found: ${Y}.`);U.sinks.push(Z)}if(U.parentSinks=D.parentSinks??"inherit",D.lowestLevel!==void 0)U.lowestLevel=D.lowestLevel;for(let Y of D.filters??[]){let Z=A.filters?.[Y];if(Z===void 0)throw new KF(`Filter not found: ${Y}.`);U.filters.push(DSA(Z))}USA.add(U)}pU.getLogger().contextLocalStorage=A.contextLocalStorage;for(let D of Object.values(A.sinks)){if(Symbol.asyncDispose in D)if(Q)oy.add(D);else throw new KF("Async disposables cannot be used with configureSync().");if(Symbol.dispose in D)et.add(D)}for(let D of Object.values(A.filters??{})){if(D==null||typeof D==="string")continue;if(Symbol.asyncDispose in D)if(Q)oy.add(D);else throw new KF("Async disposables cannot be used with configureSync().");if(Symbol.dispose in D)et.add(D)}wS1(Q);let E=pU.getLogger(["logtape","meta"]);if(!$)E.sinks.push(ay());E.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 xC0(){return Ae}function XO(){$e(),OS1()}function OS1(){let A=pU.getLogger([]);A.resetDescendants(),delete A.contextLocalStorage,USA.clear(),Ae=null}async function Qe(){$e();let A=[];for(let Q of oy)A.push(Q[Symbol.asyncDispose]()),oy.delete(Q);await Promise.all(A)}function $e(){for(let A of et)A[Symbol.dispose]();et.clear()}var Ae=null,USA,et,oy,KF;var YSA=C0(()=>{JSA();lt();yC0();USA=new Set,et=new Set,oy=new Set;KF=class extends Error{constructor(A){super(A);this.name="ConfigureError"}}});var Be=C0(()=>{lt();fC0();yC0();YSA()});var ZSA,LS1,S;var a0=C0(()=>{Be();M7();if(xC0()===null)ry({sinks:{console:ay({formatter:(A)=>{let Q=ny(A);return Object.keys(A.properties).length>0?[...Q,A.properties]:Q}})},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},{category:[],sinks:["console"]}]});ZSA=UO.union([UO.literal("error"),UO.literal("warn"),UO.literal("info"),UO.literal("debug")]),LS1=vC0(),S=LS1});function yS1(A){return A.trim().toLowerCase()}function L7(A){let Q=yS1(A);if(Q.length===0)return!1;if(Q.endsWith("@ampcode.com")||Q==="auth-bypass-user@example.com")return!0;return!1}function E1(A,Q,$=Q+"s"){return A===1?Q:$}var kB=()=>{};function De(A){Promise.resolve().then(()=>{try{A()}catch(Q){console.error(Q)}})}function ISA(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($){console.error("cleanupSubscription",$)}}function mC0(A){A._observer=void 0,A._queue=void 0,A._state="closed"}function xS1(A){let Q=A._queue;if(!Q)return;A._queue=void 0,A._state="ready";for(let $ of Q)if(GSA(A,$.type,$.value),A._state==="closed")break}function GSA(A,Q,$){A._state="running";let B=A._observer;try{switch(Q){case"next":if(B&&typeof B.next==="function")B.next($);break;case"error":if(mC0(A),B&&typeof B.error==="function")B.error($);else throw $;break;case"complete":if(mC0(A),B&&typeof B.complete==="function")B.complete();break}}catch(E){console.error("notifySubscription",E)}if(A._state==="closed")ISA(A);else if(A._state==="running")A._state="ready"}function gC0(A,Q,$){if(A._state==="closed")return;if(A._state==="buffering"){A._queue=A._queue||[],A._queue.push({type:Q,value:$});return}if(A._state!=="ready"){A._state="buffering",A._queue=[{type:Q,value:$}],De(()=>xS1(A));return}GSA(A,Q,$)}class VSA{_cleanup;_observer;_queue;_state;constructor(A,Q){this._cleanup=void 0,this._observer=A,this._queue=void 0,this._state="initializing";let $=new zSA(this);try{this._cleanup=Q.call(void 0,$)}catch(B){$.error(B)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")mC0(this),ISA(this)}}class zSA{_subscription;constructor(A){this._subscription=A}get closed(){return this._subscription._state==="closed"}next(A){gC0(this._subscription,"next",A)}error(A){gC0(this._subscription,"error",A)}complete(){gC0(this._subscription,"complete")}}function g$(A){if(typeof A==="function")A();else if(A&&typeof A.unsubscribe==="function")A.unsubscribe()}class GO{_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=(D)=>$.push(D),E=Promise.resolve().then(async()=>{await Q,await A(B),this._pendingPromises.delete(E);for(let D of $)this._baseObserver.next(D)}).catch((D)=>{this._pendingPromises.delete(E),this._baseObserver.error(D)});this._pendingPromises.add(E)}}var k0;var VO=C0(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");k0=class k0{_subscriber;constructor(A){if(!(this instanceof k0))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,$){if(typeof A!=="object"||A===null)A={next:A,error:Q,complete:$};return new VSA(A,this._subscriber)}pipe(A,...Q){let $=this;for(let B of[A,...Q])$=B($);return $}[Symbol.observable](){return this}static from(A){let Q=typeof k0==="function"?k0:k0;if(A==null)throw TypeError(A+" is not an object");let $=A[Symbol.observable];if(typeof $==="function"){let E=$.call(A);if(Object(E)!==E)throw TypeError(E+" is not an object");if(E instanceof k0)return E;return new Q((D)=>E.subscribe(D))}let B=A[Symbol.iterator];if(typeof B==="function")return new Q((E)=>{De(()=>{if(E.closed)return;for(let D of B.call(A))if(E.next(D),E.closed)return;E.complete()})});if(Array.isArray(A))return new Q((E)=>{De(()=>{if(E.closed)return;for(let D of A)if(E.next(D),E.closed)return;E.complete()})});throw TypeError(A+" is not observable")}static of(...A){return new(typeof k0==="function"?k0:k0)(($)=>{De(()=>{if($.closed)return;for(let B of A)if($.next(B),$.closed)return;$.complete()})})}static get[Symbol.species](){return k0}}});var u4,H4;var Je=C0(()=>{VO();u4=class u4 extends k0{_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()}};H4=class H4 extends u4{currentValue;constructor(A){super();this.currentValue=A}next(A){this.currentValue=A,super.next(A)}subscribe(A,Q,$){if(typeof A!=="object"||A===null){let B={};if(A)B.next=A;if(Q)B.error=Q;if($)B.complete=$;A=B}return A.next?.(this.currentValue),super.subscribe(A)}getValue(){return this.currentValue}}});var bS1,hS1;var KSA=C0(()=>{VO();Je();bS1=class bS1 extends Set{subject=new H4(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 k0.from(this.subject)}dispose(){this.subject.complete()}};hS1=class hS1 extends Map{subject=new H4(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 k0.from(this.subject)}dispose(){this.subject.complete()}}});function Ue(A,Q){if(A===Q)return!0;if(A==null||Q==null||typeof A!=="object"||typeof Q!=="object")return!1;let $=Array.isArray(A),B=Array.isArray(Q);if($!==B)return!1;if($&&B)return A.length===Q.length&&A.every((D,J)=>Ue(D,Q[J]));let E=new Set([...Object.keys(A),...Object.keys(Q)]);for(let D of E)if(!Ue(A[D],Q[D]))return!1;return!0}var dC0;var cC0=C0(()=>{dC0={now:()=>Date.now(),schedule:(A,Q)=>{let $=setTimeout(A,Q);return()=>clearTimeout($)}}});async function P4(A,Q){return new Promise(($,B)=>{let E,D=()=>{E?.unsubscribe(),B(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",D,{once:!0}),E=A.subscribe({next:(J)=>{E?.unsubscribe(),Q?.removeEventListener("abort",D),$(J)},error:(J)=>{Q?.removeEventListener("abort",D),B(J)},complete:()=>{Q?.removeEventListener("abort",D),B("Observable completed without emitting a value")}})})}async function LG(A,Q){return new Promise(($,B)=>{let E,D=!1,J,U=()=>{J?.unsubscribe(),B(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",U,{once:!0}),J=A.subscribe({next:(Y)=>{E=Y,D=!0},error:(Y)=>{Q?.removeEventListener("abort",U),B(Y)},complete:()=>{if(Q?.removeEventListener("abort",U),D)$(E);else B("Observable completed without emitting a value")}})})}async function CSA(A,Q){return new Promise(($,B)=>{let E=A.subscribe({error:B,complete:()=>$()});Q?.addEventListener("abort",()=>{E.unsubscribe(),B(new DOMException("Aborted","AbortError"))},{once:!0})})}function lJ(A){return new k0((Q)=>{A.then(($)=>{Q.next($),Q.complete()}).catch(($)=>{Q.error($)})})}function W1(A){return new k0((Q)=>{let $=!1,B=new AbortController,E=B.signal;return(async()=>{try{E?.throwIfAborted();let J=await A(E);if(E?.throwIfAborted(),!$)Q.next(J),Q.complete()}catch(J){if(!$)if(E.aborted)Q.complete();else Q.error(J)}})(),()=>{$=!0,B.abort()}})}function lA(A){return(Q)=>{return new k0(($)=>{let B=new GO($),E=0,D=Q.subscribe({complete(){B.complete()},error(J){B.error(J)},next(J){B.schedule(async(U)=>{let Y=await A(J,E);E++,U(Y)})}});return()=>g$(D)})}}function zO(A,Q=dC0){return new k0(($)=>{let B=0,E=null,D=()=>{$.next(B++),E=Q.schedule(D,A)};return E=Q.schedule(D,A),()=>{if(E)E()}})}function qC(...A){return new k0((Q)=>{let $=0,B=A.map((E)=>E.subscribe({next:(D)=>Q.next(D),error:(D)=>Q.error(D),complete:()=>{if($++,$===A.length)Q.complete()}}));return()=>{HSA(B)}})}function F6(...A){if(A.length===0)return ty;return new k0((Q)=>{let $=Array(A.length),B=Array(A.length).fill(0),E=Array(A.length).fill(!1),D=0,J=[],U=new GO(Q);for(let Y=0;Y<A.length;Y++){let Z=A[Y];J.push(Z.subscribe({next(F){$[Y]=F,E[Y]=!0;let X=++B[Y];if(E.every(Boolean))U.schedule(async(I)=>{if(B[Y]===X)I([...$])})},error(F){U.error(F)},complete(){if(D++,D===A.length)U.complete()}}))}return()=>{HSA(J)}})}function V$(A){let $=A?.shouldCountRefs??!0,B=gS1++,E=(D,...J)=>{};return(D)=>{let J=new u4,U=null,Y=!1,Z,F=0;return new k0((X)=>{if(F++,Y)E("new subscriber, emitting buffered value",Z),X.next(Z);else E("new subscriber, no buffered value to emit");if(!U)U=D.subscribe({next:(G)=>{Y=!0,Z=G,J.next(G)},error:(G)=>J.error(G),complete:()=>J.complete()});let I=J.subscribe(X);return()=>{if(F--,I.unsubscribe(),$&&F===0){if(U)g$(U),U=null;Y=!1}}})}}function HSA(A){for(let Q of A)if(Q)g$(Q)}function lC0(A){return(Q)=>{return new k0(($)=>{let B=Q.subscribe({next:(D)=>$.next(D),error:(D)=>$.error(D),complete:()=>$.complete()}),E=A.subscribe({next:()=>{$.complete(),B.unsubscribe(),E.unsubscribe()},error:(D)=>{$.error(D),B.unsubscribe()}});return()=>{B.unsubscribe(),E.unsubscribe()}})}}function KO(A){return(Q)=>{return new k0(($)=>{let B,E=Q.subscribe({next(D){B=D,$.next(D)},error(D){$.error(D)},complete(){$.complete()}});return()=>{g$(E),A(B)}})}}function BQ(A=Ue){return(Q)=>{return new k0(($)=>{let B=WSA,E=new GO($),D=Q.subscribe({complete(){E.complete()},error(J){E.error(J)},next(J){E.schedule(async(U)=>{if(B===WSA||!A(B,J))B=J,U(J)})}});return()=>g$(D)})}}function WO(A){return mS1(typeof A==="function"?{next:A}:A)}function mS1(A){return(Q)=>new k0(($)=>{let B=typeof A==="function"?A():A,E=Q.subscribe({next(D){if(B.next)try{B.next(D)}catch(J){$.error(J);return}$.next(D)},error(D){if(B.error)try{B.error(D)}catch(J){$.error(J);return}$.error(D)},complete(){if(B.complete)try{B.complete()}catch(D){$.error(D);return}$.complete()}});return()=>g$(E)})}function ey(A){return(Q)=>{return new k0(($)=>{let B=!1,E=Q.subscribe({next:(J)=>{B=!0,clearTimeout(D),$.next(J)},error:(J)=>{clearTimeout(D),$.error(J)},complete:()=>{clearTimeout(D),$.complete()}}),D=setTimeout(()=>{if(!B)E.unsubscribe(),$.error(new Ye(`Operation timed out after ${A}ms`))},A);return()=>{clearTimeout(D),E.unsubscribe()}})}}function GQ(A){return(Q)=>new k0(($)=>{let B;try{$.next(A),B=Q.subscribe({next(E){$.next(E)},error(E){$.error(E)},complete(){$.complete()}})}catch(E){$.error(E)}return()=>{if(B)g$(B)}})}function j7(A){return(Q)=>new k0(($)=>{let B=0,E=Q.subscribe({next(D){if(B<A){if($.next(D),B++,B===A)$.complete(),g$(E)}},error(D){$.error(D)},complete(){$.complete()}});return()=>{g$(E)}})}function u1(A){return(Q)=>{return new k0(($)=>{let B=0,E=null,D=!1,J=()=>{if(D&&!E)$.complete()},U=Q.subscribe({next(Y){if(E)g$(E),E=null;let Z;try{Z=A(Y,B++)}catch(F){$.error(F);return}E=Z.subscribe({next(F){$.next(F)},error(F){$.error(F)},complete(){E=null,J()}})},error(Y){$.error(Y)},complete(){D=!0,J()}});return()=>{if(g$(U),E)g$(E)}})}}function uC(A,Q){let $=Q?.scheduler??dC0;return(B)=>new k0((E)=>{let D=null,J=null,U=!1,Y=B.subscribe({next:(Z)=>{if(J=Z,U=!0,D===null)D=$.schedule(()=>{if(U)E.next(J),U=!1;D=null},A)},error:(Z)=>E.error(Z),complete:()=>{if(D!==null)D();if(U)E.next(J);E.complete()}});return()=>{if(g$(Y),D!==null)D()}})}function Ax(...A){return new k0((Q)=>{let $=0,B=null;function E(){if($>=A.length){Q.complete();return}B=A[$].subscribe({next:(J)=>Q.next(J),error:(J)=>Q.error(J),complete:()=>{$++,E()}})}return E(),()=>{if(B)g$(B)}})}function wC(A){return(Q)=>new k0(($)=>{let B=0,E=!1,D=null,J=Q.subscribe({next(U){try{let Y=A(U,B++);if(D)g$(D);D=Y.subscribe({next(Z){$.next(Z)},error(Z){$.error(Z)},complete(){if(D=null,E&&!D)$.complete()}})}catch(Y){$.error(Y)}},error(U){$.error(U)},complete(){if(E=!0,!D)$.complete()}});return()=>{if(g$(J),D)g$(D)}})}function Qx({onSubscribe:A,onUnsubscribe:Q}){return($)=>new k0((B)=>{A?.();let E=$.subscribe(B);return()=>{g$(E),Q?.()}})}function $x(A){return(Q)=>k0.from(Q).pipe(u1(($)=>W1((B)=>A($,B))))}function XD(A){return(Q)=>new k0(($)=>{let B,E=Q.subscribe({next(D){$.next(D)},error(D){try{B=A(D).subscribe({next(U){$.next(U)},error(U){$.error(U)},complete(){$.complete()}})}catch(J){$.error(J)}},complete(){$.complete()}});return()=>{if(g$(E),B)g$(B)}})}function B5(A){return(Q)=>{return new k0(($)=>{let B=Q.subscribe({next(E){if(A(E))$.next(E)},error(E){$.error(E)},complete(){$.complete()}});return()=>g$(B)})}}function Ze(A,Q){return($)=>{return new k0((B)=>{let E,D=0,J=new GO(B),U=$.subscribe({complete(){J.complete()},error(Y){J.error(Y)},next(Y){J.schedule(async(Z)=>{E=await A(D===0?typeof Q>"u"?Y:Q:E,Y,D++),Z(E)})}});return()=>g$(U)})}}var ty,pC0,gS1=0,WSA,Ye;var iC0=C0(()=>{VO();cC0();Je();ty=new k0((A)=>{A.complete()}),pC0=new k0(()=>{});WSA={};Ye=class Ye extends Error{constructor(A="Timeout has occurred"){super(A);this.name="TimeoutError"}}});function Fe(A,Q){return($)=>{return k0.from($).pipe(u1((B)=>B===iU?k0.of(iU):A(B).pipe(XD((E)=>k0.of(E instanceof Error?E:Error(E))),GQ(iU))),V$(Q))}}function dS1(){return(A)=>k0.from(A).pipe(B5((Q)=>Q!==iU))}async function NSA(A,Q){let $=await P4(k0.from(A).pipe(dS1()),Q);if($ instanceof Error)throw $;return $}var iU;var qSA=C0(()=>{VO();iC0();iU=Symbol.for("@@pendingOperation")});var uSA=()=>{};var wSA=()=>{};var kA=C0(()=>{KSA();VO();qSA();iC0();uSA();cC0();Je();wSA()});function nU(A,Q){if(A===Q)return!0;if(A==null||Q==null||typeof A!=="object"||typeof Q!=="object")return!1;let $=Array.isArray(A),B=Array.isArray(Q);if($!==B)return!1;if($&&B)return A.length===Q.length&&A.every((D,J)=>nU(D,Q[J]));let E=new Set([...Object.keys(A),...Object.keys(Q)]);for(let D of E)if(!nU(A[D],Q[D]))return!1;return!0}var ID;var qO=C0(()=>{ID={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",OLD_CODEMIRROR_DIFFS:"old-codemirror-diffs",OPENAI_REGIONAL_NONENT:"openai-regional-nonent",PAYMENT_METHOD_EXEMPT:"payment-method-exempt",PIERRE_DIFFS:"pierre-diffs",RECV_OLD_CLIENT_EMAILS:"recv-old-client-emails",SIGNING_KEYS:"signing-keys",THREAD_ACTORS_OPENAI_WEBSOCKET:"thread-actors-openai-websocket",THREAD_ACTORS_EVENT_SERVER_SYNC:"thread-actors-event-server-sync",THREAD_ACTORS_TUI:"thread-actors-tui",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 jO(A){let Q=A.length;while(--Q>=0)A[Q]=0}function EH0(A,Q,$,B,E){this.static_tree=A,this.extra_bits=Q,this.extra_base=$,this.elems=B,this.max_length=E,this.has_stree=A&&A.length}function DH0(A,Q){this.dyn_tree=A,this.max_code=0,this.stat_desc=Q}function aU(A,Q,$,B,E){this.good_length=A,this.max_lazy=Q,this.nice_length=$,this.max_chain=B,this.func=E}function Ff1(){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=Oe,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(Qf1*2),this.dyn_dtree=new Uint16Array((2*ek1+1)*2),this.bl_tree=new Uint16Array((2*Af1+1)*2),RG(this.dyn_ltree),RG(this.dyn_dtree),RG(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array($f1+1),this.heap=new Uint16Array(2*NH0+1),RG(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*NH0+1),RG(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 _f1(){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 Mx(A){this.options=Le.assign({level:bf1,method:gf1,chunkSize:16384,windowBits:15,memLevel:8,strategy:hf1},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 lkA,this.strm.avail_out=0;let $=Ix.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if($!==we)throw Error(RC[$]);if(Q.header)Ix.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){let B;if(typeof Q.dictionary==="string")B=Nx.string2buf(Q.dictionary);else if(ikA.call(Q.dictionary)==="[object ArrayBuffer]")B=new Uint8Array(Q.dictionary);else B=Q.dictionary;if($=Ix.deflateSetDictionary(this.strm,B),$!==we)throw Error(RC[$]);this._dict_set=!0}}function TH0(A,Q){let $=new Mx(Q);if($.push(A,!0),$.err)throw $.msg||RC[$.err];return $.result}function mf1(A,Q){return Q=Q||{},Q.raw=!0,TH0(A,Q)}function df1(A,Q){return Q=Q||{},Q.gzip=!0,TH0(A,Q)}function Xy1(){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 Ry1(){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 Ox(A){this.options=Le.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 lkA,this.strm.avail_out=0;let $=qF.inflateInit2(this.strm,Q.windowBits);if($!==qx)throw Error(RC[$]);if(this.header=new Py1,qF.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=Nx.string2buf(Q.dictionary);else if(EfA.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if($=qF.inflateSetDictionary(this.strm,Q.dictionary),$!==qx)throw Error(RC[$])}}}function _H0(A,Q){let $=new Ox(Q);if($.push(A),$.err)throw $.msg||RC[$.err];return $.result}function ky1(A,Q){return Q=Q||{},Q.raw=!0,_H0(A,Q)}var Zk1=0,MkA=1,Fk1=2,Xk1=3,Ik1=258,LH0=29,ux=256,Vx,MO=30,jH0=19,OkA,OC=15,BH0=16,Gk1=7,RH0=256,LkA=16,jkA=17,RkA=18,WH0,qe,Vk1,PkA,zk1=512,NF,Xx,zx,Kx,PH0,ue,vkA,TkA,_kA,SkA=(A)=>{return A<256?zx[A]:zx[256+(A>>>7)]},Wx=(A,Q)=>{A.pending_buf[A.pending++]=Q&255,A.pending_buf[A.pending++]=Q>>>8&255},v8=(A,Q,$)=>{if(A.bi_valid>BH0-$)A.bi_buf|=Q<<A.bi_valid&65535,Wx(A,A.bi_buf),A.bi_buf=Q>>BH0-A.bi_valid,A.bi_valid+=$-BH0;else A.bi_buf|=Q<<A.bi_valid&65535,A.bi_valid+=$},oU=(A,Q,$)=>{v8(A,$[Q*2],$[Q*2+1])},kkA=(A,Q)=>{let $=0;do $|=A&1,A>>>=1,$<<=1;while(--Q>0);return $>>>1},Kk1=(A)=>{if(A.bi_valid===16)Wx(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},Wk1=(A,Q)=>{let{dyn_tree:$,max_code:B}=Q,E=Q.stat_desc.static_tree,D=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,U=Q.stat_desc.extra_base,Y=Q.stat_desc.max_length,Z,F,X,I,G,V,z=0;for(I=0;I<=OC;I++)A.bl_count[I]=0;$[A.heap[A.heap_max]*2+1]=0;for(Z=A.heap_max+1;Z<OkA;Z++){if(F=A.heap[Z],I=$[$[F*2+1]*2+1]+1,I>Y)I=Y,z++;if($[F*2+1]=I,F>B)continue;if(A.bl_count[I]++,G=0,F>=U)G=J[F-U];if(V=$[F*2],A.opt_len+=V*(I+G),D)A.static_len+=V*(E[F*2+1]+G)}if(z===0)return;do{I=Y-1;while(A.bl_count[I]===0)I--;A.bl_count[I]--,A.bl_count[I+1]+=2,A.bl_count[Y]--,z-=2}while(z>0);for(I=Y;I!==0;I--){F=A.bl_count[I];while(F!==0){if(X=A.heap[--Z],X>B)continue;if($[X*2+1]!==I)A.opt_len+=(I-$[X*2+1])*$[X*2],$[X*2+1]=I;F--}}},fkA=(A,Q,$)=>{let B=Array(OC+1),E=0,D,J;for(D=1;D<=OC;D++)E=E+$[D-1]<<1,B[D]=E;for(J=0;J<=Q;J++){let U=A[J*2+1];if(U===0)continue;A[J*2]=kkA(B[U]++,U)}},Ck1=()=>{let A,Q,$,B,E,D=Array(OC+1);$=0;for(B=0;B<LH0-1;B++){PH0[B]=$;for(A=0;A<1<<WH0[B];A++)Kx[$++]=B}Kx[$-1]=B,E=0;for(B=0;B<16;B++){ue[B]=E;for(A=0;A<1<<qe[B];A++)zx[E++]=B}E>>=7;for(;B<MO;B++){ue[B]=E<<7;for(A=0;A<1<<qe[B]-7;A++)zx[256+E++]=B}for(Q=0;Q<=OC;Q++)D[Q]=0;A=0;while(A<=143)NF[A*2+1]=8,A++,D[8]++;while(A<=255)NF[A*2+1]=9,A++,D[9]++;while(A<=279)NF[A*2+1]=7,A++,D[7]++;while(A<=287)NF[A*2+1]=8,A++,D[8]++;fkA(NF,Vx+1,D);for(A=0;A<MO;A++)Xx[A*2+1]=5,Xx[A*2]=kkA(A,5);vkA=new EH0(NF,WH0,ux+1,Vx,OC),TkA=new EH0(Xx,qe,0,MO,OC),_kA=new EH0([],Vk1,0,jH0,Gk1)},ykA=(A)=>{let Q;for(Q=0;Q<Vx;Q++)A.dyn_ltree[Q*2]=0;for(Q=0;Q<MO;Q++)A.dyn_dtree[Q*2]=0;for(Q=0;Q<jH0;Q++)A.bl_tree[Q*2]=0;A.dyn_ltree[RH0*2]=1,A.opt_len=A.static_len=0,A.sym_next=A.matches=0},xkA=(A)=>{if(A.bi_valid>8)Wx(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},gSA=(A,Q,$,B)=>{let E=Q*2,D=$*2;return A[E]<A[D]||A[E]===A[D]&&B[Q]<=B[$]},JH0=(A,Q,$)=>{let B=A.heap[$],E=$<<1;while(E<=A.heap_len){if(E<A.heap_len&&gSA(Q,A.heap[E+1],A.heap[E],A.depth))E++;if(gSA(Q,B,A.heap[E],A.depth))break;A.heap[$]=A.heap[E],$=E,E<<=1}A.heap[$]=B},mSA=(A,Q,$)=>{let B,E,D=0,J,U;if(A.sym_next!==0)do if(B=A.pending_buf[A.sym_buf+D++]&255,B+=(A.pending_buf[A.sym_buf+D++]&255)<<8,E=A.pending_buf[A.sym_buf+D++],B===0)oU(A,E,Q);else{if(J=Kx[E],oU(A,J+ux+1,Q),U=WH0[J],U!==0)E-=PH0[J],v8(A,E,U);if(B--,J=SkA(B),oU(A,J,$),U=qe[J],U!==0)B-=ue[J],v8(A,B,U)}while(D<A.sym_next);oU(A,RH0,Q)},CH0=(A,Q)=>{let $=Q.dyn_tree,B=Q.stat_desc.static_tree,E=Q.stat_desc.has_stree,D=Q.stat_desc.elems,J,U,Y=-1,Z;A.heap_len=0,A.heap_max=OkA;for(J=0;J<D;J++)if($[J*2]!==0)A.heap[++A.heap_len]=Y=J,A.depth[J]=0;else $[J*2+1]=0;while(A.heap_len<2)if(Z=A.heap[++A.heap_len]=Y<2?++Y:0,$[Z*2]=1,A.depth[Z]=0,A.opt_len--,E)A.static_len-=B[Z*2+1];Q.max_code=Y;for(J=A.heap_len>>1;J>=1;J--)JH0(A,$,J);Z=D;do J=A.heap[1],A.heap[1]=A.heap[A.heap_len--],JH0(A,$,1),U=A.heap[1],A.heap[--A.heap_max]=J,A.heap[--A.heap_max]=U,$[Z*2]=$[J*2]+$[U*2],A.depth[Z]=(A.depth[J]>=A.depth[U]?A.depth[J]:A.depth[U])+1,$[J*2+1]=$[U*2+1]=Z,A.heap[1]=Z++,JH0(A,$,1);while(A.heap_len>=2);A.heap[--A.heap_max]=A.heap[1],Wk1(A,Q),fkA($,Y,A.bl_count)},dSA=(A,Q,$)=>{let B,E=-1,D,J=Q[1],U=0,Y=7,Z=4;if(J===0)Y=138,Z=3;Q[($+1)*2+1]=65535;for(B=0;B<=$;B++){if(D=J,J=Q[(B+1)*2+1],++U<Y&&D===J)continue;else if(U<Z)A.bl_tree[D*2]+=U;else if(D!==0){if(D!==E)A.bl_tree[D*2]++;A.bl_tree[LkA*2]++}else if(U<=10)A.bl_tree[jkA*2]++;else A.bl_tree[RkA*2]++;if(U=0,E=D,J===0)Y=138,Z=3;else if(D===J)Y=6,Z=3;else Y=7,Z=4}},cSA=(A,Q,$)=>{let B,E=-1,D,J=Q[1],U=0,Y=7,Z=4;if(J===0)Y=138,Z=3;for(B=0;B<=$;B++){if(D=J,J=Q[(B+1)*2+1],++U<Y&&D===J)continue;else if(U<Z)do oU(A,D,A.bl_tree);while(--U!==0);else if(D!==0){if(D!==E)oU(A,D,A.bl_tree),U--;oU(A,LkA,A.bl_tree),v8(A,U-3,2)}else if(U<=10)oU(A,jkA,A.bl_tree),v8(A,U-3,3);else oU(A,RkA,A.bl_tree),v8(A,U-11,7);if(U=0,E=D,J===0)Y=138,Z=3;else if(D===J)Y=6,Z=3;else Y=7,Z=4}},Hk1=(A)=>{let Q;dSA(A,A.dyn_ltree,A.l_desc.max_code),dSA(A,A.dyn_dtree,A.d_desc.max_code),CH0(A,A.bl_desc);for(Q=jH0-1;Q>=3;Q--)if(A.bl_tree[PkA[Q]*2+1]!==0)break;return A.opt_len+=3*(Q+1)+5+5+4,Q},Nk1=(A,Q,$,B)=>{let E;v8(A,Q-257,5),v8(A,$-1,5),v8(A,B-4,4);for(E=0;E<B;E++)v8(A,A.bl_tree[PkA[E]*2+1],3);cSA(A,A.dyn_ltree,Q-1),cSA(A,A.dyn_dtree,$-1)},qk1=(A)=>{let Q=4093624447,$;for($=0;$<=31;$++,Q>>>=1)if(Q&1&&A.dyn_ltree[$*2]!==0)return 0;if(A.dyn_ltree[18]!==0||A.dyn_ltree[20]!==0||A.dyn_ltree[26]!==0)return 1;for($=32;$<ux;$++)if(A.dyn_ltree[$*2]!==0)return 1;return 0},pSA=!1,uk1=(A)=>{if(!pSA)Ck1(),pSA=!0;A.l_desc=new DH0(A.dyn_ltree,vkA),A.d_desc=new DH0(A.dyn_dtree,TkA),A.bl_desc=new DH0(A.bl_tree,_kA),A.bi_buf=0,A.bi_valid=0,ykA(A)},bkA=(A,Q,$,B)=>{if(v8(A,(Zk1<<1)+(B?1:0),3),xkA(A),Wx(A,$),Wx(A,~$),$)A.pending_buf.set(A.window.subarray(Q,Q+$),A.pending);A.pending+=$},wk1=(A)=>{v8(A,MkA<<1,3),oU(A,RH0,NF),Kk1(A)},Mk1=(A,Q,$,B)=>{let E,D,J=0;if(A.level>0){if(A.strm.data_type===2)A.strm.data_type=qk1(A);if(CH0(A,A.l_desc),CH0(A,A.d_desc),J=Hk1(A),E=A.opt_len+3+7>>>3,D=A.static_len+3+7>>>3,D<=E)E=D}else E=D=$+5;if($+4<=E&&Q!==-1)bkA(A,Q,$,B);else if(A.strategy===4||D===E)v8(A,(MkA<<1)+(B?1:0),3),mSA(A,NF,Xx);else v8(A,(Fk1<<1)+(B?1:0),3),Nk1(A,A.l_desc.max_code+1,A.d_desc.max_code+1,J+1),mSA(A,A.dyn_ltree,A.dyn_dtree);if(ykA(A),B)xkA(A)},Ok1=(A,Q,$)=>{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++]=$,Q===0)A.dyn_ltree[$*2]++;else A.matches++,Q--,A.dyn_ltree[(Kx[$]+ux+1)*2]++,A.dyn_dtree[SkA(Q)*2]++;return A.sym_next===A.sym_end},Lk1,jk1,Rk1,Pk1,vk1,Tk1,_k1=(A,Q,$,B)=>{let E=A&65535|0,D=A>>>16&65535|0,J=0;while($!==0){J=$>2000?2000:$,$-=J;do E=E+Q[B++]|0,D=D+E|0;while(--J);E%=65521,D%=65521}return E|D<<16|0},Cx,Sk1=()=>{let A,Q=[];for(var $=0;$<256;$++){A=$;for(var B=0;B<8;B++)A=A&1?3988292384^A>>>1:A>>>1;Q[$]=A}return Q},kk1,fk1=(A,Q,$,B)=>{let E=kk1,D=B+$;A^=-1;for(let J=B;J<D;J++)A=A>>>8^E[(A^Q[J])&255];return A^-1},P3,RC,TC,yk1,HH0,xk1,vG,bk1,TG,hk1,gk1,GD,lSA,E5,iSA,rU,mk1,UH0,dk1,ck1,Ke,pk1,lk1,ik1,nk1,Oe,ak1=9,ok1=15,rk1=8,sk1=29,tk1=256,NH0,ek1=30,Af1=19,Qf1,$f1=15,uQ=3,PG=258,sU,Bf1=32,OO=42,vH0=57,qH0=69,uH0=73,wH0=91,MH0=103,LC=113,Zx=666,R7=1,RO=2,PC=3,PO=4,Ef1=3,jC=(A,Q)=>{return A.msg=RC[Q],Q},nSA=(A)=>{return A*2-(A>4?9:0)},RG=(A)=>{let Q=A.length;while(--Q>=0)A[Q]=0},Df1=(A)=>{let Q,$,B,E=A.w_size;Q=A.hash_size,B=Q;do $=A.head[--B],A.head[B]=$>=E?$-E:0;while(--Q);Q=E,B=Q;do $=A.prev[--B],A.prev[B]=$>=E?$-E:0;while(--Q)},Jf1=(A,Q,$)=>(Q<<A.hash_shift^$)&A.hash_mask,_G,p9=(A)=>{let Q=A.state,$=Q.pending;if($>A.avail_out)$=A.avail_out;if($===0)return;if(A.output.set(Q.pending_buf.subarray(Q.pending_out,Q.pending_out+$),A.next_out),A.next_out+=$,Q.pending_out+=$,A.total_out+=$,A.avail_out-=$,Q.pending-=$,Q.pending===0)Q.pending_out=0},l9=(A,Q)=>{xk1(A,A.block_start>=0?A.block_start:-1,A.strstart-A.block_start,Q),A.block_start=A.strstart,p9(A.strm)},Q6=(A,Q)=>{A.pending_buf[A.pending++]=Q},Yx=(A,Q)=>{A.pending_buf[A.pending++]=Q>>>8&255,A.pending_buf[A.pending++]=Q&255},OH0=(A,Q,$,B)=>{let E=A.avail_in;if(E>B)E=B;if(E===0)return 0;if(A.avail_in-=E,Q.set(A.input.subarray(A.next_in,A.next_in+E),$),A.state.wrap===1)A.adler=Cx(A.adler,Q,E,$);else if(A.state.wrap===2)A.adler=P3(A.adler,Q,E,$);return A.next_in+=E,A.total_in+=E,E},hkA=(A,Q)=>{let{max_chain_length:$,strstart:B}=A,E,D,J=A.prev_length,U=A.nice_match,Y=A.strstart>A.w_size-sU?A.strstart-(A.w_size-sU):0,Z=A.window,F=A.w_mask,X=A.prev,I=A.strstart+PG,G=Z[B+J-1],V=Z[B+J];if(A.prev_length>=A.good_match)$>>=2;if(U>A.lookahead)U=A.lookahead;do{if(E=Q,Z[E+J]!==V||Z[E+J-1]!==G||Z[E]!==Z[B]||Z[++E]!==Z[B+1])continue;B+=2,E++;do;while(Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&B<I);if(D=PG-(I-B),B=I-PG,D>J){if(A.match_start=Q,J=D,D>=U)break;G=Z[B+J-1],V=Z[B+J]}}while((Q=X[Q&F])>Y&&--$!==0);if(J<=A.lookahead)return J;return A.lookahead},LO=(A)=>{let Q=A.w_size,$,B,E;do{if(B=A.window_size-A.lookahead-A.strstart,A.strstart>=Q+(Q-sU)){if(A.window.set(A.window.subarray(Q,Q+Q-B),0),A.match_start-=Q,A.strstart-=Q,A.block_start-=Q,A.insert>A.strstart)A.insert=A.strstart;Df1(A),B+=Q}if(A.strm.avail_in===0)break;if($=OH0(A.strm,A.window,A.strstart+A.lookahead,B),A.lookahead+=$,A.lookahead+A.insert>=uQ){E=A.strstart-A.insert,A.ins_h=A.window[E],A.ins_h=_G(A,A.ins_h,A.window[E+1]);while(A.insert)if(A.ins_h=_G(A,A.ins_h,A.window[E+uQ-1]),A.prev[E&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=E,E++,A.insert--,A.lookahead+A.insert<uQ)break}}while(A.lookahead<sU&&A.strm.avail_in!==0)},gkA=(A,Q)=>{let $=A.pending_buf_size-5>A.w_size?A.w_size:A.pending_buf_size-5,B,E,D,J=0,U=A.strm.avail_in;do{if(B=65535,D=A.bi_valid+42>>3,A.strm.avail_out<D)break;if(D=A.strm.avail_out-D,E=A.strstart-A.block_start,B>E+A.strm.avail_in)B=E+A.strm.avail_in;if(B>D)B=D;if(B<$&&(B===0&&Q!==GD||Q===TG||B!==E+A.strm.avail_in))break;if(J=Q===GD&&B===E+A.strm.avail_in?1:0,HH0(A,0,0,J),A.pending_buf[A.pending-4]=B,A.pending_buf[A.pending-3]=B>>8,A.pending_buf[A.pending-2]=~B,A.pending_buf[A.pending-1]=~B>>8,p9(A.strm),E){if(E>B)E=B;A.strm.output.set(A.window.subarray(A.block_start,A.block_start+E),A.strm.next_out),A.strm.next_out+=E,A.strm.avail_out-=E,A.strm.total_out+=E,A.block_start+=E,B-=E}if(B)OH0(A.strm,A.strm.output,A.strm.next_out,B),A.strm.next_out+=B,A.strm.avail_out-=B,A.strm.total_out+=B}while(J===0);if(U-=A.strm.avail_in,U){if(U>=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<=U){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-U,A.strm.next_in),A.strstart),A.strstart+=U,A.insert+=U>A.w_size-A.insert?A.w_size-A.insert:U}A.block_start=A.strstart}if(A.high_water<A.strstart)A.high_water=A.strstart;if(J)return PO;if(Q!==TG&&Q!==GD&&A.strm.avail_in===0&&A.strstart===A.block_start)return RO;if(D=A.window_size-A.strstart,A.strm.avail_in>D&&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(D+=A.w_size,A.insert>A.strstart)A.insert=A.strstart}if(D>A.strm.avail_in)D=A.strm.avail_in;if(D)OH0(A.strm,A.window,A.strstart,D),A.strstart+=D,A.insert+=D>A.w_size-A.insert?A.w_size-A.insert:D;if(A.high_water<A.strstart)A.high_water=A.strstart;if(D=A.bi_valid+42>>3,D=A.pending_buf_size-D>65535?65535:A.pending_buf_size-D,$=D>A.w_size?A.w_size:D,E=A.strstart-A.block_start,E>=$||(E||Q===GD)&&Q!==TG&&A.strm.avail_in===0&&E<=D)B=E>D?D:E,J=Q===GD&&A.strm.avail_in===0&&B===E?1:0,HH0(A,A.block_start,B,J),A.block_start+=B,p9(A.strm);return J?PC:R7},YH0=(A,Q)=>{let $,B;for(;;){if(A.lookahead<sU){if(LO(A),A.lookahead<sU&&Q===TG)return R7;if(A.lookahead===0)break}if($=0,A.lookahead>=uQ)A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;if($!==0&&A.strstart-$<=A.w_size-sU)A.match_length=hkA(A,$);if(A.match_length>=uQ)if(B=vG(A,A.strstart-A.match_start,A.match_length-uQ),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=uQ){A.match_length--;do A.strstart++,A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=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=_G(A,A.ins_h,A.window[A.strstart+1]);else B=vG(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(B){if(l9(A,!1),A.strm.avail_out===0)return R7}}if(A.insert=A.strstart<uQ-1?A.strstart:uQ-1,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},uO=(A,Q)=>{let $,B,E;for(;;){if(A.lookahead<sU){if(LO(A),A.lookahead<sU&&Q===TG)return R7;if(A.lookahead===0)break}if($=0,A.lookahead>=uQ)A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=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=uQ-1,$!==0&&A.prev_length<A.max_lazy_match&&A.strstart-$<=A.w_size-sU){if(A.match_length=hkA(A,$),A.match_length<=5&&(A.strategy===ck1||A.match_length===uQ&&A.strstart-A.match_start>4096))A.match_length=uQ-1}if(A.prev_length>=uQ&&A.match_length<=A.prev_length){E=A.strstart+A.lookahead-uQ,B=vG(A,A.strstart-1-A.prev_match,A.prev_length-uQ),A.lookahead-=A.prev_length-1,A.prev_length-=2;do if(++A.strstart<=E)A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=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=uQ-1,A.strstart++,B){if(l9(A,!1),A.strm.avail_out===0)return R7}}else if(A.match_available){if(B=vG(A,0,A.window[A.strstart-1]),B)l9(A,!1);if(A.strstart++,A.lookahead--,A.strm.avail_out===0)return R7}else A.match_available=1,A.strstart++,A.lookahead--}if(A.match_available)B=vG(A,0,A.window[A.strstart-1]),A.match_available=0;if(A.insert=A.strstart<uQ-1?A.strstart:uQ-1,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},Uf1=(A,Q)=>{let $,B,E,D,J=A.window;for(;;){if(A.lookahead<=PG){if(LO(A),A.lookahead<=PG&&Q===TG)return R7;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=uQ&&A.strstart>0){if(E=A.strstart-1,B=J[E],B===J[++E]&&B===J[++E]&&B===J[++E]){D=A.strstart+PG;do;while(B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&E<D);if(A.match_length=PG-(D-E),A.match_length>A.lookahead)A.match_length=A.lookahead}}if(A.match_length>=uQ)$=vG(A,1,A.match_length-uQ),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0;else $=vG(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if($){if(l9(A,!1),A.strm.avail_out===0)return R7}}if(A.insert=0,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},Yf1=(A,Q)=>{let $;for(;;){if(A.lookahead===0){if(LO(A),A.lookahead===0){if(Q===TG)return R7;break}}if(A.match_length=0,$=vG(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,$){if(l9(A,!1),A.strm.avail_out===0)return R7}}if(A.insert=0,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},Fx,Zf1=(A)=>{A.window_size=2*A.w_size,RG(A.head),A.max_lazy_match=Fx[A.level].max_lazy,A.good_match=Fx[A.level].good_length,A.nice_match=Fx[A.level].nice_length,A.max_chain_length=Fx[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=uQ-1,A.match_available=0,A.ins_h=0},wx=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.status!==OO&&Q.status!==vH0&&Q.status!==qH0&&Q.status!==uH0&&Q.status!==wH0&&Q.status!==MH0&&Q.status!==LC&&Q.status!==Zx)return 1;return 0},mkA=(A)=>{if(wx(A))return jC(A,rU);A.total_in=A.total_out=0,A.data_type=nk1;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?vH0:Q.wrap?OO:LC,A.adler=Q.wrap===2?0:1,Q.last_flush=-2,yk1(Q),E5},dkA=(A)=>{let Q=mkA(A);if(Q===E5)Zf1(A.state);return Q},Xf1=(A,Q)=>{if(wx(A)||A.state.wrap!==2)return rU;return A.state.gzhead=Q,E5},ckA=(A,Q,$,B,E,D)=>{if(!A)return rU;let J=1;if(Q===dk1)Q=6;if(B<0)J=0,B=-B;else if(B>15)J=2,B-=16;if(E<1||E>ak1||$!==Oe||B<8||B>15||Q<0||Q>9||D<0||D>lk1||B===8&&J!==1)return jC(A,rU);if(B===8)B=9;let U=new Ff1;return A.state=U,U.strm=A,U.status=OO,U.wrap=J,U.gzhead=null,U.w_bits=B,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=E+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+uQ-1)/uQ),U.window=new Uint8Array(U.w_size*2),U.head=new Uint16Array(U.hash_size),U.prev=new Uint16Array(U.w_size),U.lit_bufsize=1<<E+6,U.pending_buf_size=U.lit_bufsize*4,U.pending_buf=new Uint8Array(U.pending_buf_size),U.sym_buf=U.lit_bufsize,U.sym_end=(U.lit_bufsize-1)*3,U.level=Q,U.strategy=D,U.method=$,dkA(A)},If1=(A,Q)=>{return ckA(A,Q,Oe,ok1,rk1,ik1)},Gf1=(A,Q)=>{if(wx(A)||Q>lSA||Q<0)return A?jC(A,rU):rU;let $=A.state;if(!A.output||A.avail_in!==0&&!A.input||$.status===Zx&&Q!==GD)return jC(A,A.avail_out===0?UH0:rU);let B=$.last_flush;if($.last_flush=Q,$.pending!==0){if(p9(A),A.avail_out===0)return $.last_flush=-1,E5}else if(A.avail_in===0&&nSA(Q)<=nSA(B)&&Q!==GD)return jC(A,UH0);if($.status===Zx&&A.avail_in!==0)return jC(A,UH0);if($.status===OO&&$.wrap===0)$.status=LC;if($.status===OO){let E=Oe+($.w_bits-8<<4)<<8,D=-1;if($.strategy>=Ke||$.level<2)D=0;else if($.level<6)D=1;else if($.level===6)D=2;else D=3;if(E|=D<<6,$.strstart!==0)E|=Bf1;if(E+=31-E%31,Yx($,E),$.strstart!==0)Yx($,A.adler>>>16),Yx($,A.adler&65535);if(A.adler=1,$.status=LC,p9(A),$.pending!==0)return $.last_flush=-1,E5}if($.status===vH0)if(A.adler=0,Q6($,31),Q6($,139),Q6($,8),!$.gzhead){if(Q6($,0),Q6($,0),Q6($,0),Q6($,0),Q6($,0),Q6($,$.level===9?2:$.strategy>=Ke||$.level<2?4:0),Q6($,Ef1),$.status=LC,p9(A),$.pending!==0)return $.last_flush=-1,E5}else{if(Q6($,($.gzhead.text?1:0)+($.gzhead.hcrc?2:0)+(!$.gzhead.extra?0:4)+(!$.gzhead.name?0:8)+(!$.gzhead.comment?0:16)),Q6($,$.gzhead.time&255),Q6($,$.gzhead.time>>8&255),Q6($,$.gzhead.time>>16&255),Q6($,$.gzhead.time>>24&255),Q6($,$.level===9?2:$.strategy>=Ke||$.level<2?4:0),Q6($,$.gzhead.os&255),$.gzhead.extra&&$.gzhead.extra.length)Q6($,$.gzhead.extra.length&255),Q6($,$.gzhead.extra.length>>8&255);if($.gzhead.hcrc)A.adler=P3(A.adler,$.pending_buf,$.pending,0);$.gzindex=0,$.status=qH0}if($.status===qH0){if($.gzhead.extra){let E=$.pending,D=($.gzhead.extra.length&65535)-$.gzindex;while($.pending+D>$.pending_buf_size){let U=$.pending_buf_size-$.pending;if($.pending_buf.set($.gzhead.extra.subarray($.gzindex,$.gzindex+U),$.pending),$.pending=$.pending_buf_size,$.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);if($.gzindex+=U,p9(A),$.pending!==0)return $.last_flush=-1,E5;E=0,D-=U}let J=new Uint8Array($.gzhead.extra);if($.pending_buf.set(J.subarray($.gzindex,$.gzindex+D),$.pending),$.pending+=D,$.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);$.gzindex=0}$.status=uH0}if($.status===uH0){if($.gzhead.name){let E=$.pending,D;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);if(p9(A),$.pending!==0)return $.last_flush=-1,E5;E=0}if($.gzindex<$.gzhead.name.length)D=$.gzhead.name.charCodeAt($.gzindex++)&255;else D=0;Q6($,D)}while(D!==0);if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);$.gzindex=0}$.status=wH0}if($.status===wH0){if($.gzhead.comment){let E=$.pending,D;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);if(p9(A),$.pending!==0)return $.last_flush=-1,E5;E=0}if($.gzindex<$.gzhead.comment.length)D=$.gzhead.comment.charCodeAt($.gzindex++)&255;else D=0;Q6($,D)}while(D!==0);if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E)}$.status=MH0}if($.status===MH0){if($.gzhead.hcrc){if($.pending+2>$.pending_buf_size){if(p9(A),$.pending!==0)return $.last_flush=-1,E5}Q6($,A.adler&255),Q6($,A.adler>>8&255),A.adler=0}if($.status=LC,p9(A),$.pending!==0)return $.last_flush=-1,E5}if(A.avail_in!==0||$.lookahead!==0||Q!==TG&&$.status!==Zx){let E=$.level===0?gkA($,Q):$.strategy===Ke?Yf1($,Q):$.strategy===pk1?Uf1($,Q):Fx[$.level].func($,Q);if(E===PC||E===PO)$.status=Zx;if(E===R7||E===PC){if(A.avail_out===0)$.last_flush=-1;return E5}if(E===RO){if(Q===hk1)bk1($);else if(Q!==lSA){if(HH0($,0,0,!1),Q===gk1){if(RG($.head),$.lookahead===0)$.strstart=0,$.block_start=0,$.insert=0}}if(p9(A),A.avail_out===0)return $.last_flush=-1,E5}}if(Q!==GD)return E5;if($.wrap<=0)return iSA;if($.wrap===2)Q6($,A.adler&255),Q6($,A.adler>>8&255),Q6($,A.adler>>16&255),Q6($,A.adler>>24&255),Q6($,A.total_in&255),Q6($,A.total_in>>8&255),Q6($,A.total_in>>16&255),Q6($,A.total_in>>24&255);else Yx($,A.adler>>>16),Yx($,A.adler&65535);if(p9(A),$.wrap>0)$.wrap=-$.wrap;return $.pending!==0?E5:iSA},Vf1=(A)=>{if(wx(A))return rU;let Q=A.state.status;return A.state=null,Q===LC?jC(A,mk1):E5},zf1=(A,Q)=>{let $=Q.length;if(wx(A))return rU;let B=A.state,E=B.wrap;if(E===2||E===1&&B.status!==OO||B.lookahead)return rU;if(E===1)A.adler=Cx(A.adler,Q,$,0);if(B.wrap=0,$>=B.w_size){if(E===0)RG(B.head),B.strstart=0,B.block_start=0,B.insert=0;let Y=new Uint8Array(B.w_size);Y.set(Q.subarray($-B.w_size,$),0),Q=Y,$=B.w_size}let{avail_in:D,next_in:J,input:U}=A;A.avail_in=$,A.next_in=0,A.input=Q,LO(B);while(B.lookahead>=uQ){let Y=B.strstart,Z=B.lookahead-(uQ-1);do B.ins_h=_G(B,B.ins_h,B.window[Y+uQ-1]),B.prev[Y&B.w_mask]=B.head[B.ins_h],B.head[B.ins_h]=Y,Y++;while(--Z);B.strstart=Y,B.lookahead=uQ-1,LO(B)}return B.strstart+=B.lookahead,B.block_start=B.strstart,B.insert=B.lookahead,B.lookahead=0,B.match_length=B.prev_length=uQ-1,B.match_available=0,A.next_in=J,A.input=U,A.avail_in=D,B.wrap=E,E5},Kf1,Wf1,Cf1,Hf1,Nf1,qf1,uf1,wf1,Mf1="pako deflate (from Nodeca project)",Ix,Of1=(A,Q)=>{return Object.prototype.hasOwnProperty.call(A,Q)},Lf1=function(A){let Q=Array.prototype.slice.call(arguments,1);while(Q.length){let $=Q.shift();if(!$)continue;if(typeof $!=="object")throw TypeError($+"must be non-object");for(let B in $)if(Of1($,B))A[B]=$[B]}return A},jf1=(A)=>{let Q=0;for(let B=0,E=A.length;B<E;B++)Q+=A[B].length;let $=new Uint8Array(Q);for(let B=0,E=0,D=A.length;B<D;B++){let J=A[B];$.set(J,E),E+=J.length}return $},Le,pkA=!0,Hx,Rf1=(A)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(A);let Q,$,B,E,D,J=A.length,U=0;for(E=0;E<J;E++){if($=A.charCodeAt(E),($&64512)===55296&&E+1<J){if(B=A.charCodeAt(E+1),(B&64512)===56320)$=65536+($-55296<<10)+(B-56320),E++}U+=$<128?1:$<2048?2:$<65536?3:4}Q=new Uint8Array(U);for(D=0,E=0;D<U;E++){if($=A.charCodeAt(E),($&64512)===55296&&E+1<J){if(B=A.charCodeAt(E+1),(B&64512)===56320)$=65536+($-55296<<10)+(B-56320),E++}if($<128)Q[D++]=$;else if($<2048)Q[D++]=192|$>>>6,Q[D++]=128|$&63;else if($<65536)Q[D++]=224|$>>>12,Q[D++]=128|$>>>6&63,Q[D++]=128|$&63;else Q[D++]=240|$>>>18,Q[D++]=128|$>>>12&63,Q[D++]=128|$>>>6&63,Q[D++]=128|$&63}return Q},Pf1=(A,Q)=>{if(Q<65534){if(A.subarray&&pkA)return String.fromCharCode.apply(null,A.length===Q?A:A.subarray(0,Q))}let $="";for(let B=0;B<Q;B++)$+=String.fromCharCode(A[B]);return $},vf1=(A,Q)=>{let $=Q||A.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(A.subarray(0,Q));let B,E,D=Array($*2);for(E=0,B=0;B<$;){let J=A[B++];if(J<128){D[E++]=J;continue}let U=Hx[J];if(U>4){D[E++]=65533,B+=U-1;continue}J&=U===2?31:U===3?15:7;while(U>1&&B<$)J=J<<6|A[B++]&63,U--;if(U>1){D[E++]=65533;continue}if(J<65536)D[E++]=J;else J-=65536,D[E++]=55296|J>>10&1023,D[E++]=56320|J&1023}return Pf1(D,E)},Tf1=(A,Q)=>{if(Q=Q||A.length,Q>A.length)Q=A.length;let $=Q-1;while($>=0&&(A[$]&192)===128)$--;if($<0)return Q;if($===0)return Q;return $+Hx[A[$]]>Q?$:Q},Nx,lkA,ikA,Sf1,kf1,ff1,yf1,we,xf1,bf1,hf1,gf1,cf1,pf1,lf1,if1,nf1,af1,We=16209,of1=16191,rf1=function(Q,$){let B,E,D,J,U,Y,Z,F,X,I,G,V,z,K,W,C,H,N,q,w,L,R,_,P,f=Q.state;B=Q.next_in,_=Q.input,E=B+(Q.avail_in-5),D=Q.next_out,P=Q.output,J=D-($-Q.avail_out),U=D+(Q.avail_out-257),Y=f.dmax,Z=f.wsize,F=f.whave,X=f.wnext,I=f.window,G=f.hold,V=f.bits,z=f.lencode,K=f.distcode,W=(1<<f.lenbits)-1,C=(1<<f.distbits)-1;A:do{if(V<15)G+=_[B++]<<V,V+=8,G+=_[B++]<<V,V+=8;H=z[G&W];Q:for(;;){if(N=H>>>24,G>>>=N,V-=N,N=H>>>16&255,N===0)P[D++]=H&65535;else if(N&16){if(q=H&65535,N&=15,N){if(V<N)G+=_[B++]<<V,V+=8;q+=G&(1<<N)-1,G>>>=N,V-=N}if(V<15)G+=_[B++]<<V,V+=8,G+=_[B++]<<V,V+=8;H=K[G&C];$:for(;;){if(N=H>>>24,G>>>=N,V-=N,N=H>>>16&255,N&16){if(w=H&65535,N&=15,V<N){if(G+=_[B++]<<V,V+=8,V<N)G+=_[B++]<<V,V+=8}if(w+=G&(1<<N)-1,w>Y){Q.msg="invalid distance too far back",f.mode=We;break A}if(G>>>=N,V-=N,N=D-J,w>N){if(N=w-N,N>F){if(f.sane){Q.msg="invalid distance too far back",f.mode=We;break A}}if(L=0,R=I,X===0){if(L+=Z-N,N<q){q-=N;do P[D++]=I[L++];while(--N);L=D-w,R=P}}else if(X<N){if(L+=Z+X-N,N-=X,N<q){q-=N;do P[D++]=I[L++];while(--N);if(L=0,X<q){N=X,q-=N;do P[D++]=I[L++];while(--N);L=D-w,R=P}}}else if(L+=X-N,N<q){q-=N;do P[D++]=I[L++];while(--N);L=D-w,R=P}while(q>2)P[D++]=R[L++],P[D++]=R[L++],P[D++]=R[L++],q-=3;if(q){if(P[D++]=R[L++],q>1)P[D++]=R[L++]}}else{L=D-w;do P[D++]=P[L++],P[D++]=P[L++],P[D++]=P[L++],q-=3;while(q>2);if(q){if(P[D++]=P[L++],q>1)P[D++]=P[L++]}}}else if((N&64)===0){H=K[(H&65535)+(G&(1<<N)-1)];continue $}else{Q.msg="invalid distance code",f.mode=We;break A}break}}else if((N&64)===0){H=z[(H&65535)+(G&(1<<N)-1)];continue Q}else if(N&32){f.mode=of1;break A}else{Q.msg="invalid literal/length code",f.mode=We;break A}break}}while(B<E&&D<U);q=V>>3,B-=q,V-=q<<3,G&=(1<<V)-1,Q.next_in=B,Q.next_out=D,Q.avail_in=B<E?5+(E-B):5-(B-E),Q.avail_out=D<U?257+(U-D):257-(D-U),f.hold=G,f.bits=V;return},wO=15,aSA=852,oSA=592,rSA=0,ZH0=1,sSA=2,sf1,tf1,ef1,Ay1,Qy1=(A,Q,$,B,E,D,J,U)=>{let Y=U.bits,Z=0,F=0,X=0,I=0,G=0,V=0,z=0,K=0,W=0,C=0,H,N,q,w,L,R=null,_,P=new Uint16Array(wO+1),f=new Uint16Array(wO+1),m=null,y,T,k;for(Z=0;Z<=wO;Z++)P[Z]=0;for(F=0;F<B;F++)P[Q[$+F]]++;G=Y;for(I=wO;I>=1;I--)if(P[I]!==0)break;if(G>I)G=I;if(I===0)return E[D++]=20971520,E[D++]=20971520,U.bits=1,0;for(X=1;X<I;X++)if(P[X]!==0)break;if(G<X)G=X;K=1;for(Z=1;Z<=wO;Z++)if(K<<=1,K-=P[Z],K<0)return-1;if(K>0&&(A===rSA||I!==1))return-1;f[1]=0;for(Z=1;Z<wO;Z++)f[Z+1]=f[Z]+P[Z];for(F=0;F<B;F++)if(Q[$+F]!==0)J[f[Q[$+F]]++]=F;if(A===rSA)R=m=J,_=20;else if(A===ZH0)R=sf1,m=tf1,_=257;else R=ef1,m=Ay1,_=0;if(C=0,F=0,Z=X,L=D,V=G,z=0,q=-1,W=1<<G,w=W-1,A===ZH0&&W>aSA||A===sSA&&W>oSA)return 1;for(;;){if(y=Z-z,J[F]+1<_)T=0,k=J[F];else if(J[F]>=_)T=m[J[F]-_],k=R[J[F]-_];else T=96,k=0;H=1<<Z-z,N=1<<V,X=N;do N-=H,E[L+(C>>z)+N]=y<<24|T<<16|k|0;while(N!==0);H=1<<Z-1;while(C&H)H>>=1;if(H!==0)C&=H-1,C+=H;else C=0;if(F++,--P[Z]===0){if(Z===I)break;Z=Q[$+J[F]]}if(Z>G&&(C&w)!==q){if(z===0)z=G;L+=X,V=Z-z,K=1<<V;while(V+z<I){if(K-=P[V+z],K<=0)break;V++,K<<=1}if(W+=1<<V,A===ZH0&&W>aSA||A===sSA&&W>oSA)return 1;q=C&w,E[q]=G<<24|V<<16|L-D|0}}if(C!==0)E[L+C]=Z-z<<24|4194304|0;return U.bits=G,0},Gx,$y1=0,nkA=1,akA=2,tSA,By1,Ce,vC,Ey1,Dy1,VD,okA,rkA,Jy1,eSA,je=16180,AkA=16181,QkA=16182,$kA=16183,BkA=16184,EkA=16185,DkA=16186,JkA=16187,UkA=16188,YkA=16189,Me=16190,HF=16191,FH0=16192,ZkA=16193,XH0=16194,FkA=16195,XkA=16196,IkA=16197,GkA=16198,He=16199,Ne=16200,VkA=16201,zkA=16202,KkA=16203,WkA=16204,CkA=16205,IH0=16206,HkA=16207,NkA=16208,L$=16209,skA=16210,tkA=16211,Uy1=852,Yy1=592,Zy1=15,Fy1,qkA=(A)=>{return(A>>>24&255)+(A>>>8&65280)+((A&65280)<<8)+((A&255)<<24)},_C=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.mode<je||Q.mode>tkA)return 1;return 0},ekA=(A)=>{if(_C(A))return VD;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=je,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(Uy1),Q.distcode=Q.distdyn=new Int32Array(Yy1),Q.sane=1,Q.back=-1,vC},AfA=(A)=>{if(_C(A))return VD;let Q=A.state;return Q.wsize=0,Q.whave=0,Q.wnext=0,ekA(A)},QfA=(A,Q)=>{let $;if(_C(A))return VD;let B=A.state;if(Q<0)$=0,Q=-Q;else if($=(Q>>4)+5,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return VD;if(B.window!==null&&B.wbits!==Q)B.window=null;return B.wrap=$,B.wbits=Q,AfA(A)},$fA=(A,Q)=>{if(!A)return VD;let $=new Xy1;A.state=$,$.strm=A,$.window=null,$.mode=je;let B=QfA(A,Q);if(B!==vC)A.state=null;return B},Iy1=(A)=>{return $fA(A,Fy1)},ukA=!0,GH0,VH0,Gy1=(A)=>{if(ukA){GH0=new Int32Array(512),VH0=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;Gx(nkA,A.lens,0,288,GH0,0,A.work,{bits:9}),Q=0;while(Q<32)A.lens[Q++]=5;Gx(akA,A.lens,0,32,VH0,0,A.work,{bits:5}),ukA=!1}A.lencode=GH0,A.lenbits=9,A.distcode=VH0,A.distbits=5},BfA=(A,Q,$,B)=>{let E,D=A.state;if(D.window===null)D.wsize=1<<D.wbits,D.wnext=0,D.whave=0,D.window=new Uint8Array(D.wsize);if(B>=D.wsize)D.window.set(Q.subarray($-D.wsize,$),0),D.wnext=0,D.whave=D.wsize;else{if(E=D.wsize-D.wnext,E>B)E=B;if(D.window.set(Q.subarray($-B,$-B+E),D.wnext),B-=E,B)D.window.set(Q.subarray($-B,$),0),D.wnext=B,D.whave=D.wsize;else{if(D.wnext+=E,D.wnext===D.wsize)D.wnext=0;if(D.whave<D.wsize)D.whave+=E}}return 0},Vy1=(A,Q)=>{let $,B,E,D,J,U,Y,Z,F,X,I,G,V,z,K=0,W,C,H,N,q,w,L,R,_=new Uint8Array(4),P,f,m=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(_C(A)||!A.output||!A.input&&A.avail_in!==0)return VD;if($=A.state,$.mode===HF)$.mode=FH0;J=A.next_out,E=A.output,Y=A.avail_out,D=A.next_in,B=A.input,U=A.avail_in,Z=$.hold,F=$.bits,X=U,I=Y,R=vC;A:for(;;)switch($.mode){case je:if($.wrap===0){$.mode=FH0;break}while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.wrap&2&&Z===35615){if($.wbits===0)$.wbits=15;$.check=0,_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0),Z=0,F=0,$.mode=AkA;break}if($.head)$.head.done=!1;if(!($.wrap&1)||(((Z&255)<<8)+(Z>>8))%31){A.msg="incorrect header check",$.mode=L$;break}if((Z&15)!==eSA){A.msg="unknown compression method",$.mode=L$;break}if(Z>>>=4,F-=4,L=(Z&15)+8,$.wbits===0)$.wbits=L;if(L>15||L>$.wbits){A.msg="invalid window size",$.mode=L$;break}$.dmax=1<<$.wbits,$.flags=0,A.adler=$.check=1,$.mode=Z&512?YkA:HF,Z=0,F=0;break;case AkA:while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.flags=Z,($.flags&255)!==eSA){A.msg="unknown compression method",$.mode=L$;break}if($.flags&57344){A.msg="unknown header flags set",$.mode=L$;break}if($.head)$.head.text=Z>>8&1;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0);Z=0,F=0,$.mode=QkA;case QkA:while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.head)$.head.time=Z;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,_[2]=Z>>>16&255,_[3]=Z>>>24&255,$.check=P3($.check,_,4,0);Z=0,F=0,$.mode=$kA;case $kA:while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.head)$.head.xflags=Z&255,$.head.os=Z>>8;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0);Z=0,F=0,$.mode=BkA;case BkA:if($.flags&1024){while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.length=Z,$.head)$.head.extra_len=Z;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0);Z=0,F=0}else if($.head)$.head.extra=null;$.mode=EkA;case EkA:if($.flags&1024){if(G=$.length,G>U)G=U;if(G){if($.head){if(L=$.head.extra_len-$.length,!$.head.extra)$.head.extra=new Uint8Array($.head.extra_len);$.head.extra.set(B.subarray(D,D+G),L)}if($.flags&512&&$.wrap&4)$.check=P3($.check,B,G,D);U-=G,D+=G,$.length-=G}if($.length)break A}$.length=0,$.mode=DkA;case DkA:if($.flags&2048){if(U===0)break A;G=0;do if(L=B[D+G++],$.head&&L&&$.length<65536)$.head.name+=String.fromCharCode(L);while(L&&G<U);if($.flags&512&&$.wrap&4)$.check=P3($.check,B,G,D);if(U-=G,D+=G,L)break A}else if($.head)$.head.name=null;$.length=0,$.mode=JkA;case JkA:if($.flags&4096){if(U===0)break A;G=0;do if(L=B[D+G++],$.head&&L&&$.length<65536)$.head.comment+=String.fromCharCode(L);while(L&&G<U);if($.flags&512&&$.wrap&4)$.check=P3($.check,B,G,D);if(U-=G,D+=G,L)break A}else if($.head)$.head.comment=null;$.mode=UkA;case UkA:if($.flags&512){while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.wrap&4&&Z!==($.check&65535)){A.msg="header crc mismatch",$.mode=L$;break}Z=0,F=0}if($.head)$.head.hcrc=$.flags>>9&1,$.head.done=!0;A.adler=$.check=0,$.mode=HF;break;case YkA:while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}A.adler=$.check=qkA(Z),Z=0,F=0,$.mode=Me;case Me:if($.havedict===0)return A.next_out=J,A.avail_out=Y,A.next_in=D,A.avail_in=U,$.hold=Z,$.bits=F,Dy1;A.adler=$.check=1,$.mode=HF;case HF:if(Q===By1||Q===Ce)break A;case FH0:if($.last){Z>>>=F&7,F-=F&7,$.mode=IH0;break}while(F<3){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}switch($.last=Z&1,Z>>>=1,F-=1,Z&3){case 0:$.mode=ZkA;break;case 1:if(Gy1($),$.mode=He,Q===Ce){Z>>>=2,F-=2;break A}break;case 2:$.mode=XkA;break;case 3:A.msg="invalid block type",$.mode=L$}Z>>>=2,F-=2;break;case ZkA:Z>>>=F&7,F-=F&7;while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if((Z&65535)!==(Z>>>16^65535)){A.msg="invalid stored block lengths",$.mode=L$;break}if($.length=Z&65535,Z=0,F=0,$.mode=XH0,Q===Ce)break A;case XH0:$.mode=FkA;case FkA:if(G=$.length,G){if(G>U)G=U;if(G>Y)G=Y;if(G===0)break A;E.set(B.subarray(D,D+G),J),U-=G,D+=G,Y-=G,J+=G,$.length-=G;break}$.mode=HF;break;case XkA:while(F<14){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.nlen=(Z&31)+257,Z>>>=5,F-=5,$.ndist=(Z&31)+1,Z>>>=5,F-=5,$.ncode=(Z&15)+4,Z>>>=4,F-=4,$.nlen>286||$.ndist>30){A.msg="too many length or distance symbols",$.mode=L$;break}$.have=0,$.mode=IkA;case IkA:while($.have<$.ncode){while(F<3){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}$.lens[m[$.have++]]=Z&7,Z>>>=3,F-=3}while($.have<19)$.lens[m[$.have++]]=0;if($.lencode=$.lendyn,$.lenbits=7,P={bits:$.lenbits},R=Gx($y1,$.lens,0,19,$.lencode,0,$.work,P),$.lenbits=P.bits,R){A.msg="invalid code lengths set",$.mode=L$;break}$.have=0,$.mode=GkA;case GkA:while($.have<$.nlen+$.ndist){for(;;){if(K=$.lencode[Z&(1<<$.lenbits)-1],W=K>>>24,C=K>>>16&255,H=K&65535,W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if(H<16)Z>>>=W,F-=W,$.lens[$.have++]=H;else{if(H===16){f=W+2;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if(Z>>>=W,F-=W,$.have===0){A.msg="invalid bit length repeat",$.mode=L$;break}L=$.lens[$.have-1],G=3+(Z&3),Z>>>=2,F-=2}else if(H===17){f=W+3;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=W,F-=W,L=0,G=3+(Z&7),Z>>>=3,F-=3}else{f=W+7;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=W,F-=W,L=0,G=11+(Z&127),Z>>>=7,F-=7}if($.have+G>$.nlen+$.ndist){A.msg="invalid bit length repeat",$.mode=L$;break}while(G--)$.lens[$.have++]=L}}if($.mode===L$)break;if($.lens[256]===0){A.msg="invalid code -- missing end-of-block",$.mode=L$;break}if($.lenbits=9,P={bits:$.lenbits},R=Gx(nkA,$.lens,0,$.nlen,$.lencode,0,$.work,P),$.lenbits=P.bits,R){A.msg="invalid literal/lengths set",$.mode=L$;break}if($.distbits=6,$.distcode=$.distdyn,P={bits:$.distbits},R=Gx(akA,$.lens,$.nlen,$.ndist,$.distcode,0,$.work,P),$.distbits=P.bits,R){A.msg="invalid distances set",$.mode=L$;break}if($.mode=He,Q===Ce)break A;case He:$.mode=Ne;case Ne:if(U>=6&&Y>=258){if(A.next_out=J,A.avail_out=Y,A.next_in=D,A.avail_in=U,$.hold=Z,$.bits=F,rf1(A,I),J=A.next_out,E=A.output,Y=A.avail_out,D=A.next_in,B=A.input,U=A.avail_in,Z=$.hold,F=$.bits,$.mode===HF)$.back=-1;break}$.back=0;for(;;){if(K=$.lencode[Z&(1<<$.lenbits)-1],W=K>>>24,C=K>>>16&255,H=K&65535,W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if(C&&(C&240)===0){N=W,q=C,w=H;for(;;){if(K=$.lencode[w+((Z&(1<<N+q)-1)>>N)],W=K>>>24,C=K>>>16&255,H=K&65535,N+W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=N,F-=N,$.back+=N}if(Z>>>=W,F-=W,$.back+=W,$.length=H,C===0){$.mode=CkA;break}if(C&32){$.back=-1,$.mode=HF;break}if(C&64){A.msg="invalid literal/length code",$.mode=L$;break}$.extra=C&15,$.mode=VkA;case VkA:if($.extra){f=$.extra;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}$.length+=Z&(1<<$.extra)-1,Z>>>=$.extra,F-=$.extra,$.back+=$.extra}$.was=$.length,$.mode=zkA;case zkA:for(;;){if(K=$.distcode[Z&(1<<$.distbits)-1],W=K>>>24,C=K>>>16&255,H=K&65535,W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if((C&240)===0){N=W,q=C,w=H;for(;;){if(K=$.distcode[w+((Z&(1<<N+q)-1)>>N)],W=K>>>24,C=K>>>16&255,H=K&65535,N+W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=N,F-=N,$.back+=N}if(Z>>>=W,F-=W,$.back+=W,C&64){A.msg="invalid distance code",$.mode=L$;break}$.offset=H,$.extra=C&15,$.mode=KkA;case KkA:if($.extra){f=$.extra;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}$.offset+=Z&(1<<$.extra)-1,Z>>>=$.extra,F-=$.extra,$.back+=$.extra}if($.offset>$.dmax){A.msg="invalid distance too far back",$.mode=L$;break}$.mode=WkA;case WkA:if(Y===0)break A;if(G=I-Y,$.offset>G){if(G=$.offset-G,G>$.whave){if($.sane){A.msg="invalid distance too far back",$.mode=L$;break}}if(G>$.wnext)G-=$.wnext,V=$.wsize-G;else V=$.wnext-G;if(G>$.length)G=$.length;z=$.window}else z=E,V=J-$.offset,G=$.length;if(G>Y)G=Y;Y-=G,$.length-=G;do E[J++]=z[V++];while(--G);if($.length===0)$.mode=Ne;break;case CkA:if(Y===0)break A;E[J++]=$.length,Y--,$.mode=Ne;break;case IH0:if($.wrap){while(F<32){if(U===0)break A;U--,Z|=B[D++]<<F,F+=8}if(I-=Y,A.total_out+=I,$.total+=I,$.wrap&4&&I)A.adler=$.check=$.flags?P3($.check,E,I,J-I):Cx($.check,E,I,J-I);if(I=Y,$.wrap&4&&($.flags?Z:qkA(Z))!==$.check){A.msg="incorrect data check",$.mode=L$;break}Z=0,F=0}$.mode=HkA;case HkA:if($.wrap&&$.flags){while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.wrap&4&&Z!==($.total&4294967295)){A.msg="incorrect length check",$.mode=L$;break}Z=0,F=0}$.mode=NkA;case NkA:R=Ey1;break A;case L$:R=okA;break A;case skA:return rkA;case tkA:default:return VD}if(A.next_out=J,A.avail_out=Y,A.next_in=D,A.avail_in=U,$.hold=Z,$.bits=F,$.wsize||I!==A.avail_out&&$.mode<L$&&($.mode<IH0||Q!==tSA)){if(BfA(A,A.output,A.next_out,I-A.avail_out));}if(X-=A.avail_in,I-=A.avail_out,A.total_in+=X,A.total_out+=I,$.total+=I,$.wrap&4&&I)A.adler=$.check=$.flags?P3($.check,E,I,A.next_out-I):Cx($.check,E,I,A.next_out-I);if(A.data_type=$.bits+($.last?64:0)+($.mode===HF?128:0)+($.mode===He||$.mode===XH0?256:0),(X===0&&I===0||Q===tSA)&&R===vC)R=Jy1;return R},zy1=(A)=>{if(_C(A))return VD;let Q=A.state;if(Q.window)Q.window=null;return A.state=null,vC},Ky1=(A,Q)=>{if(_C(A))return VD;let $=A.state;if(($.wrap&2)===0)return VD;return $.head=Q,Q.done=!1,vC},Wy1=(A,Q)=>{let $=Q.length,B,E,D;if(_C(A))return VD;if(B=A.state,B.wrap!==0&&B.mode!==Me)return VD;if(B.mode===Me){if(E=1,E=Cx(E,Q,$,0),E!==B.check)return okA}if(D=BfA(A,Q,$,$),D)return B.mode=skA,rkA;return B.havedict=1,vC},Cy1,Hy1,Ny1,qy1,uy1,wy1,My1,Oy1,Ly1,jy1="pako inflate (from Nodeca project)",qF,Py1,EfA,vy1,Ty1,qx,zH0,KH0,_y1,wkA,Sy1,fy1,yy1,xy1,by1,hy1,gy1,my1,dy1,cy1,py1,ly1,iy1,ny1,ay1,oy1,ry1,sy1,ty1,ey1,Ax1,Qx1,$x1,Bx1,DfA;var JfA=C0(()=>{/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */Vx=ux+1+LH0,OkA=2*Vx+1,WH0=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]),qe=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]),Vk1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),PkA=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),NF=Array((Vx+2)*2);jO(NF);Xx=Array(MO*2);jO(Xx);zx=Array(zk1);jO(zx);Kx=Array(Ik1-Xk1+1);jO(Kx);PH0=Array(LH0);jO(PH0);ue=Array(MO);jO(ue);Lk1=uk1,jk1=bkA,Rk1=Mk1,Pk1=Ok1,vk1=wk1,Tk1={_tr_init:Lk1,_tr_stored_block:jk1,_tr_flush_block:Rk1,_tr_tally:Pk1,_tr_align:vk1},Cx=_k1,kk1=new Uint32Array(Sk1()),P3=fk1,RC={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"},TC={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:yk1,_tr_stored_block:HH0,_tr_flush_block:xk1,_tr_tally:vG,_tr_align:bk1}=Tk1,{Z_NO_FLUSH:TG,Z_PARTIAL_FLUSH:hk1,Z_FULL_FLUSH:gk1,Z_FINISH:GD,Z_BLOCK:lSA,Z_OK:E5,Z_STREAM_END:iSA,Z_STREAM_ERROR:rU,Z_DATA_ERROR:mk1,Z_BUF_ERROR:UH0,Z_DEFAULT_COMPRESSION:dk1,Z_FILTERED:ck1,Z_HUFFMAN_ONLY:Ke,Z_RLE:pk1,Z_FIXED:lk1,Z_DEFAULT_STRATEGY:ik1,Z_UNKNOWN:nk1,Z_DEFLATED:Oe}=TC,NH0=tk1+1+sk1,Qf1=2*NH0+1,sU=PG+uQ+1,_G=Jf1;Fx=[new aU(0,0,0,0,gkA),new aU(4,4,8,4,YH0),new aU(4,5,16,8,YH0),new aU(4,6,32,32,YH0),new aU(4,4,16,16,uO),new aU(8,16,32,32,uO),new aU(8,16,128,128,uO),new aU(8,32,128,256,uO),new aU(32,128,258,1024,uO),new aU(32,258,258,4096,uO)];Kf1=If1,Wf1=ckA,Cf1=dkA,Hf1=mkA,Nf1=Xf1,qf1=Gf1,uf1=Vf1,wf1=zf1,Ix={deflateInit:Kf1,deflateInit2:Wf1,deflateReset:Cf1,deflateResetKeep:Hf1,deflateSetHeader:Nf1,deflate:qf1,deflateEnd:uf1,deflateSetDictionary:wf1,deflateInfo:Mf1},Le={assign:Lf1,flattenChunks:jf1};try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(A){pkA=!1}Hx=new Uint8Array(256);for(let A=0;A<256;A++)Hx[A]=A>=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;Hx[254]=Hx[254]=1;Nx={string2buf:Rf1,buf2string:vf1,utf8border:Tf1};lkA=_f1,ikA=Object.prototype.toString,{Z_NO_FLUSH:Sf1,Z_SYNC_FLUSH:kf1,Z_FULL_FLUSH:ff1,Z_FINISH:yf1,Z_OK:we,Z_STREAM_END:xf1,Z_DEFAULT_COMPRESSION:bf1,Z_DEFAULT_STRATEGY:hf1,Z_DEFLATED:gf1}=TC;Mx.prototype.push=function(A,Q){let $=this.strm,B=this.options.chunkSize,E,D;if(this.ended)return!1;if(Q===~~Q)D=Q;else D=Q===!0?yf1:Sf1;if(typeof A==="string")$.input=Nx.string2buf(A);else if(ikA.call(A)==="[object ArrayBuffer]")$.input=new Uint8Array(A);else $.input=A;$.next_in=0,$.avail_in=$.input.length;for(;;){if($.avail_out===0)$.output=new Uint8Array(B),$.next_out=0,$.avail_out=B;if((D===kf1||D===ff1)&&$.avail_out<=6){this.onData($.output.subarray(0,$.next_out)),$.avail_out=0;continue}if(E=Ix.deflate($,D),E===xf1){if($.next_out>0)this.onData($.output.subarray(0,$.next_out));return E=Ix.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===we}if($.avail_out===0){this.onData($.output);continue}if(D>0&&$.next_out>0){this.onData($.output.subarray(0,$.next_out)),$.avail_out=0;continue}if($.avail_in===0)break}return!0};Mx.prototype.onData=function(A){this.chunks.push(A)};Mx.prototype.onEnd=function(A){if(A===we)this.result=Le.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};cf1=Mx,pf1=TH0,lf1=mf1,if1=df1,nf1=TC,af1={Deflate:cf1,deflate:pf1,deflateRaw:lf1,gzip:if1,constants:nf1},sf1=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]),tf1=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]),ef1=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]),Ay1=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]),Gx=Qy1,{Z_FINISH:tSA,Z_BLOCK:By1,Z_TREES:Ce,Z_OK:vC,Z_STREAM_END:Ey1,Z_NEED_DICT:Dy1,Z_STREAM_ERROR:VD,Z_DATA_ERROR:okA,Z_MEM_ERROR:rkA,Z_BUF_ERROR:Jy1,Z_DEFLATED:eSA}=TC,Fy1=Zy1;Cy1=AfA,Hy1=QfA,Ny1=ekA,qy1=Iy1,uy1=$fA,wy1=Vy1,My1=zy1,Oy1=Ky1,Ly1=Wy1,qF={inflateReset:Cy1,inflateReset2:Hy1,inflateResetKeep:Ny1,inflateInit:qy1,inflateInit2:uy1,inflate:wy1,inflateEnd:My1,inflateGetHeader:Oy1,inflateSetDictionary:Ly1,inflateInfo:jy1};Py1=Ry1,EfA=Object.prototype.toString,{Z_NO_FLUSH:vy1,Z_FINISH:Ty1,Z_OK:qx,Z_STREAM_END:zH0,Z_NEED_DICT:KH0,Z_STREAM_ERROR:_y1,Z_DATA_ERROR:wkA,Z_MEM_ERROR:Sy1}=TC;Ox.prototype.push=function(A,Q){let $=this.strm,B=this.options.chunkSize,E=this.options.dictionary,D,J,U;if(this.ended)return!1;if(Q===~~Q)J=Q;else J=Q===!0?Ty1:vy1;if(EfA.call(A)==="[object ArrayBuffer]")$.input=new Uint8Array(A);else $.input=A;$.next_in=0,$.avail_in=$.input.length;for(;;){if($.avail_out===0)$.output=new Uint8Array(B),$.next_out=0,$.avail_out=B;if(D=qF.inflate($,J),D===KH0&&E){if(D=qF.inflateSetDictionary($,E),D===qx)D=qF.inflate($,J);else if(D===wkA)D=KH0}while($.avail_in>0&&D===zH0&&$.state.wrap>0&&A[$.next_in]!==0)qF.inflateReset($),D=qF.inflate($,J);switch(D){case _y1:case wkA:case KH0:case Sy1:return this.onEnd(D),this.ended=!0,!1}if(U=$.avail_out,$.next_out){if($.avail_out===0||D===zH0)if(this.options.to==="string"){let Y=Nx.utf8border($.output,$.next_out),Z=$.next_out-Y,F=Nx.buf2string($.output,Y);if($.next_out=Z,$.avail_out=B-Z,Z)$.output.set($.output.subarray(Y,Y+Z),0);this.onData(F)}else this.onData($.output.length===$.next_out?$.output:$.output.subarray(0,$.next_out))}if(D===qx&&U===0)continue;if(D===zH0)return D=qF.inflateEnd(this.strm),this.onEnd(D),this.ended=!0,!0;if($.avail_in===0)break}return!0};Ox.prototype.onData=function(A){this.chunks.push(A)};Ox.prototype.onEnd=function(A){if(A===qx)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=Le.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};fy1=Ox,yy1=_H0,xy1=ky1,by1=_H0,hy1=TC,gy1={Inflate:fy1,inflate:yy1,inflateRaw:xy1,ungzip:by1,constants:hy1},{Deflate:my1,deflate:dy1,deflateRaw:cy1,gzip:py1}=af1,{Inflate:ly1,inflate:iy1,inflateRaw:ny1,ungzip:ay1}=gy1,oy1=my1,ry1=dy1,sy1=cy1,ty1=py1,ey1=ly1,Ax1=iy1,Qx1=ny1,$x1=ay1,Bx1=TC,DfA={Deflate:oy1,deflate:ry1,deflateRaw:sy1,gzip:ty1,Inflate:ey1,inflate:Ax1,inflateRaw:Qx1,ungzip:$x1,constants:Bx1}});var UfA="This cost reflects only Amp credits consumed. It does not include any model provider usage billed directly to customer-managed model provider keys.";var Ex1,Cm6,Hm6,tU=64,SC,SH0=1024,kH0=500,Nm6;var Lx=C0(()=>{M7();Ex1=["private","public_unlisted","public_discoverable","thread_workspace_shared"],Cm6=j.enum(Ex1),Hm6=j.union([j.object({visibility:j.literal("private"),sharedGroupIDs:j.array(j.string())}),j.object({visibility:j.literal("private"),shareWithAllCreatorGroups:j.literal(!0)}),j.object({visibility:j.enum(["thread_workspace_shared","public_unlisted","public_discoverable"])})]),SC=/^[a-z0-9](?:[a-z0-9]*(?:-[a-z0-9]+)*)?$/,Nm6=j.string().regex(SC,"Must be lowercase a-z, 0-9, hyphens only, no start/end hyphen, no consecutive hyphens").min(1).max(tU)});var YfA=()=>{};var fH0=C0(()=>{SB()});function yH0(A){return pf(vO,A)}function Jx1(A){return MM(ZfA,A)}function Ux1(A){return WC(FfA,A)}function Yx1(A){return OM(jx,A)}function Zx1(A){return LM(jx,A)}function Fx1(A){return jM(jx,A)}function Xx1(A){return RM(jx,A)}function Ix1(A){return UG(xH0,A)}function Gx1(A){return UG(xH0,{protocol:/^https?$/,hostname:A3.domain,...zA(A)})}function Vx1(A){return PM(XfA,A)}function zx1(A){return vM(IfA,A)}function Kx1(A){return TM(GfA,A)}function Wx1(A){return _M(VfA,A)}function Cx1(A){return SM(zfA,A)}function Hx1(A){return kM(KfA,A)}function Nx1(A){return fM(WfA,A)}function qx1(A){return yM(CfA,A)}function ux1(A){return xM(HfA,A)}function wx1(A){return bM(NfA,A)}function Mx1(A){return hM(qfA,A)}function Ox1(A){return nf(ufA,A)}function Lx1(A){return gM(wfA,A)}function jx1(A){return mM(MfA,A)}function Rx1(A){return dM(OfA,A)}function Px1(A){return cM(LfA,A)}function vx1(A,Q,$={}){return dJ(Rx,A,Q,$)}function Tx1(A){return dJ(Rx,"hostname",A3.hostname,A)}function _x1(A){return dJ(Rx,"hex",A3.hex,A)}function Sx1(A,Q){let $=Q?.enc??"hex",B=`${A}_${$}`,E=A3[B];if(!E)throw Error(`Unrecognized hash format: ${B}`);return dJ(Rx,B,E,Q)}function jfA(A){return ef(Px,A)}function kx1(A){return Qy(TO,A)}function fx1(A){return $y(TO,A)}function yx1(A){return By(TO,A)}function xx1(A){return Ey(TO,A)}function bx1(A){return Dy(TO,A)}function RfA(A){return Jy(vx,A)}function hx1(A){return Yy(Tx,A)}function gx1(A){return Fy(bH0,A)}function mx1(A){return Xy(bH0,A)}function dx1(A){return Iy(PfA,A)}function cx1(A){return Gy(vfA,A)}function _fA(A){return Vy(TfA,A)}function px1(){return zy(SfA)}function Re(){return Ky(kfA)}function yfA(A){return Wy(ffA,A)}function lx1(A){return Cy(xfA,A)}function ix1(A){return Hy(Pe,A)}function hH0(A,Q){return new bfA({type:"array",element:A,...zA(Q)})}function nx1(A){let Q=A._zod.def.shape;return ofA(Object.keys(Q))}function hfA(A,Q){let $={type:"object",shape:A??{},...zA(Q)};return new ve($)}function ax1(A,Q){return new ve({type:"object",shape:A,catchall:yfA(),...zA(Q)})}function ox1(A,Q){return new ve({type:"object",shape:A,catchall:Re(),...zA(Q)})}function rx1(A,Q){return ys(A,Q)}function sx1(A,Q){return LV0(A,Q)}function tx1(A,Q){return ys(A,Q)}function ex1(A,Q){return MV0(A,Q)}function Ab1(A,Q){return OV0(A,Q)}function Qb1(A,Q){return jV0(dH0,A,Q)}function $b1(A,Q){return RV0(cH0,A,Q)}function Bb1(A,Q){return A.clone({...A._zod.def,catchall:Q})}function gfA(A,Q){return new gH0({type:"union",options:A,...zA(Q)})}function Eb1(A,Q){return new mfA({type:"union",options:A,inclusive:!1,...zA(Q)})}function Db1(A,Q,$){return new dfA({type:"union",options:Q,discriminator:A,...zA($)})}function Jb1(A,Q){return new cfA({type:"intersection",left:A,right:Q})}function lfA(A,Q,$){let B=Q instanceof z1;return new pfA({type:"tuple",items:A,rest:B?Q:null,...zA(B?$:Q)})}function ifA(A,Q,$){return new Te({type:"record",keyType:A,valueType:Q,...zA($)})}function Ub1(A,Q,$){let B=_B(A);return B._zod.values=void 0,new Te({type:"record",keyType:B,valueType:Q,...zA($)})}function Yb1(A,Q,$){return new Te({type:"record",keyType:A,valueType:Q,mode:"loose",...zA($)})}function Zb1(A,Q,$){return new nfA({type:"map",keyType:A,valueType:Q,...zA($)})}function Fb1(A,Q){return new afA({type:"set",valueType:A,...zA(Q)})}function ofA(A,Q){let $=Array.isArray(A)?Object.fromEntries(A.map((B)=>[B,B])):A;return new mH0({type:"enum",entries:$,...zA(Q)})}function Xb1(A,Q){return new mH0({type:"enum",entries:A,...zA(Q)})}function Ib1(A,Q){return new rfA({type:"literal",values:Array.isArray(A)?A:[A],...zA(Q)})}function Gb1(A){return uy(sfA,A)}function Vb1(A){return new tfA({type:"transform",transform:A})}function efA(A){return new dH0({type:"optional",innerType:A})}function zb1(A){return new AyA({type:"optional",innerType:A})}function $yA(A){return new QyA({type:"nullable",innerType:A})}function Kb1(A){return efA($yA(A))}function Wb1(A,Q){return new ByA({type:"default",innerType:A,get defaultValue(){return typeof Q==="function"?Q():XM(Q)}})}function Cb1(A,Q){return new EyA({type:"prefault",innerType:A,get defaultValue(){return typeof Q==="function"?Q():XM(Q)}})}function Hb1(A,Q){return new cH0({type:"nonoptional",innerType:A,...zA(Q)})}function Nb1(A){return new DyA({type:"success",innerType:A})}function qb1(A,Q){return new JyA({type:"catch",innerType:A,catchValue:typeof Q==="function"?Q:()=>Q})}function ub1(A){return qy(UyA,A)}function wb1(A,Q){return new pH0({type:"pipe",in:A,out:Q})}function Mb1(A,Q,$){return new lH0({type:"pipe",in:A,out:Q,transform:$.decode,reverseTransform:$.encode})}function Ob1(A){return new YyA({type:"readonly",innerType:A})}function Lb1(A,Q){return new ZyA({type:"template_literal",parts:A,...zA(Q)})}function XyA(A){return new FyA({type:"lazy",getter:A})}function jb1(A){return new IyA({type:"promise",innerType:A})}function Rb1(A,Q){let $=new C6({check:"custom",...zA(Q)});return $._zod.check=A,$}function GyA(A,Q){return wy(iH0,A??(()=>!0),Q)}function Pb1(A,Q={}){return My(iH0,A,Q)}function vb1(A){return Oy(A)}function Sb1(A,Q={}){let $=GyA((B)=>B instanceof A,Q);return $._zod.bag.Class=A,$._zod.check=(B)=>{if(!(B.value instanceof A))B.issues.push({code:"invalid_type",expected:A.name,input:B.value,inst:$,path:[...$._zod.def.path??[]]})},$}function fb1(){let A=XyA(()=>{return gfA([yH0(),jfA(),RfA(),_fA(),hH0(A),ifA(yH0(),A)])});return A}function yb1(A){return new VyA({type:"function",input:Array.isArray(A?.input)?lfA(A?.input):A?.input??hH0(Re()),output:A?.output??Re()})}var h1,vO,l6,ZfA,FfA,jx,xH0,XfA,IfA,GfA,VfA,zfA,KfA,WfA,CfA,HfA,NfA,qfA,ufA,wfA,MfA,OfA,LfA,Rx,Px,TO,vx,Tx,bH0,PfA,vfA,TfA,SfA,kfA,ffA,xfA,Pe,bfA,ve,gH0,mfA,dfA,cfA,pfA,Te,nfA,afA,mH0,rfA,sfA,tfA,dH0,AyA,QyA,ByA,EyA,cH0,DyA,JyA,UyA,pH0,lH0,YyA,ZyA,FyA,IyA,iH0,Tb1,_b1,kb1=(...A)=>Ry({Codec:lH0,Boolean:vx,String:vO},...A),VyA;var _e=C0(()=>{SB();_4();fH0();h1=M0("ZodMiniType",(A,Q)=>{if(!A._zod)throw Error("Uninitialized schema in ZodMiniType.");z1.init(A,Q),A.def=Q,A.type=Q.type,A.parse=($,B)=>EG(A,$,B,{callee:A.parse}),A.safeParse=($,B)=>XF(A,$,B),A.parseAsync=async($,B)=>DG(A,$,B,{callee:A.parseAsync}),A.safeParseAsync=async($,B)=>JG(A,$,B),A.check=(...$)=>{return A.clone({...Q,checks:[...Q.checks??[],...$.map((B)=>typeof B==="function"?{_zod:{check:B,def:{check:"custom"},onattach:[]}}:B)]},{parent:!0})},A.with=A.check,A.clone=($,B)=>_B(A,$,B),A.brand=()=>A,A.register=($,B)=>{return $.add(A,B),A},A.apply=($)=>$(A)}),vO=M0("ZodMiniString",(A,Q)=>{IF.init(A,Q),h1.init(A,Q)});l6=M0("ZodMiniStringFormat",(A,Q)=>{U6.init(A,Q),vO.init(A,Q)}),ZfA=M0("ZodMiniEmail",(A,Q)=>{_k.init(A,Q),l6.init(A,Q)});FfA=M0("ZodMiniGUID",(A,Q)=>{vk.init(A,Q),l6.init(A,Q)});jx=M0("ZodMiniUUID",(A,Q)=>{Tk.init(A,Q),l6.init(A,Q)});xH0=M0("ZodMiniURL",(A,Q)=>{Sk.init(A,Q),l6.init(A,Q)});XfA=M0("ZodMiniEmoji",(A,Q)=>{kk.init(A,Q),l6.init(A,Q)});IfA=M0("ZodMiniNanoID",(A,Q)=>{fk.init(A,Q),l6.init(A,Q)});GfA=M0("ZodMiniCUID",(A,Q)=>{yk.init(A,Q),l6.init(A,Q)});VfA=M0("ZodMiniCUID2",(A,Q)=>{xk.init(A,Q),l6.init(A,Q)});zfA=M0("ZodMiniULID",(A,Q)=>{bk.init(A,Q),l6.init(A,Q)});KfA=M0("ZodMiniXID",(A,Q)=>{hk.init(A,Q),l6.init(A,Q)});WfA=M0("ZodMiniKSUID",(A,Q)=>{gk.init(A,Q),l6.init(A,Q)});CfA=M0("ZodMiniIPv4",(A,Q)=>{lk.init(A,Q),l6.init(A,Q)});HfA=M0("ZodMiniIPv6",(A,Q)=>{ik.init(A,Q),l6.init(A,Q)});NfA=M0("ZodMiniCIDRv4",(A,Q)=>{ak.init(A,Q),l6.init(A,Q)});qfA=M0("ZodMiniCIDRv6",(A,Q)=>{ok.init(A,Q),l6.init(A,Q)});ufA=M0("ZodMiniMAC",(A,Q)=>{nk.init(A,Q),l6.init(A,Q)});wfA=M0("ZodMiniBase64",(A,Q)=>{rk.init(A,Q),l6.init(A,Q)});MfA=M0("ZodMiniBase64URL",(A,Q)=>{sk.init(A,Q),l6.init(A,Q)});OfA=M0("ZodMiniE164",(A,Q)=>{tk.init(A,Q),l6.init(A,Q)});LfA=M0("ZodMiniJWT",(A,Q)=>{ek.init(A,Q),l6.init(A,Q)});Rx=M0("ZodMiniCustomStringFormat",(A,Q)=>{Af.init(A,Q),l6.init(A,Q)});Px=M0("ZodMiniNumber",(A,Q)=>{CM.init(A,Q),h1.init(A,Q)});TO=M0("ZodMiniNumberFormat",(A,Q)=>{Qf.init(A,Q),Px.init(A,Q)});vx=M0("ZodMiniBoolean",(A,Q)=>{GC.init(A,Q),h1.init(A,Q)});Tx=M0("ZodMiniBigInt",(A,Q)=>{HM.init(A,Q),h1.init(A,Q)});bH0=M0("ZodMiniBigIntFormat",(A,Q)=>{$f.init(A,Q),Tx.init(A,Q)});PfA=M0("ZodMiniSymbol",(A,Q)=>{Bf.init(A,Q),h1.init(A,Q)});vfA=M0("ZodMiniUndefined",(A,Q)=>{Ef.init(A,Q),h1.init(A,Q)});TfA=M0("ZodMiniNull",(A,Q)=>{Df.init(A,Q),h1.init(A,Q)});SfA=M0("ZodMiniAny",(A,Q)=>{Jf.init(A,Q),h1.init(A,Q)});kfA=M0("ZodMiniUnknown",(A,Q)=>{Uf.init(A,Q),h1.init(A,Q)});ffA=M0("ZodMiniNever",(A,Q)=>{Yf.init(A,Q),h1.init(A,Q)});xfA=M0("ZodMiniVoid",(A,Q)=>{Zf.init(A,Q),h1.init(A,Q)});Pe=M0("ZodMiniDate",(A,Q)=>{Ff.init(A,Q),h1.init(A,Q)});bfA=M0("ZodMiniArray",(A,Q)=>{Xf.init(A,Q),h1.init(A,Q)});ve=M0("ZodMiniObject",(A,Q)=>{$t.init(A,Q),h1.init(A,Q),x1(A,"shape",()=>Q.shape)});gH0=M0("ZodMiniUnion",(A,Q)=>{VC.init(A,Q),h1.init(A,Q)});mfA=M0("ZodMiniXor",(A,Q)=>{gH0.init(A,Q),If.init(A,Q)});dfA=M0("ZodMiniDiscriminatedUnion",(A,Q)=>{Gf.init(A,Q),h1.init(A,Q)});cfA=M0("ZodMiniIntersection",(A,Q)=>{Vf.init(A,Q),h1.init(A,Q)});pfA=M0("ZodMiniTuple",(A,Q)=>{NM.init(A,Q),h1.init(A,Q)});Te=M0("ZodMiniRecord",(A,Q)=>{zf.init(A,Q),h1.init(A,Q)});nfA=M0("ZodMiniMap",(A,Q)=>{Kf.init(A,Q),h1.init(A,Q)});afA=M0("ZodMiniSet",(A,Q)=>{Wf.init(A,Q),h1.init(A,Q)});mH0=M0("ZodMiniEnum",(A,Q)=>{Cf.init(A,Q),h1.init(A,Q),A.options=Object.values(Q.entries)});rfA=M0("ZodMiniLiteral",(A,Q)=>{Hf.init(A,Q),h1.init(A,Q)});sfA=M0("ZodMiniFile",(A,Q)=>{Nf.init(A,Q),h1.init(A,Q)});tfA=M0("ZodMiniTransform",(A,Q)=>{qf.init(A,Q),h1.init(A,Q)});dH0=M0("ZodMiniOptional",(A,Q)=>{qM.init(A,Q),h1.init(A,Q)});AyA=M0("ZodMiniExactOptional",(A,Q)=>{uf.init(A,Q),h1.init(A,Q)});QyA=M0("ZodMiniNullable",(A,Q)=>{wf.init(A,Q),h1.init(A,Q)});ByA=M0("ZodMiniDefault",(A,Q)=>{Mf.init(A,Q),h1.init(A,Q)});EyA=M0("ZodMiniPrefault",(A,Q)=>{Of.init(A,Q),h1.init(A,Q)});cH0=M0("ZodMiniNonOptional",(A,Q)=>{Lf.init(A,Q),h1.init(A,Q)});DyA=M0("ZodMiniSuccess",(A,Q)=>{jf.init(A,Q),h1.init(A,Q)});JyA=M0("ZodMiniCatch",(A,Q)=>{Rf.init(A,Q),h1.init(A,Q)});UyA=M0("ZodMiniNaN",(A,Q)=>{Pf.init(A,Q),h1.init(A,Q)});pH0=M0("ZodMiniPipe",(A,Q)=>{vf.init(A,Q),h1.init(A,Q)});lH0=M0("ZodMiniCodec",(A,Q)=>{pH0.init(A,Q),zC.init(A,Q)});YyA=M0("ZodMiniReadonly",(A,Q)=>{Tf.init(A,Q),h1.init(A,Q)});ZyA=M0("ZodMiniTemplateLiteral",(A,Q)=>{_f.init(A,Q),h1.init(A,Q)});FyA=M0("ZodMiniLazy",(A,Q)=>{ff.init(A,Q),h1.init(A,Q)});IyA=M0("ZodMiniPromise",(A,Q)=>{kf.init(A,Q),h1.init(A,Q)});iH0=M0("ZodMiniCustom",(A,Q)=>{yf.init(A,Q),h1.init(A,Q)});Tb1=Ly,_b1=jy;VyA=M0("ZodMiniFunction",(A,Q)=>{Sf.init(A,Q),h1.init(A,Q)})});var KyA=C0(()=>{SB()});var nH0={};YB(nH0,{time:()=>hb1,duration:()=>gb1,datetime:()=>xb1,date:()=>bb1,ZodMiniISOTime:()=>fe,ZodMiniISODuration:()=>ye,ZodMiniISODateTime:()=>Se,ZodMiniISODate:()=>ke});function xb1(A){return of(Se,A)}function bb1(A){return rf(ke,A)}function hb1(A){return sf(fe,A)}function gb1(A){return tf(ye,A)}var Se,ke,fe,ye;var aH0=C0(()=>{SB();_e();Se=M0("ZodMiniISODateTime",(A,Q)=>{mk.init(A,Q),l6.init(A,Q)});ke=M0("ZodMiniISODate",(A,Q)=>{dk.init(A,Q),l6.init(A,Q)});fe=M0("ZodMiniISOTime",(A,Q)=>{ck.init(A,Q),l6.init(A,Q)});ye=M0("ZodMiniISODuration",(A,Q)=>{pk.init(A,Q),l6.init(A,Q)})});var oH0={};YB(oH0,{string:()=>mb1,number:()=>db1,date:()=>lb1,boolean:()=>cb1,bigint:()=>pb1});function mb1(A){return lf(vO,A)}function db1(A){return Ay(Px,A)}function cb1(A){return Uy(vx,A)}function pb1(A){return Zy(Tx,A)}function lb1(A){return Ny(Pe,A)}var WyA=C0(()=>{SB();_e()});var T8={};YB(T8,{xor:()=>Eb1,xid:()=>Hx1,void:()=>lx1,uuidv7:()=>Xx1,uuidv6:()=>Fx1,uuidv4:()=>Zx1,uuid:()=>Yx1,util:()=>RA,url:()=>Ix1,uppercase:()=>FG,unknown:()=>Re,union:()=>gfA,undefined:()=>cx1,ulid:()=>Cx1,uint64:()=>mx1,uint32:()=>bx1,tuple:()=>lfA,trim:()=>KG,treeifyError:()=>Ok,transform:()=>Vb1,toUpperCase:()=>CG,toLowerCase:()=>WG,toJSONSchema:()=>sM,templateLiteral:()=>Lb1,symbol:()=>dx1,superRefine:()=>vb1,success:()=>Nb1,stringbool:()=>kb1,stringFormat:()=>vx1,string:()=>yH0,strictObject:()=>ax1,startsWith:()=>IG,size:()=>GF,set:()=>Fb1,safeParseAsync:()=>JG,safeParse:()=>XF,safeExtend:()=>sx1,safeEncodeAsync:()=>yV0,safeEncode:()=>kV0,safeDecodeAsync:()=>xV0,safeDecode:()=>fV0,required:()=>$b1,registry:()=>wM,regexes:()=>A3,regex:()=>YG,refine:()=>Pb1,record:()=>ifA,readonly:()=>Ob1,property:()=>aM,promise:()=>jb1,prettifyError:()=>Lk,prefault:()=>Cb1,positive:()=>pM,pipe:()=>wb1,pick:()=>ex1,partialRecord:()=>Ub1,partial:()=>Qb1,parseAsync:()=>DG,parse:()=>EG,overwrite:()=>m9,optional:()=>efA,omit:()=>Ab1,object:()=>hfA,number:()=>jfA,nullish:()=>Kb1,nullable:()=>$yA,null:()=>_fA,normalize:()=>zG,nonpositive:()=>iM,nonoptional:()=>Hb1,nonnegative:()=>nM,never:()=>yfA,negative:()=>lM,nativeEnum:()=>Xb1,nanoid:()=>zx1,nan:()=>ub1,multipleOf:()=>mU,minimum:()=>j3,minSize:()=>FD,minLength:()=>mJ,mime:()=>VG,meta:()=>_b1,merge:()=>tx1,maximum:()=>m5,maxSize:()=>dU,maxLength:()=>VF,map:()=>Zb1,mac:()=>Ox1,lte:()=>m5,lt:()=>YD,lowercase:()=>ZG,looseRecord:()=>Yb1,looseObject:()=>ox1,locales:()=>KC,literal:()=>Ib1,length:()=>zF,lazy:()=>XyA,ksuid:()=>Nx1,keyof:()=>nx1,jwt:()=>Px1,json:()=>fb1,iso:()=>nH0,ipv6:()=>ux1,ipv4:()=>qx1,intersection:()=>Jb1,int64:()=>gx1,int32:()=>xx1,int:()=>kx1,instanceof:()=>Sb1,includes:()=>XG,httpUrl:()=>Gx1,hostname:()=>Tx1,hex:()=>_x1,hash:()=>Sx1,guid:()=>Ux1,gte:()=>j3,gt:()=>ZD,globalRegistry:()=>Q3,function:()=>yb1,formatError:()=>XC,float64:()=>yx1,float32:()=>fx1,flattenError:()=>FC,file:()=>Gb1,extend:()=>rx1,exactOptional:()=>zb1,enum:()=>ofA,endsWith:()=>GG,encodeAsync:()=>_V0,encode:()=>vV0,emoji:()=>Vx1,email:()=>Jx1,e164:()=>Rx1,discriminatedUnion:()=>Db1,describe:()=>Tb1,decodeAsync:()=>SV0,decode:()=>TV0,date:()=>ix1,custom:()=>GyA,cuid2:()=>Wx1,cuid:()=>Kx1,core:()=>R8,config:()=>h$,coerce:()=>oH0,codec:()=>Mb1,clone:()=>_B,cidrv6:()=>Mx1,cidrv4:()=>wx1,check:()=>Rb1,catchall:()=>Bb1,catch:()=>qb1,boolean:()=>RfA,bigint:()=>hx1,base64url:()=>jx1,base64:()=>Lx1,array:()=>hH0,any:()=>px1,_function:()=>yb1,_default:()=>Wb1,ZodMiniXor:()=>mfA,ZodMiniXID:()=>KfA,ZodMiniVoid:()=>xfA,ZodMiniUnknown:()=>kfA,ZodMiniUnion:()=>gH0,ZodMiniUndefined:()=>vfA,ZodMiniUUID:()=>jx,ZodMiniURL:()=>xH0,ZodMiniULID:()=>zfA,ZodMiniType:()=>h1,ZodMiniTuple:()=>pfA,ZodMiniTransform:()=>tfA,ZodMiniTemplateLiteral:()=>ZyA,ZodMiniSymbol:()=>PfA,ZodMiniSuccess:()=>DyA,ZodMiniStringFormat:()=>l6,ZodMiniString:()=>vO,ZodMiniSet:()=>afA,ZodMiniRecord:()=>Te,ZodMiniReadonly:()=>YyA,ZodMiniPromise:()=>IyA,ZodMiniPrefault:()=>EyA,ZodMiniPipe:()=>pH0,ZodMiniOptional:()=>dH0,ZodMiniObject:()=>ve,ZodMiniNumberFormat:()=>TO,ZodMiniNumber:()=>Px,ZodMiniNullable:()=>QyA,ZodMiniNull:()=>TfA,ZodMiniNonOptional:()=>cH0,ZodMiniNever:()=>ffA,ZodMiniNanoID:()=>IfA,ZodMiniNaN:()=>UyA,ZodMiniMap:()=>nfA,ZodMiniMAC:()=>ufA,ZodMiniLiteral:()=>rfA,ZodMiniLazy:()=>FyA,ZodMiniKSUID:()=>WfA,ZodMiniJWT:()=>LfA,ZodMiniIntersection:()=>cfA,ZodMiniISOTime:()=>fe,ZodMiniISODuration:()=>ye,ZodMiniISODateTime:()=>Se,ZodMiniISODate:()=>ke,ZodMiniIPv6:()=>HfA,ZodMiniIPv4:()=>CfA,ZodMiniGUID:()=>FfA,ZodMiniFunction:()=>VyA,ZodMiniFile:()=>sfA,ZodMiniExactOptional:()=>AyA,ZodMiniEnum:()=>mH0,ZodMiniEmoji:()=>XfA,ZodMiniEmail:()=>ZfA,ZodMiniE164:()=>OfA,ZodMiniDiscriminatedUnion:()=>dfA,ZodMiniDefault:()=>ByA,ZodMiniDate:()=>Pe,ZodMiniCustomStringFormat:()=>Rx,ZodMiniCustom:()=>iH0,ZodMiniCodec:()=>lH0,ZodMiniCatch:()=>JyA,ZodMiniCUID2:()=>VfA,ZodMiniCUID:()=>GfA,ZodMiniCIDRv6:()=>qfA,ZodMiniCIDRv4:()=>NfA,ZodMiniBoolean:()=>vx,ZodMiniBigIntFormat:()=>bH0,ZodMiniBigInt:()=>Tx,ZodMiniBase64URL:()=>MfA,ZodMiniBase64:()=>wfA,ZodMiniArray:()=>bfA,ZodMiniAny:()=>SfA,TimePrecision:()=>af,NEVER:()=>UC,$output:()=>mf,$input:()=>df,$brand:()=>Wk});var rH0=C0(()=>{SB();SB();tM();Bt();aH0();aH0();WyA();fH0();_e();KyA()});var sH0=C0(()=>{rH0();rH0()});var nb1,CyA,fm6,ab1,ym6;var HyA=C0(()=>{M7();sH0();nb1=j.templateLiteral([j.string().regex(/^[0-9a-f]{8}$/),"-",j.string().regex(/^[0-9a-f]{4}$/),"-",j.string().regex(/^[0-9a-f]{4}$/),"-",j.string().regex(/^[0-9a-f]{4}$/),"-",j.string().regex(/^[0-9a-f]{12}$/)]),CyA=j.templateLiteral(["T-",nb1]),fm6=T8.union([T8.object({visibility:T8.literal("private"),sharedGroupIDs:T8.array(T8.string())}),T8.object({visibility:T8.literal("thread_group_shared"),sharedGroupIDs:T8.array(T8.string())}),T8.object({visibility:T8.enum(["thread_workspace_shared","public_unlisted","public_discoverable"])})]),ab1=j.string(),ym6=j.object({id:ab1,title:j.string().optional(),messageCount:j.number(),updatedAt:j.string(),firstSyncAt:j.string(),created:j.number(),creatorUserID:j.string(),meta:j.object({visibility:j.enum(["private","thread_group_shared","public_unlisted","public_discoverable","thread_workspace_shared"]),sharedGroupIDs:j.array(j.string())}),labels:j.array(j.object({id:j.string(),name:j.string(),createdAt:j.string()}))})});var NyA=()=>{};var qyA=()=>{};var tH0=C0(()=>{Lx();YfA();HyA();NyA();qyA()});import{randomFillSync as ob1}from"crypto";function he(){if(xe>be.length-16)ob1(be),xe=0;return be.slice(xe,xe+=16)}var be,xe;var uyA=C0(()=>{be=new Uint8Array(256),xe=be.length});function wyA(A,Q=0){return(D5[A[Q+0]]+D5[A[Q+1]]+D5[A[Q+2]]+D5[A[Q+3]]+"-"+D5[A[Q+4]]+D5[A[Q+5]]+"-"+D5[A[Q+6]]+D5[A[Q+7]]+"-"+D5[A[Q+8]]+D5[A[Q+9]]+"-"+D5[A[Q+10]]+D5[A[Q+11]]+D5[A[Q+12]]+D5[A[Q+13]]+D5[A[Q+14]]+D5[A[Q+15]]).toLowerCase()}var D5;var MyA=C0(()=>{D5=[];for(let A=0;A<256;++A)D5.push((A+256).toString(16).slice(1))});function rb1(A,Q,$){let B;if(A)B=OyA(A.random??A.rng?.()??he(),A.msecs,A.seq,Q,$);else{let E=Date.now(),D=he();sb1(eH0,E,D),B=OyA(D,eH0.msecs,eH0.seq,Q,$)}return Q??wyA(B)}function sb1(A,Q,$){if(A.msecs??=-1/0,A.seq??=0,Q>A.msecs)A.seq=$[6]<<23|$[7]<<16|$[8]<<8|$[9],A.msecs=Q;else if(A.seq=A.seq+1|0,A.seq===0)A.msecs++;return A}function OyA(A,Q,$,B,E=0){if(A.length<16)throw Error("Random bytes length must be >= 16");if(!B)B=new Uint8Array(16),E=0;else if(E<0||E+16>B.length)throw RangeError(`UUID byte range ${E}:${E+15} is out of buffer bounds`);return Q??=Date.now(),$??=A[6]*127<<24|A[7]<<16|A[8]<<8|A[9],B[E++]=Q/1099511627776&255,B[E++]=Q/4294967296&255,B[E++]=Q/16777216&255,B[E++]=Q/65536&255,B[E++]=Q/256&255,B[E++]=Q&255,B[E++]=112|$>>>28&15,B[E++]=$>>>20&255,B[E++]=128|$>>>14&63,B[E++]=$>>>6&255,B[E++]=$<<2&255|A[10]&3,B[E++]=A[11],B[E++]=A[12],B[E++]=A[13],B[E++]=A[14],B[E++]=A[15],B}var eH0,_O;var LyA=C0(()=>{uyA();MyA();eH0={};_O=rb1});var AN0=C0(()=>{LyA()});function tb1(A){let Q=0,$=[];while(Q<A.length){let B=A[Q];if(B==="\\"){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(B==='"'){let U="",Y=!1;B=A[++Q];while(B!=='"'){if(Q===A.length){Y=!0;break}if(B==="\\"){if(Q++,Q===A.length){Y=!0;break}U+=B+A[Q],B=A[++Q]}else U+=B,B=A[++Q]}if(B=A[++Q],!Y)$.push({type:"string",value:U});continue}if(B&&/\s/.test(B)){Q++;continue}let D=/[0-9]/;if(B&&D.test(B)||B==="-"||B==="."){let U="";if(B==="-")U+=B,B=A[++Q];while(B&&D.test(B)||B===".")U+=B,B=A[++Q];$.push({type:"number",value:U});continue}let J=/[a-z]/i;if(B&&J.test(B)){let U="";while(B&&J.test(B)){if(Q===A.length)break;U+=B,B=A[++Q]}if(U==="true"||U==="false"||U==="null")$.push({type:"name",value:U});else{Q++;continue}continue}Q++}return $}function SO(A){if(A.length===0)return A;let Q=A[A.length-1];if(!Q)return A;switch(Q.type){case"separator":return SO(A.slice(0,A.length-1));case"number":{let $=Q.value[Q.value.length-1];if($==="."||$==="-")return SO(A.slice(0,A.length-1));break}case"string":{let $=A[A.length-2];if($?.type==="delimiter")return SO(A.slice(0,A.length-1));else if($?.type==="brace"&&$.value==="{")return SO(A.slice(0,A.length-1));break}case"delimiter":return SO(A.slice(0,A.length-1))}return A}function eb1(A){let Q=[];for(let $ of A){if($.type==="brace")if($.value==="{")Q.push("}");else{let B=Q.lastIndexOf("}");if(B!==-1)Q.splice(B,1)}if($.type==="paren")if($.value==="[")Q.push("]");else{let B=Q.lastIndexOf("]");if(B!==-1)Q.splice(B,1)}}if(Q.length>0){Q.reverse();for(let $ of Q)if($==="}")A.push({type:"brace",value:"}"});else if($==="]")A.push({type:"paren",value:"]"})}return A}function Ah1(A){let Q="";for(let $ of A)switch($.type){case"string":Q+='"'+$.value+'"';break;default:Q+=$.value;break}return Q}function QN0(A){let Q=Ah1(eb1(SO(tb1(A))));return JSON.parse(Q)}function Qh1(A){try{let Q=QN0(A);if(Q!==null&&typeof Q==="object"&&!Array.isArray(Q))return Q;return{}}catch{return{}}}function $h1(A){try{return jyA(QN0(A.replace(/\\+$/,"")+'"'))}catch{return jyA(QN0(A))}}function RyA(A){let Q=Qh1(A),$;try{$=$h1(A)}catch{$=Q}return{input:Q,inputIncomplete:PyA($)?$:Q}}function PyA(A){return typeof A==="object"&&A!==null&&!Array.isArray(A)}function jyA(A){return PyA(A)?A:{}}function vyA(A,Q,$="..."){if(A.length<=Q)return A;return A.slice(0,Math.max(0,Q-$.length))+$}function Bh1(A){let Q=A.match(/^(?:cat\s+)?<<['"]?(\w+)['"]?\s*\n([\s\S]*?)\n\1\s*$/);if(Q)return Q[2];return A}function Eh1(A,Q){let $=A[Q];if(!$)return null;let B=$.match(/^\*\*\* Add File: (.+)$/);if(B)return{filePath:B[1],nextIdx:Q+1};let E=$.match(/^\*\*\* Delete File: (.+)$/);if(E)return{filePath:E[1],nextIdx:Q+1};let D=$.match(/^\*\*\* Update File: (.+)$/);if(D){let J,U=Q+1,Y=A[U];if(Y){let Z=Y.match(/^\*\*\* Move to: (.+)$/);if(Z)J=Z[1],U++}return{filePath:D[1],movePath:J,nextIdx:U}}return null}function $N0(A){return A.startsWith("*** Add File:")||A.startsWith("*** Update File:")||A.startsWith("*** Delete File:")||A.trim()==="*** End Patch"}function Dh1(A,Q){let $=[],B=Q;while(B<A.length){let E=A[B];if($N0(E))break;if(E.startsWith("+"))$.push(E.slice(1));else if(E==="")$.push("");else throw Error(`Invalid patch format: Add File lines must start with '+', got: "${E.slice(0,20)}${E.length>20?"...":""}"`);B++}return{content:$.join(`
216
+ `}function rt(A,Q){if(!(Q instanceof Error))return Q;let $={name:Q.name,message:Q.message};if(typeof Q.stack==="string")$.stack=Q.stack;let B=Q.cause;if(B!==void 0)$.cause=B;if(typeof AggregateError<"u"&&Q instanceof AggregateError)$.errors=Q.errors;for(let E of Object.keys(Q))if(!(E in $))$[E]=Q[E];return $}function kC0(A={}){let Q=(()=>{let U=A.timestamp;if(U==null)return ot["date-time-timezone"];else if(U==="disabled")return ot.none;else if(typeof U==="string"&&U in ot)return ot[U];else return U})(),$=A.category??"·",B=A.value?(U)=>A.value(U,QSA):QSA,E=(()=>{let U=A.level;if(U==null||U==="ABBR")return(Y)=>FO.ABBR[Y];else if(U==="abbr")return(Y)=>FO.abbr[Y];else if(U==="FULL")return(Y)=>FO.FULL[Y];else if(U==="full")return(Y)=>FO.full[Y];else if(U==="L")return(Y)=>FO.L[Y];else if(U==="l")return(Y)=>FO.l[Y];else return U})(),D=BSA(A.lineEnding),J=A.format??(({timestamp:U,level:Y,category:Z,message:F})=>`${U?`${U} `:""}[${Y}] ${Z}: ${F}`);return(U)=>{let Y=U.message,Z=Y.length,F;if(Z===1)F=Y[0];else if(Z<=6){F="";for(let z=0;z<Z;z++)F+=z%2===0?Y[z]:B(Y[z])}else{let z=Array(Z);for(let K=0;K<Z;K++)z[K]=K%2===0?Y[K]:B(Y[K]);F=z.join("")}let X=Q(U.timestamp),I=E(U.level),G=typeof $==="function"?$(U.category):U.category.join($);return`${J({timestamp:X,level:I,category:G,message:F,record:U})}${D}`}}function ESA(A={}){let Q=A.format,$=typeof A.timestampStyle>"u"?"dim":A.timestampStyle,B=A.timestampColor??null,E=`${$==null?"":SC0[$]}${B==null?"":_C0[B]}`,D=$==null&&B==null?"":TC0,J=typeof A.levelStyle>"u"?"bold":A.levelStyle,U=A.levelColors??WS1,Y=typeof A.categoryStyle>"u"?"dim":A.categoryStyle,Z=A.categoryColor??null,F=`${Y==null?"":SC0[Y]}${Z==null?"":_C0[Z]}`,X=Y==null&&Z==null?"":TC0;return kC0({timestamp:"date-time-tz",value(I,G){return G(I,{colors:!0})},...A,format({timestamp:I,level:G,category:V,message:z,record:K}){let W=U[K.level];return I=I==null?null:`${E}${I}${D}`,G=`${J==null?"":SC0[J]}${W==null?"":_C0[W]}${G}${J==null&&W==null?"":TC0}`,Q==null?`${I==null?"":`${I} `}${G} ${F}${V}:${X} ${z}`:Q({timestamp:I,level:G,category:`${F}${V}${X}`,message:z,record:K})}})}function tt(A={}){let Q=BSA(A.lineEnding);if(!A.categorySeparator&&!A.message&&!A.properties)return(U)=>{if(U.message.length===3)return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:U.message[0]+JSON.stringify(U.message[1])+U.message[2],logger:U.category.join("."),properties:U.properties},rt)+Q;if(U.message.length===1)return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:U.message[0],logger:U.category.join("."),properties:U.properties},rt)+Q;let Y=U.message[0];for(let Z=1;Z<U.message.length;Z++)Y+=Z&1?JSON.stringify(U.message[Z]):U.message[Z];return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:Y,logger:U.category.join("."),properties:U.properties},rt)+Q};let $=A.message==="template",B=A.properties??"nest:properties",E;if(typeof A.categorySeparator==="function")E=A.categorySeparator;else{let U=A.categorySeparator??".";E=(Y)=>Y.join(U)}let D;if(B==="flatten")D=(U)=>U;else if(B.startsWith("prepend:")){let U=B.substring(8);if(U==="")throw TypeError(`Invalid properties option: ${JSON.stringify(B)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);D=(Y)=>{let Z={};for(let F in Y)Z[`${U}${F}`]=Y[F];return Z}}else if(B.startsWith("nest:")){let U=B.substring(5);D=(Y)=>({[U]:Y})}else throw TypeError(`Invalid properties option: ${JSON.stringify(B)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let J;if($)J=(U)=>{if(typeof U.rawMessage==="string")return U.rawMessage;let Y="";for(let Z=0;Z<U.rawMessage.length;Z++)Y+=Z%2<1?U.rawMessage[Z]:"{}";return Y};else J=(U)=>{let Y=U.message.length;if(Y===1)return U.message[0];let Z="";for(let F=0;F<Y;F++)Z+=F%2<1?U.message[F]:JSON.stringify(U.message[F]);return Z};return(U)=>{return JSON.stringify({"@timestamp":new Date(U.timestamp).toISOString(),level:U.level==="warning"?"WARN":U.level.toUpperCase(),message:J(U),logger:E(U.category),...D(U.properties)},rt)+Q}}function ny(A){let Q="",$=[];for(let D=0;D<A.message.length;D++)if(D%2===0)Q+=A.message[D];else Q+="%o",$.push(A.message[D]);let B=new Date(A.timestamp);return[`%c${`${B.getUTCHours().toString().padStart(2,"0")}:${B.getUTCMinutes().toString().padStart(2,"0")}:${B.getUTCSeconds().toString().padStart(2,"0")}.${B.getUTCMilliseconds().toString().padStart(3,"0")}`} %c${$SA[A.level]}%c %c${A.category.join("·")} %c${Q}`,"color: gray;",NS1[A.level],"background-color: default;","color: gray;","color: default;",...$]}var $SA,QSA,ot,FO,st,TC0="\x1B[0m",_C0,SC0,WS1,CS1,HS1,NS1;var fC0=C0(()=>{ASA();$SA={trace:"TRC",debug:"DBG",info:"INF",warning:"WRN",error:"ERR",fatal:"FTL"},QSA=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}):at!=null&&("inspect"in at)&&typeof nt==="function"?(A,Q)=>nt(A,{maxArrayLength:1/0,maxStringLength:1/0,...Q}):(A)=>JSON.stringify(A);ot={"date-time-timezone":(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate()),D=t6(Q.getUTCHours()),J=t6(Q.getUTCMinutes()),U=t6(Q.getUTCSeconds()),Y=ZO(Q.getUTCMilliseconds());return`${$}-${B}-${E} ${D}:${J}:${U}.${Y} +00:00`},"date-time-tz":(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate()),D=t6(Q.getUTCHours()),J=t6(Q.getUTCMinutes()),U=t6(Q.getUTCSeconds()),Y=ZO(Q.getUTCMilliseconds());return`${$}-${B}-${E} ${D}:${J}:${U}.${Y} +00`},"date-time":(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate()),D=t6(Q.getUTCHours()),J=t6(Q.getUTCMinutes()),U=t6(Q.getUTCSeconds()),Y=ZO(Q.getUTCMilliseconds());return`${$}-${B}-${E} ${D}:${J}:${U}.${Y}`},"time-timezone":(A)=>{let Q=new Date(A),$=t6(Q.getUTCHours()),B=t6(Q.getUTCMinutes()),E=t6(Q.getUTCSeconds()),D=ZO(Q.getUTCMilliseconds());return`${$}:${B}:${E}.${D} +00:00`},"time-tz":(A)=>{let Q=new Date(A),$=t6(Q.getUTCHours()),B=t6(Q.getUTCMinutes()),E=t6(Q.getUTCSeconds()),D=ZO(Q.getUTCMilliseconds());return`${$}:${B}:${E}.${D} +00`},time:(A)=>{let Q=new Date(A),$=t6(Q.getUTCHours()),B=t6(Q.getUTCMinutes()),E=t6(Q.getUTCSeconds()),D=ZO(Q.getUTCMilliseconds());return`${$}:${B}:${E}.${D}`},date:(A)=>{let Q=new Date(A),$=Q.getUTCFullYear(),B=t6(Q.getUTCMonth()+1),E=t6(Q.getUTCDate());return`${$}-${B}-${E}`},rfc3339:(A)=>new Date(A).toISOString(),none:()=>null},FO={ABBR:$SA,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"}};st=kC0(),_C0={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},SC0={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",strikethrough:"\x1B[9m"},WS1={trace:null,debug:"blue",info:"green",warning:"yellow",error:"red",fatal:"magenta"};CS1=ESA();HS1=tt(),NS1={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 DSA(A){if(typeof A==="function")return A;return qS1(A)}function qS1(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 JSA=()=>{};function ay(A={}){let Q=A.formatter??ny,$={trace:"debug",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"error",...A.levelMap??{}},B=A.console??globalThis.console,E=(W)=>{let C=Q(W),H=$[W.level];if(H===void 0)throw TypeError(`Invalid log level: ${W.level}.`);if(typeof C==="string"){let N=C.replace(/\r?\n$/,"");B[H](N)}else B[H](...C)};if(!A.nonBlocking)return E;let D=A.nonBlocking===!0?{}:A.nonBlocking,J=D.bufferSize??100,U=D.flushInterval??100,Y=[],Z=null,F=!1,X=!1,I=J*2;function G(){if(Y.length===0)return;let W=Y.splice(0);for(let C of W)try{E(C)}catch{}}function V(){if(X)return;X=!0,setTimeout(()=>{X=!1,G()},0)}function z(){if(Z!==null||F)return;Z=setInterval(()=>{G()},U)}let K=(W)=>{if(F)return;if(Y.length>=I)Y.shift();if(Y.push(W),Y.length>=J)V();else if(Z===null)z()};return K[Symbol.dispose]=()=>{if(F=!0,Z!==null)clearInterval(Z),Z=null;G()},K}var yC0=C0(()=>{fC0()});function uS1(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 wS1(A){let Q=A?Qe:$e;if(typeof globalThis.EdgeRuntime!=="string"&&"process"in globalThis&&!("Deno"in globalThis)){let B=globalThis.process,E=B?.on;if(typeof E==="function"){E.call(B,"exit",Q);return}}let $=globalThis.addEventListener;if(typeof $!=="function")return;if("Deno"in globalThis)$.call(globalThis,"unload",Q);else $.call(globalThis,"pagehide",Q)}function ry(A){if(Ae!=null&&!A.reset)throw new KF("Already configured; if you want to reset, turn on the reset flag.");if(oy.size>0)throw new KF("Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().");XO();try{MS1(A,!1)}catch(Q){if(Q instanceof KF)XO();throw Q}}function MS1(A,Q){Ae=A;let $=!1,B=new Set;for(let D of A.loggers){if(uS1(D))$=!0;let J=Array.isArray(D.category)?JSON.stringify(D.category):JSON.stringify([D.category]);if(B.has(J))throw new KF(`Duplicate logger configuration for category: ${J}. Each category can only be configured once.`);B.add(J);let U=pU.getLogger(D.category);for(let Y of D.sinks??[]){let Z=A.sinks[Y];if(!Z)throw new KF(`Sink not found: ${Y}.`);U.sinks.push(Z)}if(U.parentSinks=D.parentSinks??"inherit",D.lowestLevel!==void 0)U.lowestLevel=D.lowestLevel;for(let Y of D.filters??[]){let Z=A.filters?.[Y];if(Z===void 0)throw new KF(`Filter not found: ${Y}.`);U.filters.push(DSA(Z))}USA.add(U)}pU.getLogger().contextLocalStorage=A.contextLocalStorage;for(let D of Object.values(A.sinks)){if(Symbol.asyncDispose in D)if(Q)oy.add(D);else throw new KF("Async disposables cannot be used with configureSync().");if(Symbol.dispose in D)et.add(D)}for(let D of Object.values(A.filters??{})){if(D==null||typeof D==="string")continue;if(Symbol.asyncDispose in D)if(Q)oy.add(D);else throw new KF("Async disposables cannot be used with configureSync().");if(Symbol.dispose in D)et.add(D)}wS1(Q);let E=pU.getLogger(["logtape","meta"]);if(!$)E.sinks.push(ay());E.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 xC0(){return Ae}function XO(){$e(),OS1()}function OS1(){let A=pU.getLogger([]);A.resetDescendants(),delete A.contextLocalStorage,USA.clear(),Ae=null}async function Qe(){$e();let A=[];for(let Q of oy)A.push(Q[Symbol.asyncDispose]()),oy.delete(Q);await Promise.all(A)}function $e(){for(let A of et)A[Symbol.dispose]();et.clear()}var Ae=null,USA,et,oy,KF;var YSA=C0(()=>{JSA();lt();yC0();USA=new Set,et=new Set,oy=new Set;KF=class extends Error{constructor(A){super(A);this.name="ConfigureError"}}});var Be=C0(()=>{lt();fC0();yC0();YSA()});var ZSA,LS1,S;var a0=C0(()=>{Be();M7();if(xC0()===null)ry({sinks:{console:ay({formatter:(A)=>{let Q=ny(A);return Object.keys(A.properties).length>0?[...Q,A.properties]:Q}})},loggers:[{category:["logtape","meta"],sinks:["console"],lowestLevel:"warning"},{category:[],sinks:["console"]}]});ZSA=UO.union([UO.literal("error"),UO.literal("warn"),UO.literal("info"),UO.literal("debug")]),LS1=vC0(),S=LS1});function yS1(A){return A.trim().toLowerCase()}function L7(A){let Q=yS1(A);if(Q.length===0)return!1;if(Q.endsWith("@ampcode.com")||Q==="auth-bypass-user@example.com")return!0;return!1}function E1(A,Q,$=Q+"s"){return A===1?Q:$}var kB=()=>{};function De(A){Promise.resolve().then(()=>{try{A()}catch(Q){console.error(Q)}})}function ISA(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($){console.error("cleanupSubscription",$)}}function mC0(A){A._observer=void 0,A._queue=void 0,A._state="closed"}function xS1(A){let Q=A._queue;if(!Q)return;A._queue=void 0,A._state="ready";for(let $ of Q)if(GSA(A,$.type,$.value),A._state==="closed")break}function GSA(A,Q,$){A._state="running";let B=A._observer;try{switch(Q){case"next":if(B&&typeof B.next==="function")B.next($);break;case"error":if(mC0(A),B&&typeof B.error==="function")B.error($);else throw $;break;case"complete":if(mC0(A),B&&typeof B.complete==="function")B.complete();break}}catch(E){console.error("notifySubscription",E)}if(A._state==="closed")ISA(A);else if(A._state==="running")A._state="ready"}function gC0(A,Q,$){if(A._state==="closed")return;if(A._state==="buffering"){A._queue=A._queue||[],A._queue.push({type:Q,value:$});return}if(A._state!=="ready"){A._state="buffering",A._queue=[{type:Q,value:$}],De(()=>xS1(A));return}GSA(A,Q,$)}class VSA{_cleanup;_observer;_queue;_state;constructor(A,Q){this._cleanup=void 0,this._observer=A,this._queue=void 0,this._state="initializing";let $=new zSA(this);try{this._cleanup=Q.call(void 0,$)}catch(B){$.error(B)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")mC0(this),ISA(this)}}class zSA{_subscription;constructor(A){this._subscription=A}get closed(){return this._subscription._state==="closed"}next(A){gC0(this._subscription,"next",A)}error(A){gC0(this._subscription,"error",A)}complete(){gC0(this._subscription,"complete")}}function g$(A){if(typeof A==="function")A();else if(A&&typeof A.unsubscribe==="function")A.unsubscribe()}class GO{_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=(D)=>$.push(D),E=Promise.resolve().then(async()=>{await Q,await A(B),this._pendingPromises.delete(E);for(let D of $)this._baseObserver.next(D)}).catch((D)=>{this._pendingPromises.delete(E),this._baseObserver.error(D)});this._pendingPromises.add(E)}}var k0;var VO=C0(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");k0=class k0{_subscriber;constructor(A){if(!(this instanceof k0))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,$){if(typeof A!=="object"||A===null)A={next:A,error:Q,complete:$};return new VSA(A,this._subscriber)}pipe(A,...Q){let $=this;for(let B of[A,...Q])$=B($);return $}[Symbol.observable](){return this}static from(A){let Q=typeof k0==="function"?k0:k0;if(A==null)throw TypeError(A+" is not an object");let $=A[Symbol.observable];if(typeof $==="function"){let E=$.call(A);if(Object(E)!==E)throw TypeError(E+" is not an object");if(E instanceof k0)return E;return new Q((D)=>E.subscribe(D))}let B=A[Symbol.iterator];if(typeof B==="function")return new Q((E)=>{De(()=>{if(E.closed)return;for(let D of B.call(A))if(E.next(D),E.closed)return;E.complete()})});if(Array.isArray(A))return new Q((E)=>{De(()=>{if(E.closed)return;for(let D of A)if(E.next(D),E.closed)return;E.complete()})});throw TypeError(A+" is not observable")}static of(...A){return new(typeof k0==="function"?k0:k0)(($)=>{De(()=>{if($.closed)return;for(let B of A)if($.next(B),$.closed)return;$.complete()})})}static get[Symbol.species](){return k0}}});var u4,H4;var Je=C0(()=>{VO();u4=class u4 extends k0{_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()}};H4=class H4 extends u4{currentValue;constructor(A){super();this.currentValue=A}next(A){this.currentValue=A,super.next(A)}subscribe(A,Q,$){if(typeof A!=="object"||A===null){let B={};if(A)B.next=A;if(Q)B.error=Q;if($)B.complete=$;A=B}return A.next?.(this.currentValue),super.subscribe(A)}getValue(){return this.currentValue}}});var bS1,hS1;var KSA=C0(()=>{VO();Je();bS1=class bS1 extends Set{subject=new H4(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 k0.from(this.subject)}dispose(){this.subject.complete()}};hS1=class hS1 extends Map{subject=new H4(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 k0.from(this.subject)}dispose(){this.subject.complete()}}});function Ue(A,Q){if(A===Q)return!0;if(A==null||Q==null||typeof A!=="object"||typeof Q!=="object")return!1;let $=Array.isArray(A),B=Array.isArray(Q);if($!==B)return!1;if($&&B)return A.length===Q.length&&A.every((D,J)=>Ue(D,Q[J]));let E=new Set([...Object.keys(A),...Object.keys(Q)]);for(let D of E)if(!Ue(A[D],Q[D]))return!1;return!0}var dC0;var cC0=C0(()=>{dC0={now:()=>Date.now(),schedule:(A,Q)=>{let $=setTimeout(A,Q);return()=>clearTimeout($)}}});async function P4(A,Q){return new Promise(($,B)=>{let E,D=()=>{E?.unsubscribe(),B(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",D,{once:!0}),E=A.subscribe({next:(J)=>{E?.unsubscribe(),Q?.removeEventListener("abort",D),$(J)},error:(J)=>{Q?.removeEventListener("abort",D),B(J)},complete:()=>{Q?.removeEventListener("abort",D),B("Observable completed without emitting a value")}})})}async function LG(A,Q){return new Promise(($,B)=>{let E,D=!1,J,U=()=>{J?.unsubscribe(),B(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",U,{once:!0}),J=A.subscribe({next:(Y)=>{E=Y,D=!0},error:(Y)=>{Q?.removeEventListener("abort",U),B(Y)},complete:()=>{if(Q?.removeEventListener("abort",U),D)$(E);else B("Observable completed without emitting a value")}})})}async function CSA(A,Q){return new Promise(($,B)=>{let E=A.subscribe({error:B,complete:()=>$()});Q?.addEventListener("abort",()=>{E.unsubscribe(),B(new DOMException("Aborted","AbortError"))},{once:!0})})}function lJ(A){return new k0((Q)=>{A.then(($)=>{Q.next($),Q.complete()}).catch(($)=>{Q.error($)})})}function W1(A){return new k0((Q)=>{let $=!1,B=new AbortController,E=B.signal;return(async()=>{try{E?.throwIfAborted();let J=await A(E);if(E?.throwIfAborted(),!$)Q.next(J),Q.complete()}catch(J){if(!$)if(E.aborted)Q.complete();else Q.error(J)}})(),()=>{$=!0,B.abort()}})}function lA(A){return(Q)=>{return new k0(($)=>{let B=new GO($),E=0,D=Q.subscribe({complete(){B.complete()},error(J){B.error(J)},next(J){B.schedule(async(U)=>{let Y=await A(J,E);E++,U(Y)})}});return()=>g$(D)})}}function zO(A,Q=dC0){return new k0(($)=>{let B=0,E=null,D=()=>{$.next(B++),E=Q.schedule(D,A)};return E=Q.schedule(D,A),()=>{if(E)E()}})}function qC(...A){return new k0((Q)=>{let $=0,B=A.map((E)=>E.subscribe({next:(D)=>Q.next(D),error:(D)=>Q.error(D),complete:()=>{if($++,$===A.length)Q.complete()}}));return()=>{HSA(B)}})}function F6(...A){if(A.length===0)return ty;return new k0((Q)=>{let $=Array(A.length),B=Array(A.length).fill(0),E=Array(A.length).fill(!1),D=0,J=[],U=new GO(Q);for(let Y=0;Y<A.length;Y++){let Z=A[Y];J.push(Z.subscribe({next(F){$[Y]=F,E[Y]=!0;let X=++B[Y];if(E.every(Boolean))U.schedule(async(I)=>{if(B[Y]===X)I([...$])})},error(F){U.error(F)},complete(){if(D++,D===A.length)U.complete()}}))}return()=>{HSA(J)}})}function V$(A){let $=A?.shouldCountRefs??!0,B=gS1++,E=(D,...J)=>{};return(D)=>{let J=new u4,U=null,Y=!1,Z,F=0;return new k0((X)=>{if(F++,Y)E("new subscriber, emitting buffered value",Z),X.next(Z);else E("new subscriber, no buffered value to emit");if(!U)U=D.subscribe({next:(G)=>{Y=!0,Z=G,J.next(G)},error:(G)=>J.error(G),complete:()=>J.complete()});let I=J.subscribe(X);return()=>{if(F--,I.unsubscribe(),$&&F===0){if(U)g$(U),U=null;Y=!1}}})}}function HSA(A){for(let Q of A)if(Q)g$(Q)}function lC0(A){return(Q)=>{return new k0(($)=>{let B=Q.subscribe({next:(D)=>$.next(D),error:(D)=>$.error(D),complete:()=>$.complete()}),E=A.subscribe({next:()=>{$.complete(),B.unsubscribe(),E.unsubscribe()},error:(D)=>{$.error(D),B.unsubscribe()}});return()=>{B.unsubscribe(),E.unsubscribe()}})}}function KO(A){return(Q)=>{return new k0(($)=>{let B,E=Q.subscribe({next(D){B=D,$.next(D)},error(D){$.error(D)},complete(){$.complete()}});return()=>{g$(E),A(B)}})}}function BQ(A=Ue){return(Q)=>{return new k0(($)=>{let B=WSA,E=new GO($),D=Q.subscribe({complete(){E.complete()},error(J){E.error(J)},next(J){E.schedule(async(U)=>{if(B===WSA||!A(B,J))B=J,U(J)})}});return()=>g$(D)})}}function WO(A){return mS1(typeof A==="function"?{next:A}:A)}function mS1(A){return(Q)=>new k0(($)=>{let B=typeof A==="function"?A():A,E=Q.subscribe({next(D){if(B.next)try{B.next(D)}catch(J){$.error(J);return}$.next(D)},error(D){if(B.error)try{B.error(D)}catch(J){$.error(J);return}$.error(D)},complete(){if(B.complete)try{B.complete()}catch(D){$.error(D);return}$.complete()}});return()=>g$(E)})}function ey(A){return(Q)=>{return new k0(($)=>{let B=!1,E=Q.subscribe({next:(J)=>{B=!0,clearTimeout(D),$.next(J)},error:(J)=>{clearTimeout(D),$.error(J)},complete:()=>{clearTimeout(D),$.complete()}}),D=setTimeout(()=>{if(!B)E.unsubscribe(),$.error(new Ye(`Operation timed out after ${A}ms`))},A);return()=>{clearTimeout(D),E.unsubscribe()}})}}function GQ(A){return(Q)=>new k0(($)=>{let B;try{$.next(A),B=Q.subscribe({next(E){$.next(E)},error(E){$.error(E)},complete(){$.complete()}})}catch(E){$.error(E)}return()=>{if(B)g$(B)}})}function j7(A){return(Q)=>new k0(($)=>{let B=0,E=Q.subscribe({next(D){if(B<A){if($.next(D),B++,B===A)$.complete(),g$(E)}},error(D){$.error(D)},complete(){$.complete()}});return()=>{g$(E)}})}function u1(A){return(Q)=>{return new k0(($)=>{let B=0,E=null,D=!1,J=()=>{if(D&&!E)$.complete()},U=Q.subscribe({next(Y){if(E)g$(E),E=null;let Z;try{Z=A(Y,B++)}catch(F){$.error(F);return}E=Z.subscribe({next(F){$.next(F)},error(F){$.error(F)},complete(){E=null,J()}})},error(Y){$.error(Y)},complete(){D=!0,J()}});return()=>{if(g$(U),E)g$(E)}})}}function uC(A,Q){let $=Q?.scheduler??dC0;return(B)=>new k0((E)=>{let D=null,J=null,U=!1,Y=B.subscribe({next:(Z)=>{if(J=Z,U=!0,D===null)D=$.schedule(()=>{if(U)E.next(J),U=!1;D=null},A)},error:(Z)=>E.error(Z),complete:()=>{if(D!==null)D();if(U)E.next(J);E.complete()}});return()=>{if(g$(Y),D!==null)D()}})}function Ax(...A){return new k0((Q)=>{let $=0,B=null;function E(){if($>=A.length){Q.complete();return}B=A[$].subscribe({next:(J)=>Q.next(J),error:(J)=>Q.error(J),complete:()=>{$++,E()}})}return E(),()=>{if(B)g$(B)}})}function wC(A){return(Q)=>new k0(($)=>{let B=0,E=!1,D=null,J=Q.subscribe({next(U){try{let Y=A(U,B++);if(D)g$(D);D=Y.subscribe({next(Z){$.next(Z)},error(Z){$.error(Z)},complete(){if(D=null,E&&!D)$.complete()}})}catch(Y){$.error(Y)}},error(U){$.error(U)},complete(){if(E=!0,!D)$.complete()}});return()=>{if(g$(J),D)g$(D)}})}function Qx({onSubscribe:A,onUnsubscribe:Q}){return($)=>new k0((B)=>{A?.();let E=$.subscribe(B);return()=>{g$(E),Q?.()}})}function $x(A){return(Q)=>k0.from(Q).pipe(u1(($)=>W1((B)=>A($,B))))}function XD(A){return(Q)=>new k0(($)=>{let B,E=Q.subscribe({next(D){$.next(D)},error(D){try{B=A(D).subscribe({next(U){$.next(U)},error(U){$.error(U)},complete(){$.complete()}})}catch(J){$.error(J)}},complete(){$.complete()}});return()=>{if(g$(E),B)g$(B)}})}function B5(A){return(Q)=>{return new k0(($)=>{let B=Q.subscribe({next(E){if(A(E))$.next(E)},error(E){$.error(E)},complete(){$.complete()}});return()=>g$(B)})}}function Ze(A,Q){return($)=>{return new k0((B)=>{let E,D=0,J=new GO(B),U=$.subscribe({complete(){J.complete()},error(Y){J.error(Y)},next(Y){J.schedule(async(Z)=>{E=await A(D===0?typeof Q>"u"?Y:Q:E,Y,D++),Z(E)})}});return()=>g$(U)})}}var ty,pC0,gS1=0,WSA,Ye;var iC0=C0(()=>{VO();cC0();Je();ty=new k0((A)=>{A.complete()}),pC0=new k0(()=>{});WSA={};Ye=class Ye extends Error{constructor(A="Timeout has occurred"){super(A);this.name="TimeoutError"}}});function Fe(A,Q){return($)=>{return k0.from($).pipe(u1((B)=>B===iU?k0.of(iU):A(B).pipe(XD((E)=>k0.of(E instanceof Error?E:Error(E))),GQ(iU))),V$(Q))}}function dS1(){return(A)=>k0.from(A).pipe(B5((Q)=>Q!==iU))}async function NSA(A,Q){let $=await P4(k0.from(A).pipe(dS1()),Q);if($ instanceof Error)throw $;return $}var iU;var qSA=C0(()=>{VO();iC0();iU=Symbol.for("@@pendingOperation")});var uSA=()=>{};var wSA=()=>{};var kA=C0(()=>{KSA();VO();qSA();iC0();uSA();cC0();Je();wSA()});function nU(A,Q){if(A===Q)return!0;if(A==null||Q==null||typeof A!=="object"||typeof Q!=="object")return!1;let $=Array.isArray(A),B=Array.isArray(Q);if($!==B)return!1;if($&&B)return A.length===Q.length&&A.every((D,J)=>nU(D,Q[J]));let E=new Set([...Object.keys(A),...Object.keys(Q)]);for(let D of E)if(!nU(A[D],Q[D]))return!1;return!0}var ID;var qO=C0(()=>{ID={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",OLD_CODEMIRROR_DIFFS:"old-codemirror-diffs",OPENAI_REGIONAL_NONENT:"openai-regional-nonent",PAYMENT_METHOD_EXEMPT:"payment-method-exempt",PIERRE_DIFFS:"pierre-diffs",RECV_OLD_CLIENT_EMAILS:"recv-old-client-emails",SIGNING_KEYS:"signing-keys",THREAD_ACTORS_OPENAI_WEBSOCKET:"thread-actors-openai-websocket",THREAD_ACTORS_EVENT_SERVER_SYNC:"thread-actors-event-server-sync",THREAD_ACTORS_TUI:"thread-actors-tui",V2:"v2",V2_DOCS:"v2-docs",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 jO(A){let Q=A.length;while(--Q>=0)A[Q]=0}function EH0(A,Q,$,B,E){this.static_tree=A,this.extra_bits=Q,this.extra_base=$,this.elems=B,this.max_length=E,this.has_stree=A&&A.length}function DH0(A,Q){this.dyn_tree=A,this.max_code=0,this.stat_desc=Q}function aU(A,Q,$,B,E){this.good_length=A,this.max_lazy=Q,this.nice_length=$,this.max_chain=B,this.func=E}function Ff1(){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=Oe,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(Qf1*2),this.dyn_dtree=new Uint16Array((2*ek1+1)*2),this.bl_tree=new Uint16Array((2*Af1+1)*2),RG(this.dyn_ltree),RG(this.dyn_dtree),RG(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array($f1+1),this.heap=new Uint16Array(2*NH0+1),RG(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*NH0+1),RG(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 _f1(){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 Mx(A){this.options=Le.assign({level:bf1,method:gf1,chunkSize:16384,windowBits:15,memLevel:8,strategy:hf1},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 lkA,this.strm.avail_out=0;let $=Ix.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if($!==we)throw Error(RC[$]);if(Q.header)Ix.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){let B;if(typeof Q.dictionary==="string")B=Nx.string2buf(Q.dictionary);else if(ikA.call(Q.dictionary)==="[object ArrayBuffer]")B=new Uint8Array(Q.dictionary);else B=Q.dictionary;if($=Ix.deflateSetDictionary(this.strm,B),$!==we)throw Error(RC[$]);this._dict_set=!0}}function TH0(A,Q){let $=new Mx(Q);if($.push(A,!0),$.err)throw $.msg||RC[$.err];return $.result}function mf1(A,Q){return Q=Q||{},Q.raw=!0,TH0(A,Q)}function df1(A,Q){return Q=Q||{},Q.gzip=!0,TH0(A,Q)}function Xy1(){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 Ry1(){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 Ox(A){this.options=Le.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 lkA,this.strm.avail_out=0;let $=qF.inflateInit2(this.strm,Q.windowBits);if($!==qx)throw Error(RC[$]);if(this.header=new Py1,qF.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=Nx.string2buf(Q.dictionary);else if(EfA.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if($=qF.inflateSetDictionary(this.strm,Q.dictionary),$!==qx)throw Error(RC[$])}}}function _H0(A,Q){let $=new Ox(Q);if($.push(A),$.err)throw $.msg||RC[$.err];return $.result}function ky1(A,Q){return Q=Q||{},Q.raw=!0,_H0(A,Q)}var Zk1=0,MkA=1,Fk1=2,Xk1=3,Ik1=258,LH0=29,ux=256,Vx,MO=30,jH0=19,OkA,OC=15,BH0=16,Gk1=7,RH0=256,LkA=16,jkA=17,RkA=18,WH0,qe,Vk1,PkA,zk1=512,NF,Xx,zx,Kx,PH0,ue,vkA,TkA,_kA,SkA=(A)=>{return A<256?zx[A]:zx[256+(A>>>7)]},Wx=(A,Q)=>{A.pending_buf[A.pending++]=Q&255,A.pending_buf[A.pending++]=Q>>>8&255},v8=(A,Q,$)=>{if(A.bi_valid>BH0-$)A.bi_buf|=Q<<A.bi_valid&65535,Wx(A,A.bi_buf),A.bi_buf=Q>>BH0-A.bi_valid,A.bi_valid+=$-BH0;else A.bi_buf|=Q<<A.bi_valid&65535,A.bi_valid+=$},oU=(A,Q,$)=>{v8(A,$[Q*2],$[Q*2+1])},kkA=(A,Q)=>{let $=0;do $|=A&1,A>>>=1,$<<=1;while(--Q>0);return $>>>1},Kk1=(A)=>{if(A.bi_valid===16)Wx(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},Wk1=(A,Q)=>{let{dyn_tree:$,max_code:B}=Q,E=Q.stat_desc.static_tree,D=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,U=Q.stat_desc.extra_base,Y=Q.stat_desc.max_length,Z,F,X,I,G,V,z=0;for(I=0;I<=OC;I++)A.bl_count[I]=0;$[A.heap[A.heap_max]*2+1]=0;for(Z=A.heap_max+1;Z<OkA;Z++){if(F=A.heap[Z],I=$[$[F*2+1]*2+1]+1,I>Y)I=Y,z++;if($[F*2+1]=I,F>B)continue;if(A.bl_count[I]++,G=0,F>=U)G=J[F-U];if(V=$[F*2],A.opt_len+=V*(I+G),D)A.static_len+=V*(E[F*2+1]+G)}if(z===0)return;do{I=Y-1;while(A.bl_count[I]===0)I--;A.bl_count[I]--,A.bl_count[I+1]+=2,A.bl_count[Y]--,z-=2}while(z>0);for(I=Y;I!==0;I--){F=A.bl_count[I];while(F!==0){if(X=A.heap[--Z],X>B)continue;if($[X*2+1]!==I)A.opt_len+=(I-$[X*2+1])*$[X*2],$[X*2+1]=I;F--}}},fkA=(A,Q,$)=>{let B=Array(OC+1),E=0,D,J;for(D=1;D<=OC;D++)E=E+$[D-1]<<1,B[D]=E;for(J=0;J<=Q;J++){let U=A[J*2+1];if(U===0)continue;A[J*2]=kkA(B[U]++,U)}},Ck1=()=>{let A,Q,$,B,E,D=Array(OC+1);$=0;for(B=0;B<LH0-1;B++){PH0[B]=$;for(A=0;A<1<<WH0[B];A++)Kx[$++]=B}Kx[$-1]=B,E=0;for(B=0;B<16;B++){ue[B]=E;for(A=0;A<1<<qe[B];A++)zx[E++]=B}E>>=7;for(;B<MO;B++){ue[B]=E<<7;for(A=0;A<1<<qe[B]-7;A++)zx[256+E++]=B}for(Q=0;Q<=OC;Q++)D[Q]=0;A=0;while(A<=143)NF[A*2+1]=8,A++,D[8]++;while(A<=255)NF[A*2+1]=9,A++,D[9]++;while(A<=279)NF[A*2+1]=7,A++,D[7]++;while(A<=287)NF[A*2+1]=8,A++,D[8]++;fkA(NF,Vx+1,D);for(A=0;A<MO;A++)Xx[A*2+1]=5,Xx[A*2]=kkA(A,5);vkA=new EH0(NF,WH0,ux+1,Vx,OC),TkA=new EH0(Xx,qe,0,MO,OC),_kA=new EH0([],Vk1,0,jH0,Gk1)},ykA=(A)=>{let Q;for(Q=0;Q<Vx;Q++)A.dyn_ltree[Q*2]=0;for(Q=0;Q<MO;Q++)A.dyn_dtree[Q*2]=0;for(Q=0;Q<jH0;Q++)A.bl_tree[Q*2]=0;A.dyn_ltree[RH0*2]=1,A.opt_len=A.static_len=0,A.sym_next=A.matches=0},xkA=(A)=>{if(A.bi_valid>8)Wx(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},gSA=(A,Q,$,B)=>{let E=Q*2,D=$*2;return A[E]<A[D]||A[E]===A[D]&&B[Q]<=B[$]},JH0=(A,Q,$)=>{let B=A.heap[$],E=$<<1;while(E<=A.heap_len){if(E<A.heap_len&&gSA(Q,A.heap[E+1],A.heap[E],A.depth))E++;if(gSA(Q,B,A.heap[E],A.depth))break;A.heap[$]=A.heap[E],$=E,E<<=1}A.heap[$]=B},mSA=(A,Q,$)=>{let B,E,D=0,J,U;if(A.sym_next!==0)do if(B=A.pending_buf[A.sym_buf+D++]&255,B+=(A.pending_buf[A.sym_buf+D++]&255)<<8,E=A.pending_buf[A.sym_buf+D++],B===0)oU(A,E,Q);else{if(J=Kx[E],oU(A,J+ux+1,Q),U=WH0[J],U!==0)E-=PH0[J],v8(A,E,U);if(B--,J=SkA(B),oU(A,J,$),U=qe[J],U!==0)B-=ue[J],v8(A,B,U)}while(D<A.sym_next);oU(A,RH0,Q)},CH0=(A,Q)=>{let $=Q.dyn_tree,B=Q.stat_desc.static_tree,E=Q.stat_desc.has_stree,D=Q.stat_desc.elems,J,U,Y=-1,Z;A.heap_len=0,A.heap_max=OkA;for(J=0;J<D;J++)if($[J*2]!==0)A.heap[++A.heap_len]=Y=J,A.depth[J]=0;else $[J*2+1]=0;while(A.heap_len<2)if(Z=A.heap[++A.heap_len]=Y<2?++Y:0,$[Z*2]=1,A.depth[Z]=0,A.opt_len--,E)A.static_len-=B[Z*2+1];Q.max_code=Y;for(J=A.heap_len>>1;J>=1;J--)JH0(A,$,J);Z=D;do J=A.heap[1],A.heap[1]=A.heap[A.heap_len--],JH0(A,$,1),U=A.heap[1],A.heap[--A.heap_max]=J,A.heap[--A.heap_max]=U,$[Z*2]=$[J*2]+$[U*2],A.depth[Z]=(A.depth[J]>=A.depth[U]?A.depth[J]:A.depth[U])+1,$[J*2+1]=$[U*2+1]=Z,A.heap[1]=Z++,JH0(A,$,1);while(A.heap_len>=2);A.heap[--A.heap_max]=A.heap[1],Wk1(A,Q),fkA($,Y,A.bl_count)},dSA=(A,Q,$)=>{let B,E=-1,D,J=Q[1],U=0,Y=7,Z=4;if(J===0)Y=138,Z=3;Q[($+1)*2+1]=65535;for(B=0;B<=$;B++){if(D=J,J=Q[(B+1)*2+1],++U<Y&&D===J)continue;else if(U<Z)A.bl_tree[D*2]+=U;else if(D!==0){if(D!==E)A.bl_tree[D*2]++;A.bl_tree[LkA*2]++}else if(U<=10)A.bl_tree[jkA*2]++;else A.bl_tree[RkA*2]++;if(U=0,E=D,J===0)Y=138,Z=3;else if(D===J)Y=6,Z=3;else Y=7,Z=4}},cSA=(A,Q,$)=>{let B,E=-1,D,J=Q[1],U=0,Y=7,Z=4;if(J===0)Y=138,Z=3;for(B=0;B<=$;B++){if(D=J,J=Q[(B+1)*2+1],++U<Y&&D===J)continue;else if(U<Z)do oU(A,D,A.bl_tree);while(--U!==0);else if(D!==0){if(D!==E)oU(A,D,A.bl_tree),U--;oU(A,LkA,A.bl_tree),v8(A,U-3,2)}else if(U<=10)oU(A,jkA,A.bl_tree),v8(A,U-3,3);else oU(A,RkA,A.bl_tree),v8(A,U-11,7);if(U=0,E=D,J===0)Y=138,Z=3;else if(D===J)Y=6,Z=3;else Y=7,Z=4}},Hk1=(A)=>{let Q;dSA(A,A.dyn_ltree,A.l_desc.max_code),dSA(A,A.dyn_dtree,A.d_desc.max_code),CH0(A,A.bl_desc);for(Q=jH0-1;Q>=3;Q--)if(A.bl_tree[PkA[Q]*2+1]!==0)break;return A.opt_len+=3*(Q+1)+5+5+4,Q},Nk1=(A,Q,$,B)=>{let E;v8(A,Q-257,5),v8(A,$-1,5),v8(A,B-4,4);for(E=0;E<B;E++)v8(A,A.bl_tree[PkA[E]*2+1],3);cSA(A,A.dyn_ltree,Q-1),cSA(A,A.dyn_dtree,$-1)},qk1=(A)=>{let Q=4093624447,$;for($=0;$<=31;$++,Q>>>=1)if(Q&1&&A.dyn_ltree[$*2]!==0)return 0;if(A.dyn_ltree[18]!==0||A.dyn_ltree[20]!==0||A.dyn_ltree[26]!==0)return 1;for($=32;$<ux;$++)if(A.dyn_ltree[$*2]!==0)return 1;return 0},pSA=!1,uk1=(A)=>{if(!pSA)Ck1(),pSA=!0;A.l_desc=new DH0(A.dyn_ltree,vkA),A.d_desc=new DH0(A.dyn_dtree,TkA),A.bl_desc=new DH0(A.bl_tree,_kA),A.bi_buf=0,A.bi_valid=0,ykA(A)},bkA=(A,Q,$,B)=>{if(v8(A,(Zk1<<1)+(B?1:0),3),xkA(A),Wx(A,$),Wx(A,~$),$)A.pending_buf.set(A.window.subarray(Q,Q+$),A.pending);A.pending+=$},wk1=(A)=>{v8(A,MkA<<1,3),oU(A,RH0,NF),Kk1(A)},Mk1=(A,Q,$,B)=>{let E,D,J=0;if(A.level>0){if(A.strm.data_type===2)A.strm.data_type=qk1(A);if(CH0(A,A.l_desc),CH0(A,A.d_desc),J=Hk1(A),E=A.opt_len+3+7>>>3,D=A.static_len+3+7>>>3,D<=E)E=D}else E=D=$+5;if($+4<=E&&Q!==-1)bkA(A,Q,$,B);else if(A.strategy===4||D===E)v8(A,(MkA<<1)+(B?1:0),3),mSA(A,NF,Xx);else v8(A,(Fk1<<1)+(B?1:0),3),Nk1(A,A.l_desc.max_code+1,A.d_desc.max_code+1,J+1),mSA(A,A.dyn_ltree,A.dyn_dtree);if(ykA(A),B)xkA(A)},Ok1=(A,Q,$)=>{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++]=$,Q===0)A.dyn_ltree[$*2]++;else A.matches++,Q--,A.dyn_ltree[(Kx[$]+ux+1)*2]++,A.dyn_dtree[SkA(Q)*2]++;return A.sym_next===A.sym_end},Lk1,jk1,Rk1,Pk1,vk1,Tk1,_k1=(A,Q,$,B)=>{let E=A&65535|0,D=A>>>16&65535|0,J=0;while($!==0){J=$>2000?2000:$,$-=J;do E=E+Q[B++]|0,D=D+E|0;while(--J);E%=65521,D%=65521}return E|D<<16|0},Cx,Sk1=()=>{let A,Q=[];for(var $=0;$<256;$++){A=$;for(var B=0;B<8;B++)A=A&1?3988292384^A>>>1:A>>>1;Q[$]=A}return Q},kk1,fk1=(A,Q,$,B)=>{let E=kk1,D=B+$;A^=-1;for(let J=B;J<D;J++)A=A>>>8^E[(A^Q[J])&255];return A^-1},P3,RC,TC,yk1,HH0,xk1,vG,bk1,TG,hk1,gk1,GD,lSA,E5,iSA,rU,mk1,UH0,dk1,ck1,Ke,pk1,lk1,ik1,nk1,Oe,ak1=9,ok1=15,rk1=8,sk1=29,tk1=256,NH0,ek1=30,Af1=19,Qf1,$f1=15,uQ=3,PG=258,sU,Bf1=32,OO=42,vH0=57,qH0=69,uH0=73,wH0=91,MH0=103,LC=113,Zx=666,R7=1,RO=2,PC=3,PO=4,Ef1=3,jC=(A,Q)=>{return A.msg=RC[Q],Q},nSA=(A)=>{return A*2-(A>4?9:0)},RG=(A)=>{let Q=A.length;while(--Q>=0)A[Q]=0},Df1=(A)=>{let Q,$,B,E=A.w_size;Q=A.hash_size,B=Q;do $=A.head[--B],A.head[B]=$>=E?$-E:0;while(--Q);Q=E,B=Q;do $=A.prev[--B],A.prev[B]=$>=E?$-E:0;while(--Q)},Jf1=(A,Q,$)=>(Q<<A.hash_shift^$)&A.hash_mask,_G,p9=(A)=>{let Q=A.state,$=Q.pending;if($>A.avail_out)$=A.avail_out;if($===0)return;if(A.output.set(Q.pending_buf.subarray(Q.pending_out,Q.pending_out+$),A.next_out),A.next_out+=$,Q.pending_out+=$,A.total_out+=$,A.avail_out-=$,Q.pending-=$,Q.pending===0)Q.pending_out=0},l9=(A,Q)=>{xk1(A,A.block_start>=0?A.block_start:-1,A.strstart-A.block_start,Q),A.block_start=A.strstart,p9(A.strm)},Q6=(A,Q)=>{A.pending_buf[A.pending++]=Q},Yx=(A,Q)=>{A.pending_buf[A.pending++]=Q>>>8&255,A.pending_buf[A.pending++]=Q&255},OH0=(A,Q,$,B)=>{let E=A.avail_in;if(E>B)E=B;if(E===0)return 0;if(A.avail_in-=E,Q.set(A.input.subarray(A.next_in,A.next_in+E),$),A.state.wrap===1)A.adler=Cx(A.adler,Q,E,$);else if(A.state.wrap===2)A.adler=P3(A.adler,Q,E,$);return A.next_in+=E,A.total_in+=E,E},hkA=(A,Q)=>{let{max_chain_length:$,strstart:B}=A,E,D,J=A.prev_length,U=A.nice_match,Y=A.strstart>A.w_size-sU?A.strstart-(A.w_size-sU):0,Z=A.window,F=A.w_mask,X=A.prev,I=A.strstart+PG,G=Z[B+J-1],V=Z[B+J];if(A.prev_length>=A.good_match)$>>=2;if(U>A.lookahead)U=A.lookahead;do{if(E=Q,Z[E+J]!==V||Z[E+J-1]!==G||Z[E]!==Z[B]||Z[++E]!==Z[B+1])continue;B+=2,E++;do;while(Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&Z[++B]===Z[++E]&&B<I);if(D=PG-(I-B),B=I-PG,D>J){if(A.match_start=Q,J=D,D>=U)break;G=Z[B+J-1],V=Z[B+J]}}while((Q=X[Q&F])>Y&&--$!==0);if(J<=A.lookahead)return J;return A.lookahead},LO=(A)=>{let Q=A.w_size,$,B,E;do{if(B=A.window_size-A.lookahead-A.strstart,A.strstart>=Q+(Q-sU)){if(A.window.set(A.window.subarray(Q,Q+Q-B),0),A.match_start-=Q,A.strstart-=Q,A.block_start-=Q,A.insert>A.strstart)A.insert=A.strstart;Df1(A),B+=Q}if(A.strm.avail_in===0)break;if($=OH0(A.strm,A.window,A.strstart+A.lookahead,B),A.lookahead+=$,A.lookahead+A.insert>=uQ){E=A.strstart-A.insert,A.ins_h=A.window[E],A.ins_h=_G(A,A.ins_h,A.window[E+1]);while(A.insert)if(A.ins_h=_G(A,A.ins_h,A.window[E+uQ-1]),A.prev[E&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=E,E++,A.insert--,A.lookahead+A.insert<uQ)break}}while(A.lookahead<sU&&A.strm.avail_in!==0)},gkA=(A,Q)=>{let $=A.pending_buf_size-5>A.w_size?A.w_size:A.pending_buf_size-5,B,E,D,J=0,U=A.strm.avail_in;do{if(B=65535,D=A.bi_valid+42>>3,A.strm.avail_out<D)break;if(D=A.strm.avail_out-D,E=A.strstart-A.block_start,B>E+A.strm.avail_in)B=E+A.strm.avail_in;if(B>D)B=D;if(B<$&&(B===0&&Q!==GD||Q===TG||B!==E+A.strm.avail_in))break;if(J=Q===GD&&B===E+A.strm.avail_in?1:0,HH0(A,0,0,J),A.pending_buf[A.pending-4]=B,A.pending_buf[A.pending-3]=B>>8,A.pending_buf[A.pending-2]=~B,A.pending_buf[A.pending-1]=~B>>8,p9(A.strm),E){if(E>B)E=B;A.strm.output.set(A.window.subarray(A.block_start,A.block_start+E),A.strm.next_out),A.strm.next_out+=E,A.strm.avail_out-=E,A.strm.total_out+=E,A.block_start+=E,B-=E}if(B)OH0(A.strm,A.strm.output,A.strm.next_out,B),A.strm.next_out+=B,A.strm.avail_out-=B,A.strm.total_out+=B}while(J===0);if(U-=A.strm.avail_in,U){if(U>=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<=U){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-U,A.strm.next_in),A.strstart),A.strstart+=U,A.insert+=U>A.w_size-A.insert?A.w_size-A.insert:U}A.block_start=A.strstart}if(A.high_water<A.strstart)A.high_water=A.strstart;if(J)return PO;if(Q!==TG&&Q!==GD&&A.strm.avail_in===0&&A.strstart===A.block_start)return RO;if(D=A.window_size-A.strstart,A.strm.avail_in>D&&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(D+=A.w_size,A.insert>A.strstart)A.insert=A.strstart}if(D>A.strm.avail_in)D=A.strm.avail_in;if(D)OH0(A.strm,A.window,A.strstart,D),A.strstart+=D,A.insert+=D>A.w_size-A.insert?A.w_size-A.insert:D;if(A.high_water<A.strstart)A.high_water=A.strstart;if(D=A.bi_valid+42>>3,D=A.pending_buf_size-D>65535?65535:A.pending_buf_size-D,$=D>A.w_size?A.w_size:D,E=A.strstart-A.block_start,E>=$||(E||Q===GD)&&Q!==TG&&A.strm.avail_in===0&&E<=D)B=E>D?D:E,J=Q===GD&&A.strm.avail_in===0&&B===E?1:0,HH0(A,A.block_start,B,J),A.block_start+=B,p9(A.strm);return J?PC:R7},YH0=(A,Q)=>{let $,B;for(;;){if(A.lookahead<sU){if(LO(A),A.lookahead<sU&&Q===TG)return R7;if(A.lookahead===0)break}if($=0,A.lookahead>=uQ)A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;if($!==0&&A.strstart-$<=A.w_size-sU)A.match_length=hkA(A,$);if(A.match_length>=uQ)if(B=vG(A,A.strstart-A.match_start,A.match_length-uQ),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=uQ){A.match_length--;do A.strstart++,A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=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=_G(A,A.ins_h,A.window[A.strstart+1]);else B=vG(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(B){if(l9(A,!1),A.strm.avail_out===0)return R7}}if(A.insert=A.strstart<uQ-1?A.strstart:uQ-1,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},uO=(A,Q)=>{let $,B,E;for(;;){if(A.lookahead<sU){if(LO(A),A.lookahead<sU&&Q===TG)return R7;if(A.lookahead===0)break}if($=0,A.lookahead>=uQ)A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=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=uQ-1,$!==0&&A.prev_length<A.max_lazy_match&&A.strstart-$<=A.w_size-sU){if(A.match_length=hkA(A,$),A.match_length<=5&&(A.strategy===ck1||A.match_length===uQ&&A.strstart-A.match_start>4096))A.match_length=uQ-1}if(A.prev_length>=uQ&&A.match_length<=A.prev_length){E=A.strstart+A.lookahead-uQ,B=vG(A,A.strstart-1-A.prev_match,A.prev_length-uQ),A.lookahead-=A.prev_length-1,A.prev_length-=2;do if(++A.strstart<=E)A.ins_h=_G(A,A.ins_h,A.window[A.strstart+uQ-1]),$=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=uQ-1,A.strstart++,B){if(l9(A,!1),A.strm.avail_out===0)return R7}}else if(A.match_available){if(B=vG(A,0,A.window[A.strstart-1]),B)l9(A,!1);if(A.strstart++,A.lookahead--,A.strm.avail_out===0)return R7}else A.match_available=1,A.strstart++,A.lookahead--}if(A.match_available)B=vG(A,0,A.window[A.strstart-1]),A.match_available=0;if(A.insert=A.strstart<uQ-1?A.strstart:uQ-1,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},Uf1=(A,Q)=>{let $,B,E,D,J=A.window;for(;;){if(A.lookahead<=PG){if(LO(A),A.lookahead<=PG&&Q===TG)return R7;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=uQ&&A.strstart>0){if(E=A.strstart-1,B=J[E],B===J[++E]&&B===J[++E]&&B===J[++E]){D=A.strstart+PG;do;while(B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&B===J[++E]&&E<D);if(A.match_length=PG-(D-E),A.match_length>A.lookahead)A.match_length=A.lookahead}}if(A.match_length>=uQ)$=vG(A,1,A.match_length-uQ),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0;else $=vG(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if($){if(l9(A,!1),A.strm.avail_out===0)return R7}}if(A.insert=0,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},Yf1=(A,Q)=>{let $;for(;;){if(A.lookahead===0){if(LO(A),A.lookahead===0){if(Q===TG)return R7;break}}if(A.match_length=0,$=vG(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,$){if(l9(A,!1),A.strm.avail_out===0)return R7}}if(A.insert=0,Q===GD){if(l9(A,!0),A.strm.avail_out===0)return PC;return PO}if(A.sym_next){if(l9(A,!1),A.strm.avail_out===0)return R7}return RO},Fx,Zf1=(A)=>{A.window_size=2*A.w_size,RG(A.head),A.max_lazy_match=Fx[A.level].max_lazy,A.good_match=Fx[A.level].good_length,A.nice_match=Fx[A.level].nice_length,A.max_chain_length=Fx[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=uQ-1,A.match_available=0,A.ins_h=0},wx=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.status!==OO&&Q.status!==vH0&&Q.status!==qH0&&Q.status!==uH0&&Q.status!==wH0&&Q.status!==MH0&&Q.status!==LC&&Q.status!==Zx)return 1;return 0},mkA=(A)=>{if(wx(A))return jC(A,rU);A.total_in=A.total_out=0,A.data_type=nk1;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?vH0:Q.wrap?OO:LC,A.adler=Q.wrap===2?0:1,Q.last_flush=-2,yk1(Q),E5},dkA=(A)=>{let Q=mkA(A);if(Q===E5)Zf1(A.state);return Q},Xf1=(A,Q)=>{if(wx(A)||A.state.wrap!==2)return rU;return A.state.gzhead=Q,E5},ckA=(A,Q,$,B,E,D)=>{if(!A)return rU;let J=1;if(Q===dk1)Q=6;if(B<0)J=0,B=-B;else if(B>15)J=2,B-=16;if(E<1||E>ak1||$!==Oe||B<8||B>15||Q<0||Q>9||D<0||D>lk1||B===8&&J!==1)return jC(A,rU);if(B===8)B=9;let U=new Ff1;return A.state=U,U.strm=A,U.status=OO,U.wrap=J,U.gzhead=null,U.w_bits=B,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=E+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+uQ-1)/uQ),U.window=new Uint8Array(U.w_size*2),U.head=new Uint16Array(U.hash_size),U.prev=new Uint16Array(U.w_size),U.lit_bufsize=1<<E+6,U.pending_buf_size=U.lit_bufsize*4,U.pending_buf=new Uint8Array(U.pending_buf_size),U.sym_buf=U.lit_bufsize,U.sym_end=(U.lit_bufsize-1)*3,U.level=Q,U.strategy=D,U.method=$,dkA(A)},If1=(A,Q)=>{return ckA(A,Q,Oe,ok1,rk1,ik1)},Gf1=(A,Q)=>{if(wx(A)||Q>lSA||Q<0)return A?jC(A,rU):rU;let $=A.state;if(!A.output||A.avail_in!==0&&!A.input||$.status===Zx&&Q!==GD)return jC(A,A.avail_out===0?UH0:rU);let B=$.last_flush;if($.last_flush=Q,$.pending!==0){if(p9(A),A.avail_out===0)return $.last_flush=-1,E5}else if(A.avail_in===0&&nSA(Q)<=nSA(B)&&Q!==GD)return jC(A,UH0);if($.status===Zx&&A.avail_in!==0)return jC(A,UH0);if($.status===OO&&$.wrap===0)$.status=LC;if($.status===OO){let E=Oe+($.w_bits-8<<4)<<8,D=-1;if($.strategy>=Ke||$.level<2)D=0;else if($.level<6)D=1;else if($.level===6)D=2;else D=3;if(E|=D<<6,$.strstart!==0)E|=Bf1;if(E+=31-E%31,Yx($,E),$.strstart!==0)Yx($,A.adler>>>16),Yx($,A.adler&65535);if(A.adler=1,$.status=LC,p9(A),$.pending!==0)return $.last_flush=-1,E5}if($.status===vH0)if(A.adler=0,Q6($,31),Q6($,139),Q6($,8),!$.gzhead){if(Q6($,0),Q6($,0),Q6($,0),Q6($,0),Q6($,0),Q6($,$.level===9?2:$.strategy>=Ke||$.level<2?4:0),Q6($,Ef1),$.status=LC,p9(A),$.pending!==0)return $.last_flush=-1,E5}else{if(Q6($,($.gzhead.text?1:0)+($.gzhead.hcrc?2:0)+(!$.gzhead.extra?0:4)+(!$.gzhead.name?0:8)+(!$.gzhead.comment?0:16)),Q6($,$.gzhead.time&255),Q6($,$.gzhead.time>>8&255),Q6($,$.gzhead.time>>16&255),Q6($,$.gzhead.time>>24&255),Q6($,$.level===9?2:$.strategy>=Ke||$.level<2?4:0),Q6($,$.gzhead.os&255),$.gzhead.extra&&$.gzhead.extra.length)Q6($,$.gzhead.extra.length&255),Q6($,$.gzhead.extra.length>>8&255);if($.gzhead.hcrc)A.adler=P3(A.adler,$.pending_buf,$.pending,0);$.gzindex=0,$.status=qH0}if($.status===qH0){if($.gzhead.extra){let E=$.pending,D=($.gzhead.extra.length&65535)-$.gzindex;while($.pending+D>$.pending_buf_size){let U=$.pending_buf_size-$.pending;if($.pending_buf.set($.gzhead.extra.subarray($.gzindex,$.gzindex+U),$.pending),$.pending=$.pending_buf_size,$.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);if($.gzindex+=U,p9(A),$.pending!==0)return $.last_flush=-1,E5;E=0,D-=U}let J=new Uint8Array($.gzhead.extra);if($.pending_buf.set(J.subarray($.gzindex,$.gzindex+D),$.pending),$.pending+=D,$.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);$.gzindex=0}$.status=uH0}if($.status===uH0){if($.gzhead.name){let E=$.pending,D;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);if(p9(A),$.pending!==0)return $.last_flush=-1,E5;E=0}if($.gzindex<$.gzhead.name.length)D=$.gzhead.name.charCodeAt($.gzindex++)&255;else D=0;Q6($,D)}while(D!==0);if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);$.gzindex=0}$.status=wH0}if($.status===wH0){if($.gzhead.comment){let E=$.pending,D;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E);if(p9(A),$.pending!==0)return $.last_flush=-1,E5;E=0}if($.gzindex<$.gzhead.comment.length)D=$.gzhead.comment.charCodeAt($.gzindex++)&255;else D=0;Q6($,D)}while(D!==0);if($.gzhead.hcrc&&$.pending>E)A.adler=P3(A.adler,$.pending_buf,$.pending-E,E)}$.status=MH0}if($.status===MH0){if($.gzhead.hcrc){if($.pending+2>$.pending_buf_size){if(p9(A),$.pending!==0)return $.last_flush=-1,E5}Q6($,A.adler&255),Q6($,A.adler>>8&255),A.adler=0}if($.status=LC,p9(A),$.pending!==0)return $.last_flush=-1,E5}if(A.avail_in!==0||$.lookahead!==0||Q!==TG&&$.status!==Zx){let E=$.level===0?gkA($,Q):$.strategy===Ke?Yf1($,Q):$.strategy===pk1?Uf1($,Q):Fx[$.level].func($,Q);if(E===PC||E===PO)$.status=Zx;if(E===R7||E===PC){if(A.avail_out===0)$.last_flush=-1;return E5}if(E===RO){if(Q===hk1)bk1($);else if(Q!==lSA){if(HH0($,0,0,!1),Q===gk1){if(RG($.head),$.lookahead===0)$.strstart=0,$.block_start=0,$.insert=0}}if(p9(A),A.avail_out===0)return $.last_flush=-1,E5}}if(Q!==GD)return E5;if($.wrap<=0)return iSA;if($.wrap===2)Q6($,A.adler&255),Q6($,A.adler>>8&255),Q6($,A.adler>>16&255),Q6($,A.adler>>24&255),Q6($,A.total_in&255),Q6($,A.total_in>>8&255),Q6($,A.total_in>>16&255),Q6($,A.total_in>>24&255);else Yx($,A.adler>>>16),Yx($,A.adler&65535);if(p9(A),$.wrap>0)$.wrap=-$.wrap;return $.pending!==0?E5:iSA},Vf1=(A)=>{if(wx(A))return rU;let Q=A.state.status;return A.state=null,Q===LC?jC(A,mk1):E5},zf1=(A,Q)=>{let $=Q.length;if(wx(A))return rU;let B=A.state,E=B.wrap;if(E===2||E===1&&B.status!==OO||B.lookahead)return rU;if(E===1)A.adler=Cx(A.adler,Q,$,0);if(B.wrap=0,$>=B.w_size){if(E===0)RG(B.head),B.strstart=0,B.block_start=0,B.insert=0;let Y=new Uint8Array(B.w_size);Y.set(Q.subarray($-B.w_size,$),0),Q=Y,$=B.w_size}let{avail_in:D,next_in:J,input:U}=A;A.avail_in=$,A.next_in=0,A.input=Q,LO(B);while(B.lookahead>=uQ){let Y=B.strstart,Z=B.lookahead-(uQ-1);do B.ins_h=_G(B,B.ins_h,B.window[Y+uQ-1]),B.prev[Y&B.w_mask]=B.head[B.ins_h],B.head[B.ins_h]=Y,Y++;while(--Z);B.strstart=Y,B.lookahead=uQ-1,LO(B)}return B.strstart+=B.lookahead,B.block_start=B.strstart,B.insert=B.lookahead,B.lookahead=0,B.match_length=B.prev_length=uQ-1,B.match_available=0,A.next_in=J,A.input=U,A.avail_in=D,B.wrap=E,E5},Kf1,Wf1,Cf1,Hf1,Nf1,qf1,uf1,wf1,Mf1="pako deflate (from Nodeca project)",Ix,Of1=(A,Q)=>{return Object.prototype.hasOwnProperty.call(A,Q)},Lf1=function(A){let Q=Array.prototype.slice.call(arguments,1);while(Q.length){let $=Q.shift();if(!$)continue;if(typeof $!=="object")throw TypeError($+"must be non-object");for(let B in $)if(Of1($,B))A[B]=$[B]}return A},jf1=(A)=>{let Q=0;for(let B=0,E=A.length;B<E;B++)Q+=A[B].length;let $=new Uint8Array(Q);for(let B=0,E=0,D=A.length;B<D;B++){let J=A[B];$.set(J,E),E+=J.length}return $},Le,pkA=!0,Hx,Rf1=(A)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(A);let Q,$,B,E,D,J=A.length,U=0;for(E=0;E<J;E++){if($=A.charCodeAt(E),($&64512)===55296&&E+1<J){if(B=A.charCodeAt(E+1),(B&64512)===56320)$=65536+($-55296<<10)+(B-56320),E++}U+=$<128?1:$<2048?2:$<65536?3:4}Q=new Uint8Array(U);for(D=0,E=0;D<U;E++){if($=A.charCodeAt(E),($&64512)===55296&&E+1<J){if(B=A.charCodeAt(E+1),(B&64512)===56320)$=65536+($-55296<<10)+(B-56320),E++}if($<128)Q[D++]=$;else if($<2048)Q[D++]=192|$>>>6,Q[D++]=128|$&63;else if($<65536)Q[D++]=224|$>>>12,Q[D++]=128|$>>>6&63,Q[D++]=128|$&63;else Q[D++]=240|$>>>18,Q[D++]=128|$>>>12&63,Q[D++]=128|$>>>6&63,Q[D++]=128|$&63}return Q},Pf1=(A,Q)=>{if(Q<65534){if(A.subarray&&pkA)return String.fromCharCode.apply(null,A.length===Q?A:A.subarray(0,Q))}let $="";for(let B=0;B<Q;B++)$+=String.fromCharCode(A[B]);return $},vf1=(A,Q)=>{let $=Q||A.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(A.subarray(0,Q));let B,E,D=Array($*2);for(E=0,B=0;B<$;){let J=A[B++];if(J<128){D[E++]=J;continue}let U=Hx[J];if(U>4){D[E++]=65533,B+=U-1;continue}J&=U===2?31:U===3?15:7;while(U>1&&B<$)J=J<<6|A[B++]&63,U--;if(U>1){D[E++]=65533;continue}if(J<65536)D[E++]=J;else J-=65536,D[E++]=55296|J>>10&1023,D[E++]=56320|J&1023}return Pf1(D,E)},Tf1=(A,Q)=>{if(Q=Q||A.length,Q>A.length)Q=A.length;let $=Q-1;while($>=0&&(A[$]&192)===128)$--;if($<0)return Q;if($===0)return Q;return $+Hx[A[$]]>Q?$:Q},Nx,lkA,ikA,Sf1,kf1,ff1,yf1,we,xf1,bf1,hf1,gf1,cf1,pf1,lf1,if1,nf1,af1,We=16209,of1=16191,rf1=function(Q,$){let B,E,D,J,U,Y,Z,F,X,I,G,V,z,K,W,C,H,N,q,w,L,R,_,P,f=Q.state;B=Q.next_in,_=Q.input,E=B+(Q.avail_in-5),D=Q.next_out,P=Q.output,J=D-($-Q.avail_out),U=D+(Q.avail_out-257),Y=f.dmax,Z=f.wsize,F=f.whave,X=f.wnext,I=f.window,G=f.hold,V=f.bits,z=f.lencode,K=f.distcode,W=(1<<f.lenbits)-1,C=(1<<f.distbits)-1;A:do{if(V<15)G+=_[B++]<<V,V+=8,G+=_[B++]<<V,V+=8;H=z[G&W];Q:for(;;){if(N=H>>>24,G>>>=N,V-=N,N=H>>>16&255,N===0)P[D++]=H&65535;else if(N&16){if(q=H&65535,N&=15,N){if(V<N)G+=_[B++]<<V,V+=8;q+=G&(1<<N)-1,G>>>=N,V-=N}if(V<15)G+=_[B++]<<V,V+=8,G+=_[B++]<<V,V+=8;H=K[G&C];$:for(;;){if(N=H>>>24,G>>>=N,V-=N,N=H>>>16&255,N&16){if(w=H&65535,N&=15,V<N){if(G+=_[B++]<<V,V+=8,V<N)G+=_[B++]<<V,V+=8}if(w+=G&(1<<N)-1,w>Y){Q.msg="invalid distance too far back",f.mode=We;break A}if(G>>>=N,V-=N,N=D-J,w>N){if(N=w-N,N>F){if(f.sane){Q.msg="invalid distance too far back",f.mode=We;break A}}if(L=0,R=I,X===0){if(L+=Z-N,N<q){q-=N;do P[D++]=I[L++];while(--N);L=D-w,R=P}}else if(X<N){if(L+=Z+X-N,N-=X,N<q){q-=N;do P[D++]=I[L++];while(--N);if(L=0,X<q){N=X,q-=N;do P[D++]=I[L++];while(--N);L=D-w,R=P}}}else if(L+=X-N,N<q){q-=N;do P[D++]=I[L++];while(--N);L=D-w,R=P}while(q>2)P[D++]=R[L++],P[D++]=R[L++],P[D++]=R[L++],q-=3;if(q){if(P[D++]=R[L++],q>1)P[D++]=R[L++]}}else{L=D-w;do P[D++]=P[L++],P[D++]=P[L++],P[D++]=P[L++],q-=3;while(q>2);if(q){if(P[D++]=P[L++],q>1)P[D++]=P[L++]}}}else if((N&64)===0){H=K[(H&65535)+(G&(1<<N)-1)];continue $}else{Q.msg="invalid distance code",f.mode=We;break A}break}}else if((N&64)===0){H=z[(H&65535)+(G&(1<<N)-1)];continue Q}else if(N&32){f.mode=of1;break A}else{Q.msg="invalid literal/length code",f.mode=We;break A}break}}while(B<E&&D<U);q=V>>3,B-=q,V-=q<<3,G&=(1<<V)-1,Q.next_in=B,Q.next_out=D,Q.avail_in=B<E?5+(E-B):5-(B-E),Q.avail_out=D<U?257+(U-D):257-(D-U),f.hold=G,f.bits=V;return},wO=15,aSA=852,oSA=592,rSA=0,ZH0=1,sSA=2,sf1,tf1,ef1,Ay1,Qy1=(A,Q,$,B,E,D,J,U)=>{let Y=U.bits,Z=0,F=0,X=0,I=0,G=0,V=0,z=0,K=0,W=0,C=0,H,N,q,w,L,R=null,_,P=new Uint16Array(wO+1),f=new Uint16Array(wO+1),m=null,y,T,k;for(Z=0;Z<=wO;Z++)P[Z]=0;for(F=0;F<B;F++)P[Q[$+F]]++;G=Y;for(I=wO;I>=1;I--)if(P[I]!==0)break;if(G>I)G=I;if(I===0)return E[D++]=20971520,E[D++]=20971520,U.bits=1,0;for(X=1;X<I;X++)if(P[X]!==0)break;if(G<X)G=X;K=1;for(Z=1;Z<=wO;Z++)if(K<<=1,K-=P[Z],K<0)return-1;if(K>0&&(A===rSA||I!==1))return-1;f[1]=0;for(Z=1;Z<wO;Z++)f[Z+1]=f[Z]+P[Z];for(F=0;F<B;F++)if(Q[$+F]!==0)J[f[Q[$+F]]++]=F;if(A===rSA)R=m=J,_=20;else if(A===ZH0)R=sf1,m=tf1,_=257;else R=ef1,m=Ay1,_=0;if(C=0,F=0,Z=X,L=D,V=G,z=0,q=-1,W=1<<G,w=W-1,A===ZH0&&W>aSA||A===sSA&&W>oSA)return 1;for(;;){if(y=Z-z,J[F]+1<_)T=0,k=J[F];else if(J[F]>=_)T=m[J[F]-_],k=R[J[F]-_];else T=96,k=0;H=1<<Z-z,N=1<<V,X=N;do N-=H,E[L+(C>>z)+N]=y<<24|T<<16|k|0;while(N!==0);H=1<<Z-1;while(C&H)H>>=1;if(H!==0)C&=H-1,C+=H;else C=0;if(F++,--P[Z]===0){if(Z===I)break;Z=Q[$+J[F]]}if(Z>G&&(C&w)!==q){if(z===0)z=G;L+=X,V=Z-z,K=1<<V;while(V+z<I){if(K-=P[V+z],K<=0)break;V++,K<<=1}if(W+=1<<V,A===ZH0&&W>aSA||A===sSA&&W>oSA)return 1;q=C&w,E[q]=G<<24|V<<16|L-D|0}}if(C!==0)E[L+C]=Z-z<<24|4194304|0;return U.bits=G,0},Gx,$y1=0,nkA=1,akA=2,tSA,By1,Ce,vC,Ey1,Dy1,VD,okA,rkA,Jy1,eSA,je=16180,AkA=16181,QkA=16182,$kA=16183,BkA=16184,EkA=16185,DkA=16186,JkA=16187,UkA=16188,YkA=16189,Me=16190,HF=16191,FH0=16192,ZkA=16193,XH0=16194,FkA=16195,XkA=16196,IkA=16197,GkA=16198,He=16199,Ne=16200,VkA=16201,zkA=16202,KkA=16203,WkA=16204,CkA=16205,IH0=16206,HkA=16207,NkA=16208,L$=16209,skA=16210,tkA=16211,Uy1=852,Yy1=592,Zy1=15,Fy1,qkA=(A)=>{return(A>>>24&255)+(A>>>8&65280)+((A&65280)<<8)+((A&255)<<24)},_C=(A)=>{if(!A)return 1;let Q=A.state;if(!Q||Q.strm!==A||Q.mode<je||Q.mode>tkA)return 1;return 0},ekA=(A)=>{if(_C(A))return VD;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=je,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(Uy1),Q.distcode=Q.distdyn=new Int32Array(Yy1),Q.sane=1,Q.back=-1,vC},AfA=(A)=>{if(_C(A))return VD;let Q=A.state;return Q.wsize=0,Q.whave=0,Q.wnext=0,ekA(A)},QfA=(A,Q)=>{let $;if(_C(A))return VD;let B=A.state;if(Q<0)$=0,Q=-Q;else if($=(Q>>4)+5,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return VD;if(B.window!==null&&B.wbits!==Q)B.window=null;return B.wrap=$,B.wbits=Q,AfA(A)},$fA=(A,Q)=>{if(!A)return VD;let $=new Xy1;A.state=$,$.strm=A,$.window=null,$.mode=je;let B=QfA(A,Q);if(B!==vC)A.state=null;return B},Iy1=(A)=>{return $fA(A,Fy1)},ukA=!0,GH0,VH0,Gy1=(A)=>{if(ukA){GH0=new Int32Array(512),VH0=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;Gx(nkA,A.lens,0,288,GH0,0,A.work,{bits:9}),Q=0;while(Q<32)A.lens[Q++]=5;Gx(akA,A.lens,0,32,VH0,0,A.work,{bits:5}),ukA=!1}A.lencode=GH0,A.lenbits=9,A.distcode=VH0,A.distbits=5},BfA=(A,Q,$,B)=>{let E,D=A.state;if(D.window===null)D.wsize=1<<D.wbits,D.wnext=0,D.whave=0,D.window=new Uint8Array(D.wsize);if(B>=D.wsize)D.window.set(Q.subarray($-D.wsize,$),0),D.wnext=0,D.whave=D.wsize;else{if(E=D.wsize-D.wnext,E>B)E=B;if(D.window.set(Q.subarray($-B,$-B+E),D.wnext),B-=E,B)D.window.set(Q.subarray($-B,$),0),D.wnext=B,D.whave=D.wsize;else{if(D.wnext+=E,D.wnext===D.wsize)D.wnext=0;if(D.whave<D.wsize)D.whave+=E}}return 0},Vy1=(A,Q)=>{let $,B,E,D,J,U,Y,Z,F,X,I,G,V,z,K=0,W,C,H,N,q,w,L,R,_=new Uint8Array(4),P,f,m=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(_C(A)||!A.output||!A.input&&A.avail_in!==0)return VD;if($=A.state,$.mode===HF)$.mode=FH0;J=A.next_out,E=A.output,Y=A.avail_out,D=A.next_in,B=A.input,U=A.avail_in,Z=$.hold,F=$.bits,X=U,I=Y,R=vC;A:for(;;)switch($.mode){case je:if($.wrap===0){$.mode=FH0;break}while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.wrap&2&&Z===35615){if($.wbits===0)$.wbits=15;$.check=0,_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0),Z=0,F=0,$.mode=AkA;break}if($.head)$.head.done=!1;if(!($.wrap&1)||(((Z&255)<<8)+(Z>>8))%31){A.msg="incorrect header check",$.mode=L$;break}if((Z&15)!==eSA){A.msg="unknown compression method",$.mode=L$;break}if(Z>>>=4,F-=4,L=(Z&15)+8,$.wbits===0)$.wbits=L;if(L>15||L>$.wbits){A.msg="invalid window size",$.mode=L$;break}$.dmax=1<<$.wbits,$.flags=0,A.adler=$.check=1,$.mode=Z&512?YkA:HF,Z=0,F=0;break;case AkA:while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.flags=Z,($.flags&255)!==eSA){A.msg="unknown compression method",$.mode=L$;break}if($.flags&57344){A.msg="unknown header flags set",$.mode=L$;break}if($.head)$.head.text=Z>>8&1;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0);Z=0,F=0,$.mode=QkA;case QkA:while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.head)$.head.time=Z;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,_[2]=Z>>>16&255,_[3]=Z>>>24&255,$.check=P3($.check,_,4,0);Z=0,F=0,$.mode=$kA;case $kA:while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.head)$.head.xflags=Z&255,$.head.os=Z>>8;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0);Z=0,F=0,$.mode=BkA;case BkA:if($.flags&1024){while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.length=Z,$.head)$.head.extra_len=Z;if($.flags&512&&$.wrap&4)_[0]=Z&255,_[1]=Z>>>8&255,$.check=P3($.check,_,2,0);Z=0,F=0}else if($.head)$.head.extra=null;$.mode=EkA;case EkA:if($.flags&1024){if(G=$.length,G>U)G=U;if(G){if($.head){if(L=$.head.extra_len-$.length,!$.head.extra)$.head.extra=new Uint8Array($.head.extra_len);$.head.extra.set(B.subarray(D,D+G),L)}if($.flags&512&&$.wrap&4)$.check=P3($.check,B,G,D);U-=G,D+=G,$.length-=G}if($.length)break A}$.length=0,$.mode=DkA;case DkA:if($.flags&2048){if(U===0)break A;G=0;do if(L=B[D+G++],$.head&&L&&$.length<65536)$.head.name+=String.fromCharCode(L);while(L&&G<U);if($.flags&512&&$.wrap&4)$.check=P3($.check,B,G,D);if(U-=G,D+=G,L)break A}else if($.head)$.head.name=null;$.length=0,$.mode=JkA;case JkA:if($.flags&4096){if(U===0)break A;G=0;do if(L=B[D+G++],$.head&&L&&$.length<65536)$.head.comment+=String.fromCharCode(L);while(L&&G<U);if($.flags&512&&$.wrap&4)$.check=P3($.check,B,G,D);if(U-=G,D+=G,L)break A}else if($.head)$.head.comment=null;$.mode=UkA;case UkA:if($.flags&512){while(F<16){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.wrap&4&&Z!==($.check&65535)){A.msg="header crc mismatch",$.mode=L$;break}Z=0,F=0}if($.head)$.head.hcrc=$.flags>>9&1,$.head.done=!0;A.adler=$.check=0,$.mode=HF;break;case YkA:while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}A.adler=$.check=qkA(Z),Z=0,F=0,$.mode=Me;case Me:if($.havedict===0)return A.next_out=J,A.avail_out=Y,A.next_in=D,A.avail_in=U,$.hold=Z,$.bits=F,Dy1;A.adler=$.check=1,$.mode=HF;case HF:if(Q===By1||Q===Ce)break A;case FH0:if($.last){Z>>>=F&7,F-=F&7,$.mode=IH0;break}while(F<3){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}switch($.last=Z&1,Z>>>=1,F-=1,Z&3){case 0:$.mode=ZkA;break;case 1:if(Gy1($),$.mode=He,Q===Ce){Z>>>=2,F-=2;break A}break;case 2:$.mode=XkA;break;case 3:A.msg="invalid block type",$.mode=L$}Z>>>=2,F-=2;break;case ZkA:Z>>>=F&7,F-=F&7;while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if((Z&65535)!==(Z>>>16^65535)){A.msg="invalid stored block lengths",$.mode=L$;break}if($.length=Z&65535,Z=0,F=0,$.mode=XH0,Q===Ce)break A;case XH0:$.mode=FkA;case FkA:if(G=$.length,G){if(G>U)G=U;if(G>Y)G=Y;if(G===0)break A;E.set(B.subarray(D,D+G),J),U-=G,D+=G,Y-=G,J+=G,$.length-=G;break}$.mode=HF;break;case XkA:while(F<14){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.nlen=(Z&31)+257,Z>>>=5,F-=5,$.ndist=(Z&31)+1,Z>>>=5,F-=5,$.ncode=(Z&15)+4,Z>>>=4,F-=4,$.nlen>286||$.ndist>30){A.msg="too many length or distance symbols",$.mode=L$;break}$.have=0,$.mode=IkA;case IkA:while($.have<$.ncode){while(F<3){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}$.lens[m[$.have++]]=Z&7,Z>>>=3,F-=3}while($.have<19)$.lens[m[$.have++]]=0;if($.lencode=$.lendyn,$.lenbits=7,P={bits:$.lenbits},R=Gx($y1,$.lens,0,19,$.lencode,0,$.work,P),$.lenbits=P.bits,R){A.msg="invalid code lengths set",$.mode=L$;break}$.have=0,$.mode=GkA;case GkA:while($.have<$.nlen+$.ndist){for(;;){if(K=$.lencode[Z&(1<<$.lenbits)-1],W=K>>>24,C=K>>>16&255,H=K&65535,W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if(H<16)Z>>>=W,F-=W,$.lens[$.have++]=H;else{if(H===16){f=W+2;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if(Z>>>=W,F-=W,$.have===0){A.msg="invalid bit length repeat",$.mode=L$;break}L=$.lens[$.have-1],G=3+(Z&3),Z>>>=2,F-=2}else if(H===17){f=W+3;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=W,F-=W,L=0,G=3+(Z&7),Z>>>=3,F-=3}else{f=W+7;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=W,F-=W,L=0,G=11+(Z&127),Z>>>=7,F-=7}if($.have+G>$.nlen+$.ndist){A.msg="invalid bit length repeat",$.mode=L$;break}while(G--)$.lens[$.have++]=L}}if($.mode===L$)break;if($.lens[256]===0){A.msg="invalid code -- missing end-of-block",$.mode=L$;break}if($.lenbits=9,P={bits:$.lenbits},R=Gx(nkA,$.lens,0,$.nlen,$.lencode,0,$.work,P),$.lenbits=P.bits,R){A.msg="invalid literal/lengths set",$.mode=L$;break}if($.distbits=6,$.distcode=$.distdyn,P={bits:$.distbits},R=Gx(akA,$.lens,$.nlen,$.ndist,$.distcode,0,$.work,P),$.distbits=P.bits,R){A.msg="invalid distances set",$.mode=L$;break}if($.mode=He,Q===Ce)break A;case He:$.mode=Ne;case Ne:if(U>=6&&Y>=258){if(A.next_out=J,A.avail_out=Y,A.next_in=D,A.avail_in=U,$.hold=Z,$.bits=F,rf1(A,I),J=A.next_out,E=A.output,Y=A.avail_out,D=A.next_in,B=A.input,U=A.avail_in,Z=$.hold,F=$.bits,$.mode===HF)$.back=-1;break}$.back=0;for(;;){if(K=$.lencode[Z&(1<<$.lenbits)-1],W=K>>>24,C=K>>>16&255,H=K&65535,W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if(C&&(C&240)===0){N=W,q=C,w=H;for(;;){if(K=$.lencode[w+((Z&(1<<N+q)-1)>>N)],W=K>>>24,C=K>>>16&255,H=K&65535,N+W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=N,F-=N,$.back+=N}if(Z>>>=W,F-=W,$.back+=W,$.length=H,C===0){$.mode=CkA;break}if(C&32){$.back=-1,$.mode=HF;break}if(C&64){A.msg="invalid literal/length code",$.mode=L$;break}$.extra=C&15,$.mode=VkA;case VkA:if($.extra){f=$.extra;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}$.length+=Z&(1<<$.extra)-1,Z>>>=$.extra,F-=$.extra,$.back+=$.extra}$.was=$.length,$.mode=zkA;case zkA:for(;;){if(K=$.distcode[Z&(1<<$.distbits)-1],W=K>>>24,C=K>>>16&255,H=K&65535,W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if((C&240)===0){N=W,q=C,w=H;for(;;){if(K=$.distcode[w+((Z&(1<<N+q)-1)>>N)],W=K>>>24,C=K>>>16&255,H=K&65535,N+W<=F)break;if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}Z>>>=N,F-=N,$.back+=N}if(Z>>>=W,F-=W,$.back+=W,C&64){A.msg="invalid distance code",$.mode=L$;break}$.offset=H,$.extra=C&15,$.mode=KkA;case KkA:if($.extra){f=$.extra;while(F<f){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}$.offset+=Z&(1<<$.extra)-1,Z>>>=$.extra,F-=$.extra,$.back+=$.extra}if($.offset>$.dmax){A.msg="invalid distance too far back",$.mode=L$;break}$.mode=WkA;case WkA:if(Y===0)break A;if(G=I-Y,$.offset>G){if(G=$.offset-G,G>$.whave){if($.sane){A.msg="invalid distance too far back",$.mode=L$;break}}if(G>$.wnext)G-=$.wnext,V=$.wsize-G;else V=$.wnext-G;if(G>$.length)G=$.length;z=$.window}else z=E,V=J-$.offset,G=$.length;if(G>Y)G=Y;Y-=G,$.length-=G;do E[J++]=z[V++];while(--G);if($.length===0)$.mode=Ne;break;case CkA:if(Y===0)break A;E[J++]=$.length,Y--,$.mode=Ne;break;case IH0:if($.wrap){while(F<32){if(U===0)break A;U--,Z|=B[D++]<<F,F+=8}if(I-=Y,A.total_out+=I,$.total+=I,$.wrap&4&&I)A.adler=$.check=$.flags?P3($.check,E,I,J-I):Cx($.check,E,I,J-I);if(I=Y,$.wrap&4&&($.flags?Z:qkA(Z))!==$.check){A.msg="incorrect data check",$.mode=L$;break}Z=0,F=0}$.mode=HkA;case HkA:if($.wrap&&$.flags){while(F<32){if(U===0)break A;U--,Z+=B[D++]<<F,F+=8}if($.wrap&4&&Z!==($.total&4294967295)){A.msg="incorrect length check",$.mode=L$;break}Z=0,F=0}$.mode=NkA;case NkA:R=Ey1;break A;case L$:R=okA;break A;case skA:return rkA;case tkA:default:return VD}if(A.next_out=J,A.avail_out=Y,A.next_in=D,A.avail_in=U,$.hold=Z,$.bits=F,$.wsize||I!==A.avail_out&&$.mode<L$&&($.mode<IH0||Q!==tSA)){if(BfA(A,A.output,A.next_out,I-A.avail_out));}if(X-=A.avail_in,I-=A.avail_out,A.total_in+=X,A.total_out+=I,$.total+=I,$.wrap&4&&I)A.adler=$.check=$.flags?P3($.check,E,I,A.next_out-I):Cx($.check,E,I,A.next_out-I);if(A.data_type=$.bits+($.last?64:0)+($.mode===HF?128:0)+($.mode===He||$.mode===XH0?256:0),(X===0&&I===0||Q===tSA)&&R===vC)R=Jy1;return R},zy1=(A)=>{if(_C(A))return VD;let Q=A.state;if(Q.window)Q.window=null;return A.state=null,vC},Ky1=(A,Q)=>{if(_C(A))return VD;let $=A.state;if(($.wrap&2)===0)return VD;return $.head=Q,Q.done=!1,vC},Wy1=(A,Q)=>{let $=Q.length,B,E,D;if(_C(A))return VD;if(B=A.state,B.wrap!==0&&B.mode!==Me)return VD;if(B.mode===Me){if(E=1,E=Cx(E,Q,$,0),E!==B.check)return okA}if(D=BfA(A,Q,$,$),D)return B.mode=skA,rkA;return B.havedict=1,vC},Cy1,Hy1,Ny1,qy1,uy1,wy1,My1,Oy1,Ly1,jy1="pako inflate (from Nodeca project)",qF,Py1,EfA,vy1,Ty1,qx,zH0,KH0,_y1,wkA,Sy1,fy1,yy1,xy1,by1,hy1,gy1,my1,dy1,cy1,py1,ly1,iy1,ny1,ay1,oy1,ry1,sy1,ty1,ey1,Ax1,Qx1,$x1,Bx1,DfA;var JfA=C0(()=>{/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */Vx=ux+1+LH0,OkA=2*Vx+1,WH0=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]),qe=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]),Vk1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),PkA=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),NF=Array((Vx+2)*2);jO(NF);Xx=Array(MO*2);jO(Xx);zx=Array(zk1);jO(zx);Kx=Array(Ik1-Xk1+1);jO(Kx);PH0=Array(LH0);jO(PH0);ue=Array(MO);jO(ue);Lk1=uk1,jk1=bkA,Rk1=Mk1,Pk1=Ok1,vk1=wk1,Tk1={_tr_init:Lk1,_tr_stored_block:jk1,_tr_flush_block:Rk1,_tr_tally:Pk1,_tr_align:vk1},Cx=_k1,kk1=new Uint32Array(Sk1()),P3=fk1,RC={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"},TC={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:yk1,_tr_stored_block:HH0,_tr_flush_block:xk1,_tr_tally:vG,_tr_align:bk1}=Tk1,{Z_NO_FLUSH:TG,Z_PARTIAL_FLUSH:hk1,Z_FULL_FLUSH:gk1,Z_FINISH:GD,Z_BLOCK:lSA,Z_OK:E5,Z_STREAM_END:iSA,Z_STREAM_ERROR:rU,Z_DATA_ERROR:mk1,Z_BUF_ERROR:UH0,Z_DEFAULT_COMPRESSION:dk1,Z_FILTERED:ck1,Z_HUFFMAN_ONLY:Ke,Z_RLE:pk1,Z_FIXED:lk1,Z_DEFAULT_STRATEGY:ik1,Z_UNKNOWN:nk1,Z_DEFLATED:Oe}=TC,NH0=tk1+1+sk1,Qf1=2*NH0+1,sU=PG+uQ+1,_G=Jf1;Fx=[new aU(0,0,0,0,gkA),new aU(4,4,8,4,YH0),new aU(4,5,16,8,YH0),new aU(4,6,32,32,YH0),new aU(4,4,16,16,uO),new aU(8,16,32,32,uO),new aU(8,16,128,128,uO),new aU(8,32,128,256,uO),new aU(32,128,258,1024,uO),new aU(32,258,258,4096,uO)];Kf1=If1,Wf1=ckA,Cf1=dkA,Hf1=mkA,Nf1=Xf1,qf1=Gf1,uf1=Vf1,wf1=zf1,Ix={deflateInit:Kf1,deflateInit2:Wf1,deflateReset:Cf1,deflateResetKeep:Hf1,deflateSetHeader:Nf1,deflate:qf1,deflateEnd:uf1,deflateSetDictionary:wf1,deflateInfo:Mf1},Le={assign:Lf1,flattenChunks:jf1};try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(A){pkA=!1}Hx=new Uint8Array(256);for(let A=0;A<256;A++)Hx[A]=A>=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;Hx[254]=Hx[254]=1;Nx={string2buf:Rf1,buf2string:vf1,utf8border:Tf1};lkA=_f1,ikA=Object.prototype.toString,{Z_NO_FLUSH:Sf1,Z_SYNC_FLUSH:kf1,Z_FULL_FLUSH:ff1,Z_FINISH:yf1,Z_OK:we,Z_STREAM_END:xf1,Z_DEFAULT_COMPRESSION:bf1,Z_DEFAULT_STRATEGY:hf1,Z_DEFLATED:gf1}=TC;Mx.prototype.push=function(A,Q){let $=this.strm,B=this.options.chunkSize,E,D;if(this.ended)return!1;if(Q===~~Q)D=Q;else D=Q===!0?yf1:Sf1;if(typeof A==="string")$.input=Nx.string2buf(A);else if(ikA.call(A)==="[object ArrayBuffer]")$.input=new Uint8Array(A);else $.input=A;$.next_in=0,$.avail_in=$.input.length;for(;;){if($.avail_out===0)$.output=new Uint8Array(B),$.next_out=0,$.avail_out=B;if((D===kf1||D===ff1)&&$.avail_out<=6){this.onData($.output.subarray(0,$.next_out)),$.avail_out=0;continue}if(E=Ix.deflate($,D),E===xf1){if($.next_out>0)this.onData($.output.subarray(0,$.next_out));return E=Ix.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===we}if($.avail_out===0){this.onData($.output);continue}if(D>0&&$.next_out>0){this.onData($.output.subarray(0,$.next_out)),$.avail_out=0;continue}if($.avail_in===0)break}return!0};Mx.prototype.onData=function(A){this.chunks.push(A)};Mx.prototype.onEnd=function(A){if(A===we)this.result=Le.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};cf1=Mx,pf1=TH0,lf1=mf1,if1=df1,nf1=TC,af1={Deflate:cf1,deflate:pf1,deflateRaw:lf1,gzip:if1,constants:nf1},sf1=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]),tf1=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]),ef1=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]),Ay1=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]),Gx=Qy1,{Z_FINISH:tSA,Z_BLOCK:By1,Z_TREES:Ce,Z_OK:vC,Z_STREAM_END:Ey1,Z_NEED_DICT:Dy1,Z_STREAM_ERROR:VD,Z_DATA_ERROR:okA,Z_MEM_ERROR:rkA,Z_BUF_ERROR:Jy1,Z_DEFLATED:eSA}=TC,Fy1=Zy1;Cy1=AfA,Hy1=QfA,Ny1=ekA,qy1=Iy1,uy1=$fA,wy1=Vy1,My1=zy1,Oy1=Ky1,Ly1=Wy1,qF={inflateReset:Cy1,inflateReset2:Hy1,inflateResetKeep:Ny1,inflateInit:qy1,inflateInit2:uy1,inflate:wy1,inflateEnd:My1,inflateGetHeader:Oy1,inflateSetDictionary:Ly1,inflateInfo:jy1};Py1=Ry1,EfA=Object.prototype.toString,{Z_NO_FLUSH:vy1,Z_FINISH:Ty1,Z_OK:qx,Z_STREAM_END:zH0,Z_NEED_DICT:KH0,Z_STREAM_ERROR:_y1,Z_DATA_ERROR:wkA,Z_MEM_ERROR:Sy1}=TC;Ox.prototype.push=function(A,Q){let $=this.strm,B=this.options.chunkSize,E=this.options.dictionary,D,J,U;if(this.ended)return!1;if(Q===~~Q)J=Q;else J=Q===!0?Ty1:vy1;if(EfA.call(A)==="[object ArrayBuffer]")$.input=new Uint8Array(A);else $.input=A;$.next_in=0,$.avail_in=$.input.length;for(;;){if($.avail_out===0)$.output=new Uint8Array(B),$.next_out=0,$.avail_out=B;if(D=qF.inflate($,J),D===KH0&&E){if(D=qF.inflateSetDictionary($,E),D===qx)D=qF.inflate($,J);else if(D===wkA)D=KH0}while($.avail_in>0&&D===zH0&&$.state.wrap>0&&A[$.next_in]!==0)qF.inflateReset($),D=qF.inflate($,J);switch(D){case _y1:case wkA:case KH0:case Sy1:return this.onEnd(D),this.ended=!0,!1}if(U=$.avail_out,$.next_out){if($.avail_out===0||D===zH0)if(this.options.to==="string"){let Y=Nx.utf8border($.output,$.next_out),Z=$.next_out-Y,F=Nx.buf2string($.output,Y);if($.next_out=Z,$.avail_out=B-Z,Z)$.output.set($.output.subarray(Y,Y+Z),0);this.onData(F)}else this.onData($.output.length===$.next_out?$.output:$.output.subarray(0,$.next_out))}if(D===qx&&U===0)continue;if(D===zH0)return D=qF.inflateEnd(this.strm),this.onEnd(D),this.ended=!0,!0;if($.avail_in===0)break}return!0};Ox.prototype.onData=function(A){this.chunks.push(A)};Ox.prototype.onEnd=function(A){if(A===qx)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=Le.flattenChunks(this.chunks);this.chunks=[],this.err=A,this.msg=this.strm.msg};fy1=Ox,yy1=_H0,xy1=ky1,by1=_H0,hy1=TC,gy1={Inflate:fy1,inflate:yy1,inflateRaw:xy1,ungzip:by1,constants:hy1},{Deflate:my1,deflate:dy1,deflateRaw:cy1,gzip:py1}=af1,{Inflate:ly1,inflate:iy1,inflateRaw:ny1,ungzip:ay1}=gy1,oy1=my1,ry1=dy1,sy1=cy1,ty1=py1,ey1=ly1,Ax1=iy1,Qx1=ny1,$x1=ay1,Bx1=TC,DfA={Deflate:oy1,deflate:ry1,deflateRaw:sy1,gzip:ty1,Inflate:ey1,inflate:Ax1,inflateRaw:Qx1,ungzip:$x1,constants:Bx1}});var UfA="This cost reflects only Amp credits consumed. It does not include any model provider usage billed directly to customer-managed model provider keys.";var Ex1,Cm6,Hm6,tU=64,SC,SH0=1024,kH0=500,Nm6;var Lx=C0(()=>{M7();Ex1=["private","public_unlisted","public_discoverable","thread_workspace_shared"],Cm6=j.enum(Ex1),Hm6=j.union([j.object({visibility:j.literal("private"),sharedGroupIDs:j.array(j.string())}),j.object({visibility:j.literal("private"),shareWithAllCreatorGroups:j.literal(!0)}),j.object({visibility:j.enum(["thread_workspace_shared","public_unlisted","public_discoverable"])})]),SC=/^[a-z0-9](?:[a-z0-9]*(?:-[a-z0-9]+)*)?$/,Nm6=j.string().regex(SC,"Must be lowercase a-z, 0-9, hyphens only, no start/end hyphen, no consecutive hyphens").min(1).max(tU)});var YfA=()=>{};var fH0=C0(()=>{SB()});function yH0(A){return pf(vO,A)}function Jx1(A){return MM(ZfA,A)}function Ux1(A){return WC(FfA,A)}function Yx1(A){return OM(jx,A)}function Zx1(A){return LM(jx,A)}function Fx1(A){return jM(jx,A)}function Xx1(A){return RM(jx,A)}function Ix1(A){return UG(xH0,A)}function Gx1(A){return UG(xH0,{protocol:/^https?$/,hostname:A3.domain,...zA(A)})}function Vx1(A){return PM(XfA,A)}function zx1(A){return vM(IfA,A)}function Kx1(A){return TM(GfA,A)}function Wx1(A){return _M(VfA,A)}function Cx1(A){return SM(zfA,A)}function Hx1(A){return kM(KfA,A)}function Nx1(A){return fM(WfA,A)}function qx1(A){return yM(CfA,A)}function ux1(A){return xM(HfA,A)}function wx1(A){return bM(NfA,A)}function Mx1(A){return hM(qfA,A)}function Ox1(A){return nf(ufA,A)}function Lx1(A){return gM(wfA,A)}function jx1(A){return mM(MfA,A)}function Rx1(A){return dM(OfA,A)}function Px1(A){return cM(LfA,A)}function vx1(A,Q,$={}){return dJ(Rx,A,Q,$)}function Tx1(A){return dJ(Rx,"hostname",A3.hostname,A)}function _x1(A){return dJ(Rx,"hex",A3.hex,A)}function Sx1(A,Q){let $=Q?.enc??"hex",B=`${A}_${$}`,E=A3[B];if(!E)throw Error(`Unrecognized hash format: ${B}`);return dJ(Rx,B,E,Q)}function jfA(A){return ef(Px,A)}function kx1(A){return Qy(TO,A)}function fx1(A){return $y(TO,A)}function yx1(A){return By(TO,A)}function xx1(A){return Ey(TO,A)}function bx1(A){return Dy(TO,A)}function RfA(A){return Jy(vx,A)}function hx1(A){return Yy(Tx,A)}function gx1(A){return Fy(bH0,A)}function mx1(A){return Xy(bH0,A)}function dx1(A){return Iy(PfA,A)}function cx1(A){return Gy(vfA,A)}function _fA(A){return Vy(TfA,A)}function px1(){return zy(SfA)}function Re(){return Ky(kfA)}function yfA(A){return Wy(ffA,A)}function lx1(A){return Cy(xfA,A)}function ix1(A){return Hy(Pe,A)}function hH0(A,Q){return new bfA({type:"array",element:A,...zA(Q)})}function nx1(A){let Q=A._zod.def.shape;return ofA(Object.keys(Q))}function hfA(A,Q){let $={type:"object",shape:A??{},...zA(Q)};return new ve($)}function ax1(A,Q){return new ve({type:"object",shape:A,catchall:yfA(),...zA(Q)})}function ox1(A,Q){return new ve({type:"object",shape:A,catchall:Re(),...zA(Q)})}function rx1(A,Q){return ys(A,Q)}function sx1(A,Q){return LV0(A,Q)}function tx1(A,Q){return ys(A,Q)}function ex1(A,Q){return MV0(A,Q)}function Ab1(A,Q){return OV0(A,Q)}function Qb1(A,Q){return jV0(dH0,A,Q)}function $b1(A,Q){return RV0(cH0,A,Q)}function Bb1(A,Q){return A.clone({...A._zod.def,catchall:Q})}function gfA(A,Q){return new gH0({type:"union",options:A,...zA(Q)})}function Eb1(A,Q){return new mfA({type:"union",options:A,inclusive:!1,...zA(Q)})}function Db1(A,Q,$){return new dfA({type:"union",options:Q,discriminator:A,...zA($)})}function Jb1(A,Q){return new cfA({type:"intersection",left:A,right:Q})}function lfA(A,Q,$){let B=Q instanceof z1;return new pfA({type:"tuple",items:A,rest:B?Q:null,...zA(B?$:Q)})}function ifA(A,Q,$){return new Te({type:"record",keyType:A,valueType:Q,...zA($)})}function Ub1(A,Q,$){let B=_B(A);return B._zod.values=void 0,new Te({type:"record",keyType:B,valueType:Q,...zA($)})}function Yb1(A,Q,$){return new Te({type:"record",keyType:A,valueType:Q,mode:"loose",...zA($)})}function Zb1(A,Q,$){return new nfA({type:"map",keyType:A,valueType:Q,...zA($)})}function Fb1(A,Q){return new afA({type:"set",valueType:A,...zA(Q)})}function ofA(A,Q){let $=Array.isArray(A)?Object.fromEntries(A.map((B)=>[B,B])):A;return new mH0({type:"enum",entries:$,...zA(Q)})}function Xb1(A,Q){return new mH0({type:"enum",entries:A,...zA(Q)})}function Ib1(A,Q){return new rfA({type:"literal",values:Array.isArray(A)?A:[A],...zA(Q)})}function Gb1(A){return uy(sfA,A)}function Vb1(A){return new tfA({type:"transform",transform:A})}function efA(A){return new dH0({type:"optional",innerType:A})}function zb1(A){return new AyA({type:"optional",innerType:A})}function $yA(A){return new QyA({type:"nullable",innerType:A})}function Kb1(A){return efA($yA(A))}function Wb1(A,Q){return new ByA({type:"default",innerType:A,get defaultValue(){return typeof Q==="function"?Q():XM(Q)}})}function Cb1(A,Q){return new EyA({type:"prefault",innerType:A,get defaultValue(){return typeof Q==="function"?Q():XM(Q)}})}function Hb1(A,Q){return new cH0({type:"nonoptional",innerType:A,...zA(Q)})}function Nb1(A){return new DyA({type:"success",innerType:A})}function qb1(A,Q){return new JyA({type:"catch",innerType:A,catchValue:typeof Q==="function"?Q:()=>Q})}function ub1(A){return qy(UyA,A)}function wb1(A,Q){return new pH0({type:"pipe",in:A,out:Q})}function Mb1(A,Q,$){return new lH0({type:"pipe",in:A,out:Q,transform:$.decode,reverseTransform:$.encode})}function Ob1(A){return new YyA({type:"readonly",innerType:A})}function Lb1(A,Q){return new ZyA({type:"template_literal",parts:A,...zA(Q)})}function XyA(A){return new FyA({type:"lazy",getter:A})}function jb1(A){return new IyA({type:"promise",innerType:A})}function Rb1(A,Q){let $=new C6({check:"custom",...zA(Q)});return $._zod.check=A,$}function GyA(A,Q){return wy(iH0,A??(()=>!0),Q)}function Pb1(A,Q={}){return My(iH0,A,Q)}function vb1(A){return Oy(A)}function Sb1(A,Q={}){let $=GyA((B)=>B instanceof A,Q);return $._zod.bag.Class=A,$._zod.check=(B)=>{if(!(B.value instanceof A))B.issues.push({code:"invalid_type",expected:A.name,input:B.value,inst:$,path:[...$._zod.def.path??[]]})},$}function fb1(){let A=XyA(()=>{return gfA([yH0(),jfA(),RfA(),_fA(),hH0(A),ifA(yH0(),A)])});return A}function yb1(A){return new VyA({type:"function",input:Array.isArray(A?.input)?lfA(A?.input):A?.input??hH0(Re()),output:A?.output??Re()})}var h1,vO,l6,ZfA,FfA,jx,xH0,XfA,IfA,GfA,VfA,zfA,KfA,WfA,CfA,HfA,NfA,qfA,ufA,wfA,MfA,OfA,LfA,Rx,Px,TO,vx,Tx,bH0,PfA,vfA,TfA,SfA,kfA,ffA,xfA,Pe,bfA,ve,gH0,mfA,dfA,cfA,pfA,Te,nfA,afA,mH0,rfA,sfA,tfA,dH0,AyA,QyA,ByA,EyA,cH0,DyA,JyA,UyA,pH0,lH0,YyA,ZyA,FyA,IyA,iH0,Tb1,_b1,kb1=(...A)=>Ry({Codec:lH0,Boolean:vx,String:vO},...A),VyA;var _e=C0(()=>{SB();_4();fH0();h1=M0("ZodMiniType",(A,Q)=>{if(!A._zod)throw Error("Uninitialized schema in ZodMiniType.");z1.init(A,Q),A.def=Q,A.type=Q.type,A.parse=($,B)=>EG(A,$,B,{callee:A.parse}),A.safeParse=($,B)=>XF(A,$,B),A.parseAsync=async($,B)=>DG(A,$,B,{callee:A.parseAsync}),A.safeParseAsync=async($,B)=>JG(A,$,B),A.check=(...$)=>{return A.clone({...Q,checks:[...Q.checks??[],...$.map((B)=>typeof B==="function"?{_zod:{check:B,def:{check:"custom"},onattach:[]}}:B)]},{parent:!0})},A.with=A.check,A.clone=($,B)=>_B(A,$,B),A.brand=()=>A,A.register=($,B)=>{return $.add(A,B),A},A.apply=($)=>$(A)}),vO=M0("ZodMiniString",(A,Q)=>{IF.init(A,Q),h1.init(A,Q)});l6=M0("ZodMiniStringFormat",(A,Q)=>{U6.init(A,Q),vO.init(A,Q)}),ZfA=M0("ZodMiniEmail",(A,Q)=>{_k.init(A,Q),l6.init(A,Q)});FfA=M0("ZodMiniGUID",(A,Q)=>{vk.init(A,Q),l6.init(A,Q)});jx=M0("ZodMiniUUID",(A,Q)=>{Tk.init(A,Q),l6.init(A,Q)});xH0=M0("ZodMiniURL",(A,Q)=>{Sk.init(A,Q),l6.init(A,Q)});XfA=M0("ZodMiniEmoji",(A,Q)=>{kk.init(A,Q),l6.init(A,Q)});IfA=M0("ZodMiniNanoID",(A,Q)=>{fk.init(A,Q),l6.init(A,Q)});GfA=M0("ZodMiniCUID",(A,Q)=>{yk.init(A,Q),l6.init(A,Q)});VfA=M0("ZodMiniCUID2",(A,Q)=>{xk.init(A,Q),l6.init(A,Q)});zfA=M0("ZodMiniULID",(A,Q)=>{bk.init(A,Q),l6.init(A,Q)});KfA=M0("ZodMiniXID",(A,Q)=>{hk.init(A,Q),l6.init(A,Q)});WfA=M0("ZodMiniKSUID",(A,Q)=>{gk.init(A,Q),l6.init(A,Q)});CfA=M0("ZodMiniIPv4",(A,Q)=>{lk.init(A,Q),l6.init(A,Q)});HfA=M0("ZodMiniIPv6",(A,Q)=>{ik.init(A,Q),l6.init(A,Q)});NfA=M0("ZodMiniCIDRv4",(A,Q)=>{ak.init(A,Q),l6.init(A,Q)});qfA=M0("ZodMiniCIDRv6",(A,Q)=>{ok.init(A,Q),l6.init(A,Q)});ufA=M0("ZodMiniMAC",(A,Q)=>{nk.init(A,Q),l6.init(A,Q)});wfA=M0("ZodMiniBase64",(A,Q)=>{rk.init(A,Q),l6.init(A,Q)});MfA=M0("ZodMiniBase64URL",(A,Q)=>{sk.init(A,Q),l6.init(A,Q)});OfA=M0("ZodMiniE164",(A,Q)=>{tk.init(A,Q),l6.init(A,Q)});LfA=M0("ZodMiniJWT",(A,Q)=>{ek.init(A,Q),l6.init(A,Q)});Rx=M0("ZodMiniCustomStringFormat",(A,Q)=>{Af.init(A,Q),l6.init(A,Q)});Px=M0("ZodMiniNumber",(A,Q)=>{CM.init(A,Q),h1.init(A,Q)});TO=M0("ZodMiniNumberFormat",(A,Q)=>{Qf.init(A,Q),Px.init(A,Q)});vx=M0("ZodMiniBoolean",(A,Q)=>{GC.init(A,Q),h1.init(A,Q)});Tx=M0("ZodMiniBigInt",(A,Q)=>{HM.init(A,Q),h1.init(A,Q)});bH0=M0("ZodMiniBigIntFormat",(A,Q)=>{$f.init(A,Q),Tx.init(A,Q)});PfA=M0("ZodMiniSymbol",(A,Q)=>{Bf.init(A,Q),h1.init(A,Q)});vfA=M0("ZodMiniUndefined",(A,Q)=>{Ef.init(A,Q),h1.init(A,Q)});TfA=M0("ZodMiniNull",(A,Q)=>{Df.init(A,Q),h1.init(A,Q)});SfA=M0("ZodMiniAny",(A,Q)=>{Jf.init(A,Q),h1.init(A,Q)});kfA=M0("ZodMiniUnknown",(A,Q)=>{Uf.init(A,Q),h1.init(A,Q)});ffA=M0("ZodMiniNever",(A,Q)=>{Yf.init(A,Q),h1.init(A,Q)});xfA=M0("ZodMiniVoid",(A,Q)=>{Zf.init(A,Q),h1.init(A,Q)});Pe=M0("ZodMiniDate",(A,Q)=>{Ff.init(A,Q),h1.init(A,Q)});bfA=M0("ZodMiniArray",(A,Q)=>{Xf.init(A,Q),h1.init(A,Q)});ve=M0("ZodMiniObject",(A,Q)=>{$t.init(A,Q),h1.init(A,Q),x1(A,"shape",()=>Q.shape)});gH0=M0("ZodMiniUnion",(A,Q)=>{VC.init(A,Q),h1.init(A,Q)});mfA=M0("ZodMiniXor",(A,Q)=>{gH0.init(A,Q),If.init(A,Q)});dfA=M0("ZodMiniDiscriminatedUnion",(A,Q)=>{Gf.init(A,Q),h1.init(A,Q)});cfA=M0("ZodMiniIntersection",(A,Q)=>{Vf.init(A,Q),h1.init(A,Q)});pfA=M0("ZodMiniTuple",(A,Q)=>{NM.init(A,Q),h1.init(A,Q)});Te=M0("ZodMiniRecord",(A,Q)=>{zf.init(A,Q),h1.init(A,Q)});nfA=M0("ZodMiniMap",(A,Q)=>{Kf.init(A,Q),h1.init(A,Q)});afA=M0("ZodMiniSet",(A,Q)=>{Wf.init(A,Q),h1.init(A,Q)});mH0=M0("ZodMiniEnum",(A,Q)=>{Cf.init(A,Q),h1.init(A,Q),A.options=Object.values(Q.entries)});rfA=M0("ZodMiniLiteral",(A,Q)=>{Hf.init(A,Q),h1.init(A,Q)});sfA=M0("ZodMiniFile",(A,Q)=>{Nf.init(A,Q),h1.init(A,Q)});tfA=M0("ZodMiniTransform",(A,Q)=>{qf.init(A,Q),h1.init(A,Q)});dH0=M0("ZodMiniOptional",(A,Q)=>{qM.init(A,Q),h1.init(A,Q)});AyA=M0("ZodMiniExactOptional",(A,Q)=>{uf.init(A,Q),h1.init(A,Q)});QyA=M0("ZodMiniNullable",(A,Q)=>{wf.init(A,Q),h1.init(A,Q)});ByA=M0("ZodMiniDefault",(A,Q)=>{Mf.init(A,Q),h1.init(A,Q)});EyA=M0("ZodMiniPrefault",(A,Q)=>{Of.init(A,Q),h1.init(A,Q)});cH0=M0("ZodMiniNonOptional",(A,Q)=>{Lf.init(A,Q),h1.init(A,Q)});DyA=M0("ZodMiniSuccess",(A,Q)=>{jf.init(A,Q),h1.init(A,Q)});JyA=M0("ZodMiniCatch",(A,Q)=>{Rf.init(A,Q),h1.init(A,Q)});UyA=M0("ZodMiniNaN",(A,Q)=>{Pf.init(A,Q),h1.init(A,Q)});pH0=M0("ZodMiniPipe",(A,Q)=>{vf.init(A,Q),h1.init(A,Q)});lH0=M0("ZodMiniCodec",(A,Q)=>{pH0.init(A,Q),zC.init(A,Q)});YyA=M0("ZodMiniReadonly",(A,Q)=>{Tf.init(A,Q),h1.init(A,Q)});ZyA=M0("ZodMiniTemplateLiteral",(A,Q)=>{_f.init(A,Q),h1.init(A,Q)});FyA=M0("ZodMiniLazy",(A,Q)=>{ff.init(A,Q),h1.init(A,Q)});IyA=M0("ZodMiniPromise",(A,Q)=>{kf.init(A,Q),h1.init(A,Q)});iH0=M0("ZodMiniCustom",(A,Q)=>{yf.init(A,Q),h1.init(A,Q)});Tb1=Ly,_b1=jy;VyA=M0("ZodMiniFunction",(A,Q)=>{Sf.init(A,Q),h1.init(A,Q)})});var KyA=C0(()=>{SB()});var nH0={};YB(nH0,{time:()=>hb1,duration:()=>gb1,datetime:()=>xb1,date:()=>bb1,ZodMiniISOTime:()=>fe,ZodMiniISODuration:()=>ye,ZodMiniISODateTime:()=>Se,ZodMiniISODate:()=>ke});function xb1(A){return of(Se,A)}function bb1(A){return rf(ke,A)}function hb1(A){return sf(fe,A)}function gb1(A){return tf(ye,A)}var Se,ke,fe,ye;var aH0=C0(()=>{SB();_e();Se=M0("ZodMiniISODateTime",(A,Q)=>{mk.init(A,Q),l6.init(A,Q)});ke=M0("ZodMiniISODate",(A,Q)=>{dk.init(A,Q),l6.init(A,Q)});fe=M0("ZodMiniISOTime",(A,Q)=>{ck.init(A,Q),l6.init(A,Q)});ye=M0("ZodMiniISODuration",(A,Q)=>{pk.init(A,Q),l6.init(A,Q)})});var oH0={};YB(oH0,{string:()=>mb1,number:()=>db1,date:()=>lb1,boolean:()=>cb1,bigint:()=>pb1});function mb1(A){return lf(vO,A)}function db1(A){return Ay(Px,A)}function cb1(A){return Uy(vx,A)}function pb1(A){return Zy(Tx,A)}function lb1(A){return Ny(Pe,A)}var WyA=C0(()=>{SB();_e()});var T8={};YB(T8,{xor:()=>Eb1,xid:()=>Hx1,void:()=>lx1,uuidv7:()=>Xx1,uuidv6:()=>Fx1,uuidv4:()=>Zx1,uuid:()=>Yx1,util:()=>RA,url:()=>Ix1,uppercase:()=>FG,unknown:()=>Re,union:()=>gfA,undefined:()=>cx1,ulid:()=>Cx1,uint64:()=>mx1,uint32:()=>bx1,tuple:()=>lfA,trim:()=>KG,treeifyError:()=>Ok,transform:()=>Vb1,toUpperCase:()=>CG,toLowerCase:()=>WG,toJSONSchema:()=>sM,templateLiteral:()=>Lb1,symbol:()=>dx1,superRefine:()=>vb1,success:()=>Nb1,stringbool:()=>kb1,stringFormat:()=>vx1,string:()=>yH0,strictObject:()=>ax1,startsWith:()=>IG,size:()=>GF,set:()=>Fb1,safeParseAsync:()=>JG,safeParse:()=>XF,safeExtend:()=>sx1,safeEncodeAsync:()=>yV0,safeEncode:()=>kV0,safeDecodeAsync:()=>xV0,safeDecode:()=>fV0,required:()=>$b1,registry:()=>wM,regexes:()=>A3,regex:()=>YG,refine:()=>Pb1,record:()=>ifA,readonly:()=>Ob1,property:()=>aM,promise:()=>jb1,prettifyError:()=>Lk,prefault:()=>Cb1,positive:()=>pM,pipe:()=>wb1,pick:()=>ex1,partialRecord:()=>Ub1,partial:()=>Qb1,parseAsync:()=>DG,parse:()=>EG,overwrite:()=>m9,optional:()=>efA,omit:()=>Ab1,object:()=>hfA,number:()=>jfA,nullish:()=>Kb1,nullable:()=>$yA,null:()=>_fA,normalize:()=>zG,nonpositive:()=>iM,nonoptional:()=>Hb1,nonnegative:()=>nM,never:()=>yfA,negative:()=>lM,nativeEnum:()=>Xb1,nanoid:()=>zx1,nan:()=>ub1,multipleOf:()=>mU,minimum:()=>j3,minSize:()=>FD,minLength:()=>mJ,mime:()=>VG,meta:()=>_b1,merge:()=>tx1,maximum:()=>m5,maxSize:()=>dU,maxLength:()=>VF,map:()=>Zb1,mac:()=>Ox1,lte:()=>m5,lt:()=>YD,lowercase:()=>ZG,looseRecord:()=>Yb1,looseObject:()=>ox1,locales:()=>KC,literal:()=>Ib1,length:()=>zF,lazy:()=>XyA,ksuid:()=>Nx1,keyof:()=>nx1,jwt:()=>Px1,json:()=>fb1,iso:()=>nH0,ipv6:()=>ux1,ipv4:()=>qx1,intersection:()=>Jb1,int64:()=>gx1,int32:()=>xx1,int:()=>kx1,instanceof:()=>Sb1,includes:()=>XG,httpUrl:()=>Gx1,hostname:()=>Tx1,hex:()=>_x1,hash:()=>Sx1,guid:()=>Ux1,gte:()=>j3,gt:()=>ZD,globalRegistry:()=>Q3,function:()=>yb1,formatError:()=>XC,float64:()=>yx1,float32:()=>fx1,flattenError:()=>FC,file:()=>Gb1,extend:()=>rx1,exactOptional:()=>zb1,enum:()=>ofA,endsWith:()=>GG,encodeAsync:()=>_V0,encode:()=>vV0,emoji:()=>Vx1,email:()=>Jx1,e164:()=>Rx1,discriminatedUnion:()=>Db1,describe:()=>Tb1,decodeAsync:()=>SV0,decode:()=>TV0,date:()=>ix1,custom:()=>GyA,cuid2:()=>Wx1,cuid:()=>Kx1,core:()=>R8,config:()=>h$,coerce:()=>oH0,codec:()=>Mb1,clone:()=>_B,cidrv6:()=>Mx1,cidrv4:()=>wx1,check:()=>Rb1,catchall:()=>Bb1,catch:()=>qb1,boolean:()=>RfA,bigint:()=>hx1,base64url:()=>jx1,base64:()=>Lx1,array:()=>hH0,any:()=>px1,_function:()=>yb1,_default:()=>Wb1,ZodMiniXor:()=>mfA,ZodMiniXID:()=>KfA,ZodMiniVoid:()=>xfA,ZodMiniUnknown:()=>kfA,ZodMiniUnion:()=>gH0,ZodMiniUndefined:()=>vfA,ZodMiniUUID:()=>jx,ZodMiniURL:()=>xH0,ZodMiniULID:()=>zfA,ZodMiniType:()=>h1,ZodMiniTuple:()=>pfA,ZodMiniTransform:()=>tfA,ZodMiniTemplateLiteral:()=>ZyA,ZodMiniSymbol:()=>PfA,ZodMiniSuccess:()=>DyA,ZodMiniStringFormat:()=>l6,ZodMiniString:()=>vO,ZodMiniSet:()=>afA,ZodMiniRecord:()=>Te,ZodMiniReadonly:()=>YyA,ZodMiniPromise:()=>IyA,ZodMiniPrefault:()=>EyA,ZodMiniPipe:()=>pH0,ZodMiniOptional:()=>dH0,ZodMiniObject:()=>ve,ZodMiniNumberFormat:()=>TO,ZodMiniNumber:()=>Px,ZodMiniNullable:()=>QyA,ZodMiniNull:()=>TfA,ZodMiniNonOptional:()=>cH0,ZodMiniNever:()=>ffA,ZodMiniNanoID:()=>IfA,ZodMiniNaN:()=>UyA,ZodMiniMap:()=>nfA,ZodMiniMAC:()=>ufA,ZodMiniLiteral:()=>rfA,ZodMiniLazy:()=>FyA,ZodMiniKSUID:()=>WfA,ZodMiniJWT:()=>LfA,ZodMiniIntersection:()=>cfA,ZodMiniISOTime:()=>fe,ZodMiniISODuration:()=>ye,ZodMiniISODateTime:()=>Se,ZodMiniISODate:()=>ke,ZodMiniIPv6:()=>HfA,ZodMiniIPv4:()=>CfA,ZodMiniGUID:()=>FfA,ZodMiniFunction:()=>VyA,ZodMiniFile:()=>sfA,ZodMiniExactOptional:()=>AyA,ZodMiniEnum:()=>mH0,ZodMiniEmoji:()=>XfA,ZodMiniEmail:()=>ZfA,ZodMiniE164:()=>OfA,ZodMiniDiscriminatedUnion:()=>dfA,ZodMiniDefault:()=>ByA,ZodMiniDate:()=>Pe,ZodMiniCustomStringFormat:()=>Rx,ZodMiniCustom:()=>iH0,ZodMiniCodec:()=>lH0,ZodMiniCatch:()=>JyA,ZodMiniCUID2:()=>VfA,ZodMiniCUID:()=>GfA,ZodMiniCIDRv6:()=>qfA,ZodMiniCIDRv4:()=>NfA,ZodMiniBoolean:()=>vx,ZodMiniBigIntFormat:()=>bH0,ZodMiniBigInt:()=>Tx,ZodMiniBase64URL:()=>MfA,ZodMiniBase64:()=>wfA,ZodMiniArray:()=>bfA,ZodMiniAny:()=>SfA,TimePrecision:()=>af,NEVER:()=>UC,$output:()=>mf,$input:()=>df,$brand:()=>Wk});var rH0=C0(()=>{SB();SB();tM();Bt();aH0();aH0();WyA();fH0();_e();KyA()});var sH0=C0(()=>{rH0();rH0()});var nb1,CyA,fm6,ab1,ym6;var HyA=C0(()=>{M7();sH0();nb1=j.templateLiteral([j.string().regex(/^[0-9a-f]{8}$/),"-",j.string().regex(/^[0-9a-f]{4}$/),"-",j.string().regex(/^[0-9a-f]{4}$/),"-",j.string().regex(/^[0-9a-f]{4}$/),"-",j.string().regex(/^[0-9a-f]{12}$/)]),CyA=j.templateLiteral(["T-",nb1]),fm6=T8.union([T8.object({visibility:T8.literal("private"),sharedGroupIDs:T8.array(T8.string())}),T8.object({visibility:T8.literal("thread_group_shared"),sharedGroupIDs:T8.array(T8.string())}),T8.object({visibility:T8.enum(["thread_workspace_shared","public_unlisted","public_discoverable"])})]),ab1=j.string(),ym6=j.object({id:ab1,title:j.string().optional(),messageCount:j.number(),updatedAt:j.string(),firstSyncAt:j.string(),created:j.number(),creatorUserID:j.string(),meta:j.object({visibility:j.enum(["private","thread_group_shared","public_unlisted","public_discoverable","thread_workspace_shared"]),sharedGroupIDs:j.array(j.string())}),labels:j.array(j.object({id:j.string(),name:j.string(),createdAt:j.string()}))})});var NyA=()=>{};var qyA=()=>{};var tH0=C0(()=>{Lx();YfA();HyA();NyA();qyA()});import{randomFillSync as ob1}from"crypto";function he(){if(xe>be.length-16)ob1(be),xe=0;return be.slice(xe,xe+=16)}var be,xe;var uyA=C0(()=>{be=new Uint8Array(256),xe=be.length});function wyA(A,Q=0){return(D5[A[Q+0]]+D5[A[Q+1]]+D5[A[Q+2]]+D5[A[Q+3]]+"-"+D5[A[Q+4]]+D5[A[Q+5]]+"-"+D5[A[Q+6]]+D5[A[Q+7]]+"-"+D5[A[Q+8]]+D5[A[Q+9]]+"-"+D5[A[Q+10]]+D5[A[Q+11]]+D5[A[Q+12]]+D5[A[Q+13]]+D5[A[Q+14]]+D5[A[Q+15]]).toLowerCase()}var D5;var MyA=C0(()=>{D5=[];for(let A=0;A<256;++A)D5.push((A+256).toString(16).slice(1))});function rb1(A,Q,$){let B;if(A)B=OyA(A.random??A.rng?.()??he(),A.msecs,A.seq,Q,$);else{let E=Date.now(),D=he();sb1(eH0,E,D),B=OyA(D,eH0.msecs,eH0.seq,Q,$)}return Q??wyA(B)}function sb1(A,Q,$){if(A.msecs??=-1/0,A.seq??=0,Q>A.msecs)A.seq=$[6]<<23|$[7]<<16|$[8]<<8|$[9],A.msecs=Q;else if(A.seq=A.seq+1|0,A.seq===0)A.msecs++;return A}function OyA(A,Q,$,B,E=0){if(A.length<16)throw Error("Random bytes length must be >= 16");if(!B)B=new Uint8Array(16),E=0;else if(E<0||E+16>B.length)throw RangeError(`UUID byte range ${E}:${E+15} is out of buffer bounds`);return Q??=Date.now(),$??=A[6]*127<<24|A[7]<<16|A[8]<<8|A[9],B[E++]=Q/1099511627776&255,B[E++]=Q/4294967296&255,B[E++]=Q/16777216&255,B[E++]=Q/65536&255,B[E++]=Q/256&255,B[E++]=Q&255,B[E++]=112|$>>>28&15,B[E++]=$>>>20&255,B[E++]=128|$>>>14&63,B[E++]=$>>>6&255,B[E++]=$<<2&255|A[10]&3,B[E++]=A[11],B[E++]=A[12],B[E++]=A[13],B[E++]=A[14],B[E++]=A[15],B}var eH0,_O;var LyA=C0(()=>{uyA();MyA();eH0={};_O=rb1});var AN0=C0(()=>{LyA()});function tb1(A){let Q=0,$=[];while(Q<A.length){let B=A[Q];if(B==="\\"){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(B==='"'){let U="",Y=!1;B=A[++Q];while(B!=='"'){if(Q===A.length){Y=!0;break}if(B==="\\"){if(Q++,Q===A.length){Y=!0;break}U+=B+A[Q],B=A[++Q]}else U+=B,B=A[++Q]}if(B=A[++Q],!Y)$.push({type:"string",value:U});continue}if(B&&/\s/.test(B)){Q++;continue}let D=/[0-9]/;if(B&&D.test(B)||B==="-"||B==="."){let U="";if(B==="-")U+=B,B=A[++Q];while(B&&D.test(B)||B===".")U+=B,B=A[++Q];$.push({type:"number",value:U});continue}let J=/[a-z]/i;if(B&&J.test(B)){let U="";while(B&&J.test(B)){if(Q===A.length)break;U+=B,B=A[++Q]}if(U==="true"||U==="false"||U==="null")$.push({type:"name",value:U});else{Q++;continue}continue}Q++}return $}function SO(A){if(A.length===0)return A;let Q=A[A.length-1];if(!Q)return A;switch(Q.type){case"separator":return SO(A.slice(0,A.length-1));case"number":{let $=Q.value[Q.value.length-1];if($==="."||$==="-")return SO(A.slice(0,A.length-1));break}case"string":{let $=A[A.length-2];if($?.type==="delimiter")return SO(A.slice(0,A.length-1));else if($?.type==="brace"&&$.value==="{")return SO(A.slice(0,A.length-1));break}case"delimiter":return SO(A.slice(0,A.length-1))}return A}function eb1(A){let Q=[];for(let $ of A){if($.type==="brace")if($.value==="{")Q.push("}");else{let B=Q.lastIndexOf("}");if(B!==-1)Q.splice(B,1)}if($.type==="paren")if($.value==="[")Q.push("]");else{let B=Q.lastIndexOf("]");if(B!==-1)Q.splice(B,1)}}if(Q.length>0){Q.reverse();for(let $ of Q)if($==="}")A.push({type:"brace",value:"}"});else if($==="]")A.push({type:"paren",value:"]"})}return A}function Ah1(A){let Q="";for(let $ of A)switch($.type){case"string":Q+='"'+$.value+'"';break;default:Q+=$.value;break}return Q}function QN0(A){let Q=Ah1(eb1(SO(tb1(A))));return JSON.parse(Q)}function Qh1(A){try{let Q=QN0(A);if(Q!==null&&typeof Q==="object"&&!Array.isArray(Q))return Q;return{}}catch{return{}}}function $h1(A){try{return jyA(QN0(A.replace(/\\+$/,"")+'"'))}catch{return jyA(QN0(A))}}function RyA(A){let Q=Qh1(A),$;try{$=$h1(A)}catch{$=Q}return{input:Q,inputIncomplete:PyA($)?$:Q}}function PyA(A){return typeof A==="object"&&A!==null&&!Array.isArray(A)}function jyA(A){return PyA(A)?A:{}}function vyA(A,Q,$="..."){if(A.length<=Q)return A;return A.slice(0,Math.max(0,Q-$.length))+$}function Bh1(A){let Q=A.match(/^(?:cat\s+)?<<['"]?(\w+)['"]?\s*\n([\s\S]*?)\n\1\s*$/);if(Q)return Q[2];return A}function Eh1(A,Q){let $=A[Q];if(!$)return null;let B=$.match(/^\*\*\* Add File: (.+)$/);if(B)return{filePath:B[1],nextIdx:Q+1};let E=$.match(/^\*\*\* Delete File: (.+)$/);if(E)return{filePath:E[1],nextIdx:Q+1};let D=$.match(/^\*\*\* Update File: (.+)$/);if(D){let J,U=Q+1,Y=A[U];if(Y){let Z=Y.match(/^\*\*\* Move to: (.+)$/);if(Z)J=Z[1],U++}return{filePath:D[1],movePath:J,nextIdx:U}}return null}function $N0(A){return A.startsWith("*** Add File:")||A.startsWith("*** Update File:")||A.startsWith("*** Delete File:")||A.trim()==="*** End Patch"}function Dh1(A,Q){let $=[],B=Q;while(B<A.length){let E=A[B];if($N0(E))break;if(E.startsWith("+"))$.push(E.slice(1));else if(E==="")$.push("");else throw Error(`Invalid patch format: Add File lines must start with '+', got: "${E.slice(0,20)}${E.length>20?"...":""}"`);B++}return{content:$.join(`
217
217
  `),nextIdx:B}}function TyA(A){return A.startsWith("+")||A.startsWith("-")||A.startsWith(" ")}function Jh1(A,Q){let $=[],B=Q;while(B<A.length){let E=A[B];if($N0(E))break;if(E.trim()==="*** End of File"){B++;continue}if(E.startsWith("@@")||TyA(E)){let{chunk:D,nextIdx:J}=Uh1(A,B);$.push(D),B=J;continue}throw Error(`Invalid patch format: unexpected line in Update File: "${E.slice(0,30)}..."`)}return{chunks:$,nextIdx:B}}function Uh1(A,Q){let $=Q,B=[],E=[],D=!1,J=[];while($<A.length&&A[$].startsWith("@@")){let Z=A[$].slice(2).trimStart();if(Z)J.push(Z);$++}while($<A.length){let Y=A[$];if(Y.trim()==="*** End of File"){D=!0,$++;break}if(Y.startsWith("@@")||$N0(Y))break;if(!TyA(Y))throw Error(`Invalid patch format: hunk lines must start with ' ', '-', or '+', got: "${Y.slice(0,20)}..."`);if(Y.startsWith("-"))B.push(Y.slice(1));else if(Y.startsWith("+"))E.push(Y.slice(1));else if(Y.startsWith(" "))B.push(Y.slice(1)),E.push(Y.slice(1));$++}let U=J.length>0?J.filter(Boolean).join(`
218
218
  `):void 0;return{chunk:{oldLines:B,newLines:E,changeContext:U,isEndOfFile:D},nextIdx:$}}function SG(A){let $=Bh1(A.trim()).split(`
219
219
  `),B=[],E=[],D="*** Begin Patch",J="*** End Patch",U=$.findIndex((G)=>G.trim()==="*** Begin Patch"),Y=$.findIndex((G)=>G.trim()==="*** End Patch");if(U===-1&&Y===-1)throw Error(`Invalid patch format: missing *** Begin Patch and *** End Patch markers.
@@ -2695,7 +2695,7 @@ ${I}`)}}if(A.skipParseResponse)return;try{let U=new Uint8Array(await J.arrayBuff
2695
2695
  `:`
2696
2696
  `)+$,E=B+1,B=A.indexOf(`
2697
2697
  `,E)}while(B!==-1);return D+=A.slice(E),D}var{stdout:FF4,stderr:XF4}=UF4,gf0=Symbol("GENERATOR"),NP=Symbol("STYLER"),jc=Symbol("IS_EMPTY"),IF4=["ansi","ansi","ansi256","ansi16m"],qP=Object.create(null),miQ=(A,Q={})=>{if(Q.level&&!(Number.isInteger(Q.level)&&Q.level>=0&&Q.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let $=FF4?FF4.level:0;A.level=Q.level===void 0?$:Q.level};var diQ=(A)=>{let Q=(...$)=>$.join(" ");return miQ(Q,A),Object.setPrototypeOf(Q,Rc.prototype),Q};function Rc(A){return diQ(A)}Object.setPrototypeOf(Rc.prototype,Function.prototype);for(let[A,Q]of Object.entries(R2))qP[A]={get(){let $=F30(this,df0(Q.open,Q.close,this[NP]),this[jc]);return Object.defineProperty(this,A,{value:$}),$}};qP.visible={get(){let A=F30(this,this[NP],!0);return Object.defineProperty(this,"visible",{value:A}),A}};var mf0=(A,Q,$,...B)=>{if(A==="rgb"){if(Q==="ansi16m")return R2[$].ansi16m(...B);if(Q==="ansi256")return R2[$].ansi256(R2.rgbToAnsi256(...B));return R2[$].ansi(R2.rgbToAnsi(...B))}if(A==="hex")return mf0("rgb",Q,$,...R2.hexToRgb(...B));return R2[$][A](...B)},ciQ=["rgb","hex","ansi256"];for(let A of ciQ){qP[A]={get(){let{level:$}=this;return function(...B){let E=df0(mf0(A,IF4[$],"color",...B),R2.color.close,this[NP]);return F30(this,E,this[jc])}}};let Q="bg"+A[0].toUpperCase()+A.slice(1);qP[Q]={get(){let{level:$}=this;return function(...B){let E=df0(mf0(A,IF4[$],"bgColor",...B),R2.bgColor.close,this[NP]);return F30(this,E,this[jc])}}}}var piQ=Object.defineProperties(()=>{},{...qP,level:{enumerable:!0,get(){return this[gf0].level},set(A){this[gf0].level=A}}}),df0=(A,Q,$)=>{let B,E;if($===void 0)B=A,E=Q;else B=$.openAll+A,E=Q+$.closeAll;return{open:A,close:Q,openAll:B,closeAll:E,parent:$}},F30=(A,Q,$)=>{let B=(...E)=>liQ(B,E.length===1?""+E[0]:E.join(" "));return Object.setPrototypeOf(B,piQ),B[gf0]=A,B[NP]=Q,B[jc]=$,B},liQ=(A,Q)=>{if(A.level<=0||!Q)return A[jc]?"":Q;let $=A[NP];if($===void 0)return Q;let{openAll:B,closeAll:E}=$;if(Q.includes("\x1B"))while($!==void 0)Q=YF4(Q,$.close,$.open),$=$.parent;let D=Q.indexOf(`
2698
- `);if(D!==-1)Q=ZF4(Q,E,B,D);return B+Q+E};Object.defineProperties(Rc.prototype,qP);var iiQ=Rc(),KP$=Rc({level:XF4?XF4.level:0});var f0=iiQ;var PF4=M4(RF4(),1),{program:MP$,createCommand:OP$,createArgument:LP$,createOption:jP$,CommanderError:vF4,InvalidArgumentError:I30,InvalidOptionArgumentError:RP$,Command:uX,Argument:PP$,Option:v2,Help:vP$}=PF4.default;var yP$=process.hrtime.bigint(),rf0=null;function TF4(){rf0=process.hrtime.bigint()}function _F4(){if(rf0===null)return null;return Number(process.hrtime.bigint()-rf0)/1e6}function G30(A){return A instanceof Error&&"code"in A&&A.code==="EPIPE"}function SF4(){process.stdout.on("error",(A)=>{if(!G30(A))throw A;process.exit(0)})}import wP from"node:fs";import MP from"node:path";Be();function sf0(A,Q){let $=Q.formatter??st,B=Q.encoder??new TextEncoder,E=Q.maxSize??1048576,D=Q.maxFiles??5,J=Q.bufferSize??8192,U=Q.flushInterval??5000,Y=0;try{Y=Q.statSync(A).size}catch{}let Z=Q.openSync(A),F=Date.now(),X="";function I(w){return Y+w.length>E}function G(){Q.closeSync(Z);for(let w=D-1;w>0;w--){let L=`${A}.${w}`,R=`${A}.${w+1}`;try{Q.renameSync(L,R)}catch(_){}}Q.renameSync(A,`${A}.1`),Y=0,Z=Q.openSync(A)}if(!Q.nonBlocking){let w=function(){if(X.length>0){let R=B.encode(X);if(X="",I(R))G();Q.writeSync(Z,R),Q.flushSync(Z),Y+=R.length,F=Date.now()}},L=(R)=>{X+=$(R);let _=X.length>=J,P=U>0&&R.timestamp-F>=U;if(_||P)w()};return L[Symbol.dispose]=()=>{w(),Q.closeSync(Z)},L}let V=Q,z=!1,K=null,W=null;async function C(){if(X.length===0)return;let w=X;X="";try{let L=B.encode(w);if(I(L))G();V.writeSync(Z,L),await V.flush(Z),Y+=L.length,F=Date.now()}catch{}}function H(){if(K||z)return;K=C().finally(()=>{K=null})}function N(){if(W!==null||z)return;W=setInterval(()=>{H()},U)}let q=(w)=>{if(z)return;X+=$(w);let L=X.length>=J,R=U>0&&w.timestamp-F>=U;if(L||R)H();else if(W===null&&U>0)N()};return q[Symbol.asyncDispose]=async()=>{if(z=!0,W!==null)clearInterval(W),W=null;await C();try{await V.close(Z)}catch{}},q}import g3 from"node:fs";import{join as kF4}from"node:path";import{promisify as V30}from"node:util";var tf0={openSync(A){return g3.openSync(A,"a")},writeSync:g3.writeSync,writeManySync(A,Q){if(Q.length===0)return;if(Q.length===1){g3.writeSync(A,Q[0]);return}g3.writevSync(A,Q)},flushSync:g3.fsyncSync,closeSync:g3.closeSync,statSync:g3.statSync,renameSync:g3.renameSync},fF4={...tf0,async writeMany(A,Q){if(Q.length===0)return;if(Q.length===1){await V30(g3.write)(A,Q[0]);return}await V30(g3.writev)(A,Q)},flush:V30(g3.fsync),close:V30(g3.close)},iP$={...tf0,readdirSync:g3.readdirSync,unlinkSync:g3.unlinkSync,mkdirSync:g3.mkdirSync,joinPath:kF4},nP$={...fF4,readdirSync:g3.readdirSync,unlinkSync:g3.unlinkSync,mkdirSync:g3.mkdirSync,joinPath:kF4};function ef0(A,Q={}){if(Q.nonBlocking)return sf0(A,{...Q,...fF4});return sf0(A,{...Q,...tf0})}Be();a0();var Ay0=M4(sA(),1);import{inspect as LnQ}from"node:util";function z30(A,...Q){if(Q.length===0)return A;return($)=>{let B=$;for(let E of Q)B=E(B);A(B)}}var K30=(A)=>{let Q=Ay0.trace.getActiveSpan();if(!Q)return A;let{traceId:$,spanId:B}=Q.spanContext();return{...A,properties:{...A.properties,traceId:$,spanId:B}}},W30=(A)=>{let Q=null;for(let $ of Object.keys(A.properties)){let B=A.properties[$];if(B instanceof Error)Q??={...A.properties},Q[$]=yF4(B)}return Q===null?A:{...A,properties:Q}},yF4=(A)=>({name:A.name,message:A.message,stack:A.stack,cause:A.cause instanceof Error?yF4(A.cause):A.cause}),Qy0=(A)=>({...A,properties:{...A.properties,pid:process.pid}});var xF4=(A)=>{let Q=Ay0.trace.getActiveSpan();if(!Q)return;Q.addEvent(jnQ(A.message),A.properties)};var uP={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",gray:"\x1B[90m"};var $v$={trace:uP.magenta,debug:uP.blue,info:uP.green,warning:uP.yellow,error:uP.red,fatal:uP.red};function jnQ(A,Q){let $="";for(let B=0;B<A.length;B++){let E=A[B];if(B%2===0)$+=typeof E==="string"?E:String(E);else $+=typeof E==="string"?E:LnQ(E,Q)}return $}var bF4=MP.join(lU,"logs"),RnQ=604800000,C30=MP.join(bF4,"threads"),Tc=MP.join(bF4,"cli.log"),PnQ=Number(process.env.AMP_MAX_LOG_FILE_SIZE)||10485760,vnQ={error:"error",warn:"warning",info:"info",debug:"debug"},$y0=!1,vc=null,By0=!1;function Ey0(){By0=!0}function OP(A){return MP.join(C30,`${A}.log`)}function hF4(A=Date.now()){let Q;try{Q=wP.readdirSync(C30)}catch{return}let $=A-RnQ;for(let B of Q){if(!B.endsWith(".log"))continue;let E=MP.join(C30,B);try{let D=wP.statSync(E);if(D.isFile()&&D.mtimeMs<$)wP.rmSync(E,{force:!0})}catch{}}}function gF4(A){vc=null,By0=!1;let{logFile:Q,logLevel:$}=A,B=vnQ[ZSA.catch("info").parse($)],E=tt({properties:"flatten"});return wP.mkdirSync(MP.dirname(Q),{recursive:!0}),XO(),ry({sinks:{file:z30(ef0(Q,{maxSize:PnQ,maxFiles:2,formatter:E}),Qy0,K30,W30),otel:z30(xF4,K30,W30),thread:z30(TnQ(C30,E),Qy0,K30,W30)},loggers:[{category:["logtape","meta"],sinks:["file"],lowestLevel:"warning"},{category:[],sinks:["file","otel","thread"],lowestLevel:B}]}),$y0=!0,Q}var H30=new Map;function TnQ(A,Q){return($)=>{if(!By0)return;let B=$.properties.threadId;if(typeof B!=="string"||B.length===0)return;try{let E=H30.get(B);if(!E)wP.mkdirSync(A,{recursive:!0}),E=wP.createWriteStream(OP(B),{flags:"a"}),H30.set(B,E);E.write(Q($))}catch{}}}function aY(){if(vc)return vc;if(!$y0)return Promise.resolve();return vc=_nQ(),vc}async function _nQ(){await new Promise((E)=>{setImmediate(E)});let A=Array.from(H30.values());H30.clear();let Q=Promise.all(A.map((E)=>new Promise((D)=>E.end(()=>D())))),$,B=new Promise((E)=>{$=setTimeout(E,500)});try{await Promise.race([Promise.all([Q,Qe()]),B])}finally{if($)clearTimeout($)}try{XO()}catch{}$y0=!1}D4();a0();import*as mF4 from"node:child_process";import*as dF4 from"node:fs/promises";import*as cF4 from"node:path";import{promisify as knQ}from"node:util";function SnQ(A){if(A.startsWith("http://")||A.startsWith("https://"))try{let Q=new URL(A);return Q.username="",Q.password="",Q.toString()}catch{}return A}function N30(A){let Q=["github.com","gitlab.com","bitbucket.org"];A=SnQ(A);let $=null,B=null,E=A.match(/^([^@]+)@([^:/]+)[:/](.+)$/);if(E&&E[1]&&E[2]&&E[3]){let D=E[1],J=E[2],U=E[3],Y=D==="git",Z=J==="github.com"&&D.startsWith("org-");if(Y||Z)$=J,B=U}if(!$||!B){let D=A.match(/^https?:\/\/([^/]+)\/(.+)$/);if(D&&D[1]&&D[2])$=D[1],B=D[2]}if(!$||!B){let D=A.match(/^([^:]+):(.+)$/);if(D&&D[1]&&D[2])$=D[1],B=D[2]}if($&&B&&Q.includes($)){let D=B.replace(/\.git$/,"").replace(/\/+$/,"").replace(/@[^/]+$/,"");return`https://${$}/${D}`.toLowerCase()}return A.replace(/\.git$/,"").replace(/\/+$/,"").replace(/@[^/]+$/,"").toLowerCase()}var Dy0=knQ(mF4.exec);async function pF4(A){let Q={displayName:BA.basename(A)};if(!iy(A))return Q;Q.uri=E4(A);try{if(!await dF4.access(cF4.join(A.fsPath,".git")).then(()=>!0).catch(()=>!1))return Q;let{stdout:B}=await Dy0("git remote get-url origin",{cwd:A.fsPath}).catch(()=>({stdout:""}));if(!B.trim())return Q;let{stdout:E}=await Dy0("git symbolic-ref HEAD",{cwd:A.fsPath}).catch(()=>({stdout:""})),{stdout:D}=await Dy0("git rev-parse HEAD",{cwd:A.fsPath}).catch(()=>({stdout:""}));return{...Q,repository:{type:"git",url:N30(B.trim()),ref:E.trim()||void 0,sha:D.trim()??void 0}}}catch($){return S.error("Error getting repository info:",$,{dir:A.fsPath}),Q}}QY();function q30(){let A=k8(),Q=q40(),$=SxA();return{os:Q.os,osVersion:Q.osVersion,cpuArchitecture:Q.cpuArchitecture,webBrowser:Q.webBrowser,client:A.name,clientVersion:A.version,clientType:A.type,installationID:$?.installationID,deviceFingerprint:$?.deviceFingerprint}}D4();async function wX(){return{trees:[await pF4(p0.file(process.cwd()))],platform:q30()}}a0();import{execFileSync as fnQ}from"node:child_process";import{mkdir as ynQ,writeFile as xnQ}from"node:fs/promises";import bnQ from"node:path";function LP(){if(process.platform==="win32")return"edit";return process.env.AMP_EDITOR||process.env.EDITOR||process.env.VISUAL||"vi"}async function hnQ(A){await ynQ(bnQ.dirname(A),{recursive:!0});try{await xnQ(A,`{
2698
+ `);if(D!==-1)Q=ZF4(Q,E,B,D);return B+Q+E};Object.defineProperties(Rc.prototype,qP);var iiQ=Rc(),KP$=Rc({level:XF4?XF4.level:0});var f0=iiQ;var PF4=M4(RF4(),1),{program:MP$,createCommand:OP$,createArgument:LP$,createOption:jP$,CommanderError:vF4,InvalidArgumentError:I30,InvalidOptionArgumentError:RP$,Command:uX,Argument:PP$,Option:v2,Help:vP$}=PF4.default;var yP$=process.hrtime.bigint(),rf0=null;function TF4(){rf0=process.hrtime.bigint()}function _F4(){if(rf0===null)return null;return Number(process.hrtime.bigint()-rf0)/1e6}function G30(A){return A instanceof Error&&"code"in A&&A.code==="EPIPE"}function SF4(){process.stdout.on("error",(A)=>{if(!G30(A))throw A;process.exit(0)})}import wP from"node:fs";import MP from"node:path";Be();function sf0(A,Q){let $=Q.formatter??st,B=Q.encoder??new TextEncoder,E=Q.maxSize??1048576,D=Q.maxFiles??5,J=Q.bufferSize??8192,U=Q.flushInterval??5000,Y=0;try{Y=Q.statSync(A).size}catch{}let Z=Q.openSync(A),F=Date.now(),X="";function I(w){return Y+w.length>E}function G(){Q.closeSync(Z);for(let w=D-1;w>0;w--){let L=`${A}.${w}`,R=`${A}.${w+1}`;try{Q.renameSync(L,R)}catch(_){}}Q.renameSync(A,`${A}.1`),Y=0,Z=Q.openSync(A)}if(!Q.nonBlocking){let w=function(){if(X.length>0){let R=B.encode(X);if(X="",I(R))G();Q.writeSync(Z,R),Q.flushSync(Z),Y+=R.length,F=Date.now()}},L=(R)=>{X+=$(R);let _=X.length>=J,P=U>0&&R.timestamp-F>=U;if(_||P)w()};return L[Symbol.dispose]=()=>{w(),Q.closeSync(Z)},L}let V=Q,z=!1,K=null,W=null;async function C(){if(X.length===0)return;let w=X;X="";try{let L=B.encode(w);if(I(L))G();V.writeSync(Z,L),await V.flush(Z),Y+=L.length,F=Date.now()}catch{}}function H(){if(K||z)return;K=C().finally(()=>{K=null})}function N(){if(W!==null||z)return;W=setInterval(()=>{H()},U)}let q=(w)=>{if(z)return;X+=$(w);let L=X.length>=J,R=U>0&&w.timestamp-F>=U;if(L||R)H();else if(W===null&&U>0)N()};return q[Symbol.asyncDispose]=async()=>{if(z=!0,W!==null)clearInterval(W),W=null;await C();try{await V.close(Z)}catch{}},q}import g3 from"node:fs";import{join as kF4}from"node:path";import{promisify as V30}from"node:util";var tf0={openSync(A){return g3.openSync(A,"a")},writeSync:g3.writeSync,writeManySync(A,Q){if(Q.length===0)return;if(Q.length===1){g3.writeSync(A,Q[0]);return}g3.writevSync(A,Q)},flushSync:g3.fsyncSync,closeSync:g3.closeSync,statSync:g3.statSync,renameSync:g3.renameSync},fF4={...tf0,async writeMany(A,Q){if(Q.length===0)return;if(Q.length===1){await V30(g3.write)(A,Q[0]);return}await V30(g3.writev)(A,Q)},flush:V30(g3.fsync),close:V30(g3.close)},iP$={...tf0,readdirSync:g3.readdirSync,unlinkSync:g3.unlinkSync,mkdirSync:g3.mkdirSync,joinPath:kF4},nP$={...fF4,readdirSync:g3.readdirSync,unlinkSync:g3.unlinkSync,mkdirSync:g3.mkdirSync,joinPath:kF4};function ef0(A,Q={}){if(Q.nonBlocking)return sf0(A,{...Q,...fF4});return sf0(A,{...Q,...tf0})}Be();a0();var Ay0=M4(sA(),1);import{inspect as LnQ}from"node:util";function z30(A,...Q){if(Q.length===0)return A;return($)=>{let B=$;for(let E of Q)B=E(B);A(B)}}var K30=(A)=>{let Q=Ay0.trace.getActiveSpan();if(!Q)return A;let{traceId:$,spanId:B}=Q.spanContext();return{...A,properties:{...A.properties,traceId:$,spanId:B}}},W30=(A)=>{let Q=null;for(let $ of Object.keys(A.properties)){let B=A.properties[$];if(B instanceof Error)Q??={...A.properties},Q[$]=yF4(B)}return Q===null?A:{...A,properties:Q}},yF4=(A)=>({name:A.name,message:A.message,stack:A.stack,cause:A.cause instanceof Error?yF4(A.cause):A.cause}),Qy0=(A)=>({...A,properties:{...A.properties,pid:process.pid}});var xF4=(A)=>{let Q=Ay0.trace.getActiveSpan();if(!Q)return;Q.addEvent(jnQ(A.message),A.properties)};var uP={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",gray:"\x1B[90m"};var $v$={trace:uP.magenta,debug:uP.blue,info:uP.green,warning:uP.yellow,error:uP.red,fatal:uP.red};function jnQ(A,Q){let $="";for(let B=0;B<A.length;B++){let E=A[B];if(B%2===0)$+=typeof E==="string"?E:String(E);else $+=typeof E==="string"?E:LnQ(E,Q)}return $}var bF4=MP.join(lU,"logs"),RnQ=604800000,C30=MP.join(bF4,"threads"),Tc=MP.join(bF4,"cli.log"),PnQ=Number(process.env.AMP_MAX_LOG_FILE_SIZE)||10485760,vnQ={error:"error",warn:"warning",info:"info",debug:"debug"},$y0=!1,vc=null,By0=!1;function Ey0(){By0=!0}function OP(A){return MP.join(C30,`${A}.log`)}function hF4(A=Date.now()){let Q;try{Q=wP.readdirSync(C30)}catch{return}let $=A-RnQ;for(let B of Q){if(!B.endsWith(".log"))continue;let E=MP.join(C30,B);try{let D=wP.statSync(E);if(D.isFile()&&D.mtimeMs<$)wP.rmSync(E,{force:!0})}catch{}}}function gF4(A){vc=null,By0=!1;let{logFile:Q,logLevel:$}=A,B=vnQ[ZSA.catch("info").parse($)],E=tt({properties:"flatten"});return wP.mkdirSync(MP.dirname(Q),{recursive:!0}),XO(),ry({sinks:{file:z30(ef0(Q,{maxSize:PnQ,maxFiles:2,formatter:E}),Qy0,K30,W30),otel:z30(xF4,K30,W30),thread:z30(TnQ(C30,E),Qy0,K30,W30)},loggers:[{category:["logtape","meta"],sinks:["file"],lowestLevel:"warning"},{category:[],sinks:["file","otel","thread"],lowestLevel:B}]}),$y0=!0,Q}var H30=new Map;function TnQ(A,Q){return($)=>{if(!By0)return;let B=$.properties.threadId;if(typeof B!=="string"||B.length===0)return;try{let E=H30.get(B);if(!E)wP.mkdirSync(A,{recursive:!0}),E=wP.createWriteStream(OP(B),{flags:"a"}),H30.set(B,E);E.write(Q($))}catch{}}}function aY(){if(vc)return vc;if(!$y0)return Promise.resolve();return vc=_nQ(),vc}async function _nQ(){await new Promise((E)=>{setImmediate(E)});let A=Array.from(H30.values());H30.clear();let Q=Promise.all(A.map((E)=>new Promise((D)=>E.end(()=>D())))),$,B=new Promise((E)=>{$=setTimeout(E,500)});try{await Promise.race([Promise.all([Q,Qe()]),B])}finally{if($)clearTimeout($)}try{XO()}catch{}$y0=!1}D4();a0();import*as mF4 from"node:child_process";import*as dF4 from"node:fs/promises";import*as cF4 from"node:path";import{promisify as knQ}from"node:util";function SnQ(A){if(A.startsWith("http://")||A.startsWith("https://"))try{let Q=new URL(A);return Q.username="",Q.password="",Q.toString()}catch{}return A}function N30(A){let Q=["github.com","gitlab.com","bitbucket.org"];A=SnQ(A);let $=null,B=null,E=A.match(/^(?:ssh:\/\/)?([^@]+)@([^:/]+)[:/](.+)$/);if(E&&E[1]&&E[2]&&E[3]){let D=E[1],J=E[2],U=E[3],Y=D==="git",Z=J==="github.com"&&D.startsWith("org-");if(Y||Z)$=J,B=U}if(!$||!B){let D=A.match(/^https?:\/\/([^/]+)\/(.+)$/);if(D&&D[1]&&D[2])$=D[1],B=D[2]}if(!$||!B){let D=A.match(/^([^:]+):(.+)$/);if(D&&D[1]&&D[2])$=D[1],B=D[2]}if($&&B&&Q.includes($)){let D=B.replace(/\.git$/,"").replace(/\/+$/,"").replace(/@[^/]+$/,"");return`https://${$}/${D}`.toLowerCase()}return A.replace(/\.git$/,"").replace(/\/+$/,"").replace(/@[^/]+$/,"").toLowerCase()}var Dy0=knQ(mF4.exec);async function pF4(A){let Q={displayName:BA.basename(A)};if(!iy(A))return Q;Q.uri=E4(A);try{if(!await dF4.access(cF4.join(A.fsPath,".git")).then(()=>!0).catch(()=>!1))return Q;let{stdout:B}=await Dy0("git remote get-url origin",{cwd:A.fsPath}).catch(()=>({stdout:""}));if(!B.trim())return Q;let{stdout:E}=await Dy0("git symbolic-ref HEAD",{cwd:A.fsPath}).catch(()=>({stdout:""})),{stdout:D}=await Dy0("git rev-parse HEAD",{cwd:A.fsPath}).catch(()=>({stdout:""}));return{...Q,repository:{type:"git",url:N30(B.trim()),ref:E.trim()||void 0,sha:D.trim()??void 0}}}catch($){return S.error("Error getting repository info:",$,{dir:A.fsPath}),Q}}QY();function q30(){let A=k8(),Q=q40(),$=SxA();return{os:Q.os,osVersion:Q.osVersion,cpuArchitecture:Q.cpuArchitecture,webBrowser:Q.webBrowser,client:A.name,clientVersion:A.version,clientType:A.type,installationID:$?.installationID,deviceFingerprint:$?.deviceFingerprint}}D4();async function wX(){return{trees:[await pF4(p0.file(process.cwd()))],platform:q30()}}a0();import{execFileSync as fnQ}from"node:child_process";import{mkdir as ynQ,writeFile as xnQ}from"node:fs/promises";import bnQ from"node:path";function LP(){if(process.platform==="win32")return"edit";return process.env.AMP_EDITOR||process.env.EDITOR||process.env.VISUAL||"vi"}async function hnQ(A){await ynQ(bnQ.dirname(A),{recursive:!0});try{await xnQ(A,`{
2699
2699
  }
2700
2700
  `,{encoding:"utf-8",flag:"wx",mode:384})}catch(Q){if(Q.code!=="EEXIST")throw Q}}async function gnQ(A){await hnQ(A);let Q=LP();try{fnQ(Q,[A],{stdio:"inherit"})}catch($){throw S.error("Failed to open settings file in editor",{editor:Q,settingsPath:A,error:$}),Error(`Failed to open ${Q}`)}}function lF4(A,Q){let $=A.command("config").summary("Manage Amp configuration").description("Manage Amp configuration").action(()=>{$.outputHelp(),process.exit(0)});$.command("edit").summary("Open the Amp settings file in $EDITOR").description("Open the Amp settings file in $EDITOR. By default, this opens user settings. Use --workspace to edit the workspace-specific .amp/settings.json file.").option("--global","Edit user settings (default)").option("--workspace","Edit workspace settings").action(async(B,E)=>{if(B.global&&B.workspace)throw Error("Use only one of --global or --workspace");let D=await Q(E.optsWithGlobals()),J=B.workspace?D.settings.getWorkspaceSettingsPath():D.settings.getSettingsFilePath();await gnQ(J),process.exit(0)})}a0();import{execFile as mnQ}from"node:child_process";import{promisify as dnQ}from"node:util";var cnQ=dnQ(mnQ),pnQ=["private","workspace"];function lnQ(A){switch(A){case"private":return{visibility:"private",sharedGroupIDs:[]};case"workspace":return{visibility:"thread_workspace_shared"};case"group":return{visibility:"private",shareWithAllCreatorGroups:!0}}}function Jy0(A){return A.endsWith("/")?A.slice(0,-1):A}function inQ(A){let Q=N30(A);try{let E=new URL(Q);return Jy0(`${E.host}${E.pathname}`).replace(/^\//,"")}catch{}let $=Q.match(/^[^@]+@([^:/]+)[:/](.+)$/);if($?.[1]&&$[2])return Jy0(`${$[1]}/${$[2]}`).replace(/\.git$/,"");let B=Q.match(/^([^:]+):(.+)$/);if(B?.[1]&&B[2])return Jy0(`${B[1]}/${B[2]}`).replace(/\.git$/,"");return null}async function nF4(A){try{let{stdout:Q}=await cnQ("git",["remote","get-url","origin"],{cwd:A}),$=Q.trim();if(!$)return null;return inQ($)}catch{return null}}function nnQ(A){let Q=[...pnQ];if(A?.team?.disablePrivateThreads){let $=Q.indexOf("private");if($!==-1)Q.splice($,1)}if(A?.team?.groups&&A.team.groups.length>0)Q.push("group");return Q}function anQ(A){if(A?.team?.groups!==void 0)return Error(["Group visibility is not available. ",`You are not a member of any group in this workspace.
2701
2701
  `].join(""));return Error(`Group visibility is not available.
@@ -4227,13 +4227,13 @@ ${z}`))}},error:(V)=>{if(!G)G=!0,Z(Error(`Failed to spawn brew: ${V.message}`))}
4227
4227
  ${z}`;if(J==="pnpm"&&z.includes("Unable to find the global bin directory"))K+=`
4228
4228
 
4229
4229
  Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
4230
- npm install -g ${D}`;Z(Error(K))}},error:(V)=>{if(!I)I=!0,Z(Error(`Failed to spawn ${J}: ${V.message}`))},complete:()=>{if(!I)I=!0,Y()}})})}a0();a0();$g();var WtQ="@ampcode/cli";async function s30(A,Q,$=WtQ){let E=`${Q||"https://registry.npmjs.org"}/${$}/latest`,D=new AbortController,J=setTimeout(()=>D.abort(),5000);try{let U=await fetch(E,{signal:D.signal});if(!U.ok)return{hasUpdate:!1,currentVersion:A,source:"npm"};let Y=await U.json(),Z=Y.version??Y["dist-tags"]?.latest;if(!Z)return{hasUpdate:!1,currentVersion:A,source:"npm"};let F=oc(A,Z),X=F<0,I,G;if(Y.time){let V=Y.time[A],z=Y.time[Z],K=Date.now();if(V)I=Math.floor((K-new Date(V).getTime())/3600000);if(z)G=Math.floor((K-new Date(z).getTime())/3600000)}return S.info("NPM version comparison",{currentVersion:A,latestVersion:Z,compareResult:F,hasUpdate:X,currentVersionAge:I,latestVersionAge:G}),{hasUpdate:X,latestVersion:Z,currentVersion:A,currentVersionAge:I,latestVersionAge:G,source:"npm"}}catch(U){return S.debug("Error checking npm version",{error:U}),{hasUpdate:!1,currentVersion:A,source:"npm"}}finally{clearTimeout(J)}}var CtQ="https://static.ampcode.com/cli/cli-version.txt";async function t30(A){let Q=new AbortController,$=setTimeout(()=>Q.abort(),5000);try{let B=await fetch(`${CtQ}?t=${Date.now()}`,{signal:Q.signal,cache:"no-store"});if(!B.ok)return{hasUpdate:!1,currentVersion:A,source:"bin"};let E=(await B.text()).trim();if(!E||!/^\d+\.\d+\.\d+/.test(E))return{hasUpdate:!1,currentVersion:A,source:"bin"};let D=oc(A,E),J=D<0;return S.info("Bin version comparison",{currentVersion:A,latestVersion:E,compareResult:D,hasUpdate:J}),{hasUpdate:J,latestVersion:E,currentVersion:A,source:"bin"}}catch(B){return S.debug("Error checking bin version",{error:B}),{hasUpdate:!1,currentVersion:A,source:"bin"}}finally{clearTimeout($)}}function oc(A,Q){let $=(J)=>{let[U,Y]=J.split("-");return{parts:U?.split(".").map(Number)||[],label:Y}},B=$(A),E=$(Q),D=Math.max(B.parts.length,E.parts.length);for(let J=0;J<D;J++){let U=B.parts[J]||0,Y=E.parts[J]||0;if(U<Y)return-1;if(U>Y)return 1}if(B.label===E.label)return 0;if(!B.label&&E.label)return 1;if(B.label&&!E.label)return-1;if(B.label&&E.label)return B.label<E.label?-1:1;return 0}function rc(A){try{let Q=A.match(/^0\.0\.(\d+)(?:-(.+))?/);if(!Q)return null;let $=parseInt(Q[1],10),B=$!==0?$*1000:void 0,D=Q[2]?.match(/^g?([a-f0-9]+)$/)?.[1],J=B!==void 0?OV(B):void 0;return{sha:D,timestamp:B,age:J}}catch{return null}}kA();a0();import{readFile as HtQ,realpath as NtQ}from"node:fs/promises";import{dirname as oG4,join as qtQ}from"node:path";async function rG4(A){switch(A){case"binary":case"brew":return utQ(nc());case"npm":case"pnpm":case"yarn":case"bun":return wtQ()}}async function utQ(A){let Q=await Oz(A,["--version"],5000);if(Q.reason!=="success")return S.debug("failed to read version from binary",{binaryPath:A,result:Q}),null;return Q.output.trim().split(/\s+/)[0]||null}async function wtQ(){try{let A=process.argv[1];if(!A)return null;let Q=await NtQ(A),$=oG4(oG4(Q));return await MtQ(qtQ($,"package.json"))}catch(A){return S.debug("failed to read installed version from package.json",{error:A}),null}}async function MtQ(A){let Q=await HtQ(A,"utf8"),$=JSON.parse(Q);if(!$.name||!my0($.name))return S.debug("package.json name mismatch",{pkgJsonPath:A,name:$.name}),null;return $.version||null}a0();import{spawn as OtQ}from"node:child_process";function ay0(A){if(A=A.replace(/\/$/,""),!A.startsWith("http://")&&!A.startsWith("https://"))A=`https://${A}`;try{return new URL(A),A}catch{return S.warn(`Invalid registry URL: ${A}, falling back to npmjs.org`),"https://registry.npmjs.org"}}var e30=null,sc=null;function sG4(A){return new Promise((Q)=>{let $=OtQ("npm",["config","get",A],{stdio:["ignore","pipe","ignore"],timeout:5000,shell:process.platform==="win32"}),B="";$.stdout.on("data",(E)=>{B+=E.toString()}),$.on("close",(E,D)=>{if(E!==0||D==="SIGTERM"){Q(null);return}let J=B.trim();Q(J&&J!=="undefined"?J:null)}),$.on("error",()=>{Q(null)})})}async function A50(){if(e30)return e30;if(sc)return sc;sc=(async()=>{let A=process.env.NPM_CONFIG_REGISTRY??process.env.npm_config_registry;if(A)return ay0(A);let Q=await sG4("@sourcegraph:registry");if(Q)return ay0(Q);let $=await sG4("registry");if($)return ay0($);return"https://registry.npmjs.org"})();try{return e30=await sc,e30}finally{sc=null}}var LtQ=3600000,jtQ=5000;function oy0(A,Q,$={}){let B=new u4,E=B.pipe(V$({shouldCountRefs:!1})),D=$.startDelayMs??0,J=$.checkIntervalMs??LtQ,U=!1,Y=()=>{U=!0};return setImmediate(async()=>{let Z=S.getChild("update");if(D>0){if(await jV(D),U)return}let F=E.subscribe({next:(I)=>{Z.debug("emit new state",I)}}),X=A;try{while(!U){let I=await RtQ(X,Q,Z,B);if(I.stop)return;if(I.updatedTo)X=I.updatedTo;if(I.emittedVisibleState){if(await jV(jtQ),U)return;B.next("hidden")}if(J<=0)return;let G=1000,V=J;while(V>0&&!U){let z=Math.min(G,V);await jV(z),V-=z}}}finally{F.unsubscribe(),B.complete()}}),{state:E,dispose:Y}}async function RtQ(A,Q,$,B){let E={stop:!1,emittedVisibleState:!1};try{if(process.env.AMP_SKIP_UPDATE_CHECK==="1")return $.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable"),E.stop=!0,E;let D=await Q.get("updates.mode");if(D==="disabled")return $.debug("checking disabled"),E.stop=!0,E;let J=await rY(),U=J==="binary"||J==="brew",Y=U?void 0:await Lz();$.debug("checking",{currentVersion:A,mode:D,packageManager:J,isBinaryDistribution:U,npmPackageName:Y});let Z;if(U)Z=await t30(A);else{let I=await A50();Z=await s30(A,I,Y)}if(!(Z.latestVersion&&Z.hasUpdate))return $.debug("no update available"),E;let F=(I)=>{B.next(I),E.emittedVisibleState=!0};if(J){let I=await rG4(J);if(I&&oc(I,Z.latestVersion)>=0){if($.debug("on-disk version already up to date",{currentVersion:A,installedVersion:I,latestVersion:Z.latestVersion}),E.updatedTo=I,oc(A,I)<0){let G=await LX(I),V={from:A,to:I,externallyUpdated:!0,...G};if(G.status==="same")$.info("on-disk already updated by another instance",V),F("updated");else $.warn("on-disk already updated by another instance, with PATH warning",V),F("updated-with-warning")}return E}}let X=()=>{if(Z.currentVersionAge!==void 0&&Z.latestVersionAge!==void 0){let I=Z.currentVersionAge-Z.latestVersionAge,G=0.5;if(Math.abs(I)<0.5)return $.debug("versions too close together, suppressing update warning",{currentVersionAge:Z.currentVersionAge,latestVersionAge:Z.latestVersionAge,ageDifferenceHours:I}),!0}return!1};if(!D)D=J==="pnpm"?"warn":"auto",$.debug("no configured update mode; selected default based on package manager",{packageManager:J,mode:D});if(J==="brew"){if(!X())F("update-available-brew");return E}if(J==="binary"&&process.execPath!==nc()){if($.debug("non-standard binary path, showing warning"),!X())F("update-available-unrecognized-path");return E}if(D==="warn"){if(!X())F("update-available");return E}if(!J){if($.debug("auto-update not supported, falling back to warn mode"),!X())F("update-available");return E}try{await ac(Z.latestVersion,J),E.updatedTo=Z.latestVersion;let I=await LX(Z.latestVersion),G={from:Z.currentVersion,to:Z.latestVersion,...I};if(I.status==="same")$.info("success",G),F("updated");else $.warn("success with warning",G),F("updated-with-warning")}catch(I){F("update-error")}return E}catch(D){return $.debug("check failed",{error:D}),E}}$g();import{stderr as sD}from"node:process";function tG4(A){let Q=new uX().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(B)=>{await hy0(B.force||!1,B.verbose||!1,"0.0.1780162602-gb8f27a"),process.exit()});A.addCommand(Q,{hidden:!0});let $=new uX("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(B)=>{await TtQ(B.targetVersion)});A.addCommand($)}function PtQ(A){let Q=Boolean(A.isTTY),$=0,B=!1;function E(){if(!Q||!B)return;A.write(`
4230
+ npm install -g ${D}`;Z(Error(K))}},error:(V)=>{if(!I)I=!0,Z(Error(`Failed to spawn ${J}: ${V.message}`))},complete:()=>{if(!I)I=!0,Y()}})})}a0();a0();$g();var WtQ="@ampcode/cli";async function s30(A,Q,$=WtQ){let E=`${Q||"https://registry.npmjs.org"}/${$}/latest`,D=new AbortController,J=setTimeout(()=>D.abort(),5000);try{let U=await fetch(E,{signal:D.signal});if(!U.ok)return{hasUpdate:!1,currentVersion:A,source:"npm"};let Y=await U.json(),Z=Y.version??Y["dist-tags"]?.latest;if(!Z)return{hasUpdate:!1,currentVersion:A,source:"npm"};let F=oc(A,Z),X=F<0,I,G;if(Y.time){let V=Y.time[A],z=Y.time[Z],K=Date.now();if(V)I=Math.floor((K-new Date(V).getTime())/3600000);if(z)G=Math.floor((K-new Date(z).getTime())/3600000)}return S.info("NPM version comparison",{currentVersion:A,latestVersion:Z,compareResult:F,hasUpdate:X,currentVersionAge:I,latestVersionAge:G}),{hasUpdate:X,latestVersion:Z,currentVersion:A,currentVersionAge:I,latestVersionAge:G,source:"npm"}}catch(U){return S.debug("Error checking npm version",{error:U}),{hasUpdate:!1,currentVersion:A,source:"npm"}}finally{clearTimeout(J)}}var CtQ="https://static.ampcode.com/cli/cli-version.txt";async function t30(A){let Q=new AbortController,$=setTimeout(()=>Q.abort(),5000);try{let B=await fetch(`${CtQ}?t=${Date.now()}`,{signal:Q.signal,cache:"no-store"});if(!B.ok)return{hasUpdate:!1,currentVersion:A,source:"bin"};let E=(await B.text()).trim();if(!E||!/^\d+\.\d+\.\d+/.test(E))return{hasUpdate:!1,currentVersion:A,source:"bin"};let D=oc(A,E),J=D<0;return S.info("Bin version comparison",{currentVersion:A,latestVersion:E,compareResult:D,hasUpdate:J}),{hasUpdate:J,latestVersion:E,currentVersion:A,source:"bin"}}catch(B){return S.debug("Error checking bin version",{error:B}),{hasUpdate:!1,currentVersion:A,source:"bin"}}finally{clearTimeout($)}}function oc(A,Q){let $=(J)=>{let[U,Y]=J.split("-");return{parts:U?.split(".").map(Number)||[],label:Y}},B=$(A),E=$(Q),D=Math.max(B.parts.length,E.parts.length);for(let J=0;J<D;J++){let U=B.parts[J]||0,Y=E.parts[J]||0;if(U<Y)return-1;if(U>Y)return 1}if(B.label===E.label)return 0;if(!B.label&&E.label)return 1;if(B.label&&!E.label)return-1;if(B.label&&E.label)return B.label<E.label?-1:1;return 0}function rc(A){try{let Q=A.match(/^0\.0\.(\d+)(?:-(.+))?/);if(!Q)return null;let $=parseInt(Q[1],10),B=$!==0?$*1000:void 0,D=Q[2]?.match(/^g?([a-f0-9]+)$/)?.[1],J=B!==void 0?OV(B):void 0;return{sha:D,timestamp:B,age:J}}catch{return null}}kA();a0();import{readFile as HtQ,realpath as NtQ}from"node:fs/promises";import{dirname as oG4,join as qtQ}from"node:path";async function rG4(A){switch(A){case"binary":case"brew":return utQ(nc());case"npm":case"pnpm":case"yarn":case"bun":return wtQ()}}async function utQ(A){let Q=await Oz(A,["--version"],5000);if(Q.reason!=="success")return S.debug("failed to read version from binary",{binaryPath:A,result:Q}),null;return Q.output.trim().split(/\s+/)[0]||null}async function wtQ(){try{let A=process.argv[1];if(!A)return null;let Q=await NtQ(A),$=oG4(oG4(Q));return await MtQ(qtQ($,"package.json"))}catch(A){return S.debug("failed to read installed version from package.json",{error:A}),null}}async function MtQ(A){let Q=await HtQ(A,"utf8"),$=JSON.parse(Q);if(!$.name||!my0($.name))return S.debug("package.json name mismatch",{pkgJsonPath:A,name:$.name}),null;return $.version||null}a0();import{spawn as OtQ}from"node:child_process";function ay0(A){if(A=A.replace(/\/$/,""),!A.startsWith("http://")&&!A.startsWith("https://"))A=`https://${A}`;try{return new URL(A),A}catch{return S.warn(`Invalid registry URL: ${A}, falling back to npmjs.org`),"https://registry.npmjs.org"}}var e30=null,sc=null;function sG4(A){return new Promise((Q)=>{let $=OtQ("npm",["config","get",A],{stdio:["ignore","pipe","ignore"],timeout:5000,shell:process.platform==="win32"}),B="";$.stdout.on("data",(E)=>{B+=E.toString()}),$.on("close",(E,D)=>{if(E!==0||D==="SIGTERM"){Q(null);return}let J=B.trim();Q(J&&J!=="undefined"?J:null)}),$.on("error",()=>{Q(null)})})}async function A50(){if(e30)return e30;if(sc)return sc;sc=(async()=>{let A=process.env.NPM_CONFIG_REGISTRY??process.env.npm_config_registry;if(A)return ay0(A);let Q=await sG4("@sourcegraph:registry");if(Q)return ay0(Q);let $=await sG4("registry");if($)return ay0($);return"https://registry.npmjs.org"})();try{return e30=await sc,e30}finally{sc=null}}var LtQ=3600000,jtQ=5000;function oy0(A,Q,$={}){let B=new u4,E=B.pipe(V$({shouldCountRefs:!1})),D=$.startDelayMs??0,J=$.checkIntervalMs??LtQ,U=!1,Y=()=>{U=!0};return setImmediate(async()=>{let Z=S.getChild("update");if(D>0){if(await jV(D),U)return}let F=E.subscribe({next:(I)=>{Z.debug("emit new state",I)}}),X=A;try{while(!U){let I=await RtQ(X,Q,Z,B);if(I.stop)return;if(I.updatedTo)X=I.updatedTo;if(I.emittedVisibleState){if(await jV(jtQ),U)return;B.next("hidden")}if(J<=0)return;let G=1000,V=J;while(V>0&&!U){let z=Math.min(G,V);await jV(z),V-=z}}}finally{F.unsubscribe(),B.complete()}}),{state:E,dispose:Y}}async function RtQ(A,Q,$,B){let E={stop:!1,emittedVisibleState:!1};try{if(process.env.AMP_SKIP_UPDATE_CHECK==="1")return $.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable"),E.stop=!0,E;let D=await Q.get("updates.mode");if(D==="disabled")return $.debug("checking disabled"),E.stop=!0,E;let J=await rY(),U=J==="binary"||J==="brew",Y=U?void 0:await Lz();$.debug("checking",{currentVersion:A,mode:D,packageManager:J,isBinaryDistribution:U,npmPackageName:Y});let Z;if(U)Z=await t30(A);else{let I=await A50();Z=await s30(A,I,Y)}if(!(Z.latestVersion&&Z.hasUpdate))return $.debug("no update available"),E;let F=(I)=>{B.next(I),E.emittedVisibleState=!0};if(J){let I=await rG4(J);if(I&&oc(I,Z.latestVersion)>=0){if($.debug("on-disk version already up to date",{currentVersion:A,installedVersion:I,latestVersion:Z.latestVersion}),E.updatedTo=I,oc(A,I)<0){let G=await LX(I),V={from:A,to:I,externallyUpdated:!0,...G};if(G.status==="same")$.info("on-disk already updated by another instance",V),F("updated");else $.warn("on-disk already updated by another instance, with PATH warning",V),F("updated-with-warning")}return E}}let X=()=>{if(Z.currentVersionAge!==void 0&&Z.latestVersionAge!==void 0){let I=Z.currentVersionAge-Z.latestVersionAge,G=0.5;if(Math.abs(I)<0.5)return $.debug("versions too close together, suppressing update warning",{currentVersionAge:Z.currentVersionAge,latestVersionAge:Z.latestVersionAge,ageDifferenceHours:I}),!0}return!1};if(!D)D=J==="pnpm"?"warn":"auto",$.debug("no configured update mode; selected default based on package manager",{packageManager:J,mode:D});if(J==="brew"){if(!X())F("update-available-brew");return E}if(J==="binary"&&process.execPath!==nc()){if($.debug("non-standard binary path, showing warning"),!X())F("update-available-unrecognized-path");return E}if(D==="warn"){if(!X())F("update-available");return E}if(!J){if($.debug("auto-update not supported, falling back to warn mode"),!X())F("update-available");return E}try{await ac(Z.latestVersion,J),E.updatedTo=Z.latestVersion;let I=await LX(Z.latestVersion),G={from:Z.currentVersion,to:Z.latestVersion,...I};if(I.status==="same")$.info("success",G),F("updated");else $.warn("success with warning",G),F("updated-with-warning")}catch(I){F("update-error")}return E}catch(D){return $.debug("check failed",{error:D}),E}}$g();import{stderr as sD}from"node:process";function tG4(A){let Q=new uX().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(B)=>{await hy0(B.force||!1,B.verbose||!1,"0.0.1780172352-gac8e8a"),process.exit()});A.addCommand(Q,{hidden:!0});let $=new uX("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(B)=>{await TtQ(B.targetVersion)});A.addCommand($)}function PtQ(A){let Q=Boolean(A.isTTY),$=0,B=!1;function E(){if(!Q||!B)return;A.write(`
4231
4231
  `),B=!1,$=0}function D(J){if(!Q)return;let U=J.padEnd($," ");A.write(`\r${U}`),B=!0,$=U.length}return{flushProgressLine:E,renderProgress:D}}function vtQ(A){if(A.source==="npm"&&A.latestVersionAge!==void 0&&A.latestVersionAge>36)sD.write(f0.yellow(`The latest Amp CLI version reported by npm is older than expected. Be aware that you may be using an npm proxy with a corporate policy to delay package updates.
4232
4232
  `))}async function TtQ(A){let $=process.platform==="win32"&&Aq()?{currentExecutablePath:process.execPath}:void 0,{flushProgressLine:B,renderProgress:E}=PtQ(sD);if(process.env.AMP_SKIP_UPDATE_CHECK==="1")sD.write(f0.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
4233
4233
 
4234
4234
  `));try{if(!A){sD.write(f0.blue(`Checking for updates...
4235
- `));let U=!1,Y;if(Aq()){let Z=await t30("0.0.1780162602-gb8f27a");U=Z.hasUpdate,Y=Z.latestVersion}else{let Z=await A50(),F=await Lz(),X=await s30("0.0.1780162602-gb8f27a",Z,F);vtQ(X),U=X.hasUpdate,Y=X.latestVersion}if(!U){let Z=rc("0.0.1780162602-gb8f27a"),F=Z?.age?`released ${Z.age} ago`:`built ${OV(new Date("2026-05-30T17:41:57.172Z"))} ago`;sD.write(f0.green(`✓ Amp is already up to date on version ${"0.0.1780162602-gb8f27a"} (${F})
4236
- `));let X=await LX("0.0.1780162602-gb8f27a",$);if(X.warning)sD.write(`
4235
+ `));let U=!1,Y;if(Aq()){let Z=await t30("0.0.1780172352-gac8e8a");U=Z.hasUpdate,Y=Z.latestVersion}else{let Z=await A50(),F=await Lz(),X=await s30("0.0.1780172352-gac8e8a",Z,F);vtQ(X),U=X.hasUpdate,Y=X.latestVersion}if(!U){let Z=rc("0.0.1780172352-gac8e8a"),F=Z?.age?`released ${Z.age} ago`:`built ${OV(new Date("2026-05-30T20:24:02.013Z"))} ago`;sD.write(f0.green(`✓ Amp is already up to date on version ${"0.0.1780172352-gac8e8a"} (${F})
4236
+ `));let X=await LX("0.0.1780172352-gac8e8a",$);if(X.warning)sD.write(`
4237
4237
  `+f0.yellow(X.warning)+`
4238
4238
  `);process.exit(0)}if(!Y)sD.write(f0.yellow("[WARN] could not find latest version")),process.exit(0);A=Y}sD.write(f0.blue(`Updating to version ${A}...
4239
4239
  `)),await ac(A,void 0,(U)=>{B(),sD.write(f0.dim(`Running: ${U}
@@ -4385,7 +4385,7 @@ ${B}`}async function n66(A,Q){if(!Q?.forceExternal&&Q?.onShowImagePreview&&DH4(A
4385
4385
  `).length,E=new D0({text:new h(A,new $0({color:$}))});if(B<=V80)return E;return new x0({width:1/0,height:V80,child:new OB({autofocus:!1,controller:Q,child:E})})}function Z86(){return new Map([[CA.key("PageUp"),new z80],[CA.key("PageDown"),new Rg0],[CA.ctrl("u"),new z80],[CA.shift("Home"),new Pg0],[CA.shift("End"),new vg0]])}function F86(A,Q,$){return Math.max(Q,Math.min(A,$))}var Tg0=8,Tu4=1,_u4=Tg0-1;class _g0 extends I4{}class Sg0 extends I4{}class K80 extends I4{}class W80 extends I4{}class kg0 extends I4{}class fg0 extends I4{}class yg0 extends d0{props;constructor(A){super(A.key===void 0?{}:{key:A.key});this.props=A}createState(){return new Su4}}class Su4 extends m0{messageScroll=new Z$;initState(){super.initState(),this.messageScroll.followMode=!1,this.messageScroll.jumpTo(0)}dispose(){this.messageScroll.dispose(),super.dispose()}build(A){let Q=this.widget.props,$=X86(Q,this.messageScroll),B=I86(Q.options.message),E=B?new C4({actions:this.buildScrollActions(),child:new tQ({debugLabel:"SelectDialogScrollShortcuts",shortcuts:V86(),child:$})}):$,D=[{keys:["↑/↓","j/k"],label:"move"},{keys:["Enter"],label:"select"}];if(B)D.push({keys:["Ctrl+E","Ctrl+Y"],label:"scroll"});return D.push({keys:["Esc"],label:"cancel"}),new o4({header:Q.options.title,minWidth:64,maxWidth:80,footer:D,autofocus:!1,onDismiss:Q.onCancel,child:E})}buildScrollActions(){let A=(Q)=>{let $=z86(this.messageScroll.offset+Q,0,this.messageScroll.maxScrollExtent);this.messageScroll.jumpTo($)};return new Map([[_g0,new cA(()=>A(-Tu4))],[Sg0,new cA(()=>A(Tu4))],[K80,new cA(()=>A(-_u4))],[W80,new cA(()=>A(_u4))],[kg0,new cA(()=>this.messageScroll.jumpTo(0))],[fg0,new cA(()=>this.messageScroll.jumpTo(this.messageScroll.maxScrollExtent))]])}}function X86(A,Q){let $=A.options.options.map((E)=>({value:E,label:E})),B=Math.max(0,$.findIndex((E)=>E.value===A.options.initialValue));return new kX({options:$,selectedIndex:B,body:G86(A.options.message,Q),onSelect:(E)=>{if(E===null){A.onCancel();return}A.onSelect(E)},padding:n0.all(0),showBorder:!1,showDismissalMessage:!1,enableMouseInteraction:!0,wrapOptions:!0})}function I86(A){if(A===void 0)return!1;return A.split(`
4386
4386
  `).length>Tg0}function G86(A,Q){if(A===void 0)return;let $=A.split(`
4387
4387
  `).length,B=Math.min($,Tg0);return new x0({width:1/0,height:B,child:new OB({autofocus:!1,controller:Q,child:new D0({text:new h(A)})})})}function V86(){return new Map([[CA.key("PageUp"),new K80],[CA.key("PageDown"),new W80],[CA.ctrl("u"),new K80],[CA.ctrl("d"),new W80],[CA.ctrl("y"),new _g0],[CA.ctrl("e"),new Sg0],[CA.shift("Home"),new kg0],[CA.shift("End"),new fg0]])}function z86(A,Q,$){return Math.max(Q,Math.min(A,$))}var K86=3,W86=2097152,C86=new BB("PluginDialogOverlay");function C80(A,Q,$){if($!==void 0)return{type:"response",id:A,error:$};if(Q===void 0)return{type:"response",id:A};return{type:"response",id:A,result:Q}}function H86(A){let Q=new TextEncoder().encode(JSON.stringify(A)).byteLength;if(Q<=W86)return;throw Error(`thread.messages response is too large (${Q} bytes). Request fewer messages.`)}class xg0{options;unregisterPluginCommands=null;pluginCommandSubscriptions=[];pluginErrorToastKeys=new Set;activeDialog=null;queuedDialogs=[];resolvingDialog=null;pendingOwnerUIRequests=new Map;pendingActorUIRequests=new Map;stateBackedRequestIDs=new Set;pluginUIRespondRequestCounter=0;statusItems=new Map;blockingConfirmDialog=!1;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.cancelOwnerUIRequests(),this.cancelPendingDialogs(),this.statusItems.clear(),this.clearPluginPlatformStatusHandlers()}handlePluginMessage(A,Q){let $=A.message;if($.type==="response"){this.cancelOwnerUIRequest($.id),this.cancelActorUIRequest($.id);return}if($.type==="event"){if(this.handlePluginUIStateEvent($,Q))return;this.handlePluginEvent($);return}if(this.stateBackedRequestIDs.has($.id))return;if(!sB0($.method)){if($.method==="thread.messages")this.handleThreadMessagesRequest($,Q);return}this.handleOwnerUIRequest($,Q)}cancelOwnerUIRequests(){let A=[...this.pendingOwnerUIRequests.values(),...this.pendingActorUIRequests.values()];this.pendingOwnerUIRequests.clear(),this.pendingActorUIRequests.clear(),this.stateBackedRequestIDs.clear();for(let Q of A)Q.abort()}hasBlockingDialog(){return this.activeDialog!==null}hasBlockingConfirmDialog(){return this.activeDialog?.kind==="confirm"}buildDialogLayers(){let A=this.activeDialog;if(!A)return[];return[new Y$({key:C86,debugLabel:"PluginDialogOverlay",autofocus:!1,canRequestFocus:!0,child:this.buildActiveDialog(A)})]}buildActiveDialog(A){switch(A.kind){case"input":return new vl({key:new jz(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 jg0({key:new jz(A),options:A.options,onConfirm:()=>this.resolveConfirmDialog(A,!0),onCancel:()=>this.resolveConfirmDialog(A,!1)});case"select":return new yg0({key:new jz(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.context.pluginPlatform;if(!A)return;if(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.context.observerOnly?async()=>{throw Error("thread.append is only available from an executor-owned plugin runtime")}:this.options.appendToThread,this.options.readThreadMessages)A.readThreadMessagesHandler=this.readThreadMessages;A.runAgentHandler=this.options.context.observerOnly?async()=>{throw Error("agent.run is only available from an executor-owned plugin runtime")}:this.options.runAgent??(async()=>{throw Error("agent.run is not available in this context")}),A.showInputDialog=this.showInputDialog,A.showConfirmDialog=this.showConfirmDialog,A.showSelectDialog=this.showSelectDialog,A.createStatusItemHandler=this.createStatusItem,A.updateStatusItemHandler=this.updateStatusItem,A.removeStatusItemHandler=this.removeStatusItem}handlePluginEvent(A){if(A.event!=="ui.notify")return;let Q=A.data;if(typeof Q.message==="string")this.options.toastController.show(Q.message,"success")}async handleThreadMessagesRequest(A,Q){try{let{options:$,threadID:B}=this.parseThreadMessagesRequestParams(A.params),E=await this.readThreadMessages($,B);H86(E),Q(C80(A.id,E))}catch($){Q(C80(A.id,void 0,$ instanceof Error?$.message:String($)))}}parseThreadMessagesRequestParams(A){if(!A||typeof A!=="object")return{options:void 0,threadID:void 0};let Q=A;return{options:Q.options,threadID:typeof Q.threadID==="string"?Q.threadID:void 0}}async handleOwnerUIRequest(A,Q){let $=new AbortController;this.pendingOwnerUIRequests.set(A.id,$);try{let B=await this.dispatchOwnerUIRequest(A,$.signal);if(this.pendingOwnerUIRequests.get(A.id)!==$)return;this.pendingOwnerUIRequests.delete(A.id),Q(C80(A.id,B))}catch(B){if(this.pendingOwnerUIRequests.get(A.id)!==$)return;this.pendingOwnerUIRequests.delete(A.id),Q(C80(A.id,void 0,B instanceof Error?B.message:String(B)))}}dispatchOwnerUIRequest(A,Q){switch(A.method){case"ui.input":return this.showInputDialog(A.params.options,Q);case"ui.confirm":return this.showConfirmDialog(A.params.options,Q);case"ui.select":return this.showSelectDialog(A.params.options,Q);default:throw Error(`Unknown owner UI request method: ${A.method}`)}}cancelOwnerUIRequest(A){let Q=this.pendingOwnerUIRequests.get(A);if(!Q)return;this.pendingOwnerUIRequests.delete(A),Q.abort()}cancelActorUIRequest(A){let Q=this.pendingActorUIRequests.get(A);if(!Q)return;this.pendingActorUIRequests.delete(A),Q.abort()}buildPluginUIRespondRequest(A,Q,$){this.pluginUIRespondRequestCounter+=1;let B={requestId:A};if($!==void 0)B.error=$;else if(Q!==void 0)B.result=Q;return{type:"request",id:`plugin-ui-respond-${A}-${this.pluginUIRespondRequestCounter}`,method:"plugin.ui.respond",params:B}}async handleActorUIRequest(A,Q){let $=new AbortController;this.pendingActorUIRequests.set(A.requestId,$);let B={type:"request",id:A.requestId,method:A.method,params:A.params};try{let E=await this.dispatchOwnerUIRequest(B,$.signal);if(this.pendingActorUIRequests.get(A.requestId)!==$)return;this.pendingActorUIRequests.delete(A.requestId),Q(this.buildPluginUIRespondRequest(A.requestId,E))}catch(E){if(this.pendingActorUIRequests.get(A.requestId)!==$)return;this.pendingActorUIRequests.delete(A.requestId),Q(this.buildPluginUIRespondRequest(A.requestId,void 0,E instanceof Error?E.message:String(E)))}}upsertActorUIState(A,Q){if(this.stateBackedRequestIDs.add(A.requestId),A.status!=="pending"){this.cancelActorUIRequest(A.requestId);return}if(this.pendingActorUIRequests.has(A.requestId))return;this.handleActorUIRequest(A,Q)}handlePluginUISnapshot(A,Q){let $=new Set(A.requests.map((B)=>B.requestId));for(let B of this.pendingActorUIRequests.keys())if(!$.has(B))this.cancelActorUIRequest(B);for(let B of this.stateBackedRequestIDs)if(!$.has(B))this.stateBackedRequestIDs.delete(B);for(let B of A.requests)this.upsertActorUIState(B,Q)}handlePluginUIRequestAdded(A,Q){this.upsertActorUIState(A.request,Q)}handlePluginUIRequestSettled(A,Q){this.upsertActorUIState(A.request,Q)}handlePluginUIRequestRemoved(A){this.cancelActorUIRequest(A.requestId),this.stateBackedRequestIDs.delete(A.requestId)}handlePluginUIStateEvent(A,Q){if(A.event==="plugin.ui.snapshot"){let $=QZ4.safeParse(A.data);if($.success)this.handlePluginUISnapshot($.data,Q);return!0}if(A.event==="plugin.ui.request_added"){let $=$Z4.safeParse(A.data);if($.success)this.handlePluginUIRequestAdded($.data,Q);return!0}if(A.event==="plugin.ui.request_settled"){let $=BZ4.safeParse(A.data);if($.success)this.handlePluginUIRequestSettled($.data,Q);return!0}if(A.event==="plugin.ui.request_removed"){let $=EZ4.safeParse(A.data);if($.success)this.handlePluginUIRequestRemoved($.data);return!0}return!1}clearPluginPlatformStatusHandlers(){let A=this.options.context.pluginPlatform;if(!A)return;if(A.readThreadMessagesHandler===this.readThreadMessages)A.readThreadMessagesHandler=null;if(A.createStatusItemHandler===this.createStatusItem)A.createStatusItemHandler=null;if(A.updateStatusItemHandler===this.updateStatusItem)A.updateStatusItemHandler=null;if(A.removeStatusItemHandler===this.removeStatusItem)A.removeStatusItemHandler=null;if(A.runAgentHandler===this.options.runAgent)A.runAgentHandler=null}subscribePluginCommands(){let A=this.options.context.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 $=A.map((B)=>this.createPluginCommand(B)).map((B)=>this.options.commandRegistry.register(B));this.unregisterPluginCommands=()=>{for(let B of $)B()}}showNewPluginErrorToasts(A){let Q=new Set;for(let $ of A){if($.status!=="error")continue;if(Gh($.errorMessage))continue;let B=`${$.uri.toString()}
4388
- ${$.errorMessage??""}`;if(Q.add(B),this.pluginErrorToastKeys.has(B))continue;this.options.toastController.show(this.formatPluginErrorToast($),"error",8000)}this.pluginErrorToastKeys=Q}removeInactivePluginStatusItems(A){let Q=new Set(A.filter((B)=>B.status==="active").map((B)=>B.uri.toString())),$=[];for(let[B,E]of this.statusItems){if(Q.has(E.pluginURI))continue;$.push(B)}if($.length===0)return;this.updateStatusItemState(()=>{for(let B of $)this.statusItems.delete(B)})}formatPluginErrorToast(A){let Q=A.uri.toString();return`Plugin failed: ${Q.split("/").pop()??Q}. See logs: ${this.options.context.logFilePath}`}createPluginCommand(A){return{id:A.id,noun:A.category,verb:A.title,description:A.description??`Run plugin command ${A.category}: ${A.title}`,status:A.availability,run:async(Q,$,B)=>{B();try{await this.options.context.pluginService?.commands.execute(A.pluginName,A.id,{threadID:this.options.getActiveThreadID()})}catch(E){S.error("Neo plugin command failed",{error:E,command:A}),this.options.toastController.show(E instanceof Error?E.message:String(E),"error",5000)}}}}showInputDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"input",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=iG(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showConfirmDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(!1);return}let B={kind:"confirm",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=iG(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showSelectDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"select",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=iG(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};createStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{let B=this.statusItemKey(A,Q),E={pluginURI:A,id:Q};if($!==void 0)E.value=$;this.statusItems.set(B,E)})};updateStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.set(this.statusItemKey(A,Q),{pluginURI:A,id:Q,value:$})})};removeStatusItem=(A,Q)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.delete(this.statusItemKey(A,Q))})};readThreadMessages=(A,Q)=>{let $=this.options.readThreadMessages;if(!$)return Promise.reject(Error("thread.messages is not available - no active thread"));return $(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,this.emitBlockingConfirmDialogChange();for(let Q of A)this.cancelDialog(Q)}cancelDialog(A){switch(A.abortUnsubscribe(),A.kind){case"input":A.resolve(void 0);return;case"confirm":A.resolve(!1);return;case"select":A.resolve(void 0);return}}abortDialog(A){if(this.activeDialog===A){this.advanceDialog(),this.cancelDialog(A);return}let Q=this.queuedDialogs.indexOf(A);if(Q===-1)return;this.updateDialogState(()=>{this.queuedDialogs.splice(Q,1)}),this.cancelDialog(A)}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}),this.emitBlockingConfirmDialogChange()}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,A.abortUnsubscribe(),Q(),this.scheduleResolvingDialogAdvance(A,K86)}scheduleResolvingDialogAdvance(A,Q){M6.instance.addPostFrameCallback(()=>{if(this.activeDialog!==A)return;if(this.queuedDialogs.length>0||Q<=1){this.advanceResolvingDialog(A);return}this.scheduleResolvingDialogAdvance(A,Q-1)},"PluginIntegration.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();this.emitBlockingConfirmDialogChange()}emitBlockingConfirmDialogChange(){let A=this.hasBlockingConfirmDialog();if(A===this.blockingConfirmDialog)return;this.blockingConfirmDialog=A,this.options.onBlockingConfirmDialogChange?.(A)}}a0();import{spawnSync as N86}from"node:child_process";import V9 from"node:process";var ku4={options:new Set(["settings-file","log-level","log-file","mcp-config"]),booleans:new Set(["color","dangerously-allow-all","ide","jetbrains","neo-orb","notifications"])};function Tl(A){let Q=A.getRelaunchThreadIDs();if(A.onRelaunchRequested?.(Q),A.stop)A.stop();else Z1.instance.stop()}function fu4(A){return{noun:"amp",verb:"Relaunch (Quit & Reopen)",description:"Quit, reopen Amp, and resume active threads",keywords:["restart","update"],shortcut:V9.env.NODE_ENV==="development"&&V9.platform==="darwin"?CA.meta("r"):void 0,status:{type:"enabled"},sortBoost:90,run:(Q,$,B)=>{B(),Tl(A)}}}function q86(A,Q){let{command:$,args:B}=u86(A),E=V9.execve,D=V9.platform==="win32"||!E,J=D?"spawnSync":"execve";if(S.info("Relaunching Amp; threads will be resumed",{threadIDs:A,relaunchMethod:J}),D){let U=N86($,B,{cwd:Q,env:V9.env,stdio:"inherit"});if(U.error)return S.error("Failed to relaunch Amp",{error:U.error}),1;return U.status??1}try{if(V9.chdir(Q),$.includes("/"))return E($,[$,...B],V9.env);return E("/usr/bin/env",["env",$,...B],V9.env)}catch(U){return S.error("Failed to relaunch Amp",{error:U}),1}}class bg0{relaunchRequested=!1;requestedThreadIDs=[];request=(A)=>{S.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 q86(this.requestedThreadIDs,A)}}function u86(A){let Q=A.length>0?["threads","continue",...A]:[],$=w86(V9.argv),B=O86();if(B)return{command:B.command,args:[...B.args,...$,...Q]};let E=V9.argv[1],D=E&&M86(E)?[E]:[];return{command:V9.execPath,args:[...D,...$,...Q]}}function w86(A){let Q=[],$=A.slice(2);for(let B=0;B<$.length;B+=1){let E=$[B];if(!E?.startsWith("--"))continue;let[D,J]=E.split("=",2);if(!D)continue;let U=D.slice(2),Y=U.startsWith("no-")?U.slice(3):U;if(ku4.booleans.has(Y)){Q.push(E);continue}if(!ku4.options.has(U))continue;if(J!==void 0){Q.push(E);continue}let Z=$[B+1];if(Z===void 0||Z.startsWith("--"))continue;Q.push(E,Z),B+=1}return Q}function M86(A){return A!==V9.execPath&&!A.startsWith("/$bunfs/")}function O86(){if(V9.env.NODE_ENV!=="development")return null;let A=V9.env.AMP_DEV_RELAUNCH_COMMAND?.trim();if(!A)return null;let Q=L86(A),$=Q[0];if(!$)return null;return{command:$,args:Q.slice(1)}}function L86(A){if(A.startsWith("["))try{let Q=JSON.parse(A);if(Array.isArray(Q)&&Q.every(($)=>typeof $==="string"))return Q}catch{return[]}return A.split(/\s+/).filter(Boolean)}var j86=48;class hg0{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 jl({width:j86,title:"Relaunch to Update Amp",message:"Your threads will resume.",variant:"success",mouseBehavior:"click-anywhere",action:{keyboardShortcut:"Ctrl+O",command:"amp: relaunch",confirmShortcut:"Enter",label:"relaunch",onAction:()=>this.activate()}})}notifyListeners(){for(let A of this.listeners)A()}}import{readFile as R86}from"node:fs/promises";import gg0 from"node:os";A$();function P86(A=new Date){return A.toISOString().replaceAll("-","").replaceAll(":","").slice(0,15)+"Z"}async function yu4(A,Q){try{return{path:Q,contents:dk0(await R86(A,"utf8"))}}catch{return null}}async function H80(A,Q){let $=[],B=P86(),E=await z4.getThread({thread:Q},{config:A.configService}),D=E.ok?E.result.thread.data:null;$.push({path:`${B}/thread.json`,contents:JSON.stringify(iY(D),null,2)});let J=await yu4(OP(Q),`${B}/logs/${Q}.log`);if(J)$.push(J);let U=await yu4(A.settingsFilePath,`${B}/settings/global.json`);if(U)$.push(U);let Y=await rY()??"unknown",Z=await z4.sendReport({threadID:Q,files:$,metadata:{clientVersion:"0.0.1780162602-gb8f27a",clientOS:`${gg0.platform()} ${gg0.release()} ${gg0.arch()}`,installMethod:Y}},{config:A.configService});if(!Z.ok)throw Error(`Failed to submit report: ${Z.error.message}`);return Z.result.reportID}class mg0{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 $=Boolean(A);if(A)this.forwardStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.forwardStack.pop();this.backStack.push(Q)}}}startForwardNavigation(A){let Q=this.forwardStack.pop();if(!Q)return null;let $=Boolean(A);if(A)this.backStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.backStack.pop();this.forwardStack.push(Q)}}}}var v86=86400000;class dg0{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 $=(this.options.minimumOpenDurationMs??v86)-(Date.now()-this.openedAt);if($>0&&!A){if(this.relaunchNotificationPending=!0,!this.relaunchNotificationTimer)this.relaunchNotificationTimer=setTimeout(()=>{if(this.relaunchNotificationTimer=null,!this.relaunchNotificationPending)return;this.relaunchNotificationPending=!1,this.showUpdateRelaunchNotification()},$),this.relaunchNotificationTimer.unref();return}this.relaunchNotificationPending=!1,this.relaunchNotificationShown=!0,this.options.relaunchNotificationController.show(()=>Tl(this.options))}}class N80 extends O6{offstage;constructor({key:A,offstage:Q=!0,child:$}){super({key:A,child:$});this.offstage=Q}createRenderObject(){return new cg0(this.offstage)}updateRenderObject(A){if(A instanceof cg0)A.offstage=this.offstage}}class cg0 extends yA{_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;nA(!!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 $=A.constrain(Q.size.width,Q.size.height);this.setSize($.width,$.height),Q.setOffset(0,0)}else{let $=A.smallest;this.setSize($.width,$.height)}super.performLayout()}paint(A,Q,$){if(this._offstage)return;super.paint(A,Q,$)}hitTest(A,Q,$,B){if(this._offstage)return!1;return super.hitTest(A,Q,$,B)}}class _l{_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 pg0 extends d0{root;controller;constructor(A){super();this.root=A.root,this.controller=A.controller}createState(){return new xu4}}class xu4 extends m0{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 pP,$=this.makeScopedDismiss(Q);this.setState(()=>{this.entries.push({key:Q,widget:A,dismiss:$})})}pushWithDismiss(A){let Q=new pP,$=this.makeScopedDismiss(Q),B=A($);this.setState(()=>{this.entries.push({key:Q,widget:B,dismiss:$})})}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 N80({offstage:this.entries.length>0,child:this.widget.root}));for(let $=0;$<this.entries.length;$++){let B=this.entries[$],E=$===this.entries.length-1,D=E?new Y$({autofocus:!0,debugLabel:`ModalStackEntry[${$}]`,onKey:(J)=>{if(J.key!=="Escape")return"ignored";return B.dismiss(),"handled"},child:B.widget}):B.widget;Q.push(new N80({key:B.key,offstage:!E,child:D}))}return new t1({fit:"expand",children:Q})}}class ig0 extends Q4{props;constructor(A){super();this.props=A}build(A){let Q=this.props.commands.filter((E)=>E.status.type!=="hidden"),$=_86(Q),B="";return new o4({header:"Command Palette",autofocus:!1,barrierOpaque:!1,chromePadding:n0.only({left:1,top:1,right:1}),footer:"none",onDismiss:this.props.onDismiss,child:new w5({items:Q,showBorder:!1,getLabel:(E)=>{let D=lg0(E);return E.keywords&&E.keywords.length>0?`${D} ${E.keywords.join(" ").toLowerCase()}`:D},onQueryChange:(E)=>{B=E},sortItems:(E,D,J)=>{B=J;let U=J.trim().toLowerCase();if(U===""){let V=E.item.status.type==="disabled"?1:0,z=D.item.status.type==="disabled"?1:0;if(V!==z)return V-z;let K=E.item.sortBoost??0,W=D.item.sortBoost??0;if(K!==W)return W-K;let C=E.item.noun?.toLowerCase()??"",H=D.item.noun?.toLowerCase()??"";if(C!==H)return C<H?-1:1;return 0}let Y=bu4(E.item,U),Z=bu4(D.item,U);if(Y!==Z)return Y?-1:1;let F=wq(E.item.verb.toLowerCase(),J),X=wq(D.item.verb.toLowerCase(),J);if(F!==X)return X-F;let I=wq(lg0(E.item),J),G=wq(lg0(D.item),J);if(I!==G)return G-I;return D.score-E.score},isItemDisabled:(E)=>E.status.type==="disabled",buildDisabledReasonWidget:(E,D)=>{if(E.status.type!=="disabled")return;let{colors:J}=EA.of(D);return new D0({text:new h(E.status.reason,new $0({color:J.mutedForeground,dim:!0})),textAlign:"center",maxLines:1,overflow:"ellipsis"})},renderItem:(E,D,J,U)=>new hu4({command:E,isSelected:D,isDisabled:J,categoryWidth:$,query:B,buildContext:U}),onAccept:(E)=>{this.props.onAccept(E)},onDismiss:this.props.onDismiss})})}}class hu4 extends Q4{props;constructor(A){super();this.props=A}build(A){let{command:Q,isSelected:$,isDisabled:B,categoryWidth:E,query:D,buildContext:J}=this.props,U=EA.of(J),{colors:Y,app:Z}=U,F=$?Z.selectionBackground:void 0,X=$?Z.selectionForeground:Y.foreground,I=$?X:Y.mutedForeground,G=new D0({text:new h(Q.noun?.toLowerCase()??"",new $0({color:I,dim:B||!$})),textAlign:"right",maxLines:1,overflow:"ellipsis"}),V=Q.verb.toLowerCase();if(B)V+=" (unavailable)";let z=T86(Q,D);if(z)V+=` (alias: ${z})`;let K=new D0({text:new h(V,new $0({color:X,bold:!0,dim:B})),maxLines:1,overflow:"ellipsis"}),W=[{child:G,fixedWidth:E},{child:K,expanded:!0}];if(Q.shortcut)W.push({child:S86(Q.shortcut,U,B)});return new gu4({columns:W,padding:n0.horizontal(1),backgroundColor:F})}}function lg0(A){return A.noun?`${A.noun.toLowerCase()} ${A.verb.toLowerCase()}`:A.verb.toLowerCase()}function bu4(A,Q){return A.keywords?.some(($)=>$.trim().toLowerCase()===Q)??!1}function T86(A,Q){let $=Q.trim().toLowerCase();if($==="")return;return A.keywords?.find((B)=>B.trim().toLowerCase()===$)}function _86(A){return A.reduce((Q,$)=>{return $.noun?Math.max(Q,dA($.noun)):Q},0)}function S86(A,Q,$){let{app:B}=Q,E=new $0({color:B.keybind,bold:!0,dim:$}),D=[],J=PX(A.toString()).split("+");for(let U=0;U<J.length;U++){if(U>0)D.push(new h("+",E));D.push(new h(J[U],E))}return D0.spans(D)}class gu4 extends Q4{props;constructor(A){super();this.props=A}build(A){let{columns:Q,gap:$=2,padding:B,backgroundColor:E}=this.props,D=[];for(let U=0;U<Q.length;U++){let Y=Q[U];if(U>0&&$>0)D.push(new x0({width:$}));if(Y.fixedWidth!==void 0)D.push(new x0({width:Y.fixedWidth,child:Y.child}));else if(Y.expanded)D.push(new w4({child:Y.child}));else D.push(Y.child)}let J=new MA({crossAxisAlignment:"start",children:D});if(!B&&!E)return J;return new VA({decoration:E?{color:E}:void 0,padding:B,child:J})}}class ng0{#A=[];#Q=new Set;get commands(){return this.#A}register(A){return this.#A.push(A),this.#$(),()=>{let Q=this.#A.indexOf(A);if(Q===-1)return;this.#A.splice(Q,1),this.#$()}}findByID(A){return this.#A.find((Q)=>Q.id===A)}runByID(A,Q){let $=this.findByID(A);if(!$||$.status.type!=="enabled")return!1;return $.run(new _l,Q,()=>{}),!0}addListener(A){this.#Q.add(A)}removeListener(A){this.#Q.delete(A)}#$(){for(let A of this.#Q)A()}}class oB extends gQ{commandRegistry;constructor({commandRegistry:A,child:Q}){super({child:Q});this.commandRegistry=A}updateShouldNotify(A){return!1}static of(A){let Q=oB.maybeOf(A);if(!Q)throw Error("No CommandRegistryProvider found in widget tree");return Q}static maybeOf(A){return A.dependOnInheritedWidgetOfExactType(oB)?.commandRegistry??null}}class ag0 extends d0{onDismiss;constructor(A){super();this.onDismiss=A.onDismiss}createState(){return new mu4}}class mu4 extends m0{modalStack=new _l;commandRegistry=null;initState(){super.initState(),queueMicrotask(()=>{if(!this.mounted)return;let A=oB.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=oB.of(A).commands,$=new ig0({commands:Q,onAccept:(B)=>{B.run(this.modalStack,A,this.widget.onDismiss)},onDismiss:()=>{if(this.modalStack.canPop)this.modalStack.pop();else this.widget.onDismiss()}});return new pg0({root:$,controller:this.modalStack})}}var du4=[{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"]}]}],cu4=[{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 q80 extends Q4{items;renderRow;constructor({items:A,renderRow:Q}){super();this.items=A,this.renderRow=Q}build(A){let $=V4.of(A).size.width<50,B=[];for(let E of this.items){let[D,J]=this.renderRow(E),U;if($)U=new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[D,new xA({padding:n0.only({left:4}),child:J})]});else U=new MA({crossAxisAlignment:"start",children:[new w4({flex:1,child:D}),new x0({width:1}),new w4({flex:1,child:J})]});B.push(new xA({padding:n0.horizontal(6),child:U}))}return new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:B})}}function k86(A){let Q=[...A.keys];if(A.input)Q.push(A.input);return PX(Q.join("+"))}class og0 extends Q4{commands;onDismiss;constructor(A){super();this.commands=A.commands,this.onDismiss=A.onDismiss}build(A){let Q=EA.of(A),{colors:$,app:B}=Q,E=V4.of(A),D=new $0({color:$.secondary,bold:!0}),J=new $0({color:B.keybind}),U=new $0({color:B.command}),Y=new $0({color:$.foreground}),Z=Math.max(40,Math.min(80,E.size.width-4)),X=[...this.commands.filter((V)=>{let z=V.noun?.toLowerCase();return z!=="dev"&&z!=="debug"&&V.status.type!=="hidden"})].sort((V,z)=>{let K=(V.noun??"").toLowerCase(),W=(z.noun??"").toLowerCase(),C=K.localeCompare(W);if(C!==0)return C;return V.verb.toLowerCase().localeCompare(z.verb.toLowerCase())}),I=(V)=>{let z=V.methods.map((K)=>k86(K)).join(", ");return[new D0({text:new h(z,J)}),new D0({text:new h(V.description,Y)})]},G=new OB({autofocus:!0,child:new VA({constraints:new U4(Z,Z,0,Number.POSITIVE_INFINITY),child:new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[new xA({padding:n0.horizontal(2),child:new D0({text:new h(`Editor Shortcuts
4388
+ ${$.errorMessage??""}`;if(Q.add(B),this.pluginErrorToastKeys.has(B))continue;this.options.toastController.show(this.formatPluginErrorToast($),"error",8000)}this.pluginErrorToastKeys=Q}removeInactivePluginStatusItems(A){let Q=new Set(A.filter((B)=>B.status==="active").map((B)=>B.uri.toString())),$=[];for(let[B,E]of this.statusItems){if(Q.has(E.pluginURI))continue;$.push(B)}if($.length===0)return;this.updateStatusItemState(()=>{for(let B of $)this.statusItems.delete(B)})}formatPluginErrorToast(A){let Q=A.uri.toString();return`Plugin failed: ${Q.split("/").pop()??Q}. See logs: ${this.options.context.logFilePath}`}createPluginCommand(A){return{id:A.id,noun:A.category,verb:A.title,description:A.description??`Run plugin command ${A.category}: ${A.title}`,status:A.availability,run:async(Q,$,B)=>{B();try{await this.options.context.pluginService?.commands.execute(A.pluginName,A.id,{threadID:this.options.getActiveThreadID()})}catch(E){S.error("Neo plugin command failed",{error:E,command:A}),this.options.toastController.show(E instanceof Error?E.message:String(E),"error",5000)}}}}showInputDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"input",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=iG(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showConfirmDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(!1);return}let B={kind:"confirm",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=iG(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showSelectDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"select",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=iG(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};createStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{let B=this.statusItemKey(A,Q),E={pluginURI:A,id:Q};if($!==void 0)E.value=$;this.statusItems.set(B,E)})};updateStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.set(this.statusItemKey(A,Q),{pluginURI:A,id:Q,value:$})})};removeStatusItem=(A,Q)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.delete(this.statusItemKey(A,Q))})};readThreadMessages=(A,Q)=>{let $=this.options.readThreadMessages;if(!$)return Promise.reject(Error("thread.messages is not available - no active thread"));return $(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,this.emitBlockingConfirmDialogChange();for(let Q of A)this.cancelDialog(Q)}cancelDialog(A){switch(A.abortUnsubscribe(),A.kind){case"input":A.resolve(void 0);return;case"confirm":A.resolve(!1);return;case"select":A.resolve(void 0);return}}abortDialog(A){if(this.activeDialog===A){this.advanceDialog(),this.cancelDialog(A);return}let Q=this.queuedDialogs.indexOf(A);if(Q===-1)return;this.updateDialogState(()=>{this.queuedDialogs.splice(Q,1)}),this.cancelDialog(A)}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}),this.emitBlockingConfirmDialogChange()}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,A.abortUnsubscribe(),Q(),this.scheduleResolvingDialogAdvance(A,K86)}scheduleResolvingDialogAdvance(A,Q){M6.instance.addPostFrameCallback(()=>{if(this.activeDialog!==A)return;if(this.queuedDialogs.length>0||Q<=1){this.advanceResolvingDialog(A);return}this.scheduleResolvingDialogAdvance(A,Q-1)},"PluginIntegration.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();this.emitBlockingConfirmDialogChange()}emitBlockingConfirmDialogChange(){let A=this.hasBlockingConfirmDialog();if(A===this.blockingConfirmDialog)return;this.blockingConfirmDialog=A,this.options.onBlockingConfirmDialogChange?.(A)}}a0();import{spawnSync as N86}from"node:child_process";import V9 from"node:process";var ku4={options:new Set(["settings-file","log-level","log-file","mcp-config"]),booleans:new Set(["color","dangerously-allow-all","ide","jetbrains","neo-orb","notifications"])};function Tl(A){let Q=A.getRelaunchThreadIDs();if(A.onRelaunchRequested?.(Q),A.stop)A.stop();else Z1.instance.stop()}function fu4(A){return{noun:"amp",verb:"Relaunch (Quit & Reopen)",description:"Quit, reopen Amp, and resume active threads",keywords:["restart","update"],shortcut:V9.env.NODE_ENV==="development"&&V9.platform==="darwin"?CA.meta("r"):void 0,status:{type:"enabled"},sortBoost:90,run:(Q,$,B)=>{B(),Tl(A)}}}function q86(A,Q){let{command:$,args:B}=u86(A),E=V9.execve,D=V9.platform==="win32"||!E,J=D?"spawnSync":"execve";if(S.info("Relaunching Amp; threads will be resumed",{threadIDs:A,relaunchMethod:J}),D){let U=N86($,B,{cwd:Q,env:V9.env,stdio:"inherit"});if(U.error)return S.error("Failed to relaunch Amp",{error:U.error}),1;return U.status??1}try{if(V9.chdir(Q),$.includes("/"))return E($,[$,...B],V9.env);return E("/usr/bin/env",["env",$,...B],V9.env)}catch(U){return S.error("Failed to relaunch Amp",{error:U}),1}}class bg0{relaunchRequested=!1;requestedThreadIDs=[];request=(A)=>{S.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 q86(this.requestedThreadIDs,A)}}function u86(A){let Q=A.length>0?["threads","continue",...A]:[],$=w86(V9.argv),B=O86();if(B)return{command:B.command,args:[...B.args,...$,...Q]};let E=V9.argv[1],D=E&&M86(E)?[E]:[];return{command:V9.execPath,args:[...D,...$,...Q]}}function w86(A){let Q=[],$=A.slice(2);for(let B=0;B<$.length;B+=1){let E=$[B];if(!E?.startsWith("--"))continue;let[D,J]=E.split("=",2);if(!D)continue;let U=D.slice(2),Y=U.startsWith("no-")?U.slice(3):U;if(ku4.booleans.has(Y)){Q.push(E);continue}if(!ku4.options.has(U))continue;if(J!==void 0){Q.push(E);continue}let Z=$[B+1];if(Z===void 0||Z.startsWith("--"))continue;Q.push(E,Z),B+=1}return Q}function M86(A){return A!==V9.execPath&&!A.startsWith("/$bunfs/")}function O86(){if(V9.env.NODE_ENV!=="development")return null;let A=V9.env.AMP_DEV_RELAUNCH_COMMAND?.trim();if(!A)return null;let Q=L86(A),$=Q[0];if(!$)return null;return{command:$,args:Q.slice(1)}}function L86(A){if(A.startsWith("["))try{let Q=JSON.parse(A);if(Array.isArray(Q)&&Q.every(($)=>typeof $==="string"))return Q}catch{return[]}return A.split(/\s+/).filter(Boolean)}var j86=48;class hg0{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 jl({width:j86,title:"Relaunch to Update Amp",message:"Your threads will resume.",variant:"success",mouseBehavior:"click-anywhere",action:{keyboardShortcut:"Ctrl+O",command:"amp: relaunch",confirmShortcut:"Enter",label:"relaunch",onAction:()=>this.activate()}})}notifyListeners(){for(let A of this.listeners)A()}}import{readFile as R86}from"node:fs/promises";import gg0 from"node:os";A$();function P86(A=new Date){return A.toISOString().replaceAll("-","").replaceAll(":","").slice(0,15)+"Z"}async function yu4(A,Q){try{return{path:Q,contents:dk0(await R86(A,"utf8"))}}catch{return null}}async function H80(A,Q){let $=[],B=P86(),E=await z4.getThread({thread:Q},{config:A.configService}),D=E.ok?E.result.thread.data:null;$.push({path:`${B}/thread.json`,contents:JSON.stringify(iY(D),null,2)});let J=await yu4(OP(Q),`${B}/logs/${Q}.log`);if(J)$.push(J);let U=await yu4(A.settingsFilePath,`${B}/settings/global.json`);if(U)$.push(U);let Y=await rY()??"unknown",Z=await z4.sendReport({threadID:Q,files:$,metadata:{clientVersion:"0.0.1780172352-gac8e8a",clientOS:`${gg0.platform()} ${gg0.release()} ${gg0.arch()}`,installMethod:Y}},{config:A.configService});if(!Z.ok)throw Error(`Failed to submit report: ${Z.error.message}`);return Z.result.reportID}class mg0{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 $=Boolean(A);if(A)this.forwardStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.forwardStack.pop();this.backStack.push(Q)}}}startForwardNavigation(A){let Q=this.forwardStack.pop();if(!Q)return null;let $=Boolean(A);if(A)this.backStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.backStack.pop();this.forwardStack.push(Q)}}}}var v86=86400000;class dg0{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 $=(this.options.minimumOpenDurationMs??v86)-(Date.now()-this.openedAt);if($>0&&!A){if(this.relaunchNotificationPending=!0,!this.relaunchNotificationTimer)this.relaunchNotificationTimer=setTimeout(()=>{if(this.relaunchNotificationTimer=null,!this.relaunchNotificationPending)return;this.relaunchNotificationPending=!1,this.showUpdateRelaunchNotification()},$),this.relaunchNotificationTimer.unref();return}this.relaunchNotificationPending=!1,this.relaunchNotificationShown=!0,this.options.relaunchNotificationController.show(()=>Tl(this.options))}}class N80 extends O6{offstage;constructor({key:A,offstage:Q=!0,child:$}){super({key:A,child:$});this.offstage=Q}createRenderObject(){return new cg0(this.offstage)}updateRenderObject(A){if(A instanceof cg0)A.offstage=this.offstage}}class cg0 extends yA{_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;nA(!!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 $=A.constrain(Q.size.width,Q.size.height);this.setSize($.width,$.height),Q.setOffset(0,0)}else{let $=A.smallest;this.setSize($.width,$.height)}super.performLayout()}paint(A,Q,$){if(this._offstage)return;super.paint(A,Q,$)}hitTest(A,Q,$,B){if(this._offstage)return!1;return super.hitTest(A,Q,$,B)}}class _l{_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 pg0 extends d0{root;controller;constructor(A){super();this.root=A.root,this.controller=A.controller}createState(){return new xu4}}class xu4 extends m0{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 pP,$=this.makeScopedDismiss(Q);this.setState(()=>{this.entries.push({key:Q,widget:A,dismiss:$})})}pushWithDismiss(A){let Q=new pP,$=this.makeScopedDismiss(Q),B=A($);this.setState(()=>{this.entries.push({key:Q,widget:B,dismiss:$})})}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 N80({offstage:this.entries.length>0,child:this.widget.root}));for(let $=0;$<this.entries.length;$++){let B=this.entries[$],E=$===this.entries.length-1,D=E?new Y$({autofocus:!0,debugLabel:`ModalStackEntry[${$}]`,onKey:(J)=>{if(J.key!=="Escape")return"ignored";return B.dismiss(),"handled"},child:B.widget}):B.widget;Q.push(new N80({key:B.key,offstage:!E,child:D}))}return new t1({fit:"expand",children:Q})}}class ig0 extends Q4{props;constructor(A){super();this.props=A}build(A){let Q=this.props.commands.filter((E)=>E.status.type!=="hidden"),$=_86(Q),B="";return new o4({header:"Command Palette",autofocus:!1,barrierOpaque:!1,chromePadding:n0.only({left:1,top:1,right:1}),footer:"none",onDismiss:this.props.onDismiss,child:new w5({items:Q,showBorder:!1,getLabel:(E)=>{let D=lg0(E);return E.keywords&&E.keywords.length>0?`${D} ${E.keywords.join(" ").toLowerCase()}`:D},onQueryChange:(E)=>{B=E},sortItems:(E,D,J)=>{B=J;let U=J.trim().toLowerCase();if(U===""){let V=E.item.status.type==="disabled"?1:0,z=D.item.status.type==="disabled"?1:0;if(V!==z)return V-z;let K=E.item.sortBoost??0,W=D.item.sortBoost??0;if(K!==W)return W-K;let C=E.item.noun?.toLowerCase()??"",H=D.item.noun?.toLowerCase()??"";if(C!==H)return C<H?-1:1;return 0}let Y=bu4(E.item,U),Z=bu4(D.item,U);if(Y!==Z)return Y?-1:1;let F=wq(E.item.verb.toLowerCase(),J),X=wq(D.item.verb.toLowerCase(),J);if(F!==X)return X-F;let I=wq(lg0(E.item),J),G=wq(lg0(D.item),J);if(I!==G)return G-I;return D.score-E.score},isItemDisabled:(E)=>E.status.type==="disabled",buildDisabledReasonWidget:(E,D)=>{if(E.status.type!=="disabled")return;let{colors:J}=EA.of(D);return new D0({text:new h(E.status.reason,new $0({color:J.mutedForeground,dim:!0})),textAlign:"center",maxLines:1,overflow:"ellipsis"})},renderItem:(E,D,J,U)=>new hu4({command:E,isSelected:D,isDisabled:J,categoryWidth:$,query:B,buildContext:U}),onAccept:(E)=>{this.props.onAccept(E)},onDismiss:this.props.onDismiss})})}}class hu4 extends Q4{props;constructor(A){super();this.props=A}build(A){let{command:Q,isSelected:$,isDisabled:B,categoryWidth:E,query:D,buildContext:J}=this.props,U=EA.of(J),{colors:Y,app:Z}=U,F=$?Z.selectionBackground:void 0,X=$?Z.selectionForeground:Y.foreground,I=$?X:Y.mutedForeground,G=new D0({text:new h(Q.noun?.toLowerCase()??"",new $0({color:I,dim:B||!$})),textAlign:"right",maxLines:1,overflow:"ellipsis"}),V=Q.verb.toLowerCase();if(B)V+=" (unavailable)";let z=T86(Q,D);if(z)V+=` (alias: ${z})`;let K=new D0({text:new h(V,new $0({color:X,bold:!0,dim:B})),maxLines:1,overflow:"ellipsis"}),W=[{child:G,fixedWidth:E},{child:K,expanded:!0}];if(Q.shortcut)W.push({child:S86(Q.shortcut,U,B)});return new gu4({columns:W,padding:n0.horizontal(1),backgroundColor:F})}}function lg0(A){return A.noun?`${A.noun.toLowerCase()} ${A.verb.toLowerCase()}`:A.verb.toLowerCase()}function bu4(A,Q){return A.keywords?.some(($)=>$.trim().toLowerCase()===Q)??!1}function T86(A,Q){let $=Q.trim().toLowerCase();if($==="")return;return A.keywords?.find((B)=>B.trim().toLowerCase()===$)}function _86(A){return A.reduce((Q,$)=>{return $.noun?Math.max(Q,dA($.noun)):Q},0)}function S86(A,Q,$){let{app:B}=Q,E=new $0({color:B.keybind,bold:!0,dim:$}),D=[],J=PX(A.toString()).split("+");for(let U=0;U<J.length;U++){if(U>0)D.push(new h("+",E));D.push(new h(J[U],E))}return D0.spans(D)}class gu4 extends Q4{props;constructor(A){super();this.props=A}build(A){let{columns:Q,gap:$=2,padding:B,backgroundColor:E}=this.props,D=[];for(let U=0;U<Q.length;U++){let Y=Q[U];if(U>0&&$>0)D.push(new x0({width:$}));if(Y.fixedWidth!==void 0)D.push(new x0({width:Y.fixedWidth,child:Y.child}));else if(Y.expanded)D.push(new w4({child:Y.child}));else D.push(Y.child)}let J=new MA({crossAxisAlignment:"start",children:D});if(!B&&!E)return J;return new VA({decoration:E?{color:E}:void 0,padding:B,child:J})}}class ng0{#A=[];#Q=new Set;get commands(){return this.#A}register(A){return this.#A.push(A),this.#$(),()=>{let Q=this.#A.indexOf(A);if(Q===-1)return;this.#A.splice(Q,1),this.#$()}}findByID(A){return this.#A.find((Q)=>Q.id===A)}runByID(A,Q){let $=this.findByID(A);if(!$||$.status.type!=="enabled")return!1;return $.run(new _l,Q,()=>{}),!0}addListener(A){this.#Q.add(A)}removeListener(A){this.#Q.delete(A)}#$(){for(let A of this.#Q)A()}}class oB extends gQ{commandRegistry;constructor({commandRegistry:A,child:Q}){super({child:Q});this.commandRegistry=A}updateShouldNotify(A){return!1}static of(A){let Q=oB.maybeOf(A);if(!Q)throw Error("No CommandRegistryProvider found in widget tree");return Q}static maybeOf(A){return A.dependOnInheritedWidgetOfExactType(oB)?.commandRegistry??null}}class ag0 extends d0{onDismiss;constructor(A){super();this.onDismiss=A.onDismiss}createState(){return new mu4}}class mu4 extends m0{modalStack=new _l;commandRegistry=null;initState(){super.initState(),queueMicrotask(()=>{if(!this.mounted)return;let A=oB.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=oB.of(A).commands,$=new ig0({commands:Q,onAccept:(B)=>{B.run(this.modalStack,A,this.widget.onDismiss)},onDismiss:()=>{if(this.modalStack.canPop)this.modalStack.pop();else this.widget.onDismiss()}});return new pg0({root:$,controller:this.modalStack})}}var du4=[{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"]}]}],cu4=[{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 q80 extends Q4{items;renderRow;constructor({items:A,renderRow:Q}){super();this.items=A,this.renderRow=Q}build(A){let $=V4.of(A).size.width<50,B=[];for(let E of this.items){let[D,J]=this.renderRow(E),U;if($)U=new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[D,new xA({padding:n0.only({left:4}),child:J})]});else U=new MA({crossAxisAlignment:"start",children:[new w4({flex:1,child:D}),new x0({width:1}),new w4({flex:1,child:J})]});B.push(new xA({padding:n0.horizontal(6),child:U}))}return new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:B})}}function k86(A){let Q=[...A.keys];if(A.input)Q.push(A.input);return PX(Q.join("+"))}class og0 extends Q4{commands;onDismiss;constructor(A){super();this.commands=A.commands,this.onDismiss=A.onDismiss}build(A){let Q=EA.of(A),{colors:$,app:B}=Q,E=V4.of(A),D=new $0({color:$.secondary,bold:!0}),J=new $0({color:B.keybind}),U=new $0({color:B.command}),Y=new $0({color:$.foreground}),Z=Math.max(40,Math.min(80,E.size.width-4)),X=[...this.commands.filter((V)=>{let z=V.noun?.toLowerCase();return z!=="dev"&&z!=="debug"&&V.status.type!=="hidden"})].sort((V,z)=>{let K=(V.noun??"").toLowerCase(),W=(z.noun??"").toLowerCase(),C=K.localeCompare(W);if(C!==0)return C;return V.verb.toLowerCase().localeCompare(z.verb.toLowerCase())}),I=(V)=>{let z=V.methods.map((K)=>k86(K)).join(", ");return[new D0({text:new h(z,J)}),new D0({text:new h(V.description,Y)})]},G=new OB({autofocus:!0,child:new VA({constraints:new U4(Z,Z,0,Number.POSITIVE_INFINITY),child:new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[new xA({padding:n0.horizontal(2),child:new D0({text:new h(`Editor Shortcuts
4389
4389
  `,D)})}),new q80({items:du4.filter((V)=>V.submitOnEnterOnly===void 0||V.submitOnEnterOnly===!0),renderRow:I}),new x0({height:1}),new xA({padding:n0.horizontal(2),child:new D0({text:new h(`Scrolling & Navigation
4390
4390
  `,D)})}),new q80({items:cu4,renderRow:I}),new x0({height:1}),new xA({padding:n0.horizontal(2),child:new D0({text:new h(`Command Palette Commands
4391
4391
  `,D)})}),new q80({items:X,renderRow:(V)=>{let z=V.noun?`${V.noun}: ${V.verb}`:V.verb;return[new D0({text:new h(z,U)}),new D0({text:new h(V.description,Y)})]}}),new x0({height:1})]})})});return new o4({header:"Amp CLI — Help & Keyboard Shortcuts",minWidth:Z,maxWidth:Z,maxHeight:E.size.height,autofocus:!1,footer:[{keys:["Esc"],label:"close"},{keys:["↑↓","j/k"],label:"scroll"}],onDismiss:this.onDismiss,child:G})}}class Hv extends gQ{completionBuilder;constructor({completionBuilder:A,child:Q}){super({child:Q});this.completionBuilder=A}updateShouldNotify(A){return!1}static of(A){let Q=A.dependOnInheritedWidgetOfExactType(Hv);if(!Q)throw Error("No CompletionBuilderProvider found in widget tree");return Q.completionBuilder}}var f86=250,y86=2000;class rg0 extends d0{configReloadEvents;toastController;child;constructor(A){super();this.configReloadEvents=A.configReloadEvents,this.toastController=A.toastController,this.child=A.child}createState(){return new pu4}}class pu4 extends m0{subscription=null;toastTimer=null;pendingToastType=null;lastToast=null;initState(){this.subscribeToConfigReloadEvents()}didUpdateWidget(A){if(A.configReloadEvents===this.widget.configReloadEvents)return;this.clearPendingToast(),this.subscribeToConfigReloadEvents()}dispose(){this.subscription?.unsubscribe(),this.subscription=null,this.clearPendingToast(),super.dispose()}build(A){return this.widget.child}subscribeToConfigReloadEvents(){this.subscription?.unsubscribe(),this.subscription=this.widget.configReloadEvents.subscribe((A)=>{this.scheduleToast(A)})}scheduleToast(A){if(this.pendingToastType=x86(this.pendingToastType,A),this.toastTimer)clearTimeout(this.toastTimer);this.toastTimer=setTimeout(()=>{if(!this.mounted)return;this.flushToast()},f86),this.toastTimer.unref()}flushToast(){let A=this.pendingToastType;if(this.clearPendingToast(),!A)return;let Q=Date.now();if(b86(this.lastToast,A,Q))return;this.lastToast={type:A,shownAt:Q},h86(this.widget.toastController,A)}clearPendingToast(){if(this.toastTimer)clearTimeout(this.toastTimer),this.toastTimer=null;this.pendingToastType=null}}function x86(A,Q){return A==="failed"||Q.type==="failed"?"failed":"succeeded"}function b86(A,Q,$){return A?.type===Q&&$-A.shownAt<y86}function h86(A,Q){switch(Q){case"succeeded":A.show("Config reloaded","success",1500);break;case"failed":A.show("Config reload failed","error",5000);break}}class WQ extends gQ{context;constructor({context:A,child:Q}){super({child:Q});this.context=A}updateShouldNotify(A){return!1}static of(A){let Q=A.dependOnInheritedWidgetOfExactType(WQ);if(!Q)throw Error("No ContextProvider found in widget tree");return Q.context}}a0();f8();var w80=80,g86=13,m86=1,lu4=-w80,d86=16,c86=Eb0(w80,w80);function iu4({ampURL:A,threadID:Q,logPath:$}){return[`Debug thread ${yG(new URL(A),Q).toString()} (cli log: ${$}). Start with the CLI log, actor logs, and Rivet DB/inspector as sources of truth. Read thread-actors/docs/debugging-actors.md and thread-actors/scripts/README.md. For dev, actor logs are in .amp/in/thread-actors.json.log; for staging/prod, logs are in gcloud.`,"","Problem: "].join(`
@@ -4472,7 +4472,7 @@ Ctrl-X, Y, Z to unlock`;if(this.widget.centerContent)R=this.widget.centerContent
4472
4472
  `));if(U.tools.length===0)J.push(new h(` └─ No tools available
4473
4473
  `,E));else for(let F of U.tools)_Z6(J,F,$);J.push(new h(`
4474
4474
  `))}return J}function _Z6(A,Q,$){let{colors:B,app:E}=$,D=SZ6(Q.status,$);if(A.push(new h(` ${D.icon} `,new $0({color:D.color}))),A.push(new h(Q.name,new $0({color:Q.status==="pending"?B.warning:E.command}))),Q.status==="pending")A.push(new h(" discovering...",new $0({color:B.foreground,dim:!0})));else if(Q.description)A.push(new h(` ${aj4(Q.description,50)}`,new $0({color:B.foreground,dim:!0})));if(Q.error)A.push(new h(` ${aj4(Q.error,40)}`,new $0({color:E.toolError})));A.push(new h(`
4475
- `))}function SZ6(A,Q){let{colors:$,app:B}=Q;switch(A){case"pending":return{icon:"◌",color:$.warning};case"registered":return{icon:"•",color:$.mutedForeground};case"failed":return{icon:"✗",color:B.toolError};case"duplicate":return{icon:"◇",color:$.warning};default:return{icon:"?",color:$.foreground}}}function aj4(A,Q){let $=A.replace(/\s+/g," ").trim();if(dA($)<=Q)return $;let B="...",E=dA(B);if(Q<=E)return o7(B,Q);return`${o7($,Q-E,!0,"")}${B}`}var Lc0="https://ampcode.com/news/neo",jc0=[{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:Lc0,href:Lc0}]}];function kZ6(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:Lc0,textAfter:" you'll need to switch to the binary install:",linkWidget:!0},"",{codeBlock:["npm uninstall -g @sourcegraph/amp",A]}]}]}function fZ6(){if(process.platform==="win32")return'powershell -c "irm https://ampcode.com/install.ps1 | iex"';return"curl -fsSL https://ampcode.com/install.sh | bash"}var fv=50,lq=40,Mc0=1000,yZ6=420,xZ6=760,bZ6=-250,hZ6=1100,O90=33,tj4=0.999,gZ6=2.1,mZ6=720,dZ6=420,JR4="Meet the new",UR4="Amp",YR4="CLI",Rc0=A4(JR4).length,cZ6=A4(UR4).length,pZ6=A4(YR4).length,L90={primary:{r:140,g:38,b:0},secondary:{r:255,g:225,b:102}},ej4={primary:{r:10,g:42,b:18},secondary:{r:200,g:230,b:68}},AR4={primary:{r:18,g:0,b:107},secondary:{r:103,g:255,b:168}},QR4=[L90,ej4,AR4,L90,ej4,AR4,L90],lZ6=L90;class Pc0 extends d0{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??fZ6(),this.introStages=this.variant==="npm-migration"?kZ6(this.binaryInstallCommand):jc0,this.dismissible=this.variant!=="npm-migration"}createState(){return new ZR4}}class ZR4 extends m0{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=Mc0;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 O5(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=RE(this.widget.animationProgress),this.firstStageTitleVisible=this.animationProgress>=tj4,this.firstStageHintVisible=this.animationProgress>=tj4,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:Mc0,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=RE(A/xZ6);if(this.setState(()=>{this.dismissProgress=Q}),Q>=1)this.stopDismissAnimation(),this.widget.onDismiss()},O90)}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 $=performance.now()-this.stageTransitionStartedAt,B=RE($/yZ6);if(this.setState(()=>{if(this.stageTransitionProgress=B,B>=1)this.previousIntroStage=null}),B>=1)this.stopStageTransitionTimer()},O90)}startProgressAnimation({from:A,to:Q,durationMs:$,onComplete:B}){this.stopAnimation(),this.startedAt=performance.now(),this.animationStartProgress=A,this.animationTargetProgress=Q,this.animationDurationMs=$,this.onAnimationComplete=B,this.animationProgress=A,this.animationTimer=setInterval(()=>{let E=performance.now()-this.startedAt,D=RE(E/this.animationDurationMs),J=this.animationStartProgress+(this.animationTargetProgress-this.animationStartProgress)*yv(D);if(this.setState(()=>{this.animationProgress=J}),D>=1)this.stopAnimation(),this.onAnimationComplete?.(),this.onAnimationComplete=null},O90)}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,Mc0+bZ6),Q=A+hZ6;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?RE((A-this.firstStageTitleRevealStartedAt)/mZ6):this.firstStageTitleRevealProgress,$=this.firstStageHintRevealStartedAt?RE((A-this.firstStageHintRevealStartedAt)/dZ6):this.firstStageHintRevealProgress;if(this.setState(()=>{this.firstStageTitleRevealProgress=Q,this.firstStageHintRevealProgress=$}),Q>=1&&$>=1)this.stopFirstStageRevealTimer()},O90)}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=$R4(this.introStage),Q=this.previousIntroStage===null||this.stageTransitionProgress>=1?A:BR4($R4(this.previousIntroStage),A,yv(this.stageTransitionProgress));return this.dismissProgress>0?BR4(Q,lZ6,yv(this.dismissProgress)):Q}build(A){let Q=S4.of(A).colorScheme,$=EA.of(A),B=this.currentOrbPalette(),E=J7(1,"deep",B),D=V4.of(A).size,U=this.widget.animationProgress??this.animationProgress,Y=Math.max(D.width/fv,D.height/lq)*gZ6,Z=Y+(1-Y)*U,F=yv(this.dismissProgress),X=Math.max(fv,Math.round(fv*Z)),I=Math.max(lq,Math.round(lq*Z)),G=Math.round((D.width-X)/2),V=Math.round((D.height-I)/2),z=Math.max(0,Math.floor((D.width-fv)/2)),K=-Math.floor(lq/2),W=Math.round(G+(z-G)*U),C=Math.round(V+(K-V)*U),H=W+X/2,N=C+I/2,q=iZ6({dismissProgress:this.dismissProgress,easedDismissProgress:F,introOrbScale:Z,normalOrbCenterX:H,normalOrbCenterY:N,size:D}),w=Math.max(fv,Math.round(fv*q.orbScale)),L=Math.max(lq,Math.round(lq*q.orbScale)),R=q.orbCenterX,_=q.orbCenterY,P=Math.round(R-w/2),f=Math.round(_-L/2),m=Math.max(3,Math.min(D.height-5,Math.floor(lq/2)+2)),y=Math.max(m+3,D.height-3),T=q.textDissolveProgress,k=this.isFinalIntroStage()?q.backdropDissolveProgress:0,c=this.firstStageTitleVisible&&T<1,d=c&&this.firstStageHintVisible,b=d&&this.widget.dismissible&&this.introStage>0&&!this.isFinalIntroStage(),p=this.introStage===0?this.firstStageTitleRevealProgress:1,n=this.introStage===0?this.firstStageHintRevealProgress:1,s=Math.max(24,Math.min(74,D.width-4)),I0=Math.min(12,Math.max(8,D.height-m-6)),E0=Math.max(0,Math.floor((D.width-s)/2)),G0=Math.max(0,Math.min(D.height-I0,Math.floor(D.height*0.55-I0/2))),q0=this.widget.animationProgress!==void 0||!this.widget.animationsEnabled?new lz({width:w,height:L,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,seed:42,fps:0,onClick:()=>{}}):new lz({width:w,height:L,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,onClick:()=>{}});return new Y$({autofocus:!0,canRequestFocus:!0,debugLabel:"WelcomeTakeover",onKey:(t)=>{if(t.key==="Enter")return this.advanceIntroStage(),"handled";if(!this.widget.dismissible&&t.key==="c"&&t.ctrlKey)return this.widget.onQuit?.(),"handled";if(!this.widget.dismissible&&t.key==="q")return this.widget.onQuit?.(),"handled";if((t.key===" "||t.key==="Space")&&!this.isFinalIntroStage())return this.advanceIntroStage(),"handled";if(t.key==="Escape"||t.key==="Esc"){if(!this.widget.dismissible)return this.widget.onQuit?.(),"handled";return this.dismissFromFinalIntroStage()?"handled":"ignored"}if(t.key==="ArrowRight")return this.nextIntroStage(),"handled";if(t.key==="ArrowLeft")return this.goToPreviousIntroStage(),"handled";return"ignored"},child:new t1({fit:"expand",children:[new FR4({color:Q.background,dissolveProgress:k}),new t1({fit:"expand",children:[new aA({onClick:()=>{},child:x0.expand()}),new a1({left:P,top:f,width:w,height:L,child:q0}),...c?[new a1({left:E0,top:G0,width:s,height:I0,child:aZ6({introStages:this.widget.introStages,stage:this.introStage,previousStage:this.previousIntroStage,progress:this.stageTransitionProgress,direction:this.stageTransitionDirection,width:s,height:I0,foreground:Q.foreground,mutedForeground:Q.mutedForeground,accent:E,link:$.app.link,keybind:$.app.keybind,titleRevealProgress:p,dissolveProgress:T,context:A})})]:[],...d?[...b?[new a1({left:E0,top:Math.max(0,y-1),width:s,height:1,child:new D0({text:AF6({stage:this.introStage,featureStageCount:Math.max(0,this.widget.introStages.length-2),foreground:Q.mutedForeground,dissolveProgress:T}),textAlign:"center"})})]:[],new a1({left:E0,top:y,width:s,height:1,child:$F6({finalStage:this.isFinalIntroStage(),dismissible:this.widget.dismissible,foreground:Q.mutedForeground,keybind:$.app.keybind,revealProgress:n,dissolveProgress:T,context:A})})]:[]]})]})})}}class FR4 extends EB{color;dissolveProgress;constructor({color:A,dissolveProgress:Q}){super();this.color=A,this.dissolveProgress=Q}createRenderObject(){return new XR4(this.color,this.dissolveProgress)}updateRenderObject(A){A.update(this.color,this.dissolveProgress)}}class XR4 extends yA{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;nA(!!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,$=0){let B=Math.floor(Q+this.offset.x),E=Math.floor($+this.offset.y),D=Math.floor(this.size.width),J=Math.floor(this.size.height),U={bg:this.color},Y=RE(this.dissolveProgress);if(Y<=0){A.fill(B,E,D,J," ",U);return}if(Y>=1)return;for(let Z=0;Z<J;Z++)for(let F=0;F<D;F++)if(!nZ6(F,Z,D,J,Y))A.fill(B+F,E+Z,1,1," ",U)}}function RE(A){return Math.min(1,Math.max(0,A))}function yv(A){return 1-(1-A)**3}function $R4(A){return QR4[A]??QR4[0]}function BR4(A,Q,$){return{primary:Mq(A.primary,Q.primary,$),secondary:Mq(A.secondary,Q.secondary,$)}}function iZ6({dismissProgress:A,easedDismissProgress:Q,introOrbScale:$,normalOrbCenterX:B,normalOrbCenterY:E,size:D}){return{orbScale:$+($*0.86-$)*Q,orbCenterX:B+(D.width*0.54-B)*Q,orbCenterY:E-D.height*0.44*Q,textDissolveProgress:RE(A/0.52),backdropDissolveProgress:yv(RE((A-0.12)/0.88))}}function nZ6(A,Q,$,B,E){let D=B<=1?0:Q/(B-1),J=IR4(A+Q*Math.max(1,$));return(1-D)*0.72+J*0.28<E}function aZ6({introStages:A,stage:Q,previousStage:$,progress:B,direction:E,width:D,height:J,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V}){if($===null||B>=1)return Oc0({introStages:A,stage:Q,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V});let z=yv(B),K=E*Math.round((1-z)*D),W=-E*Math.round(z*D);return new Zq(new t1({fit:"expand",children:[new a1({left:W,top:0,width:D,height:J,child:Oc0({introStages:A,stage:$,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:$===0?1:I,dissolveProgress:G,context:V})}),new a1({left:K,top:0,width:D,height:J,child:Oc0({introStages:A,stage:Q,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V})})]}))}function Oc0({introStages:A,stage:Q,foreground:$,mutedForeground:B,accent:E,link:D,keybind:J,titleRevealProgress:U,dissolveProgress:Y,context:Z}){let F=A[Q]??A[0]??jc0[0],X=new $0({color:E,bold:!0}),I=new $0({color:$}),G=A===jc0&&Q===0,V=[...F.title===null?[]:[new D0({text:G?j90(sZ6({progress:U,foreground:E,pulseColor:E}),Y):new h($8(F.title,Y),X),textAlign:"center"})],...F.body.length>0?[oZ6()]:[],...F.body.map((z)=>rZ6(z,I,B,D,J,Y,Z))];return new B6({child:new xA({padding:n0.horizontal(1),child:new IA({crossAxisAlignment:"stretch",mainAxisAlignment:"center",mainAxisSize:"min",children:V})})})}function oZ6(){return x0.height(1)}function rZ6(A,Q,$,B,E,D,J){if(typeof A==="string")return new D0({text:new h($8(A,D),Q),textAlign:"center"});if("codeBlock"in A)return new q5({onCopy:(U,Y)=>{if(Y)AQ.success(J,"Copied to clipboard",2000)},child:new IA({mainAxisSize:"min",children:A.codeBlock.map((U)=>new D0({text:new h($8(U,D),new $0({color:E})),textAlign:"center",selectable:!0}))})});if("keybind"in A){let U=new D0({text:new h("",void 0,[new h($8(A.text,D),new $0({color:$,dim:!0})),new h($8(A.keybind,D,A4(A.text).length),new $0({color:E}))]),textAlign:"center",selectable:"selectable"in A?A.selectable:!1});if("selectable"in A)return new B6({child:new q5({child:U})});return U}if("highlightText"in A){let U=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),Y=cX.of(J),Z=new h("",void 0,[new h(A.text,Q),new h(A.highlightText,new $0({color:E})),new h(A.textAfterHighlight,Q),new h(U.text,U.style,U.children,U.hyperlink,()=>{H$(J,A.href,{forceExternal:!1,onShowImagePreview:Y})}),new h(A.textAfter,Q)]);return new D0({text:j90(Z,D),textAlign:"center"})}if("linkText"in A){if(A.linkWidget)return new IA({mainAxisSize:"min",children:[new D0({text:new h($8(A.text,D),Q),textAlign:"center"}),new B6({child:new MA({mainAxisSize:"min",children:[q$.createWidget(J,A.href,$8(A.linkText,D),new $0({color:B,underline:!0})),new D0({text:new h($8(A.textAfter,D),Q)})]})})]});let U=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),Y=cX.of(J),Z=new h("",void 0,[new h(A.text,Q),new h(U.text,U.style,U.children,U.hyperlink,()=>{H$(J,A.href,{forceExternal:!1,onShowImagePreview:Y})}),new h(A.textAfter,Q)]);return new D0({text:j90(Z,D),textAlign:"center"})}if(D>0)return new D0({text:new h($8(A.text,D),new $0({color:B,underline:!0})),textAlign:"center"});return new B6({child:q$.createWidget(J,A.href,A.text,new $0({color:B,underline:!0}))})}function sZ6({progress:A,foreground:Q,pulseColor:$}){let B=new $0({color:Q,bold:!0}),E=new $0({color:eZ6({progress:A,foreground:Q,pulseColor:$}),bold:!0});return new h("",void 0,[new h(tZ6(A).padEnd(Rc0," "),B),new h(" ",B),new h(ER4(UR4,cZ6,A,0.72),B),new h(" ",B),new h(ER4(YR4,pZ6,A,0.88),E)])}function tZ6(A){let Q=A4(JR4),$=Math.min(Rc0,Math.ceil(RE(A/0.62)*Rc0));return Q.slice(0,$).join("")}function ER4(A,Q,$,B){return $>=B?A:"".padEnd(Q," ")}function eZ6({progress:A,foreground:Q,pulseColor:$}){if(A<0.88||A>=1)return Q;let B=RE((A-0.88)/0.12);return Math.cos(B*Math.PI*4)*(1-B)>0.12?$:Q}function AF6({stage:A,featureStageCount:Q,foreground:$,dissolveProgress:B}){return new h($8(`${A}/${Q}`,B),new $0({color:$,dim:!0}))}function QF6({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:E,dissolveProgress:D}){let J=new $0({color:B}),U=new $0({color:$,dim:!0}),Y=Q?A?"Enter":"Space":"Esc",Z=Q?A?" to get started":" to continue":" to quit",F="",X="",I=`${Z}`;if(!Q)return new h("",void 0,[new h(Y,J),new h(Z,U),new h("",J),new h("",U)]);let G=DR4(Y,E),V=DR4(I,RE((E*(A4(Y).length+A4(I).length)-A4(Y).length)/A4(I).length));return new h("",void 0,[new h($8(G,D),J),new h($8(V.slice(0,Z.length),D),U),new h($8(V.slice(Z.length,Z.length+0),D),J),new h($8(V.slice(Z.length+0),D),U)])}function $F6({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:E,dissolveProgress:D,context:J}){if(Q)return new D0({text:QF6({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:E,dissolveProgress:D}),textAlign:"center"});let U=new $0({color:B}),Y=new $0({color:$,dim:!0});return new q5({onCopy:(Z,F)=>{if(F)AQ.success(J,"Copied to clipboard",2000)},child:new D0({text:new h("",void 0,[new h("q",U),new h(" to quit",Y)]),textAlign:"center",selectable:!0})})}function DR4(A,Q){let $=A4(A),B=Math.min($.length,Math.ceil(RE(Q)*$.length));return $.slice(0,B).join("").padEnd($.length," ")}function j90(A,Q,$=0){if(Q<=0)return A;let B=$+A4(A.text??"").length,E=A.children?.map((D)=>{let J=j90(D,Q,B);return B+=A4(D.toPlainText()).length,J});return new h(A.text?$8(A.text,Q,$):A.text,A.style,E,A.hyperlink,A.onClick)}function $8(A,Q,$=0){if(Q<=0)return A;return A4(A).map((E,D)=>{if(E.trim()==="")return E;return IR4($+D)<Q?" ":E}).join("")}function IR4(A){let Q=Math.sin((A+1)*12.9898)*43758.5453;return Q-Math.floor(Q)}function BF6(A){let $=A.observer.protocolMessages().filter((B)=>B.role==="assistant").at(-1);if(!$)return null;return $.content.filter((B)=>B.type==="text").map((B)=>B.text).join("")}function EF6(A,Q={}){return new Promise(($,B)=>{let E=!1,D=setTimeout(()=>{J.unsubscribe(),B(Error("Timed out waiting for agent response"))},Q.timeoutMs??600000),J=A.observer.agentState().subscribe((U)=>{if(h3(U)){E=!0;return}if(!E)return;let Y=BF6(A);if(Y===null)return;clearTimeout(D),J.unsubscribe(),$(Y)})})}class vc0 extends d0{listSkillsForThread;clientPool;completionBuilder;history;ideManager;configService;updateService;initialThreadIDs;showWelcome;welcomeVariant;onWelcomeDismissed;notificationService;mcpTrustHandler;onThreadArchived;onActiveThreadChange;onRelaunchRequested;onFirstFrame;initialUserInput;getDefaultNewThreadVisibility;observeThreadSummaries;openThreadPickerOnStart;workspaceSettingsFilePath;context;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.showWelcome=A.showWelcome??!1,this.welcomeVariant=A.welcomeVariant??"intro",this.onWelcomeDismissed=A.onWelcomeDismissed,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.observeThreadSummaries=A.observeThreadSummaries,this.openThreadPickerOnStart=A.openThreadPickerOnStart??!1,this.workspaceSettingsFilePath=A.workspaceSettingsFilePath,this.context=A.context}createState(){return new VR4}}class VR4 extends m0{editorController=new DZ;commandPalette=new up(this);commandRegistry=new ng0;toastController=new $b0;relaunchNotificationController=new hg0;exitHintTimer=new qp(this,1000);ideStatus=new nB(this,{});threadNavigationHistory=new mg0;draftThreadSettings={};draftThreadSettingsSeed={};hasDraftThreadSettingsSeed=!1;draftThreadSettingsInitPromise=null;activeThreadContext=null;activeThreadIDSubscription=null;activePluginMessageSubscription=null;activePluginUIRequestsSubscription=null;connectionErrorsSubscription=null;configSubscription=null;connectingToThreadID=null;executorAlreadyConnectedDialog=null;switchThreadPickerVisible=!1;welcomeVisible=!1;endCreditsVisible=!1;invadersHighScore=0;debugOverlayVisible=!1;focusDebugVisible=!1;unregisterCommands=null;emptyThreadTerminalTitleController=new ml;pluginIntegration=null;mcpTrustIntegration=null;updateRelaunchIntegration=null;noticesPollingTimeout=null;notices;loadThreads=async()=>{return this.widget.context.listThreads()};analyzeContextForThread=async(A,Q)=>{return QK4({ampURL:this.widget.context.ampURL,configService:this.widget.configService,threadID:A,signal:Q})};onSwitchThread=(A)=>{return this.connectToExistingThread(A,{recordNavigation:!0,rethrowError:!0})};threadListSidebar=new uc0({state:this,isBlocked:()=>this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal(),getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,getWorkspaceRoot:()=>this.widget.context.workspaceRoot,loadThreads:this.loadThreads,observeThreadSummaries:()=>this.widget.observeThreadSummaries(),onSelectThread:this.onSwitchThread});sendFeedbackReport=async(A)=>H80({configService:this.widget.configService,settingsFilePath:this.widget.context.settingsFilePath},A);archiveThread=async(A)=>{let Q=await B70({configService:this.widget.configService},A);if(Q===null)this.widget.onThreadArchived?.(A);return Q};addThreadLabel=async(A,Q)=>{let $=await JN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};removeThreadLabel=async(A,Q)=>{let $=await UN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};initState(){if(RX.getInstance().interceptConsole(),this.invadersHighScore=this.widget.context.invadersHighScore??0,this.notices=new ug0(this.widget.configService,($)=>this.setState($)),M6.instance.addPostFrameCallback(()=>{setTimeout(()=>this.widget.onFirstFrame?.(),0),this.noticesPollingTimeout=setTimeout(()=>{this.noticesPollingTimeout=null,this.notices.startPolling()},500)},"Neo notices polling"),this.widget.showWelcome)this.welcomeVisible=!0;if(this.connectionErrorsSubscription=this.widget.clientPool.connectionErrors$.subscribe(({threadID:$,error:B})=>{if(S.error("Neo failed to connect to thread",{threadID:$,error:B}),!$)this.toastController.show(`Connection failed: ${B.message}`,"error",4000)}),this.configSubscription=this.widget.configService.config.subscribe(($)=>{this.applyDraftThreadSettingsSeed(this.applySessionDefaultsToThreadSettings(A00($.settings)))}),this.updateRelaunchIntegration=new dg0({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 $={};if(A)$.initialUserInput=A;this.connectToInitialThreads(Q,$)}else if(A)this.onNewThread([{type:"text",text:A}],this.widget.context.sessionAgentMode);this.pluginIntegration=new xg0({state:this,commandPalette:this.commandPalette,commandRegistry:this.commandRegistry,toastController:this.toastController,context:this.widget.context,getActiveThreadID:this.getActiveThreadID,appendToThread:this.appendPluginMessagesToThread,readThreadMessages:this.readPluginThreadMessages,runAgent:this.runPluginAgent,onBlockingConfirmDialogChange:this.syncEmptyThreadPluginConfirmationTitle}),this.pluginIntegration.init(),this.mcpTrustIntegration=new Hh0({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=Z1.instance.tuiInstance.getEarlyInputText();if(!A)return;this.editorController.insertText(A)}registerAppCommands(){let A=this,Q=this.widget.context.pluginService?ju4({pluginService:this.widget.context.pluginService,workspaceRoot:this.widget.context.workspaceRoot,logFilePath:this.widget.context.logFilePath,toastController:this.toastController}):[],B=[fu4({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),{noun:"thread",verb:"switch",description:"Switch to existing thread",keywords:["resume"],status:{type:"enabled"},sortBoost:100,run:(E,D,J)=>{E.pushWithDismiss((U)=>Nd0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:U,onThreadSelected:J}))}},...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:(E,D,J)=>{A.navigateBack(),J()}},RM4({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:(E,D,J)=>{A.navigateForward(),J()}},{noun:"mcp",verb:"info",description:"Show MCP servers and tools",status:{type:"enabled"},run:(E,D,J)=>{E.push(new Rm0({mcpServers:this.widget.context.mcpServers,onDismiss:J}))}},{noun:"toolbox",verb:"list",description:"List all toolboxes and their tools",status:{type:"enabled"},run:(E)=>{E.pushWithDismiss((D)=>new wc0({toolboxes:this.widget.context.toolboxes,onDismiss:D}))}},{noun:"news",verb:"open",description:"Open Amp Chronicle in browser",keywords:["chronicle","blog","announcements"],status:{type:"enabled"},run:async(E,D,J)=>{try{await H$(D,"https://ampcode.com/chronicle")}finally{J()}}},{noun:"settings",verb:"open in editor",description:"Open CLI settings in $EDITOR",keywords:["config"],status:{type:"enabled"},run:()=>{vz(this.widget.context.settingsFilePath).catch((E)=>{S.error("Failed to open settings file in editor",{error:E})})}},{noun:"IDE",verb:"connect",description:"Connect to an IDE",keywords:["vscode","cursor","jetbrains"],status:{type:"enabled"},run:(E,D,J)=>{E.pushWithDismiss((U)=>new jm0({onCancel:U,onSelect:(Y)=>{this.handleIdeSelection(Y),J()}}))}},{noun:"amp",verb:"help",description:"Show help & keyboard shortcuts",keywords:["manual","?"],status:{type:"enabled"},run:(E,D,J)=>{E.push(new og0({commands:oB.of(D).commands,onDismiss:J}))}},{noun:"amp",verb:"show welcome",description:"Show the welcome message again",status:{type:"enabled"},run:(E,D,J)=>{J(),A.showWelcome()}},{noun:"amp",verb:"end credits",description:"Roll the full-screen Amp credits",status:{type:"enabled"},run:(E,D,J)=>{J(),A.showEndCredits()}},{noun:"amp",verb:"show version",description:"Show current Amp version",keywords:["v"],status:{type:"enabled"},run:(E,D,J)=>{E.push(new o4({header:"Amp Version",maxWidth:72,onDismiss:J,child:new D0({text:new h(v50({version:"0.0.1780162602-gb8f27a",buildTimestamp:"2026-05-30T17:41:57.172Z",buildType:"release"}))})}))}},{noun:"amp",verb:"quit",description:"Exit application",keywords:["exit","close","bye"],shortcut:CA.ctrl("c"),status:{type:"enabled"},run:(E,D)=>{C4.maybeInvoke(D,new hz)}},...Q,...DN4(this.widget.context.logFilePath)].map((E)=>this.commandRegistry.register(E));return()=>{for(let E of B)E()}}build(A){let Q=this.buildHints(),$=this.ideStatus.getValue(),B=this.notices.current,E=new Wc0({initialAgentMode:this.widget.context.sessionAgentMode,initialPluginAgentModeKey:this.widget.context.initialPluginAgentModeKey,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:$,statusItems:this.pluginIntegration?.getStatusItems()??[],pluginConfirmationBlocked:this.pluginIntegration?.hasBlockingConfirmDialog()??!1,notificationService:this.widget.notificationService,notice:this.activeThreadContext||this.welcomeVisible?null:B,onDismissNotice:(I)=>this.notices.dismiss(I)}),D=V4.of(A),J=D.capabilities.animationSupport!=="disabled",U=this.threadListSidebar.visibleWidth(),Y=Math.max(0,D.size.width-U),F=[new VA({constraints:U4.tight(D.size.width,D.size.height),child:this.threadListSidebar.buildBody(E)})];if(this.commandPalette.isEnabled())F.push(new Y$({debugLabel:"CommandPaletteOverlay",onFocusChange:this.closeCommandPaletteOnFocusLoss,child:new ag0({onDismiss:this.commandPalette.disable})}));if(this.switchThreadPickerVisible&&!this.welcomeVisible)F.push(Nd0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:this.closeSwitchThreadPicker,onThreadSelected:this.closeSwitchThreadPicker}));if(this.welcomeVisible)F.push(new Y$({debugLabel:"WelcomeDialogOverlay",child:new Pc0({onDismiss:this.dismissWelcome,onQuit:()=>Z1.instance.stop(),animationsEnabled:J,variant:this.widget.welcomeVariant})}));let X=this.executorAlreadyConnectedDialog;if(X)F.push(new Y$({debugLabel:"ExecutorAlreadyConnectedDialogOverlay",child:new Om0({existingExecutorPid:X.existingExecutorPid,onChoice:this.handleExecutorAlreadyConnectedChoice})}));if(F.push(...this.mcpTrustIntegration?.buildDialogLayers()??[]),F.push(...this.pluginIntegration?.buildDialogLayers()??[]),this.widget.context.isInternalUser)F.push(new sg0({top:this.focusDebugVisible?33:1,visible:this.debugOverlayVisible,pid:R90.pid,activeThreadID:this.activeThreadContext?.client.getThreadId()??null,connectionInfo$:this.activeThreadContext?.observer.connectionInfo()??null}));if(this.focusDebugVisible)F.push(new Lm0);if(this.endCreditsVisible)F.push(new Hm0({onComplete:this.completeEndCredits,highScore:this.invadersHighScore,onHighScoreChange:this.updateInvadersHighScore}));return new WQ({context:this.widget.context,child:new oB({commandRegistry:this.commandRegistry,child:new Hv({completionBuilder:this.widget.completionBuilder,child:new AQ({controller:this.toastController,child:new C4({actions:this.buildActions(),child:new tQ({debugLabel:"AppShortcuts",shortcuts:this.buildShortcuts(),child:new KQ({debugLabel:"AppShellFocus",child:new Bb0({controller:this.toastController,complexToastControllers:[this.relaunchNotificationController,...B&&this.activeThreadContext&&!this.welcomeVisible?[this.notices]:[]],child:new rg0({configReloadEvents:this.widget.configService.configReloadEvents,toastController:this.toastController,child:new lp({left:U,width:Y,child:new t1({children:F})})})})})})})})})})})}buildShortcuts(){let A=new Map([[CA.ctrl("c"),new N70],[CA.ctrl("o"),new u70],[CA.alt("i"),new M70],[CA.alt("p"),new Ep],[CA.ctrl("."),new j70],[CA.ctrl("t"),new v70],...this.threadListSidebar.shortcutEntries()]);if(R90.env.NODE_ENV==="development"&&R90.platform==="darwin")A.set(CA.meta("r"),new q70);return A}buildActions(){let A=new cA(()=>{if(k2.hasAnyCopyableSelection())return k2.tryCopyAnyActiveSelection(),"handled";return this.onExitPressed(),"handled"}),Q=new cA(()=>{if(!this.commandPalette.isEnabled()&&this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.toggle(),"handled"}),$=new cA(()=>{if(this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.enable(),"handled"}),B=new cA(()=>{return this.startNewDraftThread(),"handled"}),E=new cA(()=>{return Z1.instance.stop(),"handled"}),D=new cA(()=>{return Tl({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),"handled"}),J=new cA((I)=>{if(!I.text)return"ignored";return Z1.instance.tuiInstance.clipboard.writeText(I.text).then((G)=>{if(G.ok)this.toastController.show(I.successMessage,"success",2000);else this.toastController.show(`${I.failureMessage}: ${G.userFacingErrorMessage}`,"error",4000)}).catch((G)=>{S.error("Failed to copy Neo text to clipboard",{error:G}),this.toastController.show(I.failureMessage,"error",2000)}),"handled"}),U=new cA(()=>{return Z1.instance.toggleFrameStatsOverlay(),"handled"}),Y=new cA(()=>this.notices.dismissCurrent()?"handled":"ignored"),Z=new cA(()=>{if(!this.widget.context.isInternalUser)return"ignored";return this.setState(()=>{this.debugOverlayVisible=!this.debugOverlayVisible}),"handled"}),F=nu4({getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,context:this.widget.context,toastController:this.toastController,startNewDraftThread:this.startNewDraftThread,sendFeedbackReport:this.sendFeedbackReport}),X=new cA(()=>{return this.setState(()=>{this.focusDebugVisible=!this.focusDebugVisible}),"handled"});return new Map([[N70,A],[Al,B],[hz,E],[q70,D],[DB,J],[El,$],[u70,Q],[M70,Z],...this.threadListSidebar.actionEntries(),[j70,Y],...F,[Ep,U],[v70,X]])}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.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.cancelOwnerUIRequests(),this.activeThreadContext=null,this.connectingToThreadID=null,A.hideDebugOverlay)this.debugOverlayVisible=!1}),this.widget.onActiveThreadChange?.(null),this.syncEmptyThreadPluginConfirmationTitle(),A.prompt!==void 0)this.editorController.text=A.prompt}syncEmptyThreadPluginConfirmationTitle=()=>{this.emptyThreadTerminalTitleController.setPluginConfirmationBlocked(this.activeThreadContext===null&&(this.pluginIntegration?.hasBlockingConfirmDialog()??!1))};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 gP(this.widget.configService));this.applyDraftThreadSettingsSeed(A)}catch(A){S.warn("Failed to initialize Neo draft thread settings",{error:A instanceof Error?A.message:String(A)})}}applySessionDefaultsToThreadSettings(A){let Q=this.widget.context.sessionAgentMode,$=A,B=Qq(Q),E=B50(this.widget.context,Q);if(B!==void 0&&E!==void 0)$={...$,[B]:E};return Q50($,{agentMode:Q,explicitEffort:this.widget.context.explicitReasoningEffort,sessionState:this.widget.context})}applyDraftThreadSettingsSeed(A){if(!this.mounted)return;if(!this.hasDraftThreadSettingsSeed){this.setState(()=>{this.hasDraftThreadSettingsSeed=!0,this.draftThreadSettings=GR4(this.draftThreadSettings,{},A),this.draftThreadSettingsSeed={...A}});return}if(nU(this.draftThreadSettingsSeed,A))return;this.setState(()=>{this.draftThreadSettings=GR4(this.draftThreadSettings,this.draftThreadSettingsSeed,A),this.draftThreadSettingsSeed={...A}})}buildHints(){let A=new Set;if(this.connectingToThreadID)A.add(bz);if(this.exitHintTimer.isActive())A.add(Uv);return A}onExitPressed=()=>{if(this.exitHintTimer.isActive())this.exitHintTimer.clear(),Z1.instance.stop();else this.exitHintTimer.activate()};dismissWelcome=()=>{if(!this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!1}),this.widget.onWelcomeDismissed?.()};updateInvadersHighScore=(A)=>{if(A<=this.invadersHighScore)return;this.setState(()=>{this.invadersHighScore=A}),sY((Q)=>({...Q,neoInvadersHighScore:Math.max(Q.neoInvadersHighScore,A)})).catch((Q)=>{S.warn("Failed to save Neo Invaders high score",{error:Q instanceof Error?Q.message:String(Q)})})};showWelcome=()=>{if(this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!0})};showEndCredits=()=>{if(this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!0})};completeEndCredits=()=>{if(!this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!1})};promptExecutorAlreadyConnected(A){return new Promise((Q)=>{this.setState(()=>{this.executorAlreadyConnectedDialog={existingExecutorPid:A.existingExecutorPid,resolve:($)=>{Q($==="watch"?"observe":"disconnect")}}})})}handleExecutorAlreadyConnectedChoice=(A)=>{if(this.resolveExecutorAlreadyConnectedDialog(A),A==="exit")Z1.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,$=null,B,E,D)=>{await this.ensureDraftThreadSettingsInitialized();let J=this.activeThreadContext?.client.getThreadId(),U=A.find(ae);if(U)this.widget.history.add(U.text,R90.cwd()),this.widget.history.reset();let Y=$?void 0:await this.widget.getDefaultNewThreadVisibility?.(),Z=$??Y??null,F=this.widget.clientPool.createNewThread(Q,this.draftThreadSettings,Z??void 0,E,D);if(this.sendUserMessage(F,A,E?void 0:Q,E?void 0:B),!E)this.rememberSessionDefaultsForNewMessage(Q,this.draftThreadSettings);this.threadNavigationHistory.recordNavigation(J),this.setActiveClient(F)};rememberSessionDefaultsForNewMessage(A,Q){this.widget.context.sessionAgentMode=A;let $=Q["reasoning.effort"];if($!==void 0)this.widget.context.lastReasoningEffortByMode={...this.widget.context.lastReasoningEffortByMode??{},[A]:$};let B=Qq(A),E=B?Q[B]:void 0;if(E!==void 0)this.widget.context.lastSpeedByMode={...this.widget.context.lastSpeedByMode??{},[A]:E};sY((D)=>{let J={...D,agentMode:A};if($!==void 0)J={...J,lastReasoningEffortByMode:{...J.lastReasoningEffortByMode??{},[A]:$}};if(E!==void 0)J={...J,lastSpeedByMode:{...J.lastSpeedByMode??{},[A]:E}};return J}).catch((D)=>{S.warn("Failed to persist Neo session defaults for new message",{error:D instanceof Error?D.message:String(D)})})}sendUserMessage(A,Q,$,B){let E=P50(this.ideStatus.getValue());if(B===void 0){A.client.sendUserMessage(Q,$,{userState:E});return}A.client.sendUserMessage(Q,$,{reasoningEffort:B,userState:E})}getActiveThreadID=()=>{return this.activeThreadContext?.client.getThreadId()??void 0};getRelaunchThreadIDs=()=>{let A=new Set,Q=this.getActiveThreadID();if(Q)A.add(Q);for(let $ of this.widget.clientPool.activeThreadIDs)A.add($);return[...A]};appendPluginMessagesToThread=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("appendToThread is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.append is only available for the active executor thread");for(let E of A)this.sendUserMessage($,[{type:"text",text:E.content}])};readPluginThreadMessages=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("thread.messages is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.messages is only available for the active thread");return GaA(VaA($.observer.protocolMessages()),A)};runPluginAgent=async(A,Q)=>{await this.ensureDraftThreadSettingsInitialized();let $=this.widget.clientPool.createNewThread(this.widget.context.sessionAgentMode,this.draftThreadSettings,void 0,A,Q.agentModeDisplay,Q.parentThreadID,{trackAsLastActive:!1});this.sendUserMessage($,[{type:"text",text:Q.message}]);try{let B=await EF6($,{timeoutMs:Q.timeoutMs}),E=$.client.getThreadId();return E?{threadID:E,text:B}:{text:B}}finally{this.widget.clientPool.disconnect($)}};async connectToExistingThread(A,Q={}){let $=this.activeThreadContext?.client.getThreadId();this.setState(()=>{this.connectingToThreadID=A});try{let B=await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:(E)=>this.promptExecutorAlreadyConnected(E)});if(this.setActiveClient(B),Q.recordNavigation&&$!==A)this.threadNavigationHistory.recordNavigation($);if(Q.initialUserInput)this.sendUserMessage(B,[{type:"text",text:Q.initialUserInput}])}catch(B){if(S.error("Failed to load thread",{error:B,threadID:A}),this.toastController.show(`Failed to load ${A}: ${B instanceof Error?B.message:String(B)}`,"error",4000),Q.rethrowError)throw B}finally{this.setState(()=>{this.connectingToThreadID=null})}}async connectToInitialThreads(A,Q={}){await this.connectToExistingThread(A,Q);let $=this.widget.initialThreadIDs.filter((B)=>B!==A);await Promise.all($.map((B)=>this.resumeBackgroundThread(B)))}async resumeBackgroundThread(A){try{await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:async()=>"observe"})}catch(Q){S.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,agentModeDisplay:$}){this.setState(()=>{this.activeThreadContext={client:A,observer:Q,agentModeDisplay:$}}),this.syncEmptyThreadPluginConfirmationTitle(),this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=Q.threadID().subscribe((B)=>{this.widget.onActiveThreadChange?.(B)}),this.activePluginMessageSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription?.unsubscribe(),this.pluginIntegration?.cancelOwnerUIRequests(),this.activePluginMessageSubscription=Q.pluginMessages().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage(B,(E)=>{A.sendPluginMessage(E)})}),this.activePluginUIRequestsSubscription=Q.pluginUIRequests().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage({type:"plugin_message",message:{type:"event",event:"plugin.ui.snapshot",data:{requests:[...B]}}},(E)=>{A.sendPluginMessage(E)})})}handleIdeSelection=async(A)=>{try{await this.widget.ideManager.connect(A)}catch(Q){S.error("Failed to connect to IDE",{error:Q});let $=Q instanceof Error?Q.message:String(Q);this.toastController.show(`IDE connection failed: ${$}`,"error",4000)}};dispose(){if(this.unregisterCommands?.(),this.unregisterCommands=null,this.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.dispose(),this.pluginIntegration=null,this.emptyThreadTerminalTitleController.dispose(),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.welcomeVisible||(this.mcpTrustIntegration?.hasBlockingDialog()??!1)||this.endCreditsVisible||(this.pluginIntegration?.hasBlockingDialog()??!1)}}function GR4(A,Q,$){let B={...A};for(let E of DF6(Q,$)){if(!nU(A[E],Q[E]))continue;let D=$[E];if(D===void 0)delete B[E];else B[E]=D}return B}function DF6(...A){return Array.from(new Set(A.flatMap((Q)=>Object.keys(Q))))}fB();function zR4(A,Q,$,B){let E=HxA(A),D="\x1B[0m",J="\x1B[34m",U="\x1B[90m",Y="\x1B[2m",Z=[];if(A.archived)Z.push("\x1B[90m\x1B[2mArchived\x1B[0m");Z.push(`${E}`),Z.push(`\x1B[34m${Q}\x1B[0m`),Z.push(`\x1B[90mamp threads continue ${A.id}\x1B[0m`);let F=14,X=7,I=new _2(F,X),G=new O5(42),V=new qv(F,X,F,X,F,X,0,A.agentMode??"smart","intensity","ascii",void 0,void 0,g0.default(),G);V.layout(U4.tight(F,X)),V.paint(I,0,0);let z=I.getBuffer().getCells(),K=0;for(let R=0;R<X;R++)if(z[R].some((_)=>_.char!==" ")){K=R;break}let W=X-1;for(let R=X-1;R>=0;R--)if(z[R].some((_)=>_.char!==" ")){W=R;break}function C(R,_){if(!R)return"";if(R.type==="rgb"){let{r:P,g:f,b:m}=R.value;if($.getColorDepth()>=24)return`\x1B[${_?38:48};2;${P};${f};${m}m`;let y=Xp(P,f,m);return`\x1B[${_?38:48};5;${y}m`}return""}let H=[];if(W>=K)for(let R=K;R<=W;R++){let _="";for(let P=0;P<F;P++){let f=z[R][P],m=f.char,y=C(f.style.fg,!0);_+=y+m+"\x1B[0m"}H.push(_)}let N=H.length,q=Math.max(N,Z.length),w=Math.floor((q-N)/2),L=Math.floor((q-Z.length)/2);for(let R=0;R<q;R++){let _=" ".repeat(F);if(R>=w&&R<w+N)_=H[R-w];let P=" ",f="";if(R>=L&&R<L+Z.length)f=Z[R-L];$.write(_+P+f+`
4475
+ `))}function SZ6(A,Q){let{colors:$,app:B}=Q;switch(A){case"pending":return{icon:"◌",color:$.warning};case"registered":return{icon:"•",color:$.mutedForeground};case"failed":return{icon:"✗",color:B.toolError};case"duplicate":return{icon:"◇",color:$.warning};default:return{icon:"?",color:$.foreground}}}function aj4(A,Q){let $=A.replace(/\s+/g," ").trim();if(dA($)<=Q)return $;let B="...",E=dA(B);if(Q<=E)return o7(B,Q);return`${o7($,Q-E,!0,"")}${B}`}var Lc0="https://ampcode.com/news/neo",jc0=[{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:Lc0,href:Lc0}]}];function kZ6(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:Lc0,textAfter:" you'll need to switch to the binary install:",linkWidget:!0},"",{codeBlock:["npm uninstall -g @sourcegraph/amp",A]}]}]}function fZ6(){if(process.platform==="win32")return'powershell -c "irm https://ampcode.com/install.ps1 | iex"';return"curl -fsSL https://ampcode.com/install.sh | bash"}var fv=50,lq=40,Mc0=1000,yZ6=420,xZ6=760,bZ6=-250,hZ6=1100,O90=33,tj4=0.999,gZ6=2.1,mZ6=720,dZ6=420,JR4="Meet the new",UR4="Amp",YR4="CLI",Rc0=A4(JR4).length,cZ6=A4(UR4).length,pZ6=A4(YR4).length,L90={primary:{r:140,g:38,b:0},secondary:{r:255,g:225,b:102}},ej4={primary:{r:10,g:42,b:18},secondary:{r:200,g:230,b:68}},AR4={primary:{r:18,g:0,b:107},secondary:{r:103,g:255,b:168}},QR4=[L90,ej4,AR4,L90,ej4,AR4,L90],lZ6=L90;class Pc0 extends d0{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??fZ6(),this.introStages=this.variant==="npm-migration"?kZ6(this.binaryInstallCommand):jc0,this.dismissible=this.variant!=="npm-migration"}createState(){return new ZR4}}class ZR4 extends m0{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=Mc0;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 O5(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=RE(this.widget.animationProgress),this.firstStageTitleVisible=this.animationProgress>=tj4,this.firstStageHintVisible=this.animationProgress>=tj4,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:Mc0,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=RE(A/xZ6);if(this.setState(()=>{this.dismissProgress=Q}),Q>=1)this.stopDismissAnimation(),this.widget.onDismiss()},O90)}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 $=performance.now()-this.stageTransitionStartedAt,B=RE($/yZ6);if(this.setState(()=>{if(this.stageTransitionProgress=B,B>=1)this.previousIntroStage=null}),B>=1)this.stopStageTransitionTimer()},O90)}startProgressAnimation({from:A,to:Q,durationMs:$,onComplete:B}){this.stopAnimation(),this.startedAt=performance.now(),this.animationStartProgress=A,this.animationTargetProgress=Q,this.animationDurationMs=$,this.onAnimationComplete=B,this.animationProgress=A,this.animationTimer=setInterval(()=>{let E=performance.now()-this.startedAt,D=RE(E/this.animationDurationMs),J=this.animationStartProgress+(this.animationTargetProgress-this.animationStartProgress)*yv(D);if(this.setState(()=>{this.animationProgress=J}),D>=1)this.stopAnimation(),this.onAnimationComplete?.(),this.onAnimationComplete=null},O90)}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,Mc0+bZ6),Q=A+hZ6;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?RE((A-this.firstStageTitleRevealStartedAt)/mZ6):this.firstStageTitleRevealProgress,$=this.firstStageHintRevealStartedAt?RE((A-this.firstStageHintRevealStartedAt)/dZ6):this.firstStageHintRevealProgress;if(this.setState(()=>{this.firstStageTitleRevealProgress=Q,this.firstStageHintRevealProgress=$}),Q>=1&&$>=1)this.stopFirstStageRevealTimer()},O90)}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=$R4(this.introStage),Q=this.previousIntroStage===null||this.stageTransitionProgress>=1?A:BR4($R4(this.previousIntroStage),A,yv(this.stageTransitionProgress));return this.dismissProgress>0?BR4(Q,lZ6,yv(this.dismissProgress)):Q}build(A){let Q=S4.of(A).colorScheme,$=EA.of(A),B=this.currentOrbPalette(),E=J7(1,"deep",B),D=V4.of(A).size,U=this.widget.animationProgress??this.animationProgress,Y=Math.max(D.width/fv,D.height/lq)*gZ6,Z=Y+(1-Y)*U,F=yv(this.dismissProgress),X=Math.max(fv,Math.round(fv*Z)),I=Math.max(lq,Math.round(lq*Z)),G=Math.round((D.width-X)/2),V=Math.round((D.height-I)/2),z=Math.max(0,Math.floor((D.width-fv)/2)),K=-Math.floor(lq/2),W=Math.round(G+(z-G)*U),C=Math.round(V+(K-V)*U),H=W+X/2,N=C+I/2,q=iZ6({dismissProgress:this.dismissProgress,easedDismissProgress:F,introOrbScale:Z,normalOrbCenterX:H,normalOrbCenterY:N,size:D}),w=Math.max(fv,Math.round(fv*q.orbScale)),L=Math.max(lq,Math.round(lq*q.orbScale)),R=q.orbCenterX,_=q.orbCenterY,P=Math.round(R-w/2),f=Math.round(_-L/2),m=Math.max(3,Math.min(D.height-5,Math.floor(lq/2)+2)),y=Math.max(m+3,D.height-3),T=q.textDissolveProgress,k=this.isFinalIntroStage()?q.backdropDissolveProgress:0,c=this.firstStageTitleVisible&&T<1,d=c&&this.firstStageHintVisible,b=d&&this.widget.dismissible&&this.introStage>0&&!this.isFinalIntroStage(),p=this.introStage===0?this.firstStageTitleRevealProgress:1,n=this.introStage===0?this.firstStageHintRevealProgress:1,s=Math.max(24,Math.min(74,D.width-4)),I0=Math.min(12,Math.max(8,D.height-m-6)),E0=Math.max(0,Math.floor((D.width-s)/2)),G0=Math.max(0,Math.min(D.height-I0,Math.floor(D.height*0.55-I0/2))),q0=this.widget.animationProgress!==void 0||!this.widget.animationsEnabled?new lz({width:w,height:L,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,seed:42,fps:0,onClick:()=>{}}):new lz({width:w,height:L,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,onClick:()=>{}});return new Y$({autofocus:!0,canRequestFocus:!0,debugLabel:"WelcomeTakeover",onKey:(t)=>{if(t.key==="Enter")return this.advanceIntroStage(),"handled";if(!this.widget.dismissible&&t.key==="c"&&t.ctrlKey)return this.widget.onQuit?.(),"handled";if(!this.widget.dismissible&&t.key==="q")return this.widget.onQuit?.(),"handled";if((t.key===" "||t.key==="Space")&&!this.isFinalIntroStage())return this.advanceIntroStage(),"handled";if(t.key==="Escape"||t.key==="Esc"){if(!this.widget.dismissible)return this.widget.onQuit?.(),"handled";return this.dismissFromFinalIntroStage()?"handled":"ignored"}if(t.key==="ArrowRight")return this.nextIntroStage(),"handled";if(t.key==="ArrowLeft")return this.goToPreviousIntroStage(),"handled";return"ignored"},child:new t1({fit:"expand",children:[new FR4({color:Q.background,dissolveProgress:k}),new t1({fit:"expand",children:[new aA({onClick:()=>{},child:x0.expand()}),new a1({left:P,top:f,width:w,height:L,child:q0}),...c?[new a1({left:E0,top:G0,width:s,height:I0,child:aZ6({introStages:this.widget.introStages,stage:this.introStage,previousStage:this.previousIntroStage,progress:this.stageTransitionProgress,direction:this.stageTransitionDirection,width:s,height:I0,foreground:Q.foreground,mutedForeground:Q.mutedForeground,accent:E,link:$.app.link,keybind:$.app.keybind,titleRevealProgress:p,dissolveProgress:T,context:A})})]:[],...d?[...b?[new a1({left:E0,top:Math.max(0,y-1),width:s,height:1,child:new D0({text:AF6({stage:this.introStage,featureStageCount:Math.max(0,this.widget.introStages.length-2),foreground:Q.mutedForeground,dissolveProgress:T}),textAlign:"center"})})]:[],new a1({left:E0,top:y,width:s,height:1,child:$F6({finalStage:this.isFinalIntroStage(),dismissible:this.widget.dismissible,foreground:Q.mutedForeground,keybind:$.app.keybind,revealProgress:n,dissolveProgress:T,context:A})})]:[]]})]})})}}class FR4 extends EB{color;dissolveProgress;constructor({color:A,dissolveProgress:Q}){super();this.color=A,this.dissolveProgress=Q}createRenderObject(){return new XR4(this.color,this.dissolveProgress)}updateRenderObject(A){A.update(this.color,this.dissolveProgress)}}class XR4 extends yA{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;nA(!!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,$=0){let B=Math.floor(Q+this.offset.x),E=Math.floor($+this.offset.y),D=Math.floor(this.size.width),J=Math.floor(this.size.height),U={bg:this.color},Y=RE(this.dissolveProgress);if(Y<=0){A.fill(B,E,D,J," ",U);return}if(Y>=1)return;for(let Z=0;Z<J;Z++)for(let F=0;F<D;F++)if(!nZ6(F,Z,D,J,Y))A.fill(B+F,E+Z,1,1," ",U)}}function RE(A){return Math.min(1,Math.max(0,A))}function yv(A){return 1-(1-A)**3}function $R4(A){return QR4[A]??QR4[0]}function BR4(A,Q,$){return{primary:Mq(A.primary,Q.primary,$),secondary:Mq(A.secondary,Q.secondary,$)}}function iZ6({dismissProgress:A,easedDismissProgress:Q,introOrbScale:$,normalOrbCenterX:B,normalOrbCenterY:E,size:D}){return{orbScale:$+($*0.86-$)*Q,orbCenterX:B+(D.width*0.54-B)*Q,orbCenterY:E-D.height*0.44*Q,textDissolveProgress:RE(A/0.52),backdropDissolveProgress:yv(RE((A-0.12)/0.88))}}function nZ6(A,Q,$,B,E){let D=B<=1?0:Q/(B-1),J=IR4(A+Q*Math.max(1,$));return(1-D)*0.72+J*0.28<E}function aZ6({introStages:A,stage:Q,previousStage:$,progress:B,direction:E,width:D,height:J,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V}){if($===null||B>=1)return Oc0({introStages:A,stage:Q,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V});let z=yv(B),K=E*Math.round((1-z)*D),W=-E*Math.round(z*D);return new Zq(new t1({fit:"expand",children:[new a1({left:W,top:0,width:D,height:J,child:Oc0({introStages:A,stage:$,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:$===0?1:I,dissolveProgress:G,context:V})}),new a1({left:K,top:0,width:D,height:J,child:Oc0({introStages:A,stage:Q,foreground:U,mutedForeground:Y,accent:Z,link:F,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V})})]}))}function Oc0({introStages:A,stage:Q,foreground:$,mutedForeground:B,accent:E,link:D,keybind:J,titleRevealProgress:U,dissolveProgress:Y,context:Z}){let F=A[Q]??A[0]??jc0[0],X=new $0({color:E,bold:!0}),I=new $0({color:$}),G=A===jc0&&Q===0,V=[...F.title===null?[]:[new D0({text:G?j90(sZ6({progress:U,foreground:E,pulseColor:E}),Y):new h($8(F.title,Y),X),textAlign:"center"})],...F.body.length>0?[oZ6()]:[],...F.body.map((z)=>rZ6(z,I,B,D,J,Y,Z))];return new B6({child:new xA({padding:n0.horizontal(1),child:new IA({crossAxisAlignment:"stretch",mainAxisAlignment:"center",mainAxisSize:"min",children:V})})})}function oZ6(){return x0.height(1)}function rZ6(A,Q,$,B,E,D,J){if(typeof A==="string")return new D0({text:new h($8(A,D),Q),textAlign:"center"});if("codeBlock"in A)return new q5({onCopy:(U,Y)=>{if(Y)AQ.success(J,"Copied to clipboard",2000)},child:new IA({mainAxisSize:"min",children:A.codeBlock.map((U)=>new D0({text:new h($8(U,D),new $0({color:E})),textAlign:"center",selectable:!0}))})});if("keybind"in A){let U=new D0({text:new h("",void 0,[new h($8(A.text,D),new $0({color:$,dim:!0})),new h($8(A.keybind,D,A4(A.text).length),new $0({color:E}))]),textAlign:"center",selectable:"selectable"in A?A.selectable:!1});if("selectable"in A)return new B6({child:new q5({child:U})});return U}if("highlightText"in A){let U=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),Y=cX.of(J),Z=new h("",void 0,[new h(A.text,Q),new h(A.highlightText,new $0({color:E})),new h(A.textAfterHighlight,Q),new h(U.text,U.style,U.children,U.hyperlink,()=>{H$(J,A.href,{forceExternal:!1,onShowImagePreview:Y})}),new h(A.textAfter,Q)]);return new D0({text:j90(Z,D),textAlign:"center"})}if("linkText"in A){if(A.linkWidget)return new IA({mainAxisSize:"min",children:[new D0({text:new h($8(A.text,D),Q),textAlign:"center"}),new B6({child:new MA({mainAxisSize:"min",children:[q$.createWidget(J,A.href,$8(A.linkText,D),new $0({color:B,underline:!0})),new D0({text:new h($8(A.textAfter,D),Q)})]})})]});let U=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),Y=cX.of(J),Z=new h("",void 0,[new h(A.text,Q),new h(U.text,U.style,U.children,U.hyperlink,()=>{H$(J,A.href,{forceExternal:!1,onShowImagePreview:Y})}),new h(A.textAfter,Q)]);return new D0({text:j90(Z,D),textAlign:"center"})}if(D>0)return new D0({text:new h($8(A.text,D),new $0({color:B,underline:!0})),textAlign:"center"});return new B6({child:q$.createWidget(J,A.href,A.text,new $0({color:B,underline:!0}))})}function sZ6({progress:A,foreground:Q,pulseColor:$}){let B=new $0({color:Q,bold:!0}),E=new $0({color:eZ6({progress:A,foreground:Q,pulseColor:$}),bold:!0});return new h("",void 0,[new h(tZ6(A).padEnd(Rc0," "),B),new h(" ",B),new h(ER4(UR4,cZ6,A,0.72),B),new h(" ",B),new h(ER4(YR4,pZ6,A,0.88),E)])}function tZ6(A){let Q=A4(JR4),$=Math.min(Rc0,Math.ceil(RE(A/0.62)*Rc0));return Q.slice(0,$).join("")}function ER4(A,Q,$,B){return $>=B?A:"".padEnd(Q," ")}function eZ6({progress:A,foreground:Q,pulseColor:$}){if(A<0.88||A>=1)return Q;let B=RE((A-0.88)/0.12);return Math.cos(B*Math.PI*4)*(1-B)>0.12?$:Q}function AF6({stage:A,featureStageCount:Q,foreground:$,dissolveProgress:B}){return new h($8(`${A}/${Q}`,B),new $0({color:$,dim:!0}))}function QF6({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:E,dissolveProgress:D}){let J=new $0({color:B}),U=new $0({color:$,dim:!0}),Y=Q?A?"Enter":"Space":"Esc",Z=Q?A?" to get started":" to continue":" to quit",F="",X="",I=`${Z}`;if(!Q)return new h("",void 0,[new h(Y,J),new h(Z,U),new h("",J),new h("",U)]);let G=DR4(Y,E),V=DR4(I,RE((E*(A4(Y).length+A4(I).length)-A4(Y).length)/A4(I).length));return new h("",void 0,[new h($8(G,D),J),new h($8(V.slice(0,Z.length),D),U),new h($8(V.slice(Z.length,Z.length+0),D),J),new h($8(V.slice(Z.length+0),D),U)])}function $F6({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:E,dissolveProgress:D,context:J}){if(Q)return new D0({text:QF6({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:E,dissolveProgress:D}),textAlign:"center"});let U=new $0({color:B}),Y=new $0({color:$,dim:!0});return new q5({onCopy:(Z,F)=>{if(F)AQ.success(J,"Copied to clipboard",2000)},child:new D0({text:new h("",void 0,[new h("q",U),new h(" to quit",Y)]),textAlign:"center",selectable:!0})})}function DR4(A,Q){let $=A4(A),B=Math.min($.length,Math.ceil(RE(Q)*$.length));return $.slice(0,B).join("").padEnd($.length," ")}function j90(A,Q,$=0){if(Q<=0)return A;let B=$+A4(A.text??"").length,E=A.children?.map((D)=>{let J=j90(D,Q,B);return B+=A4(D.toPlainText()).length,J});return new h(A.text?$8(A.text,Q,$):A.text,A.style,E,A.hyperlink,A.onClick)}function $8(A,Q,$=0){if(Q<=0)return A;return A4(A).map((E,D)=>{if(E.trim()==="")return E;return IR4($+D)<Q?" ":E}).join("")}function IR4(A){let Q=Math.sin((A+1)*12.9898)*43758.5453;return Q-Math.floor(Q)}function BF6(A){let $=A.observer.protocolMessages().filter((B)=>B.role==="assistant").at(-1);if(!$)return null;return $.content.filter((B)=>B.type==="text").map((B)=>B.text).join("")}function EF6(A,Q={}){return new Promise(($,B)=>{let E=!1,D=setTimeout(()=>{J.unsubscribe(),B(Error("Timed out waiting for agent response"))},Q.timeoutMs??600000),J=A.observer.agentState().subscribe((U)=>{if(h3(U)){E=!0;return}if(!E)return;let Y=BF6(A);if(Y===null)return;clearTimeout(D),J.unsubscribe(),$(Y)})})}class vc0 extends d0{listSkillsForThread;clientPool;completionBuilder;history;ideManager;configService;updateService;initialThreadIDs;showWelcome;welcomeVariant;onWelcomeDismissed;notificationService;mcpTrustHandler;onThreadArchived;onActiveThreadChange;onRelaunchRequested;onFirstFrame;initialUserInput;getDefaultNewThreadVisibility;observeThreadSummaries;openThreadPickerOnStart;workspaceSettingsFilePath;context;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.showWelcome=A.showWelcome??!1,this.welcomeVariant=A.welcomeVariant??"intro",this.onWelcomeDismissed=A.onWelcomeDismissed,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.observeThreadSummaries=A.observeThreadSummaries,this.openThreadPickerOnStart=A.openThreadPickerOnStart??!1,this.workspaceSettingsFilePath=A.workspaceSettingsFilePath,this.context=A.context}createState(){return new VR4}}class VR4 extends m0{editorController=new DZ;commandPalette=new up(this);commandRegistry=new ng0;toastController=new $b0;relaunchNotificationController=new hg0;exitHintTimer=new qp(this,1000);ideStatus=new nB(this,{});threadNavigationHistory=new mg0;draftThreadSettings={};draftThreadSettingsSeed={};hasDraftThreadSettingsSeed=!1;draftThreadSettingsInitPromise=null;activeThreadContext=null;activeThreadIDSubscription=null;activePluginMessageSubscription=null;activePluginUIRequestsSubscription=null;connectionErrorsSubscription=null;configSubscription=null;connectingToThreadID=null;executorAlreadyConnectedDialog=null;switchThreadPickerVisible=!1;welcomeVisible=!1;endCreditsVisible=!1;invadersHighScore=0;debugOverlayVisible=!1;focusDebugVisible=!1;unregisterCommands=null;emptyThreadTerminalTitleController=new ml;pluginIntegration=null;mcpTrustIntegration=null;updateRelaunchIntegration=null;noticesPollingTimeout=null;notices;loadThreads=async()=>{return this.widget.context.listThreads()};analyzeContextForThread=async(A,Q)=>{return QK4({ampURL:this.widget.context.ampURL,configService:this.widget.configService,threadID:A,signal:Q})};onSwitchThread=(A)=>{return this.connectToExistingThread(A,{recordNavigation:!0,rethrowError:!0})};threadListSidebar=new uc0({state:this,isBlocked:()=>this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal(),getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,getWorkspaceRoot:()=>this.widget.context.workspaceRoot,loadThreads:this.loadThreads,observeThreadSummaries:()=>this.widget.observeThreadSummaries(),onSelectThread:this.onSwitchThread});sendFeedbackReport=async(A)=>H80({configService:this.widget.configService,settingsFilePath:this.widget.context.settingsFilePath},A);archiveThread=async(A)=>{let Q=await B70({configService:this.widget.configService},A);if(Q===null)this.widget.onThreadArchived?.(A);return Q};addThreadLabel=async(A,Q)=>{let $=await JN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};removeThreadLabel=async(A,Q)=>{let $=await UN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};initState(){if(RX.getInstance().interceptConsole(),this.invadersHighScore=this.widget.context.invadersHighScore??0,this.notices=new ug0(this.widget.configService,($)=>this.setState($)),M6.instance.addPostFrameCallback(()=>{setTimeout(()=>this.widget.onFirstFrame?.(),0),this.noticesPollingTimeout=setTimeout(()=>{this.noticesPollingTimeout=null,this.notices.startPolling()},500)},"Neo notices polling"),this.widget.showWelcome)this.welcomeVisible=!0;if(this.connectionErrorsSubscription=this.widget.clientPool.connectionErrors$.subscribe(({threadID:$,error:B})=>{if(S.error("Neo failed to connect to thread",{threadID:$,error:B}),!$)this.toastController.show(`Connection failed: ${B.message}`,"error",4000)}),this.configSubscription=this.widget.configService.config.subscribe(($)=>{this.applyDraftThreadSettingsSeed(this.applySessionDefaultsToThreadSettings(A00($.settings)))}),this.updateRelaunchIntegration=new dg0({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 $={};if(A)$.initialUserInput=A;this.connectToInitialThreads(Q,$)}else if(A)this.onNewThread([{type:"text",text:A}],this.widget.context.sessionAgentMode);this.pluginIntegration=new xg0({state:this,commandPalette:this.commandPalette,commandRegistry:this.commandRegistry,toastController:this.toastController,context:this.widget.context,getActiveThreadID:this.getActiveThreadID,appendToThread:this.appendPluginMessagesToThread,readThreadMessages:this.readPluginThreadMessages,runAgent:this.runPluginAgent,onBlockingConfirmDialogChange:this.syncEmptyThreadPluginConfirmationTitle}),this.pluginIntegration.init(),this.mcpTrustIntegration=new Hh0({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=Z1.instance.tuiInstance.getEarlyInputText();if(!A)return;this.editorController.insertText(A)}registerAppCommands(){let A=this,Q=this.widget.context.pluginService?ju4({pluginService:this.widget.context.pluginService,workspaceRoot:this.widget.context.workspaceRoot,logFilePath:this.widget.context.logFilePath,toastController:this.toastController}):[],B=[fu4({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),{noun:"thread",verb:"switch",description:"Switch to existing thread",keywords:["resume"],status:{type:"enabled"},sortBoost:100,run:(E,D,J)=>{E.pushWithDismiss((U)=>Nd0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:U,onThreadSelected:J}))}},...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:(E,D,J)=>{A.navigateBack(),J()}},RM4({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:(E,D,J)=>{A.navigateForward(),J()}},{noun:"mcp",verb:"info",description:"Show MCP servers and tools",status:{type:"enabled"},run:(E,D,J)=>{E.push(new Rm0({mcpServers:this.widget.context.mcpServers,onDismiss:J}))}},{noun:"toolbox",verb:"list",description:"List all toolboxes and their tools",status:{type:"enabled"},run:(E)=>{E.pushWithDismiss((D)=>new wc0({toolboxes:this.widget.context.toolboxes,onDismiss:D}))}},{noun:"news",verb:"open",description:"Open Amp Chronicle in browser",keywords:["chronicle","blog","announcements"],status:{type:"enabled"},run:async(E,D,J)=>{try{await H$(D,"https://ampcode.com/chronicle")}finally{J()}}},{noun:"settings",verb:"open in editor",description:"Open CLI settings in $EDITOR",keywords:["config"],status:{type:"enabled"},run:()=>{vz(this.widget.context.settingsFilePath).catch((E)=>{S.error("Failed to open settings file in editor",{error:E})})}},{noun:"IDE",verb:"connect",description:"Connect to an IDE",keywords:["vscode","cursor","jetbrains"],status:{type:"enabled"},run:(E,D,J)=>{E.pushWithDismiss((U)=>new jm0({onCancel:U,onSelect:(Y)=>{this.handleIdeSelection(Y),J()}}))}},{noun:"amp",verb:"help",description:"Show help & keyboard shortcuts",keywords:["manual","?"],status:{type:"enabled"},run:(E,D,J)=>{E.push(new og0({commands:oB.of(D).commands,onDismiss:J}))}},{noun:"amp",verb:"show welcome",description:"Show the welcome message again",status:{type:"enabled"},run:(E,D,J)=>{J(),A.showWelcome()}},{noun:"amp",verb:"end credits",description:"Roll the full-screen Amp credits",status:{type:"enabled"},run:(E,D,J)=>{J(),A.showEndCredits()}},{noun:"amp",verb:"show version",description:"Show current Amp version",keywords:["v"],status:{type:"enabled"},run:(E,D,J)=>{E.push(new o4({header:"Amp Version",maxWidth:72,onDismiss:J,child:new D0({text:new h(v50({version:"0.0.1780172352-gac8e8a",buildTimestamp:"2026-05-30T20:24:02.013Z",buildType:"release"}))})}))}},{noun:"amp",verb:"quit",description:"Exit application",keywords:["exit","close","bye"],shortcut:CA.ctrl("c"),status:{type:"enabled"},run:(E,D)=>{C4.maybeInvoke(D,new hz)}},...Q,...DN4(this.widget.context.logFilePath)].map((E)=>this.commandRegistry.register(E));return()=>{for(let E of B)E()}}build(A){let Q=this.buildHints(),$=this.ideStatus.getValue(),B=this.notices.current,E=new Wc0({initialAgentMode:this.widget.context.sessionAgentMode,initialPluginAgentModeKey:this.widget.context.initialPluginAgentModeKey,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:$,statusItems:this.pluginIntegration?.getStatusItems()??[],pluginConfirmationBlocked:this.pluginIntegration?.hasBlockingConfirmDialog()??!1,notificationService:this.widget.notificationService,notice:this.activeThreadContext||this.welcomeVisible?null:B,onDismissNotice:(I)=>this.notices.dismiss(I)}),D=V4.of(A),J=D.capabilities.animationSupport!=="disabled",U=this.threadListSidebar.visibleWidth(),Y=Math.max(0,D.size.width-U),F=[new VA({constraints:U4.tight(D.size.width,D.size.height),child:this.threadListSidebar.buildBody(E)})];if(this.commandPalette.isEnabled())F.push(new Y$({debugLabel:"CommandPaletteOverlay",onFocusChange:this.closeCommandPaletteOnFocusLoss,child:new ag0({onDismiss:this.commandPalette.disable})}));if(this.switchThreadPickerVisible&&!this.welcomeVisible)F.push(Nd0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:this.closeSwitchThreadPicker,onThreadSelected:this.closeSwitchThreadPicker}));if(this.welcomeVisible)F.push(new Y$({debugLabel:"WelcomeDialogOverlay",child:new Pc0({onDismiss:this.dismissWelcome,onQuit:()=>Z1.instance.stop(),animationsEnabled:J,variant:this.widget.welcomeVariant})}));let X=this.executorAlreadyConnectedDialog;if(X)F.push(new Y$({debugLabel:"ExecutorAlreadyConnectedDialogOverlay",child:new Om0({existingExecutorPid:X.existingExecutorPid,onChoice:this.handleExecutorAlreadyConnectedChoice})}));if(F.push(...this.mcpTrustIntegration?.buildDialogLayers()??[]),F.push(...this.pluginIntegration?.buildDialogLayers()??[]),this.widget.context.isInternalUser)F.push(new sg0({top:this.focusDebugVisible?33:1,visible:this.debugOverlayVisible,pid:R90.pid,activeThreadID:this.activeThreadContext?.client.getThreadId()??null,connectionInfo$:this.activeThreadContext?.observer.connectionInfo()??null}));if(this.focusDebugVisible)F.push(new Lm0);if(this.endCreditsVisible)F.push(new Hm0({onComplete:this.completeEndCredits,highScore:this.invadersHighScore,onHighScoreChange:this.updateInvadersHighScore}));return new WQ({context:this.widget.context,child:new oB({commandRegistry:this.commandRegistry,child:new Hv({completionBuilder:this.widget.completionBuilder,child:new AQ({controller:this.toastController,child:new C4({actions:this.buildActions(),child:new tQ({debugLabel:"AppShortcuts",shortcuts:this.buildShortcuts(),child:new KQ({debugLabel:"AppShellFocus",child:new Bb0({controller:this.toastController,complexToastControllers:[this.relaunchNotificationController,...B&&this.activeThreadContext&&!this.welcomeVisible?[this.notices]:[]],child:new rg0({configReloadEvents:this.widget.configService.configReloadEvents,toastController:this.toastController,child:new lp({left:U,width:Y,child:new t1({children:F})})})})})})})})})})})}buildShortcuts(){let A=new Map([[CA.ctrl("c"),new N70],[CA.ctrl("o"),new u70],[CA.alt("i"),new M70],[CA.alt("p"),new Ep],[CA.ctrl("."),new j70],[CA.ctrl("t"),new v70],...this.threadListSidebar.shortcutEntries()]);if(R90.env.NODE_ENV==="development"&&R90.platform==="darwin")A.set(CA.meta("r"),new q70);return A}buildActions(){let A=new cA(()=>{if(k2.hasAnyCopyableSelection())return k2.tryCopyAnyActiveSelection(),"handled";return this.onExitPressed(),"handled"}),Q=new cA(()=>{if(!this.commandPalette.isEnabled()&&this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.toggle(),"handled"}),$=new cA(()=>{if(this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.enable(),"handled"}),B=new cA(()=>{return this.startNewDraftThread(),"handled"}),E=new cA(()=>{return Z1.instance.stop(),"handled"}),D=new cA(()=>{return Tl({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),"handled"}),J=new cA((I)=>{if(!I.text)return"ignored";return Z1.instance.tuiInstance.clipboard.writeText(I.text).then((G)=>{if(G.ok)this.toastController.show(I.successMessage,"success",2000);else this.toastController.show(`${I.failureMessage}: ${G.userFacingErrorMessage}`,"error",4000)}).catch((G)=>{S.error("Failed to copy Neo text to clipboard",{error:G}),this.toastController.show(I.failureMessage,"error",2000)}),"handled"}),U=new cA(()=>{return Z1.instance.toggleFrameStatsOverlay(),"handled"}),Y=new cA(()=>this.notices.dismissCurrent()?"handled":"ignored"),Z=new cA(()=>{if(!this.widget.context.isInternalUser)return"ignored";return this.setState(()=>{this.debugOverlayVisible=!this.debugOverlayVisible}),"handled"}),F=nu4({getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,context:this.widget.context,toastController:this.toastController,startNewDraftThread:this.startNewDraftThread,sendFeedbackReport:this.sendFeedbackReport}),X=new cA(()=>{return this.setState(()=>{this.focusDebugVisible=!this.focusDebugVisible}),"handled"});return new Map([[N70,A],[Al,B],[hz,E],[q70,D],[DB,J],[El,$],[u70,Q],[M70,Z],...this.threadListSidebar.actionEntries(),[j70,Y],...F,[Ep,U],[v70,X]])}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.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.cancelOwnerUIRequests(),this.activeThreadContext=null,this.connectingToThreadID=null,A.hideDebugOverlay)this.debugOverlayVisible=!1}),this.widget.onActiveThreadChange?.(null),this.syncEmptyThreadPluginConfirmationTitle(),A.prompt!==void 0)this.editorController.text=A.prompt}syncEmptyThreadPluginConfirmationTitle=()=>{this.emptyThreadTerminalTitleController.setPluginConfirmationBlocked(this.activeThreadContext===null&&(this.pluginIntegration?.hasBlockingConfirmDialog()??!1))};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 gP(this.widget.configService));this.applyDraftThreadSettingsSeed(A)}catch(A){S.warn("Failed to initialize Neo draft thread settings",{error:A instanceof Error?A.message:String(A)})}}applySessionDefaultsToThreadSettings(A){let Q=this.widget.context.sessionAgentMode,$=A,B=Qq(Q),E=B50(this.widget.context,Q);if(B!==void 0&&E!==void 0)$={...$,[B]:E};return Q50($,{agentMode:Q,explicitEffort:this.widget.context.explicitReasoningEffort,sessionState:this.widget.context})}applyDraftThreadSettingsSeed(A){if(!this.mounted)return;if(!this.hasDraftThreadSettingsSeed){this.setState(()=>{this.hasDraftThreadSettingsSeed=!0,this.draftThreadSettings=GR4(this.draftThreadSettings,{},A),this.draftThreadSettingsSeed={...A}});return}if(nU(this.draftThreadSettingsSeed,A))return;this.setState(()=>{this.draftThreadSettings=GR4(this.draftThreadSettings,this.draftThreadSettingsSeed,A),this.draftThreadSettingsSeed={...A}})}buildHints(){let A=new Set;if(this.connectingToThreadID)A.add(bz);if(this.exitHintTimer.isActive())A.add(Uv);return A}onExitPressed=()=>{if(this.exitHintTimer.isActive())this.exitHintTimer.clear(),Z1.instance.stop();else this.exitHintTimer.activate()};dismissWelcome=()=>{if(!this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!1}),this.widget.onWelcomeDismissed?.()};updateInvadersHighScore=(A)=>{if(A<=this.invadersHighScore)return;this.setState(()=>{this.invadersHighScore=A}),sY((Q)=>({...Q,neoInvadersHighScore:Math.max(Q.neoInvadersHighScore,A)})).catch((Q)=>{S.warn("Failed to save Neo Invaders high score",{error:Q instanceof Error?Q.message:String(Q)})})};showWelcome=()=>{if(this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!0})};showEndCredits=()=>{if(this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!0})};completeEndCredits=()=>{if(!this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!1})};promptExecutorAlreadyConnected(A){return new Promise((Q)=>{this.setState(()=>{this.executorAlreadyConnectedDialog={existingExecutorPid:A.existingExecutorPid,resolve:($)=>{Q($==="watch"?"observe":"disconnect")}}})})}handleExecutorAlreadyConnectedChoice=(A)=>{if(this.resolveExecutorAlreadyConnectedDialog(A),A==="exit")Z1.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,$=null,B,E,D)=>{await this.ensureDraftThreadSettingsInitialized();let J=this.activeThreadContext?.client.getThreadId(),U=A.find(ae);if(U)this.widget.history.add(U.text,R90.cwd()),this.widget.history.reset();let Y=$?void 0:await this.widget.getDefaultNewThreadVisibility?.(),Z=$??Y??null,F=this.widget.clientPool.createNewThread(Q,this.draftThreadSettings,Z??void 0,E,D);if(this.sendUserMessage(F,A,E?void 0:Q,E?void 0:B),!E)this.rememberSessionDefaultsForNewMessage(Q,this.draftThreadSettings);this.threadNavigationHistory.recordNavigation(J),this.setActiveClient(F)};rememberSessionDefaultsForNewMessage(A,Q){this.widget.context.sessionAgentMode=A;let $=Q["reasoning.effort"];if($!==void 0)this.widget.context.lastReasoningEffortByMode={...this.widget.context.lastReasoningEffortByMode??{},[A]:$};let B=Qq(A),E=B?Q[B]:void 0;if(E!==void 0)this.widget.context.lastSpeedByMode={...this.widget.context.lastSpeedByMode??{},[A]:E};sY((D)=>{let J={...D,agentMode:A};if($!==void 0)J={...J,lastReasoningEffortByMode:{...J.lastReasoningEffortByMode??{},[A]:$}};if(E!==void 0)J={...J,lastSpeedByMode:{...J.lastSpeedByMode??{},[A]:E}};return J}).catch((D)=>{S.warn("Failed to persist Neo session defaults for new message",{error:D instanceof Error?D.message:String(D)})})}sendUserMessage(A,Q,$,B){let E=P50(this.ideStatus.getValue());if(B===void 0){A.client.sendUserMessage(Q,$,{userState:E});return}A.client.sendUserMessage(Q,$,{reasoningEffort:B,userState:E})}getActiveThreadID=()=>{return this.activeThreadContext?.client.getThreadId()??void 0};getRelaunchThreadIDs=()=>{let A=new Set,Q=this.getActiveThreadID();if(Q)A.add(Q);for(let $ of this.widget.clientPool.activeThreadIDs)A.add($);return[...A]};appendPluginMessagesToThread=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("appendToThread is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.append is only available for the active executor thread");for(let E of A)this.sendUserMessage($,[{type:"text",text:E.content}])};readPluginThreadMessages=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("thread.messages is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.messages is only available for the active thread");return GaA(VaA($.observer.protocolMessages()),A)};runPluginAgent=async(A,Q)=>{await this.ensureDraftThreadSettingsInitialized();let $=this.widget.clientPool.createNewThread(this.widget.context.sessionAgentMode,this.draftThreadSettings,void 0,A,Q.agentModeDisplay,Q.parentThreadID,{trackAsLastActive:!1});this.sendUserMessage($,[{type:"text",text:Q.message}]);try{let B=await EF6($,{timeoutMs:Q.timeoutMs}),E=$.client.getThreadId();return E?{threadID:E,text:B}:{text:B}}finally{this.widget.clientPool.disconnect($)}};async connectToExistingThread(A,Q={}){let $=this.activeThreadContext?.client.getThreadId();this.setState(()=>{this.connectingToThreadID=A});try{let B=await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:(E)=>this.promptExecutorAlreadyConnected(E)});if(this.setActiveClient(B),Q.recordNavigation&&$!==A)this.threadNavigationHistory.recordNavigation($);if(Q.initialUserInput)this.sendUserMessage(B,[{type:"text",text:Q.initialUserInput}])}catch(B){if(S.error("Failed to load thread",{error:B,threadID:A}),this.toastController.show(`Failed to load ${A}: ${B instanceof Error?B.message:String(B)}`,"error",4000),Q.rethrowError)throw B}finally{this.setState(()=>{this.connectingToThreadID=null})}}async connectToInitialThreads(A,Q={}){await this.connectToExistingThread(A,Q);let $=this.widget.initialThreadIDs.filter((B)=>B!==A);await Promise.all($.map((B)=>this.resumeBackgroundThread(B)))}async resumeBackgroundThread(A){try{await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:async()=>"observe"})}catch(Q){S.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,agentModeDisplay:$}){this.setState(()=>{this.activeThreadContext={client:A,observer:Q,agentModeDisplay:$}}),this.syncEmptyThreadPluginConfirmationTitle(),this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=Q.threadID().subscribe((B)=>{this.widget.onActiveThreadChange?.(B)}),this.activePluginMessageSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription?.unsubscribe(),this.pluginIntegration?.cancelOwnerUIRequests(),this.activePluginMessageSubscription=Q.pluginMessages().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage(B,(E)=>{A.sendPluginMessage(E)})}),this.activePluginUIRequestsSubscription=Q.pluginUIRequests().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage({type:"plugin_message",message:{type:"event",event:"plugin.ui.snapshot",data:{requests:[...B]}}},(E)=>{A.sendPluginMessage(E)})})}handleIdeSelection=async(A)=>{try{await this.widget.ideManager.connect(A)}catch(Q){S.error("Failed to connect to IDE",{error:Q});let $=Q instanceof Error?Q.message:String(Q);this.toastController.show(`IDE connection failed: ${$}`,"error",4000)}};dispose(){if(this.unregisterCommands?.(),this.unregisterCommands=null,this.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.dispose(),this.pluginIntegration=null,this.emptyThreadTerminalTitleController.dispose(),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.welcomeVisible||(this.mcpTrustIntegration?.hasBlockingDialog()??!1)||this.endCreditsVisible||(this.pluginIntegration?.hasBlockingDialog()??!1)}}function GR4(A,Q,$){let B={...A};for(let E of DF6(Q,$)){if(!nU(A[E],Q[E]))continue;let D=$[E];if(D===void 0)delete B[E];else B[E]=D}return B}function DF6(...A){return Array.from(new Set(A.flatMap((Q)=>Object.keys(Q))))}fB();function zR4(A,Q,$,B){let E=HxA(A),D="\x1B[0m",J="\x1B[34m",U="\x1B[90m",Y="\x1B[2m",Z=[];if(A.archived)Z.push("\x1B[90m\x1B[2mArchived\x1B[0m");Z.push(`${E}`),Z.push(`\x1B[34m${Q}\x1B[0m`),Z.push(`\x1B[90mamp threads continue ${A.id}\x1B[0m`);let F=14,X=7,I=new _2(F,X),G=new O5(42),V=new qv(F,X,F,X,F,X,0,A.agentMode??"smart","intensity","ascii",void 0,void 0,g0.default(),G);V.layout(U4.tight(F,X)),V.paint(I,0,0);let z=I.getBuffer().getCells(),K=0;for(let R=0;R<X;R++)if(z[R].some((_)=>_.char!==" ")){K=R;break}let W=X-1;for(let R=X-1;R>=0;R--)if(z[R].some((_)=>_.char!==" ")){W=R;break}function C(R,_){if(!R)return"";if(R.type==="rgb"){let{r:P,g:f,b:m}=R.value;if($.getColorDepth()>=24)return`\x1B[${_?38:48};2;${P};${f};${m}m`;let y=Xp(P,f,m);return`\x1B[${_?38:48};5;${y}m`}return""}let H=[];if(W>=K)for(let R=K;R<=W;R++){let _="";for(let P=0;P<F;P++){let f=z[R][P],m=f.char,y=C(f.style.fg,!0);_+=y+m+"\x1B[0m"}H.push(_)}let N=H.length,q=Math.max(N,Z.length),w=Math.floor((q-N)/2),L=Math.floor((q-Z.length)/2);for(let R=0;R<q;R++){let _=" ".repeat(F);if(R>=w&&R<w+N)_=H[R-w];let P=" ",f="";if(R>=L&&R<L+Z.length)f=Z[R-L];$.write(_+P+f+`
4476
4476
  `)}if(B)$.write(`
4477
4477
  \x1B[90m${B}\x1B[0m
4478
4478
  `)}a0();class Tc0{status=T3.status;constructor(){this.autoConnect()}async connect(A){await T3.start(A,!0,"user-initiated"),T3.selectConfig(A)}autoConnect(){let A=T3.getSelectedConfig();if(A){T3.start(A,!0,"auto-startup").catch((Q)=>{S.error("Failed to auto-connect to IDE",{error:Q})});return}this.discoverAndConnect()}async discoverAndConnect(){try{await mbA();let A=await cC({});if(A.length===1&&A[0])T3.selectConfig(A[0]),await T3.start(A[0],!0,"auto-startup")}catch(A){S.error("Failed to auto-discover IDE",{error:A})}}}a0();a0();import{exec as iq}from"node:child_process";function KR4(A="idle"){try{if(A==="idle"){if(process.platform==="darwin")iq("afplay /System/Library/Sounds/Submarine.aiff");else if(process.platform==="win32")iq("powershell [console]::beep(800,200)");else if(process.platform==="linux")iq("paplay /usr/share/sounds/freedesktop/stereo/message.oga || beep")}else if(A==="idle-review"){if(process.platform==="darwin")iq("afplay /System/Library/Sounds/Glass.aiff")}else if(A==="requires-user-input"){if(process.platform==="darwin")iq("afplay /System/Library/Sounds/Ping.aiff");else if(process.platform==="win32")iq("powershell [console]::beep(1000,300)");else if(process.platform==="linux")iq("paplay /usr/share/sounds/freedesktop/stereo/dialog-information.oga || beep -f 1000 -l 100")}}catch(Q){S.error(`Failed to play notification sound (${A}):`,Q)}}Kp();ix0();var JF6=2000,UF6="Agent is ready",YF6="Waiting for approval";function WR4(A){let Q=!0,$=!0,B=A.configService.config.subscribe((W)=>{Q=W.settings["notifications.enabled"]??!0,$=W.settings["notifications.system.enabled"]!==!1}),E=0,D=()=>{let W=G?.prepareTerminalTitleForNotification();if(W!==void 0)process.stdout.write(Ez4(W))},J=(W)=>{if(!Q)return;let C=Date.now();if(C-E<JF6)return;if(E=C,Pz())return;if(nI4())D(),setTimeout(aI4,Tx0);else KR4(W)},U=()=>{J("idle"),V(UF6)},Y=()=>{J("requires-user-input"),V(YF6)},Z=(W)=>W?.attempt===void 0||W.attempt===0,F=null,X=null,I=null,G,V=(W)=>{if(!Q||!$)return;if(Pz()&&!lx0()&&!z50())return;D(),setTimeout(()=>{process.stdout.write(Bz4(W))},Tx0)},z=()=>{F?.unsubscribe(),X?.unsubscribe(),F=null,X=null,I=null,G=void 0};return{attach:(W,C,H)=>{if(z(),G=H,C)X=C.subscribe({next:(N)=>{if(N===null)return;if(!Z(N))return;U()},error:(N)=>{S.debug("Neo notification active error stream errored",{error:N})}});F=W.subscribe({next:(N)=>{try{let q=I!==null&&h3(I),w=I==="awaiting_approval",L=q||w;if(N==="awaiting_approval"&&!w)Y();else if(N==="idle"&&L)U()}catch(q){S.debug("Neo notification handling failed",{error:q})}finally{I=N}},error:(N)=>{S.debug("Neo notification agent state stream errored",{error:N})}})},detach:z,unsubscribe(){z(),B.unsubscribe()}}}function ZF6({initialUserInput:A,showWelcome:Q,hideWelcome:$,welcomeVariant:B,welcomeDismissed:E}){if($)return{show:!1,markDismissedOnDismiss:!1};if(B==="npm-migration")return{show:!0,markDismissedOnDismiss:!1};if(Q)return{show:!0,markDismissedOnDismiss:!0};let D=!A&&!E;return{show:D,markDismissedOnDismiss:D}}async function FF6(A){await sY((Q)=>cP(Q,A,"interactive"))}async function CR4(A,Q={}){let{initialThreadIDs:$=[],initialUserInput:B,getDefaultNewThreadVisibility:E,openThreadPickerOnStart:D=!1,observerOnly:J=!1,initialAgentMode:U,initialPluginAgentModeKey:Y,initialReasoningEffort:Z,onFirstFrame:F,showWelcome:X=!1,hideWelcome:I=!1,welcomeVariant:G="intro"}=Q,V=G==="npm-migration";if($.length>1)S.info("Resuming multiple initial threads",{threadIDs:$});let z=async(m)=>{let y=await A.getThreadFromServer(m);if(!y)return null;return L30(y)},K=async(m)=>{let y=await A.getThreadFromServer(m);if(!y)throw Error(`Thread ${m} not found`);let T=await uB(m,A.configService,A.apiKey,{usesThreadActors:!0}),k=D9({endpoint:A.rivetEndpoint,poolName:T.poolName}),c={wsToken:T.wsToken,transport:"json-rpc"},b=await k.threadActor.get([T.threadId],{params:c}).fetch("/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({thread:j30(y)}),skipReadyWait:!0});if(!b.ok&&b.status!==409)throw Error(`Thread import failed (${b.status}): ${await b.text()}`);try{await k30(m,A.configService,A.apiKey,{executorType:"local-client"})}catch(p){S.warn("failed to mark thread as imported on server",{threadID:m,error:p instanceof Error?p.message:String(p)})}},W=new qx0(A.rivetEndpoint,A.apiKey,A.configService,{clientID:Kz.parse(`neo-${crypto.randomUUID()}`),toolService:A.toolService,skillService:A.skillService,requestPluginToolCall:(m)=>A.pluginService.event.toolCall(m),requestPluginToolResult:(m)=>A.pluginService.event.toolResult(m),pluginService:A.pluginService,pluginPlatform:A.pluginPlatform,invokeTool:async(m,y)=>{let T=typeof y.args==="object"&&y.args!==null?y.args:{},k=await wz({toolName:y.toolName,configService:A.configService,toolService:A.toolService,mcpService:A.mcpService,skillService:A.skillService,toolUseID:y.toolCallId,threadId:m});return A.toolService.invokeTool(y.toolName,{args:T},k)},persistLastThreadID:FF6,readFileSystemDirectory:A.readFileSystemDirectory},z,K),C=await $q(),H=ZF6({initialUserInput:B,showWelcome:X,hideWelcome:I,welcomeVariant:G,welcomeDismissed:C.neoWelcomeDismissed}),N={ampURL:A.ampURL,configService:A.configService,getThreadMarkdown:async(m)=>{let y=await A.getThreadFromServer(m);return y?o10(y):null},isInternalUser:A.isInternalUser,listThreads:A.listThreads,loadThreadTail:A.getThreadTail,logFilePath:Tc,mcpServers:A.mcpService.servers,pluginPlatform:A.pluginPlatform,pluginService:A.pluginService,toolboxes:A.toolboxes,observerOnly:V?!1:J,invadersHighScore:C.neoInvadersHighScore,sessionAgentMode:U??C.agentMode,initialPluginAgentModeKey:Y,explicitReasoningEffort:Z,lastReasoningEffortByMode:C.lastReasoningEffortByMode,lastSpeedByMode:C.lastSpeedByMode,settingsFilePath:A.settingsFilePath,workspaceRoot:A.workspaceRoot},q=(m,y)=>{return gV4({ampURL:A.ampURL,configService:A.configService,threadID:m,signal:y})},w=()=>dV4({apiKey:A.apiKey,configService:A.configService,rivetEndpoint:A.rivetEndpoint}),L=new Tc0,R=WR4({configService:A.configService}),_=await A.configService.getLatest();Z1.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:_.settings["terminal.animation"]===!1}});let P=new Set,f=new bg0;try{await nx0(new vc0({clientPool:W,listSkillsForThread:q,completionBuilder:A.completionBuilder,history:new ty0,ideManager:L,configService:A.configService,updateService:A.updateService,initialThreadIDs:V?[]:$,notificationService:R,mcpTrustHandler:A.mcpTrustHandler,initialUserInput:V?void 0:B,getDefaultNewThreadVisibility:E,observeThreadSummaries:w,openThreadPickerOnStart:V?!1:D,workspaceSettingsFilePath:A.workspaceSettingsFilePath,context:N,showWelcome:H.show,welcomeVariant:G,onActiveThreadChange:A.setActiveThreadID,onRelaunchRequested:f.request,onWelcomeDismissed:H.markDismissedOnDismiss?()=>{sY(iV4).catch((y)=>{S.warn("Failed to mark Neo welcome as dismissed",{error:y})})}:void 0,onThreadArchived:(y)=>{P.add(y)},onFirstFrame:F}));let m=W.lastActiveObservingClient;if(m&&f.shouldShowExitSummary){let{client:y,observer:T}=m,k=y.getThreadId();if(k){let c={id:k,title:T.title().getValue(),agentMode:T.agentMode,archived:P.has(k)},d=`${A.ampURL.replace(/\/$/,"")}/threads/${k}`;zR4(c,d,process.stdout)}}}finally{process.stdout.write(C50("")),R.unsubscribe(),W.dispose(),await A.dispose?.()}process.exit(f.relaunchIfRequested(A.workspaceRoot)??0)}import{execFile as XF6}from"node:child_process";import{closeSync as HR4,openSync as IF6,writeSync as GF6}from"node:fs";import VF6 from"node:tty";var zF6="\x1B[c",KF6="\x1B[?1004h",WF6="\x1B[?1004l",CF6="\x1B[?u",NR4=200,HF6="\x1B[>4;2m",NF6="\x1B[?9001h",qF6="\x1B[?9001l";function qR4(){let A=null;try{if(process.stdout.isTTY){let Q=process.stdout.getWindowSize();A=[Q[0],Q[1]]}}catch{}return{isTTY:process.stdout.isTTY,columns:process.stdout.columns??null,rows:process.stdout.rows??null,windowSize:A,hasRefreshSize:typeof process.stdout._refreshSize==="function"}}function uF6(){if(process.stdout.isTTY)return{stream:process.stdout,target:"stdout",dispose:()=>{}};if(process.stderr.isTTY)return{stream:process.stderr,target:"stderr",dispose:()=>{}};if(process.platform!=="win32")try{let A=IF6("/dev/tty","w");if(VF6.isatty(A))return{stream:{write(Q){return GF6(A,Q),!0}},target:"dev-tty",dispose:()=>{HR4(A)}};HR4(A)}catch{}return{stream:process.stdout,target:"stdout",dispose:()=>{}}}function u$(A,Q){if(!process.stdout.writable||process.stdout.destroyed){Q?.();return}let $=`${JSON.stringify(A)}
@@ -6372,7 +6372,7 @@ Start Amp from a smaller directory.`};function oX(A,Q){if(!fI4())return;S.debug(
6372
6372
  `)}function Gv4(A,Q){A.command("usage").description("Show your current Amp usage and credit balance").action(async($,B)=>{let E=B.optsWithGlobals(),D=await Q(E),J=await x30(D),U=await z4.userDisplayBalanceInfo({},{config:J});if(!U.ok){if(U.error.code==="auth-required")process.stderr.write(f0.red("Error: ")+"You must be logged in to view usage. Run `amp login` first.\n"),process.exit(1);process.stderr.write(f0.red("Error: ")+U.error.message+`
6373
6373
  `),process.exit(1)}process.stdout.write(await RV6(U.result.displayText)+`
6374
6374
  `),process.exit(0)})}var sC6=Si.join(lU,"logs","headless.log"),Tl0=Si.join(hx,"device-id.json");SF4();async function tC6(){let A=await Promise.all(dC.map(async(Q)=>{try{return{query:Q,hasConfigs:(await Q.listConfigs()).length>0}}catch($){return S.debug("Failed to detect query-based IDE integration",{ideName:Q.ideName,error:$}),{query:Q,hasConfigs:!1}}}));for(let Q of A)if(Q.hasConfigs)return Q.query;return}function mS4(){tC6().then((A)=>{if(A){let Q=V00(A.ideName);if(Q)yC(Q)}})}try{if(process.platform==="win32")await Promise.resolve().then(() => M4(JT(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(A){z7.write(`Failed to change directory to ${process.env.AMP_PWD}: ${A}
6375
- `)}function eC6(A){process.emitWarning=(Q,$,B,E)=>{let D=typeof Q==="string"?Q:Q.message||String(Q),J=$||"Warning",U=!1;A.warn(D,{name:J,code:B})}}function C3(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")gG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("mode")==="cli"&&UT(Q.mode))gG("experimental.agentMode",Q.mode)}function AH6(A,Q){if(!Q$(Q))return;if(!L7(Q.user.email)){if(A.model)throw new GA("The --model flag is only available for Amp employees.",1);gG("internal.model",void 0);return}if(A.model)gG("internal.model",BH6(A.model))}function kS4(A){let Q=A.indexOf(":");if(Q===-1)throw new GA(`Invalid model format "${A}". Expected "provider:model" (e.g., "anthropic:claude-sonnet-4-20250514").`,1);let $=A.slice(0,Q).trim(),B=A.slice(Q+1).trim();if(!$||!B)throw new GA(`Invalid model format "${A}". Both provider and model must be non-empty (e.g., "anthropic:claude-sonnet-4-20250514").`,1)}function QH6(A){if(A===void 0)return;let Q=A.trim();if(se(Q))return Q;throw new GA(`Invalid effort "${A}". Expected one of: none, minimal, low, medium, high, xhigh, max.`,1)}function $H6(A,Q){if(MF(A,Q))return;let $=hC(A)?.levels,B=$?` Allowed for ${A}: ${$.join(", ")}.`:"";throw new GA(`Reasoning effort "${Q}" is not available for ${A} mode.${B}`,1)}function BH6(A){if(!A.includes("="))return kS4(A),A;let Q={};for(let $ of A.split(",")){let B=$.trim();if(!B)continue;let E=B.indexOf("=");if(E===-1)throw new GA(`Invalid mode-specific model entry "${B}". Expected "mode=provider:model" (e.g., "smart=anthropic:claude-sonnet-4-20250514").`,1);let D=B.slice(0,E).trim(),J=B.slice(E+1).trim();if(!D)throw new GA(`Missing mode name in "${B}". Expected "mode=provider:model".`,1);if(!J)throw new GA(`Missing model value for mode "${D}". Expected "${D}=provider:model".`,1);kS4(J),Q[D]=J}if(Object.keys(Q).length===0)throw new GA("No valid model overrides found in --model flag value.",1);return Q}function _E0(A,Q,$){let B=Number(A);if(!Number.isInteger(B)||B<$.min)throw new I30(`${Q} must be an integer >= ${$.min}`);if($.max!==void 0&&B>$.max)throw new I30(`${Q} must be an integer <= ${$.max}`);return B}function EH6(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 DH6(A){try{return await gS4(A,"utf-8")}catch{return A}}async function JH6(A,Q,$){let B=EH6(A,Q);if(!B)return;let E=Q$($)?$.features:[],D=Q$($)?$.user.email:void 0;if(!dS4(E,ID.HARNESS_SYSTEM_PROMPT)&&!(D&&L7(D)))throw new GA("You are not allowed to do this.",1);gG("systemPrompt",await DH6(B))}function dS4(A,Q){return A?.some(($)=>$.name===Q&&$.enabled)??!1}function UH6(A){return A!=="pending"}function Ju(A){if(!Q$(A))return null;return{...A.user,features:A.features??[],team:A.workspace??void 0}}function YH6(A){let Q=Ju(A);if(Q)return Q.id;if(xC(A))throw Error(A.error.message);throw Error("unreachable")}function ZH6(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 FH6(A){let B=ZH6(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 GA(`Couldn't connect to the Amp server at ${A}.`,1,B)}function kl0(A,Q){let $=Uy0(Error(A.error.message));if($.message===G3.networkOffline||$.message===G3.networkTimeout)return FH6(Q);if($.message!==G3.internalBug)return new GA($.message,1,$.suggestion);return new GA(A.error.message.replace(/^Error: /,""),1)}async function XH6(){if(process.versions.bun)return!1;try{return await rY()==="npm"}catch(A){return S.debug("Failed to detect package manager for Neo npm migration welcome",{error:A}),!1}}var fS4=[{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??nJ,description:`Custom settings file path (overrides the default location ${nJ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(S).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Tc})`},{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:uE(),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:i9.SMART.key,description:`Set the agent mode (${hG({}).map((A)=>A.mode).join(", ")}) — controls the model, system prompt, and tool selection`},{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:"Show migration instructions for the removed legacy runtime",hidden:!0},{name:"orb",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}],yS4=(A)=>("deprecated"in A)&&A.deprecated===!0,IH6=(A)=>("hidden"in A)&&A.hidden===!0,GH6=(A)=>("default"in A),VH6=(A)=>("default"in A)?A.default:void 0;function xS4(A,Q){if(A.getOptionValueSourceWithGlobals("effort")!=="cli")return;let $=QH6(Q.effort);if($!==void 0){if(UT(Q.mode))$H6(Q.mode,$)}return $}var zH6="Amp Neo is now Amp and available to everyone. If you need to finish work in the old Amp, you can use an older version. For instructions on how to do that and more information: https://ampcode.com/news/drop-the-neo";function UT(A){return Object.values(i9).some((Q)=>Q.key===A)}function KH6(A,Q){if(UT(A))return A;throw new GA(`${Q} does not support plugin-defined agent modes`,1)}function cS4(A,Q){if(UT(Q))return{agentMode:Q};let $=A.agentModes.list().find((E)=>E.key===Q||E.label===Q);if(!$){let E=hG({}).map((U)=>U.mode).join(", "),D=A.agentModes.list().map((U)=>U.label).join(", "),J=D?` Plugin modes: ${D}.`:"";throw new GA(`Unknown agent mode '${Q}'. Built-in modes: ${E}.${J}`,1)}let B={label:$.label};if($.color!==void 0)B.color=$.color;return{agentMode:i9.SMART.key,agent:$.agent,agentModeDisplay:B,pluginAgentModeKey:$.key}}async function WH6(A,Q,$){if(A.getOptionValueSourceWithGlobals("mode")!=="cli")return;return await Q.initialized,cS4(Q,$)}function CH6(A,Q){let $=Q.args[0],B=Q.commands.map((D)=>D.name());if($&&!$.includes(" ")&&$.length<30&&!/[./\\]/.test($)){let D=B.filter((U)=>$.includes(U)||U.includes($)),J="Run amp --help for a list of available commands.";if(D.length>0)J=`Did you mean: ${D.join(", ")}? Or run amp --help for all commands.`;throw new GA(G3.unknownCommand($),1,J)}}var SE0=p0.file(rC6.homedir()),_l0=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):BA.joinPath(SE0,".config");async function LB(A,Q,$){let B=$?.deferAuth??!1,E=$?.skipToolProviders??!1;vxA("0.0.1780162602-gb8f27a");let D=U00({storage:A.settings,secretStorage:A.secrets,workspaceRoot:process.cwd(),defaultAmpURL:A.ampURL,homeDir:SE0,userConfigDir:_l0}),J=A.secrets.get("apiKey",A.ampURL),U=nO(D),Y=null,Z=()=>{return},F=new Promise((t)=>{Z=t}),X=J.then(async(t)=>{if(!t&&!B)await F;return Y??=U.subscribe(()=>{}),P4(U.pipe(B5(UH6)))});X.catch(()=>{return}),aP4(D);let I=await D.getLatest();S.debug("Global configuration initialized",{settingsKeys:Object.keys(I.settings)});let G=!1;{let t=await J;if(G=Boolean(t),S.info("API key lookup before login",{found:Boolean(t),ampURL:A.ampURL,deferAuth:B}),!t)if(B)S.info("No API key found, continuing startup with deferred auth");else{RQ.write(`No API key found. Starting login flow...
6375
+ `)}function eC6(A){process.emitWarning=(Q,$,B,E)=>{let D=typeof Q==="string"?Q:Q.message||String(Q),J=$||"Warning",U=!1;A.warn(D,{name:J,code:B})}}function C3(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")gG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("mode")==="cli"&&UT(Q.mode))gG("experimental.agentMode",Q.mode)}function AH6(A,Q){if(!Q$(Q))return;if(!L7(Q.user.email)){if(A.model)throw new GA("The --model flag is only available for Amp employees.",1);gG("internal.model",void 0);return}if(A.model)gG("internal.model",BH6(A.model))}function kS4(A){let Q=A.indexOf(":");if(Q===-1)throw new GA(`Invalid model format "${A}". Expected "provider:model" (e.g., "anthropic:claude-sonnet-4-20250514").`,1);let $=A.slice(0,Q).trim(),B=A.slice(Q+1).trim();if(!$||!B)throw new GA(`Invalid model format "${A}". Both provider and model must be non-empty (e.g., "anthropic:claude-sonnet-4-20250514").`,1)}function QH6(A){if(A===void 0)return;let Q=A.trim();if(se(Q))return Q;throw new GA(`Invalid effort "${A}". Expected one of: none, minimal, low, medium, high, xhigh, max.`,1)}function $H6(A,Q){if(MF(A,Q))return;let $=hC(A)?.levels,B=$?` Allowed for ${A}: ${$.join(", ")}.`:"";throw new GA(`Reasoning effort "${Q}" is not available for ${A} mode.${B}`,1)}function BH6(A){if(!A.includes("="))return kS4(A),A;let Q={};for(let $ of A.split(",")){let B=$.trim();if(!B)continue;let E=B.indexOf("=");if(E===-1)throw new GA(`Invalid mode-specific model entry "${B}". Expected "mode=provider:model" (e.g., "smart=anthropic:claude-sonnet-4-20250514").`,1);let D=B.slice(0,E).trim(),J=B.slice(E+1).trim();if(!D)throw new GA(`Missing mode name in "${B}". Expected "mode=provider:model".`,1);if(!J)throw new GA(`Missing model value for mode "${D}". Expected "${D}=provider:model".`,1);kS4(J),Q[D]=J}if(Object.keys(Q).length===0)throw new GA("No valid model overrides found in --model flag value.",1);return Q}function _E0(A,Q,$){let B=Number(A);if(!Number.isInteger(B)||B<$.min)throw new I30(`${Q} must be an integer >= ${$.min}`);if($.max!==void 0&&B>$.max)throw new I30(`${Q} must be an integer <= ${$.max}`);return B}function EH6(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 DH6(A){try{return await gS4(A,"utf-8")}catch{return A}}async function JH6(A,Q,$){let B=EH6(A,Q);if(!B)return;let E=Q$($)?$.features:[],D=Q$($)?$.user.email:void 0;if(!dS4(E,ID.HARNESS_SYSTEM_PROMPT)&&!(D&&L7(D)))throw new GA("You are not allowed to do this.",1);gG("systemPrompt",await DH6(B))}function dS4(A,Q){return A?.some(($)=>$.name===Q&&$.enabled)??!1}function UH6(A){return A!=="pending"}function Ju(A){if(!Q$(A))return null;return{...A.user,features:A.features??[],team:A.workspace??void 0}}function YH6(A){let Q=Ju(A);if(Q)return Q.id;if(xC(A))throw Error(A.error.message);throw Error("unreachable")}function ZH6(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 FH6(A){let B=ZH6(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 GA(`Couldn't connect to the Amp server at ${A}.`,1,B)}function kl0(A,Q){let $=Uy0(Error(A.error.message));if($.message===G3.networkOffline||$.message===G3.networkTimeout)return FH6(Q);if($.message!==G3.internalBug)return new GA($.message,1,$.suggestion);return new GA(A.error.message.replace(/^Error: /,""),1)}async function XH6(){if(process.versions.bun)return!1;try{return await rY()==="npm"}catch(A){return S.debug("Failed to detect package manager for Neo npm migration welcome",{error:A}),!1}}var fS4=[{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??nJ,description:`Custom settings file path (overrides the default location ${nJ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(S).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Tc})`},{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:uE(),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:i9.SMART.key,description:`Set the agent mode (${hG({}).map((A)=>A.mode).join(", ")}) — controls the model, system prompt, and tool selection`},{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:"Show migration instructions for the removed legacy runtime",hidden:!0},{name:"orb",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}],yS4=(A)=>("deprecated"in A)&&A.deprecated===!0,IH6=(A)=>("hidden"in A)&&A.hidden===!0,GH6=(A)=>("default"in A),VH6=(A)=>("default"in A)?A.default:void 0;function xS4(A,Q){if(A.getOptionValueSourceWithGlobals("effort")!=="cli")return;let $=QH6(Q.effort);if($!==void 0){if(UT(Q.mode))$H6(Q.mode,$)}return $}var zH6="Amp Neo is now Amp and available to everyone. If you need to finish work in the old Amp, you can use an older version. For instructions on how to do that and more information: https://ampcode.com/news/drop-the-neo";function UT(A){return Object.values(i9).some((Q)=>Q.key===A)}function KH6(A,Q){if(UT(A))return A;throw new GA(`${Q} does not support plugin-defined agent modes`,1)}function cS4(A,Q){if(UT(Q))return{agentMode:Q};let $=A.agentModes.list().find((E)=>E.key===Q||E.label===Q);if(!$){let E=hG({}).map((U)=>U.mode).join(", "),D=A.agentModes.list().map((U)=>U.label).join(", "),J=D?` Plugin modes: ${D}.`:"";throw new GA(`Unknown agent mode '${Q}'. Built-in modes: ${E}.${J}`,1)}let B={label:$.label};if($.color!==void 0)B.color=$.color;return{agentMode:i9.SMART.key,agent:$.agent,agentModeDisplay:B,pluginAgentModeKey:$.key}}async function WH6(A,Q,$){if(A.getOptionValueSourceWithGlobals("mode")!=="cli")return;return await Q.initialized,cS4(Q,$)}function CH6(A,Q){let $=Q.args[0],B=Q.commands.map((D)=>D.name());if($&&!$.includes(" ")&&$.length<30&&!/[./\\]/.test($)){let D=B.filter((U)=>$.includes(U)||U.includes($)),J="Run amp --help for a list of available commands.";if(D.length>0)J=`Did you mean: ${D.join(", ")}? Or run amp --help for all commands.`;throw new GA(G3.unknownCommand($),1,J)}}var SE0=p0.file(rC6.homedir()),_l0=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):BA.joinPath(SE0,".config");async function LB(A,Q,$){let B=$?.deferAuth??!1,E=$?.skipToolProviders??!1;vxA("0.0.1780172352-gac8e8a");let D=U00({storage:A.settings,secretStorage:A.secrets,workspaceRoot:process.cwd(),defaultAmpURL:A.ampURL,homeDir:SE0,userConfigDir:_l0}),J=A.secrets.get("apiKey",A.ampURL),U=nO(D),Y=null,Z=()=>{return},F=new Promise((t)=>{Z=t}),X=J.then(async(t)=>{if(!t&&!B)await F;return Y??=U.subscribe(()=>{}),P4(U.pipe(B5(UH6)))});X.catch(()=>{return}),aP4(D);let I=await D.getLatest();S.debug("Global configuration initialized",{settingsKeys:Object.keys(I.settings)});let G=!1;{let t=await J;if(G=Boolean(t),S.info("API key lookup before login",{found:Boolean(t),ampURL:A.ampURL,deferAuth:B}),!t)if(B)S.info("No API key found, continuing startup with deferred auth");else{RQ.write(`No API key found. Starting login flow...
6376
6376
  `);let W0=await HH6(A),l=await A.secrets.get("apiKey",A.ampURL);if(S.info("Login flow completed",{success:W0,storedKeyPresent:Boolean(l),ampURL:A.ampURL}),!W0)await aY(),process.exit(1);G=!0,Z()}}{let t=await D.getLatest(),W0=t.settings.url,l=t.secrets.isSet?.[W0];S.info("Config secrets state after login",{configURL:W0,apiKeySet:l?.apiKey??!1})}let V=B?"pending":await X;if(!B)S.info("Server status resolved",{status:"ready",isAuthenticated:Q$(V),isError:xC(V),errorMessage:xC(V)?V.error.message:void 0});AH6(Q,V);let z=X.then((t)=>YH6(t));z.catch(()=>{return});let K=Q$(V),W=!1;if(process.env.AMP_DISABLE_PLUGINS==="1")S.warn("Ignoring AMP_DISABLE_PLUGINS outside development");let C=W?"off":"all",{toolService:H,dispose:N}=FD4({configService:D}),q=new Map,w=()=>q.clear(),L=new XM0(D,A.settings.getWorkspaceRootPath()),R=QtA({configService:D}),_=ynA({configService:D,trustStore:L,skillMCPServers:R.skillMCPServers,uploadImageAttachments:K,createOAuthProvider:async(t,W0,l)=>{let i=`${t}:${W0}`,A0=q.get(i);if(A0)return S.debug("Reusing existing OAuth provider for server",{serverName:t,serverUrl:W0}),A0;S.debug("Creating OAuth provider for server",{serverName:t,serverUrl:W0});let r=(async()=>{let B0=new oC(A.secrets),Q0=await B0.getClientInfo(t,W0),V0=l?.scopes??Q0?.scopes,z0=eI4();S.info("OAuth headless mode check",{useHeadless:z0,executeMode:A.executeMode,envVar:process.env.AMP_HEADLESS_OAUTH,isTTY:RQ.isTTY});let w0;if(z0)w0=A.executeMode?tI4():sI4(t);let X0=new Bq0({storage:B0,serverName:t,serverUrl:W0,clientId:l?.clientId??Q0?.clientId,clientSecret:l?.clientSecret??Q0?.clientSecret,authUrl:l?.authUrl??Q0?.authUrl,tokenUrl:l?.tokenUrl??Q0?.tokenUrl,scopes:V0,headlessAuthHandler:w0});return S.debug("OAuth provider created",{serverName:t,serverUrl:W0,hasManualClientId:!!(l?.clientId??Q0?.clientId),willUseDCR:!(l?.clientId??Q0?.clientId),scopes:V0,headlessMode:z0,executeMode:A.executeMode}),X0})();return q.set(i,r),r}}),P=IL0({configService:D,spawn:t10}),f=Q.headless?CP4():void 0,m=f??new g90({configService:D}),y=m instanceof g90?m:void 0;if(y)y.pluginExecutorKind="local";let T=new H4(null),k=null,c=K&&!W?[...qP4(I.settings)?[{name:"permissions",entryPoint:nc0}]:[],{name:"thread-visibility",entryPoint:MP4(D,()=>X.then(Ju),()=>k,(t)=>{k=t}),alwaysLoad:!0}]:[],d=MM0({configService:D,platform:m,loadGlobalPlugins:wy0(D),pluginFilter:C,activeThread$:T,internalPlugins:c}),b=faA(d),p=[_,P,b],n;if(E)n=new Map;else if(A.executeMode){let t=await jeA({toolService:H,providers:p,initialTimeout:15000});n=t.registrations;for(let[W0,l]of t.initErrors)S.warn(`${W0} provider initialization slow or failed:`,l)}else n=GL0({toolService:H,providers:p});if(Q.jetbrains)yC("JetBrains");else if(Q.ide&&DG4())yC("VS Code");else if(Q.ide&&JG4())yC("Neovim");else if(Q.ide&&A.executeMode)mS4();if(A.executeMode)TxA(!0);let s,I0=T3.status.pipe(lA((t)=>Boolean(t.connected&&t.authenticated&&t.ideName&&kbA(t.ideName))),BQ()).subscribe((t)=>{if(t){if(!s)s=H.registerTool(LeA)}else s?.dispose(),s=void 0}),E0;if(!A.executeMode){let t=await A.settings.get("fuzzy.alwaysIncludePaths")??[];E0=new y30(process.cwd(),{alwaysIncludePaths:t},!0)}else E0=new class extends y30{async start(){}async query(){return[]}async queryCompletions(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};let G0=ah(D);S.info("Starting Amp background services");let F0=new Ap0,q0={configService:D,toolService:H,mcpService:_,skillService:R,toolboxService:P,trustStore:L,threadRemote:G0,setThreadMeta:G0.setThreadMeta,secretStorage:A.secrets,settingsStorage:A.settings,fuzzyServer:E0,terminal:F0,pluginService:d,pluginPlatform:y,headlessPluginPlatform:f,activeThread$:T,serverStatus:V,serverStatusPromise:X,viewerUserIDPromise:z,hasAPIKeyAtStartup:G,consumeDraftNewThreadVisibility:()=>{let t=k;return k=null,t}};return{...q0,async asyncDispose(){if(q0.mcpService.hasAuthenticatingClients())S.info("Waiting for OAuth authentication to complete before exit..."),await q0.mcpService.waitForAuthentication();for(let t of n.values())t.dispose();await q0.mcpService.dispose(),w(),q0.configService.unsubscribe(),Y?.unsubscribe(),N(),q0.fuzzyServer.dispose(),q0.settingsStorage[Symbol.dispose](),I0.unsubscribe(),s?.dispose(),await q0.pluginService.dispose()}}}async function HH6(A){if(!A.executeMode){if(!await x90("Would you like to log in to Amp? [(y)es, (n)o]: "))return RQ.write(`Login cancelled. Run the command again to retry.
6377
6377
  `),!1}return await pS4(A)}async function pS4(A){let Q=nC6(32).toString("hex"),$=await mc0(A.ampURL,Q),B=new AbortController;try{await OG($,B.signal)}catch(D){S.error("Error opening browser",{error:D})}let E=await mc0(A.ampURL,Q,!1);RQ.write(`If your browser does not open automatically, visit:
6378
6378
 
@@ -6380,7 +6380,7 @@ ${f0.blue.bold(E)}
6380
6380
 
6381
6381
  `);try{return await AP4(A.ampURL,Q,A.secrets,B),RQ.write("\nLogin successful! Run `amp` to get started.\n"),!0}catch(D){return S.error("Login failed",{error:D}),z7.write(`
6382
6382
  Login failed: ${D instanceof Error?D.message:String(D)}
6383
- `),!1}}async function NH6(A,Q,$){let B=await Q.get("apiKey",A);if(!B)throw new GA("No Amp API key found. Run `amp login` first.",1);let E=iC6("curl",["-H",`Authorization: Bearer ${B}`,...$],{stdio:"inherit"});process.exitCode=await new Promise((D,J)=>{E.on("error",J),E.on("close",(U)=>D(U??1))})}function qH6(A){let Q=new uX().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, unlisted, workspace, group)").configureOutput({writeErr:()=>{}});Q.exitOverride((C)=>{if(C.code==="commander.help"||C.code==="commander.version"||C.exitCode===0)cN(),process.exit(0);let H=C.originalError??C;JX4(H)}),BK4(Q,{version:"0.0.1780162602-gb8f27a",buildTimestamp:"2026-05-30T17:41:57.172Z",buildType:"release"}),Q.addHelpText("after",wG4()),Q.configureHelp({formatHelp:MG4}),Q.command("logout").description("Log out by removing stored API key").action(async(C,H)=>{let N=H.optsWithGlobals(),q=await E6(N);await _H6(q)}),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(C,H)=>{let N=H.optsWithGlobals(),q=await E6(N);await TH6(q,await oc0(N,q.settings))}),BX4(Q,E6);let B=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(...C)=>{let H=C.find((L)=>typeof L==="object"&&L!==null&&typeof L.optsWithGlobals==="function")??B,N=C.filter((L)=>L!==H).flatMap((L)=>Array.isArray(L)?L:typeof L==="string"?[L]:[]),q=H.optsWithGlobals(),w=await E6(q);await NH6(w.ampURL,w.secrets,N),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(C,H,N)=>{let q=N.optsWithGlobals(),w=await E6(q);await bI4(C??"get",w.ampURL,w.secrets),process.exit(process.exitCode??0)}),Q.command("sign-commit [args...]",{hidden:!0}).summary("Git commit signing helper").description("Internal: implements Git signing helper interfaces. Used inside sandboxes for commit signing.").allowUnknownOption(!0).allowExcessArguments(!0).action(async(C,H,N)=>{let q=N.optsWithGlobals(),w=await E6(q);await gI4(w,C),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(C)=>{await MR4({raw:C.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(`
6383
+ `),!1}}async function NH6(A,Q,$){let B=await Q.get("apiKey",A);if(!B)throw new GA("No Amp API key found. Run `amp login` first.",1);let E=iC6("curl",["-H",`Authorization: Bearer ${B}`,...$],{stdio:"inherit"});process.exitCode=await new Promise((D,J)=>{E.on("error",J),E.on("close",(U)=>D(U??1))})}function qH6(A){let Q=new uX().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, unlisted, workspace, group)").configureOutput({writeErr:()=>{}});Q.exitOverride((C)=>{if(C.code==="commander.help"||C.code==="commander.version"||C.exitCode===0)cN(),process.exit(0);let H=C.originalError??C;JX4(H)}),BK4(Q,{version:"0.0.1780172352-gac8e8a",buildTimestamp:"2026-05-30T20:24:02.013Z",buildType:"release"}),Q.addHelpText("after",wG4()),Q.configureHelp({formatHelp:MG4}),Q.command("logout").description("Log out by removing stored API key").action(async(C,H)=>{let N=H.optsWithGlobals(),q=await E6(N);await _H6(q)}),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(C,H)=>{let N=H.optsWithGlobals(),q=await E6(N);await TH6(q,await oc0(N,q.settings))}),BX4(Q,E6);let B=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(...C)=>{let H=C.find((L)=>typeof L==="object"&&L!==null&&typeof L.optsWithGlobals==="function")??B,N=C.filter((L)=>L!==H).flatMap((L)=>Array.isArray(L)?L:typeof L==="string"?[L]:[]),q=H.optsWithGlobals(),w=await E6(q);await NH6(w.ampURL,w.secrets,N),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(C,H,N)=>{let q=N.optsWithGlobals(),w=await E6(q);await bI4(C??"get",w.ampURL,w.secrets),process.exit(process.exitCode??0)}),Q.command("sign-commit [args...]",{hidden:!0}).summary("Git commit signing helper").description("Internal: implements Git signing helper interfaces. Used inside sandboxes for commit signing.").allowUnknownOption(!0).allowExcessArguments(!0).action(async(C,H,N)=>{let q=N.optsWithGlobals(),w=await E6(q);await gI4(w,C),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(C)=>{await MR4({raw:C.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(`
6384
6384
  `)).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(C,H,N)=>{if(C&&H.apply)throw new GA("Choose either a positional thread ID/URL or --apply <thread-id>, not both.",1);let q=H.apply??C;if(!q||q.trim().length===0)RQ.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.
6385
6385
 
6386
6386
  `),N.outputHelp(),process.exit(0);let w=$3(q)??a7(q),L=N.optsWithGlobals(),R=await E6(L);C3(N,L);let _=await LB(R,L),P=!1;try{if(H.checkout&&H.skipCheckout)throw new GA("Choose either --checkout or --skip-checkout, not both.",1);if(xC(_.serverStatus))throw kl0(_.serverStatus,R.ampURL);let f=Q$(_.serverStatus)?_.serverStatus.features:void 0;if(!dS4(f,ID.V2))throw new GA("live-sync is not enabled for your user",1);await dR4({ampURL:R.ampURL,threadId:w,configService:_.configService,threadSnapshotReader:{get:_.threadRemote.getThread},apiKey:process.env.AMP_API_KEY,applyOnce:typeof H.apply==="string",checkoutMode:H.checkout?"always":H.skipCheckout?"never":"prompt",promptForYesNo:x90}),P=!0}finally{if(await _.asyncDispose(),P)process.exit(0)}});let E=async(C,H,N)=>{U00({storage:H.settings,secretStorage:H.secrets,workspaceRoot:process.cwd(),defaultAmpURL:H.ampURL,homeDir:SE0,userConfigDir:_l0});let q={...H,executeMode:!1};await Sl0(q,{...C,openThreadSwitcher:!0},N)},D=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").option("--limit <number>","Maximum number of threads to return",(C)=>_E0(C,"--limit",{min:1,max:500})).option("--offset <number>","Number of threads to skip",(C)=>_E0(C,"--offset",{min:0})).action(async(C,H)=>{let N=H.optsWithGlobals(),q=await E6(N);await hS4(N,q,H)});D.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, unlisted, workspace, group)").action(async(C,H)=>{let N=H.optsWithGlobals(),q=await E6(N);await lH6(N,q,H)}),D.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(C,H,N)=>{let q=N.optsWithGlobals(),w=await E6(q),L=Array.isArray(C)?C:[];if(H.pick)z7.write(`${f0.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
@@ -6405,8 +6405,8 @@ ${R}
6405
6405
 
6406
6406
  `)},async input(){return},async confirm(){return!1},async select(){return},async ask(){return{result:"uncertain",probability:0.5,reason:"AI not available"}}},loadGlobalPlugins:wy0(q),pluginFilter:process.env.PLUGINS??"all"}),asyncDispose:async()=>{}}}),xP4(Q,async(C)=>{let H=C.optsWithGlobals(),N=await E6(H);C3(C,H);let q=await LB(N,H),w=await q.secretStorage.get("apiKey",N.ampURL);if(!w)throw await q.asyncDispose(),new GA("API key required. Please run `amp login` first.",1);return{configService:q.configService,actorOptions:{apiKey:w,ampURL:N.ampURL,workspaceRoot:process.cwd(),dependencies:q},cleanupTerminal:cN,asyncDispose:q.asyncDispose.bind(q)}}),iP4(Q,async(C)=>{let H=C.optsWithGlobals(),N=await E6(H);C3(C,H);let q=await LB(N,H);return{settings:N.settings,configService:q.configService,skillService:q.skillService,asyncDispose:q.asyncDispose.bind(q)}}),VP4(Q,async(C)=>{let H=C.optsWithGlobals();return await E6(H)}),JP4(Q,async(C)=>{let H=await E6(C);return{settings:H.settings,secretStorage:H.secrets,getThreadDeps:async(N)=>{C3(N,C);let q=await LB(H,C);return{mcpService:q.mcpService,settings:H.settings,asyncDispose:q.asyncDispose.bind(q)}}}}),lF4(Q,E6),Gv4(Q,E6);function Z(C,H,N){let w=typeof C.description==="string"?C.description:N===void 0?C.description(!0):C.description(N),L=new v2(H,w),R=VH6(C);if(R)L.default(R);if(L.hidden=IH6(C)||yS4(C),"choices"in C&&Array.isArray(C.choices))if("hiddenChoices"in C){let _=[...C.choices],P=Array.isArray(C.hiddenChoices)?C.hiddenChoices:[],f=new Set([..._,...P]);L.argParser((m)=>{if(!f.has(m))throw new I30(`Allowed choices are ${_.join(", ")}.`);return m})}else L.choices([...C.choices]);return L}for(let C of fS4){switch(C.type){case"flag":{Q.addOption(Z(C,`--${C.long}`)),Q.addOption(Z(C,`--no-${C.long}`,!1));break}case"switch":{Q.addOption(Z(C,`--${C.long}`,!0));break}case"optional-option":{Q.addOption(Z(C,`${"short"in C?`-${C.short}, `:""}--${C.long} [value]`));break}default:{Q.addOption(Z(C,`${"short"in C?`-${C.short}, `:""}--${C.long} <value>`));break}}if("aliases"in C&&Array.isArray(C.aliases))for(let H of C.aliases){let N=new v2(`--${H}`,C.description);N.hidden=!0,N.implies({[C.name]:!0}),Q.addOption(N)}}Q.hook("preAction",(C,H)=>{if(H.optsWithGlobals().takeMeBack)D6(zH6)});let F=new v2("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);Q.addOption(F);let X=new v2("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp(!0);Q.addOption(X);let I=new v2("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);Q.addOption(I);let G=new v2("--stream-json-thinking","Include thinking blocks in stream JSON output (non-Claude Code extension). Implies --stream-json.").default(!1);Q.addOption(G);let V=new v2("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);Q.addOption(V);let z=new v2("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);Q.addOption(z);let K=new v2("--archive","When used with --execute, archive the thread after the command finishes.").default(!1);Q.addOption(K);let W=new v2("-l, --label <label>","When used with --execute, add a label to the thread. Repeat the flag for multiple labels.").argParser((C,H)=>{if(H===void 0)return[C];return[...H,C]});return Q.addOption(W),Q.action(async(C,H)=>{let N=C,q=await E6(N);if(Object.keys(N).forEach((w)=>{let L=fS4.find((R)=>R.name===w);if(L&&yS4(L)&&!GH6(L))z7.write(f0.yellow(`Warning: '--${w}' flag is deprecated
6407
6407
  `))}),H.args.length>0)CH6(q,H);await Sl0(q,N,H)}),tG4(Q),Q}async function lS4(A,Q){await sY(($)=>cP($,A,Q))}async function uH6(A){if(A.streamJsonInput)return{userInput:"",stdinInput:null};if(typeof A.execute==="string"){let Q=(await rc0()).trimEnd();return{userInput:A.execute,stdinInput:Q||null}}return{userInput:(await rc0()).trimEnd(),stdinInput:null}}function wH6(A,Q,$){if(A.remote&&!Q)throw new GA("The -r/--remote flag requires --execute mode",1,'Use: amp --remote --execute "your message"');if(A.streamJson&&!Q)throw new GA("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(A.streamJsonInput&&!Q)throw new GA("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(A.streamJsonInput&&!A.streamJson)throw new GA("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if(A.stats&&A.streamJson)throw new GA("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 GA("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(A.archive&&!Q)throw new GA("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 GA("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&&$===""&&!A.streamJsonInput&&!A.headless)throw new GA("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"
6408
- Or pipe via stdin: echo "your message" | amp --execute`)}function MH6(){JmA([D00.parse({tool:"*",action:"allow"})]),SgA({bypass:!0})}function OH6(A){if(A.threadId&&!S7(A.threadId))delete A.threadId}async function Sl0(A,Q,$){if(Q.headless)return LH6(A,Q,$);let B=await LB(A,Q);if(Q.showWelcome&&Q.hideWelcome)throw await B.asyncDispose(),new GA("Cannot use --show-welcome and --hide-welcome together",1);let E=!A.executeMode&&await XH6();return MH6(),OH6(Q),jH6(A,Q,$,B,{showNpmMigrationWelcome:E})}async function LH6(A,Q,$){let B=(W,C)=>{let H=Number(process.hrtime.bigint()-C)/1e6,N=_F4();S.info("Startup phase",{phase:W,phaseMs:Math.round(H),sinceMainMs:N===null?void 0:Math.round(N)})};C3($,Q);let E=process.hrtime.bigint(),D=await LB(A,Q);B("runMainThread:createThreadDependencies",E);let{serverStatus:J}=D;if(xC(J))throw kl0(J,A.ampURL);let U=Q$(J)?J:null,Y=U?.user.email;await JH6($,Q,J);let Z=Ju(J),F=Ui(Q,Z);if(F instanceof Error)D6(F.message);if(U&&UT(Q.mode)&&!te(Q.mode,Y))throw new GA(`Agent mode '${Q.mode}' is only available for Amp employees`,1);if(process.env.AMP_EXECUTOR!=="1"&&(!Y||!L7(Y)))throw new GA("Headless executor mode is only available for Amp employees",1);Ey0();let I=await D.secretStorage.get("apiKey",A.ampURL);if(!I)throw new GA("API key required for headless mode. Please run `amp login` first.",1);let G=typeof Q.headless==="string"&&Q.headless!=="true"?Q.headless:void 0;if(G&&!S7(G))throw new GA(`Invalid thread ID: ${G}`,1);let V=G?void 0:await cH6({dependencies:D,apiKey:I,visibility:F??void 0}),z=G??V?.threadId;if(!z)throw new GA("Failed to resolve headless thread ID",1);let K=await BG4(z);if(K.status==="already-running")await D.asyncDispose(),await aY(),process.exit(0);try{await lI4({ampURL:A.ampURL,apiKey:I,workspaceRoot:process.cwd(),threadId:z,ownerUserId:V?.ownerUserId,threadVersion:V?.threadVersion,agentMode:V?.agentMode,initialToolDiscovery:Promise.all([D.mcpService.initialized,D.toolboxService.initialized,D.pluginService.initialized]).then(()=>{return}),configService:D.configService,mcpService:D.mcpService,toolService:D.toolService,skillService:D.skillService,pluginService:D.pluginService,pluginPlatform:D.headlessPluginPlatform})}finally{await K.release(),await D.asyncDispose()}await aY(),process.exit(0)}async function jH6(A,Q,$,B,E){let{userInput:D,stdinInput:J}=await uH6(Q),U=!!Q.streamJson||!!Q.streamJsonThinking;wH6({...Q,streamJson:U},A.executeMode,D),C3($,Q),hF4(),Ey0();let Y=Q.threadId,Z=Q.resumeThreadIDs??(Y?[Y]:[]),F=Q.observe?$3(Q.observe)??a7(Q.observe):void 0,X=await B.serverStatusPromise;if(xC(X))throw kl0(X,A.ampURL);let I=Ju(X),G=Ui(Q,I);if(G instanceof Error)D6(G.message);if(A.executeMode&&Q.remote){if(!UT(Q.mode))throw new GA("Remote execute mode does not support plugin-defined agent modes",1);if(!Q$(X)||!L7(X.user.email))throw new GA("Remote execute mode is only available for Amp employees",1);await vP4(D,J,B.configService,Q.mode),await B.asyncDispose(),await aY(),process.exit(0)}let V=null,z=async()=>{let C=B.consumeDraftNewThreadVisibility();if(C!==null)return C;return V??=(async()=>{let H=await u30(A.settings,process.cwd(),I,G);if(H instanceof Error)D6(H.message);return H})(),V},K=await B.secretStorage.get("apiKey",A.ampURL);if(!K)throw new GA("API key required. Please run `amp login` first.",1);let W=Q$(X)&&L7(X.user.email);if(A.executeMode){if(Z.length>1)throw new GA("Execute mode can only resume one thread.",1);FP4(B.mcpService,A.settings);try{await B.pluginService.initialized;let C=cS4(B.pluginService,Q.mode),H=xS4($,Q),N=await $q(),q=Y?H:Ax0({agentMode:C.agentMode,explicitEffort:H,sessionState:N}),w=Y?void 0:Q50(await gP(B.configService),{agentMode:C.agentMode,explicitEffort:H,sessionState:N}),L=Y?void 0:await z(),{threadID:R}=await f30({apiKey:K,ampURL:A.ampURL,workspaceRoot:process.cwd(),dependencies:B,userInput:D,stdinInput:J,stats:!!Q.stats,streamJson:U,streamJsonThinking:!!Q.streamJsonThinking,streamJsonInput:!!Q.streamJsonInput,stdin:process.stdin,agentMode:C.agentMode,reasoningEffort:C.agent?void 0:q,agent:C.agent,labels:Q.label,initialThreadID:Y,initialThreadMeta:L,initialSettings:w});if(await lS4(R,"execute"),Q.archive)await B.threadRemote.archiveThread(R,!0)}finally{await B.asyncDispose()}await aY(),process.exit(0)}else{let C=xS4($,Q),H=await WH6($,B.pluginService,Q.mode),N=E.showNpmMigrationWelcome?"npm-migration":"intro",q=oy0("0.0.1780162602-gb8f27a",B.settingsStorage,{startDelayMs:3000}),w=new dc0(B.mcpService,A.settings.getWorkspaceRootPath()),L=ah(B.configService),R=new Ep0(B.fuzzyServer),_=process.cwd();await CR4({ampURL:A.ampURL,apiKey:K,rivetEndpoint:process.env.RIVET_PUBLIC_ENDPOINT??J9(A.ampURL),configService:B.configService,toolService:B.toolService,pluginPlatform:B.pluginPlatform,pluginService:B.pluginService,skillService:B.skillService,mcpService:B.mcpService,readFileSystemDirectory:({uri:P})=>_P({workspaceRoot:_},P),completionBuilder:R,updateService:q,workspaceRoot:_,listThreads:()=>L.listThreads(),getThreadFromServer:(P)=>L.getThread(P),getThreadTail:async(P,f)=>{let m=await z4.getThreadTail({thread:P,limit:f},{config:B.configService});if(!m.ok){if(m.error.code==="thread-not-found")return null;throw Error(m.error.message??m.error.code)}return{...m.result.thread.data,messages:m.result.messages}},toolboxes:B.toolboxService.toolboxes,isInternalUser:W,settingsFilePath:B.settingsStorage.getSettingsFilePath(),workspaceSettingsFilePath:B.settingsStorage.getWorkspaceSettingsPath(),mcpTrustHandler:w,setActiveThreadID:(P)=>B.activeThread$.next(P),dispose:()=>{return w.dispose(),q.dispose(),B.asyncDispose()}},{initialThreadIDs:F?[F]:Z,initialUserInput:D||void 0,getDefaultNewThreadVisibility:z,onFirstFrame:Q.ide?mS4:void 0,openThreadPickerOnStart:Q.openThreadSwitcher,observerOnly:!!F,hideWelcome:!!Q.hideWelcome,showWelcome:Q.showWelcome,welcomeVariant:N,initialAgentMode:H?.agentMode,initialPluginAgentModeKey:H?.pluginAgentModeKey,initialReasoningEffort:C}),process.exit(0)}}async function E6(A){if(S.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)z7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
6409
- `);let Q=!!A.execute||!process.stdout.isTTY&&!A.streamJson,$=process.stdout.isTTY&&process.stderr.isTTY;S.info("Execution mode resolved",{executeMode:Q,stdoutTTY:process.stdout.isTTY,stderrTTY:process.stderr.isTTY,streamJson:A.streamJson,executeFlag:A.execute});let B=await mnA({get:async(U)=>{if(U!==Dh)return;try{let Y=await gS4(Tl0,"utf-8");return JSON.parse(Y).installationID}catch{return}},set:async(U,Y)=>{if(U!==Dh)return;await aC6(Si.dirname(Tl0),{recursive:!0}),await oC6(Tl0,JSON.stringify({installationID:Y},null,2),{mode:384})}},{clientType:"cli",platform:q40()});_xA(B);let E=await pP4({...A,workspaceTrust:{current:!0,changes:ty},getHook:process.env.AMP_URL?(U,Y)=>{if(U==="url")return Promise.resolve(process.env.AMP_URL);return Y()}:void 0});if(A.mcpConfig){let U=await YP4(A.mcpConfig);E=ZP4(E,U)}let D=Si.dirname(E.getSettingsFilePath());VD4(hx,D),E=SSA(E);let J=await E.get("url","admin")??await E.get("url","global");if(!J)J=S8;if(S.info("Resolved Amp URL",{ampURL:J,settingsFile:E.getSettingsFilePath(),workspaceRoot:E.getWorkspaceRootPath()}),!mO(J))S.info("Targeting custom Amp server",{ampURL:J});return{executeMode:Q,isTTY:$,ampURL:J,settings:E,secrets:bP4(await oc0(A,E))}}function RH6(A){let Q={};for(let $=0;$<A.length;$++){let B=A[$];if(B?.startsWith("--")){let D=B.slice(2).replace(/-([a-z])/g,(U,Y)=>Y.toUpperCase()),J=A[$+1];if(J&&!J.startsWith("--"))Q[D]=J,$++}}return Q}function PH6(A,Q){let $=A.includes("--headless")||A.some((E)=>E.startsWith("--headless=")),B=Si.resolve(Q.logFile??process.env.AMP_LOG_FILE??($?sC6:Tc));return{logLevel:Q.logLevel??process.env.AMP_LOG_LEVEL??"info",logFile:B}}async function vH6(){TF4();let A=RH6(process.argv),Q=PH6(process.argv,A),$=gF4(Q);qB0("silent");let B=process.argv.includes("--no-color"),E=process.argv.includes("--color"),D=process.stdout.isTTY&&process.stderr.isTTY;if(B||!E&&!D)f0.level=0;if(eC6(S),S.info("Starting Amp CLI.",{version:"0.0.1780162602-gb8f27a",buildTimestamp:"2026-05-30T17:41:57.172Z"}),process.platform==="win32"&&Aq())nG4();if(parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new GA(G3.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await qH6($).parseAsync(process.argv)}ID4().startActiveSpan("main",async(A)=>{process.on("exit",()=>A.end()),await vH6().catch(w30)});async function TH6(A,Q){let $=A.ampURL.includes("localhost")||A.ampURL.includes("127.0.0.1");if(process.env.AMP_URL&&!$)await A.settings.set("url",process.env.AMP_URL,"global"),RQ.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
6408
+ Or pipe via stdin: echo "your message" | amp --execute`)}function MH6(){JmA([D00.parse({tool:"*",action:"allow"})]),SgA({bypass:!0})}function OH6(A){if(A.threadId&&!S7(A.threadId))delete A.threadId}async function Sl0(A,Q,$){if(Q.headless)return LH6(A,Q,$);let B=await LB(A,Q);if(Q.showWelcome&&Q.hideWelcome)throw await B.asyncDispose(),new GA("Cannot use --show-welcome and --hide-welcome together",1);let E=!A.executeMode&&await XH6();return MH6(),OH6(Q),jH6(A,Q,$,B,{showNpmMigrationWelcome:E})}async function LH6(A,Q,$){let B=(W,C)=>{let H=Number(process.hrtime.bigint()-C)/1e6,N=_F4();S.info("Startup phase",{phase:W,phaseMs:Math.round(H),sinceMainMs:N===null?void 0:Math.round(N)})};C3($,Q);let E=process.hrtime.bigint(),D=await LB(A,Q);B("runMainThread:createThreadDependencies",E);let{serverStatus:J}=D;if(xC(J))throw kl0(J,A.ampURL);let U=Q$(J)?J:null,Y=U?.user.email;await JH6($,Q,J);let Z=Ju(J),F=Ui(Q,Z);if(F instanceof Error)D6(F.message);if(U&&UT(Q.mode)&&!te(Q.mode,Y))throw new GA(`Agent mode '${Q.mode}' is only available for Amp employees`,1);if(process.env.AMP_EXECUTOR!=="1"&&(!Y||!L7(Y)))throw new GA("Headless executor mode is only available for Amp employees",1);Ey0();let I=await D.secretStorage.get("apiKey",A.ampURL);if(!I)throw new GA("API key required for headless mode. Please run `amp login` first.",1);let G=typeof Q.headless==="string"&&Q.headless!=="true"?Q.headless:void 0;if(G&&!S7(G))throw new GA(`Invalid thread ID: ${G}`,1);let V=G?void 0:await cH6({dependencies:D,apiKey:I,visibility:F??void 0}),z=G??V?.threadId;if(!z)throw new GA("Failed to resolve headless thread ID",1);let K=await BG4(z);if(K.status==="already-running")await D.asyncDispose(),await aY(),process.exit(0);try{await lI4({ampURL:A.ampURL,apiKey:I,workspaceRoot:process.cwd(),threadId:z,ownerUserId:V?.ownerUserId,threadVersion:V?.threadVersion,agentMode:V?.agentMode,initialToolDiscovery:Promise.all([D.mcpService.initialized,D.toolboxService.initialized,D.pluginService.initialized]).then(()=>{return}),configService:D.configService,mcpService:D.mcpService,toolService:D.toolService,skillService:D.skillService,pluginService:D.pluginService,pluginPlatform:D.headlessPluginPlatform})}finally{await K.release(),await D.asyncDispose()}await aY(),process.exit(0)}async function jH6(A,Q,$,B,E){let{userInput:D,stdinInput:J}=await uH6(Q),U=!!Q.streamJson||!!Q.streamJsonThinking;wH6({...Q,streamJson:U},A.executeMode,D),C3($,Q),hF4(),Ey0();let Y=Q.threadId,Z=Q.resumeThreadIDs??(Y?[Y]:[]),F=Q.observe?$3(Q.observe)??a7(Q.observe):void 0,X=await B.serverStatusPromise;if(xC(X))throw kl0(X,A.ampURL);let I=Ju(X),G=Ui(Q,I);if(G instanceof Error)D6(G.message);if(A.executeMode&&Q.remote){if(!UT(Q.mode))throw new GA("Remote execute mode does not support plugin-defined agent modes",1);if(!Q$(X)||!L7(X.user.email))throw new GA("Remote execute mode is only available for Amp employees",1);await vP4(D,J,B.configService,Q.mode),await B.asyncDispose(),await aY(),process.exit(0)}let V=null,z=async()=>{let C=B.consumeDraftNewThreadVisibility();if(C!==null)return C;return V??=(async()=>{let H=await u30(A.settings,process.cwd(),I,G);if(H instanceof Error)D6(H.message);return H})(),V},K=await B.secretStorage.get("apiKey",A.ampURL);if(!K)throw new GA("API key required. Please run `amp login` first.",1);let W=Q$(X)&&L7(X.user.email);if(A.executeMode){if(Z.length>1)throw new GA("Execute mode can only resume one thread.",1);FP4(B.mcpService,A.settings);try{await B.pluginService.initialized;let C=cS4(B.pluginService,Q.mode),H=xS4($,Q),N=await $q(),q=Y?H:Ax0({agentMode:C.agentMode,explicitEffort:H,sessionState:N}),w=Y?void 0:Q50(await gP(B.configService),{agentMode:C.agentMode,explicitEffort:H,sessionState:N}),L=Y?void 0:await z(),{threadID:R}=await f30({apiKey:K,ampURL:A.ampURL,workspaceRoot:process.cwd(),dependencies:B,userInput:D,stdinInput:J,stats:!!Q.stats,streamJson:U,streamJsonThinking:!!Q.streamJsonThinking,streamJsonInput:!!Q.streamJsonInput,stdin:process.stdin,agentMode:C.agentMode,reasoningEffort:C.agent?void 0:q,agent:C.agent,labels:Q.label,initialThreadID:Y,initialThreadMeta:L,initialSettings:w});if(await lS4(R,"execute"),Q.archive)await B.threadRemote.archiveThread(R,!0)}finally{await B.asyncDispose()}await aY(),process.exit(0)}else{let C=xS4($,Q),H=await WH6($,B.pluginService,Q.mode),N=E.showNpmMigrationWelcome?"npm-migration":"intro",q=oy0("0.0.1780172352-gac8e8a",B.settingsStorage,{startDelayMs:3000}),w=new dc0(B.mcpService,A.settings.getWorkspaceRootPath()),L=ah(B.configService),R=new Ep0(B.fuzzyServer),_=process.cwd();await CR4({ampURL:A.ampURL,apiKey:K,rivetEndpoint:process.env.RIVET_PUBLIC_ENDPOINT??J9(A.ampURL),configService:B.configService,toolService:B.toolService,pluginPlatform:B.pluginPlatform,pluginService:B.pluginService,skillService:B.skillService,mcpService:B.mcpService,readFileSystemDirectory:({uri:P})=>_P({workspaceRoot:_},P),completionBuilder:R,updateService:q,workspaceRoot:_,listThreads:()=>L.listThreads(),getThreadFromServer:(P)=>L.getThread(P),getThreadTail:async(P,f)=>{let m=await z4.getThreadTail({thread:P,limit:f},{config:B.configService});if(!m.ok){if(m.error.code==="thread-not-found")return null;throw Error(m.error.message??m.error.code)}return{...m.result.thread.data,messages:m.result.messages}},toolboxes:B.toolboxService.toolboxes,isInternalUser:W,settingsFilePath:B.settingsStorage.getSettingsFilePath(),workspaceSettingsFilePath:B.settingsStorage.getWorkspaceSettingsPath(),mcpTrustHandler:w,setActiveThreadID:(P)=>B.activeThread$.next(P),dispose:()=>{return w.dispose(),q.dispose(),B.asyncDispose()}},{initialThreadIDs:F?[F]:Z,initialUserInput:D||void 0,getDefaultNewThreadVisibility:z,onFirstFrame:Q.ide?mS4:void 0,openThreadPickerOnStart:Q.openThreadSwitcher,observerOnly:!!F,hideWelcome:!!Q.hideWelcome,showWelcome:Q.showWelcome,welcomeVariant:N,initialAgentMode:H?.agentMode,initialPluginAgentModeKey:H?.pluginAgentModeKey,initialReasoningEffort:C}),process.exit(0)}}async function E6(A){if(S.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)z7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
6409
+ `);let Q=!!A.execute||!process.stdout.isTTY&&!A.streamJson,$=process.stdout.isTTY&&process.stderr.isTTY;S.info("Execution mode resolved",{executeMode:Q,stdoutTTY:process.stdout.isTTY,stderrTTY:process.stderr.isTTY,streamJson:A.streamJson,executeFlag:A.execute});let B=await mnA({get:async(U)=>{if(U!==Dh)return;try{let Y=await gS4(Tl0,"utf-8");return JSON.parse(Y).installationID}catch{return}},set:async(U,Y)=>{if(U!==Dh)return;await aC6(Si.dirname(Tl0),{recursive:!0}),await oC6(Tl0,JSON.stringify({installationID:Y},null,2),{mode:384})}},{clientType:"cli",platform:q40()});_xA(B);let E=await pP4({...A,workspaceTrust:{current:!0,changes:ty},getHook:process.env.AMP_URL?(U,Y)=>{if(U==="url")return Promise.resolve(process.env.AMP_URL);return Y()}:void 0});if(A.mcpConfig){let U=await YP4(A.mcpConfig);E=ZP4(E,U)}let D=Si.dirname(E.getSettingsFilePath());VD4(hx,D),E=SSA(E);let J=await E.get("url","admin")??await E.get("url","global");if(!J)J=S8;if(S.info("Resolved Amp URL",{ampURL:J,settingsFile:E.getSettingsFilePath(),workspaceRoot:E.getWorkspaceRootPath()}),!mO(J))S.info("Targeting custom Amp server",{ampURL:J});return{executeMode:Q,isTTY:$,ampURL:J,settings:E,secrets:bP4(await oc0(A,E))}}function RH6(A){let Q={};for(let $=0;$<A.length;$++){let B=A[$];if(B?.startsWith("--")){let D=B.slice(2).replace(/-([a-z])/g,(U,Y)=>Y.toUpperCase()),J=A[$+1];if(J&&!J.startsWith("--"))Q[D]=J,$++}}return Q}function PH6(A,Q){let $=A.includes("--headless")||A.some((E)=>E.startsWith("--headless=")),B=Si.resolve(Q.logFile??process.env.AMP_LOG_FILE??($?sC6:Tc));return{logLevel:Q.logLevel??process.env.AMP_LOG_LEVEL??"info",logFile:B}}async function vH6(){TF4();let A=RH6(process.argv),Q=PH6(process.argv,A),$=gF4(Q);qB0("silent");let B=process.argv.includes("--no-color"),E=process.argv.includes("--color"),D=process.stdout.isTTY&&process.stderr.isTTY;if(B||!E&&!D)f0.level=0;if(eC6(S),S.info("Starting Amp CLI.",{version:"0.0.1780172352-gac8e8a",buildTimestamp:"2026-05-30T20:24:02.013Z"}),process.platform==="win32"&&Aq())nG4();if(parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new GA(G3.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await qH6($).parseAsync(process.argv)}ID4().startActiveSpan("main",async(A)=>{process.on("exit",()=>A.end()),await vH6().catch(w30)});async function TH6(A,Q){let $=A.ampURL.includes("localhost")||A.ampURL.includes("127.0.0.1");if(process.env.AMP_URL&&!$)await A.settings.set("url",process.env.AMP_URL,"global"),RQ.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
6410
6410
  `);else if(!mO(A.ampURL))RQ.write(`Logging in to ${new URL(A.ampURL).hostname}
6411
6411
  `);let B=process.env.AMP_API_KEY;if(B)RQ.write(`API key found in environment variable, storing...
6412
6412
  `),await Q.set("apiKey",B,A.ampURL),RQ.write(`API key successfully stored.