@anthropic-ai/claude-agent-sdk 0.3.150 → 0.3.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sdk.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
3
3
 
4
- // Version: 0.3.150
4
+ // Version: 0.3.152
5
5
 
6
6
  // Want to see the unminified source? We're hiring!
7
7
  // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
@@ -12,7 +12,7 @@ import{createRequire as i_}from"node:module";var f_=Object.create;var{getPrototy
12
12
  || ${G} === "boolean" || ${X} === null`).assign(U,$$._`[${X}]`)}}}function pd({gen:$,parentData:Q,parentDataProperty:J},Y){$.if($$._`${Q} !== undefined`,()=>$.assign($$._`${Q}[${J}]`,Y))}function ZB($,Q,J,Y=B9.Correct){let X=Y===B9.Correct?$$.operators.EQ:$$.operators.NEQ,W;switch($){case"null":return $$._`${Q} ${X} null`;case"array":W=$$._`Array.isArray(${Q})`;break;case"object":W=$$._`${Q} && typeof ${Q} == "object" && !Array.isArray(${Q})`;break;case"integer":W=G($$._`!(${Q} % 1) && !isNaN(${Q})`);break;case"number":W=G();break;default:return $$._`typeof ${Q} ${X} ${$}`}return Y===B9.Correct?W:(0,$$.not)(W);function G(U=$$.nil){return(0,$$.and)($$._`typeof ${Q} == "number"`,U,J?$$._`isFinite(${Q})`:$$.nil)}}ej.checkDataType=ZB;function MB($,Q,J,Y){if($.length===1)return ZB($[0],Q,J,Y);let X,W=(0,tj.toHash)($);if(W.array&&W.object){let G=$$._`typeof ${Q} != "object"`;X=W.null?G:$$._`!${Q} || ${G}`,delete W.null,delete W.array,delete W.object}else X=$$.nil;if(W.number)delete W.integer;for(let G in W)X=(0,$$.and)(X,ZB(G,Q,J,Y));return X}ej.checkDataTypes=MB;var dd={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:Q})=>typeof $=="string"?$$._`{type: ${$}}`:$$._`{type: ${Q}}`};function LB($){let Q=id($);(0,hd.reportError)(Q,dd)}ej.reportTypeError=LB;function id($){let{gen:Q,data:J,schema:Y}=$,X=(0,tj.schemaRefOrVal)($,Y,"type");return{gen:Q,keyword:"type",data:J,schema:Y.type,schemaCode:X,schemaValue:X,parentSchema:Y,params:{},it:$}}});var YA=I((JA)=>{Object.defineProperty(JA,"__esModule",{value:!0});JA.assignDefaults=void 0;var z9=Q$(),ed=q$();function $i($,Q){let{properties:J,items:Y}=$.schema;if(Q==="object"&&J)for(let X in J)QA($,X,J[X].default);else if(Q==="array"&&Array.isArray(Y))Y.forEach((X,W)=>QA($,W,X.default))}JA.assignDefaults=$i;function QA($,Q,J){let{gen:Y,compositeRule:X,data:W,opts:G}=$;if(J===void 0)return;let U=z9._`${W}${(0,z9.getProperty)(Q)}`;if(X){(0,ed.checkStrictMode)($,`default is ignored for: ${U}`);return}let H=z9._`${U} === undefined`;if(G.useDefaults==="empty")H=z9._`${H} || ${U} === null || ${U} === ""`;Y.if(H,z9._`${U} = ${(0,z9.stringify)(J)}`)}});var $4=I((UA)=>{Object.defineProperty(UA,"__esModule",{value:!0});UA.validateUnion=UA.validateArray=UA.usePattern=UA.callValidateCode=UA.schemaProperties=UA.allSchemaProperties=UA.noPropertyInData=UA.propertyInData=UA.isOwnProperty=UA.hasPropFunc=UA.reportMissingProp=UA.checkMissingProp=UA.checkReportMissingProp=void 0;var k$=Q$(),jB=q$(),g1=$1(),Qi=q$();function Ji($,Q){let{gen:J,data:Y,it:X}=$;J.if(IB(J,Y,Q,X.opts.ownProperties),()=>{$.setParams({missingProperty:k$._`${Q}`},!0),$.error()})}UA.checkReportMissingProp=Ji;function Xi({gen:$,data:Q,it:{opts:J}},Y,X){return(0,k$.or)(...Y.map((W)=>(0,k$.and)(IB($,Q,W,J.ownProperties),k$._`${X} = ${W}`)))}UA.checkMissingProp=Xi;function Yi($,Q){$.setParams({missingProperty:Q},!0),$.error()}UA.reportMissingProp=Yi;function WA($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:k$._`Object.prototype.hasOwnProperty`})}UA.hasPropFunc=WA;function AB($,Q,J){return k$._`${WA($)}.call(${Q}, ${J})`}UA.isOwnProperty=AB;function Wi($,Q,J,Y){let X=k$._`${Q}${(0,k$.getProperty)(J)} !== undefined`;return Y?k$._`${X} && ${AB($,Q,J)}`:X}UA.propertyInData=Wi;function IB($,Q,J,Y){let X=k$._`${Q}${(0,k$.getProperty)(J)} === undefined`;return Y?(0,k$.or)(X,(0,k$.not)(AB($,Q,J))):X}UA.noPropertyInData=IB;function GA($){return $?Object.keys($).filter((Q)=>Q!=="__proto__"):[]}UA.allSchemaProperties=GA;function Gi($,Q){return GA(Q).filter((J)=>!(0,jB.alwaysValidSchema)($,Q[J]))}UA.schemaProperties=Gi;function Ui({schemaCode:$,data:Q,it:{gen:J,topSchemaRef:Y,schemaPath:X,errorPath:W},it:G},U,H,q){let V=q?k$._`${$}, ${Q}, ${Y}${X}`:Q,B=[[g1.default.instancePath,(0,k$.strConcat)(g1.default.instancePath,W)],[g1.default.parentData,G.parentData],[g1.default.parentDataProperty,G.parentDataProperty],[g1.default.rootData,g1.default.rootData]];if(G.opts.dynamicRef)B.push([g1.default.dynamicAnchors,g1.default.dynamicAnchors]);let z=k$._`${V}, ${J.object(...B)}`;return H!==k$.nil?k$._`${U}.call(${H}, ${z})`:k$._`${U}(${z})`}UA.callValidateCode=Ui;var Hi=k$._`new RegExp`;function Ki({gen:$,it:{opts:Q}},J){let Y=Q.unicodeRegExp?"u":"",{regExp:X}=Q.code,W=X(J,Y);return $.scopeValue("pattern",{key:W.toString(),ref:W,code:k$._`${X.code==="new RegExp"?Hi:(0,Qi.useFunc)($,X)}(${J}, ${Y})`})}UA.usePattern=Ki;function qi($){let{gen:Q,data:J,keyword:Y,it:X}=$,W=Q.name("valid");if(X.allErrors){let U=Q.let("valid",!0);return G(()=>Q.assign(U,!1)),U}return Q.var(W,!0),G(()=>Q.break()),W;function G(U){let H=Q.const("len",k$._`${J}.length`);Q.forRange("i",0,H,(q)=>{$.subschema({keyword:Y,dataProp:q,dataPropType:jB.Type.Num},W),Q.if((0,k$.not)(W),U)})}}UA.validateArray=qi;function Vi($){let{gen:Q,schema:J,keyword:Y,it:X}=$;if(!Array.isArray(J))throw Error("ajv implementation error");if(J.some((H)=>(0,jB.alwaysValidSchema)(X,H))&&!X.opts.unevaluated)return;let G=Q.let("valid",!1),U=Q.name("_valid");Q.block(()=>J.forEach((H,q)=>{let V=$.subschema({keyword:Y,schemaProp:q,compositeRule:!0},U);if(Q.assign(G,k$._`${G} || ${U}`),!$.mergeValidEvaluated(V,U))Q.if((0,k$.not)(G))})),$.result(G,()=>$.reset(),()=>$.error(!0))}UA.validateUnion=Vi});var zA=I((VA)=>{Object.defineProperty(VA,"__esModule",{value:!0});VA.validateKeywordUsage=VA.validSchemaType=VA.funcKeywordCode=VA.macroKeywordCode=void 0;var D6=Q$(),T0=$1(),Ii=$4(),Ri=RJ();function Pi($,Q){let{gen:J,keyword:Y,schema:X,parentSchema:W,it:G}=$,U=Q.macro.call(G.self,X,W,G),H=qA(J,Y,U);if(G.opts.validateSchema!==!1)G.self.validateSchema(U,!0);let q=J.name("valid");$.subschema({schema:U,schemaPath:D6.nil,errSchemaPath:`${G.errSchemaPath}/${Y}`,topSchemaRef:H,compositeRule:!0},q),$.pass(q,()=>$.error(!0))}VA.macroKeywordCode=Pi;function Ei($,Q){var J;let{gen:Y,keyword:X,schema:W,parentSchema:G,$data:U,it:H}=$;_i(H,Q);let q=!U&&Q.compile?Q.compile.call(H.self,W,G,H):Q.validate,V=qA(Y,X,q),B=Y.let("valid");$.block$data(B,z),$.ok((J=Q.valid)!==null&&J!==void 0?J:B);function z(){if(Q.errors===!1){if(O(),Q.modifying)KA($);D(()=>$.error())}else{let M=Q.async?N():w();if(Q.modifying)KA($);D(()=>bi($,M))}}function N(){let M=Y.let("ruleErrs",null);return Y.try(()=>O(D6._`await `),(j)=>Y.assign(B,!1).if(D6._`${j} instanceof ${H.ValidationError}`,()=>Y.assign(M,D6._`${j}.errors`),()=>Y.throw(j))),M}function w(){let M=D6._`${V}.errors`;return Y.assign(M,null),O(D6.nil),M}function O(M=Q.async?D6._`await `:D6.nil){let j=H.opts.passContext?T0.default.this:T0.default.self,A=!(("compile"in Q)&&!U||Q.schema===!1);Y.assign(B,D6._`${M}${(0,Ii.callValidateCode)($,V,j,A)}`,Q.modifying)}function D(M){var j;Y.if((0,D6.not)((j=Q.valid)!==null&&j!==void 0?j:B),M)}}VA.funcKeywordCode=Ei;function KA($){let{gen:Q,data:J,it:Y}=$;Q.if(Y.parentData,()=>Q.assign(J,D6._`${Y.parentData}[${Y.parentDataProperty}]`))}function bi($,Q){let{gen:J}=$;J.if(D6._`Array.isArray(${Q})`,()=>{J.assign(T0.default.vErrors,D6._`${T0.default.vErrors} === null ? ${Q} : ${T0.default.vErrors}.concat(${Q})`).assign(T0.default.errors,D6._`${T0.default.vErrors}.length`),(0,Ri.extendErrors)($)},()=>$.error())}function _i({schemaEnv:$},Q){if(Q.async&&!$.$async)throw Error("async keyword in sync schema")}function qA($,Q,J){if(J===void 0)throw Error(`keyword "${Q}" failed to compile`);return $.scopeValue("keyword",typeof J=="function"?{ref:J}:{ref:J,code:(0,D6.stringify)(J)})}function Si($,Q,J=!1){return!Q.length||Q.some((Y)=>Y==="array"?Array.isArray($):Y==="object"?$&&typeof $=="object"&&!Array.isArray($):typeof $==Y||J&&typeof $>"u")}VA.validSchemaType=Si;function ki({schema:$,opts:Q,self:J,errSchemaPath:Y},X,W){if(Array.isArray(X.keyword)?!X.keyword.includes(W):X.keyword!==W)throw Error("ajv implementation error");let G=X.dependencies;if(G===null||G===void 0?void 0:G.some((U)=>!Object.prototype.hasOwnProperty.call($,U)))throw Error(`parent schema must have dependencies of ${W}: ${G.join(",")}`);if(X.validateSchema){if(!X.validateSchema($[W])){let H=`keyword "${W}" value is invalid at path "${Y}": `+J.errorsText(X.validateSchema.errors);if(Q.validateSchema==="log")J.logger.error(H);else throw Error(H)}}}VA.validateKeywordUsage=ki});var DA=I((wA)=>{Object.defineProperty(wA,"__esModule",{value:!0});wA.extendSubschemaMode=wA.extendSubschemaData=wA.getSubschema=void 0;var E4=Q$(),NA=q$();function xi($,{keyword:Q,schemaProp:J,schema:Y,schemaPath:X,errSchemaPath:W,topSchemaRef:G}){if(Q!==void 0&&Y!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Q!==void 0){let U=$.schema[Q];return J===void 0?{schema:U,schemaPath:E4._`${$.schemaPath}${(0,E4.getProperty)(Q)}`,errSchemaPath:`${$.errSchemaPath}/${Q}`}:{schema:U[J],schemaPath:E4._`${$.schemaPath}${(0,E4.getProperty)(Q)}${(0,E4.getProperty)(J)}`,errSchemaPath:`${$.errSchemaPath}/${Q}/${(0,NA.escapeFragment)(J)}`}}if(Y!==void 0){if(X===void 0||W===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:Y,schemaPath:X,topSchemaRef:G,errSchemaPath:W}}throw Error('either "keyword" or "schema" must be passed')}wA.getSubschema=xi;function yi($,Q,{dataProp:J,dataPropType:Y,data:X,dataTypes:W,propertyName:G}){if(X!==void 0&&J!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:U}=Q;if(J!==void 0){let{errorPath:q,dataPathArr:V,opts:B}=Q,z=U.let("data",E4._`${Q.data}${(0,E4.getProperty)(J)}`,!0);H(z),$.errorPath=E4.str`${q}${(0,NA.getErrorPath)(J,Y,B.jsPropertySyntax)}`,$.parentDataProperty=E4._`${J}`,$.dataPathArr=[...V,$.parentDataProperty]}if(X!==void 0){let q=X instanceof E4.Name?X:U.let("data",X,!0);if(H(q),G!==void 0)$.propertyName=G}if(W)$.dataTypes=W;function H(q){$.data=q,$.dataLevel=Q.dataLevel+1,$.dataTypes=[],Q.definedProperties=new Set,$.parentData=Q.data,$.dataNames=[...Q.dataNames,q]}}wA.extendSubschemaData=yi;function fi($,{jtdDiscriminator:Q,jtdMetadata:J,compositeRule:Y,createErrors:X,allErrors:W}){if(Y!==void 0)$.compositeRule=Y;if(X!==void 0)$.createErrors=X;if(W!==void 0)$.allErrors=W;$.jtdDiscriminator=Q,$.jtdMetadata=J}wA.extendSubschemaMode=fi});var RB=I((Qw$,FA)=>{FA.exports=function $(Q,J){if(Q===J)return!0;if(Q&&J&&typeof Q=="object"&&typeof J=="object"){if(Q.constructor!==J.constructor)return!1;var Y,X,W;if(Array.isArray(Q)){if(Y=Q.length,Y!=J.length)return!1;for(X=Y;X--!==0;)if(!$(Q[X],J[X]))return!1;return!0}if(Q.constructor===RegExp)return Q.source===J.source&&Q.flags===J.flags;if(Q.valueOf!==Object.prototype.valueOf)return Q.valueOf()===J.valueOf();if(Q.toString!==Object.prototype.toString)return Q.toString()===J.toString();if(W=Object.keys(Q),Y=W.length,Y!==Object.keys(J).length)return!1;for(X=Y;X--!==0;)if(!Object.prototype.hasOwnProperty.call(J,W[X]))return!1;for(X=Y;X--!==0;){var G=W[X];if(!$(Q[G],J[G]))return!1}return!0}return Q!==Q&&J!==J}});var MA=I((Jw$,ZA)=>{var h1=ZA.exports=function($,Q,J){if(typeof Q=="function")J=Q,Q={};J=Q.cb||J;var Y=typeof J=="function"?J:J.pre||function(){},X=J.post||function(){};IW(Q,Y,X,$,"",$)};h1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};h1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};h1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};h1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function IW($,Q,J,Y,X,W,G,U,H,q){if(Y&&typeof Y=="object"&&!Array.isArray(Y)){Q(Y,X,W,G,U,H,q);for(var V in Y){var B=Y[V];if(Array.isArray(B)){if(V in h1.arrayKeywords)for(var z=0;z<B.length;z++)IW($,Q,J,B[z],X+"/"+V+"/"+z,W,X,V,Y,z)}else if(V in h1.propsKeywords){if(B&&typeof B=="object")for(var N in B)IW($,Q,J,B[N],X+"/"+V+"/"+ui(N),W,X,V,Y,N)}else if(V in h1.keywords||$.allKeys&&!(V in h1.skipKeywords))IW($,Q,J,B,X+"/"+V,W,X,V,Y)}J(Y,X,W,G,U,H,q)}}function ui($){return $.replace(/~/g,"~0").replace(/\//g,"~1")}});var EJ=I((IA)=>{Object.defineProperty(IA,"__esModule",{value:!0});IA.getSchemaRefs=IA.resolveUrl=IA.normalizeId=IA._getFullPath=IA.getFullPath=IA.inlineRef=void 0;var mi=q$(),li=RB(),ci=MA(),pi=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function di($,Q=!0){if(typeof $=="boolean")return!0;if(Q===!0)return!PB($);if(!Q)return!1;return LA($)<=Q}IA.inlineRef=di;var ii=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function PB($){for(let Q in $){if(ii.has(Q))return!0;let J=$[Q];if(Array.isArray(J)&&J.some(PB))return!0;if(typeof J=="object"&&PB(J))return!0}return!1}function LA($){let Q=0;for(let J in $){if(J==="$ref")return 1/0;if(Q++,pi.has(J))continue;if(typeof $[J]=="object")(0,mi.eachItem)($[J],(Y)=>Q+=LA(Y));if(Q===1/0)return 1/0}return Q}function jA($,Q="",J){if(J!==!1)Q=N9(Q);let Y=$.parse(Q);return AA($,Y)}IA.getFullPath=jA;function AA($,Q){return $.serialize(Q).split("#")[0]+"#"}IA._getFullPath=AA;var ni=/#\/?$/;function N9($){return $?$.replace(ni,""):""}IA.normalizeId=N9;function ri($,Q,J){return J=N9(J),$.resolve(Q,J)}IA.resolveUrl=ri;var oi=/^[a-z_][-a-z0-9._]*$/i;function ti($,Q){if(typeof $=="boolean")return{};let{schemaId:J,uriResolver:Y}=this.opts,X=N9($[J]||Q),W={"":X},G=jA(Y,X,!1),U={},H=new Set;return ci($,{allKeys:!0},(B,z,N,w)=>{if(w===void 0)return;let O=G+z,D=W[w];if(typeof B[J]=="string")D=M.call(this,B[J]);j.call(this,B.$anchor),j.call(this,B.$dynamicAnchor),W[z]=D;function M(A){let k=this.opts.uriResolver.resolve;if(A=N9(D?k(D,A):A),H.has(A))throw V(A);H.add(A);let u=this.refs[A];if(typeof u=="string")u=this.refs[u];if(typeof u=="object")q(B,u.schema,A);else if(A!==N9(O))if(A[0]==="#")q(B,U[A],A),U[A]=B;else this.refs[A]=O;return A}function j(A){if(typeof A=="string"){if(!oi.test(A))throw Error(`invalid anchor "${A}"`);M.call(this,`#${A}`)}}}),U;function q(B,z,N){if(z!==void 0&&!li(B,z))throw V(N)}function V(B){return Error(`reference "${B}" resolves to more than one schema`)}}IA.getSchemaRefs=ti});var SJ=I((uA)=>{Object.defineProperty(uA,"__esModule",{value:!0});uA.getData=uA.KeywordCxt=uA.validateFunctionCode=void 0;var SA=cj(),PA=PJ(),bB=FB(),RW=PJ(),Jn=YA(),_J=zA(),EB=DA(),p=Q$(),a=$1(),Xn=EJ(),Q1=q$(),bJ=RJ();function Yn($){if(CA($)){if(TA($),vA($)){Un($);return}}kA($,()=>(0,SA.topBoolOrEmptySchema)($))}uA.validateFunctionCode=Yn;function kA({gen:$,validateName:Q,schema:J,schemaEnv:Y,opts:X},W){if(X.code.es5)$.func(Q,p._`${a.default.data}, ${a.default.valCxt}`,Y.$async,()=>{$.code(p._`"use strict"; ${EA(J,X)}`),Gn($,X),$.code(W)});else $.func(Q,p._`${a.default.data}, ${Wn(X)}`,Y.$async,()=>$.code(EA(J,X)).code(W))}function Wn($){return p._`{${a.default.instancePath}="", ${a.default.parentData}, ${a.default.parentDataProperty}, ${a.default.rootData}=${a.default.data}${$.dynamicRef?p._`, ${a.default.dynamicAnchors}={}`:p.nil}}={}`}function Gn($,Q){$.if(a.default.valCxt,()=>{if($.var(a.default.instancePath,p._`${a.default.valCxt}.${a.default.instancePath}`),$.var(a.default.parentData,p._`${a.default.valCxt}.${a.default.parentData}`),$.var(a.default.parentDataProperty,p._`${a.default.valCxt}.${a.default.parentDataProperty}`),$.var(a.default.rootData,p._`${a.default.valCxt}.${a.default.rootData}`),Q.dynamicRef)$.var(a.default.dynamicAnchors,p._`${a.default.valCxt}.${a.default.dynamicAnchors}`)},()=>{if($.var(a.default.instancePath,p._`""`),$.var(a.default.parentData,p._`undefined`),$.var(a.default.parentDataProperty,p._`undefined`),$.var(a.default.rootData,a.default.data),Q.dynamicRef)$.var(a.default.dynamicAnchors,p._`{}`)})}function Un($){let{schema:Q,opts:J,gen:Y}=$;kA($,()=>{if(J.$comment&&Q.$comment)yA($);if(Bn($),Y.let(a.default.vErrors,null),Y.let(a.default.errors,0),J.unevaluated)Hn($);xA($),wn($)});return}function Hn($){let{gen:Q,validateName:J}=$;$.evaluated=Q.const("evaluated",p._`${J}.evaluated`),Q.if(p._`${$.evaluated}.dynamicProps`,()=>Q.assign(p._`${$.evaluated}.props`,p._`undefined`)),Q.if(p._`${$.evaluated}.dynamicItems`,()=>Q.assign(p._`${$.evaluated}.items`,p._`undefined`))}function EA($,Q){let J=typeof $=="object"&&$[Q.schemaId];return J&&(Q.code.source||Q.code.process)?p._`/*# sourceURL=${J} */`:p.nil}function Kn($,Q){if(CA($)){if(TA($),vA($)){qn($,Q);return}}(0,SA.boolOrEmptySchema)($,Q)}function vA({schema:$,self:Q}){if(typeof $=="boolean")return!$;for(let J in $)if(Q.RULES.all[J])return!0;return!1}function CA($){return typeof $.schema!="boolean"}function qn($,Q){let{schema:J,gen:Y,opts:X}=$;if(X.$comment&&J.$comment)yA($);zn($),Nn($);let W=Y.const("_errs",a.default.errors);xA($,W),Y.var(Q,p._`${W} === ${a.default.errors}`)}function TA($){(0,Q1.checkUnknownRules)($),Vn($)}function xA($,Q){if($.opts.jtd)return bA($,[],!1,Q);let J=(0,PA.getSchemaTypes)($.schema),Y=(0,PA.coerceAndCheckDataType)($,J);bA($,J,!Y,Q)}function Vn($){let{schema:Q,errSchemaPath:J,opts:Y,self:X}=$;if(Q.$ref&&Y.ignoreKeywordsWithRef&&(0,Q1.schemaHasRulesButRef)(Q,X.RULES))X.logger.warn(`$ref: keywords ignored in schema at path "${J}"`)}function Bn($){let{schema:Q,opts:J}=$;if(Q.default!==void 0&&J.useDefaults&&J.strictSchema)(0,Q1.checkStrictMode)($,"default is ignored in the schema root")}function zn($){let Q=$.schema[$.opts.schemaId];if(Q)$.baseId=(0,Xn.resolveUrl)($.opts.uriResolver,$.baseId,Q)}function Nn($){if($.schema.$async&&!$.schemaEnv.$async)throw Error("async schema in sync schema")}function yA({gen:$,schemaEnv:Q,schema:J,errSchemaPath:Y,opts:X}){let W=J.$comment;if(X.$comment===!0)$.code(p._`${a.default.self}.logger.log(${W})`);else if(typeof X.$comment=="function"){let G=p.str`${Y}/$comment`,U=$.scopeValue("root",{ref:Q.root});$.code(p._`${a.default.self}.opts.$comment(${W}, ${G}, ${U}.schema)`)}}function wn($){let{gen:Q,schemaEnv:J,validateName:Y,ValidationError:X,opts:W}=$;if(J.$async)Q.if(p._`${a.default.errors} === 0`,()=>Q.return(a.default.data),()=>Q.throw(p._`new ${X}(${a.default.vErrors})`));else{if(Q.assign(p._`${Y}.errors`,a.default.vErrors),W.unevaluated)On($);Q.return(p._`${a.default.errors} === 0`)}}function On({gen:$,evaluated:Q,props:J,items:Y}){if(J instanceof p.Name)$.assign(p._`${Q}.props`,J);if(Y instanceof p.Name)$.assign(p._`${Q}.items`,Y)}function bA($,Q,J,Y){let{gen:X,schema:W,data:G,allErrors:U,opts:H,self:q}=$,{RULES:V}=q;if(W.$ref&&(H.ignoreKeywordsWithRef||!(0,Q1.schemaHasRulesButRef)(W,V))){X.block(()=>gA($,"$ref",V.all.$ref.definition));return}if(!H.jtd)Dn($,Q);X.block(()=>{for(let z of V.rules)B(z);B(V.post)});function B(z){if(!(0,bB.shouldUseGroup)(W,z))return;if(z.type){if(X.if((0,RW.checkDataType)(z.type,G,H.strictNumbers)),_A($,z),Q.length===1&&Q[0]===z.type&&J)X.else(),(0,RW.reportTypeError)($);X.endIf()}else _A($,z);if(!U)X.if(p._`${a.default.errors} === ${Y||0}`)}}function _A($,Q){let{gen:J,schema:Y,opts:{useDefaults:X}}=$;if(X)(0,Jn.assignDefaults)($,Q.type);J.block(()=>{for(let W of Q.rules)if((0,bB.shouldUseRule)(Y,W))gA($,W.keyword,W.definition,Q.type)})}function Dn($,Q){if($.schemaEnv.meta||!$.opts.strictTypes)return;if(Fn($,Q),!$.opts.allowUnionTypes)Zn($,Q);Mn($,$.dataTypes)}function Fn($,Q){if(!Q.length)return;if(!$.dataTypes.length){$.dataTypes=Q;return}Q.forEach((J)=>{if(!fA($.dataTypes,J))_B($,`type "${J}" not allowed by context "${$.dataTypes.join(",")}"`)}),jn($,Q)}function Zn($,Q){if(Q.length>1&&!(Q.length===2&&Q.includes("null")))_B($,"use allowUnionTypes to allow union type keyword")}function Mn($,Q){let J=$.self.RULES.all;for(let Y in J){let X=J[Y];if(typeof X=="object"&&(0,bB.shouldUseRule)($.schema,X)){let{type:W}=X.definition;if(W.length&&!W.some((G)=>Ln(Q,G)))_B($,`missing type "${W.join(",")}" for keyword "${Y}"`)}}}function Ln($,Q){return $.includes(Q)||Q==="number"&&$.includes("integer")}function fA($,Q){return $.includes(Q)||Q==="integer"&&$.includes("number")}function jn($,Q){let J=[];for(let Y of $.dataTypes)if(fA(Q,Y))J.push(Y);else if(Q.includes("integer")&&Y==="number")J.push("integer");$.dataTypes=J}function _B($,Q){let J=$.schemaEnv.baseId+$.errSchemaPath;Q+=` at "${J}" (strictTypes)`,(0,Q1.checkStrictMode)($,Q,$.opts.strictTypes)}class SB{constructor($,Q,J){if((0,_J.validateKeywordUsage)($,Q,J),this.gen=$.gen,this.allErrors=$.allErrors,this.keyword=J,this.data=$.data,this.schema=$.schema[J],this.$data=Q.$data&&$.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Q1.schemaRefOrVal)($,this.schema,J,this.$data),this.schemaType=Q.schemaType,this.parentSchema=$.schema,this.params={},this.it=$,this.def=Q,this.$data)this.schemaCode=$.gen.const("vSchema",hA(this.$data,$));else if(this.schemaCode=this.schemaValue,!(0,_J.validSchemaType)(this.schema,Q.schemaType,Q.allowUndefined))throw Error(`${J} value must be ${JSON.stringify(Q.schemaType)}`);if("code"in Q?Q.trackErrors:Q.errors!==!1)this.errsCount=$.gen.const("_errs",a.default.errors)}result($,Q,J){this.failResult((0,p.not)($),Q,J)}failResult($,Q,J){if(this.gen.if($),J)J();else this.error();if(Q){if(this.gen.else(),Q(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass($,Q){this.failResult((0,p.not)($),void 0,Q)}fail($){if($===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if($),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data($){if(!this.$data)return this.fail($);let{schemaCode:Q}=this;this.fail(p._`${Q} !== undefined && (${(0,p.or)(this.invalid$data(),$)})`)}error($,Q,J){if(Q){this.setParams(Q),this._error($,J),this.setParams({});return}this._error($,J)}_error($,Q){($?bJ.reportExtraError:bJ.reportError)(this,this.def.error,Q)}$dataError(){(0,bJ.reportError)(this,this.def.$dataError||bJ.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,bJ.resetErrorsCount)(this.gen,this.errsCount)}ok($){if(!this.allErrors)this.gen.if($)}setParams($,Q){if(Q)Object.assign(this.params,$);else this.params=$}block$data($,Q,J=p.nil){this.gen.block(()=>{this.check$data($,J),Q()})}check$data($=p.nil,Q=p.nil){if(!this.$data)return;let{gen:J,schemaCode:Y,schemaType:X,def:W}=this;if(J.if((0,p.or)(p._`${Y} === undefined`,Q)),$!==p.nil)J.assign($,!0);if(X.length||W.validateSchema){if(J.elseIf(this.invalid$data()),this.$dataError(),$!==p.nil)J.assign($,!1)}J.else()}invalid$data(){let{gen:$,schemaCode:Q,schemaType:J,def:Y,it:X}=this;return(0,p.or)(W(),G());function W(){if(J.length){if(!(Q instanceof p.Name))throw Error("ajv implementation error");let U=Array.isArray(J)?J:[J];return p._`${(0,RW.checkDataTypes)(U,Q,X.opts.strictNumbers,RW.DataType.Wrong)}`}return p.nil}function G(){if(Y.validateSchema){let U=$.scopeValue("validate$data",{ref:Y.validateSchema});return p._`!${U}(${Q})`}return p.nil}}subschema($,Q){let J=(0,EB.getSubschema)(this.it,$);(0,EB.extendSubschemaData)(J,this.it,$),(0,EB.extendSubschemaMode)(J,$);let Y={...this.it,...J,items:void 0,props:void 0};return Kn(Y,Q),Y}mergeEvaluated($,Q){let{it:J,gen:Y}=this;if(!J.opts.unevaluated)return;if(J.props!==!0&&$.props!==void 0)J.props=Q1.mergeEvaluated.props(Y,$.props,J.props,Q);if(J.items!==!0&&$.items!==void 0)J.items=Q1.mergeEvaluated.items(Y,$.items,J.items,Q)}mergeValidEvaluated($,Q){let{it:J,gen:Y}=this;if(J.opts.unevaluated&&(J.props!==!0||J.items!==!0))return Y.if(Q,()=>this.mergeEvaluated($,p.Name)),!0}}uA.KeywordCxt=SB;function gA($,Q,J,Y){let X=new SB($,J,Q);if("code"in J)J.code(X,Y);else if(X.$data&&J.validate)(0,_J.funcKeywordCode)(X,J);else if("macro"in J)(0,_J.macroKeywordCode)(X,J);else if(J.compile||J.validate)(0,_J.funcKeywordCode)(X,J)}var An=/^\/(?:[^~]|~0|~1)*$/,In=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hA($,{dataLevel:Q,dataNames:J,dataPathArr:Y}){let X,W;if($==="")return a.default.rootData;if($[0]==="/"){if(!An.test($))throw Error(`Invalid JSON-pointer: ${$}`);X=$,W=a.default.rootData}else{let q=In.exec($);if(!q)throw Error(`Invalid JSON-pointer: ${$}`);let V=+q[1];if(X=q[2],X==="#"){if(V>=Q)throw Error(H("property/index",V));return Y[Q-V]}if(V>Q)throw Error(H("data",V));if(W=J[Q-V],!X)return W}let G=W,U=X.split("/");for(let q of U)if(q)W=p._`${W}${(0,p.getProperty)((0,Q1.unescapeJsonPointer)(q))}`,G=p._`${G} && ${W}`;return G;function H(q,V){return`Cannot access ${q} ${V} levels up, current level is ${Q}`}}uA.getData=hA});var PW=I((cA)=>{Object.defineProperty(cA,"__esModule",{value:!0});class lA extends Error{constructor($){super("validation failed");this.errors=$,this.ajv=this.validation=!0}}cA.default=lA});var kJ=I((dA)=>{Object.defineProperty(dA,"__esModule",{value:!0});var kB=EJ();class pA extends Error{constructor($,Q,J,Y){super(Y||`can't resolve reference ${J} from id ${Q}`);this.missingRef=(0,kB.resolveUrl)($,Q,J),this.missingSchema=(0,kB.normalizeId)((0,kB.getFullPath)($,this.missingRef))}}dA.default=pA});var bW=I((rA)=>{Object.defineProperty(rA,"__esModule",{value:!0});rA.resolveSchema=rA.getCompilingSchema=rA.resolveRef=rA.compileSchema=rA.SchemaEnv=void 0;var N4=Q$(),_n=PW(),x0=$1(),w4=EJ(),iA=q$(),Sn=SJ();class vJ{constructor($){var Q;this.refs={},this.dynamicAnchors={};let J;if(typeof $.schema=="object")J=$.schema;this.schema=$.schema,this.schemaId=$.schemaId,this.root=$.root||this,this.baseId=(Q=$.baseId)!==null&&Q!==void 0?Q:(0,w4.normalizeId)(J===null||J===void 0?void 0:J[$.schemaId||"$id"]),this.schemaPath=$.schemaPath,this.localRefs=$.localRefs,this.meta=$.meta,this.$async=J===null||J===void 0?void 0:J.$async,this.refs={}}}rA.SchemaEnv=vJ;function CB($){let Q=nA.call(this,$);if(Q)return Q;let J=(0,w4.getFullPath)(this.opts.uriResolver,$.root.baseId),{es5:Y,lines:X}=this.opts.code,{ownProperties:W}=this.opts,G=new N4.CodeGen(this.scope,{es5:Y,lines:X,ownProperties:W}),U;if($.$async)U=G.scopeValue("Error",{ref:_n.default,code:N4._`require("ajv/dist/runtime/validation_error").default`});let H=G.scopeName("validate");$.validateName=H;let q={gen:G,allErrors:this.opts.allErrors,data:x0.default.data,parentData:x0.default.parentData,parentDataProperty:x0.default.parentDataProperty,dataNames:[x0.default.data],dataPathArr:[N4.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:$.schema,code:(0,N4.stringify)($.schema)}:{ref:$.schema}),validateName:H,ValidationError:U,schema:$.schema,schemaEnv:$,rootId:J,baseId:$.baseId||J,schemaPath:N4.nil,errSchemaPath:$.schemaPath||(this.opts.jtd?"":"#"),errorPath:N4._`""`,opts:this.opts,self:this},V;try{this._compilations.add($),(0,Sn.validateFunctionCode)(q),G.optimize(this.opts.code.optimize);let B=G.toString();if(V=`${G.scopeRefs(x0.default.scope)}return ${B}`,this.opts.code.process)V=this.opts.code.process(V,$);let N=Function(`${x0.default.self}`,`${x0.default.scope}`,V)(this,this.scope.get());if(this.scope.value(H,{ref:N}),N.errors=null,N.schema=$.schema,N.schemaEnv=$,$.$async)N.$async=!0;if(this.opts.code.source===!0)N.source={validateName:H,validateCode:B,scopeValues:G._values};if(this.opts.unevaluated){let{props:w,items:O}=q;if(N.evaluated={props:w instanceof N4.Name?void 0:w,items:O instanceof N4.Name?void 0:O,dynamicProps:w instanceof N4.Name,dynamicItems:O instanceof N4.Name},N.source)N.source.evaluated=(0,N4.stringify)(N.evaluated)}return $.validate=N,$}catch(B){if(delete $.validate,delete $.validateName,V)this.logger.error("Error compiling schema, function code:",V);throw B}finally{this._compilations.delete($)}}rA.compileSchema=CB;function kn($,Q,J){var Y;J=(0,w4.resolveUrl)(this.opts.uriResolver,Q,J);let X=$.refs[J];if(X)return X;let W=Tn.call(this,$,J);if(W===void 0){let G=(Y=$.localRefs)===null||Y===void 0?void 0:Y[J],{schemaId:U}=this.opts;if(G)W=new vJ({schema:G,schemaId:U,root:$,baseId:Q})}if(W===void 0)return;return $.refs[J]=vn.call(this,W)}rA.resolveRef=kn;function vn($){if((0,w4.inlineRef)($.schema,this.opts.inlineRefs))return $.schema;return $.validate?$:CB.call(this,$)}function nA($){for(let Q of this._compilations)if(Cn(Q,$))return Q}rA.getCompilingSchema=nA;function Cn($,Q){return $.schema===Q.schema&&$.root===Q.root&&$.baseId===Q.baseId}function Tn($,Q){let J;while(typeof(J=this.refs[Q])=="string")Q=J;return J||this.schemas[Q]||EW.call(this,$,Q)}function EW($,Q){let J=this.opts.uriResolver.parse(Q),Y=(0,w4._getFullPath)(this.opts.uriResolver,J),X=(0,w4.getFullPath)(this.opts.uriResolver,$.baseId,void 0);if(Object.keys($.schema).length>0&&Y===X)return vB.call(this,J,$);let W=(0,w4.normalizeId)(Y),G=this.refs[W]||this.schemas[W];if(typeof G=="string"){let U=EW.call(this,$,G);if(typeof(U===null||U===void 0?void 0:U.schema)!=="object")return;return vB.call(this,J,U)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)CB.call(this,G);if(W===(0,w4.normalizeId)(Q)){let{schema:U}=G,{schemaId:H}=this.opts,q=U[H];if(q)X=(0,w4.resolveUrl)(this.opts.uriResolver,X,q);return new vJ({schema:U,schemaId:H,root:$,baseId:X})}return vB.call(this,J,G)}rA.resolveSchema=EW;var xn=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function vB($,{baseId:Q,schema:J,root:Y}){var X;if(((X=$.fragment)===null||X===void 0?void 0:X[0])!=="/")return;for(let U of $.fragment.slice(1).split("/")){if(typeof J==="boolean")return;let H=J[(0,iA.unescapeFragment)(U)];if(H===void 0)return;J=H;let q=typeof J==="object"&&J[this.opts.schemaId];if(!xn.has(U)&&q)Q=(0,w4.resolveUrl)(this.opts.uriResolver,Q,q)}let W;if(typeof J!="boolean"&&J.$ref&&!(0,iA.schemaHasRulesButRef)(J,this.RULES)){let U=(0,w4.resolveUrl)(this.opts.uriResolver,Q,J.$ref);W=EW.call(this,Y,U)}let{schemaId:G}=this.opts;if(W=W||new vJ({schema:J,schemaId:G,root:Y,baseId:Q}),W.schema!==W.root.schema)return W;return}});var tA=I((Hw$,un)=>{un.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var yB=I((Kw$,JI)=>{var mn=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),sA=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),TB=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),eA=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),ln=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function xB($){let Q="",J=0,Y=0;for(Y=0;Y<$.length;Y++){if(J=$[Y].charCodeAt(0),J===48)continue;if(!(J>=48&&J<=57||J>=65&&J<=70||J>=97&&J<=102))return"";Q+=$[Y];break}for(Y+=1;Y<$.length;Y++){if(J=$[Y].charCodeAt(0),!(J>=48&&J<=57||J>=65&&J<=70||J>=97&&J<=102))return"";Q+=$[Y]}return Q}var cn=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function aA($){return $.length=0,!0}function pn($,Q,J){if($.length){let Y=xB($);if(Y!=="")Q.push(Y);else return J.error=!0,!1;$.length=0}return!0}function dn($){let Q=0,J={error:!1,address:"",zone:""},Y=[],X=[],W=!1,G=!1,U=pn;for(let H=0;H<$.length;H++){let q=$[H];if(q==="["||q==="]")continue;if(q===":"){if(W===!0)G=!0;if(!U(X,Y,J))break;if(++Q>7){J.error=!0;break}if(H>0&&$[H-1]===":")W=!0;Y.push(":");continue}else if(q==="%"){if(!U(X,Y,J))break;U=aA}else{X.push(q);continue}}if(X.length)if(U===aA)J.zone=X.join("");else if(G)Y.push(X.join(""));else Y.push(xB(X));return J.address=Y.join(""),J}function $I($){if(nn($,":")<2)return{host:$,isIPV6:!1};let Q=dn($);if(!Q.error){let{address:J,address:Y}=Q;if(Q.zone)J+="%"+Q.zone,Y+="%25"+Q.zone;return{host:J,isIPV6:!0,escapedHost:Y}}else return{host:$,isIPV6:!1}}function nn($,Q){let J=0;for(let Y=0;Y<$.length;Y++)if($[Y]===Q)J++;return J}function rn($){let Q=$,J=[],Y=-1,X=0;while(X=Q.length){if(X===1)if(Q===".")break;else if(Q==="/"){J.push("/");break}else{J.push(Q);break}else if(X===2){if(Q[0]==="."){if(Q[1]===".")break;else if(Q[1]==="/"){Q=Q.slice(2);continue}}else if(Q[0]==="/"){if(Q[1]==="."||Q[1]==="/"){J.push("/");break}}}else if(X===3){if(Q==="/.."){if(J.length!==0)J.pop();J.push("/");break}}if(Q[0]==="."){if(Q[1]==="."){if(Q[2]==="/"){Q=Q.slice(3);continue}}else if(Q[1]==="/"){Q=Q.slice(2);continue}}else if(Q[0]==="/"){if(Q[1]==="."){if(Q[2]==="/"){Q=Q.slice(2);continue}else if(Q[2]==="."){if(Q[3]==="/"){if(Q=Q.slice(3),J.length!==0)J.pop();continue}}}}if((Y=Q.indexOf("/",1))===-1){J.push(Q);break}else J.push(Q.slice(0,Y)),Q=Q.slice(Y)}return J.join("")}var on={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},tn=/[@/?#:]/g,an=/[@/?#]/g;function QI($,Q){let J=Q?an:tn;return J.lastIndex=0,$.replace(J,(Y)=>on[Y])}function sn($,Q=!1){if($.indexOf("%")===-1)return $;let J="";for(let Y=0;Y<$.length;Y++){if($[Y]==="%"&&Y+2<$.length){let X=$.slice(Y+1,Y+3);if(TB(X)){let W=X.toUpperCase(),G=String.fromCharCode(parseInt(W,16));if(Q&&eA(G))J+=G;else J+="%"+W;Y+=2;continue}}J+=$[Y]}return J}function en($){let Q="";for(let J=0;J<$.length;J++){if($[J]==="%"&&J+2<$.length){let Y=$.slice(J+1,J+3);if(TB(Y)){let X=Y.toUpperCase(),W=String.fromCharCode(parseInt(X,16));if(W!=="."&&eA(W))Q+=W;else Q+="%"+X;J+=2;continue}}if(ln($[J]))Q+=$[J];else Q+=escape($[J])}return Q}function $r($){let Q="";for(let J=0;J<$.length;J++){if($[J]==="%"&&J+2<$.length){let Y=$.slice(J+1,J+3);if(TB(Y)){Q+="%"+Y.toUpperCase(),J+=2;continue}}Q+=escape($[J])}return Q}function Qr($){let Q=[];if($.userinfo!==void 0)Q.push($.userinfo),Q.push("@");if($.host!==void 0){let J=unescape($.host);if(!sA(J)){let Y=$I(J);if(Y.isIPV6===!0)J=`[${Y.escapedHost}]`;else J=QI(J,!1)}Q.push(J)}if(typeof $.port==="number"||typeof $.port==="string")Q.push(":"),Q.push(String($.port));return Q.length?Q.join(""):void 0}JI.exports={nonSimpleDomain:cn,recomposeAuthority:Qr,reescapeHostDelimiters:QI,normalizePercentEncoding:sn,normalizePathEncoding:en,escapePreservingEscapes:$r,removeDotSegments:rn,isIPv4:sA,isUUID:mn,normalizeIPv6:$I,stringArrayToHexStripped:xB}});var UI=I((qw$,GI)=>{var{isUUID:Jr}=yB(),Xr=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Yr=["http","https","ws","wss","urn","urn:uuid"];function Wr($){return Yr.indexOf($)!==-1}function fB($){if($.secure===!0)return!0;else if($.secure===!1)return!1;else if($.scheme)return $.scheme.length===3&&($.scheme[0]==="w"||$.scheme[0]==="W")&&($.scheme[1]==="s"||$.scheme[1]==="S")&&($.scheme[2]==="s"||$.scheme[2]==="S");else return!1}function XI($){if(!$.host)$.error=$.error||"HTTP URIs must have a host.";return $}function YI($){let Q=String($.scheme).toLowerCase()==="https";if($.port===(Q?443:80)||$.port==="")$.port=void 0;if(!$.path)$.path="/";return $}function Gr($){return $.secure=fB($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$}function Ur($){if($.port===(fB($)?443:80)||$.port==="")$.port=void 0;if(typeof $.secure==="boolean")$.scheme=$.secure?"wss":"ws",$.secure=void 0;if($.resourceName){let[Q,J]=$.resourceName.split("?");$.path=Q&&Q!=="/"?Q:void 0,$.query=J,$.resourceName=void 0}return $.fragment=void 0,$}function Hr($,Q){if(!$.path)return $.error="URN can not be parsed",$;let J=$.path.match(Xr);if(J){let Y=Q.scheme||$.scheme||"urn";$.nid=J[1].toLowerCase(),$.nss=J[2];let X=`${Y}:${Q.nid||$.nid}`,W=gB(X);if($.path=void 0,W)$=W.parse($,Q)}else $.error=$.error||"URN can not be parsed.";return $}function Kr($,Q){if($.nid===void 0)throw Error("URN without nid cannot be serialized");let J=Q.scheme||$.scheme||"urn",Y=$.nid.toLowerCase(),X=`${J}:${Q.nid||Y}`,W=gB(X);if(W)$=W.serialize($,Q);let G=$,U=$.nss;return G.path=`${Y||Q.nid}:${U}`,Q.skipEscape=!0,G}function qr($,Q){let J=$;if(J.uuid=J.nss,J.nss=void 0,!Q.tolerant&&(!J.uuid||!Jr(J.uuid)))J.error=J.error||"UUID is not valid.";return J}function Vr($){let Q=$;return Q.nss=($.uuid||"").toLowerCase(),Q}var WI={scheme:"http",domainHost:!0,parse:XI,serialize:YI},Br={scheme:"https",domainHost:WI.domainHost,parse:XI,serialize:YI},_W={scheme:"ws",domainHost:!0,parse:Gr,serialize:Ur},zr={scheme:"wss",domainHost:_W.domainHost,parse:_W.parse,serialize:_W.serialize},Nr={scheme:"urn",parse:Hr,serialize:Kr,skipNormalize:!0},wr={scheme:"urn:uuid",parse:qr,serialize:Vr,skipNormalize:!0},SW={http:WI,https:Br,ws:_W,wss:zr,urn:Nr,"urn:uuid":wr};Object.setPrototypeOf(SW,null);function gB($){return $&&(SW[$]||SW[$.toLowerCase()])||void 0}GI.exports={wsIsSecure:fB,SCHEMES:SW,isValidSchemeName:Wr,getSchemeHandler:gB}});var zI=I((Vw$,kW)=>{var{normalizeIPv6:Or,removeDotSegments:CJ,recomposeAuthority:Dr,normalizePercentEncoding:Fr,normalizePathEncoding:Zr,escapePreservingEscapes:Mr,reescapeHostDelimiters:Lr,isIPv4:jr,nonSimpleDomain:Ar}=yB(),{SCHEMES:Ir,getSchemeHandler:KI}=UI();function Rr($,Q){if(typeof $==="string")$=Sr($,Q);else if(typeof $==="object")$=w9(y0($,Q),Q);return $}function Pr($,Q,J){let Y=J?Object.assign({scheme:"null"},J):{scheme:"null"},X=qI(w9($,Y),w9(Q,Y),Y,!0);return Y.skipEscape=!0,y0(X,Y)}function qI($,Q,J,Y){let X={};if(!Y)$=w9(y0($,J),J),Q=w9(y0(Q,J),J);if(J=J||{},!J.tolerant&&Q.scheme)X.scheme=Q.scheme,X.userinfo=Q.userinfo,X.host=Q.host,X.port=Q.port,X.path=CJ(Q.path||""),X.query=Q.query;else{if(Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)X.userinfo=Q.userinfo,X.host=Q.host,X.port=Q.port,X.path=CJ(Q.path||""),X.query=Q.query;else{if(!Q.path)if(X.path=$.path,Q.query!==void 0)X.query=Q.query;else X.query=$.query;else{if(Q.path[0]==="/")X.path=CJ(Q.path);else{if(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path)X.path="/"+Q.path;else if(!$.path)X.path=Q.path;else X.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+Q.path;X.path=CJ(X.path)}X.query=Q.query}X.userinfo=$.userinfo,X.host=$.host,X.port=$.port}X.scheme=$.scheme}return X.fragment=Q.fragment,X}function Er($,Q,J){let Y=HI($,J),X=HI(Q,J);return Y!==void 0&&X!==void 0&&Y.toLowerCase()===X.toLowerCase()}function y0($,Q){let J={host:$.host,scheme:$.scheme,userinfo:$.userinfo,port:$.port,path:$.path,query:$.query,nid:$.nid,nss:$.nss,uuid:$.uuid,fragment:$.fragment,reference:$.reference,resourceName:$.resourceName,secure:$.secure,error:""},Y=Object.assign({},Q),X=[],W=KI(Y.scheme||J.scheme);if(W&&W.serialize)W.serialize(J,Y);if(J.path!==void 0)if(!Y.skipEscape){if(J.path=Mr(J.path),J.scheme!==void 0)J.path=J.path.split("%3A").join(":")}else J.path=Fr(J.path);if(Y.reference!=="suffix"&&J.scheme)X.push(J.scheme,":");let G=Dr(J);if(G!==void 0){if(Y.reference!=="suffix")X.push("//");if(X.push(G),J.path&&J.path[0]!=="/")X.push("/")}if(J.path!==void 0){let U=J.path;if(!Y.absolutePath&&(!W||!W.absolutePath))U=CJ(U);if(G===void 0&&U[0]==="/"&&U[1]==="/")U="/%2F"+U.slice(2);X.push(U)}if(J.query!==void 0)X.push("?",J.query);if(J.fragment!==void 0)X.push("#",J.fragment);return X.join("")}var br=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function _r($,Q){if(Q[2]!==void 0&&$.path&&$.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof $.port==="number"&&($.port<0||$.port>65535))return"URI port is malformed.";return}function VI($,Q){let J=Object.assign({},Q),Y={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},X=!1,W=!1;if(J.reference==="suffix")if(J.scheme)$=J.scheme+":"+$;else $="//"+$;let G=$.match(br);if(G){if(Y.scheme=G[1],Y.userinfo=G[3],Y.host=G[4],Y.port=parseInt(G[5],10),Y.path=G[6]||"",Y.query=G[7],Y.fragment=G[8],isNaN(Y.port))Y.port=G[5];let U=_r(Y,G);if(U!==void 0)Y.error=Y.error||U,X=!0;if(Y.host)if(jr(Y.host)===!1){let V=Or(Y.host);Y.host=V.host.toLowerCase(),W=V.isIPV6}else W=!0;if(Y.scheme===void 0&&Y.userinfo===void 0&&Y.host===void 0&&Y.port===void 0&&Y.query===void 0&&!Y.path)Y.reference="same-document";else if(Y.scheme===void 0)Y.reference="relative";else if(Y.fragment===void 0)Y.reference="absolute";else Y.reference="uri";if(J.reference&&J.reference!=="suffix"&&J.reference!==Y.reference)Y.error=Y.error||"URI is not a "+J.reference+" reference.";let H=KI(J.scheme||Y.scheme);if(!J.unicodeSupport&&(!H||!H.unicodeSupport)){if(Y.host&&(J.domainHost||H&&H.domainHost)&&W===!1&&Ar(Y.host))try{Y.host=URL.domainToASCII(Y.host.toLowerCase())}catch(q){Y.error=Y.error||"Host's domain name can not be converted to ASCII: "+q}}if(!H||H&&!H.skipNormalize){if($.indexOf("%")!==-1){if(Y.scheme!==void 0)Y.scheme=unescape(Y.scheme);if(Y.host!==void 0)Y.host=Lr(unescape(Y.host),W)}if(Y.path)Y.path=Zr(Y.path);if(Y.fragment)try{Y.fragment=encodeURI(decodeURIComponent(Y.fragment))}catch{Y.error=Y.error||"URI malformed"}}if(H&&H.parse)H.parse(Y,J)}else Y.error=Y.error||"URI can not be parsed.";return{parsed:Y,malformedAuthorityOrPort:X}}function w9($,Q){return VI($,Q).parsed}function Sr($,Q){return BI($,Q).normalized}function BI($,Q){let{parsed:J,malformedAuthorityOrPort:Y}=VI($,Q);return{normalized:Y?$:y0(J,Q),malformedAuthorityOrPort:Y}}function HI($,Q){if(typeof $==="string"){let{normalized:J,malformedAuthorityOrPort:Y}=BI($,Q);return Y?void 0:J}if(typeof $==="object")return y0($,Q)}var hB={SCHEMES:Ir,normalize:Rr,resolve:Pr,resolveComponent:qI,equal:Er,serialize:y0,parse:w9};kW.exports=hB;kW.exports.default=hB;kW.exports.fastUri=hB});var OI=I((wI)=>{Object.defineProperty(wI,"__esModule",{value:!0});var NI=zI();NI.code='require("ajv/dist/runtime/uri").default';wI.default=NI});var II=I((J1)=>{Object.defineProperty(J1,"__esModule",{value:!0});J1.CodeGen=J1.Name=J1.nil=J1.stringify=J1.str=J1._=J1.KeywordCxt=void 0;var vr=SJ();Object.defineProperty(J1,"KeywordCxt",{enumerable:!0,get:function(){return vr.KeywordCxt}});var O9=Q$();Object.defineProperty(J1,"_",{enumerable:!0,get:function(){return O9._}});Object.defineProperty(J1,"str",{enumerable:!0,get:function(){return O9.str}});Object.defineProperty(J1,"stringify",{enumerable:!0,get:function(){return O9.stringify}});Object.defineProperty(J1,"nil",{enumerable:!0,get:function(){return O9.nil}});Object.defineProperty(J1,"Name",{enumerable:!0,get:function(){return O9.Name}});Object.defineProperty(J1,"CodeGen",{enumerable:!0,get:function(){return O9.CodeGen}});var Cr=PW(),LI=kJ(),Tr=DB(),TJ=bW(),xr=Q$(),xJ=EJ(),vW=PJ(),mB=q$(),DI=tA(),yr=OI(),jI=($,Q)=>new RegExp($,Q);jI.code="new RegExp";var fr=["removeAdditional","useDefaults","coerceTypes"],gr=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),hr={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},ur={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},FI=200;function mr($){var Q,J,Y,X,W,G,U,H,q,V,B,z,N,w,O,D,M,j,A,k,u,G$,u$,e$,m6;let F6=$.strict,a1=(Q=$.code)===null||Q===void 0?void 0:Q.optimize,i0=a1===!0||a1===void 0?1:a1||0,S4=(Y=(J=$.code)===null||J===void 0?void 0:J.regExp)!==null&&Y!==void 0?Y:jI,S9=(X=$.uriResolver)!==null&&X!==void 0?X:yr.default;return{strictSchema:(G=(W=$.strictSchema)!==null&&W!==void 0?W:F6)!==null&&G!==void 0?G:!0,strictNumbers:(H=(U=$.strictNumbers)!==null&&U!==void 0?U:F6)!==null&&H!==void 0?H:!0,strictTypes:(V=(q=$.strictTypes)!==null&&q!==void 0?q:F6)!==null&&V!==void 0?V:"log",strictTuples:(z=(B=$.strictTuples)!==null&&B!==void 0?B:F6)!==null&&z!==void 0?z:"log",strictRequired:(w=(N=$.strictRequired)!==null&&N!==void 0?N:F6)!==null&&w!==void 0?w:!1,code:$.code?{...$.code,optimize:i0,regExp:S4}:{optimize:i0,regExp:S4},loopRequired:(O=$.loopRequired)!==null&&O!==void 0?O:FI,loopEnum:(D=$.loopEnum)!==null&&D!==void 0?D:FI,meta:(M=$.meta)!==null&&M!==void 0?M:!0,messages:(j=$.messages)!==null&&j!==void 0?j:!0,inlineRefs:(A=$.inlineRefs)!==null&&A!==void 0?A:!0,schemaId:(k=$.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(u=$.addUsedSchema)!==null&&u!==void 0?u:!0,validateSchema:(G$=$.validateSchema)!==null&&G$!==void 0?G$:!0,validateFormats:(u$=$.validateFormats)!==null&&u$!==void 0?u$:!0,unicodeRegExp:(e$=$.unicodeRegExp)!==null&&e$!==void 0?e$:!0,int32range:(m6=$.int32range)!==null&&m6!==void 0?m6:!0,uriResolver:S9}}class CW{constructor($={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...mr($)};let{es5:Q,lines:J}=this.opts.code;this.scope=new xr.ValueScope({scope:{},prefixes:gr,es5:Q,lines:J}),this.logger=nr($.logger);let Y=$.validateFormats;if($.validateFormats=!1,this.RULES=(0,Tr.getRules)(),ZI.call(this,hr,$,"NOT SUPPORTED"),ZI.call(this,ur,$,"DEPRECATED","warn"),this._metaOpts=dr.call(this),$.formats)cr.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords)pr.call(this,$.keywords);if(typeof $.meta=="object")this.addMetaSchema($.meta);lr.call(this),$.validateFormats=Y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:$,meta:Q,schemaId:J}=this.opts,Y=DI;if(J==="id")Y={...DI},Y.id=Y.$id,delete Y.$id;if(Q&&$)this.addMetaSchema(Y,Y[J],!1)}defaultMeta(){let{meta:$,schemaId:Q}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[Q]||$:void 0}validate($,Q){let J;if(typeof $=="string"){if(J=this.getSchema($),!J)throw Error(`no schema with key or ref "${$}"`)}else J=this.compile($);let Y=J(Q);if(!("$async"in J))this.errors=J.errors;return Y}compile($,Q){let J=this._addSchema($,Q);return J.validate||this._compileSchemaEnv(J)}compileAsync($,Q){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:J}=this.opts;return Y.call(this,$,Q);async function Y(q,V){await X.call(this,q.$schema);let B=this._addSchema(q,V);return B.validate||W.call(this,B)}async function X(q){if(q&&!this.getSchema(q))await Y.call(this,{$ref:q},!0)}async function W(q){try{return this._compileSchemaEnv(q)}catch(V){if(!(V instanceof LI.default))throw V;return G.call(this,V),await U.call(this,V.missingSchema),W.call(this,q)}}function G({missingSchema:q,missingRef:V}){if(this.refs[q])throw Error(`AnySchema ${q} is loaded but ${V} cannot be resolved`)}async function U(q){let V=await H.call(this,q);if(!this.refs[q])await X.call(this,V.$schema);if(!this.refs[q])this.addSchema(V,q,Q)}async function H(q){let V=this._loading[q];if(V)return V;try{return await(this._loading[q]=J(q))}finally{delete this._loading[q]}}}addSchema($,Q,J,Y=this.opts.validateSchema){if(Array.isArray($)){for(let W of $)this.addSchema(W,void 0,J,Y);return this}let X;if(typeof $==="object"){let{schemaId:W}=this.opts;if(X=$[W],X!==void 0&&typeof X!="string")throw Error(`schema ${W} must be string`)}return Q=(0,xJ.normalizeId)(Q||X),this._checkUnique(Q),this.schemas[Q]=this._addSchema($,J,Q,Y,!0),this}addMetaSchema($,Q,J=this.opts.validateSchema){return this.addSchema($,Q,!0,J),this}validateSchema($,Q){if(typeof $=="boolean")return!0;let J;if(J=$.$schema,J!==void 0&&typeof J!="string")throw Error("$schema must be a string");if(J=J||this.opts.defaultMeta||this.defaultMeta(),!J)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let Y=this.validate(J,$);if(!Y&&Q){let X="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(X);else throw Error(X)}return Y}getSchema($){let Q;while(typeof(Q=MI.call(this,$))=="string")$=Q;if(Q===void 0){let{schemaId:J}=this.opts,Y=new TJ.SchemaEnv({schema:{},schemaId:J});if(Q=TJ.resolveSchema.call(this,Y,$),!Q)return;this.refs[$]=Q}return Q.validate||this._compileSchemaEnv(Q)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let Q=MI.call(this,$);if(typeof Q=="object")this._cache.delete(Q.schema);return delete this.schemas[$],delete this.refs[$],this}case"object":{let Q=$;this._cache.delete(Q);let J=$[this.opts.schemaId];if(J)J=(0,xJ.normalizeId)(J),delete this.schemas[J],delete this.refs[J];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(let Q of $)this.addKeyword(Q);return this}addKeyword($,Q){let J;if(typeof $=="string"){if(J=$,typeof Q=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Q.keyword=J}else if(typeof $=="object"&&Q===void 0){if(Q=$,J=Q.keyword,Array.isArray(J)&&!J.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(or.call(this,J,Q),!Q)return(0,mB.eachItem)(J,(X)=>uB.call(this,X)),this;ar.call(this,Q);let Y={...Q,type:(0,vW.getJSONTypes)(Q.type),schemaType:(0,vW.getJSONTypes)(Q.schemaType)};return(0,mB.eachItem)(J,Y.type.length===0?(X)=>uB.call(this,X,Y):(X)=>Y.type.forEach((W)=>uB.call(this,X,Y,W))),this}getKeyword($){let Q=this.RULES.all[$];return typeof Q=="object"?Q.definition:!!Q}removeKeyword($){let{RULES:Q}=this;delete Q.keywords[$],delete Q.all[$];for(let J of Q.rules){let Y=J.rules.findIndex((X)=>X.keyword===$);if(Y>=0)J.rules.splice(Y,1)}return this}addFormat($,Q){if(typeof Q=="string")Q=new RegExp(Q);return this.formats[$]=Q,this}errorsText($=this.errors,{separator:Q=", ",dataVar:J="data"}={}){if(!$||$.length===0)return"No errors";return $.map((Y)=>`${J}${Y.instancePath} ${Y.message}`).reduce((Y,X)=>Y+Q+X)}$dataMetaSchema($,Q){let J=this.RULES.all;$=JSON.parse(JSON.stringify($));for(let Y of Q){let X=Y.split("/").slice(1),W=$;for(let G of X)W=W[G];for(let G in J){let U=J[G];if(typeof U!="object")continue;let{$data:H}=U.definition,q=W[G];if(H&&q)W[G]=AI(q)}}return $}_removeAllSchemas($,Q){for(let J in $){let Y=$[J];if(!Q||Q.test(J)){if(typeof Y=="string")delete $[J];else if(Y&&!Y.meta)this._cache.delete(Y.schema),delete $[J]}}}_addSchema($,Q,J,Y=this.opts.validateSchema,X=this.opts.addUsedSchema){let W,{schemaId:G}=this.opts;if(typeof $=="object")W=$[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof $!="boolean")throw Error("schema must be object or boolean");let U=this._cache.get($);if(U!==void 0)return U;J=(0,xJ.normalizeId)(W||J);let H=xJ.getSchemaRefs.call(this,$,J);if(U=new TJ.SchemaEnv({schema:$,schemaId:G,meta:Q,baseId:J,localRefs:H}),this._cache.set(U.schema,U),X&&!J.startsWith("#")){if(J)this._checkUnique(J);this.refs[J]=U}if(Y)this.validateSchema($,!0);return U}_checkUnique($){if(this.schemas[$]||this.refs[$])throw Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta)this._compileMetaSchema($);else TJ.compileSchema.call(this,$);if(!$.validate)throw Error("ajv implementation error");return $.validate}_compileMetaSchema($){let Q=this.opts;this.opts=this._metaOpts;try{TJ.compileSchema.call(this,$)}finally{this.opts=Q}}}CW.ValidationError=Cr.default;CW.MissingRefError=LI.default;J1.default=CW;function ZI($,Q,J,Y="error"){for(let X in $){let W=X;if(W in Q)this.logger[Y](`${J}: option ${X}. ${$[W]}`)}}function MI($){return $=(0,xJ.normalizeId)($),this.schemas[$]||this.refs[$]}function lr(){let $=this.opts.schemas;if(!$)return;if(Array.isArray($))this.addSchema($);else for(let Q in $)this.addSchema($[Q],Q)}function cr(){for(let $ in this.opts.formats){let Q=this.opts.formats[$];if(Q)this.addFormat($,Q)}}function pr($){if(Array.isArray($)){this.addVocabulary($);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Q in $){let J=$[Q];if(!J.keyword)J.keyword=Q;this.addKeyword(J)}}function dr(){let $={...this.opts};for(let Q of fr)delete $[Q];return $}var ir={log(){},warn(){},error(){}};function nr($){if($===!1)return ir;if($===void 0)return console;if($.log&&$.warn&&$.error)return $;throw Error("logger must implement log, warn and error methods")}var rr=/^[a-z_$][a-z0-9_$:-]*$/i;function or($,Q){let{RULES:J}=this;if((0,mB.eachItem)($,(Y)=>{if(J.keywords[Y])throw Error(`Keyword ${Y} is already defined`);if(!rr.test(Y))throw Error(`Keyword ${Y} has invalid name`)}),!Q)return;if(Q.$data&&!(("code"in Q)||("validate"in Q)))throw Error('$data keyword must have "code" or "validate" function')}function uB($,Q,J){var Y;let X=Q===null||Q===void 0?void 0:Q.post;if(J&&X)throw Error('keyword with "post" flag cannot have "type"');let{RULES:W}=this,G=X?W.post:W.rules.find(({type:H})=>H===J);if(!G)G={type:J,rules:[]},W.rules.push(G);if(W.keywords[$]=!0,!Q)return;let U={keyword:$,definition:{...Q,type:(0,vW.getJSONTypes)(Q.type),schemaType:(0,vW.getJSONTypes)(Q.schemaType)}};if(Q.before)tr.call(this,G,U,Q.before);else G.rules.push(U);W.all[$]=U,(Y=Q.implements)===null||Y===void 0||Y.forEach((H)=>this.addKeyword(H))}function tr($,Q,J){let Y=$.rules.findIndex((X)=>X.keyword===J);if(Y>=0)$.rules.splice(Y,0,Q);else $.rules.push(Q),this.logger.warn(`rule ${J} is not defined`)}function ar($){let{metaSchema:Q}=$;if(Q===void 0)return;if($.$data&&this.opts.$data)Q=AI(Q);$.validateSchema=this.compile(Q,!0)}var sr={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function AI($){return{anyOf:[$,sr]}}});var PI=I((RI)=>{Object.defineProperty(RI,"__esModule",{value:!0});var Qo={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};RI.default=Qo});var vI=I((SI)=>{Object.defineProperty(SI,"__esModule",{value:!0});SI.callRef=SI.getValidate=void 0;var Xo=kJ(),EI=$4(),_6=Q$(),D9=$1(),bI=bW(),TW=q$(),Yo={keyword:"$ref",schemaType:"string",code($){let{gen:Q,schema:J,it:Y}=$,{baseId:X,schemaEnv:W,validateName:G,opts:U,self:H}=Y,{root:q}=W;if((J==="#"||J==="#/")&&X===q.baseId)return B();let V=bI.resolveRef.call(H,q,X,J);if(V===void 0)throw new Xo.default(Y.opts.uriResolver,X,J);if(V instanceof bI.SchemaEnv)return z(V);return N(V);function B(){if(W===q)return xW($,G,W,W.$async);let w=Q.scopeValue("root",{ref:q});return xW($,_6._`${w}.validate`,q,q.$async)}function z(w){let O=_I($,w);xW($,O,w,w.$async)}function N(w){let O=Q.scopeValue("schema",U.code.source===!0?{ref:w,code:(0,_6.stringify)(w)}:{ref:w}),D=Q.name("valid"),M=$.subschema({schema:w,dataTypes:[],schemaPath:_6.nil,topSchemaRef:O,errSchemaPath:J},D);$.mergeEvaluated(M),$.ok(D)}}};function _I($,Q){let{gen:J}=$;return Q.validate?J.scopeValue("validate",{ref:Q.validate}):_6._`${J.scopeValue("wrapper",{ref:Q})}.validate`}SI.getValidate=_I;function xW($,Q,J,Y){let{gen:X,it:W}=$,{allErrors:G,schemaEnv:U,opts:H}=W,q=H.passContext?D9.default.this:_6.nil;if(Y)V();else B();function V(){if(!U.$async)throw Error("async schema referenced by sync schema");let w=X.let("valid");X.try(()=>{if(X.code(_6._`await ${(0,EI.callValidateCode)($,Q,q)}`),N(Q),!G)X.assign(w,!0)},(O)=>{if(X.if(_6._`!(${O} instanceof ${W.ValidationError})`,()=>X.throw(O)),z(O),!G)X.assign(w,!1)}),$.ok(w)}function B(){$.result((0,EI.callValidateCode)($,Q,q),()=>N(Q),()=>z(Q))}function z(w){let O=_6._`${w}.errors`;X.assign(D9.default.vErrors,_6._`${D9.default.vErrors} === null ? ${O} : ${D9.default.vErrors}.concat(${O})`),X.assign(D9.default.errors,_6._`${D9.default.vErrors}.length`)}function N(w){var O;if(!W.opts.unevaluated)return;let D=(O=J===null||J===void 0?void 0:J.validate)===null||O===void 0?void 0:O.evaluated;if(W.props!==!0)if(D&&!D.dynamicProps){if(D.props!==void 0)W.props=TW.mergeEvaluated.props(X,D.props,W.props)}else{let M=X.var("props",_6._`${w}.evaluated.props`);W.props=TW.mergeEvaluated.props(X,M,W.props,_6.Name)}if(W.items!==!0)if(D&&!D.dynamicItems){if(D.items!==void 0)W.items=TW.mergeEvaluated.items(X,D.items,W.items)}else{let M=X.var("items",_6._`${w}.evaluated.items`);W.items=TW.mergeEvaluated.items(X,M,W.items,_6.Name)}}}SI.callRef=xW;SI.default=Yo});var TI=I((CI)=>{Object.defineProperty(CI,"__esModule",{value:!0});var Uo=PI(),Ho=vI(),Ko=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Uo.default,Ho.default];CI.default=Ko});var yI=I((xI)=>{Object.defineProperty(xI,"__esModule",{value:!0});var yW=Q$(),u1=yW.operators,fW={maximum:{okStr:"<=",ok:u1.LTE,fail:u1.GT},minimum:{okStr:">=",ok:u1.GTE,fail:u1.LT},exclusiveMaximum:{okStr:"<",ok:u1.LT,fail:u1.GTE},exclusiveMinimum:{okStr:">",ok:u1.GT,fail:u1.LTE}},Vo={message:({keyword:$,schemaCode:Q})=>yW.str`must be ${fW[$].okStr} ${Q}`,params:({keyword:$,schemaCode:Q})=>yW._`{comparison: ${fW[$].okStr}, limit: ${Q}}`},Bo={keyword:Object.keys(fW),type:"number",schemaType:"number",$data:!0,error:Vo,code($){let{keyword:Q,data:J,schemaCode:Y}=$;$.fail$data(yW._`${J} ${fW[Q].fail} ${Y} || isNaN(${J})`)}};xI.default=Bo});var gI=I((fI)=>{Object.defineProperty(fI,"__esModule",{value:!0});var yJ=Q$(),No={message:({schemaCode:$})=>yJ.str`must be multiple of ${$}`,params:({schemaCode:$})=>yJ._`{multipleOf: ${$}}`},wo={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:No,code($){let{gen:Q,data:J,schemaCode:Y,it:X}=$,W=X.opts.multipleOfPrecision,G=Q.let("res"),U=W?yJ._`Math.abs(Math.round(${G}) - ${G}) > 1e-${W}`:yJ._`${G} !== parseInt(${G})`;$.fail$data(yJ._`(${Y} === 0 || (${G} = ${J}/${Y}, ${U}))`)}};fI.default=wo});var mI=I((uI)=>{Object.defineProperty(uI,"__esModule",{value:!0});function hI($){let Q=$.length,J=0,Y=0,X;while(Y<Q)if(J++,X=$.charCodeAt(Y++),X>=55296&&X<=56319&&Y<Q){if(X=$.charCodeAt(Y),(X&64512)===56320)Y++}return J}uI.default=hI;hI.code='require("ajv/dist/runtime/ucs2length").default'});var cI=I((lI)=>{Object.defineProperty(lI,"__esModule",{value:!0});var f0=Q$(),Fo=q$(),Zo=mI(),Mo={message({keyword:$,schemaCode:Q}){let J=$==="maxLength"?"more":"fewer";return f0.str`must NOT have ${J} than ${Q} characters`},params:({schemaCode:$})=>f0._`{limit: ${$}}`},Lo={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Mo,code($){let{keyword:Q,data:J,schemaCode:Y,it:X}=$,W=Q==="maxLength"?f0.operators.GT:f0.operators.LT,G=X.opts.unicode===!1?f0._`${J}.length`:f0._`${(0,Fo.useFunc)($.gen,Zo.default)}(${J})`;$.fail$data(f0._`${G} ${W} ${Y}`)}};lI.default=Lo});var dI=I((pI)=>{Object.defineProperty(pI,"__esModule",{value:!0});var Ao=$4(),Io=q$(),F9=Q$(),Ro={message:({schemaCode:$})=>F9.str`must match pattern "${$}"`,params:({schemaCode:$})=>F9._`{pattern: ${$}}`},Po={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Ro,code($){let{gen:Q,data:J,$data:Y,schema:X,schemaCode:W,it:G}=$,U=G.opts.unicodeRegExp?"u":"";if(Y){let{regExp:H}=G.opts.code,q=H.code==="new RegExp"?F9._`new RegExp`:(0,Io.useFunc)(Q,H),V=Q.let("valid");Q.try(()=>Q.assign(V,F9._`${q}(${W}, ${U}).test(${J})`),()=>Q.assign(V,!1)),$.fail$data(F9._`!${V}`)}else{let H=(0,Ao.usePattern)($,X);$.fail$data(F9._`!${H}.test(${J})`)}}};pI.default=Po});var nI=I((iI)=>{Object.defineProperty(iI,"__esModule",{value:!0});var fJ=Q$(),bo={message({keyword:$,schemaCode:Q}){let J=$==="maxProperties"?"more":"fewer";return fJ.str`must NOT have ${J} than ${Q} properties`},params:({schemaCode:$})=>fJ._`{limit: ${$}}`},_o={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:bo,code($){let{keyword:Q,data:J,schemaCode:Y}=$,X=Q==="maxProperties"?fJ.operators.GT:fJ.operators.LT;$.fail$data(fJ._`Object.keys(${J}).length ${X} ${Y}`)}};iI.default=_o});var oI=I((rI)=>{Object.defineProperty(rI,"__esModule",{value:!0});var gJ=$4(),hJ=Q$(),ko=q$(),vo={message:({params:{missingProperty:$}})=>hJ.str`must have required property '${$}'`,params:({params:{missingProperty:$}})=>hJ._`{missingProperty: ${$}}`},Co={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vo,code($){let{gen:Q,schema:J,schemaCode:Y,data:X,$data:W,it:G}=$,{opts:U}=G;if(!W&&J.length===0)return;let H=J.length>=U.loopRequired;if(G.allErrors)q();else V();if(U.strictRequired){let N=$.parentSchema.properties,{definedProperties:w}=$.it;for(let O of J)if((N===null||N===void 0?void 0:N[O])===void 0&&!w.has(O)){let D=G.schemaEnv.baseId+G.errSchemaPath,M=`required property "${O}" is not defined at "${D}" (strictRequired)`;(0,ko.checkStrictMode)(G,M,G.opts.strictRequired)}}function q(){if(H||W)$.block$data(hJ.nil,B);else for(let N of J)(0,gJ.checkReportMissingProp)($,N)}function V(){let N=Q.let("missing");if(H||W){let w=Q.let("valid",!0);$.block$data(w,()=>z(N,w)),$.ok(w)}else Q.if((0,gJ.checkMissingProp)($,J,N)),(0,gJ.reportMissingProp)($,N),Q.else()}function B(){Q.forOf("prop",Y,(N)=>{$.setParams({missingProperty:N}),Q.if((0,gJ.noPropertyInData)(Q,X,N,U.ownProperties),()=>$.error())})}function z(N,w){$.setParams({missingProperty:N}),Q.forOf(N,Y,()=>{Q.assign(w,(0,gJ.propertyInData)(Q,X,N,U.ownProperties)),Q.if((0,hJ.not)(w),()=>{$.error(),Q.break()})},hJ.nil)}}};rI.default=Co});var aI=I((tI)=>{Object.defineProperty(tI,"__esModule",{value:!0});var uJ=Q$(),xo={message({keyword:$,schemaCode:Q}){let J=$==="maxItems"?"more":"fewer";return uJ.str`must NOT have ${J} than ${Q} items`},params:({schemaCode:$})=>uJ._`{limit: ${$}}`},yo={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:xo,code($){let{keyword:Q,data:J,schemaCode:Y}=$,X=Q==="maxItems"?uJ.operators.GT:uJ.operators.LT;$.fail$data(uJ._`${J}.length ${X} ${Y}`)}};tI.default=yo});var gW=I((eI)=>{Object.defineProperty(eI,"__esModule",{value:!0});var sI=RB();sI.code='require("ajv/dist/runtime/equal").default';eI.default=sI});var QR=I(($R)=>{Object.defineProperty($R,"__esModule",{value:!0});var lB=PJ(),Y6=Q$(),ho=q$(),uo=gW(),mo={message:({params:{i:$,j:Q}})=>Y6.str`must NOT have duplicate items (items ## ${Q} and ${$} are identical)`,params:({params:{i:$,j:Q}})=>Y6._`{i: ${$}, j: ${Q}}`},lo={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mo,code($){let{gen:Q,data:J,$data:Y,schema:X,parentSchema:W,schemaCode:G,it:U}=$;if(!Y&&!X)return;let H=Q.let("valid"),q=W.items?(0,lB.getSchemaTypes)(W.items):[];$.block$data(H,V,Y6._`${G} === false`),$.ok(H);function V(){let w=Q.let("i",Y6._`${J}.length`),O=Q.let("j");$.setParams({i:w,j:O}),Q.assign(H,!0),Q.if(Y6._`${w} > 1`,()=>(B()?z:N)(w,O))}function B(){return q.length>0&&!q.some((w)=>w==="object"||w==="array")}function z(w,O){let D=Q.name("item"),M=(0,lB.checkDataTypes)(q,D,U.opts.strictNumbers,lB.DataType.Wrong),j=Q.const("indices",Y6._`{}`);Q.for(Y6._`;${w}--;`,()=>{if(Q.let(D,Y6._`${J}[${w}]`),Q.if(M,Y6._`continue`),q.length>1)Q.if(Y6._`typeof ${D} == "string"`,Y6._`${D} += "_"`);Q.if(Y6._`typeof ${j}[${D}] == "number"`,()=>{Q.assign(O,Y6._`${j}[${D}]`),$.error(),Q.assign(H,!1).break()}).code(Y6._`${j}[${D}] = ${w}`)})}function N(w,O){let D=(0,ho.useFunc)(Q,uo.default),M=Q.name("outer");Q.label(M).for(Y6._`;${w}--;`,()=>Q.for(Y6._`${O} = ${w}; ${O}--;`,()=>Q.if(Y6._`${D}(${J}[${w}], ${J}[${O}])`,()=>{$.error(),Q.assign(H,!1).break(M)})))}}};$R.default=lo});var XR=I((JR)=>{Object.defineProperty(JR,"__esModule",{value:!0});var cB=Q$(),po=q$(),io=gW(),no={message:"must be equal to constant",params:({schemaCode:$})=>cB._`{allowedValue: ${$}}`},ro={keyword:"const",$data:!0,error:no,code($){let{gen:Q,data:J,$data:Y,schemaCode:X,schema:W}=$;if(Y||W&&typeof W=="object")$.fail$data(cB._`!${(0,po.useFunc)(Q,io.default)}(${J}, ${X})`);else $.fail(cB._`${W} !== ${J}`)}};JR.default=ro});var WR=I((YR)=>{Object.defineProperty(YR,"__esModule",{value:!0});var mJ=Q$(),to=q$(),ao=gW(),so={message:"must be equal to one of the allowed values",params:({schemaCode:$})=>mJ._`{allowedValues: ${$}}`},eo={keyword:"enum",schemaType:"array",$data:!0,error:so,code($){let{gen:Q,data:J,$data:Y,schema:X,schemaCode:W,it:G}=$;if(!Y&&X.length===0)throw Error("enum must have non-empty array");let U=X.length>=G.opts.loopEnum,H,q=()=>H!==null&&H!==void 0?H:H=(0,to.useFunc)(Q,ao.default),V;if(U||Y)V=Q.let("valid"),$.block$data(V,B);else{if(!Array.isArray(X))throw Error("ajv implementation error");let N=Q.const("vSchema",W);V=(0,mJ.or)(...X.map((w,O)=>z(N,O)))}$.pass(V);function B(){Q.assign(V,!1),Q.forOf("v",W,(N)=>Q.if(mJ._`${q()}(${J}, ${N})`,()=>Q.assign(V,!0).break()))}function z(N,w){let O=X[w];return typeof O==="object"&&O!==null?mJ._`${q()}(${J}, ${N}[${w}])`:mJ._`${J} === ${O}`}}};YR.default=eo});var UR=I((GR)=>{Object.defineProperty(GR,"__esModule",{value:!0});var Qt=yI(),Jt=gI(),Xt=cI(),Yt=dI(),Wt=nI(),Gt=oI(),Ut=aI(),Ht=QR(),Kt=XR(),qt=WR(),Vt=[Qt.default,Jt.default,Xt.default,Yt.default,Wt.default,Gt.default,Ut.default,Ht.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Kt.default,qt.default];GR.default=Vt});var dB=I((KR)=>{Object.defineProperty(KR,"__esModule",{value:!0});KR.validateAdditionalItems=void 0;var g0=Q$(),pB=q$(),zt={message:({params:{len:$}})=>g0.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>g0._`{limit: ${$}}`},Nt={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:zt,code($){let{parentSchema:Q,it:J}=$,{items:Y}=Q;if(!Array.isArray(Y)){(0,pB.checkStrictMode)(J,'"additionalItems" is ignored when "items" is not an array of schemas');return}HR($,Y)}};function HR($,Q){let{gen:J,schema:Y,data:X,keyword:W,it:G}=$;G.items=!0;let U=J.const("len",g0._`${X}.length`);if(Y===!1)$.setParams({len:Q.length}),$.pass(g0._`${U} <= ${Q.length}`);else if(typeof Y=="object"&&!(0,pB.alwaysValidSchema)(G,Y)){let q=J.var("valid",g0._`${U} <= ${Q.length}`);J.if((0,g0.not)(q),()=>H(q)),$.ok(q)}function H(q){J.forRange("i",Q.length,U,(V)=>{if($.subschema({keyword:W,dataProp:V,dataPropType:pB.Type.Num},q),!G.allErrors)J.if((0,g0.not)(q),()=>J.break())})}}KR.validateAdditionalItems=HR;KR.default=Nt});var iB=I((zR)=>{Object.defineProperty(zR,"__esModule",{value:!0});zR.validateTuple=void 0;var VR=Q$(),hW=q$(),Ot=$4(),Dt={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code($){let{schema:Q,it:J}=$;if(Array.isArray(Q))return BR($,"additionalItems",Q);if(J.items=!0,(0,hW.alwaysValidSchema)(J,Q))return;$.ok((0,Ot.validateArray)($))}};function BR($,Q,J=$.schema){let{gen:Y,parentSchema:X,data:W,keyword:G,it:U}=$;if(V(X),U.opts.unevaluated&&J.length&&U.items!==!0)U.items=hW.mergeEvaluated.items(Y,J.length,U.items);let H=Y.name("valid"),q=Y.const("len",VR._`${W}.length`);J.forEach((B,z)=>{if((0,hW.alwaysValidSchema)(U,B))return;Y.if(VR._`${q} > ${z}`,()=>$.subschema({keyword:G,schemaProp:z,dataProp:z},H)),$.ok(H)});function V(B){let{opts:z,errSchemaPath:N}=U,w=J.length,O=w===B.minItems&&(w===B.maxItems||B[Q]===!1);if(z.strictTuples&&!O){let D=`"${G}" is ${w}-tuple, but minItems or maxItems/${Q} are not specified or different at path "${N}"`;(0,hW.checkStrictMode)(U,D,z.strictTuples)}}}zR.validateTuple=BR;zR.default=Dt});var OR=I((wR)=>{Object.defineProperty(wR,"__esModule",{value:!0});var Zt=iB(),Mt={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:($)=>(0,Zt.validateTuple)($,"items")};wR.default=Mt});var ZR=I((FR)=>{Object.defineProperty(FR,"__esModule",{value:!0});var DR=Q$(),jt=q$(),At=$4(),It=dB(),Rt={message:({params:{len:$}})=>DR.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>DR._`{limit: ${$}}`},Pt={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Rt,code($){let{schema:Q,parentSchema:J,it:Y}=$,{prefixItems:X}=J;if(Y.items=!0,(0,jt.alwaysValidSchema)(Y,Q))return;if(X)(0,It.validateAdditionalItems)($,X);else $.ok((0,At.validateArray)($))}};FR.default=Pt});var LR=I((MR)=>{Object.defineProperty(MR,"__esModule",{value:!0});var Q4=Q$(),uW=q$(),bt={message:({params:{min:$,max:Q}})=>Q===void 0?Q4.str`must contain at least ${$} valid item(s)`:Q4.str`must contain at least ${$} and no more than ${Q} valid item(s)`,params:({params:{min:$,max:Q}})=>Q===void 0?Q4._`{minContains: ${$}}`:Q4._`{minContains: ${$}, maxContains: ${Q}}`},_t={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:bt,code($){let{gen:Q,schema:J,parentSchema:Y,data:X,it:W}=$,G,U,{minContains:H,maxContains:q}=Y;if(W.opts.next)G=H===void 0?1:H,U=q;else G=1;let V=Q.const("len",Q4._`${X}.length`);if($.setParams({min:G,max:U}),U===void 0&&G===0){(0,uW.checkStrictMode)(W,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(U!==void 0&&G>U){(0,uW.checkStrictMode)(W,'"minContains" > "maxContains" is always invalid'),$.fail();return}if((0,uW.alwaysValidSchema)(W,J)){let O=Q4._`${V} >= ${G}`;if(U!==void 0)O=Q4._`${O} && ${V} <= ${U}`;$.pass(O);return}W.items=!0;let B=Q.name("valid");if(U===void 0&&G===1)N(B,()=>Q.if(B,()=>Q.break()));else if(G===0){if(Q.let(B,!0),U!==void 0)Q.if(Q4._`${X}.length > 0`,z)}else Q.let(B,!1),z();$.result(B,()=>$.reset());function z(){let O=Q.name("_valid"),D=Q.let("count",0);N(O,()=>Q.if(O,()=>w(D)))}function N(O,D){Q.forRange("i",0,V,(M)=>{$.subschema({keyword:"contains",dataProp:M,dataPropType:uW.Type.Num,compositeRule:!0},O),D()})}function w(O){if(Q.code(Q4._`${O}++`),U===void 0)Q.if(Q4._`${O} >= ${G}`,()=>Q.assign(B,!0).break());else if(Q.if(Q4._`${O} > ${U}`,()=>Q.assign(B,!1).break()),G===1)Q.assign(B,!0);else Q.if(Q4._`${O} >= ${G}`,()=>Q.assign(B,!0))}}};MR.default=_t});var ER=I((IR)=>{Object.defineProperty(IR,"__esModule",{value:!0});IR.validateSchemaDeps=IR.validatePropertyDeps=IR.error=void 0;var nB=Q$(),kt=q$(),lJ=$4();IR.error={message:({params:{property:$,depsCount:Q,deps:J}})=>{let Y=Q===1?"property":"properties";return nB.str`must have ${Y} ${J} when property ${$} is present`},params:({params:{property:$,depsCount:Q,deps:J,missingProperty:Y}})=>nB._`{property: ${$},
13
13
  missingProperty: ${Y},
14
14
  depsCount: ${Q},
15
- deps: ${J}}`};var vt={keyword:"dependencies",type:"object",schemaType:"object",error:IR.error,code($){let[Q,J]=Ct($);jR($,Q),AR($,J)}};function Ct({schema:$}){let Q={},J={};for(let Y in $){if(Y==="__proto__")continue;let X=Array.isArray($[Y])?Q:J;X[Y]=$[Y]}return[Q,J]}function jR($,Q=$.schema){let{gen:J,data:Y,it:X}=$;if(Object.keys(Q).length===0)return;let W=J.let("missing");for(let G in Q){let U=Q[G];if(U.length===0)continue;let H=(0,lJ.propertyInData)(J,Y,G,X.opts.ownProperties);if($.setParams({property:G,depsCount:U.length,deps:U.join(", ")}),X.allErrors)J.if(H,()=>{for(let q of U)(0,lJ.checkReportMissingProp)($,q)});else J.if(nB._`${H} && (${(0,lJ.checkMissingProp)($,U,W)})`),(0,lJ.reportMissingProp)($,W),J.else()}}IR.validatePropertyDeps=jR;function AR($,Q=$.schema){let{gen:J,data:Y,keyword:X,it:W}=$,G=J.name("valid");for(let U in Q){if((0,kt.alwaysValidSchema)(W,Q[U]))continue;J.if((0,lJ.propertyInData)(J,Y,U,W.opts.ownProperties),()=>{let H=$.subschema({keyword:X,schemaProp:U},G);$.mergeValidEvaluated(H,G)},()=>J.var(G,!0)),$.ok(G)}}IR.validateSchemaDeps=AR;IR.default=vt});var SR=I((_R)=>{Object.defineProperty(_R,"__esModule",{value:!0});var bR=Q$(),yt=q$(),ft={message:"property name must be valid",params:({params:$})=>bR._`{propertyName: ${$.propertyName}}`},gt={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ft,code($){let{gen:Q,schema:J,data:Y,it:X}=$;if((0,yt.alwaysValidSchema)(X,J))return;let W=Q.name("valid");Q.forIn("key",Y,(G)=>{$.setParams({propertyName:G}),$.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},W),Q.if((0,bR.not)(W),()=>{if($.error(!0),!X.allErrors)Q.break()})}),$.ok(W)}};_R.default=gt});var rB=I((kR)=>{Object.defineProperty(kR,"__esModule",{value:!0});var mW=$4(),O4=Q$(),ut=$1(),lW=q$(),mt={message:"must NOT have additional properties",params:({params:$})=>O4._`{additionalProperty: ${$.additionalProperty}}`},lt={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mt,code($){let{gen:Q,schema:J,parentSchema:Y,data:X,errsCount:W,it:G}=$;if(!W)throw Error("ajv implementation error");let{allErrors:U,opts:H}=G;if(G.props=!0,H.removeAdditional!=="all"&&(0,lW.alwaysValidSchema)(G,J))return;let q=(0,mW.allSchemaProperties)(Y.properties),V=(0,mW.allSchemaProperties)(Y.patternProperties);B(),$.ok(O4._`${W} === ${ut.default.errors}`);function B(){Q.forIn("key",X,(D)=>{if(!q.length&&!V.length)w(D);else Q.if(z(D),()=>w(D))})}function z(D){let M;if(q.length>8){let j=(0,lW.schemaRefOrVal)(G,Y.properties,"properties");M=(0,mW.isOwnProperty)(Q,j,D)}else if(q.length)M=(0,O4.or)(...q.map((j)=>O4._`${D} === ${j}`));else M=O4.nil;if(V.length)M=(0,O4.or)(M,...V.map((j)=>O4._`${(0,mW.usePattern)($,j)}.test(${D})`));return(0,O4.not)(M)}function N(D){Q.code(O4._`delete ${X}[${D}]`)}function w(D){if(H.removeAdditional==="all"||H.removeAdditional&&J===!1){N(D);return}if(J===!1){if($.setParams({additionalProperty:D}),$.error(),!U)Q.break();return}if(typeof J=="object"&&!(0,lW.alwaysValidSchema)(G,J)){let M=Q.name("valid");if(H.removeAdditional==="failing")O(D,M,!1),Q.if((0,O4.not)(M),()=>{$.reset(),N(D)});else if(O(D,M),!U)Q.if((0,O4.not)(M),()=>Q.break())}}function O(D,M,j){let A={keyword:"additionalProperties",dataProp:D,dataPropType:lW.Type.Str};if(j===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(A,M)}}};kR.default=lt});var xR=I((TR)=>{Object.defineProperty(TR,"__esModule",{value:!0});var pt=SJ(),vR=$4(),oB=q$(),CR=rB(),dt={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:Q,schema:J,parentSchema:Y,data:X,it:W}=$;if(W.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)CR.default.code(new pt.KeywordCxt(W,CR.default,"additionalProperties"));let G=(0,vR.allSchemaProperties)(J);for(let B of G)W.definedProperties.add(B);if(W.opts.unevaluated&&G.length&&W.props!==!0)W.props=oB.mergeEvaluated.props(Q,(0,oB.toHash)(G),W.props);let U=G.filter((B)=>!(0,oB.alwaysValidSchema)(W,J[B]));if(U.length===0)return;let H=Q.name("valid");for(let B of U){if(q(B))V(B);else{if(Q.if((0,vR.propertyInData)(Q,X,B,W.opts.ownProperties)),V(B),!W.allErrors)Q.else().var(H,!0);Q.endIf()}$.it.definedProperties.add(B),$.ok(H)}function q(B){return W.opts.useDefaults&&!W.compositeRule&&J[B].default!==void 0}function V(B){$.subschema({keyword:"properties",schemaProp:B,dataProp:B},H)}}};TR.default=dt});var uR=I((hR)=>{Object.defineProperty(hR,"__esModule",{value:!0});var yR=$4(),cW=Q$(),fR=q$(),gR=q$(),nt={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:Q,schema:J,data:Y,parentSchema:X,it:W}=$,{opts:G}=W,U=(0,yR.allSchemaProperties)(J),H=U.filter((O)=>(0,fR.alwaysValidSchema)(W,J[O]));if(U.length===0||H.length===U.length&&(!W.opts.unevaluated||W.props===!0))return;let q=G.strictSchema&&!G.allowMatchingProperties&&X.properties,V=Q.name("valid");if(W.props!==!0&&!(W.props instanceof cW.Name))W.props=(0,gR.evaluatedPropsToName)(Q,W.props);let{props:B}=W;z();function z(){for(let O of U){if(q)N(O);if(W.allErrors)w(O);else Q.var(V,!0),w(O),Q.if(V)}}function N(O){for(let D in q)if(new RegExp(O).test(D))(0,fR.checkStrictMode)(W,`property ${D} matches pattern ${O} (use allowMatchingProperties)`)}function w(O){Q.forIn("key",Y,(D)=>{Q.if(cW._`${(0,yR.usePattern)($,O)}.test(${D})`,()=>{let M=H.includes(O);if(!M)$.subschema({keyword:"patternProperties",schemaProp:O,dataProp:D,dataPropType:gR.Type.Str},V);if(W.opts.unevaluated&&B!==!0)Q.assign(cW._`${B}[${D}]`,!0);else if(!M&&!W.allErrors)Q.if((0,cW.not)(V),()=>Q.break())})})}}};hR.default=nt});var lR=I((mR)=>{Object.defineProperty(mR,"__esModule",{value:!0});var ot=q$(),tt={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code($){let{gen:Q,schema:J,it:Y}=$;if((0,ot.alwaysValidSchema)(Y,J)){$.fail();return}let X=Q.name("valid");$.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},X),$.failResult(X,()=>$.reset(),()=>$.error())},error:{message:"must NOT be valid"}};mR.default=tt});var pR=I((cR)=>{Object.defineProperty(cR,"__esModule",{value:!0});var st=$4(),et={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:st.validateUnion,error:{message:"must match a schema in anyOf"}};cR.default=et});var iR=I((dR)=>{Object.defineProperty(dR,"__esModule",{value:!0});var pW=Q$(),Qa=q$(),Ja={message:"must match exactly one schema in oneOf",params:({params:$})=>pW._`{passingSchemas: ${$.passing}}`},Xa={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Ja,code($){let{gen:Q,schema:J,parentSchema:Y,it:X}=$;if(!Array.isArray(J))throw Error("ajv implementation error");if(X.opts.discriminator&&Y.discriminator)return;let W=J,G=Q.let("valid",!1),U=Q.let("passing",null),H=Q.name("_valid");$.setParams({passing:U}),Q.block(q),$.result(G,()=>$.reset(),()=>$.error(!0));function q(){W.forEach((V,B)=>{let z;if((0,Qa.alwaysValidSchema)(X,V))Q.var(H,!0);else z=$.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},H);if(B>0)Q.if(pW._`${H} && ${G}`).assign(G,!1).assign(U,pW._`[${U}, ${B}]`).else();Q.if(H,()=>{if(Q.assign(G,!0),Q.assign(U,B),z)$.mergeEvaluated(z,pW.Name)})})}}};dR.default=Xa});var rR=I((nR)=>{Object.defineProperty(nR,"__esModule",{value:!0});var Wa=q$(),Ga={keyword:"allOf",schemaType:"array",code($){let{gen:Q,schema:J,it:Y}=$;if(!Array.isArray(J))throw Error("ajv implementation error");let X=Q.name("valid");J.forEach((W,G)=>{if((0,Wa.alwaysValidSchema)(Y,W))return;let U=$.subschema({keyword:"allOf",schemaProp:G},X);$.ok(X),$.mergeEvaluated(U)})}};nR.default=Ga});var sR=I((aR)=>{Object.defineProperty(aR,"__esModule",{value:!0});var dW=Q$(),tR=q$(),Ha={message:({params:$})=>dW.str`must match "${$.ifClause}" schema`,params:({params:$})=>dW._`{failingKeyword: ${$.ifClause}}`},Ka={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ha,code($){let{gen:Q,parentSchema:J,it:Y}=$;if(J.then===void 0&&J.else===void 0)(0,tR.checkStrictMode)(Y,'"if" without "then" and "else" is ignored');let X=oR(Y,"then"),W=oR(Y,"else");if(!X&&!W)return;let G=Q.let("valid",!0),U=Q.name("_valid");if(H(),$.reset(),X&&W){let V=Q.let("ifClause");$.setParams({ifClause:V}),Q.if(U,q("then",V),q("else",V))}else if(X)Q.if(U,q("then"));else Q.if((0,dW.not)(U),q("else"));$.pass(G,()=>$.error(!0));function H(){let V=$.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},U);$.mergeEvaluated(V)}function q(V,B){return()=>{let z=$.subschema({keyword:V},U);if(Q.assign(G,U),$.mergeValidEvaluated(z,G),B)Q.assign(B,dW._`${V}`);else $.setParams({ifClause:V})}}}};function oR($,Q){let J=$.schema[Q];return J!==void 0&&!(0,tR.alwaysValidSchema)($,J)}aR.default=Ka});var $P=I((eR)=>{Object.defineProperty(eR,"__esModule",{value:!0});var Va=q$(),Ba={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:$,parentSchema:Q,it:J}){if(Q.if===void 0)(0,Va.checkStrictMode)(J,`"${$}" without "if" is ignored`)}};eR.default=Ba});var JP=I((QP)=>{Object.defineProperty(QP,"__esModule",{value:!0});var Na=dB(),wa=OR(),Oa=iB(),Da=ZR(),Fa=LR(),Za=ER(),Ma=SR(),La=rB(),ja=xR(),Aa=uR(),Ia=lR(),Ra=pR(),Pa=iR(),Ea=rR(),ba=sR(),_a=$P();function Sa($=!1){let Q=[Ia.default,Ra.default,Pa.default,Ea.default,ba.default,_a.default,Ma.default,La.default,Za.default,ja.default,Aa.default];if($)Q.push(wa.default,Da.default);else Q.push(Na.default,Oa.default);return Q.push(Fa.default),Q}QP.default=Sa});var YP=I((XP)=>{Object.defineProperty(XP,"__esModule",{value:!0});var d$=Q$(),va={message:({schemaCode:$})=>d$.str`must match format "${$}"`,params:({schemaCode:$})=>d$._`{format: ${$}}`},Ca={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:va,code($,Q){let{gen:J,data:Y,$data:X,schema:W,schemaCode:G,it:U}=$,{opts:H,errSchemaPath:q,schemaEnv:V,self:B}=U;if(!H.validateFormats)return;if(X)z();else N();function z(){let w=J.scopeValue("formats",{ref:B.formats,code:H.code.formats}),O=J.const("fDef",d$._`${w}[${G}]`),D=J.let("fType"),M=J.let("format");J.if(d$._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>J.assign(D,d$._`${O}.type || "string"`).assign(M,d$._`${O}.validate`),()=>J.assign(D,d$._`"string"`).assign(M,O)),$.fail$data((0,d$.or)(j(),A()));function j(){if(H.strictSchema===!1)return d$.nil;return d$._`${G} && !${M}`}function A(){let k=V.$async?d$._`(${O}.async ? await ${M}(${Y}) : ${M}(${Y}))`:d$._`${M}(${Y})`,u=d$._`(typeof ${M} == "function" ? ${k} : ${M}.test(${Y}))`;return d$._`${M} && ${M} !== true && ${D} === ${Q} && !${u}`}}function N(){let w=B.formats[W];if(!w){j();return}if(w===!0)return;let[O,D,M]=A(w);if(O===Q)$.pass(k());function j(){if(H.strictSchema===!1){B.logger.warn(u());return}throw Error(u());function u(){return`unknown format "${W}" ignored in schema at path "${q}"`}}function A(u){let G$=u instanceof RegExp?(0,d$.regexpCode)(u):H.code.formats?d$._`${H.code.formats}${(0,d$.getProperty)(W)}`:void 0,u$=J.scopeValue("formats",{key:W,ref:u,code:G$});if(typeof u=="object"&&!(u instanceof RegExp))return[u.type||"string",u.validate,d$._`${u$}.validate`];return["string",u,u$]}function k(){if(typeof w=="object"&&!(w instanceof RegExp)&&w.async){if(!V.$async)throw Error("async format in sync schema");return d$._`await ${M}(${Y})`}return typeof D=="function"?d$._`${M}(${Y})`:d$._`${M}.test(${Y})`}}}};XP.default=Ca});var GP=I((WP)=>{Object.defineProperty(WP,"__esModule",{value:!0});var xa=YP(),ya=[xa.default];WP.default=ya});var KP=I((UP)=>{Object.defineProperty(UP,"__esModule",{value:!0});UP.contentVocabulary=UP.metadataVocabulary=void 0;UP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];UP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var BP=I((VP)=>{Object.defineProperty(VP,"__esModule",{value:!0});var ha=TI(),ua=UR(),ma=JP(),la=GP(),qP=KP(),ca=[ha.default,ua.default,(0,ma.default)(),la.default,qP.metadataVocabulary,qP.contentVocabulary];VP.default=ca});var OP=I((NP)=>{Object.defineProperty(NP,"__esModule",{value:!0});NP.DiscrError=void 0;var zP;(function($){$.Tag="tag",$.Mapping="mapping"})(zP||(NP.DiscrError=zP={}))});var ZP=I((FP)=>{Object.defineProperty(FP,"__esModule",{value:!0});var Z9=Q$(),tB=OP(),DP=bW(),da=kJ(),ia=q$(),na={message:({params:{discrError:$,tagName:Q}})=>$===tB.DiscrError.Tag?`tag "${Q}" must be string`:`value of tag "${Q}" must be in oneOf`,params:({params:{discrError:$,tag:Q,tagName:J}})=>Z9._`{error: ${$}, tag: ${J}, tagValue: ${Q}}`},ra={keyword:"discriminator",type:"object",schemaType:"object",error:na,code($){let{gen:Q,data:J,schema:Y,parentSchema:X,it:W}=$,{oneOf:G}=X;if(!W.opts.discriminator)throw Error("discriminator: requires discriminator option");let U=Y.propertyName;if(typeof U!="string")throw Error("discriminator: requires propertyName");if(Y.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let H=Q.let("valid",!1),q=Q.const("tag",Z9._`${J}${(0,Z9.getProperty)(U)}`);Q.if(Z9._`typeof ${q} == "string"`,()=>V(),()=>$.error(!1,{discrError:tB.DiscrError.Tag,tag:q,tagName:U})),$.ok(H);function V(){let N=z();Q.if(!1);for(let w in N)Q.elseIf(Z9._`${q} === ${w}`),Q.assign(H,B(N[w]));Q.else(),$.error(!1,{discrError:tB.DiscrError.Mapping,tag:q,tagName:U}),Q.endIf()}function B(N){let w=Q.name("valid"),O=$.subschema({keyword:"oneOf",schemaProp:N},w);return $.mergeEvaluated(O,Z9.Name),w}function z(){var N;let w={},O=M(X),D=!0;for(let k=0;k<G.length;k++){let u=G[k];if((u===null||u===void 0?void 0:u.$ref)&&!(0,ia.schemaHasRulesButRef)(u,W.self.RULES)){let u$=u.$ref;if(u=DP.resolveRef.call(W.self,W.schemaEnv.root,W.baseId,u$),u instanceof DP.SchemaEnv)u=u.schema;if(u===void 0)throw new da.default(W.opts.uriResolver,W.baseId,u$)}let G$=(N=u===null||u===void 0?void 0:u.properties)===null||N===void 0?void 0:N[U];if(typeof G$!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${U}"`);D=D&&(O||M(u)),j(G$,k)}if(!D)throw Error(`discriminator: "${U}" must be required`);return w;function M({required:k}){return Array.isArray(k)&&k.includes(U)}function j(k,u){if(k.const)A(k.const,u);else if(k.enum)for(let G$ of k.enum)A(G$,u);else throw Error(`discriminator: "properties/${U}" must have "const" or "enum"`)}function A(k,u){if(typeof k!="string"||k in w)throw Error(`discriminator: "${U}" values must be unique strings`);w[k]=u}}}};FP.default=ra});var MP=I((WO$,ta)=>{ta.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var sB=I((S6,aB)=>{Object.defineProperty(S6,"__esModule",{value:!0});S6.MissingRefError=S6.ValidationError=S6.CodeGen=S6.Name=S6.nil=S6.stringify=S6.str=S6._=S6.KeywordCxt=S6.Ajv=void 0;var aa=II(),sa=BP(),ea=ZP(),LP=MP(),$s=["/properties"],iW="http://json-schema.org/draft-07/schema";class cJ extends aa.default{_addVocabularies(){if(super._addVocabularies(),sa.default.forEach(($)=>this.addVocabulary($)),this.opts.discriminator)this.addKeyword(ea.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let $=this.opts.$data?this.$dataMetaSchema(LP,$s):LP;this.addMetaSchema($,iW,!1),this.refs["http://json-schema.org/schema"]=iW}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(iW)?iW:void 0)}}S6.Ajv=cJ;aB.exports=S6=cJ;aB.exports.Ajv=cJ;Object.defineProperty(S6,"__esModule",{value:!0});S6.default=cJ;var Qs=SJ();Object.defineProperty(S6,"KeywordCxt",{enumerable:!0,get:function(){return Qs.KeywordCxt}});var M9=Q$();Object.defineProperty(S6,"_",{enumerable:!0,get:function(){return M9._}});Object.defineProperty(S6,"str",{enumerable:!0,get:function(){return M9.str}});Object.defineProperty(S6,"stringify",{enumerable:!0,get:function(){return M9.stringify}});Object.defineProperty(S6,"nil",{enumerable:!0,get:function(){return M9.nil}});Object.defineProperty(S6,"Name",{enumerable:!0,get:function(){return M9.Name}});Object.defineProperty(S6,"CodeGen",{enumerable:!0,get:function(){return M9.CodeGen}});var Js=PW();Object.defineProperty(S6,"ValidationError",{enumerable:!0,get:function(){return Js.default}});var Xs=kJ();Object.defineProperty(S6,"MissingRefError",{enumerable:!0,get:function(){return Xs.default}})});var kP=I((_P)=>{Object.defineProperty(_P,"__esModule",{value:!0});_P.formatNames=_P.fastFormats=_P.fullFormats=void 0;function b4($,Q){return{validate:$,compare:Q}}_P.fullFormats={date:b4(RP,Jz),time:b4($z(!0),Xz),"date-time":b4(jP(!0),EP),"iso-time":b4($z(),PP),"iso-date-time":b4(jP(),bP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Vs,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Fs,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Bs,int32:{type:"number",validate:ws},int64:{type:"number",validate:Os},float:{type:"number",validate:IP},double:{type:"number",validate:IP},password:!0,binary:!0};_P.fastFormats={..._P.fullFormats,date:b4(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Jz),time:b4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Xz),"date-time":b4(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EP),"iso-time":b4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,PP),"iso-date-time":b4(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,bP),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};_P.formatNames=Object.keys(_P.fullFormats);function Gs($){return $%4===0&&($%100!==0||$%400===0)}var Us=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Hs=[0,31,28,31,30,31,30,31,31,30,31,30,31];function RP($){let Q=Us.exec($);if(!Q)return!1;let J=+Q[1],Y=+Q[2],X=+Q[3];return Y>=1&&Y<=12&&X>=1&&X<=(Y===2&&Gs(J)?29:Hs[Y])}function Jz($,Q){if(!($&&Q))return;if($>Q)return 1;if($<Q)return-1;return 0}var eB=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $z($){return function(J){let Y=eB.exec(J);if(!Y)return!1;let X=+Y[1],W=+Y[2],G=+Y[3],U=Y[4],H=Y[5]==="-"?-1:1,q=+(Y[6]||0),V=+(Y[7]||0);if(q>23||V>59||$&&!U)return!1;if(X<=23&&W<=59&&G<60)return!0;let B=W-V*H,z=X-q*H-(B<0?1:0);return(z===23||z===-1)&&(B===59||B===-1)&&G<61}}function Xz($,Q){if(!($&&Q))return;let J=new Date("2020-01-01T"+$).valueOf(),Y=new Date("2020-01-01T"+Q).valueOf();if(!(J&&Y))return;return J-Y}function PP($,Q){if(!($&&Q))return;let J=eB.exec($),Y=eB.exec(Q);if(!(J&&Y))return;if($=J[1]+J[2]+J[3],Q=Y[1]+Y[2]+Y[3],$>Q)return 1;if($<Q)return-1;return 0}var Qz=/t|\s/i;function jP($){let Q=$z($);return function(Y){let X=Y.split(Qz);return X.length===2&&RP(X[0])&&Q(X[1])}}function EP($,Q){if(!($&&Q))return;let J=new Date($).valueOf(),Y=new Date(Q).valueOf();if(!(J&&Y))return;return J-Y}function bP($,Q){if(!($&&Q))return;let[J,Y]=$.split(Qz),[X,W]=Q.split(Qz),G=Jz(J,X);if(G===void 0)return;return G||Xz(Y,W)}var Ks=/\/|:/,qs=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Vs($){return Ks.test($)&&qs.test($)}var AP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Bs($){return AP.lastIndex=0,AP.test($)}var zs=-2147483648,Ns=2147483647;function ws($){return Number.isInteger($)&&$<=Ns&&$>=zs}function Os($){return Number.isInteger($)}function IP(){return!0}var Ds=/[^\\]\\Z/;function Fs($){if(Ds.test($))return!1;try{return new RegExp($),!0}catch(Q){return!1}}});var CP=I((vP)=>{Object.defineProperty(vP,"__esModule",{value:!0});vP.formatLimitDefinition=void 0;var Ms=sB(),D4=Q$(),m1=D4.operators,nW={formatMaximum:{okStr:"<=",ok:m1.LTE,fail:m1.GT},formatMinimum:{okStr:">=",ok:m1.GTE,fail:m1.LT},formatExclusiveMaximum:{okStr:"<",ok:m1.LT,fail:m1.GTE},formatExclusiveMinimum:{okStr:">",ok:m1.GT,fail:m1.LTE}},Ls={message:({keyword:$,schemaCode:Q})=>D4.str`should be ${nW[$].okStr} ${Q}`,params:({keyword:$,schemaCode:Q})=>D4._`{comparison: ${nW[$].okStr}, limit: ${Q}}`};vP.formatLimitDefinition={keyword:Object.keys(nW),type:"string",schemaType:"string",$data:!0,error:Ls,code($){let{gen:Q,data:J,schemaCode:Y,keyword:X,it:W}=$,{opts:G,self:U}=W;if(!G.validateFormats)return;let H=new Ms.KeywordCxt(W,U.RULES.all.format.definition,"format");if(H.$data)q();else V();function q(){let z=Q.scopeValue("formats",{ref:U.formats,code:G.code.formats}),N=Q.const("fmt",D4._`${z}[${H.schemaCode}]`);$.fail$data((0,D4.or)(D4._`typeof ${N} != "object"`,D4._`${N} instanceof RegExp`,D4._`typeof ${N}.compare != "function"`,B(N)))}function V(){let z=H.schema,N=U.formats[z];if(!N||N===!0)return;if(typeof N!="object"||N instanceof RegExp||typeof N.compare!="function")throw Error(`"${X}": format "${z}" does not define "compare" function`);let w=Q.scopeValue("formats",{key:z,ref:N,code:G.code.formats?D4._`${G.code.formats}${(0,D4.getProperty)(z)}`:void 0});$.fail$data(B(w))}function B(z){return D4._`${z}.compare(${J}, ${Y}) ${nW[X].fail} 0`}},dependencies:["format"]};var js=($)=>{return $.addKeyword(vP.formatLimitDefinition),$};vP.default=js});var fP=I((pJ,yP)=>{Object.defineProperty(pJ,"__esModule",{value:!0});var L9=kP(),Is=CP(),Gz=Q$(),TP=new Gz.Name("fullFormats"),Rs=new Gz.Name("fastFormats"),Uz=($,Q={keywords:!0})=>{if(Array.isArray(Q))return xP($,Q,L9.fullFormats,TP),$;let[J,Y]=Q.mode==="fast"?[L9.fastFormats,Rs]:[L9.fullFormats,TP],X=Q.formats||L9.formatNames;if(xP($,X,J,Y),Q.keywords)(0,Is.default)($);return $};Uz.get=($,Q="full")=>{let Y=(Q==="fast"?L9.fastFormats:L9.fullFormats)[$];if(!Y)throw Error(`Unknown format "${$}"`);return Y};function xP($,Q,J,Y){var X,W;(X=(W=$.opts.code).formats)!==null&&X!==void 0||(W.formats=Gz._`require("ajv-formats/dist/formats").${Y}`);for(let G of Q)$.addFormat(G,J[G])}yP.exports=pJ=Uz;Object.defineProperty(pJ,"__esModule",{value:!0});pJ.default=Uz});import{execFile as v6$}from"child_process";import{randomUUID as hz}from"crypto";import{createReadStream as C6$,realpathSync as T6$}from"fs";import{copyFile as x6$,mkdir as Tz,readdir as y6$,readFile as N_,rm as f6$,writeFile as w_}from"fs/promises";import{createRequire as g6$}from"module";import{homedir as xz,tmpdir as h6$}from"os";import{dirname as K_,isAbsolute as O_,join as u6,relative as D_,resolve as WX,sep as uz}from"path";import{createInterface as u6$}from"readline";import{fileURLToPath as m6$}from"url";import{setMaxListeners as o_}from"events";var t_=50;function f9($=t_){let Q=new AbortController;return o_($,Q.signal),Q}function KX($,Q,J){return new Promise((Y,X)=>{if(Q?.aborted){if(J?.throwOnAbort||J?.abortError)X(J.abortError?.()??Error("aborted"));else Y();return}let W=setTimeout((U,H,q)=>{U?.removeEventListener("abort",H),q()},$,Q,G,Y);function G(){if(clearTimeout(W),J?.throwOnAbort||J?.abortError)X(J.abortError?.()??Error("aborted"));else Y()}if(Q?.addEventListener("abort",G,{once:!0}),J?.unref)W.unref()})}function a_($,Q){$(Error(Q))}function v4($,Q,J){let Y,X=new Promise((W,G)=>{if(Y=setTimeout(a_,Q,G,J),typeof Y==="object")Y.unref?.()});return Promise.race([$,X]).finally(()=>{if(Y!==void 0)clearTimeout(Y)})}import{spawn as Zx}from"child_process";import{existsSync as Mx}from"fs";import{createInterface as Lx}from"readline";var r0=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged"],s_=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],e_="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__";var $S=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,QS=/<command-name>(.*?)<\/command-name>/;function g9($,Q){if($.type!=="user")return;if($.isMeta===!0||$.isCompactSummary===!0)return;let J=$.message;if(!J)return;let Y=J.content,X=[];if(typeof Y==="string")X.push(Y);else if(Array.isArray(Y))for(let W of Y){if(!W||typeof W!=="object")continue;if(W.type==="tool_result")return;if(W.type==="text"&&typeof W.text==="string")X.push(W.text)}for(let W of X){let G=W.replaceAll(`
15
+ deps: ${J}}`};var vt={keyword:"dependencies",type:"object",schemaType:"object",error:IR.error,code($){let[Q,J]=Ct($);jR($,Q),AR($,J)}};function Ct({schema:$}){let Q={},J={};for(let Y in $){if(Y==="__proto__")continue;let X=Array.isArray($[Y])?Q:J;X[Y]=$[Y]}return[Q,J]}function jR($,Q=$.schema){let{gen:J,data:Y,it:X}=$;if(Object.keys(Q).length===0)return;let W=J.let("missing");for(let G in Q){let U=Q[G];if(U.length===0)continue;let H=(0,lJ.propertyInData)(J,Y,G,X.opts.ownProperties);if($.setParams({property:G,depsCount:U.length,deps:U.join(", ")}),X.allErrors)J.if(H,()=>{for(let q of U)(0,lJ.checkReportMissingProp)($,q)});else J.if(nB._`${H} && (${(0,lJ.checkMissingProp)($,U,W)})`),(0,lJ.reportMissingProp)($,W),J.else()}}IR.validatePropertyDeps=jR;function AR($,Q=$.schema){let{gen:J,data:Y,keyword:X,it:W}=$,G=J.name("valid");for(let U in Q){if((0,kt.alwaysValidSchema)(W,Q[U]))continue;J.if((0,lJ.propertyInData)(J,Y,U,W.opts.ownProperties),()=>{let H=$.subschema({keyword:X,schemaProp:U},G);$.mergeValidEvaluated(H,G)},()=>J.var(G,!0)),$.ok(G)}}IR.validateSchemaDeps=AR;IR.default=vt});var SR=I((_R)=>{Object.defineProperty(_R,"__esModule",{value:!0});var bR=Q$(),yt=q$(),ft={message:"property name must be valid",params:({params:$})=>bR._`{propertyName: ${$.propertyName}}`},gt={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ft,code($){let{gen:Q,schema:J,data:Y,it:X}=$;if((0,yt.alwaysValidSchema)(X,J))return;let W=Q.name("valid");Q.forIn("key",Y,(G)=>{$.setParams({propertyName:G}),$.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},W),Q.if((0,bR.not)(W),()=>{if($.error(!0),!X.allErrors)Q.break()})}),$.ok(W)}};_R.default=gt});var rB=I((kR)=>{Object.defineProperty(kR,"__esModule",{value:!0});var mW=$4(),O4=Q$(),ut=$1(),lW=q$(),mt={message:"must NOT have additional properties",params:({params:$})=>O4._`{additionalProperty: ${$.additionalProperty}}`},lt={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mt,code($){let{gen:Q,schema:J,parentSchema:Y,data:X,errsCount:W,it:G}=$;if(!W)throw Error("ajv implementation error");let{allErrors:U,opts:H}=G;if(G.props=!0,H.removeAdditional!=="all"&&(0,lW.alwaysValidSchema)(G,J))return;let q=(0,mW.allSchemaProperties)(Y.properties),V=(0,mW.allSchemaProperties)(Y.patternProperties);B(),$.ok(O4._`${W} === ${ut.default.errors}`);function B(){Q.forIn("key",X,(D)=>{if(!q.length&&!V.length)w(D);else Q.if(z(D),()=>w(D))})}function z(D){let M;if(q.length>8){let j=(0,lW.schemaRefOrVal)(G,Y.properties,"properties");M=(0,mW.isOwnProperty)(Q,j,D)}else if(q.length)M=(0,O4.or)(...q.map((j)=>O4._`${D} === ${j}`));else M=O4.nil;if(V.length)M=(0,O4.or)(M,...V.map((j)=>O4._`${(0,mW.usePattern)($,j)}.test(${D})`));return(0,O4.not)(M)}function N(D){Q.code(O4._`delete ${X}[${D}]`)}function w(D){if(H.removeAdditional==="all"||H.removeAdditional&&J===!1){N(D);return}if(J===!1){if($.setParams({additionalProperty:D}),$.error(),!U)Q.break();return}if(typeof J=="object"&&!(0,lW.alwaysValidSchema)(G,J)){let M=Q.name("valid");if(H.removeAdditional==="failing")O(D,M,!1),Q.if((0,O4.not)(M),()=>{$.reset(),N(D)});else if(O(D,M),!U)Q.if((0,O4.not)(M),()=>Q.break())}}function O(D,M,j){let A={keyword:"additionalProperties",dataProp:D,dataPropType:lW.Type.Str};if(j===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(A,M)}}};kR.default=lt});var xR=I((TR)=>{Object.defineProperty(TR,"__esModule",{value:!0});var pt=SJ(),vR=$4(),oB=q$(),CR=rB(),dt={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:Q,schema:J,parentSchema:Y,data:X,it:W}=$;if(W.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)CR.default.code(new pt.KeywordCxt(W,CR.default,"additionalProperties"));let G=(0,vR.allSchemaProperties)(J);for(let B of G)W.definedProperties.add(B);if(W.opts.unevaluated&&G.length&&W.props!==!0)W.props=oB.mergeEvaluated.props(Q,(0,oB.toHash)(G),W.props);let U=G.filter((B)=>!(0,oB.alwaysValidSchema)(W,J[B]));if(U.length===0)return;let H=Q.name("valid");for(let B of U){if(q(B))V(B);else{if(Q.if((0,vR.propertyInData)(Q,X,B,W.opts.ownProperties)),V(B),!W.allErrors)Q.else().var(H,!0);Q.endIf()}$.it.definedProperties.add(B),$.ok(H)}function q(B){return W.opts.useDefaults&&!W.compositeRule&&J[B].default!==void 0}function V(B){$.subschema({keyword:"properties",schemaProp:B,dataProp:B},H)}}};TR.default=dt});var uR=I((hR)=>{Object.defineProperty(hR,"__esModule",{value:!0});var yR=$4(),cW=Q$(),fR=q$(),gR=q$(),nt={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:Q,schema:J,data:Y,parentSchema:X,it:W}=$,{opts:G}=W,U=(0,yR.allSchemaProperties)(J),H=U.filter((O)=>(0,fR.alwaysValidSchema)(W,J[O]));if(U.length===0||H.length===U.length&&(!W.opts.unevaluated||W.props===!0))return;let q=G.strictSchema&&!G.allowMatchingProperties&&X.properties,V=Q.name("valid");if(W.props!==!0&&!(W.props instanceof cW.Name))W.props=(0,gR.evaluatedPropsToName)(Q,W.props);let{props:B}=W;z();function z(){for(let O of U){if(q)N(O);if(W.allErrors)w(O);else Q.var(V,!0),w(O),Q.if(V)}}function N(O){for(let D in q)if(new RegExp(O).test(D))(0,fR.checkStrictMode)(W,`property ${D} matches pattern ${O} (use allowMatchingProperties)`)}function w(O){Q.forIn("key",Y,(D)=>{Q.if(cW._`${(0,yR.usePattern)($,O)}.test(${D})`,()=>{let M=H.includes(O);if(!M)$.subschema({keyword:"patternProperties",schemaProp:O,dataProp:D,dataPropType:gR.Type.Str},V);if(W.opts.unevaluated&&B!==!0)Q.assign(cW._`${B}[${D}]`,!0);else if(!M&&!W.allErrors)Q.if((0,cW.not)(V),()=>Q.break())})})}}};hR.default=nt});var lR=I((mR)=>{Object.defineProperty(mR,"__esModule",{value:!0});var ot=q$(),tt={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code($){let{gen:Q,schema:J,it:Y}=$;if((0,ot.alwaysValidSchema)(Y,J)){$.fail();return}let X=Q.name("valid");$.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},X),$.failResult(X,()=>$.reset(),()=>$.error())},error:{message:"must NOT be valid"}};mR.default=tt});var pR=I((cR)=>{Object.defineProperty(cR,"__esModule",{value:!0});var st=$4(),et={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:st.validateUnion,error:{message:"must match a schema in anyOf"}};cR.default=et});var iR=I((dR)=>{Object.defineProperty(dR,"__esModule",{value:!0});var pW=Q$(),Qa=q$(),Ja={message:"must match exactly one schema in oneOf",params:({params:$})=>pW._`{passingSchemas: ${$.passing}}`},Xa={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Ja,code($){let{gen:Q,schema:J,parentSchema:Y,it:X}=$;if(!Array.isArray(J))throw Error("ajv implementation error");if(X.opts.discriminator&&Y.discriminator)return;let W=J,G=Q.let("valid",!1),U=Q.let("passing",null),H=Q.name("_valid");$.setParams({passing:U}),Q.block(q),$.result(G,()=>$.reset(),()=>$.error(!0));function q(){W.forEach((V,B)=>{let z;if((0,Qa.alwaysValidSchema)(X,V))Q.var(H,!0);else z=$.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},H);if(B>0)Q.if(pW._`${H} && ${G}`).assign(G,!1).assign(U,pW._`[${U}, ${B}]`).else();Q.if(H,()=>{if(Q.assign(G,!0),Q.assign(U,B),z)$.mergeEvaluated(z,pW.Name)})})}}};dR.default=Xa});var rR=I((nR)=>{Object.defineProperty(nR,"__esModule",{value:!0});var Wa=q$(),Ga={keyword:"allOf",schemaType:"array",code($){let{gen:Q,schema:J,it:Y}=$;if(!Array.isArray(J))throw Error("ajv implementation error");let X=Q.name("valid");J.forEach((W,G)=>{if((0,Wa.alwaysValidSchema)(Y,W))return;let U=$.subschema({keyword:"allOf",schemaProp:G},X);$.ok(X),$.mergeEvaluated(U)})}};nR.default=Ga});var sR=I((aR)=>{Object.defineProperty(aR,"__esModule",{value:!0});var dW=Q$(),tR=q$(),Ha={message:({params:$})=>dW.str`must match "${$.ifClause}" schema`,params:({params:$})=>dW._`{failingKeyword: ${$.ifClause}}`},Ka={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ha,code($){let{gen:Q,parentSchema:J,it:Y}=$;if(J.then===void 0&&J.else===void 0)(0,tR.checkStrictMode)(Y,'"if" without "then" and "else" is ignored');let X=oR(Y,"then"),W=oR(Y,"else");if(!X&&!W)return;let G=Q.let("valid",!0),U=Q.name("_valid");if(H(),$.reset(),X&&W){let V=Q.let("ifClause");$.setParams({ifClause:V}),Q.if(U,q("then",V),q("else",V))}else if(X)Q.if(U,q("then"));else Q.if((0,dW.not)(U),q("else"));$.pass(G,()=>$.error(!0));function H(){let V=$.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},U);$.mergeEvaluated(V)}function q(V,B){return()=>{let z=$.subschema({keyword:V},U);if(Q.assign(G,U),$.mergeValidEvaluated(z,G),B)Q.assign(B,dW._`${V}`);else $.setParams({ifClause:V})}}}};function oR($,Q){let J=$.schema[Q];return J!==void 0&&!(0,tR.alwaysValidSchema)($,J)}aR.default=Ka});var $P=I((eR)=>{Object.defineProperty(eR,"__esModule",{value:!0});var Va=q$(),Ba={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:$,parentSchema:Q,it:J}){if(Q.if===void 0)(0,Va.checkStrictMode)(J,`"${$}" without "if" is ignored`)}};eR.default=Ba});var JP=I((QP)=>{Object.defineProperty(QP,"__esModule",{value:!0});var Na=dB(),wa=OR(),Oa=iB(),Da=ZR(),Fa=LR(),Za=ER(),Ma=SR(),La=rB(),ja=xR(),Aa=uR(),Ia=lR(),Ra=pR(),Pa=iR(),Ea=rR(),ba=sR(),_a=$P();function Sa($=!1){let Q=[Ia.default,Ra.default,Pa.default,Ea.default,ba.default,_a.default,Ma.default,La.default,Za.default,ja.default,Aa.default];if($)Q.push(wa.default,Da.default);else Q.push(Na.default,Oa.default);return Q.push(Fa.default),Q}QP.default=Sa});var YP=I((XP)=>{Object.defineProperty(XP,"__esModule",{value:!0});var d$=Q$(),va={message:({schemaCode:$})=>d$.str`must match format "${$}"`,params:({schemaCode:$})=>d$._`{format: ${$}}`},Ca={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:va,code($,Q){let{gen:J,data:Y,$data:X,schema:W,schemaCode:G,it:U}=$,{opts:H,errSchemaPath:q,schemaEnv:V,self:B}=U;if(!H.validateFormats)return;if(X)z();else N();function z(){let w=J.scopeValue("formats",{ref:B.formats,code:H.code.formats}),O=J.const("fDef",d$._`${w}[${G}]`),D=J.let("fType"),M=J.let("format");J.if(d$._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>J.assign(D,d$._`${O}.type || "string"`).assign(M,d$._`${O}.validate`),()=>J.assign(D,d$._`"string"`).assign(M,O)),$.fail$data((0,d$.or)(j(),A()));function j(){if(H.strictSchema===!1)return d$.nil;return d$._`${G} && !${M}`}function A(){let k=V.$async?d$._`(${O}.async ? await ${M}(${Y}) : ${M}(${Y}))`:d$._`${M}(${Y})`,u=d$._`(typeof ${M} == "function" ? ${k} : ${M}.test(${Y}))`;return d$._`${M} && ${M} !== true && ${D} === ${Q} && !${u}`}}function N(){let w=B.formats[W];if(!w){j();return}if(w===!0)return;let[O,D,M]=A(w);if(O===Q)$.pass(k());function j(){if(H.strictSchema===!1){B.logger.warn(u());return}throw Error(u());function u(){return`unknown format "${W}" ignored in schema at path "${q}"`}}function A(u){let G$=u instanceof RegExp?(0,d$.regexpCode)(u):H.code.formats?d$._`${H.code.formats}${(0,d$.getProperty)(W)}`:void 0,u$=J.scopeValue("formats",{key:W,ref:u,code:G$});if(typeof u=="object"&&!(u instanceof RegExp))return[u.type||"string",u.validate,d$._`${u$}.validate`];return["string",u,u$]}function k(){if(typeof w=="object"&&!(w instanceof RegExp)&&w.async){if(!V.$async)throw Error("async format in sync schema");return d$._`await ${M}(${Y})`}return typeof D=="function"?d$._`${M}(${Y})`:d$._`${M}.test(${Y})`}}}};XP.default=Ca});var GP=I((WP)=>{Object.defineProperty(WP,"__esModule",{value:!0});var xa=YP(),ya=[xa.default];WP.default=ya});var KP=I((UP)=>{Object.defineProperty(UP,"__esModule",{value:!0});UP.contentVocabulary=UP.metadataVocabulary=void 0;UP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];UP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var BP=I((VP)=>{Object.defineProperty(VP,"__esModule",{value:!0});var ha=TI(),ua=UR(),ma=JP(),la=GP(),qP=KP(),ca=[ha.default,ua.default,(0,ma.default)(),la.default,qP.metadataVocabulary,qP.contentVocabulary];VP.default=ca});var OP=I((NP)=>{Object.defineProperty(NP,"__esModule",{value:!0});NP.DiscrError=void 0;var zP;(function($){$.Tag="tag",$.Mapping="mapping"})(zP||(NP.DiscrError=zP={}))});var ZP=I((FP)=>{Object.defineProperty(FP,"__esModule",{value:!0});var Z9=Q$(),tB=OP(),DP=bW(),da=kJ(),ia=q$(),na={message:({params:{discrError:$,tagName:Q}})=>$===tB.DiscrError.Tag?`tag "${Q}" must be string`:`value of tag "${Q}" must be in oneOf`,params:({params:{discrError:$,tag:Q,tagName:J}})=>Z9._`{error: ${$}, tag: ${J}, tagValue: ${Q}}`},ra={keyword:"discriminator",type:"object",schemaType:"object",error:na,code($){let{gen:Q,data:J,schema:Y,parentSchema:X,it:W}=$,{oneOf:G}=X;if(!W.opts.discriminator)throw Error("discriminator: requires discriminator option");let U=Y.propertyName;if(typeof U!="string")throw Error("discriminator: requires propertyName");if(Y.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let H=Q.let("valid",!1),q=Q.const("tag",Z9._`${J}${(0,Z9.getProperty)(U)}`);Q.if(Z9._`typeof ${q} == "string"`,()=>V(),()=>$.error(!1,{discrError:tB.DiscrError.Tag,tag:q,tagName:U})),$.ok(H);function V(){let N=z();Q.if(!1);for(let w in N)Q.elseIf(Z9._`${q} === ${w}`),Q.assign(H,B(N[w]));Q.else(),$.error(!1,{discrError:tB.DiscrError.Mapping,tag:q,tagName:U}),Q.endIf()}function B(N){let w=Q.name("valid"),O=$.subschema({keyword:"oneOf",schemaProp:N},w);return $.mergeEvaluated(O,Z9.Name),w}function z(){var N;let w={},O=M(X),D=!0;for(let k=0;k<G.length;k++){let u=G[k];if((u===null||u===void 0?void 0:u.$ref)&&!(0,ia.schemaHasRulesButRef)(u,W.self.RULES)){let u$=u.$ref;if(u=DP.resolveRef.call(W.self,W.schemaEnv.root,W.baseId,u$),u instanceof DP.SchemaEnv)u=u.schema;if(u===void 0)throw new da.default(W.opts.uriResolver,W.baseId,u$)}let G$=(N=u===null||u===void 0?void 0:u.properties)===null||N===void 0?void 0:N[U];if(typeof G$!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${U}"`);D=D&&(O||M(u)),j(G$,k)}if(!D)throw Error(`discriminator: "${U}" must be required`);return w;function M({required:k}){return Array.isArray(k)&&k.includes(U)}function j(k,u){if(k.const)A(k.const,u);else if(k.enum)for(let G$ of k.enum)A(G$,u);else throw Error(`discriminator: "properties/${U}" must have "const" or "enum"`)}function A(k,u){if(typeof k!="string"||k in w)throw Error(`discriminator: "${U}" values must be unique strings`);w[k]=u}}}};FP.default=ra});var MP=I((WO$,ta)=>{ta.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var sB=I((S6,aB)=>{Object.defineProperty(S6,"__esModule",{value:!0});S6.MissingRefError=S6.ValidationError=S6.CodeGen=S6.Name=S6.nil=S6.stringify=S6.str=S6._=S6.KeywordCxt=S6.Ajv=void 0;var aa=II(),sa=BP(),ea=ZP(),LP=MP(),$s=["/properties"],iW="http://json-schema.org/draft-07/schema";class cJ extends aa.default{_addVocabularies(){if(super._addVocabularies(),sa.default.forEach(($)=>this.addVocabulary($)),this.opts.discriminator)this.addKeyword(ea.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let $=this.opts.$data?this.$dataMetaSchema(LP,$s):LP;this.addMetaSchema($,iW,!1),this.refs["http://json-schema.org/schema"]=iW}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(iW)?iW:void 0)}}S6.Ajv=cJ;aB.exports=S6=cJ;aB.exports.Ajv=cJ;Object.defineProperty(S6,"__esModule",{value:!0});S6.default=cJ;var Qs=SJ();Object.defineProperty(S6,"KeywordCxt",{enumerable:!0,get:function(){return Qs.KeywordCxt}});var M9=Q$();Object.defineProperty(S6,"_",{enumerable:!0,get:function(){return M9._}});Object.defineProperty(S6,"str",{enumerable:!0,get:function(){return M9.str}});Object.defineProperty(S6,"stringify",{enumerable:!0,get:function(){return M9.stringify}});Object.defineProperty(S6,"nil",{enumerable:!0,get:function(){return M9.nil}});Object.defineProperty(S6,"Name",{enumerable:!0,get:function(){return M9.Name}});Object.defineProperty(S6,"CodeGen",{enumerable:!0,get:function(){return M9.CodeGen}});var Js=PW();Object.defineProperty(S6,"ValidationError",{enumerable:!0,get:function(){return Js.default}});var Xs=kJ();Object.defineProperty(S6,"MissingRefError",{enumerable:!0,get:function(){return Xs.default}})});var kP=I((_P)=>{Object.defineProperty(_P,"__esModule",{value:!0});_P.formatNames=_P.fastFormats=_P.fullFormats=void 0;function b4($,Q){return{validate:$,compare:Q}}_P.fullFormats={date:b4(RP,Jz),time:b4($z(!0),Xz),"date-time":b4(jP(!0),EP),"iso-time":b4($z(),PP),"iso-date-time":b4(jP(),bP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Vs,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Fs,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Bs,int32:{type:"number",validate:ws},int64:{type:"number",validate:Os},float:{type:"number",validate:IP},double:{type:"number",validate:IP},password:!0,binary:!0};_P.fastFormats={..._P.fullFormats,date:b4(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Jz),time:b4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Xz),"date-time":b4(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,EP),"iso-time":b4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,PP),"iso-date-time":b4(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,bP),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};_P.formatNames=Object.keys(_P.fullFormats);function Gs($){return $%4===0&&($%100!==0||$%400===0)}var Us=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Hs=[0,31,28,31,30,31,30,31,31,30,31,30,31];function RP($){let Q=Us.exec($);if(!Q)return!1;let J=+Q[1],Y=+Q[2],X=+Q[3];return Y>=1&&Y<=12&&X>=1&&X<=(Y===2&&Gs(J)?29:Hs[Y])}function Jz($,Q){if(!($&&Q))return;if($>Q)return 1;if($<Q)return-1;return 0}var eB=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $z($){return function(J){let Y=eB.exec(J);if(!Y)return!1;let X=+Y[1],W=+Y[2],G=+Y[3],U=Y[4],H=Y[5]==="-"?-1:1,q=+(Y[6]||0),V=+(Y[7]||0);if(q>23||V>59||$&&!U)return!1;if(X<=23&&W<=59&&G<60)return!0;let B=W-V*H,z=X-q*H-(B<0?1:0);return(z===23||z===-1)&&(B===59||B===-1)&&G<61}}function Xz($,Q){if(!($&&Q))return;let J=new Date("2020-01-01T"+$).valueOf(),Y=new Date("2020-01-01T"+Q).valueOf();if(!(J&&Y))return;return J-Y}function PP($,Q){if(!($&&Q))return;let J=eB.exec($),Y=eB.exec(Q);if(!(J&&Y))return;if($=J[1]+J[2]+J[3],Q=Y[1]+Y[2]+Y[3],$>Q)return 1;if($<Q)return-1;return 0}var Qz=/t|\s/i;function jP($){let Q=$z($);return function(Y){let X=Y.split(Qz);return X.length===2&&RP(X[0])&&Q(X[1])}}function EP($,Q){if(!($&&Q))return;let J=new Date($).valueOf(),Y=new Date(Q).valueOf();if(!(J&&Y))return;return J-Y}function bP($,Q){if(!($&&Q))return;let[J,Y]=$.split(Qz),[X,W]=Q.split(Qz),G=Jz(J,X);if(G===void 0)return;return G||Xz(Y,W)}var Ks=/\/|:/,qs=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Vs($){return Ks.test($)&&qs.test($)}var AP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Bs($){return AP.lastIndex=0,AP.test($)}var zs=-2147483648,Ns=2147483647;function ws($){return Number.isInteger($)&&$<=Ns&&$>=zs}function Os($){return Number.isInteger($)}function IP(){return!0}var Ds=/[^\\]\\Z/;function Fs($){if(Ds.test($))return!1;try{return new RegExp($),!0}catch(Q){return!1}}});var CP=I((vP)=>{Object.defineProperty(vP,"__esModule",{value:!0});vP.formatLimitDefinition=void 0;var Ms=sB(),D4=Q$(),m1=D4.operators,nW={formatMaximum:{okStr:"<=",ok:m1.LTE,fail:m1.GT},formatMinimum:{okStr:">=",ok:m1.GTE,fail:m1.LT},formatExclusiveMaximum:{okStr:"<",ok:m1.LT,fail:m1.GTE},formatExclusiveMinimum:{okStr:">",ok:m1.GT,fail:m1.LTE}},Ls={message:({keyword:$,schemaCode:Q})=>D4.str`should be ${nW[$].okStr} ${Q}`,params:({keyword:$,schemaCode:Q})=>D4._`{comparison: ${nW[$].okStr}, limit: ${Q}}`};vP.formatLimitDefinition={keyword:Object.keys(nW),type:"string",schemaType:"string",$data:!0,error:Ls,code($){let{gen:Q,data:J,schemaCode:Y,keyword:X,it:W}=$,{opts:G,self:U}=W;if(!G.validateFormats)return;let H=new Ms.KeywordCxt(W,U.RULES.all.format.definition,"format");if(H.$data)q();else V();function q(){let z=Q.scopeValue("formats",{ref:U.formats,code:G.code.formats}),N=Q.const("fmt",D4._`${z}[${H.schemaCode}]`);$.fail$data((0,D4.or)(D4._`typeof ${N} != "object"`,D4._`${N} instanceof RegExp`,D4._`typeof ${N}.compare != "function"`,B(N)))}function V(){let z=H.schema,N=U.formats[z];if(!N||N===!0)return;if(typeof N!="object"||N instanceof RegExp||typeof N.compare!="function")throw Error(`"${X}": format "${z}" does not define "compare" function`);let w=Q.scopeValue("formats",{key:z,ref:N,code:G.code.formats?D4._`${G.code.formats}${(0,D4.getProperty)(z)}`:void 0});$.fail$data(B(w))}function B(z){return D4._`${z}.compare(${J}, ${Y}) ${nW[X].fail} 0`}},dependencies:["format"]};var js=($)=>{return $.addKeyword(vP.formatLimitDefinition),$};vP.default=js});var fP=I((pJ,yP)=>{Object.defineProperty(pJ,"__esModule",{value:!0});var L9=kP(),Is=CP(),Gz=Q$(),TP=new Gz.Name("fullFormats"),Rs=new Gz.Name("fastFormats"),Uz=($,Q={keywords:!0})=>{if(Array.isArray(Q))return xP($,Q,L9.fullFormats,TP),$;let[J,Y]=Q.mode==="fast"?[L9.fastFormats,Rs]:[L9.fullFormats,TP],X=Q.formats||L9.formatNames;if(xP($,X,J,Y),Q.keywords)(0,Is.default)($);return $};Uz.get=($,Q="full")=>{let Y=(Q==="fast"?L9.fastFormats:L9.fullFormats)[$];if(!Y)throw Error(`Unknown format "${$}"`);return Y};function xP($,Q,J,Y){var X,W;(X=(W=$.opts.code).formats)!==null&&X!==void 0||(W.formats=Gz._`require("ajv-formats/dist/formats").${Y}`);for(let G of Q)$.addFormat(G,J[G])}yP.exports=pJ=Uz;Object.defineProperty(pJ,"__esModule",{value:!0});pJ.default=Uz});import{execFile as v6$}from"child_process";import{randomUUID as hz}from"crypto";import{createReadStream as C6$,realpathSync as T6$}from"fs";import{copyFile as x6$,mkdir as Tz,readdir as y6$,readFile as N_,rm as f6$,writeFile as w_}from"fs/promises";import{createRequire as g6$}from"module";import{homedir as xz,tmpdir as h6$}from"os";import{dirname as K_,isAbsolute as O_,join as u6,relative as D_,resolve as WX,sep as uz}from"path";import{createInterface as u6$}from"readline";import{fileURLToPath as m6$}from"url";import{setMaxListeners as o_}from"events";var t_=50;function f9($=t_){let Q=new AbortController;return o_($,Q.signal),Q}function KX($,Q,J){return new Promise((Y,X)=>{if(Q?.aborted){if(J?.throwOnAbort||J?.abortError)X(J.abortError?.()??Error("aborted"));else Y();return}let W=setTimeout((U,H,q)=>{U?.removeEventListener("abort",H),q()},$,Q,G,Y);function G(){if(clearTimeout(W),J?.throwOnAbort||J?.abortError)X(J.abortError?.()??Error("aborted"));else Y()}if(Q?.addEventListener("abort",G,{once:!0}),J?.unref)W.unref()})}function a_($,Q){$(Error(Q))}function v4($,Q,J){let Y,X=new Promise((W,G)=>{if(Y=setTimeout(a_,Q,G,J),typeof Y==="object")Y.unref?.()});return Promise.race([$,X]).finally(()=>{if(Y!==void 0)clearTimeout(Y)})}import{spawn as Zx}from"child_process";import{existsSync as Mx}from"fs";import{createInterface as Lx}from"readline";var r0=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged","MessageDisplay"],s_=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],e_="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__";var $S=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,QS=/<command-name>(.*?)<\/command-name>/;function g9($,Q){if($.type!=="user")return;if($.isMeta===!0||$.isCompactSummary===!0)return;let J=$.message;if(!J)return;let Y=J.content,X=[];if(typeof Y==="string")X.push(Y);else if(Array.isArray(Y))for(let W of Y){if(!W||typeof W!=="object")continue;if(W.type==="tool_result")return;if(W.type==="text"&&typeof W.text==="string")X.push(W.text)}for(let W of X){let G=W.replaceAll(`
16
16
  `," ").trim();if(!G)continue;let U=QS.exec(G);if(U){if(!Q.commandFallback)Q.commandFallback=U[1];continue}let H=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(G);if(H)return`! ${H[1].trim()}`;if($S.test(G))continue;if(G.length>200)G=G.slice(0,200).trim()+"…";return G}return}var JS={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};function qX($,Q,J,Y){let X=Y?.mtime??$?.mtime??0,W=$!==void 0?{sessionId:$.sessionId,mtime:X,data:{...$.data}}:{sessionId:Q.sessionId,mtime:X,data:{}},G=W.data;for(let U of J){let H=YS(U.timestamp);if(G.isSidechain===void 0)G.isSidechain=U.isSidechain===!0;if(G.createdAt===void 0&&H!==void 0)G.createdAt=H;if(G.cwd===void 0){let q=U.cwd;if(typeof q==="string"&&q)G.cwd=q}WS(G,U);for(let[q,V]of Object.entries(JS)){let B=U[q];if(typeof B==="string")G[V]=B}if(U.type==="tag"){let q=U.tag;if(typeof q==="string"&&q)G.tag=q;else delete G.tag}}return W}function sz($,Q){let J=$.data;if(J.isSidechain===!0)return null;let Y=G1(J.firstPromptLocked===!0?J.firstPrompt:J.commandFallback)||void 0,X=G1(J.customTitle)||G1(J.aiTitle)||void 0,W=X||G1(J.lastPrompt)||G1(J.summaryHint)||Y;if(!W)return null;return{sessionId:$.sessionId,summary:W,lastModified:$.mtime,fileSize:void 0,customTitle:X,firstPrompt:Y,gitBranch:G1(J.gitBranch)||void 0,cwd:G1(J.cwd)||Q||void 0,tag:G1(J.tag)||void 0,createdAt:XS(J.createdAt)}}function G1($){return typeof $==="string"?$:void 0}function XS($){return typeof $==="number"?$:void 0}function YS($){if(typeof $!=="string")return;let Q=Date.parse($);return Number.isNaN(Q)?void 0:Q}function WS($,Q){if($.firstPromptLocked)return;let J={commandFallback:$.commandFallback??""},Y=g9(Q,J);if(J.commandFallback&&!$.commandFallback)$.commandFallback=J.commandFallback;if(Y!==void 0)$.firstPrompt=Y,$.firstPromptLocked=!0}class FG{store=new Map;mtimes=new Map;summaries=new Map;lastMtime=0;keyToString($){let Q=[$.projectKey,$.sessionId];if($.subpath)Q.push($.subpath);return Q.join("/")}async append($,Q){let J=this.keyToString($),Y=this.store.get(J)??[];Y.push(...Q),this.store.set(J,Y);let X=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=X,this.mtimes.set(J,X),$.subpath===void 0){let W=`${$.projectKey}/${$.sessionId}`,G=qX(this.summaries.get(W),$,Q,{mtime:X});this.summaries.set(W,G)}}async load($){let Q=this.keyToString($);return this.store.get(Q)??null}async listSessions($){let Q=[],J=$+"/";for(let[Y]of this.store)if(Y.startsWith(J)){let X=Y.slice(J.length);if(!X.includes("/"))Q.push({sessionId:X,mtime:this.mtimes.get(Y)??0})}return Q}async listSessionSummaries($){let Q=[],J=$+"/";for(let[Y,X]of this.summaries)if(Y.startsWith(J))Q.push(X);return Q}async delete($){let Q=this.keyToString($);if(this.store.delete(Q),this.mtimes.delete(Q),$.subpath===void 0){this.summaries.delete(`${$.projectKey}/${$.sessionId}`);let J=`${$.projectKey}/${$.sessionId}/`;for(let Y of this.store.keys())if(Y.startsWith(J))this.store.delete(Y),this.mtimes.delete(Y)}}async listSubkeys($){let Q=`${$.projectKey}/${$.sessionId}/`,J=[];for(let Y of this.store.keys())if(Y.startsWith(Q))J.push(Y.slice(Q.length));return J}getEntries($){return this.store.get(this.keyToString($))??[]}get size(){let $=0;for(let Q of this.store.keys()){let J=Q.indexOf("/");if(J!==-1&&!Q.slice(J+1).includes("/"))$++}return $}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}}class W6 extends Error{}function VX(){return process.versions.bun!==void 0}function A$($){if(!$)return!1;if(typeof $==="boolean")return $;let Q=String($).toLowerCase().trim();return["1","true","yes","on"].includes(Q)}function U1(){let $=new Set;return{subscribe(Q){return $.add(Q),()=>{$.delete(Q)}},emit(...Q){let J;for(let Y of $)try{Y(...Q)}catch(X){(J??=[]).push(X)}if(J)throw J.length===1?J[0]:AggregateError(J,"Signal listener(s) threw")},clear(){$.clear()}}}var US=typeof global=="object"&&global&&global.Object===Object&&global,BX=US;var HS=typeof self=="object"&&self&&self.Object===Object&&self,KS=BX||HS||Function("return this")(),l6=KS;var qS=l6.Symbol,c6=qS;var ez=Object.prototype,VS=ez.hasOwnProperty,BS=ez.toString,h9=c6?c6.toStringTag:void 0;function zS($){var Q=VS.call($,h9),J=$[h9];try{$[h9]=void 0;var Y=!0}catch(W){}var X=BS.call($);if(Y)if(Q)$[h9]=J;else delete $[h9];return X}var $N=zS;var NS=Object.prototype,wS=NS.toString;function OS($){return wS.call($)}var QN=OS;var DS="[object Null]",FS="[object Undefined]",JN=c6?c6.toStringTag:void 0;function ZS($){if($==null)return $===void 0?FS:DS;return JN&&JN in Object($)?$N($):QN($)}var L4=ZS;function MS($){var Q=typeof $;return $!=null&&(Q=="object"||Q=="function")}var $6=MS;var LS="[object AsyncFunction]",jS="[object Function]",AS="[object GeneratorFunction]",IS="[object Proxy]";function RS($){if(!$6($))return!1;var Q=L4($);return Q==jS||Q==AS||Q==LS||Q==IS}var o0=RS;var PS=l6["__core-js_shared__"],zX=PS;var XN=function(){var $=/[^.]+$/.exec(zX&&zX.keys&&zX.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}();function ES($){return!!XN&&XN in $}var YN=ES;var bS=Function.prototype,_S=bS.toString;function SS($){if($!=null){try{return _S.call($)}catch(Q){}try{return $+""}catch(Q){}}return""}var WN=SS;var kS=/[\\^$.*+?()[\]{}|]/g,vS=/^\[object .+?Constructor\]$/,CS=Function.prototype,TS=Object.prototype,xS=CS.toString,yS=TS.hasOwnProperty,fS=RegExp("^"+xS.call(yS).replace(kS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gS($){if(!$6($)||YN($))return!1;var Q=o0($)?fS:vS;return Q.test(WN($))}var GN=gS;function hS($,Q){return $==null?void 0:$[Q]}var UN=hS;function uS($,Q){var J=UN($,Q);return GN(J)?J:void 0}var t0=uS;var mS=t0(Object,"create"),C4=mS;function lS(){this.__data__=C4?C4(null):{},this.size=0}var HN=lS;function cS($){var Q=this.has($)&&delete this.__data__[$];return this.size-=Q?1:0,Q}var KN=cS;var pS="__lodash_hash_undefined__",dS=Object.prototype,iS=dS.hasOwnProperty;function nS($){var Q=this.__data__;if(C4){var J=Q[$];return J===pS?void 0:J}return iS.call(Q,$)?Q[$]:void 0}var qN=nS;var rS=Object.prototype,oS=rS.hasOwnProperty;function tS($){var Q=this.__data__;return C4?Q[$]!==void 0:oS.call(Q,$)}var VN=tS;var aS="__lodash_hash_undefined__";function sS($,Q){var J=this.__data__;return this.size+=this.has($)?0:1,J[$]=C4&&Q===void 0?aS:Q,this}var BN=sS;function a0($){var Q=-1,J=$==null?0:$.length;this.clear();while(++Q<J){var Y=$[Q];this.set(Y[0],Y[1])}}a0.prototype.clear=HN;a0.prototype.delete=KN;a0.prototype.get=qN;a0.prototype.has=VN;a0.prototype.set=BN;var ZG=a0;function eS(){this.__data__=[],this.size=0}var zN=eS;function $k($,Q){return $===Q||$!==$&&Q!==Q}var H1=$k;function Qk($,Q){var J=$.length;while(J--)if(H1($[J][0],Q))return J;return-1}var K1=Qk;var Jk=Array.prototype,Xk=Jk.splice;function Yk($){var Q=this.__data__,J=K1(Q,$);if(J<0)return!1;var Y=Q.length-1;if(J==Y)Q.pop();else Xk.call(Q,J,1);return--this.size,!0}var NN=Yk;function Wk($){var Q=this.__data__,J=K1(Q,$);return J<0?void 0:Q[J][1]}var wN=Wk;function Gk($){return K1(this.__data__,$)>-1}var ON=Gk;function Uk($,Q){var J=this.__data__,Y=K1(J,$);if(Y<0)++this.size,J.push([$,Q]);else J[Y][1]=Q;return this}var DN=Uk;function s0($){var Q=-1,J=$==null?0:$.length;this.clear();while(++Q<J){var Y=$[Q];this.set(Y[0],Y[1])}}s0.prototype.clear=zN;s0.prototype.delete=NN;s0.prototype.get=wN;s0.prototype.has=ON;s0.prototype.set=DN;var q1=s0;var Hk=t0(l6,"Map"),NX=Hk;function Kk(){this.size=0,this.__data__={hash:new ZG,map:new(NX||q1),string:new ZG}}var FN=Kk;function qk($){var Q=typeof $;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?$!=="__proto__":$===null}var ZN=qk;function Vk($,Q){var J=$.__data__;return ZN(Q)?J[typeof Q=="string"?"string":"hash"]:J.map}var V1=Vk;function Bk($){var Q=V1(this,$).delete($);return this.size-=Q?1:0,Q}var MN=Bk;function zk($){return V1(this,$).get($)}var LN=zk;function Nk($){return V1(this,$).has($)}var jN=Nk;function wk($,Q){var J=V1(this,$),Y=J.size;return J.set($,Q),this.size+=J.size==Y?0:1,this}var AN=wk;function e0($){var Q=-1,J=$==null?0:$.length;this.clear();while(++Q<J){var Y=$[Q];this.set(Y[0],Y[1])}}e0.prototype.clear=FN;e0.prototype.delete=MN;e0.prototype.get=LN;e0.prototype.has=jN;e0.prototype.set=AN;var u9=e0;var Ok="Expected a function";function MG($,Q){if(typeof $!="function"||Q!=null&&typeof Q!="function")throw TypeError(Ok);var J=function(){var Y=arguments,X=Q?Q.apply(this,Y):Y[0],W=J.cache;if(W.has(X))return W.get(X);var G=$.apply(this,Y);return J.cache=W.set(X,G)||W,G};return J.cache=new(MG.Cache||u9),J}MG.Cache=u9;var v$=MG;import{homedir as Dk}from"os";import{join as Fk}from"path";var p6=v$(()=>{return(process.env.CLAUDE_CONFIG_DIR??Fk(Dk(),".claude")).normalize("NFC")},()=>process.env.CLAUDE_CONFIG_DIR);var L0$=v$(()=>A$(process.env.CLAUDE_CODE_SUPERVISED));function y($,Q,J,Y,X){if(Y==="m")throw TypeError("Private method is not writable");if(Y==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Q==="function"?$!==Q||!X:!Q.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Y==="a"?X.call($,J):X?X.value=J:Q.set($,J),J}function Z($,Q,J,Y){if(J==="a"&&!Y)throw TypeError("Private accessor was defined without a getter");if(typeof Q==="function"?$!==Q||!Y:!Q.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return J==="m"?Y:J==="a"?Y.call($):Y?Y.value:Q.get($)}var LG=function(){let{crypto:$}=globalThis;if($?.randomUUID)return LG=$.randomUUID.bind($),$.randomUUID();let Q=new Uint8Array(1),J=$?()=>$.getRandomValues(Q)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Y)=>(+Y^J()&15>>+Y/4).toString(16))};function T4($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var m9=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Q=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Q.stack=$.stack;if($.cause&&!Q.cause)Q.cause=$.cause;if($.name)Q.name=$.name;return Q}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};class g extends Error{}class n$ extends g{constructor($,Q,J,Y,X){super(`${n$.makeMessage($,Q,J)}`);this.status=$,this.headers=Y,this.requestID=Y?.get("request-id"),this.error=Q,this.type=X??null}static makeMessage($,Q,J){let Y=Q?.message?typeof Q.message==="string"?Q.message:JSON.stringify(Q.message):Q?JSON.stringify(Q):J;if($&&Y)return`${$} ${Y}`;if($)return`${$} status code (no body)`;if(Y)return Y;return"(no status code or body)"}static generate($,Q,J,Y){if(!$||!Y)return new e1({message:J,cause:m9(Q)});let X=Q,W=X?.error?.type;if($===400)return new c9($,X,J,Y,W);if($===401)return new p9($,X,J,Y,W);if($===403)return new d9($,X,J,Y,W);if($===404)return new i9($,X,J,Y,W);if($===409)return new n9($,X,J,Y,W);if($===422)return new r9($,X,J,Y,W);if($===429)return new o9($,X,J,Y,W);if($>=500)return new t9($,X,J,Y,W);return new n$($,X,J,Y,W)}}class Q6 extends n${constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class e1 extends n${constructor({message:$,cause:Q}){super(void 0,void 0,$||"Connection error.",void 0);if(Q)this.cause=Q}}class l9 extends e1{constructor({message:$}={}){super({message:$??"Request timed out."})}}class c9 extends n${}class p9 extends n${}class d9 extends n${}class i9 extends n${}class n9 extends n${}class r9 extends n${}class o9 extends n${}class t9 extends n${}var Mk=/^[a-z][a-z0-9+.-]*:/i,IN=($)=>{return Mk.test($)},jG=($)=>(jG=Array.isArray,jG($)),AG=jG;function wX($){if(typeof $!=="object")return{};return $??{}}function IG($){if(!$)return!0;for(let Q in $)return!1;return!0}function RN($,Q){return Object.prototype.hasOwnProperty.call($,Q)}var PN=($,Q)=>{if(typeof Q!=="number"||!Number.isInteger(Q))throw new g(`${$} must be an integer`);if(Q<0)throw new g(`${$} must be a positive integer`);return Q};var OX=($)=>{try{return JSON.parse($)}catch(Q){return}};var EN=($)=>new Promise((Q)=>setTimeout(Q,$));var d6="0.94.0";var kN=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function Lk(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var jk=()=>{let $=Lk();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":d6,"X-Stainless-OS":_N(Deno.build.os),"X-Stainless-Arch":bN(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":d6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":d6,"X-Stainless-OS":_N(globalThis.process.platform??"unknown"),"X-Stainless-Arch":bN(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Q=Ak();if(Q)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":d6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Q.browser}`,"X-Stainless-Runtime-Version":Q.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":d6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Ak(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Q,pattern:J}of $){let Y=J.exec(navigator.userAgent);if(Y){let X=Y[1]||0,W=Y[2]||0,G=Y[3]||0;return{browser:Q,version:`${X}.${W}.${G}`}}}return null}var bN=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},_N=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},SN,a9=()=>{return SN??(SN=jk())};function vN(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function RG(...$){let Q=globalThis.ReadableStream;if(typeof Q>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Q(...$)}function DX($){let Q=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return RG({start(){},async pull(J){let{done:Y,value:X}=await Q.next();if(Y)J.close();else J.enqueue(X)},async cancel(){await Q.return?.()}})}function s9($){if($[Symbol.asyncIterator])return $;let Q=$.getReader();return{async next(){try{let J=await Q.read();if(J?.done)Q.releaseLock();return J}catch(J){throw Q.releaseLock(),J}},async return(){let J=Q.cancel();return Q.releaseLock(),await J,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function CN($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Q=$.getReader(),J=Q.cancel();Q.releaseLock(),await J}var TN=({headers:$,body:Q})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Q)}};function xN($){return Object.entries($).filter(([Q,J])=>typeof J<"u").map(([Q,J])=>{if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")return`${encodeURIComponent(Q)}=${encodeURIComponent(J)}`;if(J===null)return`${encodeURIComponent(Q)}=`;throw new g(`Cannot stringify type ${typeof J}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var fN="urn:ietf:params:oauth:grant-type:jwt-bearer",gN="refresh_token",FX="/v1/oauth/token",$0="oauth-2025-04-20",hN="oidc-federation-2026-04-01",uN=120,$8=30,mN=5,yN=1048576;function ZX($){if(!$)return;let Q;try{Q=new URL($)}catch(Y){throw new O$(`Invalid token endpoint base URL "${$}": ${Y}`)}if(Q.protocol==="https:")return;let J=Q.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(Q.protocol==="http:"&&(J==="localhost"||J==="127.0.0.1"||J==="::1"))return;throw new O$(`Refusing to send credential over non-https token endpoint "${$}"`)}async function MX($,Q){let J=await Ek($),Y;try{Y=JSON.parse(J)}catch{throw new O$(`Token endpoint returned non-JSON response (status ${$.status})`,$.status,Z6(J),Q)}if(!Y.access_token)throw new O$(`Token endpoint response missing access_token: ${JSON.stringify(Z6(Y))}`,$.status,Z6(Y),Q);if(Y.token_type&&Y.token_type.toLowerCase()!=="bearer")throw new O$(`Token endpoint response: unsupported token_type "${Y.token_type}" (want Bearer)`,$.status,Z6(Y),Q);return Y}var PG=2000,Pk=new Set(["error","error_description","error_uri"]);function Z6($){if($==null)return $;if(typeof $==="string"){let Q;try{Q=JSON.parse($)}catch{if($.length<=PG)return $;return $.slice(0,PG)+`... <${$.length-PG} more chars>`}return JSON.stringify(Z6(Q))}if(typeof $==="object"&&!Array.isArray($)){let Q={};for(let[J,Y]of Object.entries($))if(Pk.has(J))Q[J]=Y;return Q}return null}async function LX($,Q=(J)=>console.warn(`anthropic-sdk: ${J}`)){if(typeof process>"u"||process.platform==="win32")return;let J=await import("node:fs"),Y=$,X;try{Y=await J.promises.realpath($),X=await J.promises.stat(Y)}catch{return}let W=X.mode&511;if(W&18)throw new O$(`Credentials file at ${Y} is group/world-writable (mode 0o${W.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${Y}\`.`);if(W&36)throw new O$(`Credentials file at ${Y} is group/world-readable (mode 0o${W.toString(8)}); run \`chmod 600 ${Y}\` before retrying.`);if(typeof process.getuid==="function"&&X.uid!==process.getuid())Q(`credentials file at ${Y} is owned by uid ${X.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function jX($,Q){let J=await import("node:fs"),X=(await import("node:path")).dirname($);await J.promises.mkdir(X,{recursive:!0,mode:448});let W=`${$}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let G=await J.promises.open(W,"w",384);try{await G.writeFile(JSON.stringify(Q,null,2)),await G.sync()}finally{await G.close()}await J.promises.rename(W,$)}catch(G){throw await J.promises.unlink(W).catch(()=>{}),G}try{let G=await J.promises.open(X,"r");try{await G.sync()}finally{await G.close()}}catch{}}async function Ek($){if(!$.body)return"";let Q=$.body.getReader(),J=[],Y=0;for(;;){let{done:W,value:G}=await Q.read();if(W)break;if(Y+G.length>yN){let U=yN-Y;if(U>0)J.push(G.subarray(0,U));await Q.cancel();break}J.push(G),Y+=G.length}let X;if(J.length===1)X=J[0];else{X=new Uint8Array(J.reduce((G,U)=>G+U.length,0));let W=0;for(let G of J)X.set(G,W),W+=G.length}return new TextDecoder("utf-8").decode(X)}class O$ extends g{constructor($,Q=null,J=null,Y=null){super($);this.statusCode=Q,this.body=J,this.requestId=Y}}function Y4(){return Math.floor(Date.now()/1000)}class EG{constructor($,Q){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=$,this.onAdvisoryRefreshError=Q}async getToken(){let $=this.nextForce;this.nextForce=!1;let Q=this.cached;if($||Q==null)return(await this.refresh($)).token;if(Q.expiresAt==null)return Q.token;let J=Q.expiresAt-Y4();if(J>uN)return Q.token;if(J>$8)return this.backgroundRefresh(),Q.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh($=!1){if(this.pendingRefresh&&!$)return this.pendingRefresh;return this.doRefresh($)}backgroundRefresh(){if(this.pendingRefresh)return;if(Y4()-this.lastAdvisoryError<mN)return;this.doRefresh().catch(($)=>{this.lastAdvisoryError=Y4(),this.onAdvisoryRefreshError?.($)})}doRefresh($=!1){return this.pendingRefresh=this.provider($?{forceRefresh:!0}:void 0).then((Q)=>{return this.cached=Q,this.pendingRefresh=null,Q},(Q)=>{throw this.pendingRefresh=null,Q}),this.pendingRefresh}}var w$=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};function pN($){let Q=0;for(let X of $)Q+=X.length;let J=new Uint8Array(Q),Y=0;for(let X of $)J.set(X,Y),Y+=X.length;return J}var lN;function Q8($){let Q;return(lN??(Q=new globalThis.TextEncoder,lN=Q.encode.bind(Q)))($)}var cN;function bG($){let Q;return(cN??(Q=new globalThis.TextDecoder,cN=Q.decode.bind(Q)))($)}var IX={off:0,error:200,warn:300,info:400,debug:500},_G=($,Q,J)=>{if(!$)return;if(RN(IX,$))return $;l$(J).warn(`${Q} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(IX))}`);return};function e9(){}function AX($,Q,J){if(!Q||IX[$]>IX[J])return e9;else return Q[$].bind(Q)}var bk={error:e9,warn:e9,info:e9,debug:e9},dN=new WeakMap;function l$($){let Q=$.logger,J=$.logLevel??"off";if(!Q)return bk;let Y=dN.get(Q);if(Y&&Y[0]===J)return Y[1];let X={error:AX("error",Q,J),warn:AX("warn",Q,J),info:AX("info",Q,J),debug:AX("debug",Q,J)};return dN.set(Q,[J,X]),X}var x4=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Q,J])=>[Q,Q.toLowerCase()==="x-api-key"||Q.toLowerCase()==="authorization"||Q.toLowerCase()==="cookie"||Q.toLowerCase()==="set-cookie"?"***":J]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var RX="1.0",_k=/^[A-Za-z0-9_.-]+$/;function iN($){if(!$)throw Error("profile name is empty");if($==="."||$==="..")throw Error(`profile name "${$}" is not allowed`);if($.includes("/")||$.includes("\\"))throw Error(`profile name "${$}" must not contain path separators`);if(!_k.test($))throw Error(`profile name "${$}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var nN=async($)=>{var Q,J;let Y=await SG();if(Y===null)return null;let X=$??await oN();if(X===null)return null;iN(X);let W=await import("node:fs"),U=(await import("node:path")).join(Y,"configs",`${X}.json`),H;try{H=await W.promises.readFile(U,"utf-8")}catch(B){if(B?.code!=="ENOENT")throw Error(`failed to read config file ${U}: ${B}`);H=null}if(H===null){let B=w$("ANTHROPIC_ORGANIZATION_ID"),z=w$("ANTHROPIC_IDENTITY_TOKEN_FILE"),N=w$("ANTHROPIC_FEDERATION_RULE_ID");if(N&&B)return{fromFile:!1,config:{organization_id:B,workspace_id:w$("ANTHROPIC_WORKSPACE_ID"),base_url:w$("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:N,service_account_id:w$("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:z?{source:"file",path:z}:void 0,scope:w$("ANTHROPIC_SCOPE")}}};return null}let q;try{q=JSON.parse(H)}catch(B){throw Error(`failed to parse config file ${U}: ${B}`)}if(!q.authentication)throw Error(`config file ${U} is missing "authentication"`);let V=q.authentication.type;if(V!=="oidc_federation"&&V!=="user_oauth")throw Error(`authentication.type "${V}" is not a known authentication type`);if(q.organization_id??(q.organization_id=w$("ANTHROPIC_ORGANIZATION_ID")),q.workspace_id??(q.workspace_id=w$("ANTHROPIC_WORKSPACE_ID")),q.base_url??(q.base_url=w$("ANTHROPIC_BASE_URL")),(Q=q.authentication).scope??(Q.scope=w$("ANTHROPIC_SCOPE")),q.authentication.type==="oidc_federation"){if(!q.authentication.identity_token){let B=w$("ANTHROPIC_IDENTITY_TOKEN_FILE");if(B)q.authentication.identity_token={source:"file",path:B}}if(!q.authentication.federation_rule_id)q.authentication.federation_rule_id=w$("ANTHROPIC_FEDERATION_RULE_ID")??"";(J=q.authentication).service_account_id??(J.service_account_id=w$("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:q,fromFile:!0}};var rN=async($,Q)=>{if($?.authentication.credentials_path)return $.authentication.credentials_path;let J=await SG();if(!J)return null;let Y=Q??await oN();if(!Y)return null;return iN(Y),(await import("node:path")).join(J,"credentials",`${Y}.json`)},SG=async()=>{if(!Sk())return null;let $=await import("node:path"),Q=w$("ANTHROPIC_CONFIG_DIR");if(Q)return Q;if(a9()["X-Stainless-OS"]==="Windows"){let W=w$("APPDATA");if(W)return $.join(W,"Anthropic");let G=w$("USERPROFILE");if(G)return $.join(G,"AppData","Roaming","Anthropic");return null}let Y=w$("XDG_CONFIG_HOME");if(Y)return $.join(Y,"anthropic");let X=w$("HOME");if(X)return $.join(X,".config","anthropic");return null},Sk=()=>{let $=a9()["X-Stainless-Runtime"];return $==="node"||$==="deno"},oN=async()=>{let $=await SG();if(!$)return null;let Q=w$("ANTHROPIC_PROFILE");if(Q)return Q;let J=await import("node:fs"),X=(await import("node:path")).join($,"active_config");try{return(await J.promises.readFile(X,"utf-8")).trim()||"default"}catch(W){if(W?.code!=="ENOENT")throw Error(`failed to read ${X}: ${W}`);return"default"}};function kG($){if(!$)throw new g("Identity token file path is empty");return async()=>{let Q=await import("node:fs"),J;try{J=await Q.promises.readFile($,"utf-8")}catch(X){throw new g(`Failed to read identity token file at ${$}: ${X}`)}let Y=J.trim();if(!Y)throw new g(`Identity token file at ${$} is empty`);return Y}}function tN($){if(!$)throw new g("Identity token value is empty");return()=>$}function aN($){return async()=>{ZX($.baseURL);let Q=await $.identityTokenProvider();if(Q.length>16384)throw new O$(`Identity token is ${Math.ceil(Q.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let J={grant_type:fN,assertion:Q,federation_rule_id:$.federationRuleId,organization_id:$.organizationId};if($.serviceAccountId)J.service_account_id=$.serviceAccountId;if($.workspaceId)J.workspace_id=$.workspaceId;let Y=`${$.baseURL}${FX}`,X;try{X=await $.fetch(Y,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${$0},${hN}`,"User-Agent":$.userAgent||`anthropic-sdk-typescript/${d6} oidcFederationProvider`},body:JSON.stringify(J)})}catch(H){throw new O$(`Failed to reach token endpoint ${Y}: ${H}`)}let W=X.headers.get("Request-Id");if(!X.ok){let H=await X.text().catch(()=>""),q=Z6(H),V="";if(X.status===401)V=` Ensure your federation rule matches your identity token. ${$.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`;throw new O$(`Token exchange failed with status ${X.status}${W?` (request-id ${W})`:""}: ${q}${V}`,X.status,q,W)}let G=await MX(X,W),U=Number(G.expires_in);if(!Number.isFinite(U))throw new O$(`Token endpoint response missing required fields: ${JSON.stringify(Z6(G))}`,X.status,Z6(G),W);return{token:G.access_token,expiresAt:Y4()+U}}}function sN($){return async(Q)=>{let J=await import("node:fs");await LX($.credentialsPath,$.onSafetyWarning);let Y;try{Y=await J.promises.readFile($.credentialsPath,"utf-8")}catch(D){throw new O$(`Credentials file not found at ${$.credentialsPath}: ${D}`)}let X;try{X=JSON.parse(Y)}catch(D){throw new O$(`Credentials file at ${$.credentialsPath} is not valid JSON: ${D}`)}let W=X.access_token;if(!W)throw new O$(`Credentials file at ${$.credentialsPath} must include 'access_token'`);let G=X.expires_at;if(!Q?.forceRefresh&&(G==null||Y4()<G-$8))return{token:W,expiresAt:G??null};let U=X.refresh_token;if(!$.clientId||!U)throw new O$(`Access token at ${$.credentialsPath} has expired and no refresh is available (client_id ${$.clientId?"set":"empty"}, refresh_token ${U?"set":"empty"})`);ZX($.baseURL);let H={grant_type:gN,refresh_token:U,client_id:$.clientId},q=`${$.baseURL}${FX}`,V;try{V=await $.fetch(q,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":$0,"User-Agent":$.userAgent||`anthropic-sdk-typescript/${d6} userOAuthProvider`},body:JSON.stringify(H)})}catch(D){throw new O$(`User OAuth refresh failed to reach token endpoint: ${D}`)}let B=V.headers.get("Request-Id");if(!V.ok){let D=await V.text().catch(()=>"");throw new O$(`User OAuth refresh failed (HTTP ${V.status}): ${Z6(D)}`,V.status,Z6(D),B)}let z=await MX(V,B),N=Number(z.expires_in);if(!Number.isFinite(N))throw new O$(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(Z6(z))}`,V.status,Z6(z),B);let w=Y4()+N,O=z.refresh_token||U;return await jX($.credentialsPath,{...X,version:RX,type:"oauth_token",access_token:z.access_token,expires_at:w,refresh_token:O}),{token:z.access_token,expiresAt:w}}}function vG($,Q){let J=$.authentication.credentials_path??null,Y=($.base_url||Q.baseURL).replace(/\/+$/,""),X=kk($,J,Y,Q),W={};if($.workspace_id&&$.authentication.type==="user_oauth")W["anthropic-workspace-id"]=$.workspace_id;return{provider:X,extraHeaders:W,baseURL:$.base_url||void 0}}async function eN($,Q){let J=await nN(Q);if(!J)return null;let{config:Y,fromFile:X}=J,W=Y.authentication.credentials_path||!X?Y:{...Y,authentication:{...Y.authentication,credentials_path:await rN(Y,Q)??void 0}};return vG(W,$)}function kk($,Q,J,Y){switch($.authentication.type){case"oidc_federation":{let X=$.authentication,W=vk(X);if(!W)throw new O$("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!X.federation_rule_id)throw new O$("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!$.organization_id)throw new O$("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let G=aN({identityTokenProvider:W,federationRuleId:X.federation_rule_id,organizationId:$.organization_id,serviceAccountId:X.service_account_id,workspaceId:$.workspace_id,baseURL:J,fetch:Y.fetch,userAgent:Y.userAgent});if(Q)return Ck(G,Q,Y.onCacheWriteError,Y.onSafetyWarning);return G}case"user_oauth":{if(!Q)throw new O$("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return sN({credentialsPath:Q,clientId:$.authentication.client_id,baseURL:J,fetch:Y.fetch,userAgent:Y.userAgent,onSafetyWarning:Y.onSafetyWarning})}default:{let X=$.authentication.type;throw new O$(`authentication.type "${X}" is not a known authentication type`)}}}function vk($){if($.identity_token){let Y=$.identity_token.source;if(Y!=="file")throw new O$(`identity_token.source "${Y}" is not supported by this SDK version (only "file")`);if(!$.identity_token.path)throw new O$('identity_token.source "file" requires a non-empty path');return kG($.identity_token.path)}let Q=w$("ANTHROPIC_IDENTITY_TOKEN_FILE");if(Q)return kG(Q);let J=w$("ANTHROPIC_IDENTITY_TOKEN");if(J)return tN(J);return null}function Ck($,Q,J,Y){return async(X)=>{let W=await import("node:fs");await LX(Q,Y);let G;try{let H=await W.promises.readFile(Q,"utf-8");G=JSON.parse(H);let q=G?.access_token;if(q&&!X?.forceRefresh){let V=G?.expires_at;if(V==null||Y4()<V-$8)return{token:q,expiresAt:V??null}}}catch(H){if(H?.code!=="ENOENT"&&!(H instanceof SyntaxError))J?.(H)}let U=await $(X);try{await jX(Q,{...G??{},version:RX,type:"oauth_token",access_token:U.token,expires_at:U.expiresAt})}catch(H){J?.(H)}return U}}var C6,T6;class B1{constructor(){C6.set(this,void 0),T6.set(this,void 0),y(this,C6,new Uint8Array,"f"),y(this,T6,null,"f")}decode($){if($==null)return[];let Q=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?Q8($):$;y(this,C6,pN([Z(this,C6,"f"),Q]),"f");let J=[],Y;while((Y=Tk(Z(this,C6,"f"),Z(this,T6,"f")))!=null){if(Y.carriage&&Z(this,T6,"f")==null){y(this,T6,Y.index,"f");continue}if(Z(this,T6,"f")!=null&&(Y.index!==Z(this,T6,"f")+1||Y.carriage)){J.push(bG(Z(this,C6,"f").subarray(0,Z(this,T6,"f")-1))),y(this,C6,Z(this,C6,"f").subarray(Z(this,T6,"f")),"f"),y(this,T6,null,"f");continue}let X=Z(this,T6,"f")!==null?Y.preceding-1:Y.preceding,W=bG(Z(this,C6,"f").subarray(0,X));J.push(W),y(this,C6,Z(this,C6,"f").subarray(Y.index),"f"),y(this,T6,null,"f")}return J}flush(){if(!Z(this,C6,"f").length)return[];return this.decode(`
17
17
  `)}}C6=new WeakMap,T6=new WeakMap;B1.NEWLINE_CHARS=new Set([`
18
18
  `,"\r"]);B1.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Tk($,Q){for(let X=Q??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function $w($){for(let Y=0;Y<$.length-1;Y++){if($[Y]===10&&$[Y+1]===10)return Y+2;if($[Y]===13&&$[Y+1]===13)return Y+2;if($[Y]===13&&$[Y+1]===10&&Y+3<$.length&&$[Y+2]===13&&$[Y+3]===10)return Y+4}return-1}var $Q;class x6{constructor($,Q,J){this.iterator=$,$Q.set(this,void 0),this.controller=Q,y(this,$Q,J,"f")}static fromSSEResponse($,Q,J){let Y=!1,X=J?l$(J):console;async function*W(){if(Y)throw new g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let G=!1;try{for await(let U of xk($,Q)){if(U.event==="completion")try{yield JSON.parse(U.data)}catch(H){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),H}if(U.event==="message_start"||U.event==="message_delta"||U.event==="message_stop"||U.event==="content_block_start"||U.event==="content_block_delta"||U.event==="content_block_stop"||U.event==="message"||U.event==="user.message"||U.event==="user.interrupt"||U.event==="user.tool_confirmation"||U.event==="user.custom_tool_result"||U.event==="agent.message"||U.event==="agent.thinking"||U.event==="agent.tool_use"||U.event==="agent.tool_result"||U.event==="agent.mcp_tool_use"||U.event==="agent.mcp_tool_result"||U.event==="agent.custom_tool_use"||U.event==="agent.thread_context_compacted"||U.event==="session.status_running"||U.event==="session.status_idle"||U.event==="session.status_rescheduled"||U.event==="session.status_terminated"||U.event==="session.error"||U.event==="session.deleted"||U.event==="span.model_request_start"||U.event==="span.model_request_end")try{yield JSON.parse(U.data)}catch(H){throw X.error("Could not parse message into JSON:",U.data),X.error("From chunk:",U.raw),H}if(U.event==="ping")continue;if(U.event==="error"){let H=OX(U.data)??U.data,q=H?.error?.type;throw new n$(void 0,H,void 0,$.headers,q)}}G=!0}catch(U){if(T4(U))return;throw U}finally{if(!G)Q.abort()}}return new x6(W,Q,J)}static fromReadableStream($,Q,J){let Y=!1;async function*X(){let G=new B1,U=s9($);for await(let H of U)for(let q of G.decode(H))yield q;for(let H of G.flush())yield H}async function*W(){if(Y)throw new g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let G=!1;try{for await(let U of X()){if(G)continue;if(U)yield JSON.parse(U)}G=!0}catch(U){if(T4(U))return;throw U}finally{if(!G)Q.abort()}}return new x6(W,Q,J)}[($Q=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Q=[],J=this.iterator(),Y=(X)=>{return{next:()=>{if(X.length===0){let W=J.next();$.push(W),Q.push(W)}return X.shift()}}};return[new x6(()=>Y($),this.controller,Z(this,$Q,"f")),new x6(()=>Y(Q),this.controller,Z(this,$Q,"f"))]}toReadableStream(){let $=this,Q;return RG({async start(){Q=$[Symbol.asyncIterator]()},async pull(J){try{let{value:Y,done:X}=await Q.next();if(X)return J.close();let W=Q8(JSON.stringify(Y)+`
@@ -55,7 +55,7 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
55
55
  `);this.baseURL=X.baseURL,this._baseURLIsExplicit=Y.__baseURLIsExplicit??!!$,this.timeout=X.timeout??QU.DEFAULT_TIMEOUT,this.logger=X.logger??console;let W="warn";this.logLevel=W,this.logLevel=_G(X.logLevel,"ClientOptions.logLevel",this)??_G(w$("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??W,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??vN(),y(this,nX,TN,"f");let G=w$("ANTHROPIC_CUSTOM_HEADERS");if(G){let H={};for(let q of G.split(`
56
56
  `)){let V=q.indexOf(":");if(V>=0)H[q.substring(0,V).trim()]=q.substring(V+1).trim()}X.defaultHeaders={...H,...X.defaultHeaders}}let U=Y.__auth;if(delete X.__auth,delete X.__baseURLIsExplicit,this._options=X,this.apiKey=typeof Q==="string"?Q:null,this.authToken=J,U){if(this._authState=U,!this._baseURLIsExplicit&&U.baseURL)this.baseURL=U.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let H=X.credentials??null;if(H)this._authState.provider=H,this._authState.tokenCache=this._makeTokenCache(H);else if(X.config!=null){let q=vG(X.config,this._credentialResolverOptions());this._authState.provider=q.provider,this._authState.tokenCache=this._makeTokenCache(q.provider),this._authState.extraHeaders=q.extraHeaders,this._applyCredentialBaseURL(q.baseURL)}else if(X.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(X.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL($){if(!$)return;let Q=$.replace(/\/+$/,"");if(this._authState.baseURL=Q,!this._baseURLIsExplicit)this.baseURL=Q}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:($)=>{l$(this).debug("credential cache write failed (best-effort)",$)},onSafetyWarning:($)=>{l$(this).warn($)}}}_makeTokenCache($){return new EG($,(Q)=>{l$(this).debug("advisory token refresh failed; serving cached token",Q)})}withOptions($){let Q="credentials"in $||"config"in $||"profile"in $,J="apiKey"in $||"authToken"in $||Q,Y={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...Q?{credentials:void 0,config:void 0,profile:void 0}:{},...$,__auth:J?void 0:this._authState,__baseURLIsExplicit:"baseURL"in $?!0:this._baseURLIsExplicit};return new this.constructor(Y)}async _resolveDefaultCredentials($){try{let Q=await eN(this._credentialResolverOptions(),$);if(Q)this._authState.provider=Q.provider,this._authState.tokenCache=this._makeTokenCache(Q.provider),this._authState.extraHeaders=Q.extraHeaders,this._applyCredentialBaseURL(Q.baseURL);else if($!=null)throw new g(`Profile "${$}" could not be resolved (no <config_dir>/configs/${$}.json found).`)}catch(Q){this._authState.error=Q}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Q}){if($.get("x-api-key")||$.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&$.get("x-api-key"))return;if(Q.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Q.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags($){let Q=this._requestAuthFlags.get($);if(!Q)Q={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set($,Q);return Q}async authHeaders($){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let Q=await this._authState.tokenCache.getToken();return this._authFlags($).usedTokenCache=!0,R([{Authorization:`Bearer ${Q}`}])}return R([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return R([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return R([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return xN($)}getUserAgent(){return`${this.constructor.name}/JS ${d6}`}defaultIdempotencyKey(){return`stainless-node-retry-${LG()}`}makeStatusError($,Q,J,Y){return n$.generate($,Q,J,Y)}buildURL($,Q,J){let Y=!Z(this,$U,"m",Ew).call(this)&&J||this.baseURL,X=IN($)?new URL($):new URL(Y+(Y.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),W=this.defaultQuery(),G=Object.fromEntries(X.searchParams);if(!IG(W)||!IG(G))Q={...G,...W,...Q};if(typeof Q==="object"&&Q&&!Array.isArray(Q))X.search=this.stringifyQuery(Q);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new g("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Q,options:J}){if(this._authState.tokenCache&&this.apiKey==null){let Y=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[W,G]of Object.entries(this._authState.extraHeaders))if(!Y.has(W))Y.set(W,G);if(!Y.get("anthropic-beta")?.split(",").map((W)=>W.trim())?.includes($0))Y.append("anthropic-beta",$0);$.headers=Y}}get($,Q){return this.methodRequest("get",$,Q)}post($,Q){return this.methodRequest("post",$,Q)}patch($,Q){return this.methodRequest("patch",$,Q)}put($,Q){return this.methodRequest("put",$,Q)}delete($,Q){return this.methodRequest("delete",$,Q)}methodRequest($,Q,J){return this.request(Promise.resolve(J).then((Y)=>{return{method:$,path:Q,...Y}}))}request($,Q=null){return new Q0(this,this.makeRequest($,Q,void 0))}async makeRequest($,Q,J){let Y=await $,X=Y.maxRetries??this.maxRetries;if(Q==null)Q=X,this._requestAuthFlags.delete(Y);await this.prepareOptions(Y);let{req:W,url:G,timeout:U}=await this.buildRequest(Y,{retryCount:X-Q});await this.prepareRequest(W,{url:G,options:Y});let H="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),q=J===void 0?"":`, retryOf: ${J}`,V=Date.now();if(l$(this).debug(`[${H}] sending request`,x4({retryOfRequestLogID:J,method:Y.method,url:G,options:Y,headers:W.headers})),Y.signal?.aborted)throw new Q6;let B=new AbortController,z=await this.fetchWithTimeout(G,W,U,B).catch(m9),N=Date.now();if(z instanceof globalThis.Error){let D=`retrying, ${Q} attempts remaining`;if(Y.signal?.aborted)throw new Q6;let M=T4(z)||/timed? ?out/i.test(String(z)+("cause"in z?String(z.cause):""));if(Q)return l$(this).info(`[${H}] connection ${M?"timed out":"failed"} - ${D}`),l$(this).debug(`[${H}] connection ${M?"timed out":"failed"} (${D})`,x4({retryOfRequestLogID:J,url:G,durationMs:N-V,message:z.message})),this.retryRequest(Y,Q,J??H);if(l$(this).info(`[${H}] connection ${M?"timed out":"failed"} - error; no more retries left`),l$(this).debug(`[${H}] connection ${M?"timed out":"failed"} (error; no more retries left)`,x4({retryOfRequestLogID:J,url:G,durationMs:N-V,message:z.message})),M)throw new l9;throw new e1({cause:z})}let w=[...z.headers.entries()].filter(([D])=>D==="request-id").map(([D,M])=>", "+D+": "+JSON.stringify(M)).join(""),O=`[${H}${q}${w}] ${W.method} ${G} ${z.ok?"succeeded":"failed"} with status ${z.status} in ${N-V}ms`;if(!z.ok){let D=await this.shouldRetry(z,Y);if(Q&&D){let G$=`retrying, ${Q} attempts remaining`;return await CN(z.body),l$(this).info(`${O} - ${G$}`),l$(this).debug(`[${H}] response error (${G$})`,x4({retryOfRequestLogID:J,url:z.url,status:z.status,headers:z.headers,durationMs:N-V})),this.retryRequest(Y,Q,J??H,z.headers)}let M=D?"error; no more retries left":"error; not retryable";l$(this).info(`${O} - ${M}`);let j=await z.text().catch((G$)=>m9(G$).message),A=OX(j),k=A?void 0:j;throw l$(this).debug(`[${H}] response error (${M})`,x4({retryOfRequestLogID:J,url:z.url,status:z.status,headers:z.headers,message:k,durationMs:Date.now()-V})),this.makeStatusError(z.status,A,k,z.headers)}return l$(this).info(O),l$(this).debug(`[${H}] response start`,x4({retryOfRequestLogID:J,url:z.url,status:z.status,headers:z.headers,durationMs:N-V})),{response:z,options:Y,controller:B,requestLogID:H,retryOfRequestLogID:J,startTime:V}}getAPIList($,Q,J){return this.requestAPIList(Q,J&&"then"in J?J.then((Y)=>({method:"get",path:$,...Y})):{method:"get",path:$,...J})}requestAPIList($,Q){let J=this.makeRequest(Q,null,void 0);return new bX(this,J,$)}async fetchWithTimeout($,Q,J,Y){let{signal:X,method:W,...G}=Q||{},U=this._makeAbort(Y);if(X)X.addEventListener("abort",U,{once:!0});let H=setTimeout(U,J),q=globalThis.ReadableStream&&G.body instanceof globalThis.ReadableStream||typeof G.body==="object"&&G.body!==null&&Symbol.asyncIterator in G.body,V={signal:Y.signal,...q?{duplex:"half"}:{},method:"GET",...G};if(W)V.method=W.toUpperCase();try{return await this.fetch.call(void 0,$,V)}finally{clearTimeout(H)}}async shouldRetry($,Q){let J=this._authFlags(Q);if($.status===401&&this._authState.tokenCache&&J.usedTokenCache&&!J.didRefreshFor401)return J.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let Y=$.headers.get("x-should-retry");if(Y==="true")return!0;if(Y==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Q,J,Y){let X,W=Y?.get("retry-after-ms");if(W){let U=parseFloat(W);if(!Number.isNaN(U))X=U}let G=Y?.get("retry-after");if(G&&!X){let U=parseFloat(G);if(!Number.isNaN(U))X=U*1000;else X=Date.parse(G)-Date.now()}if(X===void 0){let U=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Q,U)}return await EN(X),this.makeRequest($,Q-1,J)}calculateDefaultRetryTimeoutMillis($,Q){let X=Q-$,W=Math.min(0.5*Math.pow(2,X),8),G=1-Math.random()*0.25;return W*G*1000}calculateNonstreamingTimeout($,Q){if(3600000*$/128000>600000||Q!=null&&$>Q)throw new g("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Q=0}={}){let J={...$},{method:Y,path:X,query:W,defaultBaseURL:G}=J;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let U=this.buildURL(X,W,G);if("timeout"in J)PN("timeout",J.timeout);J.timeout=J.timeout??this.timeout;let{bodyHeaders:H,body:q}=this.buildBody({options:J}),V=await this.buildHeaders({options:$,method:Y,bodyHeaders:H,retryCount:Q});return{req:{method:Y,headers:V,...J.signal&&{signal:J.signal},...globalThis.ReadableStream&&q instanceof globalThis.ReadableStream&&{duplex:"half"},...q&&{body:q},...this.fetchOptions??{},...J.fetchOptions??{}},url:U,timeout:J.timeout}}async buildHeaders({options:$,method:Q,bodyHeaders:J,retryCount:Y}){let X={};if(this.idempotencyHeader&&Q!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let W=R([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Y),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...a9(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,J,$.headers]);return this.validateHeaders(W),W.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Q}}){if(!$)return{bodyHeaders:void 0,body:void 0};let J=R([Q]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&J.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:DX($)};else if(typeof $==="object"&&J.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return Z(this,nX,"f").call(this,{body:$,headers:J})}}QU=f$,nX=new WeakMap,$U=new WeakSet,Ew=function(){return this.baseURL!=="https://api.anthropic.com"};f$.Anthropic=QU;f$.HUMAN_PROMPT=bw;f$.AI_PROMPT=_w;f$.DEFAULT_TIMEOUT=600000;f$.AnthropicError=g;f$.APIError=n$;f$.APIConnectionError=e1;f$.APIConnectionTimeoutError=l9;f$.APIUserAbortError=Q6;f$.NotFoundError=i9;f$.ConflictError=n9;f$.RateLimitError=o9;f$.BadRequestError=c9;f$.AuthenticationError=p9;f$.InternalServerError=t9;f$.PermissionDeniedError=d9;f$.UnprocessableEntityError=r9;f$.toFile=_X;class K0 extends f${constructor(){super(...arguments);this.completions=new V8(this),this.messages=new H0(this),this.models=new z8(this),this.beta=new G6(this)}}K0.Completions=V8;K0.Messages=H0;K0.Models=z8;K0.Beta=G6;function j4($){return $ instanceof Error?$:Error(String($))}function N8($){return $ instanceof Error?$.message:String($)}function o$($){if($&&typeof $==="object"&&"code"in $&&typeof $.code==="string")return $.code;return}function D1($){return o$($)==="ENOENT"}function JU($){return o$($)==="EISDIR"}function Sw($){let Q=o$($);return Q==="ENOENT"||Q==="EACCES"||Q==="EPERM"||Q==="ENOTDIR"||Q==="ELOOP"||Q==="EROFS"}import{randomUUID as Tv}from"crypto";import{join as xw}from"path";import{AsyncLocalStorage as bv}from"async_hooks";import{appendFile as _v,mkdir as Sv,readdir as vw,readFile as Cw,stat as kv,unlink as vv,writeFile as YU}from"fs/promises";import{randomBytes as jv}from"crypto";import{copyFile as Av,rename as Iv,unlink as XU,writeFile as Rv}from"fs/promises";var Pv=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),Ev=new Set(["ENOSPC","EIO","EDQUOT","EFBIG"]);async function kw($,Q,J){let Y=`${$}.tmp.${jv(4).toString("hex")}`;try{await Rv(Y,Q,{encoding:"utf8",mode:J});try{await Iv(Y,$)}catch(X){let W=o$(X);if(W!==void 0&&Pv.has(W)){try{await Av(Y,$)}catch(G){if(Ev.has(o$(G)??""))await XU($).catch(()=>{});throw G}await XU(Y).catch(()=>{})}else throw X}}catch(X){throw await XU(Y).catch(()=>{}),X}}class Tw{read($){return Cw($,"utf8")}readBytes($){return Cw($)}write($,Q,J){return YU($,Q,{encoding:"utf8",mode:J})}async mkdir($){try{await Sv($,{recursive:!0})}catch(Q){if(o$(Q)!=="EEXIST")throw Q}}atomicWrite($,Q,J){return kw($,Q,J)}delete($){return vv($)}list($){return vw($)}append($,Q,J){return _v($,Q,{encoding:"utf8",mode:J})}writeExclusive($,Q){return YU($,Q,{encoding:"utf8",flag:"wx"})}writeBytes($,Q){return YU($,Q)}async stat($){return{mtimeMs:(await kv($)).mtimeMs}}async listEntries($){return(await vw($,{withFileTypes:!0})).map((J)=>({name:J.name,isDirectory:J.isDirectory(),isFile:J.isFile()}))}}var Cv=new bv;function w8(){return Cv.getStore()??new Tw}var q0,O8=null;function yw(){if(O8)return O8;if(!A$(process.env.DEBUG_CLAUDE_AGENT_SDK))return q0=null,O8=Promise.resolve(),O8;let $=xw(p6(),"debug");return q0=xw($,`sdk-${Tv()}.txt`),process.stderr.write(`SDK debug logs: ${q0}
57
57
  `),O8=w8().mkdir($).catch(()=>{}),O8}function fw(){return yw(),q0??null}function L6($){if(q0===null)return;let J=`${new Date().toISOString()} ${$}
58
- `;yw().then(()=>{if(q0)w8().append(q0,J).catch(()=>{})})}function xv(){this.__data__=new q1,this.size=0}var gw=xv;function yv($){var Q=this.__data__,J=Q.delete($);return this.size=Q.size,J}var hw=yv;function fv($){return this.__data__.get($)}var uw=fv;function gv($){return this.__data__.has($)}var mw=gv;var hv=200;function uv($,Q){var J=this.__data__;if(J instanceof q1){var Y=J.__data__;if(!NX||Y.length<hv-1)return Y.push([$,Q]),this.size=++J.size,this;J=this.__data__=new u9(Y)}return J.set($,Q),this.size=J.size,this}var lw=uv;function D8($){var Q=this.__data__=new q1($);this.size=Q.size}D8.prototype.clear=gw;D8.prototype.delete=hw;D8.prototype.get=uw;D8.prototype.has=mw;D8.prototype.set=lw;var cw=D8;var mv=function(){try{var $=t0(Object,"defineProperty");return $({},"",{}),$}catch(Q){}}(),F8=mv;function lv($,Q,J){if(Q=="__proto__"&&F8)F8($,Q,{configurable:!0,enumerable:!0,value:J,writable:!0});else $[Q]=J}var Z8=lv;var cv=Object.prototype,pv=cv.hasOwnProperty;function dv($,Q,J){var Y=$[Q];if(!(pv.call($,Q)&&H1(Y,J))||J===void 0&&!(Q in $))Z8($,Q,J)}var rX=dv;function iv($,Q,J,Y){var X=!J;J||(J={});var W=-1,G=Q.length;while(++W<G){var U=Q[W],H=Y?Y(J[U],$[U],U,J,$):void 0;if(H===void 0)H=$[U];if(X)Z8(J,U,H);else rX(J,U,H)}return J}var pw=iv;function nv($,Q){var J=-1,Y=Array($);while(++J<$)Y[J]=Q(J);return Y}var dw=nv;function rv($){return $!=null&&typeof $=="object"}var r6=rv;var ov="[object Arguments]";function tv($){return r6($)&&L4($)==ov}var WU=tv;var iw=Object.prototype,av=iw.hasOwnProperty,sv=iw.propertyIsEnumerable,ev=WU(function(){return arguments}())?WU:function($){return r6($)&&av.call($,"callee")&&!sv.call($,"callee")},h4=ev;var $C=Array.isArray,B6=$C;var tX={};M4(tX,{default:()=>TQ});function QC(){return!1}var nw=QC;var tw=typeof tX=="object"&&tX&&!tX.nodeType&&tX,rw=tw&&typeof oX=="object"&&oX&&!oX.nodeType&&oX,JC=rw&&rw.exports===tw,ow=JC?l6.Buffer:void 0,XC=ow?ow.isBuffer:void 0,YC=XC||nw,TQ=YC;var WC=9007199254740991,GC=/^(?:0|[1-9]\d*)$/;function UC($,Q){var J=typeof $;return Q=Q==null?WC:Q,!!Q&&(J=="number"||J!="symbol"&&GC.test($))&&($>-1&&$%1==0&&$<Q)}var F1=UC;var HC=9007199254740991;function KC($){return typeof $=="number"&&$>-1&&$%1==0&&$<=HC}var M8=KC;var qC="[object Arguments]",VC="[object Array]",BC="[object Boolean]",zC="[object Date]",NC="[object Error]",wC="[object Function]",OC="[object Map]",DC="[object Number]",FC="[object Object]",ZC="[object RegExp]",MC="[object Set]",LC="[object String]",jC="[object WeakMap]",AC="[object ArrayBuffer]",IC="[object DataView]",RC="[object Float32Array]",PC="[object Float64Array]",EC="[object Int8Array]",bC="[object Int16Array]",_C="[object Int32Array]",SC="[object Uint8Array]",kC="[object Uint8ClampedArray]",vC="[object Uint16Array]",CC="[object Uint32Array]",_$={};_$[RC]=_$[PC]=_$[EC]=_$[bC]=_$[_C]=_$[SC]=_$[kC]=_$[vC]=_$[CC]=!0;_$[qC]=_$[VC]=_$[AC]=_$[BC]=_$[IC]=_$[zC]=_$[NC]=_$[wC]=_$[OC]=_$[DC]=_$[FC]=_$[ZC]=_$[MC]=_$[LC]=_$[jC]=!1;function TC($){return r6($)&&M8($.length)&&!!_$[L4($)]}var aw=TC;function xC($){return function(Q){return $(Q)}}var sw=xC;var sX={};M4(sX,{default:()=>eX});var ew=typeof sX=="object"&&sX&&!sX.nodeType&&sX,xQ=ew&&typeof aX=="object"&&aX&&!aX.nodeType&&aX,yC=xQ&&xQ.exports===ew,GU=yC&&BX.process,fC=function(){try{var $=xQ&&xQ.require&&xQ.require("util").types;if($)return $;return GU&&GU.binding&&GU.binding("util")}catch(Q){}}(),eX=fC;var $O=eX&&eX.isTypedArray,gC=$O?sw($O):aw,$5=gC;var hC=Object.prototype,uC=hC.hasOwnProperty;function mC($,Q){var J=B6($),Y=!J&&h4($),X=!J&&!Y&&TQ($),W=!J&&!Y&&!X&&$5($),G=J||Y||X||W,U=G?dw($.length,String):[],H=U.length;for(var q in $)if((Q||uC.call($,q))&&!(G&&(q=="length"||X&&(q=="offset"||q=="parent")||W&&(q=="buffer"||q=="byteLength"||q=="byteOffset")||F1(q,H))))U.push(q);return U}var QO=mC;var lC=Object.prototype;function cC($){var Q=$&&$.constructor,J=typeof Q=="function"&&Q.prototype||lC;return $===J}var Q5=cC;function pC($,Q){return function(J){return $(Q(J))}}var JO=pC;function dC($){return $!=null&&M8($.length)&&!o0($)}var L8=dC;function iC($){var Q=[];if($!=null)for(var J in Object($))Q.push(J);return Q}var XO=iC;var nC=Object.prototype,rC=nC.hasOwnProperty;function oC($){if(!$6($))return XO($);var Q=Q5($),J=[];for(var Y in $)if(!(Y=="constructor"&&(Q||!rC.call($,Y))))J.push(Y);return J}var YO=oC;function tC($){return L8($)?QO($,!0):YO($)}var J5=tC;var Y5={};M4(Y5,{default:()=>UU});var HO=typeof Y5=="object"&&Y5&&!Y5.nodeType&&Y5,WO=HO&&typeof X5=="object"&&X5&&!X5.nodeType&&X5,aC=WO&&WO.exports===HO,GO=aC?l6.Buffer:void 0,UO=GO?GO.allocUnsafe:void 0;function sC($,Q){if(Q)return $.slice();var J=$.length,Y=UO?UO(J):new $.constructor(J);return $.copy(Y),Y}var UU=sC;function eC($,Q){var J=-1,Y=$.length;Q||(Q=Array(Y));while(++J<Y)Q[J]=$[J];return Q}var KO=eC;function $T($,Q){var J=-1,Y=Q.length,X=$.length;while(++J<Y)$[X+J]=Q[J];return $}var qO=$T;var QT=JO(Object.getPrototypeOf,Object),W5=QT;var JT=l6.Uint8Array,HU=JT;function XT($){var Q=new $.constructor($.byteLength);return new HU(Q).set(new HU($)),Q}var VO=XT;function YT($,Q){var J=Q?VO($.buffer):$.buffer;return new $.constructor(J,$.byteOffset,$.length)}var BO=YT;var zO=Object.create,WT=function(){function $(){}return function(Q){if(!$6(Q))return{};if(zO)return zO(Q);$.prototype=Q;var J=new $;return $.prototype=void 0,J}}(),NO=WT;function GT($){return typeof $.constructor=="function"&&!Q5($)?NO(W5($)):{}}var wO=GT;import{realpathSync as fO}from"fs";var UT="[object Symbol]";function HT($){return typeof $=="symbol"||r6($)&&L4($)==UT}var j8=HT;var KT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qT=/^\w*$/;function VT($,Q){if(B6($))return!1;var J=typeof $;if(J=="number"||J=="symbol"||J=="boolean"||$==null||j8($))return!0;return qT.test($)||!KT.test($)||Q!=null&&$ in Object(Q)}var OO=VT;var BT=500;function zT($){var Q=v$($,function(Y){if(J.size===BT)J.clear();return Y}),J=Q.cache;return Q}var DO=zT;var NT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wT=/\\(\\)?/g,OT=DO(function($){var Q=[];if($.charCodeAt(0)===46)Q.push("");return $.replace(NT,function(J,Y,X,W){Q.push(X?W.replace(wT,"$1"):Y||J)}),Q}),FO=OT;function DT($,Q){var J=-1,Y=$==null?0:$.length,X=Array(Y);while(++J<Y)X[J]=Q($[J],J,$);return X}var ZO=DT;var FT=1/0,MO=c6?c6.prototype:void 0,LO=MO?MO.toString:void 0;function jO($){if(typeof $=="string")return $;if(B6($))return ZO($,jO)+"";if(j8($))return LO?LO.call($):"";var Q=$+"";return Q=="0"&&1/$==-FT?"-0":Q}var AO=jO;function ZT($){return $==null?"":AO($)}var IO=ZT;function MT($,Q){if(B6($))return $;return OO($,Q)?[$]:FO(IO($))}var Z1=MT;var LT=1/0;function jT($){if(typeof $=="string"||j8($))return $;var Q=$+"";return Q=="0"&&1/$==-LT?"-0":Q}var A8=jT;function AT($,Q){Q=Z1(Q,$);var J=0,Y=Q.length;while($!=null&&J<Y)$=$[A8(Q[J++])];return J&&J==Y?$:void 0}var RO=AT;function IT($,Q){return $!=null&&Q in Object($)}var PO=IT;function RT($,Q,J){Q=Z1(Q,$);var Y=-1,X=Q.length,W=!1;while(++Y<X){var G=A8(Q[Y]);if(!(W=$!=null&&J($,G)))break;$=$[G]}if(W||++Y!=X)return W;return X=$==null?0:$.length,!!X&&M8(X)&&F1(G,X)&&(B6($)||h4($))}var EO=RT;function PT($,Q){return $!=null&&EO($,Q,PO)}var bO=PT;function ET($){return $}var G5=ET;import{cwd as ST}from"process";import{randomUUID as yQ}from"crypto";var KU=null;function _O(){return KU}function SO($){KU=$}var U5=new Map;function kO($){return U5.has($)?U5.get($):void 0}function vO($,Q){U5.set($,Q)}var bT;var qU=new Map;function CO($){return qU.get($)}function TO($,Q){qU.set($,Q)}function V0(){KU=null,U5.clear(),qU.clear(),bT=void 0}var _T;function xO(){return _T}function yO(){return{sent:new Set,rejected:new Set}}var kT={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function vT(){let $="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof fO==="function"){let J=ST();try{$=fO(J).normalize("NFC")}catch{$=J.normalize("NFC")}}return{originalCwd:$,projectRoot:$,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:$,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackPreviousTurn:!1,replConfigArgv:[],initialMainLoopModel:void 0,modelStrings:null,isInteractive:!1,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,kairosActive:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,flagSettingsPath:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:yQ(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginUrls:[],chromeFlagOverride:void 0,useCoworkPlugins:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:kT,replBridgeActive:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],activeInputs:new Map,hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:yO(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var CT=vT(),TT=()=>{return};function VU(){return TT()?.sessionId??CT.sessionId}var xT=U1(),mY$=xT.subscribe;var yT=U1(),lY$=yT.subscribe;var fT=U1(),cY$=fT.subscribe;var gT=U1();var pY$=gT.subscribe;var hT=U1();var dY$=hT.subscribe;import{appendFile as sO,mkdir as Wx,rename as eO,stat as Gx,symlink as Ux,unlink as wU}from"fs/promises";import{dirname as $2,join as MU}from"path";function gO({writeFn:$,flushIntervalMs:Q=1000,maxBufferSize:J=100,maxBufferBytes:Y=1/0,immediateMode:X=!1}){let W=[],G=0,U=null,H=null;function q(){if(U)clearTimeout(U),U=null}function V(w){try{$(w)}catch{}}function B(){if(H)V(H.join("")),H=null;if(W.length===0)return;V(W.join("")),W=[],G=0,q()}function z(){if(!U)U=setTimeout(B,Q)}function N(){if(H){H.push(...W),W=[],G=0,q();return}let w=W;W=[],G=0,q(),H=w,setImmediate(()=>{let O=H;if(H=null,O)V(O.join(""))})}return{write(w){if(X){V(w);return}if(W.push(w),G+=w.length,z(),W.length>=J||G>=Y)N()},flush:B,dispose(){B()}}}function uT($){if(typeof $==="function")return $;if(Symbol.asyncDispose in $)return()=>$[Symbol.asyncDispose]();return()=>$[Symbol.dispose]()}class hO{#X=new Set;register($){let Q=uT($);this.#X.add(Q);let J=()=>{this.#X.delete(Q)};return Object.assign(J,{[Symbol.dispose]:J})}async drain(){let $=Array.from(this.#X);this.#X.clear(),await Promise.all($.map(async(Q)=>Q()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#X.size}}var mT=new hO;function uO($){return mT.register($)}var mO=v$(($)=>{if(!$||$.trim()==="")return null;let Q=$.split(",").map((W)=>W.trim()).filter(Boolean);if(Q.length===0)return null;let J=Q.some((W)=>W.startsWith("!")),Y=Q.some((W)=>!W.startsWith("!"));if(J&&Y)return null;let X=Q.map((W)=>W.replace(/^!/,"").toLowerCase());return{include:J?[]:X,exclude:J?X:[],isExclusive:J}});function lT($){let Q=[],J=$.match(/^MCP server ["']([^"']+)["']/);if(J&&J[1])Q.push("mcp"),Q.push(J[1].toLowerCase());else{let W=$.match(/^([^:[]+):/);if(W&&W[1])Q.push(W[1].trim().toLowerCase())}let Y=$.match(/^\[([^\]]+)]/);if(Y&&Y[1])Q.push(Y[1].trim().toLowerCase());if($.toLowerCase().includes("1p event:"))Q.push("1p");let X=$.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(X&&X[1]){let W=X[1].trim().toLowerCase();if(W.length<30&&!W.includes(" "))Q.push(W)}return Array.from(new Set(Q))}function cT($,Q){if(!Q)return!0;if($.length===0)return!1;if(Q.isExclusive)return!$.some((J)=>Q.exclude.includes(J));else return $.some((J)=>Q.include.includes(J))}function lO($,Q){if(!Q)return!0;let J=lT($);return cT(J,Q)}import*as s from"fs";import{mkdir as pT,open as dT,readdir as iT,readFile as pO,rename as nT,rmdir as rT,rm as oT,stat as tT,unlink as aT}from"fs/promises";function cO($){return/^[\\/]{2}/.test($)}function H5($,Q){if(cO(Q))return{resolvedPath:Q,isSymlink:!1,isCanonical:!1};try{let J=$.lstatSync(Q);if(J.isFIFO()||J.isSocket()||J.isCharacterDevice()||J.isBlockDevice())return{resolvedPath:Q,isSymlink:!1,isCanonical:!1};let Y=$.realpathSync(Q);return{resolvedPath:Y,isSymlink:Y!==Q,isCanonical:!0}}catch(J){return{resolvedPath:Q,isSymlink:!1,isCanonical:!1}}}var sT={cwd(){return process.cwd()},existsSync($){let J=[];try{const Q=R$(J,C$`fs.existsSync(${$})`,0);return s.existsSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},async stat($){return tT($)},async readdir($){return iT($,{withFileTypes:!0})},async unlink($){return aT($)},async rmdir($){return rT($)},async rm($,Q){return oT($,Q)},async mkdir($,Q){try{await pT($,{recursive:!0,...Q})}catch(J){if(o$(J)!=="EEXIST")throw J}},async readFile($,Q){return pO($,{encoding:Q.encoding})},async rename($,Q){return nT($,Q)},statSync($){let J=[];try{const Q=R$(J,C$`fs.statSync(${$})`,0);return s.statSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},lstatSync($){let J=[];try{const Q=R$(J,C$`fs.lstatSync(${$})`,0);return s.lstatSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},readFileSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.readFileSync(${$})`,0);return s.readFileSync($,{encoding:Q.encoding})}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},readFileBytesSync($){let J=[];try{const Q=R$(J,C$`fs.readFileBytesSync(${$})`,0);return s.readFileSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},readSync($,Q){let X=[];try{const J=R$(X,C$`fs.readSync(${$}, ${Q.length} bytes)`,0);let Y=void 0;try{Y=s.openSync($,"r");let H=Buffer.alloc(Q.length),q=s.readSync(Y,H,0,Q.length,0);return{buffer:H,bytesRead:q}}finally{if(Y)s.closeSync(Y)}}catch(W){var G=W,U=1}finally{P$(X,G,U)}},appendFileSync($,Q,J){let X=[];try{const Y=R$(X,C$`fs.appendFileSync(${$}, ${Q.length} chars)`,0);if(J?.mode!==void 0)try{let H=s.openSync($,"ax",J.mode);try{s.appendFileSync(H,Q)}finally{s.closeSync(H)}return}catch(H){if(o$(H)!=="EEXIST")throw H}s.appendFileSync($,Q)}catch(W){var G=W,U=1}finally{P$(X,G,U)}},copyFileSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.copyFileSync(${$} → ${Q})`,0);s.copyFileSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},unlinkSync($){let J=[];try{const Q=R$(J,C$`fs.unlinkSync(${$})`,0);s.unlinkSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},renameSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.renameSync(${$} → ${Q})`,0);s.renameSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},linkSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.linkSync(${$} → ${Q})`,0);s.linkSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},symlinkSync($,Q,J){let X=[];try{const Y=R$(X,C$`fs.symlinkSync(${$} → ${Q})`,0);s.symlinkSync($,Q,J)}catch(W){var G=W,U=1}finally{P$(X,G,U)}},readlinkSync($){let J=[];try{const Q=R$(J,C$`fs.readlinkSync(${$})`,0);return s.readlinkSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},realpathSync($){let J=[];try{const Q=R$(J,C$`fs.realpathSync(${$})`,0);return s.realpathSync($).normalize("NFC")}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},mkdirSync($,Q){let X=[];try{const J=R$(X,C$`fs.mkdirSync(${$})`,0);let Y={recursive:!0};if(Q?.mode!==void 0)Y.mode=Q.mode;try{s.mkdirSync($,Y)}catch(H){if(o$(H)!=="EEXIST")throw H}}catch(W){var G=W,U=1}finally{P$(X,G,U)}},readdirSync($){let J=[];try{const Q=R$(J,C$`fs.readdirSync(${$})`,0);return s.readdirSync($,{withFileTypes:!0})}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},readdirStringSync($){let J=[];try{const Q=R$(J,C$`fs.readdirStringSync(${$})`,0);return s.readdirSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},isDirEmptySync($){let Y=[];try{const Q=R$(Y,C$`fs.isDirEmptySync(${$})`,0);let J=this.readdirSync($);return J.length===0}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},rmdirSync($){let J=[];try{const Q=R$(J,C$`fs.rmdirSync(${$})`,0);s.rmdirSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},rmSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.rmSync(${$})`,0);s.rmSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},createWriteStream($){return s.createWriteStream($)},async readFileBytes($,Q){if(Q===void 0)return pO($);let J=await dT($,"r");try{let{size:Y}=await J.stat(),X=Math.min(Y,Q),W=Buffer.allocUnsafe(X),G=0;while(G<X){let{bytesRead:U}=await J.read(W,G,X-G,G);if(U===0)break;G+=U}return G<X?W.subarray(0,G):W}finally{await J.close()}}},eT=sT;function c$(){return eT}function $x($,Q){if($.destroyed)return;$.write(Q)}function dO($){$x(process.stderr,$)}function BU($){return $.charAt(0).toUpperCase()+$.slice(1)}function iO($,Q,J=Q+"s"){return $===1?Q:J}var H3$=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,K3$=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function nO($,Q){let J=$.indexOf(Q);return J===-1?$:$.slice(0,J)}var Qx=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,rO="[^\\s,;&}\\])]+",oO=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${rO})|${rO}`,Jx=["sk","ant","api"].join("-"),Xx=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${Qx.source})[\\w.-]*["']?\\s*[=:]\\s*(${oO})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${oO})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:`\\b(AIza[\\w-]{35})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${Jx}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:`\\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",flags:"i",confidence:"high"}];var tO=null;function Yx($){return Xx.map((Q)=>({id:Q.id,confidence:Q.confidence,re:new RegExp(Q.source,$?(Q.flags??"").replace("g","")+"g":Q.flags??"")}))}function aO($){tO??=Yx(!0);for(let Q of tO)$=$.replace(Q.re,(J,Y)=>{if(typeof Y!=="string")return"[REDACTED]";let X=Y.length>=2&&(Y[0]==='"'||Y[0]==="'")&&Y.at(-1)===Y[0]?Y[0]:"",W=J.lastIndexOf(Y);return`${J.slice(0,W)}${X}[REDACTED]${X}${J.slice(W+Y.length)}`});return $}var OU={verbose:0,debug:1,info:2,warn:3,error:4},Hx=v$(()=>{let $=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if($&&Object.hasOwn(OU,$))return $;return"debug"}),Kx=!1;function q5(){return typeof process<"u"&&Array.isArray(process.argv)?process.argv:[]}var DU=v$(()=>{let $=q5();return Kx||A$(process.env.DEBUG)||A$(process.env.DEBUG_SDK)||$.includes("--debug")||$.includes("-d")||Q2()||$.some((Q)=>Q.startsWith("--debug="))||J2()!==null});var qx=v$(()=>{let $=q5().find((J)=>J.startsWith("--debug="));if(!$)return null;let Q=$.substring(8);return mO(Q)}),Q2=v$(()=>{let $=q5();return $.includes("--debug-to-stderr")||$.includes("-d2e")}),J2=v$(()=>{let $=q5();for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J.startsWith("--debug-file="))return J.substring(13);if(J==="--debug-file"&&Q+1<$.length)return $[Q+1]}return null});function Vx($){if(!DU())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let Q=qx();return lO($,Q)}var Bx=!1;var zx=10485760,K5=null,zU=Promise.resolve(),fQ=-1,NU=!1,FU=null;async function X2($,Q,J=zx){if(fQ<0)fQ=await Gx($).then((Y)=>Y.size).catch(()=>0);else fQ+=Q;if(fQ<=J||NU)return;NU=!0;try{let Y=$.endsWith(".txt")?`${$.slice(0,-4)}.1.txt`:`${$}.1`;try{await eO($,Y)}catch(X){if(!D1(X))await wU(Y).catch(()=>{}),await eO($,Y).catch(()=>wU($).catch(()=>{}))}fQ=0}finally{NU=!1}}function Y2($){return FU=MU($,`${VU()}.txt`),FU}async function Nx($,Q,J,Y){if($)await Wx(Q,{recursive:!0}).catch(()=>{});let X=J;try{await sO(J,Y)}catch(W){if(!JU(W))throw W;X=Y2(J),await sO(X,Y)}await X2(X,Buffer.byteLength(Y)).catch(ZU),G2()}function ZU(){}function wx(){if(!K5){let $=null;K5=gO({writeFn:(Q)=>{let J=W2(),Y=$2(J),X=$!==Y;if($=Y,DU()){if(X)try{c$().mkdirSync(Y)}catch{}let W=J;try{c$().appendFileSync(J,Q)}catch(G){if(!JU(G))throw G;W=Y2(J),c$().appendFileSync(W,Q)}X2(W,Buffer.byteLength(Q)).catch(ZU),G2();return}zU=zU.then(Nx.bind(null,X,Y,J,Q)).catch(ZU)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:DU()}),uO(async()=>{K5?.dispose(),await zU})}return K5}function X$($,{level:Q}={level:"debug"}){if(OU[Q]<OU[Hx()])return;if(!Vx($))return;if(Bx&&$.includes(`
58
+ `;yw().then(()=>{if(q0)w8().append(q0,J).catch(()=>{})})}function xv(){this.__data__=new q1,this.size=0}var gw=xv;function yv($){var Q=this.__data__,J=Q.delete($);return this.size=Q.size,J}var hw=yv;function fv($){return this.__data__.get($)}var uw=fv;function gv($){return this.__data__.has($)}var mw=gv;var hv=200;function uv($,Q){var J=this.__data__;if(J instanceof q1){var Y=J.__data__;if(!NX||Y.length<hv-1)return Y.push([$,Q]),this.size=++J.size,this;J=this.__data__=new u9(Y)}return J.set($,Q),this.size=J.size,this}var lw=uv;function D8($){var Q=this.__data__=new q1($);this.size=Q.size}D8.prototype.clear=gw;D8.prototype.delete=hw;D8.prototype.get=uw;D8.prototype.has=mw;D8.prototype.set=lw;var cw=D8;var mv=function(){try{var $=t0(Object,"defineProperty");return $({},"",{}),$}catch(Q){}}(),F8=mv;function lv($,Q,J){if(Q=="__proto__"&&F8)F8($,Q,{configurable:!0,enumerable:!0,value:J,writable:!0});else $[Q]=J}var Z8=lv;var cv=Object.prototype,pv=cv.hasOwnProperty;function dv($,Q,J){var Y=$[Q];if(!(pv.call($,Q)&&H1(Y,J))||J===void 0&&!(Q in $))Z8($,Q,J)}var rX=dv;function iv($,Q,J,Y){var X=!J;J||(J={});var W=-1,G=Q.length;while(++W<G){var U=Q[W],H=Y?Y(J[U],$[U],U,J,$):void 0;if(H===void 0)H=$[U];if(X)Z8(J,U,H);else rX(J,U,H)}return J}var pw=iv;function nv($,Q){var J=-1,Y=Array($);while(++J<$)Y[J]=Q(J);return Y}var dw=nv;function rv($){return $!=null&&typeof $=="object"}var r6=rv;var ov="[object Arguments]";function tv($){return r6($)&&L4($)==ov}var WU=tv;var iw=Object.prototype,av=iw.hasOwnProperty,sv=iw.propertyIsEnumerable,ev=WU(function(){return arguments}())?WU:function($){return r6($)&&av.call($,"callee")&&!sv.call($,"callee")},h4=ev;var $C=Array.isArray,B6=$C;var tX={};M4(tX,{default:()=>TQ});function QC(){return!1}var nw=QC;var tw=typeof tX=="object"&&tX&&!tX.nodeType&&tX,rw=tw&&typeof oX=="object"&&oX&&!oX.nodeType&&oX,JC=rw&&rw.exports===tw,ow=JC?l6.Buffer:void 0,XC=ow?ow.isBuffer:void 0,YC=XC||nw,TQ=YC;var WC=9007199254740991,GC=/^(?:0|[1-9]\d*)$/;function UC($,Q){var J=typeof $;return Q=Q==null?WC:Q,!!Q&&(J=="number"||J!="symbol"&&GC.test($))&&($>-1&&$%1==0&&$<Q)}var F1=UC;var HC=9007199254740991;function KC($){return typeof $=="number"&&$>-1&&$%1==0&&$<=HC}var M8=KC;var qC="[object Arguments]",VC="[object Array]",BC="[object Boolean]",zC="[object Date]",NC="[object Error]",wC="[object Function]",OC="[object Map]",DC="[object Number]",FC="[object Object]",ZC="[object RegExp]",MC="[object Set]",LC="[object String]",jC="[object WeakMap]",AC="[object ArrayBuffer]",IC="[object DataView]",RC="[object Float32Array]",PC="[object Float64Array]",EC="[object Int8Array]",bC="[object Int16Array]",_C="[object Int32Array]",SC="[object Uint8Array]",kC="[object Uint8ClampedArray]",vC="[object Uint16Array]",CC="[object Uint32Array]",_$={};_$[RC]=_$[PC]=_$[EC]=_$[bC]=_$[_C]=_$[SC]=_$[kC]=_$[vC]=_$[CC]=!0;_$[qC]=_$[VC]=_$[AC]=_$[BC]=_$[IC]=_$[zC]=_$[NC]=_$[wC]=_$[OC]=_$[DC]=_$[FC]=_$[ZC]=_$[MC]=_$[LC]=_$[jC]=!1;function TC($){return r6($)&&M8($.length)&&!!_$[L4($)]}var aw=TC;function xC($){return function(Q){return $(Q)}}var sw=xC;var sX={};M4(sX,{default:()=>eX});var ew=typeof sX=="object"&&sX&&!sX.nodeType&&sX,xQ=ew&&typeof aX=="object"&&aX&&!aX.nodeType&&aX,yC=xQ&&xQ.exports===ew,GU=yC&&BX.process,fC=function(){try{var $=xQ&&xQ.require&&xQ.require("util").types;if($)return $;return GU&&GU.binding&&GU.binding("util")}catch(Q){}}(),eX=fC;var $O=eX&&eX.isTypedArray,gC=$O?sw($O):aw,$5=gC;var hC=Object.prototype,uC=hC.hasOwnProperty;function mC($,Q){var J=B6($),Y=!J&&h4($),X=!J&&!Y&&TQ($),W=!J&&!Y&&!X&&$5($),G=J||Y||X||W,U=G?dw($.length,String):[],H=U.length;for(var q in $)if((Q||uC.call($,q))&&!(G&&(q=="length"||X&&(q=="offset"||q=="parent")||W&&(q=="buffer"||q=="byteLength"||q=="byteOffset")||F1(q,H))))U.push(q);return U}var QO=mC;var lC=Object.prototype;function cC($){var Q=$&&$.constructor,J=typeof Q=="function"&&Q.prototype||lC;return $===J}var Q5=cC;function pC($,Q){return function(J){return $(Q(J))}}var JO=pC;function dC($){return $!=null&&M8($.length)&&!o0($)}var L8=dC;function iC($){var Q=[];if($!=null)for(var J in Object($))Q.push(J);return Q}var XO=iC;var nC=Object.prototype,rC=nC.hasOwnProperty;function oC($){if(!$6($))return XO($);var Q=Q5($),J=[];for(var Y in $)if(!(Y=="constructor"&&(Q||!rC.call($,Y))))J.push(Y);return J}var YO=oC;function tC($){return L8($)?QO($,!0):YO($)}var J5=tC;var Y5={};M4(Y5,{default:()=>UU});var HO=typeof Y5=="object"&&Y5&&!Y5.nodeType&&Y5,WO=HO&&typeof X5=="object"&&X5&&!X5.nodeType&&X5,aC=WO&&WO.exports===HO,GO=aC?l6.Buffer:void 0,UO=GO?GO.allocUnsafe:void 0;function sC($,Q){if(Q)return $.slice();var J=$.length,Y=UO?UO(J):new $.constructor(J);return $.copy(Y),Y}var UU=sC;function eC($,Q){var J=-1,Y=$.length;Q||(Q=Array(Y));while(++J<Y)Q[J]=$[J];return Q}var KO=eC;function $T($,Q){var J=-1,Y=Q.length,X=$.length;while(++J<Y)$[X+J]=Q[J];return $}var qO=$T;var QT=JO(Object.getPrototypeOf,Object),W5=QT;var JT=l6.Uint8Array,HU=JT;function XT($){var Q=new $.constructor($.byteLength);return new HU(Q).set(new HU($)),Q}var VO=XT;function YT($,Q){var J=Q?VO($.buffer):$.buffer;return new $.constructor(J,$.byteOffset,$.length)}var BO=YT;var zO=Object.create,WT=function(){function $(){}return function(Q){if(!$6(Q))return{};if(zO)return zO(Q);$.prototype=Q;var J=new $;return $.prototype=void 0,J}}(),NO=WT;function GT($){return typeof $.constructor=="function"&&!Q5($)?NO(W5($)):{}}var wO=GT;import{realpathSync as fO}from"fs";var UT="[object Symbol]";function HT($){return typeof $=="symbol"||r6($)&&L4($)==UT}var j8=HT;var KT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qT=/^\w*$/;function VT($,Q){if(B6($))return!1;var J=typeof $;if(J=="number"||J=="symbol"||J=="boolean"||$==null||j8($))return!0;return qT.test($)||!KT.test($)||Q!=null&&$ in Object(Q)}var OO=VT;var BT=500;function zT($){var Q=v$($,function(Y){if(J.size===BT)J.clear();return Y}),J=Q.cache;return Q}var DO=zT;var NT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wT=/\\(\\)?/g,OT=DO(function($){var Q=[];if($.charCodeAt(0)===46)Q.push("");return $.replace(NT,function(J,Y,X,W){Q.push(X?W.replace(wT,"$1"):Y||J)}),Q}),FO=OT;function DT($,Q){var J=-1,Y=$==null?0:$.length,X=Array(Y);while(++J<Y)X[J]=Q($[J],J,$);return X}var ZO=DT;var FT=1/0,MO=c6?c6.prototype:void 0,LO=MO?MO.toString:void 0;function jO($){if(typeof $=="string")return $;if(B6($))return ZO($,jO)+"";if(j8($))return LO?LO.call($):"";var Q=$+"";return Q=="0"&&1/$==-FT?"-0":Q}var AO=jO;function ZT($){return $==null?"":AO($)}var IO=ZT;function MT($,Q){if(B6($))return $;return OO($,Q)?[$]:FO(IO($))}var Z1=MT;var LT=1/0;function jT($){if(typeof $=="string"||j8($))return $;var Q=$+"";return Q=="0"&&1/$==-LT?"-0":Q}var A8=jT;function AT($,Q){Q=Z1(Q,$);var J=0,Y=Q.length;while($!=null&&J<Y)$=$[A8(Q[J++])];return J&&J==Y?$:void 0}var RO=AT;function IT($,Q){return $!=null&&Q in Object($)}var PO=IT;function RT($,Q,J){Q=Z1(Q,$);var Y=-1,X=Q.length,W=!1;while(++Y<X){var G=A8(Q[Y]);if(!(W=$!=null&&J($,G)))break;$=$[G]}if(W||++Y!=X)return W;return X=$==null?0:$.length,!!X&&M8(X)&&F1(G,X)&&(B6($)||h4($))}var EO=RT;function PT($,Q){return $!=null&&EO($,Q,PO)}var bO=PT;function ET($){return $}var G5=ET;import{cwd as ST}from"process";import{randomUUID as yQ}from"crypto";var KU=null;function _O(){return KU}function SO($){KU=$}var U5=new Map;function kO($){return U5.has($)?U5.get($):void 0}function vO($,Q){U5.set($,Q)}var bT;var qU=new Map;function CO($){return qU.get($)}function TO($,Q){qU.set($,Q)}function V0(){KU=null,U5.clear(),qU.clear(),bT=void 0}var _T;function xO(){return _T}function yO(){return{sent:new Set,rejected:new Set}}var kT={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function vT(){let $="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof fO==="function"){let J=ST();try{$=fO(J).normalize("NFC")}catch{$=J.normalize("NFC")}}return{originalCwd:$,projectRoot:$,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:$,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackPreviousTurn:!1,replConfigArgv:[],initialMainLoopModel:void 0,modelStrings:null,isInteractive:!1,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,kairosActive:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:yQ(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginUrls:[],chromeFlagOverride:void 0,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:kT,replBridgeActive:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],activeInputs:new Map,hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:yO(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var CT=vT(),TT=()=>{return};function VU(){return TT()?.sessionId??CT.sessionId}var xT=U1(),mY$=xT.subscribe;var yT=U1(),lY$=yT.subscribe;var fT=U1(),cY$=fT.subscribe;var gT=U1();var pY$=gT.subscribe;var hT=U1();var dY$=hT.subscribe;import{appendFile as sO,mkdir as Wx,rename as eO,stat as Gx,symlink as Ux,unlink as wU}from"fs/promises";import{dirname as $2,join as MU}from"path";function gO({writeFn:$,flushIntervalMs:Q=1000,maxBufferSize:J=100,maxBufferBytes:Y=1/0,immediateMode:X=!1}){let W=[],G=0,U=null,H=null;function q(){if(U)clearTimeout(U),U=null}function V(w){try{$(w)}catch{}}function B(){if(H)V(H.join("")),H=null;if(W.length===0)return;V(W.join("")),W=[],G=0,q()}function z(){if(!U)U=setTimeout(B,Q)}function N(){if(H){H.push(...W),W=[],G=0,q();return}let w=W;W=[],G=0,q(),H=w,setImmediate(()=>{let O=H;if(H=null,O)V(O.join(""))})}return{write(w){if(X){V(w);return}if(W.push(w),G+=w.length,z(),W.length>=J||G>=Y)N()},flush:B,dispose(){B()}}}function uT($){if(typeof $==="function")return $;if(Symbol.asyncDispose in $)return()=>$[Symbol.asyncDispose]();return()=>$[Symbol.dispose]()}class hO{#X=new Set;register($){let Q=uT($);this.#X.add(Q);let J=()=>{this.#X.delete(Q)};return Object.assign(J,{[Symbol.dispose]:J})}async drain(){let $=Array.from(this.#X);this.#X.clear(),await Promise.all($.map(async(Q)=>Q()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#X.size}}var mT=new hO;function uO($){return mT.register($)}var mO=v$(($)=>{if(!$||$.trim()==="")return null;let Q=$.split(",").map((W)=>W.trim()).filter(Boolean);if(Q.length===0)return null;let J=Q.some((W)=>W.startsWith("!")),Y=Q.some((W)=>!W.startsWith("!"));if(J&&Y)return null;let X=Q.map((W)=>W.replace(/^!/,"").toLowerCase());return{include:J?[]:X,exclude:J?X:[],isExclusive:J}});function lT($){let Q=[],J=$.match(/^MCP server ["']([^"']+)["']/);if(J&&J[1])Q.push("mcp"),Q.push(J[1].toLowerCase());else{let W=$.match(/^([^:[]+):/);if(W&&W[1])Q.push(W[1].trim().toLowerCase())}let Y=$.match(/^\[([^\]]+)]/);if(Y&&Y[1])Q.push(Y[1].trim().toLowerCase());if($.toLowerCase().includes("1p event:"))Q.push("1p");let X=$.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(X&&X[1]){let W=X[1].trim().toLowerCase();if(W.length<30&&!W.includes(" "))Q.push(W)}return Array.from(new Set(Q))}function cT($,Q){if(!Q)return!0;if($.length===0)return!1;if(Q.isExclusive)return!$.some((J)=>Q.exclude.includes(J));else return $.some((J)=>Q.include.includes(J))}function lO($,Q){if(!Q)return!0;let J=lT($);return cT(J,Q)}import*as s from"fs";import{mkdir as pT,open as dT,readdir as iT,readFile as pO,rename as nT,rmdir as rT,rm as oT,stat as tT,unlink as aT}from"fs/promises";function cO($){return/^[\\/]{2}/.test($)}function H5($,Q){if(cO(Q))return{resolvedPath:Q,isSymlink:!1,isCanonical:!1};try{let J=$.lstatSync(Q);if(J.isFIFO()||J.isSocket()||J.isCharacterDevice()||J.isBlockDevice())return{resolvedPath:Q,isSymlink:!1,isCanonical:!1};let Y=$.realpathSync(Q);return{resolvedPath:Y,isSymlink:Y!==Q,isCanonical:!0}}catch(J){return{resolvedPath:Q,isSymlink:!1,isCanonical:!1}}}var sT={cwd(){return process.cwd()},existsSync($){let J=[];try{const Q=R$(J,C$`fs.existsSync(${$})`,0);return s.existsSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},async stat($){return tT($)},async readdir($){return iT($,{withFileTypes:!0})},async unlink($){return aT($)},async rmdir($){return rT($)},async rm($,Q){return oT($,Q)},async mkdir($,Q){try{await pT($,{recursive:!0,...Q})}catch(J){if(o$(J)!=="EEXIST")throw J}},async readFile($,Q){return pO($,{encoding:Q.encoding})},async rename($,Q){return nT($,Q)},statSync($){let J=[];try{const Q=R$(J,C$`fs.statSync(${$})`,0);return s.statSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},lstatSync($){let J=[];try{const Q=R$(J,C$`fs.lstatSync(${$})`,0);return s.lstatSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},readFileSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.readFileSync(${$})`,0);return s.readFileSync($,{encoding:Q.encoding})}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},readFileBytesSync($){let J=[];try{const Q=R$(J,C$`fs.readFileBytesSync(${$})`,0);return s.readFileSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},readSync($,Q){let X=[];try{const J=R$(X,C$`fs.readSync(${$}, ${Q.length} bytes)`,0);let Y=void 0;try{Y=s.openSync($,"r");let H=Buffer.alloc(Q.length),q=s.readSync(Y,H,0,Q.length,0);return{buffer:H,bytesRead:q}}finally{if(Y)s.closeSync(Y)}}catch(W){var G=W,U=1}finally{P$(X,G,U)}},appendFileSync($,Q,J){let X=[];try{const Y=R$(X,C$`fs.appendFileSync(${$}, ${Q.length} chars)`,0);if(J?.mode!==void 0)try{let H=s.openSync($,"ax",J.mode);try{s.appendFileSync(H,Q)}finally{s.closeSync(H)}return}catch(H){if(o$(H)!=="EEXIST")throw H}s.appendFileSync($,Q)}catch(W){var G=W,U=1}finally{P$(X,G,U)}},copyFileSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.copyFileSync(${$} → ${Q})`,0);s.copyFileSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},unlinkSync($){let J=[];try{const Q=R$(J,C$`fs.unlinkSync(${$})`,0);s.unlinkSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},renameSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.renameSync(${$} → ${Q})`,0);s.renameSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},linkSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.linkSync(${$} → ${Q})`,0);s.linkSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},symlinkSync($,Q,J){let X=[];try{const Y=R$(X,C$`fs.symlinkSync(${$} → ${Q})`,0);s.symlinkSync($,Q,J)}catch(W){var G=W,U=1}finally{P$(X,G,U)}},readlinkSync($){let J=[];try{const Q=R$(J,C$`fs.readlinkSync(${$})`,0);return s.readlinkSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},realpathSync($){let J=[];try{const Q=R$(J,C$`fs.realpathSync(${$})`,0);return s.realpathSync($).normalize("NFC")}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},mkdirSync($,Q){let X=[];try{const J=R$(X,C$`fs.mkdirSync(${$})`,0);let Y={recursive:!0};if(Q?.mode!==void 0)Y.mode=Q.mode;try{s.mkdirSync($,Y)}catch(H){if(o$(H)!=="EEXIST")throw H}}catch(W){var G=W,U=1}finally{P$(X,G,U)}},readdirSync($){let J=[];try{const Q=R$(J,C$`fs.readdirSync(${$})`,0);return s.readdirSync($,{withFileTypes:!0})}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},readdirStringSync($){let J=[];try{const Q=R$(J,C$`fs.readdirStringSync(${$})`,0);return s.readdirSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},isDirEmptySync($){let Y=[];try{const Q=R$(Y,C$`fs.isDirEmptySync(${$})`,0);let J=this.readdirSync($);return J.length===0}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},rmdirSync($){let J=[];try{const Q=R$(J,C$`fs.rmdirSync(${$})`,0);s.rmdirSync($)}catch(Y){var X=Y,W=1}finally{P$(J,X,W)}},rmSync($,Q){let Y=[];try{const J=R$(Y,C$`fs.rmSync(${$})`,0);s.rmSync($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}},createWriteStream($){return s.createWriteStream($)},async readFileBytes($,Q){if(Q===void 0)return pO($);let J=await dT($,"r");try{let{size:Y}=await J.stat(),X=Math.min(Y,Q),W=Buffer.allocUnsafe(X),G=0;while(G<X){let{bytesRead:U}=await J.read(W,G,X-G,G);if(U===0)break;G+=U}return G<X?W.subarray(0,G):W}finally{await J.close()}}},eT=sT;function c$(){return eT}function $x($,Q){if($.destroyed)return;$.write(Q)}function dO($){$x(process.stderr,$)}function BU($){return $.charAt(0).toUpperCase()+$.slice(1)}function iO($,Q,J=Q+"s"){return $===1?Q:J}var H3$=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,K3$=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function nO($,Q){let J=$.indexOf(Q);return J===-1?$:$.slice(0,J)}var Qx=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,rO="[^\\s,;&}\\])]+",oO=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${rO})|${rO}`,Jx=["sk","ant","api"].join("-"),Xx=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${Qx.source})[\\w.-]*["']?\\s*[=:]\\s*(${oO})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${oO})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:`\\b(AIza[\\w-]{35})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${Jx}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:`\\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",flags:"i",confidence:"high"}];var tO=null;function Yx($){return Xx.map((Q)=>({id:Q.id,confidence:Q.confidence,re:new RegExp(Q.source,$?(Q.flags??"").replace("g","")+"g":Q.flags??"")}))}function aO($){tO??=Yx(!0);for(let Q of tO)$=$.replace(Q.re,(J,Y)=>{if(typeof Y!=="string")return"[REDACTED]";let X=Y.length>=2&&(Y[0]==='"'||Y[0]==="'")&&Y.at(-1)===Y[0]?Y[0]:"",W=J.lastIndexOf(Y);return`${J.slice(0,W)}${X}[REDACTED]${X}${J.slice(W+Y.length)}`});return $}var OU={verbose:0,debug:1,info:2,warn:3,error:4},Hx=v$(()=>{let $=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if($&&Object.hasOwn(OU,$))return $;return"debug"}),Kx=!1;function q5(){return typeof process<"u"&&Array.isArray(process.argv)?process.argv:[]}var DU=v$(()=>{let $=q5();return Kx||A$(process.env.DEBUG)||A$(process.env.DEBUG_SDK)||$.includes("--debug")||$.includes("-d")||Q2()||$.some((Q)=>Q.startsWith("--debug="))||J2()!==null});var qx=v$(()=>{let $=q5().find((J)=>J.startsWith("--debug="));if(!$)return null;let Q=$.substring(8);return mO(Q)}),Q2=v$(()=>{let $=q5();return $.includes("--debug-to-stderr")||$.includes("-d2e")}),J2=v$(()=>{let $=q5();for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J.startsWith("--debug-file="))return J.substring(13);if(J==="--debug-file"&&Q+1<$.length)return $[Q+1]}return null});function Vx($){if(!DU())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let Q=qx();return lO($,Q)}var Bx=!1;var zx=10485760,K5=null,zU=Promise.resolve(),fQ=-1,NU=!1,FU=null;async function X2($,Q,J=zx){if(fQ<0)fQ=await Gx($).then((Y)=>Y.size).catch(()=>0);else fQ+=Q;if(fQ<=J||NU)return;NU=!0;try{let Y=$.endsWith(".txt")?`${$.slice(0,-4)}.1.txt`:`${$}.1`;try{await eO($,Y)}catch(X){if(!D1(X))await wU(Y).catch(()=>{}),await eO($,Y).catch(()=>wU($).catch(()=>{}))}fQ=0}finally{NU=!1}}function Y2($){return FU=MU($,`${VU()}.txt`),FU}async function Nx($,Q,J,Y){if($)await Wx(Q,{recursive:!0}).catch(()=>{});let X=J;try{await sO(J,Y)}catch(W){if(!JU(W))throw W;X=Y2(J),await sO(X,Y)}await X2(X,Buffer.byteLength(Y)).catch(ZU),G2()}function ZU(){}function wx(){if(!K5){let $=null;K5=gO({writeFn:(Q)=>{let J=W2(),Y=$2(J),X=$!==Y;if($=Y,DU()){if(X)try{c$().mkdirSync(Y)}catch{}let W=J;try{c$().appendFileSync(J,Q)}catch(G){if(!JU(G))throw G;W=Y2(J),c$().appendFileSync(W,Q)}X2(W,Buffer.byteLength(Q)).catch(ZU),G2();return}zU=zU.then(Nx.bind(null,X,Y,J,Q)).catch(ZU)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:DU()}),uO(async()=>{K5?.dispose(),await zU})}return K5}function X$($,{level:Q}={level:"debug"}){if(OU[Q]<OU[Hx()])return;if(!Vx($))return;if(Bx&&$.includes(`
59
59
  `))$=B$($);let Y=`${new Date().toISOString()} [${Q.toUpperCase()}] ${aO($.trim())}
60
60
  `;if(Q2()){dO(Y);return}wx().write(Y)}function W2(){return J2()??FU??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??MU(p6(),"debug",`${VU()}.txt`)}var G2=v$(async()=>{try{let $=W2(),Q=$2($),J=MU(Q,"latest");await wU(J).catch(()=>{}),await Ux($,J)}catch{}});var k3$=(()=>{let $=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if($!==void 0){let Q=Number($);if(!Number.isNaN(Q)&&Q>=0)return Q}return 1/0})();var Ox={[Symbol.dispose](){}};function Dx(){return Ox}var C$=Dx;function B$($,Q,J){let X=[];try{const Y=R$(X,C$`JSON.stringify(${$})`,0);return JSON.stringify($,Q,J)}catch(W){var G=W,U=1}finally{P$(X,G,U)}}var g$=($,Q)=>{let Y=[];try{const J=R$(Y,C$`JSON.parse(${$})`,0);return typeof Q>"u"?JSON.parse($):JSON.parse($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}};function A4($,Q){let Y=[];try{const J=R$(Y,C$`structuredClone(${$})`,0);return structuredClone($,Q)}catch(X){var W=X,G=1}finally{P$(Y,W,G)}}function Fx($){let Q=$.trim();return Q.startsWith("{")&&Q.endsWith("}")}function U2($,Q){let J={...$};if(Q){let Y=Q.enabled===!0&&Q.failIfUnavailable===void 0?{...Q,failIfUnavailable:!0}:Q,X=J.settings;if(X&&!Fx(X))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let W={sandbox:Y};if(X)try{W={...g$(X),sandbox:Y}}catch{}J.settings=B$(W)}return J}var jx=2000,V5=new Set,H2=!1;function Ax(){for(let $ of V5)if(!$.killed)$.kill("SIGTERM")}function Ix($){if(V5.add($),!H2)H2=!0,process.on("exit",Ax)}class LU{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;forwardedAbort=f9();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor($){this.options=$;if(this.abortController=$.abortController||f9(),$.deferSpawn)this.spawnPromise=new Promise((Q,J)=>{this.spawnResolve=Q,this.spawnReject=J}),this.spawnPromise.catch(()=>{});else this.initialize()}spawn(){try{this.initialize()}catch(Q){throw this.spawnAbort(j4(Q)),Q}let $=this.pendingWrites;if(this.pendingWrites=[],this.spawnResolve)this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0;for(let Q of $)this.write(Q);if(this.pendingEndInput)this.pendingEndInput=!1,this.processStdin?.end()}spawnAbort($){if(this.spawnReject)this.spawnReject($),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[]}updateEnv($){if(this.options.env)Object.assign(this.options.env,$);else this.options.env={...$}}updateResume($){this.options.resume=$}getDefaultExecutable(){return VX()?"bun":"node"}spawnLocalProcess($){let{command:Q,args:J,cwd:Y,env:X,signal:W}=$,G=A$(X.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",U=Zx(Q,J,{cwd:Y,stdio:["pipe","pipe",G],signal:W,env:X,windowsHide:!0});if(A$(X.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)U.stderr.on("data",(q)=>{let V=q.toString();if(L6(V),this.options.stderr)this.options.stderr(V)});return{stdin:U.stdin,stdout:U.stdout,get killed(){return U.killed},get exitCode(){return U.exitCode},kill:U.kill.bind(U),on:U.on.bind(U),once:U.once.bind(U),off:U.off.bind(U)}}initialize(){try{let{additionalDirectories:$=[],agent:Q,betas:J,cwd:Y,executable:X=this.getDefaultExecutable(),executableArgs:W=[],extraArgs:G={},pathToClaudeCodeExecutable:U,env:H={...process.env},thinkingConfig:q,maxTurns:V,maxBudgetUsd:B,taskBudget:z,model:N,fallbackModel:w,jsonSchema:O,permissionMode:D,allowDangerouslySkipPermissions:M,permissionPromptToolName:j,continueConversation:A,resume:k,settingSources:u,skills:G$,disallowedTools:u$=[],tools:e$,mcpServers:m6,strictMcpConfig:F6,canUseTool:a1,includePartialMessages:i0,plugins:S4,sandbox:S9}=this.options,{allowedTools:W1=[]}=this.options;if(G$!==void 0){let m$=G$==="all"?["Skill"]:G$.map((k4)=>`Skill(${k4})`),s$=new Set(W1);W1=[...W1,...m$.filter((k4)=>!s$.has(k4))]}let i=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(q){switch(q.type){case"enabled":if(q.budgetTokens===void 0)i.push("--thinking","adaptive");else i.push("--max-thinking-tokens",q.budgetTokens.toString());break;case"disabled":i.push("--thinking","disabled");break;case"adaptive":i.push("--thinking","adaptive");break}if(q.type!=="disabled"&&q.display)i.push("--thinking-display",q.display)}if(this.options.effort)i.push("--effort",this.options.effort);if(V)i.push("--max-turns",V.toString());if(B!==void 0)i.push("--max-budget-usd",B.toString());if(z)i.push("--task-budget",z.total.toString());if(N)i.push("--model",N);if(Q)i.push("--agent",Q);if(J&&J.length>0)i.push("--betas",J.join(","));if(O)i.push("--json-schema",B$(O));if(this.options.debugFile)i.push("--debug-file",this.options.debugFile);else if(this.options.debug)i.push("--debug");if(!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let m$=fw();if(m$)i.push("--debug-file",m$)}if(a1){if(j)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");i.push("--permission-prompt-tool","stdio")}else if(j)i.push("--permission-prompt-tool",j);if(A)i.push("--continue");if(k)i.push("--resume",k);if(this.options.assistant)i.push("--assistant");if(this.options.channels&&this.options.channels.length>0)i.push("--channels",...this.options.channels);if(W1.length>0)i.push("--allowedTools",W1.join(","));if(u$.length>0)i.push("--disallowedTools",u$.join(","));if(e$!==void 0)if(Array.isArray(e$))if(e$.length===0)i.push("--tools","");else i.push("--tools",e$.join(","));else i.push("--tools","default");if(m6&&Object.keys(m6).length>0)i.push("--mcp-config",B$({mcpServers:m6}));if(u!==void 0)i.push(`--setting-sources=${u.join(",")}`);if(F6)i.push("--strict-mcp-config");if(D)i.push("--permission-mode",D);if(M)i.push("--allow-dangerously-skip-permissions");if(w){if(N&&w===N)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");i.push("--fallback-model",w)}if(this.options.includeHookEvents)i.push("--include-hook-events");if(i0)i.push("--include-partial-messages");if(this.options.sessionMirror)i.push("--session-mirror");for(let m$ of $)i.push("--add-dir",m$);if(S4&&S4.length>0)for(let m$ of S4)if(m$.type==="local")i.push("--plugin-dir",m$.path);else throw Error(`Unsupported plugin type: ${m$.type}`);if(this.options.forkSession)i.push("--fork-session");if(this.options.resumeSessionAt)i.push("--resume-session-at",this.options.resumeSessionAt);if(this.options.sessionId)i.push("--session-id",this.options.sessionId);if(this.options.persistSession===!1)i.push("--no-session-persistence");if(this.options.managedSettings)i.push("--managed-settings",this.options.managedSettings);let GX={...G??{}};if(this.options.settings)GX.settings=this.options.settings;let UX=U2(GX,S9);for(let[m$,s$]of Object.entries(UX))if(s$===null)i.push(`--${m$}`);else i.push(`--${m$}`,s$);if(!H.CLAUDE_CODE_ENTRYPOINT)H.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete H.NODE_OPTIONS,A$(H.DEBUG_CLAUDE_AGENT_SDK))H.DEBUG="1";else delete H.DEBUG;let k9=Rx(U),v9=k9?U:X,C9=k9?[...W,...i]:[...W,U,...i],HX={command:v9,args:C9,cwd:Y,env:H,signal:this.forwardedAbort.signal};if(this.options.spawnClaudeCodeProcess)L6(`Spawning Claude Code (custom): ${v9} ${C9.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(HX);else L6(`Spawning Claude Code: ${v9} ${C9.join(" ")}`),this.process=this.spawnLocalProcess(HX);if(this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,Ix(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted)this.close();this.process.on("error",(m$)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new W6("Claude Code process aborted by user");else if(Sw(m$)){let s$=Px(U,k9);this.exitError=ReferenceError(s$),L6(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${m$.message}`),L6(this.exitError.message)}),this.process.on("exit",(m$,s$)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new W6("Claude Code process aborted by user");else{let k4=this.getProcessExitError(m$,s$);if(k4)this.exitError=k4,L6(k4.message)}}),this.ready=!this.abortController.signal.aborted}catch($){throw this.ready=!1,$}}getProcessExitError($,Q){if($!==0&&$!==null)return Error(`Claude Code process exited with code ${$}`);else if(Q)return Error(`Claude Code process terminated by signal ${Q}`);return}write($){if(this.abortController.signal.aborted)throw new W6("Operation aborted");if(this.spawnResolve){this.pendingWrites.push($);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){L6("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);L6(`[ProcessTransport] Writing to stdin: ${$.substring(0,100)}`);try{if(!this.processStdin.write($))L6("[ProcessTransport] Write buffer full, data queued")}catch(Q){throw this.ready=!1,Error(`Failed to write to process stdin: ${N8(Q)}`)}}[Symbol.dispose](){this.close()}close(){if(this.spawnAbort(this.abortController.signal.aborted?new W6("Claude Code process aborted by user"):Error("Query closed before spawn")),this.processStdin)this.processStdin.end(),this.processStdin=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:J}of this.exitListeners)this.process?.off("exit",J);this.exitListeners=[];let $=()=>{if(this.abortController.signal.aborted)this.forwardedAbort.abort(this.abortController.signal.reason)},Q=this.process;if(Q&&!Q.killed&&Q.exitCode===null)setTimeout((J,Y)=>{if(J.exitCode!==null){Y();return}J.kill("SIGTERM"),setTimeout((X)=>{if(X.exitCode===null)X.kill("SIGKILL")},5000,J).unref(),Y()},jx,Q,$).unref(),Q.once("exit",()=>V5.delete(Q));else if(Q)V5.delete(Q),$();this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise)await this.spawnPromise,this.spawnPromise=void 0;if(!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let $=Lx({input:this.processStdout}),Q=this.process?(()=>{let J=this.process,Y=()=>$.close();return J.on("error",Y),()=>J.off("error",Y)})():void 0;if(this.exitError)$.close();try{for await(let J of $)if(J.trim()){let Y;try{Y=g$(J)}catch(X){L6(`Non-JSON stdout: ${J}`);continue}yield Y}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(J){throw J}finally{Q?.(),$.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}if(this.processStdin)this.processStdin.end()}getInputStream(){return this.processStdin}onExit($){if(!this.process)return()=>{};let Q=(J,Y)=>{let X=this.getProcessExitError(J,Y);$(X)};return this.process.on("exit",Q),this.exitListeners.push({callback:$,handler:Q}),()=>{if(this.process)this.process.off("exit",Q);let J=this.exitListeners.findIndex((Y)=>Y.handler===Q);if(J!==-1)this.exitListeners.splice(J,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise(($,Q)=>{let J=(X,W)=>{if(this.abortController.signal.aborted){Q(new W6("Operation aborted"));return}let G=this.getProcessExitError(X,W);if(G)Q(G);else $()};this.process.once("exit",J);let Y=(X)=>{this.process.off("exit",J),Q(X)};this.process.once("error",Y),this.process.once("exit",()=>{this.process.off("error",Y)})})}}function Rx($){return![".js",".mjs",".tsx",".ts",".jsx"].some((J)=>$.endsWith(J))}function Px($,Q){if(Mx($))return Q?`Claude Code native binary at ${$} exists but failed to launch.`:`Claude Code executable at ${$} exists but failed to launch.`;return Q?`Claude Code native binary not found at ${$}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${$}. Is options.pathToClaudeCodeExecutable set?`}import{existsSync as Ex}from"fs";var I8="@anthropic-ai/claude-agent-sdk";function bx(){if(process.platform!=="linux")return!1;let $=typeof process.report?.getReport==="function"?process.report.getReport():null;return $!=null&&$.header?.glibcVersionRuntime===void 0}function K2($,Q=process.platform,J=process.arch,Y=Ex,X=bx()){let G=Q==="win32"?".exe":"",H=(Q==="android"?[`${I8}-linux-${J}-android`]:Q==="linux"?X?[`${I8}-linux-${J}-musl`,`${I8}-linux-${J}`]:[`${I8}-linux-${J}`,`${I8}-linux-${J}-musl`]:[`${I8}-${Q}-${J}`]).map((q)=>`${q}/claude${G}`);for(let q of H)try{let V=$(q);if(Y(V))return V}catch{}return null}class gQ{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor($){this.returned=$}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise(($,Q)=>{this.readResolve=$,this.readReject=Q})}enqueue($){if(this.readResolve){let Q=this.readResolve;this.readResolve=void 0,this.readReject=void 0,Q({done:!1,value:$})}else this.queue.push($)}done(){if(this.isDone=!0,this.readResolve){let $=this.readResolve;this.readResolve=void 0,this.readReject=void 0,$({done:!0,value:void 0})}}error($){if(this.hasError=$,this.readReject){let Q=this.readReject;this.readResolve=void 0,this.readReject=void 0,Q($)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}function _x(){return{eventQueue:[],sink:null}}var Sx=_x();function B5($,Q){let J=Sx;if(J.sink===null){J.eventQueue.push({eventName:$,metadata:Q,async:!1});return}J.sink.logEvent($,Q)}function jU($){B5("tengu_feature_ok",{feature_name:$})}function AU($,Q,J){B5("tengu_feature_bad",{feature_name:$,error_code:Q,...J})}function q2($,Q,J){B5("tengu_feature_sad",{feature_name:$,error_code:Q,...J})}async function I4($,Q,J){try{let Y=await Q();return jU($),Y}catch(Y){throw AU($,J?.(Y)??"error"),Y}}class IU{sendMcpMessage;isClosed=!1;constructor($){this.sendMcpMessage=$}onclose;onerror;onmessage;async start(){}async send($){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage($)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}class RU{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new gQ;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn($){this.isSingleUserTurn=$}setTranscriptMirrorBatcher($){this.transcriptMirrorBatcher=$}reportMirrorError($,Q){let J={type:"system",subtype:"mirror_error",error:Q,key:$,uuid:yQ(),session_id:$.sessionId};this.inputStream.enqueue(J)}addCleanupCallback($){if(this.cleanupPerformed)$();else this.cleanupCallbacks.push($)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor($,Q,J,Y,X,W=new Map,G,U,H,q,V){this.transport=$;this.isSingleUserTurn=Q;this.canUseTool=J;this.hooks=Y;this.abortController=X;this.jsonSchema=G;this.initConfig=U;this.onElicitation=H;this.getOAuthToken=q;this.getHostAuthToken=V;for(let[B,z]of W)this.connectSdkMcpServer(B,z);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError($){this.inputStream.error($)}async stopTask($){await this.request({subtype:"stop_task",task_id:$})}async backgroundTasks($){return(await this.request({subtype:"background_tasks",tool_use_id:$})).response.backgrounded??!0}close(){this.cleanup()}cleanup($){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup($),this.cleanupPromise}async performCleanup($){for(let Q of this.cleanupCallbacks)try{Q()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let J of this.cancelControllers.values())J.abort();this.cancelControllers.clear(),this.transport.close();let Q=$??Error("Query closed before response received");for(let{reject:J}of this.pendingControlResponses.values())J(Q);this.pendingControlResponses.clear();for(let{reject:J}of this.pendingMcpResponses.values())J(Q);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let J of this.sdkMcpTransports.values())J.close().catch(()=>{});if(this.sdkMcpTransports.clear(),$)this.inputStream.error($);else this.inputStream.done()}catch(Q){}}next(...[$]){return this.sdkMessages.next(...[$])}async return($){return await this.cleanup(),this.sdkMessages.return($)}async throw($){return await this.cleanup(),this.sdkMessages.throw($)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let $ of this.transport.readMessages()){if($.type==="control_response"){let Q=this.pendingControlResponses.get($.response.request_id);if(Q)Q.handler($.response);continue}else if($.type==="control_request"){this.handleControlRequest($);continue}else if($.type==="control_cancel_request"){this.handleControlCancelRequest($);continue}else if($.type==="keep_alive")continue;else if($.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue($.filePath,$.entries);continue}if($.type==="system"&&($.subtype==="post_turn_summary"||$.subtype==="task_summary")){this.inputStream.enqueue($);continue}if($.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.lastErrorResultText=$.is_error?$.subtype==="success"?$.result:$.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)X$("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!($.type==="system"&&$.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue($)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch($){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!($ instanceof W6)){let Q=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);X$(`[Query.readMessages] Replacing exit error with result text. Original: ${N8($)}`),this.inputStream.error(Q),this.cleanup(Q);return}this.inputStream.error($),this.cleanup($)}}async handleControlRequest($){let Q=new AbortController;this.cancelControllers.set($.request_id,Q);try{let J=await this.processControlRequest($,Q.signal);if(this.cleanupPerformed)return;let Y={type:"control_response",response:{subtype:"success",request_id:$.request_id,response:J}};await Promise.resolve(this.transport.write(B$(Y)+`
61
61
  `))}catch(J){if(this.cleanupPerformed)return;let Y={type:"control_response",response:{subtype:"error",request_id:$.request_id,error:N8(J)}};try{await Promise.resolve(this.transport.write(B$(Y)+`
@@ -112,7 +112,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
112
112
  `+" ".repeat(Q)})},"\t":{"\n":Array(200).fill(0).map(($,Q)=>{return`
113
113
  `+"\t".repeat(Q)}),"\r":Array(200).fill(0).map(($,Q)=>{return"\r"+"\t".repeat(Q)}),"\r\n":Array(200).fill(0).map(($,Q)=>{return`\r
114
114
  `+"\t".repeat(Q)})}};var $E;(function($){$.DEFAULT={allowTrailingComma:!1}})($E||($E={}));var QE;(function($){$[$.None=0]="None",$[$.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",$[$.UnexpectedEndOfString=2]="UnexpectedEndOfString",$[$.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",$[$.InvalidUnicode=4]="InvalidUnicode",$[$.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",$[$.InvalidCharacter=6]="InvalidCharacter"})(QE||(QE={}));var JE;(function($){$[$.OpenBraceToken=1]="OpenBraceToken",$[$.CloseBraceToken=2]="CloseBraceToken",$[$.OpenBracketToken=3]="OpenBracketToken",$[$.CloseBracketToken=4]="CloseBracketToken",$[$.CommaToken=5]="CommaToken",$[$.ColonToken=6]="ColonToken",$[$.NullKeyword=7]="NullKeyword",$[$.TrueKeyword=8]="TrueKeyword",$[$.FalseKeyword=9]="FalseKeyword",$[$.StringLiteral=10]="StringLiteral",$[$.NumericLiteral=11]="NumericLiteral",$[$.LineCommentTrivia=12]="LineCommentTrivia",$[$.BlockCommentTrivia=13]="BlockCommentTrivia",$[$.LineBreakTrivia=14]="LineBreakTrivia",$[$.Trivia=15]="Trivia",$[$.Unknown=16]="Unknown",$[$.EOF=17]="EOF"})(JE||(JE={}));var XE;(function($){$[$.InvalidSymbol=1]="InvalidSymbol",$[$.InvalidNumberFormat=2]="InvalidNumberFormat",$[$.PropertyNameExpected=3]="PropertyNameExpected",$[$.ValueExpected=4]="ValueExpected",$[$.ColonExpected=5]="ColonExpected",$[$.CommaExpected=6]="CommaExpected",$[$.CloseBraceExpected=7]="CloseBraceExpected",$[$.CloseBracketExpected=8]="CloseBracketExpected",$[$.EndOfFileExpected=9]="EndOfFileExpected",$[$.InvalidCommentToken=10]="InvalidCommentToken",$[$.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",$[$.UnexpectedEndOfString=12]="UnexpectedEndOfString",$[$.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",$[$.InvalidUnicode=14]="InvalidUnicode",$[$.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",$[$.InvalidCharacter=16]="InvalidCharacter"})(XE||(XE={}));function rW($){return $.startsWith("\uFEFF")?$.slice(1):$}import y$ from"node:path";import YE from"node:os";import Oz from"node:process";var c1=YE.homedir(),Dz=YE.tmpdir(),{env:j9}=Oz,ss=($)=>{let Q=y$.join(c1,"Library");return{data:y$.join(Q,"Application Support",$),config:y$.join(Q,"Preferences",$),cache:y$.join(Q,"Caches",$),log:y$.join(Q,"Logs",$),temp:y$.join(Dz,$)}},es=($)=>{let Q=j9.APPDATA||y$.join(c1,"AppData","Roaming"),J=j9.LOCALAPPDATA||y$.join(c1,"AppData","Local");return{data:y$.join(J,$,"Data"),config:y$.join(Q,$,"Config"),cache:y$.join(J,$,"Cache"),log:y$.join(J,$,"Log"),temp:y$.join(Dz,$)}},$e=($)=>{let Q=y$.basename(c1);return{data:y$.join(j9.XDG_DATA_HOME||y$.join(c1,".local","share"),$),config:y$.join(j9.XDG_CONFIG_HOME||y$.join(c1,".config"),$),cache:y$.join(j9.XDG_CACHE_HOME||y$.join(c1,".cache"),$),log:y$.join(j9.XDG_STATE_HOME||y$.join(c1,".local","state"),$),temp:y$.join(Dz,Q,$)}};function Fz($,{suffix:Q="nodejs"}={}){if(typeof $!=="string")throw TypeError(`Expected a string, got ${typeof $}`);if(Q)$+=`-${Q}`;if(Oz.platform==="darwin")return ss($);if(Oz.platform==="win32")return es($);return $e($)}var y2$=Fz("claude-cli");function Qe(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return"essential-traffic";if(process.env.DISABLE_TELEMETRY)return"no-telemetry";if(A$(process.env.DO_NOT_TRACK))return"no-telemetry";return"default"}function WE(){return Qe()==="essential-traffic"}var Je=100,Zz=[];function Xe($){if(Zz.length>=Je)Zz.shift();Zz.push($)}var Ye=[],GE=null;var UD$=v$(()=>{return process.argv.includes("--hard-fail")});function oW($){let Q=j4($);try{if(A$(process.env.CLAUDE_CODE_USE_BEDROCK)||A$(process.env.CLAUDE_CODE_USE_VERTEX)||A$(process.env.CLAUDE_CODE_USE_FOUNDRY)||A$(process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS)||A$(process.env.CLAUDE_CODE_USE_MANTLE)||process.env.DISABLE_ERROR_REPORTING||WE())return;let Y={error:Q.stack||Q.message,timestamp:new Date().toISOString()};if(Xe(Y),GE===null){Ye.push({type:"error",error:Q});return}GE.logError(Q)}catch{}}var A9=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,HE=new Set,Mz=typeof process==="object"&&!!process?process:{},KE=($,Q,J,Y)=>{typeof Mz.emitWarning==="function"?Mz.emitWarning($,Q,J,Y):console.error(`[${J}] ${Q}: ${$}`)},tW=globalThis.AbortController,UE=globalThis.AbortSignal;if(typeof tW>"u"){UE=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,X){this._onabort.push(X)}},tW=class{constructor(){Q()}signal=new UE;abort(Y){if(this.signal.aborted)return;this.signal.reason=Y,this.signal.aborted=!0;for(let X of this.signal._onabort)X(Y);this.signal.onabort?.(Y)}};let $=Mz.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",Q=()=>{if(!$)return;$=!1,KE("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",Q)}}var We=($)=>!HE.has($),KD$=Symbol("type"),p1=($)=>$&&$===Math.floor($)&&$>0&&isFinite($),qE=($)=>!p1($)?null:$<=Math.pow(2,8)?Uint8Array:$<=Math.pow(2,16)?Uint16Array:$<=Math.pow(2,32)?Uint32Array:$<=Number.MAX_SAFE_INTEGER?nJ:null;class nJ extends Array{constructor($){super($);this.fill(0)}}class I9{heap;length;static#X=!1;static create($){let Q=qE($);if(!Q)return[];I9.#X=!0;let J=new I9($,Q);return I9.#X=!1,J}constructor($,Q){if(!I9.#X)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Q($),this.length=0}push($){this.heap[this.length++]=$}pop(){return this.heap[--this.length]}}class aW{#X;#V;#w;#O;#S;#k;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#W;#D;#Y;#J;#$;#K;#B;#H;#G;#F;#U;#Z;#M;#z;#L;#P;#q;static unsafeExposeInternals($){return{starts:$.#M,ttls:$.#z,sizes:$.#Z,keyMap:$.#Y,keyList:$.#J,valList:$.#$,next:$.#K,prev:$.#B,get head(){return $.#H},get tail(){return $.#G},free:$.#F,isBackgroundFetch:(Q)=>$.#Q(Q),backgroundFetch:(Q,J,Y,X)=>$.#T(Q,J,Y,X),moveToTail:(Q)=>$.#_(Q),indexes:(Q)=>$.#j(Q),rindexes:(Q)=>$.#A(Q),isStale:(Q)=>$.#N(Q)}}get max(){return this.#X}get maxSize(){return this.#V}get calculatedSize(){return this.#D}get size(){return this.#W}get fetchMethod(){return this.#S}get memoMethod(){return this.#k}get dispose(){return this.#w}get disposeAfter(){return this.#O}constructor($){let{max:Q=0,ttl:J,ttlResolution:Y=1,ttlAutopurge:X,updateAgeOnGet:W,updateAgeOnHas:G,allowStale:U,dispose:H,disposeAfter:q,noDisposeOnSet:V,noUpdateTTL:B,maxSize:z=0,maxEntrySize:N=0,sizeCalculation:w,fetchMethod:O,memoMethod:D,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:j,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:k,ignoreFetchAbort:u}=$;if(Q!==0&&!p1(Q))throw TypeError("max option must be a nonnegative integer");let G$=Q?qE(Q):Array;if(!G$)throw Error("invalid max value: "+Q);if(this.#X=Q,this.#V=z,this.maxEntrySize=N||this.#V,this.sizeCalculation=w,this.sizeCalculation){if(!this.#V&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(D!==void 0&&typeof D!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#k=D,O!==void 0&&typeof O!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#S=O,this.#P=!!O,this.#Y=new Map,this.#J=Array(Q).fill(void 0),this.#$=Array(Q).fill(void 0),this.#K=new G$(Q),this.#B=new G$(Q),this.#H=0,this.#G=0,this.#F=I9.create(Q),this.#W=0,this.#D=0,typeof H==="function")this.#w=H;if(typeof q==="function")this.#O=q,this.#U=[];else this.#O=void 0,this.#U=void 0;if(this.#L=!!this.#w,this.#q=!!this.#O,this.noDisposeOnSet=!!V,this.noUpdateTTL=!!B,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!u,this.maxEntrySize!==0){if(this.#V!==0){if(!p1(this.#V))throw TypeError("maxSize must be a positive integer if specified")}if(!p1(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#m()}if(this.allowStale=!!U,this.noDeleteOnStaleGet=!!j,this.updateAgeOnGet=!!W,this.updateAgeOnHas=!!G,this.ttlResolution=p1(Y)||Y===0?Y:1,this.ttlAutopurge=!!X,this.ttl=J||0,this.ttl){if(!p1(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#X===0&&this.ttl===0&&this.#V===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#X&&!this.#V){if(We("LRU_CACHE_UNBOUNDED"))HE.add("LRU_CACHE_UNBOUNDED"),KE("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",aW)}}getRemainingTTL($){return this.#Y.has($)?1/0:0}#x(){let $=new nJ(this.#X),Q=new nJ(this.#X);this.#z=$,this.#M=Q,this.#y=(X,W,G=A9.now())=>{if(Q[X]=W!==0?G:0,$[X]=W,W!==0&&this.ttlAutopurge){let U=setTimeout(()=>{if(this.#N(X))this.#I(this.#J[X],"expire")},W+1);if(U.unref)U.unref()}},this.#E=(X)=>{Q[X]=$[X]!==0?A9.now():0},this.#R=(X,W)=>{if($[W]){let G=$[W],U=Q[W];if(!G||!U)return;X.ttl=G,X.start=U,X.now=J||Y();let H=X.now-U;X.remainingTTL=G-H}};let J=0,Y=()=>{let X=A9.now();if(this.ttlResolution>0){J=X;let W=setTimeout(()=>J=0,this.ttlResolution);if(W.unref)W.unref()}return X};this.getRemainingTTL=(X)=>{let W=this.#Y.get(X);if(W===void 0)return 0;let G=$[W],U=Q[W];if(!G||!U)return 1/0;let H=(J||Y())-U;return G-H},this.#N=(X)=>{let W=Q[X],G=$[X];return!!G&&!!W&&(J||Y())-W>G}}#E=()=>{};#R=()=>{};#y=()=>{};#N=()=>!1;#m(){let $=new nJ(this.#X);this.#D=0,this.#Z=$,this.#b=(Q)=>{this.#D-=$[Q],$[Q]=0},this.#f=(Q,J,Y,X)=>{if(this.#Q(J))return 0;if(!p1(Y))if(X){if(typeof X!=="function")throw TypeError("sizeCalculation must be a function");if(Y=X(J,Q),!p1(Y))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Y},this.#v=(Q,J,Y)=>{if($[Q]=J,this.#V){let X=this.#V-$[Q];while(this.#D>X)this.#C(!0)}if(this.#D+=$[Q],Y)Y.entrySize=J,Y.totalCalculatedSize=this.#D}}#b=($)=>{};#v=($,Q,J)=>{};#f=($,Q,J,Y)=>{if(J||Y)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#j({allowStale:$=this.allowStale}={}){if(this.#W)for(let Q=this.#G;;){if(!this.#g(Q))break;if($||!this.#N(Q))yield Q;if(Q===this.#H)break;else Q=this.#B[Q]}}*#A({allowStale:$=this.allowStale}={}){if(this.#W)for(let Q=this.#H;;){if(!this.#g(Q))break;if($||!this.#N(Q))yield Q;if(Q===this.#G)break;else Q=this.#K[Q]}}#g($){return $!==void 0&&this.#Y.get(this.#J[$])===$}*entries(){for(let $ of this.#j())if(this.#$[$]!==void 0&&this.#J[$]!==void 0&&!this.#Q(this.#$[$]))yield[this.#J[$],this.#$[$]]}*rentries(){for(let $ of this.#A())if(this.#$[$]!==void 0&&this.#J[$]!==void 0&&!this.#Q(this.#$[$]))yield[this.#J[$],this.#$[$]]}*keys(){for(let $ of this.#j()){let Q=this.#J[$];if(Q!==void 0&&!this.#Q(this.#$[$]))yield Q}}*rkeys(){for(let $ of this.#A()){let Q=this.#J[$];if(Q!==void 0&&!this.#Q(this.#$[$]))yield Q}}*values(){for(let $ of this.#j())if(this.#$[$]!==void 0&&!this.#Q(this.#$[$]))yield this.#$[$]}*rvalues(){for(let $ of this.#A())if(this.#$[$]!==void 0&&!this.#Q(this.#$[$]))yield this.#$[$]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find($,Q={}){for(let J of this.#j()){let Y=this.#$[J],X=this.#Q(Y)?Y.__staleWhileFetching:Y;if(X===void 0)continue;if($(X,this.#J[J],this))return this.get(this.#J[J],Q)}}forEach($,Q=this){for(let J of this.#j()){let Y=this.#$[J],X=this.#Q(Y)?Y.__staleWhileFetching:Y;if(X===void 0)continue;$.call(Q,X,this.#J[J],this)}}rforEach($,Q=this){for(let J of this.#A()){let Y=this.#$[J],X=this.#Q(Y)?Y.__staleWhileFetching:Y;if(X===void 0)continue;$.call(Q,X,this.#J[J],this)}}purgeStale(){let $=!1;for(let Q of this.#A({allowStale:!0}))if(this.#N(Q))this.#I(this.#J[Q],"expire"),$=!0;return $}info($){let Q=this.#Y.get($);if(Q===void 0)return;let J=this.#$[Q],Y=this.#Q(J)?J.__staleWhileFetching:J;if(Y===void 0)return;let X={value:Y};if(this.#z&&this.#M){let W=this.#z[Q],G=this.#M[Q];if(W&&G){let U=W-(A9.now()-G);X.ttl=U,X.start=Date.now()}}if(this.#Z)X.size=this.#Z[Q];return X}dump(){let $=[];for(let Q of this.#j({allowStale:!0})){let J=this.#J[Q],Y=this.#$[Q],X=this.#Q(Y)?Y.__staleWhileFetching:Y;if(X===void 0||J===void 0)continue;let W={value:X};if(this.#z&&this.#M){W.ttl=this.#z[Q];let G=A9.now()-this.#M[Q];W.start=Math.floor(Date.now()-G)}if(this.#Z)W.size=this.#Z[Q];$.unshift([J,W])}return $}load($){this.clear();for(let[Q,J]of $){if(J.start){let Y=Date.now()-J.start;J.start=A9.now()-Y}this.set(Q,J.value,J)}}set($,Q,J={}){if(Q===void 0)return this.delete($),this;let{ttl:Y=this.ttl,start:X,noDisposeOnSet:W=this.noDisposeOnSet,sizeCalculation:G=this.sizeCalculation,status:U}=J,{noUpdateTTL:H=this.noUpdateTTL}=J,q=this.#f($,Q,J.size||0,G);if(this.maxEntrySize&&q>this.maxEntrySize){if(U)U.set="miss",U.maxEntrySizeExceeded=!0;return this.#I($,"set"),this}let V=this.#W===0?void 0:this.#Y.get($);if(V===void 0){if(V=this.#W===0?this.#G:this.#F.length!==0?this.#F.pop():this.#W===this.#X?this.#C(!1):this.#W,this.#J[V]=$,this.#$[V]=Q,this.#Y.set($,V),this.#K[this.#G]=V,this.#B[V]=this.#G,this.#G=V,this.#W++,this.#v(V,q,U),U)U.set="add";H=!1}else{this.#_(V);let B=this.#$[V];if(Q!==B){if(this.#P&&this.#Q(B)){B.__abortController.abort(Error("replaced"));let{__staleWhileFetching:z}=B;if(z!==void 0&&!W){if(this.#L)this.#w?.(z,$,"set");if(this.#q)this.#U?.push([z,$,"set"])}}else if(!W){if(this.#L)this.#w?.(B,$,"set");if(this.#q)this.#U?.push([B,$,"set"])}if(this.#b(V),this.#v(V,q,U),this.#$[V]=Q,U){U.set="replace";let z=B&&this.#Q(B)?B.__staleWhileFetching:B;if(z!==void 0)U.oldValue=z}}else if(U)U.set="update"}if(Y!==0&&!this.#z)this.#x();if(this.#z){if(!H)this.#y(V,Y,X);if(U)this.#R(U,V)}if(!W&&this.#q&&this.#U){let B=this.#U,z;while(z=B?.shift())this.#O?.(...z)}return this}pop(){try{while(this.#W){let $=this.#$[this.#H];if(this.#C(!0),this.#Q($)){if($.__staleWhileFetching)return $.__staleWhileFetching}else if($!==void 0)return $}}finally{if(this.#q&&this.#U){let $=this.#U,Q;while(Q=$?.shift())this.#O?.(...Q)}}}#C($){let Q=this.#H,J=this.#J[Q],Y=this.#$[Q];if(this.#P&&this.#Q(Y))Y.__abortController.abort(Error("evicted"));else if(this.#L||this.#q){if(this.#L)this.#w?.(Y,J,"evict");if(this.#q)this.#U?.push([Y,J,"evict"])}if(this.#b(Q),$)this.#J[Q]=void 0,this.#$[Q]=void 0,this.#F.push(Q);if(this.#W===1)this.#H=this.#G=0,this.#F.length=0;else this.#H=this.#K[Q];return this.#Y.delete(J),this.#W--,Q}has($,Q={}){let{updateAgeOnHas:J=this.updateAgeOnHas,status:Y}=Q,X=this.#Y.get($);if(X!==void 0){let W=this.#$[X];if(this.#Q(W)&&W.__staleWhileFetching===void 0)return!1;if(!this.#N(X)){if(J)this.#E(X);if(Y)Y.has="hit",this.#R(Y,X);return!0}else if(Y)Y.has="stale",this.#R(Y,X)}else if(Y)Y.has="miss";return!1}peek($,Q={}){let{allowStale:J=this.allowStale}=Q,Y=this.#Y.get($);if(Y===void 0||!J&&this.#N(Y))return;let X=this.#$[Y];return this.#Q(X)?X.__staleWhileFetching:X}#T($,Q,J,Y){let X=Q===void 0?void 0:this.#$[Q];if(this.#Q(X))return X;let W=new tW,{signal:G}=J;G?.addEventListener("abort",()=>W.abort(G.reason),{signal:W.signal});let U={signal:W.signal,options:J,context:Y},H=(w,O=!1)=>{let{aborted:D}=W.signal,M=J.ignoreFetchAbort&&w!==void 0;if(J.status)if(D&&!O){if(J.status.fetchAborted=!0,J.status.fetchError=W.signal.reason,M)J.status.fetchAbortIgnored=!0}else J.status.fetchResolved=!0;if(D&&!M&&!O)return V(W.signal.reason);let j=z;if(this.#$[Q]===z)if(w===void 0)if(j.__staleWhileFetching)this.#$[Q]=j.__staleWhileFetching;else this.#I($,"fetch");else{if(J.status)J.status.fetchUpdated=!0;this.set($,w,U.options)}return w},q=(w)=>{if(J.status)J.status.fetchRejected=!0,J.status.fetchError=w;return V(w)},V=(w)=>{let{aborted:O}=W.signal,D=O&&J.allowStaleOnFetchAbort,M=D||J.allowStaleOnFetchRejection,j=M||J.noDeleteOnFetchRejection,A=z;if(this.#$[Q]===z){if(!j||A.__staleWhileFetching===void 0)this.#I($,"fetch");else if(!D)this.#$[Q]=A.__staleWhileFetching}if(M){if(J.status&&A.__staleWhileFetching!==void 0)J.status.returnedStale=!0;return A.__staleWhileFetching}else if(A.__returned===A)throw w},B=(w,O)=>{let D=this.#S?.($,X,U);if(D&&D instanceof Promise)D.then((M)=>w(M===void 0?void 0:M),O);W.signal.addEventListener("abort",()=>{if(!J.ignoreFetchAbort||J.allowStaleOnFetchAbort){if(w(void 0),J.allowStaleOnFetchAbort)w=(M)=>H(M,!0)}})};if(J.status)J.status.fetchDispatched=!0;let z=new Promise(B).then(H,q),N=Object.assign(z,{__abortController:W,__staleWhileFetching:X,__returned:void 0});if(Q===void 0)this.set($,N,{...U.options,status:void 0}),Q=this.#Y.get($);else this.#$[Q]=N;return N}#Q($){if(!this.#P)return!1;let Q=$;return!!Q&&Q instanceof Promise&&Q.hasOwnProperty("__staleWhileFetching")&&Q.__abortController instanceof tW}async fetch($,Q={}){let{allowStale:J=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:X=this.noDeleteOnStaleGet,ttl:W=this.ttl,noDisposeOnSet:G=this.noDisposeOnSet,size:U=0,sizeCalculation:H=this.sizeCalculation,noUpdateTTL:q=this.noUpdateTTL,noDeleteOnFetchRejection:V=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:B=this.allowStaleOnFetchRejection,ignoreFetchAbort:z=this.ignoreFetchAbort,allowStaleOnFetchAbort:N=this.allowStaleOnFetchAbort,context:w,forceRefresh:O=!1,status:D,signal:M}=Q;if(!this.#P){if(D)D.fetch="get";return this.get($,{allowStale:J,updateAgeOnGet:Y,noDeleteOnStaleGet:X,status:D})}let j={allowStale:J,updateAgeOnGet:Y,noDeleteOnStaleGet:X,ttl:W,noDisposeOnSet:G,size:U,sizeCalculation:H,noUpdateTTL:q,noDeleteOnFetchRejection:V,allowStaleOnFetchRejection:B,allowStaleOnFetchAbort:N,ignoreFetchAbort:z,status:D,signal:M},A=this.#Y.get($);if(A===void 0){if(D)D.fetch="miss";let k=this.#T($,A,j,w);return k.__returned=k}else{let k=this.#$[A];if(this.#Q(k)){let m6=J&&k.__staleWhileFetching!==void 0;if(D){if(D.fetch="inflight",m6)D.returnedStale=!0}return m6?k.__staleWhileFetching:k.__returned=k}let u=this.#N(A);if(!O&&!u){if(D)D.fetch="hit";if(this.#_(A),Y)this.#E(A);if(D)this.#R(D,A);return k}let G$=this.#T($,A,j,w),e$=G$.__staleWhileFetching!==void 0&&J;if(D){if(D.fetch=u?"stale":"refresh",e$&&u)D.returnedStale=!0}return e$?G$.__staleWhileFetching:G$.__returned=G$}}async forceFetch($,Q={}){let J=await this.fetch($,Q);if(J===void 0)throw Error("fetch() returned undefined");return J}memo($,Q={}){let J=this.#k;if(!J)throw Error("no memoMethod provided to constructor");let{context:Y,forceRefresh:X,...W}=Q,G=this.get($,W);if(!X&&G!==void 0)return G;let U=J($,G,{options:W,context:Y});return this.set($,U,W),U}get($,Q={}){let{allowStale:J=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:X=this.noDeleteOnStaleGet,status:W}=Q,G=this.#Y.get($);if(G!==void 0){let U=this.#$[G],H=this.#Q(U);if(W)this.#R(W,G);if(this.#N(G)){if(W)W.get="stale";if(!H){if(!X)this.#I($,"expire");if(W&&J)W.returnedStale=!0;return J?U:void 0}else{if(W&&J&&U.__staleWhileFetching!==void 0)W.returnedStale=!0;return J?U.__staleWhileFetching:void 0}}else{if(W)W.get="hit";if(H)return U.__staleWhileFetching;if(this.#_(G),Y)this.#E(G);return U}}else if(W)W.get="miss"}#h($,Q){this.#B[Q]=$,this.#K[$]=Q}#_($){if($!==this.#G){if($===this.#H)this.#H=this.#K[$];else this.#h(this.#B[$],this.#K[$]);this.#h(this.#G,$),this.#G=$}}delete($){return this.#I($,"delete")}#I($,Q){let J=!1;if(this.#W!==0){let Y=this.#Y.get($);if(Y!==void 0)if(J=!0,this.#W===1)this.#u(Q);else{this.#b(Y);let X=this.#$[Y];if(this.#Q(X))X.__abortController.abort(Error("deleted"));else if(this.#L||this.#q){if(this.#L)this.#w?.(X,$,Q);if(this.#q)this.#U?.push([X,$,Q])}if(this.#Y.delete($),this.#J[Y]=void 0,this.#$[Y]=void 0,Y===this.#G)this.#G=this.#B[Y];else if(Y===this.#H)this.#H=this.#K[Y];else{let W=this.#B[Y];this.#K[W]=this.#K[Y];let G=this.#K[Y];this.#B[G]=this.#B[Y]}this.#W--,this.#F.push(Y)}}if(this.#q&&this.#U?.length){let Y=this.#U,X;while(X=Y?.shift())this.#O?.(...X)}return J}clear(){return this.#u("delete")}#u($){for(let Q of this.#A({allowStale:!0})){let J=this.#$[Q];if(this.#Q(J))J.__abortController.abort(Error("deleted"));else{let Y=this.#J[Q];if(this.#L)this.#w?.(J,Y,$);if(this.#q)this.#U?.push([J,Y,$])}}if(this.#Y.clear(),this.#$.fill(void 0),this.#J.fill(void 0),this.#z&&this.#M)this.#z.fill(0),this.#M.fill(0);if(this.#Z)this.#Z.fill(0);if(this.#H=0,this.#G=0,this.#F.length=0,this.#D=0,this.#W=0,this.#q&&this.#U){let Q=this.#U,J;while(J=Q?.shift())this.#O?.(...J)}}}function VE($,Q,J=100){let Y=new aW({max:J}),X=(...W)=>{let G=Q(...W),U=Y.get(G);if(U!==void 0)return U;let H=$(...W);return Y.set(G,H),H};return X.cache={clear:()=>Y.clear(),size:()=>Y.size,delete:(W)=>Y.delete(W),get:(W)=>Y.peek(W),has:(W)=>Y.has(W)},X}var Ge=8192;function zE($,Q){try{return{ok:!0,value:JSON.parse(rW($))}}catch(J){if(Q)oW(J);return{ok:!1}}}var BE=VE(zE,($)=>$,50);var R9=Object.assign(function(Q,J=!0){if(!Q)return null;let Y=Q.length>Ge?zE(Q,J):BE(Q,J);return Y.ok?Y.value:null},{cache:BE.cache});import{join as He}from"path";import{readdir as ED$,readFile as Ue}from"fs/promises";import{release as NE}from"os";var u0=v$(()=>{try{if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";if(process.platform==="linux"){try{let $=c$().readFileSync("/proc/version",{encoding:"utf8"});if($.toLowerCase().includes("microsoft")||$.toLowerCase().includes("wsl"))return"wsl"}catch($){X$(`Failed to read /proc/version for WSL detection: ${$}`,{level:"error"})}return"linux"}return"unknown"}catch($){return oW($),"unknown"}}),CD$=v$(()=>{if(process.platform!=="linux")return;try{let $=c$().readFileSync("/proc/version",{encoding:"utf8"}),Q=$.match(/WSL(\d+)/i);if(Q&&Q[1])return Q[1];if($.toLowerCase().includes("microsoft"))return"1";return}catch($){X$(`Failed to read /proc/version for WSL detection: ${$}`,{level:"error"});return}}),TD$=v$(async()=>{if(process.platform!=="linux")return;let $={linuxKernel:NE()};try{let Q=await Ue("/etc/os-release","utf8");for(let J of Q.split(`
115
- `)){let Y=J.match(/^(ID|VERSION_ID)=(.*)$/);if(Y&&Y[1]&&Y[2]){let X=Y[2].replace(/^"|"$/g,"");if(Y[1]==="ID")$.linuxDistroId=X;else $.linuxDistroVersion=X}}}catch{}return $});var xD$=v$(()=>{if(process.platform!=="darwin")return;let Q=NE().match(/^(\d+)\./);if(!Q||!Q[1])return;return parseInt(Q[1],10)-9});var m0=v$(function(){switch(u0()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),uD$=v$(function(){return He(m0(),"managed-settings.d")});import{isAbsolute as wE}from"path";var Ke=b(()=>K.object({allowedDomains:K.array(K.string()).optional(),deniedDomains:K.array(K.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),allowManagedDomainsOnly:K.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:K.array(K.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:K.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:K.boolean().optional(),allowMachLookup:K.array(K.string().refine(($)=>{return!($.endsWith("*")?$.slice(0,-1):$).includes("*")},{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:K.number().optional(),socksProxyPort:K.number().optional(),tlsTerminate:K.object({caCertPath:K.string().min(1).optional(),caKeyPath:K.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session.")}).optional()),qe=b(()=>K.object({allowWrite:K.array(K.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:K.array(K.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:K.array(K.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:K.array(K.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:K.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),OE=b(()=>K.object({enabled:K.boolean().optional(),failIfUnavailable:K.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:K.boolean().optional(),allowUnsandboxedCommands:K.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:Ke(),filesystem:qe(),ignoreViolations:K.record(K.string(),K.array(K.string())).optional(),enableWeakerNestedSandbox:K.boolean().optional(),enableWeakerNetworkIsolation:K.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false"),excludedCommands:K.array(K.string()).optional(),ripgrep:K.object({command:K.string(),args:K.array(K.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:K.preprocess(($)=>typeof $==="string"&&wE($)?$:void 0,K.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:K.preprocess(($)=>typeof $==="string"&&wE($)?$:void 0,K.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough());var DE=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],FE=["normal","vim"],ZE=["auto","tmux","in-process"],Ve=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],ME=["auto",...Ve];var rD$=u0()==="macos"?"⏺":"●";var rJ=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],Be=[...rJ,"bubble"],LE=Be;var JF$=b(()=>vV.enum(LE)),XF$=b(()=>vV.enum(rJ));var jE=["bash","powershell"];var oJ=b(()=>K.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));function ze(){let $=K.object({type:K.literal("command").describe("Shell command hook type"),command:K.string().describe("Shell command to execute"),args:K.array(K.string()).optional().describe("Argument list for exec form. When present, `command` is resolved as "+"an executable and spawned directly with these arguments — no shell. "+"Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:oJ(),shell:K.enum(jE).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:K.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:K.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:K.string().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:K.string().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".')}),Q=K.object({type:K.literal("prompt").describe("LLM prompt hook type"),prompt:K.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:K.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.'),continueOnBlock:K.boolean().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")}),J=K.object({type:K.literal("mcp_tool").describe("MCP tool hook type"),server:K.string().describe("Name of an already-configured MCP server to invoke"),tool:K.string().describe("Name of the tool on that server to call"),input:K.record(K.string(),K.unknown()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")}),Y=K.object({type:K.literal("http").describe("HTTP hook type"),url:K.string().url().describe("URL to POST the hook input JSON to"),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:K.record(K.string(),K.string()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:K.array(K.string()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")}),X=K.object({type:K.literal("agent").describe("Agentic verifier hook type"),prompt:K.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:K.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.'),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:$,PromptHookSchema:Q,HttpHookSchema:Y,AgentHookSchema:X,McpToolHookSchema:J}}var AE=b(()=>{let{BashCommandHookSchema:$,PromptHookSchema:Q,AgentHookSchema:J,HttpHookSchema:Y,McpToolHookSchema:X}=ze();return K.discriminatedUnion("type",[$,Q,J,Y,X])}),IE=b(()=>K.object({matcher:K.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:K.array(AE()).describe("List of hooks to execute when the matcher matches")})),l0=b(()=>K.partialRecord(K.enum(r0),K.array(IE())));var zF$=b(()=>K.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),NF$=b(()=>K.enum(["stdio","sse","sse-ide","http","ws","sdk"])),P9=b(()=>K.literal("comms").optional().catch(void 0)),d1=b(()=>K.number().int().positive()),Ne=b(()=>K.object({type:K.literal("stdio").optional(),command:K.string().min(1,"Command cannot be empty"),args:K.array(K.string()).default([]),env:K.record(K.string(),K.string()).optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),we=b(()=>K.boolean()),RE=b(()=>K.object({clientId:K.string().optional(),callbackPort:K.number().int().positive().optional(),authServerMetadataUrl:K.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:K.string().min(1).optional(),xaa:we().optional()})),Oe=b(()=>K.object({type:K.literal("sse"),url:K.string(),headers:K.record(K.string(),K.string()).optional(),headersHelper:K.string().optional(),oauth:RE().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),De=b(()=>K.object({type:K.literal("sse-ide"),url:K.string(),ideName:K.string(),ideRunningInWindows:K.boolean().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Fe=b(()=>K.object({type:K.literal("ws-ide"),url:K.string(),ideName:K.string(),authToken:K.string().optional(),ideRunningInWindows:K.boolean().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Ze=b(()=>K.object({type:K.enum(["http","streamable-http"]).transform(()=>"http"),url:K.string(),headers:K.record(K.string(),K.string()).optional(),headersHelper:K.string().optional(),oauth:RE().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Me=b(()=>K.object({type:K.literal("ws"),url:K.string(),headers:K.record(K.string(),K.string()).optional(),headersHelper:K.string().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Le=b(()=>K.object({type:K.literal("sdk"),name:K.string(),timeout:d1().optional(),alwaysLoad:K.boolean().optional()})),je=b(()=>K.enum(["allow","ask","blocked"])),Ae=b(()=>K.object({type:K.literal("claudeai-proxy"),url:K.string(),id:K.string(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),toolPermissions:K.record(K.string(),je()).optional()})),sW=b(()=>K.union([Ne(),Oe(),De(),Fe(),Ze(),Me(),Le(),Ae()])),wF$=b(()=>K.object({mcpServers:K.record(K.string(),sW())}));var _E=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins"]);var Ie=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,Re=/[^\u0020-\u007E]/;function Pe($){if(_E.has($.toLowerCase()))return!1;if(Re.test($))return!0;return Ie.test($)}var Z4=b(()=>K.string().startsWith("./")),c0=b(()=>Z4().endsWith(".json")),PE=b(()=>K.union([Z4().refine(($)=>$.endsWith(".mcpb")||$.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),K.string().url().refine(($)=>$.endsWith(".mcpb")||$.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),jz=b(()=>Z4().endsWith(".md")),Az=b(()=>K.union([jz(),Z4()])),SE=b(()=>K.string().min(1,"Marketplace must have a name").refine(($)=>!$.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine(($)=>!$.includes("/")&&!$.includes("\\")&&!$.includes("..")&&$!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine(($)=>!Pe($),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine(($)=>$.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine(($)=>$.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine(($)=>$.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Iz=b(()=>K.object({name:K.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:K.string().optional().describe("Contact email for support or feedback"),url:K.string().optional().describe("Website, GitHub profile, or organization URL")})),Ee=b(()=>K.object({$schema:K.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:K.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:K.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:K.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:K.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Iz().optional().describe("Information about the plugin creator or maintainer"),homepage:K.string().url().optional().describe("Plugin homepage or documentation URL"),repository:K.string().optional().describe("Source code repository URL"),license:K.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:K.array(K.string()).optional().describe("Tags for plugin discovery and categorization"),dependencies:K.array(ae()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),AF$=b(()=>K.object({description:K.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:K.lazy(()=>l0()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),be=b(()=>K.object({hooks:K.union([c0().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),K.lazy(()=>l0()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),K.array(K.union([c0().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),K.lazy(()=>l0()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),_e=b(()=>K.object({source:Az().optional().describe("Path to command markdown file, relative to plugin root"),content:K.string().optional().describe("Inline markdown content for the command"),description:K.string().optional().describe("Command description override"),argumentHint:K.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:K.string().optional().describe("Default model for this command"),allowedTools:K.array(K.string()).optional().describe("Tools allowed when command runs")}).refine(($)=>$.source&&!$.content||!$.source&&$.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),Se=b(()=>K.object({commands:K.union([Az().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both."),K.array(Az().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),K.record(K.string(),_e()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),ke=b(()=>K.object({agents:K.union([jz().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both."),K.array(jz().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),ve=b(()=>K.object({skills:K.union([Z4().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory."),K.array(Z4().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory.")).describe("List of skill directory paths, loaded in addition to the skills/ directory.")])})),kE=b(()=>K.object({outputStyles:K.union([Z4().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both."),K.array(Z4().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),vE=b(()=>K.object({themes:K.union([Z4().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both."),K.array(Z4().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),Ce=b(()=>K.object({})),EE=b(()=>K.string().min(1)),Te=b(()=>K.string().min(2).refine(($)=>$.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),xe=b(()=>K.object({mcpServers:K.union([c0().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),PE().describe("Path or URL to MCPB file containing MCP server configuration"),K.record(K.string(),sW()).describe("MCP server configurations keyed by server name"),K.array(K.union([c0().describe("Path to MCP servers configuration file"),PE().describe("Path or URL to MCPB file"),K.record(K.string(),sW()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),CE=b(()=>K.object({type:K.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:K.string().describe("Human-readable label shown in the config dialog"),description:K.string().describe("Help text shown beneath the field in the config dialog"),required:K.boolean().optional().describe("If true, validation fails when this field is empty"),default:K.union([K.string(),K.number(),K.boolean(),K.array(K.string())]).optional().describe("Default value used when the user provides nothing"),multiple:K.boolean().optional().describe("For string type: allow an array of strings"),sensitive:K.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:K.number().optional().describe("Minimum value (number type only)"),max:K.number().optional().describe("Maximum value (number type only)")}).strict()),ye=b(()=>K.object({userConfig:K.record(K.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),CE()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),fe=b(()=>K.object({channels:K.array(K.object({server:K.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:K.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:K.record(K.string(),CE()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),bE=b(()=>K.strictObject({command:K.string().min(1).refine(($)=>{if($.includes(" ")&&!$.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:K.array(EE()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:K.record(Te(),EE()).refine(($)=>Object.keys($).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:K.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:K.record(K.string(),K.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:K.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:K.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:K.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:K.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:K.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:K.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:K.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up")})),ge=b(()=>K.strictObject({name:K.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:K.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:K.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:K.union([K.literal("always"),K.string().startsWith("on-skill-invoke:").refine(($)=>$.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),he=b(()=>K.array(ge()).refine(($)=>new Set($.map((Q)=>Q.name)).size===$.length,{message:"Monitor names must be unique within a plugin"})),TE=b(()=>K.object({monitors:K.union([c0().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),he()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),ue=b(()=>K.object({lspServers:K.union([c0().describe("Path to .lsp.json configuration file relative to plugin root"),K.record(K.string(),bE()).describe("LSP server configurations keyed by server name"),K.array(K.union([c0().describe("Path to LSP configuration file"),K.record(K.string(),bE()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),xE=b(()=>K.string().refine(($)=>!$.includes("..")&&!$.includes("//"),"Package name cannot contain path traversal patterns").refine(($)=>{let Q=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,J=/^[a-z0-9][a-z0-9-._]*$/;return Q.test($)||J.test($)},"Invalid npm package name format")),me=b(()=>K.object({settings:K.record(K.string(),K.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),le=b(()=>K.object({experimental:K.preprocess(($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,K.object({...vE().partial().shape,...TE().partial().shape,...kE().partial().shape,evals:K.union([K.string(),K.array(K.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),ce=b(()=>K.object({...Ee().shape,...be().partial().shape,...Se().partial().shape,...ke().partial().shape,...ve().partial().shape,...kE().partial().shape,...vE().partial().shape,...Ce().shape,...fe().partial().shape,...xe().partial().shape,...ue().partial().shape,...TE().partial().shape,...me().partial().shape,...ye().partial().shape,...le().partial().shape})),tJ=b(()=>K.discriminatedUnion("source",[K.object({source:K.literal("url"),url:K.string().url().describe("Direct URL to marketplace.json file"),headers:K.record(K.string(),K.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),K.object({source:K.literal("github"),repo:K.string().describe("GitHub repository in owner/repo format"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:K.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:K.array(K.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.')}),K.object({source:K.literal("git"),url:K.string().describe("Full git repository URL"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:K.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:K.array(K.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.')}),K.object({source:K.literal("npm"),package:xE().describe("NPM package containing marketplace.json")}),K.object({source:K.literal("file"),path:K.string().describe("Local file path to marketplace.json")}),K.object({source:K.literal("directory"),path:K.string().describe("Local directory containing .claude-plugin/marketplace.json")}),K.object({source:K.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),K.object({source:K.literal("hostPattern"),hostPattern:K.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against "github.com". For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),K.object({source:K.literal("pathPattern"),pathPattern:K.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),K.object({source:K.literal("settings"),name:SE().refine(($)=>!_E.has($.toLowerCase()),{message:"Reserved official marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection — "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:K.array(pe()).describe("Plugin entries declared inline in settings.json"),owner:Iz().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),Lz=b(()=>K.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),yE=b(()=>K.union([Z4().describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),K.object({source:K.literal("npm"),package:xE().or(K.string().refine(($)=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test($)||!$.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:K.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:K.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),K.object({source:K.literal("url"),url:K.string().describe("Full git repository URL (https:// or git@)"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Lz().optional().describe("Specific commit SHA to use")}),K.object({source:K.literal("github"),repo:K.string().describe("GitHub repository in owner/repo format"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Lz().optional().describe("Specific commit SHA to use")}),K.object({source:K.literal("git-subdir"),url:K.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:K.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Lz().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),K.object({source:K.literal("unsupported")}).describe("Placeholder for source types this Claude Code version does not "+"recognize. Never authored by hand — PluginMarketplaceSchema rewrites "+'unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),pe=b(()=>K.object({name:K.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:yE().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:K.string().optional(),version:K.string().optional(),strict:K.boolean().optional()}).refine(($)=>typeof $.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine(($)=>typeof $.source==="string"||$.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."}));var de=b(()=>K.object({cli:K.array(K.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:K.array(K.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) — exact, case-insensitive match against '+"hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path."),filePath:K.string().max(256).optional().describe("RegExp source matched (case-insensitive) against file paths read this session, or present in cwd at session start."),manifestDeps:K.array(K.object({file:K.string().max(256),pattern:K.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: "+"`file` matches the manifest filename (package.json, go.mod, requirements.txt, …); "+"`pattern` matches the dependency declaration inside that file. Evaluated against files read this session, or present in cwd at session start.")})),ie=b(()=>K.object({topic:K.string().max(64).optional().describe('What the user is working with when this plugin is relevant — fills "Working with {topic}?". '+'Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:de().optional().describe("Matchers that determine when the plugin is relevant.")})),ne=b(()=>ce().partial().extend({name:K.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:yE().describe("Where to fetch the plugin from"),category:K.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:K.array(K.string()).optional().describe("Tags for searchability and discovery"),strict:K.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:K.preprocess(($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,ie().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),re=b(()=>K.object({name:K.string().min(1).refine(($)=>!$.includes(" "))}));function oe($){let Q=ne();return $.flatMap((J,Y)=>{let X=Q.safeParse(J);if(X.success)return[X.data];let W=re().safeParse(J).data?.name,G=X.error.issues.map((U)=>`${U.path.join(".")}: ${U.message}`).join(", ");if(W)return X$(`Stubbing unparseable marketplace plugin entry (${W}): ${G}`,{level:"warn"}),[{name:W,source:{source:"unsupported"},strict:!0}];return X$(`Dropping unparseable marketplace plugin entry (index ${Y}): ${G}`,{level:"warn"}),[]})}var IF$=b(()=>K.object({$schema:K.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:SE(),version:K.string().optional().describe("Marketplace manifest version"),description:K.string().optional().describe("Human-readable description of this marketplace"),owner:Iz().describe("Marketplace maintainer or curator information"),plugins:K.array(K.unknown()).transform(oe).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:K.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:K.object({pluginRoot:K.string().optional().describe("Base path for relative plugin sources"),version:K.string().optional().describe("Marketplace version"),description:K.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:K.array(K.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.")})),fE=b(()=>K.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),te=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,ae=b(()=>K.union([K.string().regex(te,"Dependency must be a plugin name, optionally qualified with @marketplace").transform(($)=>$.replace(/@\^[^@]*$/,"")),K.object({name:K.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:K.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform(($)=>$.marketplace?`${$.name}@${$.marketplace}`:$.name)])),se=b(()=>K.object({version:K.string().describe("Currently installed version"),installedAt:K.string().describe("ISO 8601 timestamp of installation"),lastUpdated:K.string().optional().describe("ISO 8601 timestamp of last update"),installPath:K.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:K.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:K.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:K.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),ee=b(()=>K.object({version:K.literal(1).describe("Schema version 1"),plugins:K.record(fE(),se()).describe("Map of plugin IDs to their installation metadata")})),$$$=b(()=>K.enum(["managed","user","project","local"])),Q$$=b(()=>K.object({scope:$$$().describe("Installation scope"),projectPath:K.string().optional().describe("Project path (required for project/local scopes)"),installPath:K.string().describe("Absolute path to the versioned plugin directory"),version:K.string().optional().describe("Currently installed version"),installedAt:K.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:K.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:K.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:K.string().optional().describe("Tag-derived semver this install resolved to"),auto:K.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),J$$=b(()=>K.object({version:K.literal(2).describe("Schema version 2"),plugins:K.record(fE(),K.array(Q$$())).describe("Map of plugin IDs to arrays of installation entries")})),RF$=b(()=>K.union([ee(),J$$()])),X$$=b(()=>K.object({source:tJ().describe("Where to fetch the marketplace from"),installLocation:K.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:K.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:K.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),PF$=b(()=>K.record(K.string(),X$$()));var gE=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];var hE="https://json.schemastore.org/claude-code-settings.json";var Y$$=["autoMode","deepLink","voice","assistant","briefView"],eW={},$G={autoMode:{buildGate:()=>!1,shape:()=>eW,permissionsShape:()=>eW,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:K.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>eW},assistant:{buildGate:()=>!1,shape:()=>eW},briefView:{buildGate:()=>!0,shape:()=>({defaultView:K.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})}};function Rz(){return Y$$.filter(($)=>$G[$].buildGate())}function uE($){let Q={};for(let J of $)Q={...Q,...$G[J].shape()};return Q}function mE($){let Q={};for(let J of $)Q={...Q,...$G[J].permissionsShape?.()};return Q}function lE($){let Q=[];for(let J of $)Q.push(...$G[J].permissionModes?.()??[]);return Q}function cE($){let Q=$.split("__"),[J,Y,...X]=Q;if(J!=="mcp"||!Y)return null;let W=X.length>0?X.join("__"):void 0;return{serverName:Y,toolName:W}}var pE={Task:"Agent",KillShell:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage"};function E9($){return Object.hasOwn(pE,$)?pE[$]:$}var dE="workspace",uF$=`mcp__${dE}__bash`,mF$=`mcp__${dE}__web_fetch`;function W$$($){return $.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function iE($){let Q=G$$($,"(");if(Q===-1)return{toolName:E9($)};let J=U$$($,")");if(J===-1||J<=Q)return{toolName:E9($)};if(J!==$.length-1)return{toolName:E9($)};let Y=$.substring(0,Q),X=$.substring(Q+1,J);if(!Y)return{toolName:E9($)};if(X===""||X==="*")return{toolName:E9(Y)};let W=W$$(X);return{toolName:E9(Y),ruleContent:W}}function G$$($,Q){for(let J=0;J<$.length;J++)if($[J]===Q){let Y=0,X=J-1;while(X>=0&&$[X]==="\\")Y++,X--;if(Y%2===0)return J}return-1}function U$$($,Q){for(let J=$.length-1;J>=0;J--)if($[J]===Q){let Y=0,X=J-1;while(X>=0&&$[X]==="\\")Y++,X--;if(Y%2===0)return J}return-1}var QG={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit"],bashPrefixTools:["Bash"],customValidation:{WebSearch:($)=>{if($.includes("*")||$.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:($)=>{if($.includes("://")||$.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!$.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}};function nE($){return QG.filePatternTools.includes($)}function rE($){return QG.bashPrefixTools.includes($)}function oE($){return Object.hasOwn(QG.customValidation,$)?QG.customValidation[$]:void 0}function tE($,Q){let J=0,Y=Q-1;while(Y>=0&&$[Y]==="\\")J++,Y--;return J%2!==0}function Pz($,Q){let J=0;for(let Y=0;Y<$.length;Y++)if($[Y]===Q&&!tE($,Y))J++;return J}function H$$($){for(let Q=0;Q<$.length-1;Q++)if($[Q]==="("&&$[Q+1]===")"){if(!tE($,Q))return!0}return!1}function Ez($){if(!$||$.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let Q=Pz($,"("),J=Pz($,")");if(Q!==J)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(H$$($)){let G=$.substring(0,$.indexOf("("));if(!G)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${G}" without parentheses`,examples:[`${G}`,`${G}(some-pattern)`]}}let Y=iE($),X=cE(Y.toolName);if(X){if(Y.ruleContent!==void 0||Pz($,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${Y.toolName}" without parentheses, or use "mcp__${X.serverName}__*" for all tools`,examples:[`mcp__${X.serverName}`,`mcp__${X.serverName}__*`,X.toolName&&X.toolName!=="*"?`mcp__${X.serverName}__${X.toolName}`:void 0].filter(Boolean)};return{valid:!0}}if(!Y.toolName||Y.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(!Y.toolName.includes("_")&&Y.toolName[0]!==Y.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${BU(String(Y.toolName))}"`};let W=oE(Y.toolName);if(W&&Y.ruleContent!==void 0){let G=W(Y.ruleContent);if(!G.valid)return G}if(rE(Y.toolName)&&Y.ruleContent!==void 0){let G=Y.ruleContent;if(G.includes(":*")&&!G.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(G===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]}}if(nE(Y.toolName)&&Y.ruleContent!==void 0){let G=Y.ruleContent;if(G.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${Y.toolName}(*.ts) - matches .ts files`,`${Y.toolName}(src/**) - matches all files in src`,`${Y.toolName}(**/*.test.ts) - matches test files`]};if(G.includes("*")&&!G.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!G.includes("**"))return{valid:!1,error:"Wildcard placement might be incorrect",suggestion:"Wildcards are typically used at path boundaries",examples:[`${Y.toolName}(*.js) - all .js files`,`${Y.toolName}(src/*) - all files directly in src`,`${Y.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var JG=b(()=>K.string().superRefine(($,Q)=>{let J=Ez($);if(!J.valid){let Y=J.error;if(J.suggestion)Y+=`. ${J.suggestion}`;if(J.examples&&J.examples.length>0)Y+=`. Examples: ${J.examples.join(", ")}`;Q.addIssue({code:K.ZodIssueCode.custom,message:Y,params:{received:$}})}}));var K$$=b(()=>K.record(K.string(),K.coerce.string()));function sE($){return K.object({allow:K.array(JG()).optional().describe("List of permission rules for allowed operations"),deny:K.array(JG()).optional().describe("List of permission rules for denied operations"),ask:K.array(JG()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:K.enum([...rJ,...lE($)]).optional().describe("Default permission mode when Claude Code needs access"),disableBypassPermissionsMode:K.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...mE($),additionalDirectories:K.array(K.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var KZ$=b(()=>sE(Rz())),q$$=b(()=>K.object({source:tJ().describe("Where to fetch the marketplace from"),installLocation:K.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:K.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),V$$=b(()=>K.object({serverName:K.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:K.array(K.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:K.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(($)=>{return kH([$.serverName!==void 0,$.serverCommand!==void 0,$.serverUrl!==void 0],Boolean)===1},{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),B$$=b(()=>K.object({serverName:K.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:K.array(K.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:K.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(($)=>{return kH([$.serverName!==void 0,$.serverCommand!==void 0,$.serverUrl!==void 0],Boolean)===1},{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),z$$=b(()=>K.object({path:K.string().describe("Absolute path to the helper executable"),timeoutMs:K.number().int().min(1000).optional(),refreshIntervalMs:K.union([K.literal(0),K.number().int().min(60000)]).optional()})),aE=["skills","agents","hooks","mcp"];function eE($){return K.object({$schema:K.literal(hE).optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:K.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:K.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:K.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:K.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:K.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),policyHelper:z$$().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...A$(process.env.CLAUDE_CODE_ENABLE_XAA)&&{xaaIdp:K.object({issuer:K.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:K.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:K.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:K.object({type:K.literal("command"),command:K.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:K.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:K.object({enabled:K.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:K.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 120). Re-fires every interval until you take a break."),breakThresholdMinutes:K.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 15)"),message:K.string().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks — just a friendly heads-up."),quietHours:K.object({enabled:K.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:K.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:K.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:K.number().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),skillListingMaxDescChars:K.number().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:K.number().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:K.boolean().optional().describe("When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:K$$().optional().describe("Environment variables to set for Claude Code sessions"),attribution:K.object({commit:K.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:K.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:K.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),includeGitInstructions:K.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:sE($).optional().describe("Tool usage permissions configuration"),model:K.string().optional().describe("Override the default model used by Claude Code"),availableModels:K.array(K.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),modelOverrides:K.record(K.string(),K.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:K.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:K.array(K.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:K.array(K.string()).optional().describe("List of rejected MCP servers from .mcp.json"),skillOverrides:K.record(K.string(),K.enum(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),allowedMcpServers:K.array(V$$()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:K.array(B$$()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:l0().optional().describe("Custom commands to run before/after tool executions"),worktree:K.object({symlinkDirectories:K.array(K.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:K.array(K.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos — only the listed paths are written to disk."),baseRef:K.enum(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:K.enum(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:K.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:K.boolean().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:K.boolean().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableSkillShellExecution:K.boolean().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:K.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:K.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:K.array(K.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:K.array(K.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:K.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:K.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:K.boolean().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:K.preprocess((Q)=>Array.isArray(Q)?Q.filter((J)=>aE.includes(J)):Q,K.union([K.boolean(),K.array(K.enum(aE))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:K.object({type:K.literal("command"),command:K.string(),padding:K.number().optional(),refreshInterval:K.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:K.boolean().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:K.string().optional().describe('URL template for PR links in the footer badge and inline messages. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),subagentStatusLine:K.object({type:K.literal("command"),command:K.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:K.record(K.string(),K.union([K.array(K.string()),K.boolean(),K.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json — setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:K.record(K.string(),q$$()).check((Q)=>{for(let[J,Y]of Object.entries(Q.value))if(Y.source.source==="settings"&&Y.source.name!==J)Q.issues.push({code:"custom",input:Y.source.name,path:[J,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${J}" but source.name "${Y.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:K.array(tJ()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. "+"Note: this is a policy gate only — it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:K.array(tJ()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),forceLoginMethod:K.enum(["claudeai","console"]).optional().describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing'),parentSettingsBehavior:K.enum(["first-wins","merge"]).optional().describe('Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" '+"(default): parent is dropped — admin tiers are the only policy "+`source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),forceLoginOrgUUID:K.union([K.string(),K.array(K.string())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:K.boolean().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:K.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:K.string().optional().describe("Controls the output style for assistant responses"),viewMode:K.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:K.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:K.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:OE().optional(),feedbackSurveyRate:K.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:K.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:K.object({mode:K.enum(["append","replace"]),verbs:K.array(K.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:K.object({excludeDefault:K.boolean().optional(),tips:K.array(K.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:K.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:K.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:K.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:K.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),autoCompactWindow:K.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:K.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:K.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:K.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:K.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),awaySummaryEnabled:K.boolean().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:K.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:K.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:K.array(K.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:K.record(K.string(),K.object({mcpServers:K.record(K.string(),K.record(K.string(),K.union([K.string(),K.number(),K.boolean(),K.array(K.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:K.record(K.string(),K.union([K.string(),K.number(),K.boolean(),K.array(K.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:K.object({defaultEnvironmentId:K.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:K.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:K.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),plansDirectory:K.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:K.enum(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),...!1,voice:K.object({enabled:K.boolean().optional(),mode:K.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:K.boolean().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:K.boolean().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:K.array(K.object({marketplace:K.string(),plugin:K.string()})).optional().describe("Managed-org allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist — admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:K.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:K.boolean().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),autoMemoryEnabled:K.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:K.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:K.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:K.boolean().optional().describe("Show thinking summaries in the transcript view (ctrl+o). Default: false."),skipDangerousModePermissionPrompt:K.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),disableAutoMode:K.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:K.array(K.object({id:K.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:K.string().describe("Display name for the SSH connection"),sshHost:K.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:K.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:K.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:K.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:K.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:K.array(K.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:K.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:K.union([K.enum(ME),K.string().startsWith("custom:").transform((Q)=>Q)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:K.enum(FE).optional().catch(void 0).describe("Key binding mode for the prompt input"),verbose:K.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:K.enum(DE).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:K.boolean().optional().describe("Automatically compact conversation when context fills"),autoScrollEnabled:K.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),fileCheckpointingEnabled:K.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:K.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:K.boolean().optional().describe("Stamp each assistant message with its arrival time"),terminalProgressBarEnabled:K.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:K.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:K.enum(ZE).optional().catch(void 0).describe("How spawned teammates execute (tmux, in-process, auto)"),remoteControlAtStartup:K.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:K.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:K.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:K.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:K.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:K.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...uE($)}).passthrough()}var _4=b(()=>eE(Rz()));var X1="https://code.claude.com/docs/en",N$$=[{matches:($)=>$.path==="permissions.defaultMode"&&$.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${X1}/iam#permission-modes`}},{matches:($)=>$.path==="apiKeyHelper"&&$.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:($)=>$.path==="cleanupPeriodDays"&&$.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:($)=>$.path.startsWith("env.")&&$.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${X1}/settings#environment-variables`}},{matches:($)=>($.path==="permissions.allow"||$.path==="permissions.deny")&&$.code==="invalid_type"&&$.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:($)=>$.path.startsWith("hooks.")&&$.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${X1}/hooks`}},{matches:($)=>/\.hooks\.\d+\.command$/.test($.path)&&$.code==="invalid_type"&&$.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${X1}/hooks#exec-form-and-shell-form`}},{matches:($)=>$.path.includes("hooks")&&$.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:($)=>$.code==="invalid_type"&&$.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:($)=>$.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${X1}/settings`}},{matches:($)=>$.code==="invalid_value"&&$.enumValues!==void 0,tip:{suggestion:void 0}},{matches:($)=>$.code==="invalid_type"&&$.expected==="object"&&$.received===null&&$.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:($)=>$.path==="permissions.additionalDirectories"&&$.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${X1}/iam#working-directories`}}],w$$={permissions:`${X1}/iam#configuring-permissions`,env:`${X1}/settings#environment-variables`,hooks:`${X1}/hooks`};function $b($){let Q=N$$.find((Y)=>Y.matches($));if(!Q)return null;let J={...Q.tip};if($.code==="invalid_value"&&$.enumValues&&!J.suggestion)J.suggestion=`Valid values: ${$.enumValues.map((Y)=>`"${Y}"`).join(", ")}`;if(!J.docLink&&$.path)J.docLink=w$$[nO($.path,".")];return J}var PZ$=b(()=>_4().strict());function Qb($){return $.code==="invalid_type"}function Jb($){return $.code==="invalid_value"}function O$$($){return $.code==="unrecognized_keys"}function Xb($){return $.code==="too_small"}function aJ($){if($===null)return"null";if($===void 0)return"undefined";if(Array.isArray($))return"array";return typeof $}function Yb($){let Q=$.match(/received (\w+)/);return Q?Q[1]:void 0}function d0($,Q){return $.issues.map((J)=>{let Y=J.path.map(String).join("."),X=J.message,W,G,U,H,q;if(Jb(J))G=J.values.map((B)=>String(B)),U=G.join(" | "),H=void 0,q=void 0;else if(Qb(J)){U=J.expected;let B=Yb(J.message);H=B??aJ(J.input),q=B??aJ(J.input)}else if(Xb(J))U=String(J.minimum);else if(J.code==="custom"&&"params"in J)H=J.params.received,q=H;let V=$b({path:Y,code:J.code,expected:U,received:H,enumValues:G,message:J.message,value:H});if(Jb(J))W=G?.map((B)=>`"${B}"`).join(", "),X=`Invalid value. Expected one of: ${W}`;else if(Qb(J)){let B=Yb(J.message)??aJ(J.input);if(J.expected==="object"&&B==="null"&&Y==="")X="Invalid or malformed JSON";else X=`Expected ${J.expected}, but received ${B}`}else if(O$$(J)){let B=J.keys.join(", ");X=`Unrecognized ${iO(J.keys.length,"field")}: ${B}`}else if(Xb(J))X=`Number must be greater than or equal to ${J.minimum}`,W=String(J.minimum);return{file:Q,path:Y,message:X,expected:W,invalidValue:q,suggestion:V?.suggestion,docLink:V?.docLink}})}function D$$($,Q){if(!$||typeof $!=="object")return[];let J=$;if(!J.permissions||typeof J.permissions!=="object")return[];let Y=J.permissions,X=[];for(let W of["allow","deny","ask"]){let G=Y[W];if(!Array.isArray(G))continue;Y[W]=G.filter((U)=>{if(typeof U!=="string")return X.push({file:Q,path:`permissions.${W}`,message:`Non-string value in ${W} array was removed`,severity:"warning",invalidValue:U}),!1;let H=Ez(U);if(!H.valid){let q=`Invalid permission rule "${U}" was skipped: ${H.error}`;if(H.suggestion)q+=`. ${H.suggestion}`;return X.push({file:Q,path:`permissions.${W}`,message:q,severity:"warning",invalidValue:U}),!1}return!0})}return X}var F$$=new Set(r0);function Z$$($,Q){if(!$||typeof $!=="object")return[];let J=$;if(!("hooks"in J))return[];if(J.hooks===null||typeof J.hooks!=="object"||Array.isArray(J.hooks)){let W=aJ(J.hooks);return delete J.hooks,[{file:Q,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${W}. This field was ignored.`,severity:"warning",invalidValue:W,docLink:"https://code.claude.com/docs/en/hooks"}]}let Y=J.hooks,X=[];for(let W of Object.keys(Y)){if(!F$$.has(W)){delete Y[W],X.push({file:Q,path:`hooks.${W}`,message:`Unknown hook event "${W}" was ignored. Valid events: ${r0.join(", ")}`,severity:"warning",invalidValue:W,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(Y[W])){let G=aJ(Y[W]);delete Y[W],X.push({file:Q,path:`hooks.${W}`,message:`Hook event "${W}" must be an array of matchers; received ${G}. This entry was ignored.`,severity:"warning",invalidValue:G,docLink:"https://code.claude.com/docs/en/hooks"})}}if(X.length>0&&Object.keys(Y).length===0)delete J.hooks;return X}function i1($,Q){return[...D$$($,Q),...Z$$($,Q)]}import{userInfo as M$$}from"os";var Wb="com.anthropic.claudecode",sJ="HKLM\\SOFTWARE\\Policies\\ClaudeCode",eJ="HKCU\\SOFTWARE\\Policies\\ClaudeCode",n1="Settings",Gb="/usr/bin/plutil",Ub=["-convert","json","-o","-","--"],Hb=5000,bz="/mnt/c/Windows/System32/reg.exe",b9="/mnt/c/Program Files/ClaudeCode";function XG(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let $=v6("fs").readFileSync("/proc/version","utf8").toLowerCase();return $.includes("microsoft")||$.includes("wsl")}catch{return!1}}function Kb(){let $="";try{$=M$$().username}catch{}let Q=[];if($)Q.push({path:`/Library/Managed Preferences/${$}/${Wb}.plist`,label:"per-user managed preferences"});return Q.push({path:`/Library/Managed Preferences/${Wb}.plist`,label:"device-level managed preferences"}),Q}import{execFile as L$$}from"child_process";import{existsSync as j$$}from"fs";var A$$=null;function $X($,Q){return new Promise((J)=>{try{L$$($,Q,{encoding:"utf-8",timeout:Hb},(Y,X)=>{J({stdout:X??"",code:Y?1:0})})}catch{J({stdout:"",code:1})}})}function qb(){return(async()=>{if(process.platform==="darwin"){let $=Kb(),J=(await Promise.all($.map(async({path:Y,label:X})=>{if(!j$$(Y))return{stdout:"",label:X,ok:!1};let{stdout:W,code:G}=await $X(Gb,[...Ub,Y]);return{stdout:W,label:X,ok:G===0&&!!W}}))).find((Y)=>Y.ok);return{plistStdouts:J?[{stdout:J.stdout,label:J.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let Q=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[J,Y]=await Promise.all([$X(Q,["query",sJ,"/v",n1]),$X(Q,["query",eJ,"/v",n1])]);return{plistStdouts:null,hklmStdout:J.code===0?J.stdout:null,hkcuStdout:Y.code===0?Y.stdout:null}}if(XG()){let[$,Q]=await Promise.all([$X(bz,["query",sJ,"/v",n1]),$X(bz,["query",eJ,"/v",n1])]);return{plistStdouts:null,hklmStdout:$.code===0?$.stdout:null,hkcuStdout:Q.code===0?Q.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function Vb(){return A$$}var r1=Object.freeze({settings:{},errors:[]}),wb=null,Ob=null,Db=!1,YG=null;function I$$(){if(YG)return;YG=(async()=>{let $=Date.now(),Q=Vb()??qb(),{mdm:J,hkcu:Y,wslInherits:X}=R$$(await Q);wb=J,Ob=Y,Db=X;let W=Date.now()-$;if(X$(`MDM settings load completed in ${W}ms`),Object.keys(J.settings).length>0){X$(`MDM settings found: ${Object.keys(J.settings).join(", ")}`);try{iJ("info","mdm_settings_loaded",{duration_ms:W,key_count:Object.keys(J.settings).length,error_count:J.errors.length})}catch{}}})()}async function Fb(){if(!YG)I$$();await YG}function Zb(){return wb??r1}function Mb(){return Ob??r1}function Lb(){return Db}function _z($,Q){let J=A4(R9($,!1));if(!J||typeof J!=="object")return{settings:{},errors:[]};let Y=i1(J,Q),X=_4().safeParse(J);if(!X.success){let W=d0(X.error,Q);return{settings:{},errors:[...Y,...W]}}return{settings:X.data,errors:Y}}function Bb($,Q="Settings"){let J=$.split(/\r?\n/),Y=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`^\\s+${Y}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let W of J){let G=W.match(X);if(G&&G[1])return G[1].trimEnd()}return null}function R$$($){let Q=[];if($.plistStdouts&&$.plistStdouts.length>0){let{stdout:G,label:U}=$.plistStdouts[0],H=_z(G,U),{wslInheritsWindowsSettings:q,...V}=H.settings;if(Object.keys(V).length>0)return{mdm:H,hkcu:r1,wslInherits:!1};Q.push(...H.errors)}let J=null;if($.hklmStdout){let G=Bb($.hklmStdout);if(G)J=_z(G,`Registry: ${sJ}\\${n1}`)}if(J)Q.push(...J.errors);let Y=Q.length>0?{settings:{},errors:Q}:r1,X=XG(),W=!1;if(X){if(W=J?.settings.wslInheritsWindowsSettings===!0||E$$(),!W)return{mdm:Y,hkcu:r1,wslInherits:!1}}if(J){let{wslInheritsWindowsSettings:G,...U}=J.settings;if(Object.keys(U).length>0)return{mdm:J,hkcu:r1,wslInherits:W}}if(P$$(W))return{mdm:Y,hkcu:r1,wslInherits:W};if($.hkcuStdout){let G=Bb($.hkcuStdout);if(G){let U=_z(G,`Registry: ${eJ}\\${n1}`);if(!X||U.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:H,...q}=U.settings;return{mdm:Y,hkcu:{settings:q,errors:U.errors},wslInherits:W}}if(U.errors.length>0)return{mdm:Y,hkcu:{settings:{},errors:U.errors},wslInherits:W}}}return{mdm:Y,hkcu:r1,wslInherits:W}}function P$$($){if($&&Nb(b9))return!0;return Nb(m0())}function zb($){let Q=A4(R9(h0($),!1));if(!Q||typeof Q!=="object")return!1;i1(Q,$);let{wslInheritsWindowsSettings:J,...Y}=Q;return Object.keys(Y).length>0}function E$$(){function $(Q){try{let J=R9(h0(Q),!1);return!!J&&typeof J==="object"&&"wslInheritsWindowsSettings"in J&&J.wslInheritsWindowsSettings===!0}catch{return!1}}if($(_9(b9,"managed-settings.json")))return!0;try{let Q=_9(b9,"managed-settings.d");for(let J of c$().readdirSync(Q))if((J.isFile()||J.isSymbolicLink())&&J.name.endsWith(".json")&&!J.name.startsWith(".")&&$(_9(Q,J.name)))return!0}catch{}return!1}function Nb($){try{if(zb(_9($,"managed-settings.json")))return!0}catch{}try{let Q=_9($,"managed-settings.d"),J=c$().readdirSync(Q);for(let Y of J){if(!(Y.isFile()||Y.isSymbolicLink())||!Y.name.endsWith(".json")||Y.name.startsWith("."))continue;try{if(zb(_9(Q,Y.name)))return!0}catch{}}}catch{}return!1}function b$$($,Q,J){if(J!==void 0&&!H1($[Q],J)||J===void 0&&!(Q in $))Z8($,Q,J)}var QX=b$$;function _$$($){return function(Q,J,Y){var X=-1,W=Object(Q),G=Y(Q),U=G.length;while(U--){var H=G[$?U:++X];if(J(W[H],H,W)===!1)break}return Q}}var jb=_$$;var S$$=jb(),Ab=S$$;function k$$($){return r6($)&&L8($)}var Ib=k$$;var v$$="[object Object]",C$$=Function.prototype,T$$=Object.prototype,Rb=C$$.toString,x$$=T$$.hasOwnProperty,y$$=Rb.call(Object);function f$$($){if(!r6($)||L4($)!=v$$)return!1;var Q=W5($);if(Q===null)return!0;var J=x$$.call(Q,"constructor")&&Q.constructor;return typeof J=="function"&&J instanceof J&&Rb.call(J)==y$$}var Pb=f$$;function g$$($,Q){if(Q==="constructor"&&typeof $[Q]==="function")return;if(Q=="__proto__")return;return $[Q]}var JX=g$$;function h$$($){return pw($,J5($))}var Eb=h$$;function u$$($,Q,J,Y,X,W,G){var U=JX($,J),H=JX(Q,J),q=G.get(H);if(q){QX($,J,q);return}var V=W?W(U,H,J+"",$,Q,G):void 0,B=V===void 0;if(B){var z=B6(H),N=!z&&TQ(H),w=!z&&!N&&$5(H);if(V=H,z||N||w)if(B6(U))V=U;else if(Ib(U))V=KO(U);else if(N)B=!1,V=UU(H,!0);else if(w)B=!1,V=BO(H,!0);else V=[];else if(Pb(H)||h4(H)){if(V=U,h4(U))V=Eb(U);else if(!$6(U)||o0(U))V=wO(H)}else B=!1}if(B)G.set(H,V),X(V,H,Y,W,G),G.delete(H);QX($,J,V)}var bb=u$$;function _b($,Q,J,Y,X){if($===Q)return;Ab(Q,function(W,G){if(X||(X=new cw),$6(W))bb($,Q,G,J,_b,Y,X);else{var U=Y?Y(JX($,G),W,G+"",$,Q,X):void 0;if(U===void 0)U=W;QX($,G,U)}},J5)}var Sb=_b;function m$$($,Q,J){switch(J.length){case 0:return $.call(Q);case 1:return $.call(Q,J[0]);case 2:return $.call(Q,J[0],J[1]);case 3:return $.call(Q,J[0],J[1],J[2])}return $.apply(Q,J)}var kb=m$$;var vb=Math.max;function l$$($,Q,J){return Q=vb(Q===void 0?$.length-1:Q,0),function(){var Y=arguments,X=-1,W=vb(Y.length-Q,0),G=Array(W);while(++X<W)G[X]=Y[Q+X];X=-1;var U=Array(Q+1);while(++X<Q)U[X]=Y[X];return U[Q]=J(G),kb($,this,U)}}var WG=l$$;function c$$($){return function(){return $}}var Cb=c$$;var p$$=!F8?G5:function($,Q){return F8($,"toString",{configurable:!0,enumerable:!1,value:Cb(Q),writable:!0})},Tb=p$$;var d$$=800,i$$=16,n$$=Date.now;function r$$($){var Q=0,J=0;return function(){var Y=n$$(),X=i$$-(Y-J);if(J=Y,X>0){if(++Q>=d$$)return arguments[0]}else Q=0;return $.apply(void 0,arguments)}}var xb=r$$;var o$$=xb(Tb),GG=o$$;function t$$($,Q){return GG(WG($,Q,G5),$+"")}var yb=t$$;function a$$($,Q,J){if(!$6(J))return!1;var Y=typeof Q;if(Y=="number"?L8(J)&&F1(Q,J.length):Y=="string"&&(Q in J))return H1(J[Q],$);return!1}var fb=a$$;function s$$($){return yb(function(Q,J){var Y=-1,X=J.length,W=X>1?J[X-1]:void 0,G=X>2?J[2]:void 0;if(W=$.length>3&&typeof W=="function"?(X--,W):void 0,G&&fb(J[0],J[1],G))W=X<3?void 0:W,X=1;Q=Object(Q);while(++Y<X){var U=J[Y];if(U)$(Q,U,Y,W)}return Q})}var gb=s$$;var e$$=gb(function($,Q,J,Y){Sb($,Q,J,Y)}),Y1=e$$;function $6$($,Q,J,Y){if(!$6($))return $;Q=Z1(Q,$);var X=-1,W=Q.length,G=W-1,U=$;while(U!=null&&++X<W){var H=A8(Q[X]),q=J;if(H==="__proto__"||H==="constructor"||H==="prototype")return $;if(X!=G){var V=U[H];if(q=Y?Y(V,H,U):void 0,q===void 0)q=$6(V)?V:F1(Q[X+1])?[]:{}}rX(U,H,q),U=U[H]}return $}var hb=$6$;function Q6$($,Q,J){var Y=-1,X=Q.length,W={};while(++Y<X){var G=Q[Y],U=RO($,G);if(J(U,G))hb(W,Z1(G,$),U)}return W}var ub=Q6$;function J6$($,Q){return ub($,Q,function(J,Y){return bO($,Y)})}var mb=J6$;var lb=c6?c6.isConcatSpreadable:void 0;function X6$($){return B6($)||h4($)||!!(lb&&$&&$[lb])}var cb=X6$;function pb($,Q,J,Y,X){var W=-1,G=$.length;J||(J=cb),X||(X=[]);while(++W<G){var U=$[W];if(Q>0&&J(U))if(Q>1)pb(U,Q-1,J,Y,X);else qO(X,U);else if(!Y)X[X.length]=U}return X}var db=pb;function Y6$($){var Q=$==null?0:$.length;return Q?db($,1):[]}var ib=Y6$;function W6$($){return GG(WG($,void 0,ib),$+"")}var nb=W6$;var G6$=nb(function($,Q){return $==null?{}:mb($,Q)}),UG=G6$;import{dirname as B6$,join as t1,resolve as XX}from"path";import{join as U6$}from"path";var H6$="remote-settings.json",Sz=null,K6$;function rb(){return}function q6$(){return rb()??U6$(p6(),H6$)}function V6$(){try{let $=h0(q6$()),Q=g$(rW($));if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;return Q}catch{return null}}function ob(){if(!rb()&&K6$!==!0)return null;if(Sz)return Sz;let $=V6$();if($)return Sz=$,V0(),$;return null}function Cz($){let Q=new Set($.allowedSources);return Q.add("flagSettings"),Q.add("policySettings"),gE.filter((J)=>Q.has(J))}function z6$(){return t1(m0(),"managed-settings.json")}function ab($){if(u0()==="wsl"&&$.wslInherits?.()){let Q=kz(b9);if(Q.settings)return Q;let J=kz(m0());return{settings:J.settings,errors:[...Q.errors,...J.errors]}}return kz(m0())}function kz($){let Q=[],J={},Y=!1,{settings:X,errors:W}=HG(t1($,"managed-settings.json"));if(Q.push(...W),X&&Object.keys(X).length>0)J=Y1(J,X,o1),Y=!0;let G=t1($,"managed-settings.d");try{let q=c$().readdirSync(G).filter((V)=>(V.isFile()||V.isSymbolicLink())&&V.name.endsWith(".json")&&!V.name.startsWith(".")).map((V)=>V.name).sort();for(let V of q){let{settings:B,errors:z}=HG(t1(G,V));if(Q.push(...z),B&&Object.keys(B).length>0)J=Y1(J,B,o1),Y=!0}}catch(q){let V=o$(q);if(V!=="ENOENT"&&V!=="ENOTDIR")X$(`managed-settings.d read failed: ${q}`,{level:"error"})}let{wslInheritsWindowsSettings:U,...H}=J;return{settings:Y&&Object.keys(H).length>0?J:null,errors:Q}}function N6$($,Q){if(D1($))X$(`Broken symlink or missing file encountered for settings.json at path: ${Q}`);else X$(`settings file read failed at ${Q}: ${$}`,{level:"error"})}function HG($){let Q=CO($);if(Q)return{settings:Q.settings?A4(Q.settings):null,errors:Q.errors};let J=w6$($);return TO($,J),{settings:J.settings?A4(J.settings):null,errors:J.errors}}function sb($){if(!$.mdm)return{settings:null,errors:[]};let Q=$.mdm();return{settings:Object.keys(Q.settings).length>0?Q.settings:null,errors:Q.errors}}function eb($){let Q=$?.remote?$.remote():ob();if(!Q||Object.keys(Q).length===0)return{settings:null,errors:[]};let J=A4(Q),Y=i1(J,"remote managed settings"),X=_4().safeParse(J);if(!X.success)return{settings:null,errors:[...Y,...d0(X.error,"remote managed settings")]};return{settings:Object.keys(X.data).length>0?X.data:null,errors:Y}}function $_($){let Q=$.parentManaged;if(!Q||Object.keys(Q).length===0)return{settings:null,errors:[]};let J=A4(Q),Y=i1(J,"parent managed settings"),X=_4().safeParse(J);if(!X.success)return{settings:null,errors:[...Y,...d0(X.error,"parent managed settings")]};return Object.keys(X.data).length>0?{settings:X.data,errors:Y}:{settings:null,errors:Y}}function Q_($){let Q=$.flagInline;if(!Q)return{settings:null,errors:[]};let J=A4(Q),Y=i1(J,"SDK inline settings"),X=_4().safeParse(J);if(!X.success)return{settings:null,errors:[...Y,...d0(X.error,"SDK inline settings")]};return{settings:X.data,errors:Y}}function w6$($){try{let{resolvedPath:Q}=H5(c$(),$),J=h0(Q);if(J.trim()==="")return{settings:{},errors:[]};let Y=A4(R9(J,!1)),X=i1(Y,$),W=_4().safeParse(Y);if(!W.success){let G=d0(W.error,$);return{settings:null,errors:[...X,...G]}}return{settings:W.data,errors:X}}catch(Q){return N6$(Q,$),{settings:null,errors:[]}}}function tb($,Q){switch($){case"userSettings":return XX(p6());case"policySettings":case"projectSettings":case"localSettings":return XX(Q.cwd);case"flagSettings":return Q.flagPath?B6$(XX(Q.flagPath)):XX(Q.cwd)}}function O6$($){if($.coworkPlugins||A$(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS))return"cowork_settings.json";return"settings.json"}function YX($,Q){switch($){case"userSettings":return t1(tb($,Q),O6$(Q));case"projectSettings":case"localSettings":return t1(tb($,Q),D6$($));case"policySettings":return z6$();case"flagSettings":return Q.flagPath}}function D6$($){switch($){case"projectSettings":return t1(".claude","settings.json");case"localSettings":return t1(".claude","settings.local.json")}}function J_($,Q){let J=kO($);if(J!==void 0)return J;let Y=L6$($,Q);return vO($,Y),Y}function F6$($){return!$||$.parentSettingsBehavior==="merge"}function Z6$($,Q){let J={};if($.allowManagedHooksOnly===!0)J.allowManagedHooksOnly=!0;if($.allowManagedMcpServersOnly===!0)J.allowManagedMcpServersOnly=!0;if($.allowManagedPermissionRulesOnly===!0)J.allowManagedPermissionRulesOnly=!0;let Y=$.strictPluginOnlyCustomization;if(Y===!0||Array.isArray(Y)&&Y.length>0)J.strictPluginOnlyCustomization=Y;if($.deniedMcpServers)J.deniedMcpServers=$.deniedMcpServers;if(Q.forceLoginOrgUUID===void 0&&$.forceLoginOrgUUID)J.forceLoginOrgUUID=$.forceLoginOrgUUID;if(Q.allowedMcpServers===void 0&&$.allowedMcpServers)J.allowedMcpServers=$.allowedMcpServers;if($.permissions){let X=UG($.permissions,["deny","ask"]);if($.permissions.disableBypassPermissionsMode==="disable")X.disableBypassPermissionsMode="disable";if(Q.allowManagedPermissionRulesOnly!==!0){let{allow:W,additionalDirectories:G}=$.permissions;if(W&&Q.sandbox?.network?.allowManagedDomainsOnly!==!0)X.allow=W;if(G)X.additionalDirectories=G}if(Object.keys(X).length>0)J.permissions=X}if($.sandbox){let{network:X,filesystem:W}=$.sandbox,G={};if($.sandbox.enabled===!0)G.enabled=!0;if($.sandbox.failIfUnavailable===!0)G.failIfUnavailable=!0;if($.sandbox.allowUnsandboxedCommands===!1)G.allowUnsandboxedCommands=!1;if($.sandbox.autoAllowBashIfSandboxed===!1)G.autoAllowBashIfSandboxed=!1;if(X){let U=UG(X,["deniedDomains"]);if(X.allowManagedDomainsOnly===!0)U.allowManagedDomainsOnly=!0;if(Q.sandbox?.network?.allowManagedDomainsOnly!==!0&&X.allowedDomains)U.allowedDomains=X.allowedDomains;if(Object.keys(U).length>0)G.network=U}if(W){let U=UG(W,["denyRead","denyWrite"]);if(W.allowManagedReadPathsOnly===!0)U.allowManagedReadPathsOnly=!0;if(Q.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&W.allowRead)U.allowRead=W.allowRead;if(Object.keys(U).length>0)G.filesystem=U}if(Object.keys(G).length>0)J.sandbox=G}return J}function X_($){if($.helper?.())return"helper";if(eb($).settings)return"remote";if(sb($).settings)return u0()==="macos"?"plist":"hklm";if(($.file?.()??ab($)).settings)return"file";if($_($).settings)return"parent";let Q=$.hkcu?.();return Q&&Object.keys(Q.settings).length>0?"hkcu":null}function M6$($){let Q=[],{settings:J,errors:Y}=eb($);Q.push(...Y);let{settings:X,errors:W}=sb($);Q.push(...W);let{settings:G,errors:U}=$.file?.()??ab($);Q.push(...U);let{settings:H,errors:q}=$_($);Q.push(...q);let V=[J,X,G].filter((w)=>w!==null),B=V[0]??null,z={allowManagedPermissionRulesOnly:V.some((w)=>w.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:V.find((w)=>w.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:V.find((w)=>w.allowedMcpServers!==void 0)?.allowedMcpServers,sandbox:{network:{allowManagedDomainsOnly:V.some((w)=>w.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:V.some((w)=>w.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},N=H&&F6$(B)?Z6$(H,z):null;return{tiers:V,admin:B,parentSlice:N,errors:Q}}function Y_($){let Q=$.helper?.();if(Q)return{settings:Q,errors:$.helperWarnings?.()??[]};let{admin:J,parentSlice:Y,errors:X}=M6$($);if(!J&&!Y){let W=$.hkcu?.();if(W&&Object.keys(W.settings).length>0)return{settings:W.settings,errors:[...X,...W.errors]};return{settings:null,errors:[...X,...W?.errors??[]]}}return{settings:Y1({},Y??{},J??{},o1),errors:X}}function L6$($,Q){if($==="policySettings")return Y_(Q).settings;let J=YX($,Q),{settings:Y}=J?HG(J):{settings:null};if($==="flagSettings"){let{settings:X}=Q_(Q);if(X)return Y1(Y||{},X,o1)}return Y}function j6$($,Q){return b5([...$,...Q])}function o1($,Q){if(Array.isArray($)&&Array.isArray(Q))return j6$($,Q);return}var vz=!1;function A6$($){if(vz)return{settings:{},errors:[]};let Q=Date.now();iJ("info","settings_load_started"),vz=!0;try{let J=xO(),Y={};if(J)Y=Y1(Y,J,o1);let X=[],W=new Set,G=new Set;for(let U of Cz($)){if(U==="policySettings"){let{settings:q,errors:V}=Y_($);if(q)Y=Y1(Y,q,o1);for(let B of V){let z=`${B.file}:${B.path}:${B.message}`;if(!W.has(z))W.add(z),X.push(B)}continue}let H=YX(U,$);if(H){let q=XX(H);if(!G.has(q)){G.add(q);let{settings:V,errors:B}=HG(H);for(let z of B){let N=`${z.file}:${z.path}:${z.message}`;if(!W.has(N))W.add(N),X.push(z)}if(V)Y=Y1(Y,V,o1)}}if(U==="flagSettings"){let{settings:q,errors:V}=Q_($);for(let B of V){let z=`${B.file}:${B.path}:${B.message}`;if(!W.has(z))W.add(z),X.push(B)}if(q)Y=Y1(Y,q,o1)}}return iJ("info","settings_load_completed",{duration_ms:Date.now()-Q,source_count:G.size,error_count:X.length}),{settings:Y,errors:X}}finally{vz=!1}}function I6$($){let Q=_O();if(Q!==null)return Q;let J=A6$($);return SO(J),J}function R6$($){let{settings:Q}=I6$($);return Q||{}}function W_($){V0();let Q=[];for(let J of Cz($)){let Y=J_(J,$);if(Y&&Object.keys(Y).length>0)Q.push({source:J,settings:Y})}return{effective:R6$($),sources:Q}}function G_($,Q){let J=Cz(Q);for(let Y=J.length-1;Y>=0;Y--){let X=J[Y];if(J_(X,Q)?.[$]!==void 0)return X}return null}var E6$={user:"userSettings",project:"projectSettings",local:"localSettings"},U_={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},b6$=["user","project","local"],_6$=new Set(["bypassPermissions","auto","acceptEdits"]),S6$=new Set(["project"]);function k6$($){let Q=$.effective.permissions?.defaultMode;if(!Q||!_6$.has(Q))return $.effective;for(let J=$.sources.length-1;J>=0;J--){let Y=$.sources[J];if(Y.settings.permissions?.defaultMode!==void 0){if(S6$.has(Y.source)){let{defaultMode:X,...W}=$.effective.permissions??{};return{...$.effective,permissions:W}}return $.effective}}return $.effective}async function H_($={}){await Fb();let Q={cwd:P6$($.cwd??c$().cwd()),allowedSources:($.settingSources??b6$).map((J)=>E6$[J]),parentManaged:$.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Zb,hkcu:Mb,wslInherits:Lb,...$.serverManagedSettings!==void 0&&{remote:()=>$.serverManagedSettings}};try{let{effective:J,sources:Y}=W_(Q),X=X_(Q)??void 0,W=Y.map(({source:U,settings:H})=>({source:U_[U],settings:H,path:U==="policySettings"?void 0:YX(U,Q),...U==="policySettings"&&{policyOrigin:X}})),G={};for(let U of Object.keys(J)){let H=G_(U,Q);if(H)G[U]={source:U_[H],path:H==="policySettings"?void 0:YX(H,Q),...H==="policySettings"&&{policyOrigin:X}}}return{effective:J,provenance:G,sources:W}}finally{V0()}}async function oj$($){return H_($)}async function l6$($,Q){try{await x6$($,Q)}catch(J){if(!D1(J))throw J}}async function c6$($,Q){if(!$)return;let J=$;try{let Y=g$($);if(Y?.claudeAiOauth?.refreshToken)delete Y.claudeAiOauth.refreshToken,J=B$(Y)}catch{}await w_(Q,J,{mode:384})}function p6$(){if(process.platform!=="darwin")return Promise.resolve(void 0);let $=uZ(hZ);return new Promise((Q)=>{v6$("security",["find-generic-password","-a",mZ(),"-w","-s",$],{encoding:"utf-8",timeout:5000},(J,Y)=>Q(J?void 0:Y.trim()||void 0))})}async function F_($,Q,J,Y,X=60000){if(!Z$(Q))return;let W=J4(J),G=await v4($.load({projectKey:W,sessionId:Q}),X,`SessionStore.load() timed out after ${X}ms for session ${Q}`);if(!G||G.length===0)return;let U=u6(h6$(),`claude-resume-${hz()}`);try{let H=u6(U,"projects",W);await Tz(H,{recursive:!0});let q=u6(H,`${Q}.jsonl`);await nQ(q,G);let V=Y?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,B=V??u6(xz(),".claude"),z;try{z=await N_(u6(B,".credentials.json"),"utf-8")}catch(N){if(!D1(N))throw N}if(!V&&!(Y??process.env).ANTHROPIC_API_KEY&&!(Y??process.env).CLAUDE_CODE_OAUTH_TOKEN)z=await p6$()??z;if(await c6$(z,u6(U,".credentials.json")),await l6$(u6(V??xz(),".claude.json"),u6(U,".claude.json")),$.listSubkeys){let N=u6(H,Q),w=await v4($.listSubkeys({projectKey:W,sessionId:Q}),X,`SessionStore.listSubkeys() timed out after ${X}ms for session ${Q}`);for(let O of w){let D=WX(N,O+".jsonl");if(!O||O_(O)||O.split(/[\\/]/).includes("..")||!D.startsWith(N+uz)){X$(`[SessionStore] skipping unsafe subpath from listSubkeys: ${O}`,{level:"warn"});continue}let M=await v4($.load({projectKey:W,sessionId:Q,subpath:O}),X,`SessionStore.load() timed out after ${X}ms for session ${Q} subpath ${O}`);if(!M||M.length===0)continue;let j=[],A=[];for(let k of M)if(gz(k))j.push(k);else A.push(k);if(A.length>0)await Tz(K_(D),{recursive:!0}),await nQ(D,A);if(j.length>0){let k=j.at(-1),u=WX(N,O+".meta.json");await Tz(K_(u),{recursive:!0});let{type:G$,...u$}=k;await w_(u,B$(u$),{mode:384})}}}return U}catch(H){throw await KG(U),H}}function yz($,Q,J,Y){let{systemPrompt:X,settings:W,managedSettings:G,settingSources:U,sandbox:H,...q}=$??{},V,B,z;if(X===void 0)V="";else if(typeof X==="string")V=X;else if(Array.isArray(X))V=X;else if(X.type==="preset")B=X.append,z=X.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.150";let{abortController:N=f9(),additionalDirectories:w=[],agent:O,agents:D,allowedTools:M=[],betas:j,canUseTool:A,continue:k,cwd:u,debug:G$,debugFile:u$,disallowedTools:e$=[],tools:m6,env:F6,executable:a1=VX()?"bun":"node",executableArgs:i0=[],extraArgs:S4={},fallbackModel:S9,enableFileCheckpointing:W1,toolConfig:i,forkSession:GX,hooks:UX,includeHookEvents:k9,includePartialMessages:v9,forwardSubagentText:C9,onElicitation:HX,persistSession:m$,sessionStore:s$,sessionStoreFlush:k4,thinking:T9,effort:A_,maxThinkingTokens:VG,maxTurns:I_,maxBudgetUsd:R_,taskBudget:P_,mcpServers:mz,model:E_,outputFormat:lz,permissionMode:b_="default",allowDangerouslySkipPermissions:__=!1,permissionPromptToolName:S_,plugins:k_,getOAuthToken:cz,getHostAuthToken:pz,workload:dz,resume:iz,resumeSessionAt:v_,sessionId:C_,skills:nz,stderr:T_,strictMcpConfig:x_}=q;if(s$&&m$===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(s$&&k&&!iz&&!s$.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(s$&&W1)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(s$&&q.spawnClaudeCodeProcess)X$("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});let BG=q.pathToClaudeCodeExecutable;if(!BG){let k6=m6$(import.meta.url),X4=g6$(k6),s1=K2((n0)=>X4.resolve(n0));if(!s1)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);BG=s1}let rz=lz?.type==="json_schema"?lz.schema:void 0,V6=F6?{...F6}:{...process.env};if(!V6.CLAUDE_CODE_ENTRYPOINT)V6.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!V6.CLAUDE_AGENT_SDK_VERSION)V6.CLAUDE_AGENT_SDK_VERSION="0.3.150";if(W1)V6.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(cz)V6.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(pz)V6.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(i?.askUserQuestion?.previewFormat)V6.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=i.askUserQuestion.previewFormat;let zG={};if(qG.propagation.inject(qG.context.active(),zG),"traceparent"in zG){for(let k6 of["TRACEPARENT","TRACESTATE"])if(!(k6 in(F6??{})))delete V6[k6]}for(let[k6,X4]of Object.entries(zG)){let s1=k6.toUpperCase();if(!(s1 in(F6??{})))V6[s1]=X4}let oz={},tz=new Map;if(mz)for(let[k6,X4]of Object.entries(mz))if(X4.type==="sdk"&&X4.instance)tz.set(k6,X4.instance);else oz[k6]=X4;let x9;if(T9)switch(T9.type){case"adaptive":x9={type:"adaptive",display:T9.display};break;case"enabled":x9={type:"enabled",budgetTokens:T9.budgetTokens,display:T9.display};break;case"disabled":x9={type:"disabled"};break}else if(VG!==void 0)x9=VG===0?{type:"disabled"}:{type:"enabled",budgetTokens:VG};if(J){if(V6.CLAUDE_CONFIG_DIR=J,process.platform==="win32")V6.CLAUDE_SECURESTORAGE_CONFIG_DIR=F6?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??F6?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let az=new LU({abortController:N,additionalDirectories:w,agent:O,betas:j,cwd:u,debug:G$,debugFile:u$,executable:a1,executableArgs:i0,extraArgs:dz?{...S4,workload:dz}:S4,pathToClaudeCodeExecutable:BG,env:V6,forkSession:GX,stderr:T_,thinkingConfig:x9,effort:A_,maxTurns:I_,maxBudgetUsd:R_,taskBudget:P_,model:E_,fallbackModel:S9,jsonSchema:rz,permissionMode:b_,allowDangerouslySkipPermissions:__,permissionPromptToolName:S_,continueConversation:s$?void 0:k,resume:iz,resumeSessionAt:v_,sessionId:C_,settings:typeof W==="object"?B$(W):W,managedSettings:G?B$(G):void 0,settingSources:U,skills:nz,allowedTools:M,disallowedTools:e$,tools:m6,mcpServers:oz,strictMcpConfig:x_,canUseTool:!!A,hooks:!!UX,includeHookEvents:k9,includePartialMessages:v9,persistSession:m$,sessionMirror:!!s$,plugins:k_,sandbox:H,spawnClaudeCodeProcess:q.spawnClaudeCodeProcess,deferSpawn:Y}),y_={systemPrompt:V,appendSystemPrompt:B,planModeInstructions:q.planModeInstructions,appendSubagentSystemPrompt:q.appendSubagentSystemPrompt,toolAliases:q.toolAliases,excludeDynamicSections:z,agents:D,title:q.title,skills:nz,webSearchIsolationExemptMcpServers:q.webSearchIsolationExemptMcpServers,promptSuggestions:q.promptSuggestions,agentProgressSummaries:q.agentProgressSummaries,forwardSubagentText:C9},NG=new RU(az,Q,A,UX,N,tz,rz,y_,HX,cz,pz);if(s$){let k6=()=>u6(V6.CLAUDE_CONFIG_DIR??u6(xz(),".claude"),"projects"),X4=k4==="eager",s1=new PU(async(n0,wG)=>{let y9=z_(n0,k6());if(y9)await s$.append(y9,wG);else X$(`[SessionStore] dropping mirror frame: filePath ${n0} is not under ${k6()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},void 0,(n0,wG)=>{let y9=z_(n0,k6());if(y9)NG.reportMirrorError(y9,wG.message)},X4?0:z5,X4?0:N5);NG.setTranscriptMirrorBatcher(s1)}return{queryInstance:NG,transport:az,abortController:N,processEnv:V6}}function fz($,Q,J,Y){if(typeof J==="string")Q.write(B$({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:J}]},parent_tool_use_id:null})+`
115
+ `)){let Y=J.match(/^(ID|VERSION_ID)=(.*)$/);if(Y&&Y[1]&&Y[2]){let X=Y[2].replace(/^"|"$/g,"");if(Y[1]==="ID")$.linuxDistroId=X;else $.linuxDistroVersion=X}}}catch{}return $});var xD$=v$(()=>{if(process.platform!=="darwin")return;let Q=NE().match(/^(\d+)\./);if(!Q||!Q[1])return;return parseInt(Q[1],10)-9});var m0=v$(function(){switch(u0()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),uD$=v$(function(){return He(m0(),"managed-settings.d")});import{isAbsolute as wE}from"path";var Ke=b(()=>K.object({allowedDomains:K.array(K.string()).optional(),deniedDomains:K.array(K.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),allowManagedDomainsOnly:K.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:K.array(K.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:K.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:K.boolean().optional(),allowMachLookup:K.array(K.string().refine(($)=>{return!($.endsWith("*")?$.slice(0,-1):$).includes("*")},{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:K.number().optional(),socksProxyPort:K.number().optional(),tlsTerminate:K.object({caCertPath:K.string().min(1).optional(),caKeyPath:K.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session.")}).optional()),qe=b(()=>K.object({allowWrite:K.array(K.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:K.array(K.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:K.array(K.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:K.array(K.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:K.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),OE=b(()=>K.object({enabled:K.boolean().optional(),failIfUnavailable:K.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:K.boolean().optional(),allowUnsandboxedCommands:K.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:Ke(),filesystem:qe(),ignoreViolations:K.record(K.string(),K.array(K.string())).optional(),enableWeakerNestedSandbox:K.boolean().optional(),enableWeakerNetworkIsolation:K.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false"),excludedCommands:K.array(K.string()).optional(),ripgrep:K.object({command:K.string(),args:K.array(K.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:K.preprocess(($)=>typeof $==="string"&&wE($)?$:void 0,K.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:K.preprocess(($)=>typeof $==="string"&&wE($)?$:void 0,K.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough());var DE=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],FE=["normal","vim"],ZE=["auto","tmux","in-process"],Ve=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],ME=["auto",...Ve];var rD$=u0()==="macos"?"⏺":"●";var rJ=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],Be=[...rJ,"bubble"],LE=Be;var JF$=b(()=>vV.enum(LE)),XF$=b(()=>vV.enum(rJ));var jE=["bash","powershell"];var oJ=b(()=>K.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));function ze(){let $=K.object({type:K.literal("command").describe("Shell command hook type"),command:K.string().describe("Shell command to execute"),args:K.array(K.string()).optional().describe("Argument list for exec form. When present, `command` is resolved as "+"an executable and spawned directly with these arguments — no shell. "+"Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:oJ(),shell:K.enum(jE).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:K.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:K.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:K.string().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:K.string().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".')}),Q=K.object({type:K.literal("prompt").describe("LLM prompt hook type"),prompt:K.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:K.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.'),continueOnBlock:K.boolean().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")}),J=K.object({type:K.literal("mcp_tool").describe("MCP tool hook type"),server:K.string().describe("Name of an already-configured MCP server to invoke"),tool:K.string().describe("Name of the tool on that server to call"),input:K.record(K.string(),K.unknown()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")}),Y=K.object({type:K.literal("http").describe("HTTP hook type"),url:K.string().url().describe("URL to POST the hook input JSON to"),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:K.record(K.string(),K.string()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:K.array(K.string()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")}),X=K.object({type:K.literal("agent").describe("Agentic verifier hook type"),prompt:K.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:oJ(),timeout:K.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:K.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.'),statusMessage:K.string().optional().describe("Custom status message to display in spinner while hook runs"),once:K.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:$,PromptHookSchema:Q,HttpHookSchema:Y,AgentHookSchema:X,McpToolHookSchema:J}}var AE=b(()=>{let{BashCommandHookSchema:$,PromptHookSchema:Q,AgentHookSchema:J,HttpHookSchema:Y,McpToolHookSchema:X}=ze();return K.discriminatedUnion("type",[$,Q,J,Y,X])}),IE=b(()=>K.object({matcher:K.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:K.array(AE()).describe("List of hooks to execute when the matcher matches")})),l0=b(()=>K.partialRecord(K.enum(r0),K.array(IE())));var zF$=b(()=>K.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),NF$=b(()=>K.enum(["stdio","sse","sse-ide","http","ws","sdk"])),P9=b(()=>K.literal("comms").optional().catch(void 0)),d1=b(()=>K.number().int().positive()),Ne=b(()=>K.object({type:K.literal("stdio").optional(),command:K.string().min(1,"Command cannot be empty"),args:K.array(K.string()).default([]),env:K.record(K.string(),K.string()).optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),we=b(()=>K.boolean()),RE=b(()=>K.object({clientId:K.string().optional(),callbackPort:K.number().int().positive().optional(),authServerMetadataUrl:K.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:K.string().min(1).optional(),xaa:we().optional()})),Oe=b(()=>K.object({type:K.literal("sse"),url:K.string(),headers:K.record(K.string(),K.string()).optional(),headersHelper:K.string().optional(),oauth:RE().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),De=b(()=>K.object({type:K.literal("sse-ide"),url:K.string(),ideName:K.string(),ideRunningInWindows:K.boolean().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Fe=b(()=>K.object({type:K.literal("ws-ide"),url:K.string(),ideName:K.string(),authToken:K.string().optional(),ideRunningInWindows:K.boolean().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Ze=b(()=>K.object({type:K.enum(["http","streamable-http"]).transform(()=>"http"),url:K.string(),headers:K.record(K.string(),K.string()).optional(),headersHelper:K.string().optional(),oauth:RE().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Me=b(()=>K.object({type:K.literal("ws"),url:K.string(),headers:K.record(K.string(),K.string()).optional(),headersHelper:K.string().optional(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),role:P9()})),Le=b(()=>K.object({type:K.literal("sdk"),name:K.string(),timeout:d1().optional(),alwaysLoad:K.boolean().optional()})),je=b(()=>K.enum(["allow","ask","blocked"])),Ae=b(()=>K.object({type:K.literal("claudeai-proxy"),url:K.string(),id:K.string(),timeout:d1().optional(),alwaysLoad:K.boolean().optional(),toolPermissions:K.record(K.string(),je()).optional()})),sW=b(()=>K.union([Ne(),Oe(),De(),Fe(),Ze(),Me(),Le(),Ae()])),wF$=b(()=>K.object({mcpServers:K.record(K.string(),sW())}));var _E=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins"]);var Ie=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,Re=/[^\u0020-\u007E]/;function Pe($){if(_E.has($.toLowerCase()))return!1;if(Re.test($))return!0;return Ie.test($)}var Z4=b(()=>K.string().startsWith("./")),c0=b(()=>Z4().endsWith(".json")),PE=b(()=>K.union([Z4().refine(($)=>$.endsWith(".mcpb")||$.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),K.string().url().refine(($)=>$.endsWith(".mcpb")||$.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),jz=b(()=>Z4().endsWith(".md")),Az=b(()=>K.union([jz(),Z4()])),SE=b(()=>K.string().min(1,"Marketplace must have a name").refine(($)=>!$.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine(($)=>!$.includes("/")&&!$.includes("\\")&&!$.includes("..")&&$!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine(($)=>!Pe($),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine(($)=>$.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine(($)=>$.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine(($)=>$.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Iz=b(()=>K.object({name:K.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:K.string().optional().describe("Contact email for support or feedback"),url:K.string().optional().describe("Website, GitHub profile, or organization URL")})),Ee=b(()=>K.object({$schema:K.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:K.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:K.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:K.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:K.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Iz().optional().describe("Information about the plugin creator or maintainer"),homepage:K.string().url().optional().describe("Plugin homepage or documentation URL"),repository:K.string().optional().describe("Source code repository URL"),license:K.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:K.array(K.string()).optional().describe("Tags for plugin discovery and categorization"),dependencies:K.array(ae()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),AF$=b(()=>K.object({description:K.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:K.lazy(()=>l0()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),be=b(()=>K.object({hooks:K.union([c0().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),K.lazy(()=>l0()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),K.array(K.union([c0().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),K.lazy(()=>l0()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),_e=b(()=>K.object({source:Az().optional().describe("Path to command markdown file, relative to plugin root"),content:K.string().optional().describe("Inline markdown content for the command"),description:K.string().optional().describe("Command description override"),argumentHint:K.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:K.string().optional().describe("Default model for this command"),allowedTools:K.array(K.string()).optional().describe("Tools allowed when command runs")}).refine(($)=>$.source&&!$.content||!$.source&&$.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),Se=b(()=>K.object({commands:K.union([Az().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both."),K.array(Az().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),K.record(K.string(),_e()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),ke=b(()=>K.object({agents:K.union([jz().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both."),K.array(jz().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),ve=b(()=>K.object({skills:K.union([Z4().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory."),K.array(Z4().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory.")).describe("List of skill directory paths, loaded in addition to the skills/ directory.")])})),kE=b(()=>K.object({outputStyles:K.union([Z4().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both."),K.array(Z4().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),vE=b(()=>K.object({themes:K.union([Z4().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both."),K.array(Z4().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),Ce=b(()=>K.object({})),EE=b(()=>K.string().min(1)),Te=b(()=>K.string().min(2).refine(($)=>$.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),xe=b(()=>K.object({mcpServers:K.union([c0().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),PE().describe("Path or URL to MCPB file containing MCP server configuration"),K.record(K.string(),sW()).describe("MCP server configurations keyed by server name"),K.array(K.union([c0().describe("Path to MCP servers configuration file"),PE().describe("Path or URL to MCPB file"),K.record(K.string(),sW()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),CE=b(()=>K.object({type:K.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:K.string().describe("Human-readable label shown in the config dialog"),description:K.string().describe("Help text shown beneath the field in the config dialog"),required:K.boolean().optional().describe("If true, validation fails when this field is empty"),default:K.union([K.string(),K.number(),K.boolean(),K.array(K.string())]).optional().describe("Default value used when the user provides nothing"),multiple:K.boolean().optional().describe("For string type: allow an array of strings"),sensitive:K.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:K.number().optional().describe("Minimum value (number type only)"),max:K.number().optional().describe("Maximum value (number type only)")}).strict()),ye=b(()=>K.object({userConfig:K.record(K.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),CE()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),fe=b(()=>K.object({channels:K.array(K.object({server:K.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:K.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:K.record(K.string(),CE()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),bE=b(()=>K.strictObject({command:K.string().min(1).refine(($)=>{if($.includes(" ")&&!$.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:K.array(EE()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:K.record(Te(),EE()).refine(($)=>Object.keys($).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:K.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:K.record(K.string(),K.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:K.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:K.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:K.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:K.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:K.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:K.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:K.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up")})),ge=b(()=>K.strictObject({name:K.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:K.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:K.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:K.union([K.literal("always"),K.string().startsWith("on-skill-invoke:").refine(($)=>$.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),he=b(()=>K.array(ge()).refine(($)=>new Set($.map((Q)=>Q.name)).size===$.length,{message:"Monitor names must be unique within a plugin"})),TE=b(()=>K.object({monitors:K.union([c0().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),he()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),ue=b(()=>K.object({lspServers:K.union([c0().describe("Path to .lsp.json configuration file relative to plugin root"),K.record(K.string(),bE()).describe("LSP server configurations keyed by server name"),K.array(K.union([c0().describe("Path to LSP configuration file"),K.record(K.string(),bE()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),xE=b(()=>K.string().refine(($)=>!$.includes("..")&&!$.includes("//"),"Package name cannot contain path traversal patterns").refine(($)=>{let Q=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,J=/^[a-z0-9][a-z0-9-._]*$/;return Q.test($)||J.test($)},"Invalid npm package name format")),me=b(()=>K.object({settings:K.record(K.string(),K.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),le=b(()=>K.object({experimental:K.preprocess(($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,K.object({...vE().partial().shape,...TE().partial().shape,...kE().partial().shape,evals:K.union([K.string(),K.array(K.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),ce=b(()=>K.object({...Ee().shape,...be().partial().shape,...Se().partial().shape,...ke().partial().shape,...ve().partial().shape,...kE().partial().shape,...vE().partial().shape,...Ce().shape,...fe().partial().shape,...xe().partial().shape,...ue().partial().shape,...TE().partial().shape,...me().partial().shape,...ye().partial().shape,...le().partial().shape})),tJ=b(()=>K.discriminatedUnion("source",[K.object({source:K.literal("url"),url:K.string().url().describe("Direct URL to marketplace.json file"),headers:K.record(K.string(),K.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),K.object({source:K.literal("github"),repo:K.string().describe("GitHub repository in owner/repo format"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:K.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:K.array(K.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.')}),K.object({source:K.literal("git"),url:K.string().describe("Full git repository URL"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:K.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:K.array(K.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.')}),K.object({source:K.literal("npm"),package:xE().describe("NPM package containing marketplace.json")}),K.object({source:K.literal("file"),path:K.string().describe("Local file path to marketplace.json")}),K.object({source:K.literal("directory"),path:K.string().describe("Local directory containing .claude-plugin/marketplace.json")}),K.object({source:K.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),K.object({source:K.literal("hostPattern"),hostPattern:K.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against "github.com". For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),K.object({source:K.literal("pathPattern"),pathPattern:K.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),K.object({source:K.literal("settings"),name:SE().refine(($)=>!_E.has($.toLowerCase()),{message:"Reserved official marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection — "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:K.array(pe()).describe("Plugin entries declared inline in settings.json"),owner:Iz().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),Lz=b(()=>K.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),yE=b(()=>K.union([Z4().describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),K.object({source:K.literal("npm"),package:xE().or(K.string().refine(($)=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test($)||!$.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:K.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:K.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),K.object({source:K.literal("url"),url:K.string().describe("Full git repository URL (https:// or git@)"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Lz().optional().describe("Specific commit SHA to use")}),K.object({source:K.literal("github"),repo:K.string().describe("GitHub repository in owner/repo format"),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Lz().optional().describe("Specific commit SHA to use")}),K.object({source:K.literal("git-subdir"),url:K.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:K.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:K.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Lz().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),K.object({source:K.literal("unsupported")}).describe("Placeholder for source types this Claude Code version does not "+"recognize. Never authored by hand — PluginMarketplaceSchema rewrites "+'unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),pe=b(()=>K.object({name:K.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:yE().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:K.string().optional(),version:K.string().optional(),strict:K.boolean().optional()}).refine(($)=>typeof $.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine(($)=>typeof $.source==="string"||$.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."}));var de=b(()=>K.object({cli:K.array(K.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:K.array(K.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) — exact, case-insensitive match against '+"hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path."),filePath:K.string().max(256).optional().describe("RegExp source matched (case-insensitive) against file paths read this session, or present in cwd at session start."),manifestDeps:K.array(K.object({file:K.string().max(256),pattern:K.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: "+"`file` matches the manifest filename (package.json, go.mod, requirements.txt, …); "+"`pattern` matches the dependency declaration inside that file. Evaluated against files read this session, or present in cwd at session start.")})),ie=b(()=>K.object({topic:K.string().max(64).optional().describe('What the user is working with when this plugin is relevant — fills "Working with {topic}?". '+'Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:de().optional().describe("Matchers that determine when the plugin is relevant.")})),ne=b(()=>ce().partial().extend({name:K.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:yE().describe("Where to fetch the plugin from"),category:K.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:K.array(K.string()).optional().describe("Tags for searchability and discovery"),strict:K.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:K.preprocess(($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,ie().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),re=b(()=>K.object({name:K.string().min(1).refine(($)=>!$.includes(" "))}));function oe($){let Q=ne();return $.flatMap((J,Y)=>{let X=Q.safeParse(J);if(X.success)return[X.data];let W=re().safeParse(J).data?.name,G=X.error.issues.map((U)=>`${U.path.join(".")}: ${U.message}`).join(", ");if(W)return X$(`Stubbing unparseable marketplace plugin entry (${W}): ${G}`,{level:"warn"}),[{name:W,source:{source:"unsupported"},strict:!0}];return X$(`Dropping unparseable marketplace plugin entry (index ${Y}): ${G}`,{level:"warn"}),[]})}var IF$=b(()=>K.object({$schema:K.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:SE(),version:K.string().optional().describe("Marketplace manifest version"),description:K.string().optional().describe("Human-readable description of this marketplace"),owner:Iz().describe("Marketplace maintainer or curator information"),plugins:K.array(K.unknown()).transform(oe).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:K.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:K.object({pluginRoot:K.string().optional().describe("Base path for relative plugin sources"),version:K.string().optional().describe("Marketplace version"),description:K.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:K.array(K.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.")})),fE=b(()=>K.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),te=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,ae=b(()=>K.union([K.string().regex(te,"Dependency must be a plugin name, optionally qualified with @marketplace").transform(($)=>$.replace(/@\^[^@]*$/,"")),K.object({name:K.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:K.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform(($)=>$.marketplace?`${$.name}@${$.marketplace}`:$.name)])),se=b(()=>K.object({version:K.string().describe("Currently installed version"),installedAt:K.string().describe("ISO 8601 timestamp of installation"),lastUpdated:K.string().optional().describe("ISO 8601 timestamp of last update"),installPath:K.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:K.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:K.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:K.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),ee=b(()=>K.object({version:K.literal(1).describe("Schema version 1"),plugins:K.record(fE(),se()).describe("Map of plugin IDs to their installation metadata")})),$$$=b(()=>K.enum(["managed","user","project","local"])),Q$$=b(()=>K.object({scope:$$$().describe("Installation scope"),projectPath:K.string().optional().describe("Project path (required for project/local scopes)"),installPath:K.string().describe("Absolute path to the versioned plugin directory"),version:K.string().optional().describe("Currently installed version"),installedAt:K.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:K.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:K.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:K.string().optional().describe("Tag-derived semver this install resolved to"),auto:K.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),J$$=b(()=>K.object({version:K.literal(2).describe("Schema version 2"),plugins:K.record(fE(),K.array(Q$$())).describe("Map of plugin IDs to arrays of installation entries")})),RF$=b(()=>K.union([ee(),J$$()])),X$$=b(()=>K.object({source:tJ().describe("Where to fetch the marketplace from"),installLocation:K.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:K.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:K.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),PF$=b(()=>K.record(K.string(),X$$()));var gE=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];var hE="https://json.schemastore.org/claude-code-settings.json";var Y$$=["autoMode","deepLink","voice","assistant","briefView"],eW={},$G={autoMode:{buildGate:()=>!1,shape:()=>eW,permissionsShape:()=>eW,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:K.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>eW},assistant:{buildGate:()=>!1,shape:()=>eW},briefView:{buildGate:()=>!0,shape:()=>({defaultView:K.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})}};function Rz(){return Y$$.filter(($)=>$G[$].buildGate())}function uE($){let Q={};for(let J of $)Q={...Q,...$G[J].shape()};return Q}function mE($){let Q={};for(let J of $)Q={...Q,...$G[J].permissionsShape?.()};return Q}function lE($){let Q=[];for(let J of $)Q.push(...$G[J].permissionModes?.()??[]);return Q}function cE($){let Q=$.split("__"),[J,Y,...X]=Q;if(J!=="mcp"||!Y)return null;let W=X.length>0?X.join("__"):void 0;return{serverName:Y,toolName:W}}var pE={Task:"Agent",KillShell:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage"};function E9($){return Object.hasOwn(pE,$)?pE[$]:$}var dE="workspace",uF$=`mcp__${dE}__bash`,mF$=`mcp__${dE}__web_fetch`;function W$$($){return $.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function iE($){let Q=G$$($,"(");if(Q===-1)return{toolName:E9($)};let J=U$$($,")");if(J===-1||J<=Q)return{toolName:E9($)};if(J!==$.length-1)return{toolName:E9($)};let Y=$.substring(0,Q),X=$.substring(Q+1,J);if(!Y)return{toolName:E9($)};if(X===""||X==="*")return{toolName:E9(Y)};let W=W$$(X);return{toolName:E9(Y),ruleContent:W}}function G$$($,Q){for(let J=0;J<$.length;J++)if($[J]===Q){let Y=0,X=J-1;while(X>=0&&$[X]==="\\")Y++,X--;if(Y%2===0)return J}return-1}function U$$($,Q){for(let J=$.length-1;J>=0;J--)if($[J]===Q){let Y=0,X=J-1;while(X>=0&&$[X]==="\\")Y++,X--;if(Y%2===0)return J}return-1}var QG={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit"],bashPrefixTools:["Bash"],customValidation:{WebSearch:($)=>{if($.includes("*")||$.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:($)=>{if($.includes("://")||$.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!$.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}};function nE($){return QG.filePatternTools.includes($)}function rE($){return QG.bashPrefixTools.includes($)}function oE($){return Object.hasOwn(QG.customValidation,$)?QG.customValidation[$]:void 0}function tE($,Q){let J=0,Y=Q-1;while(Y>=0&&$[Y]==="\\")J++,Y--;return J%2!==0}function Pz($,Q){let J=0;for(let Y=0;Y<$.length;Y++)if($[Y]===Q&&!tE($,Y))J++;return J}function H$$($){for(let Q=0;Q<$.length-1;Q++)if($[Q]==="("&&$[Q+1]===")"){if(!tE($,Q))return!0}return!1}function Ez($){if(!$||$.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let Q=Pz($,"("),J=Pz($,")");if(Q!==J)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(H$$($)){let G=$.substring(0,$.indexOf("("));if(!G)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${G}" without parentheses`,examples:[`${G}`,`${G}(some-pattern)`]}}let Y=iE($),X=cE(Y.toolName);if(X){if(Y.ruleContent!==void 0||Pz($,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${Y.toolName}" without parentheses, or use "mcp__${X.serverName}__*" for all tools`,examples:[`mcp__${X.serverName}`,`mcp__${X.serverName}__*`,X.toolName&&X.toolName!=="*"?`mcp__${X.serverName}__${X.toolName}`:void 0].filter(Boolean)};return{valid:!0}}if(!Y.toolName||Y.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(!Y.toolName.includes("_")&&Y.toolName[0]!==Y.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${BU(String(Y.toolName))}"`};let W=oE(Y.toolName);if(W&&Y.ruleContent!==void 0){let G=W(Y.ruleContent);if(!G.valid)return G}if(rE(Y.toolName)&&Y.ruleContent!==void 0){let G=Y.ruleContent;if(G.includes(":*")&&!G.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(G===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]}}if(nE(Y.toolName)&&Y.ruleContent!==void 0){let G=Y.ruleContent;if(G.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${Y.toolName}(*.ts) - matches .ts files`,`${Y.toolName}(src/**) - matches all files in src`,`${Y.toolName}(**/*.test.ts) - matches test files`]};if(G.includes("*")&&!G.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!G.includes("**"))return{valid:!1,error:"Wildcard placement might be incorrect",suggestion:"Wildcards are typically used at path boundaries",examples:[`${Y.toolName}(*.js) - all .js files`,`${Y.toolName}(src/*) - all files directly in src`,`${Y.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var JG=b(()=>K.string().superRefine(($,Q)=>{let J=Ez($);if(!J.valid){let Y=J.error;if(J.suggestion)Y+=`. ${J.suggestion}`;if(J.examples&&J.examples.length>0)Y+=`. Examples: ${J.examples.join(", ")}`;Q.addIssue({code:K.ZodIssueCode.custom,message:Y,params:{received:$}})}}));var K$$=b(()=>K.record(K.string(),K.coerce.string()));function sE($){return K.object({allow:K.array(JG()).optional().describe("List of permission rules for allowed operations"),deny:K.array(JG()).optional().describe("List of permission rules for denied operations"),ask:K.array(JG()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:K.enum([...rJ,...lE($)]).optional().describe("Default permission mode when Claude Code needs access"),disableBypassPermissionsMode:K.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...mE($),additionalDirectories:K.array(K.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var KZ$=b(()=>sE(Rz())),q$$=b(()=>K.object({source:tJ().describe("Where to fetch the marketplace from"),installLocation:K.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:K.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),V$$=b(()=>K.object({serverName:K.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:K.array(K.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:K.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(($)=>{return kH([$.serverName!==void 0,$.serverCommand!==void 0,$.serverUrl!==void 0],Boolean)===1},{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),B$$=b(()=>K.object({serverName:K.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:K.array(K.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:K.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(($)=>{return kH([$.serverName!==void 0,$.serverCommand!==void 0,$.serverUrl!==void 0],Boolean)===1},{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),z$$=b(()=>K.object({path:K.string().describe("Absolute path to the helper executable"),timeoutMs:K.number().int().min(1000).optional(),refreshIntervalMs:K.union([K.literal(0),K.number().int().min(60000)]).optional()})),aE=["skills","agents","hooks","mcp"];function eE($){return K.object({$schema:K.literal(hE).optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:K.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:K.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:K.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:K.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:K.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),policyHelper:z$$().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...A$(process.env.CLAUDE_CODE_ENABLE_XAA)&&{xaaIdp:K.object({issuer:K.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:K.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:K.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:K.object({type:K.literal("command"),command:K.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:K.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:K.object({enabled:K.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:K.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 120). Re-fires every interval until you take a break."),breakThresholdMinutes:K.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 15)"),message:K.string().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks — just a friendly heads-up."),quietHours:K.object({enabled:K.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:K.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:K.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:K.number().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),skillListingMaxDescChars:K.number().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:K.number().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:K.boolean().optional().describe("When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:K$$().optional().describe("Environment variables to set for Claude Code sessions"),attribution:K.object({commit:K.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:K.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:K.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,includeGitInstructions:K.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:sE($).optional().describe("Tool usage permissions configuration"),model:K.string().optional().describe("Override the default model used by Claude Code"),availableModels:K.array(K.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),modelOverrides:K.record(K.string(),K.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:K.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:K.array(K.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:K.array(K.string()).optional().describe("List of rejected MCP servers from .mcp.json"),skillOverrides:K.record(K.string(),K.enum(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),allowedMcpServers:K.array(V$$()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:K.array(B$$()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:l0().optional().describe("Custom commands to run before/after tool executions"),worktree:K.object({symlinkDirectories:K.array(K.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:K.array(K.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos — only the listed paths are written to disk."),baseRef:K.enum(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:K.enum(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:K.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:K.boolean().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:K.boolean().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableWorkflows:K.boolean().optional().describe("@internal Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableSkillShellExecution:K.boolean().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:K.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:K.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:K.array(K.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:K.array(K.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:K.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:K.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:K.boolean().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:K.preprocess((Q)=>Array.isArray(Q)?Q.filter((J)=>aE.includes(J)):Q,K.union([K.boolean(),K.array(K.enum(aE))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:K.object({type:K.literal("command"),command:K.string(),padding:K.number().optional(),refreshInterval:K.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:K.boolean().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:K.string().optional().describe('URL template for PR links in the footer badge and inline messages. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),subagentStatusLine:K.object({type:K.literal("command"),command:K.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:K.record(K.string(),K.union([K.array(K.string()),K.boolean(),K.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json — setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:K.record(K.string(),q$$()).check((Q)=>{for(let[J,Y]of Object.entries(Q.value))if(Y.source.source==="settings"&&Y.source.name!==J)Q.issues.push({code:"custom",input:Y.source.name,path:[J,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${J}" but source.name "${Y.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:K.array(tJ()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. "+"Note: this is a policy gate only — it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:K.array(tJ()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),pluginSuggestionMarketplaces:K.array(K.string()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips), in addition to the official marketplace. Only honored when set in managed settings (policy scope); the key is ignored in user, project, and local settings. A name only takes effect when the marketplace is registered on the machine AND its registered source is also declared in managed settings, either as the extraKnownMarketplaces entry for that name or as an entry of strictKnownMarketplaces. A marketplace registered from a different source under an allowlisted name is ignored."),forceLoginMethod:K.enum(["claudeai","console"]).optional().describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing'),parentSettingsBehavior:K.enum(["first-wins","merge"]).optional().describe('Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" '+"(default): parent is dropped — admin tiers are the only policy "+`source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),forceLoginOrgUUID:K.union([K.string(),K.array(K.string())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:K.boolean().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:K.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:K.string().optional().describe("Controls the output style for assistant responses"),viewMode:K.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:K.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:K.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:OE().optional(),feedbackSurveyRate:K.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:K.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:K.object({mode:K.enum(["append","replace"]),verbs:K.array(K.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:K.object({excludeDefault:K.boolean().optional(),tips:K.array(K.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:K.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:K.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:K.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:K.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),autoCompactWindow:K.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:K.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:K.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:K.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:K.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),awaySummaryEnabled:K.boolean().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:K.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:K.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:K.array(K.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:K.record(K.string(),K.object({mcpServers:K.record(K.string(),K.record(K.string(),K.union([K.string(),K.number(),K.boolean(),K.array(K.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:K.record(K.string(),K.union([K.string(),K.number(),K.boolean(),K.array(K.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:K.object({defaultEnvironmentId:K.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:K.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:K.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),plansDirectory:K.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:K.enum(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),...!1,voice:K.object({enabled:K.boolean().optional(),mode:K.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:K.boolean().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:K.boolean().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:K.array(K.object({marketplace:K.string(),plugin:K.string()})).optional().describe("Managed-org allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist — admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:K.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:K.boolean().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),autoMemoryEnabled:K.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:K.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:K.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:K.boolean().optional().describe("Request API-side thinking summaries and show them in the conversation and in the transcript view (ctrl+o). Set explicitly to override the default for your install."),skipDangerousModePermissionPrompt:K.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),disableAutoMode:K.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:K.array(K.object({id:K.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:K.string().describe("Display name for the SSH connection"),sshHost:K.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:K.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:K.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:K.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:K.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:K.array(K.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:K.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:K.union([K.enum(ME),K.string().startsWith("custom:").transform((Q)=>Q)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:K.enum(FE).optional().catch(void 0).describe("Key binding mode for the prompt input"),verbose:K.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:K.enum(DE).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:K.boolean().optional().describe("Automatically compact conversation when context fills"),autoScrollEnabled:K.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),fileCheckpointingEnabled:K.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:K.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:K.boolean().optional().describe("Stamp each assistant message with its arrival time"),terminalProgressBarEnabled:K.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:K.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:K.enum(ZE).optional().catch(void 0).describe("How spawned teammates execute (tmux, in-process, auto)"),remoteControlAtStartup:K.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:K.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:K.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:K.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:K.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:K.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...uE($)}).passthrough()}var _4=b(()=>eE(Rz()));var X1="https://code.claude.com/docs/en",N$$=[{matches:($)=>$.path==="permissions.defaultMode"&&$.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${X1}/iam#permission-modes`}},{matches:($)=>$.path==="apiKeyHelper"&&$.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:($)=>$.path==="cleanupPeriodDays"&&$.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:($)=>$.path.startsWith("env.")&&$.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${X1}/settings#environment-variables`}},{matches:($)=>($.path==="permissions.allow"||$.path==="permissions.deny")&&$.code==="invalid_type"&&$.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:($)=>$.path.startsWith("hooks.")&&$.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${X1}/hooks`}},{matches:($)=>/\.hooks\.\d+\.command$/.test($.path)&&$.code==="invalid_type"&&$.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${X1}/hooks#exec-form-and-shell-form`}},{matches:($)=>$.path.includes("hooks")&&$.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:($)=>$.code==="invalid_type"&&$.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:($)=>$.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${X1}/settings`}},{matches:($)=>$.code==="invalid_value"&&$.enumValues!==void 0,tip:{suggestion:void 0}},{matches:($)=>$.code==="invalid_type"&&$.expected==="object"&&$.received===null&&$.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:($)=>$.path==="permissions.additionalDirectories"&&$.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${X1}/iam#working-directories`}}],w$$={permissions:`${X1}/iam#configuring-permissions`,env:`${X1}/settings#environment-variables`,hooks:`${X1}/hooks`};function $b($){let Q=N$$.find((Y)=>Y.matches($));if(!Q)return null;let J={...Q.tip};if($.code==="invalid_value"&&$.enumValues&&!J.suggestion)J.suggestion=`Valid values: ${$.enumValues.map((Y)=>`"${Y}"`).join(", ")}`;if(!J.docLink&&$.path)J.docLink=w$$[nO($.path,".")];return J}var PZ$=b(()=>_4().strict());function Qb($){return $.code==="invalid_type"}function Jb($){return $.code==="invalid_value"}function O$$($){return $.code==="unrecognized_keys"}function Xb($){return $.code==="too_small"}function aJ($){if($===null)return"null";if($===void 0)return"undefined";if(Array.isArray($))return"array";return typeof $}function Yb($){let Q=$.match(/received (\w+)/);return Q?Q[1]:void 0}function d0($,Q){return $.issues.map((J)=>{let Y=J.path.map(String).join("."),X=J.message,W,G,U,H,q;if(Jb(J))G=J.values.map((B)=>String(B)),U=G.join(" | "),H=void 0,q=void 0;else if(Qb(J)){U=J.expected;let B=Yb(J.message);H=B??aJ(J.input),q=B??aJ(J.input)}else if(Xb(J))U=String(J.minimum);else if(J.code==="custom"&&"params"in J)H=J.params.received,q=H;let V=$b({path:Y,code:J.code,expected:U,received:H,enumValues:G,message:J.message,value:H});if(Jb(J))W=G?.map((B)=>`"${B}"`).join(", "),X=`Invalid value. Expected one of: ${W}`;else if(Qb(J)){let B=Yb(J.message)??aJ(J.input);if(J.expected==="object"&&B==="null"&&Y==="")X="Invalid or malformed JSON";else X=`Expected ${J.expected}, but received ${B}`}else if(O$$(J)){let B=J.keys.join(", ");X=`Unrecognized ${iO(J.keys.length,"field")}: ${B}`}else if(Xb(J))X=`Number must be greater than or equal to ${J.minimum}`,W=String(J.minimum);return{file:Q,path:Y,message:X,expected:W,invalidValue:q,suggestion:V?.suggestion,docLink:V?.docLink}})}function D$$($,Q){if(!$||typeof $!=="object")return[];let J=$;if(!J.permissions||typeof J.permissions!=="object")return[];let Y=J.permissions,X=[];for(let W of["allow","deny","ask"]){let G=Y[W];if(!Array.isArray(G))continue;Y[W]=G.filter((U)=>{if(typeof U!=="string")return X.push({file:Q,path:`permissions.${W}`,message:`Non-string value in ${W} array was removed`,severity:"warning",invalidValue:U}),!1;let H=Ez(U);if(!H.valid){let q=`Invalid permission rule "${U}" was skipped: ${H.error}`;if(H.suggestion)q+=`. ${H.suggestion}`;return X.push({file:Q,path:`permissions.${W}`,message:q,severity:"warning",invalidValue:U}),!1}return!0})}return X}var F$$=new Set(r0);function Z$$($,Q){if(!$||typeof $!=="object")return[];let J=$;if(!("hooks"in J))return[];if(J.hooks===null||typeof J.hooks!=="object"||Array.isArray(J.hooks)){let W=aJ(J.hooks);return delete J.hooks,[{file:Q,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${W}. This field was ignored.`,severity:"warning",invalidValue:W,docLink:"https://code.claude.com/docs/en/hooks"}]}let Y=J.hooks,X=[];for(let W of Object.keys(Y)){if(!F$$.has(W)){delete Y[W],X.push({file:Q,path:`hooks.${W}`,message:`Unknown hook event "${W}" was ignored. Valid events: ${r0.join(", ")}`,severity:"warning",invalidValue:W,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(Y[W])){let G=aJ(Y[W]);delete Y[W],X.push({file:Q,path:`hooks.${W}`,message:`Hook event "${W}" must be an array of matchers; received ${G}. This entry was ignored.`,severity:"warning",invalidValue:G,docLink:"https://code.claude.com/docs/en/hooks"})}}if(X.length>0&&Object.keys(Y).length===0)delete J.hooks;return X}function i1($,Q){return[...D$$($,Q),...Z$$($,Q)]}import{userInfo as M$$}from"os";var Wb="com.anthropic.claudecode",sJ="HKLM\\SOFTWARE\\Policies\\ClaudeCode",eJ="HKCU\\SOFTWARE\\Policies\\ClaudeCode",n1="Settings",Gb="/usr/bin/plutil",Ub=["-convert","json","-o","-","--"],Hb=5000,bz="/mnt/c/Windows/System32/reg.exe",b9="/mnt/c/Program Files/ClaudeCode";function XG(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let $=v6("fs").readFileSync("/proc/version","utf8").toLowerCase();return $.includes("microsoft")||$.includes("wsl")}catch{return!1}}function Kb(){let $="";try{$=M$$().username}catch{}let Q=[];if($)Q.push({path:`/Library/Managed Preferences/${$}/${Wb}.plist`,label:"per-user managed preferences"});return Q.push({path:`/Library/Managed Preferences/${Wb}.plist`,label:"device-level managed preferences"}),Q}import{execFile as L$$}from"child_process";import{existsSync as j$$}from"fs";var A$$=null;function $X($,Q){return new Promise((J)=>{try{L$$($,Q,{encoding:"utf-8",timeout:Hb},(Y,X)=>{J({stdout:X??"",code:Y?1:0})})}catch{J({stdout:"",code:1})}})}function qb(){return(async()=>{if(process.platform==="darwin"){let $=Kb(),J=(await Promise.all($.map(async({path:Y,label:X})=>{if(!j$$(Y))return{stdout:"",label:X,ok:!1};let{stdout:W,code:G}=await $X(Gb,[...Ub,Y]);return{stdout:W,label:X,ok:G===0&&!!W}}))).find((Y)=>Y.ok);return{plistStdouts:J?[{stdout:J.stdout,label:J.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let Q=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[J,Y]=await Promise.all([$X(Q,["query",sJ,"/v",n1]),$X(Q,["query",eJ,"/v",n1])]);return{plistStdouts:null,hklmStdout:J.code===0?J.stdout:null,hkcuStdout:Y.code===0?Y.stdout:null}}if(XG()){let[$,Q]=await Promise.all([$X(bz,["query",sJ,"/v",n1]),$X(bz,["query",eJ,"/v",n1])]);return{plistStdouts:null,hklmStdout:$.code===0?$.stdout:null,hkcuStdout:Q.code===0?Q.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function Vb(){return A$$}var r1=Object.freeze({settings:{},errors:[]}),wb=null,Ob=null,Db=!1,YG=null;function I$$(){if(YG)return;YG=(async()=>{let $=Date.now(),Q=Vb()??qb(),{mdm:J,hkcu:Y,wslInherits:X}=R$$(await Q);wb=J,Ob=Y,Db=X;let W=Date.now()-$;if(X$(`MDM settings load completed in ${W}ms`),Object.keys(J.settings).length>0){X$(`MDM settings found: ${Object.keys(J.settings).join(", ")}`);try{iJ("info","mdm_settings_loaded",{duration_ms:W,key_count:Object.keys(J.settings).length,error_count:J.errors.length})}catch{}}})()}async function Fb(){if(!YG)I$$();await YG}function Zb(){return wb??r1}function Mb(){return Ob??r1}function Lb(){return Db}function _z($,Q){let J=A4(R9($,!1));if(!J||typeof J!=="object")return{settings:{},errors:[]};let Y=i1(J,Q),X=_4().safeParse(J);if(!X.success){let W=d0(X.error,Q);return{settings:{},errors:[...Y,...W]}}return{settings:X.data,errors:Y}}function Bb($,Q="Settings"){let J=$.split(/\r?\n/),Y=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`^\\s+${Y}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let W of J){let G=W.match(X);if(G&&G[1])return G[1].trimEnd()}return null}function R$$($){let Q=[];if($.plistStdouts&&$.plistStdouts.length>0){let{stdout:G,label:U}=$.plistStdouts[0],H=_z(G,U),{wslInheritsWindowsSettings:q,...V}=H.settings;if(Object.keys(V).length>0)return{mdm:H,hkcu:r1,wslInherits:!1};Q.push(...H.errors)}let J=null;if($.hklmStdout){let G=Bb($.hklmStdout);if(G)J=_z(G,`Registry: ${sJ}\\${n1}`)}if(J)Q.push(...J.errors);let Y=Q.length>0?{settings:{},errors:Q}:r1,X=XG(),W=!1;if(X){if(W=J?.settings.wslInheritsWindowsSettings===!0||E$$(),!W)return{mdm:Y,hkcu:r1,wslInherits:!1}}if(J){let{wslInheritsWindowsSettings:G,...U}=J.settings;if(Object.keys(U).length>0)return{mdm:J,hkcu:r1,wslInherits:W}}if(P$$(W))return{mdm:Y,hkcu:r1,wslInherits:W};if($.hkcuStdout){let G=Bb($.hkcuStdout);if(G){let U=_z(G,`Registry: ${eJ}\\${n1}`);if(!X||U.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:H,...q}=U.settings;return{mdm:Y,hkcu:{settings:q,errors:U.errors},wslInherits:W}}if(U.errors.length>0)return{mdm:Y,hkcu:{settings:{},errors:U.errors},wslInherits:W}}}return{mdm:Y,hkcu:r1,wslInherits:W}}function P$$($){if($&&Nb(b9))return!0;return Nb(m0())}function zb($){let Q=A4(R9(h0($),!1));if(!Q||typeof Q!=="object")return!1;i1(Q,$);let{wslInheritsWindowsSettings:J,...Y}=Q;return Object.keys(Y).length>0}function E$$(){function $(Q){try{let J=R9(h0(Q),!1);return!!J&&typeof J==="object"&&"wslInheritsWindowsSettings"in J&&J.wslInheritsWindowsSettings===!0}catch{return!1}}if($(_9(b9,"managed-settings.json")))return!0;try{let Q=_9(b9,"managed-settings.d");for(let J of c$().readdirSync(Q))if((J.isFile()||J.isSymbolicLink())&&J.name.endsWith(".json")&&!J.name.startsWith(".")&&$(_9(Q,J.name)))return!0}catch{}return!1}function Nb($){try{if(zb(_9($,"managed-settings.json")))return!0}catch{}try{let Q=_9($,"managed-settings.d"),J=c$().readdirSync(Q);for(let Y of J){if(!(Y.isFile()||Y.isSymbolicLink())||!Y.name.endsWith(".json")||Y.name.startsWith("."))continue;try{if(zb(_9(Q,Y.name)))return!0}catch{}}}catch{}return!1}function b$$($,Q,J){if(J!==void 0&&!H1($[Q],J)||J===void 0&&!(Q in $))Z8($,Q,J)}var QX=b$$;function _$$($){return function(Q,J,Y){var X=-1,W=Object(Q),G=Y(Q),U=G.length;while(U--){var H=G[$?U:++X];if(J(W[H],H,W)===!1)break}return Q}}var jb=_$$;var S$$=jb(),Ab=S$$;function k$$($){return r6($)&&L8($)}var Ib=k$$;var v$$="[object Object]",C$$=Function.prototype,T$$=Object.prototype,Rb=C$$.toString,x$$=T$$.hasOwnProperty,y$$=Rb.call(Object);function f$$($){if(!r6($)||L4($)!=v$$)return!1;var Q=W5($);if(Q===null)return!0;var J=x$$.call(Q,"constructor")&&Q.constructor;return typeof J=="function"&&J instanceof J&&Rb.call(J)==y$$}var Pb=f$$;function g$$($,Q){if(Q==="constructor"&&typeof $[Q]==="function")return;if(Q=="__proto__")return;return $[Q]}var JX=g$$;function h$$($){return pw($,J5($))}var Eb=h$$;function u$$($,Q,J,Y,X,W,G){var U=JX($,J),H=JX(Q,J),q=G.get(H);if(q){QX($,J,q);return}var V=W?W(U,H,J+"",$,Q,G):void 0,B=V===void 0;if(B){var z=B6(H),N=!z&&TQ(H),w=!z&&!N&&$5(H);if(V=H,z||N||w)if(B6(U))V=U;else if(Ib(U))V=KO(U);else if(N)B=!1,V=UU(H,!0);else if(w)B=!1,V=BO(H,!0);else V=[];else if(Pb(H)||h4(H)){if(V=U,h4(U))V=Eb(U);else if(!$6(U)||o0(U))V=wO(H)}else B=!1}if(B)G.set(H,V),X(V,H,Y,W,G),G.delete(H);QX($,J,V)}var bb=u$$;function _b($,Q,J,Y,X){if($===Q)return;Ab(Q,function(W,G){if(X||(X=new cw),$6(W))bb($,Q,G,J,_b,Y,X);else{var U=Y?Y(JX($,G),W,G+"",$,Q,X):void 0;if(U===void 0)U=W;QX($,G,U)}},J5)}var Sb=_b;function m$$($,Q,J){switch(J.length){case 0:return $.call(Q);case 1:return $.call(Q,J[0]);case 2:return $.call(Q,J[0],J[1]);case 3:return $.call(Q,J[0],J[1],J[2])}return $.apply(Q,J)}var kb=m$$;var vb=Math.max;function l$$($,Q,J){return Q=vb(Q===void 0?$.length-1:Q,0),function(){var Y=arguments,X=-1,W=vb(Y.length-Q,0),G=Array(W);while(++X<W)G[X]=Y[Q+X];X=-1;var U=Array(Q+1);while(++X<Q)U[X]=Y[X];return U[Q]=J(G),kb($,this,U)}}var WG=l$$;function c$$($){return function(){return $}}var Cb=c$$;var p$$=!F8?G5:function($,Q){return F8($,"toString",{configurable:!0,enumerable:!1,value:Cb(Q),writable:!0})},Tb=p$$;var d$$=800,i$$=16,n$$=Date.now;function r$$($){var Q=0,J=0;return function(){var Y=n$$(),X=i$$-(Y-J);if(J=Y,X>0){if(++Q>=d$$)return arguments[0]}else Q=0;return $.apply(void 0,arguments)}}var xb=r$$;var o$$=xb(Tb),GG=o$$;function t$$($,Q){return GG(WG($,Q,G5),$+"")}var yb=t$$;function a$$($,Q,J){if(!$6(J))return!1;var Y=typeof Q;if(Y=="number"?L8(J)&&F1(Q,J.length):Y=="string"&&(Q in J))return H1(J[Q],$);return!1}var fb=a$$;function s$$($){return yb(function(Q,J){var Y=-1,X=J.length,W=X>1?J[X-1]:void 0,G=X>2?J[2]:void 0;if(W=$.length>3&&typeof W=="function"?(X--,W):void 0,G&&fb(J[0],J[1],G))W=X<3?void 0:W,X=1;Q=Object(Q);while(++Y<X){var U=J[Y];if(U)$(Q,U,Y,W)}return Q})}var gb=s$$;var e$$=gb(function($,Q,J,Y){Sb($,Q,J,Y)}),Y1=e$$;function $6$($,Q,J,Y){if(!$6($))return $;Q=Z1(Q,$);var X=-1,W=Q.length,G=W-1,U=$;while(U!=null&&++X<W){var H=A8(Q[X]),q=J;if(H==="__proto__"||H==="constructor"||H==="prototype")return $;if(X!=G){var V=U[H];if(q=Y?Y(V,H,U):void 0,q===void 0)q=$6(V)?V:F1(Q[X+1])?[]:{}}rX(U,H,q),U=U[H]}return $}var hb=$6$;function Q6$($,Q,J){var Y=-1,X=Q.length,W={};while(++Y<X){var G=Q[Y],U=RO($,G);if(J(U,G))hb(W,Z1(G,$),U)}return W}var ub=Q6$;function J6$($,Q){return ub($,Q,function(J,Y){return bO($,Y)})}var mb=J6$;var lb=c6?c6.isConcatSpreadable:void 0;function X6$($){return B6($)||h4($)||!!(lb&&$&&$[lb])}var cb=X6$;function pb($,Q,J,Y,X){var W=-1,G=$.length;J||(J=cb),X||(X=[]);while(++W<G){var U=$[W];if(Q>0&&J(U))if(Q>1)pb(U,Q-1,J,Y,X);else qO(X,U);else if(!Y)X[X.length]=U}return X}var db=pb;function Y6$($){var Q=$==null?0:$.length;return Q?db($,1):[]}var ib=Y6$;function W6$($){return GG(WG($,void 0,ib),$+"")}var nb=W6$;var G6$=nb(function($,Q){return $==null?{}:mb($,Q)}),UG=G6$;import{dirname as B6$,join as t1,resolve as XX}from"path";import{join as U6$}from"path";var H6$="remote-settings.json",Sz=null,K6$;function rb(){return}function q6$(){return rb()??U6$(p6(),H6$)}function V6$(){try{let $=h0(q6$()),Q=g$(rW($));if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;return Q}catch{return null}}function ob(){if(!rb()&&K6$!==!0)return null;if(Sz)return Sz;let $=V6$();if($)return Sz=$,V0(),$;return null}function Cz($){let Q=new Set($.allowedSources);return Q.add("flagSettings"),Q.add("policySettings"),gE.filter((J)=>Q.has(J))}function z6$(){return t1(m0(),"managed-settings.json")}function ab($){if(u0()==="wsl"&&$.wslInherits?.()){let Q=kz(b9);if(Q.settings)return Q;let J=kz(m0());return{settings:J.settings,errors:[...Q.errors,...J.errors]}}return kz(m0())}function kz($){let Q=[],J={},Y=!1,{settings:X,errors:W}=HG(t1($,"managed-settings.json"));if(Q.push(...W),X&&Object.keys(X).length>0)J=Y1(J,X,o1),Y=!0;let G=t1($,"managed-settings.d");try{let q=c$().readdirSync(G).filter((V)=>(V.isFile()||V.isSymbolicLink())&&V.name.endsWith(".json")&&!V.name.startsWith(".")).map((V)=>V.name).sort();for(let V of q){let{settings:B,errors:z}=HG(t1(G,V));if(Q.push(...z),B&&Object.keys(B).length>0)J=Y1(J,B,o1),Y=!0}}catch(q){let V=o$(q);if(V!=="ENOENT"&&V!=="ENOTDIR")X$(`managed-settings.d read failed: ${q}`,{level:"error"})}let{wslInheritsWindowsSettings:U,...H}=J;return{settings:Y&&Object.keys(H).length>0?J:null,errors:Q}}function N6$($,Q){if(D1($))X$(`Broken symlink or missing file encountered for settings.json at path: ${Q}`);else X$(`settings file read failed at ${Q}: ${$}`,{level:"error"})}function HG($,Q){let J=CO($);if(J)return{settings:J.settings?A4(J.settings):null,errors:J.errors};let Y=w6$($,Q);return TO($,Y),{settings:Y.settings?A4(Y.settings):null,errors:Y.errors}}function sb($){if(!$.mdm)return{settings:null,errors:[]};let Q=$.mdm();return{settings:Object.keys(Q.settings).length>0?Q.settings:null,errors:Q.errors}}function eb($){let Q=$?.remote?$.remote():ob();if(!Q||Object.keys(Q).length===0)return{settings:null,errors:[]};let J=A4(Q),Y=i1(J,"remote managed settings"),X=_4().safeParse(J);if(!X.success)return{settings:null,errors:[...Y,...d0(X.error,"remote managed settings")]};return{settings:Object.keys(X.data).length>0?X.data:null,errors:Y}}function $_($){let Q=$.parentManaged;if(!Q||Object.keys(Q).length===0)return{settings:null,errors:[]};let J=A4(Q),Y=i1(J,"parent managed settings"),X=_4().safeParse(J);if(!X.success)return{settings:null,errors:[...Y,...d0(X.error,"parent managed settings")]};return Object.keys(X.data).length>0?{settings:X.data,errors:Y}:{settings:null,errors:Y}}function Q_($){let Q=$.flagInline;if(!Q)return{settings:null,errors:[]};let J=A4(Q),Y=i1(J,"SDK inline settings"),X=_4().safeParse(J);if(!X.success)return{settings:null,errors:[...Y,...d0(X.error,"SDK inline settings")]};return{settings:X.data,errors:Y}}function w6$($,Q){try{let J;if(Q!==void 0)J=Q;else{let{resolvedPath:G}=H5(c$(),$);J=h0(G)}if(J.trim()==="")return{settings:{},errors:[]};let Y=A4(R9(J,!1)),X=i1(Y,$),W=_4().safeParse(Y);if(!W.success){let G=d0(W.error,$);return{settings:null,errors:[...X,...G]}}return{settings:W.data,errors:X}}catch(J){return N6$(J,$),{settings:null,errors:[]}}}function tb($,Q){switch($){case"userSettings":return XX(p6());case"policySettings":case"projectSettings":case"localSettings":return XX(Q.cwd);case"flagSettings":return Q.flagPath?B6$(XX(Q.flagPath)):XX(Q.cwd)}}function O6$($){if($.coworkPlugins||A$(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS))return"cowork_settings.json";return"settings.json"}function YX($,Q){switch($){case"userSettings":return t1(tb($,Q),O6$(Q));case"projectSettings":case"localSettings":return t1(tb($,Q),D6$($));case"policySettings":return z6$();case"flagSettings":return Q.flagPath}}function D6$($){switch($){case"projectSettings":return t1(".claude","settings.json");case"localSettings":return t1(".claude","settings.local.json")}}function J_($,Q){let J=kO($);if(J!==void 0)return J;let Y=L6$($,Q);return vO($,Y),Y}function F6$($){return!$||$.parentSettingsBehavior==="merge"}function Z6$($,Q){let J={};if($.allowManagedHooksOnly===!0)J.allowManagedHooksOnly=!0;if($.allowManagedMcpServersOnly===!0)J.allowManagedMcpServersOnly=!0;if($.allowManagedPermissionRulesOnly===!0)J.allowManagedPermissionRulesOnly=!0;let Y=$.strictPluginOnlyCustomization;if(Y===!0||Array.isArray(Y)&&Y.length>0)J.strictPluginOnlyCustomization=Y;if($.deniedMcpServers)J.deniedMcpServers=$.deniedMcpServers;if(Q.forceLoginOrgUUID===void 0&&$.forceLoginOrgUUID)J.forceLoginOrgUUID=$.forceLoginOrgUUID;if(Q.allowedMcpServers===void 0&&$.allowedMcpServers)J.allowedMcpServers=$.allowedMcpServers;if($.permissions){let X=UG($.permissions,["deny","ask"]);if($.permissions.disableBypassPermissionsMode==="disable")X.disableBypassPermissionsMode="disable";if(Q.allowManagedPermissionRulesOnly!==!0){let{allow:W,additionalDirectories:G}=$.permissions;if(W&&Q.sandbox?.network?.allowManagedDomainsOnly!==!0)X.allow=W;if(G)X.additionalDirectories=G}if(Object.keys(X).length>0)J.permissions=X}if($.sandbox){let{network:X,filesystem:W}=$.sandbox,G={};if($.sandbox.enabled===!0)G.enabled=!0;if($.sandbox.failIfUnavailable===!0)G.failIfUnavailable=!0;if($.sandbox.allowUnsandboxedCommands===!1)G.allowUnsandboxedCommands=!1;if($.sandbox.autoAllowBashIfSandboxed===!1)G.autoAllowBashIfSandboxed=!1;if(X){let U=UG(X,["deniedDomains"]);if(X.allowManagedDomainsOnly===!0)U.allowManagedDomainsOnly=!0;if(Q.sandbox?.network?.allowManagedDomainsOnly!==!0&&X.allowedDomains)U.allowedDomains=X.allowedDomains;if(Object.keys(U).length>0)G.network=U}if(W){let U=UG(W,["denyRead","denyWrite"]);if(W.allowManagedReadPathsOnly===!0)U.allowManagedReadPathsOnly=!0;if(Q.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&W.allowRead)U.allowRead=W.allowRead;if(Object.keys(U).length>0)G.filesystem=U}if(Object.keys(G).length>0)J.sandbox=G}return J}function X_($){if($.helper?.())return"helper";if(eb($).settings)return"remote";if(sb($).settings)return u0()==="macos"?"plist":"hklm";if(($.file?.()??ab($)).settings)return"file";if($_($).settings)return"parent";let Q=$.hkcu?.();return Q&&Object.keys(Q.settings).length>0?"hkcu":null}function M6$($){let Q=[],{settings:J,errors:Y}=eb($);Q.push(...Y);let{settings:X,errors:W}=sb($);Q.push(...W);let{settings:G,errors:U}=$.file?.()??ab($);Q.push(...U);let{settings:H,errors:q}=$_($);Q.push(...q);let V=[J,X,G].filter((w)=>w!==null),B=V[0]??null,z={allowManagedPermissionRulesOnly:V.some((w)=>w.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:V.find((w)=>w.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:V.find((w)=>w.allowedMcpServers!==void 0)?.allowedMcpServers,sandbox:{network:{allowManagedDomainsOnly:V.some((w)=>w.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:V.some((w)=>w.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},N=H&&F6$(B)?Z6$(H,z):null;return{tiers:V,admin:B,parentSlice:N,errors:Q}}function Y_($){let Q=$.helper?.();if(Q)return{settings:Q,errors:$.helperWarnings?.()??[]};let{admin:J,parentSlice:Y,errors:X}=M6$($);if(!J&&!Y){let W=$.hkcu?.();if(W&&Object.keys(W.settings).length>0)return{settings:W.settings,errors:[...X,...W.errors]};return{settings:null,errors:[...X,...W?.errors??[]]}}return{settings:Y1({},Y??{},J??{},o1),errors:X}}function L6$($,Q){if($==="policySettings")return Y_(Q).settings;let J=YX($,Q),{settings:Y}=J?HG(J,$==="flagSettings"?Q.flagExpectedContent:void 0):{settings:null};if($==="flagSettings"){let{settings:X}=Q_(Q);if(X)return Y1(Y||{},X,o1)}return Y}function j6$($,Q){return b5([...$,...Q])}function o1($,Q){if(Array.isArray($)&&Array.isArray(Q))return j6$($,Q);return}var vz=!1;function A6$($){if(vz)return{settings:{},errors:[]};let Q=Date.now();iJ("info","settings_load_started"),vz=!0;try{let J=xO(),Y={};if(J)Y=Y1(Y,J,o1);let X=[],W=new Set,G=new Set;for(let U of Cz($)){if(U==="policySettings"){let{settings:q,errors:V}=Y_($);if(q)Y=Y1(Y,q,o1);for(let B of V){let z=`${B.file}:${B.path}:${B.message}`;if(!W.has(z))W.add(z),X.push(B)}continue}let H=YX(U,$);if(H){let q=XX(H);if(!G.has(q)){G.add(q);let{settings:V,errors:B}=HG(H,U==="flagSettings"?$.flagExpectedContent:void 0);for(let z of B){let N=`${z.file}:${z.path}:${z.message}`;if(!W.has(N))W.add(N),X.push(z)}if(V)Y=Y1(Y,V,o1)}}if(U==="flagSettings"){let{settings:q,errors:V}=Q_($);for(let B of V){let z=`${B.file}:${B.path}:${B.message}`;if(!W.has(z))W.add(z),X.push(B)}if(q)Y=Y1(Y,q,o1)}}return iJ("info","settings_load_completed",{duration_ms:Date.now()-Q,source_count:G.size,error_count:X.length}),{settings:Y,errors:X}}finally{vz=!1}}function I6$($){let Q=_O();if(Q!==null)return Q;let J=A6$($);return SO(J),J}function R6$($){let{settings:Q}=I6$($);return Q||{}}function W_($){V0();let Q=[];for(let J of Cz($)){let Y=J_(J,$);if(Y&&Object.keys(Y).length>0)Q.push({source:J,settings:Y})}return{effective:R6$($),sources:Q}}function G_($,Q){let J=Cz(Q);for(let Y=J.length-1;Y>=0;Y--){let X=J[Y];if(J_(X,Q)?.[$]!==void 0)return X}return null}var E6$={user:"userSettings",project:"projectSettings",local:"localSettings"},U_={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},b6$=["user","project","local"],_6$=new Set(["bypassPermissions","auto","acceptEdits"]),S6$=new Set(["project"]);function k6$($){let Q=$.effective.permissions?.defaultMode;if(!Q||!_6$.has(Q))return $.effective;for(let J=$.sources.length-1;J>=0;J--){let Y=$.sources[J];if(Y.settings.permissions?.defaultMode!==void 0){if(S6$.has(Y.source)){let{defaultMode:X,...W}=$.effective.permissions??{};return{...$.effective,permissions:W}}return $.effective}}return $.effective}async function H_($={}){await Fb();let Q={cwd:P6$($.cwd??c$().cwd()),allowedSources:($.settingSources??b6$).map((J)=>E6$[J]),parentManaged:$.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Zb,hkcu:Mb,wslInherits:Lb,...$.serverManagedSettings!==void 0&&{remote:()=>$.serverManagedSettings}};try{let{effective:J,sources:Y}=W_(Q),X=X_(Q)??void 0,W=Y.map(({source:U,settings:H})=>({source:U_[U],settings:H,path:U==="policySettings"?void 0:YX(U,Q),...U==="policySettings"&&{policyOrigin:X}})),G={};for(let U of Object.keys(J)){let H=G_(U,Q);if(H)G[U]={source:U_[H],path:H==="policySettings"?void 0:YX(H,Q),...H==="policySettings"&&{policyOrigin:X}}}return{effective:J,provenance:G,sources:W}}finally{V0()}}async function oj$($){return H_($)}async function l6$($,Q){try{await x6$($,Q)}catch(J){if(!D1(J))throw J}}async function c6$($,Q){if(!$)return;let J=$;try{let Y=g$($);if(Y?.claudeAiOauth?.refreshToken)delete Y.claudeAiOauth.refreshToken,J=B$(Y)}catch{}await w_(Q,J,{mode:384})}function p6$(){if(process.platform!=="darwin")return Promise.resolve(void 0);let $=uZ(hZ);return new Promise((Q)=>{v6$("security",["find-generic-password","-a",mZ(),"-w","-s",$],{encoding:"utf-8",timeout:5000},(J,Y)=>Q(J?void 0:Y.trim()||void 0))})}async function F_($,Q,J,Y,X=60000){if(!Z$(Q))return;let W=J4(J),G=await v4($.load({projectKey:W,sessionId:Q}),X,`SessionStore.load() timed out after ${X}ms for session ${Q}`);if(!G||G.length===0)return;let U=u6(h6$(),`claude-resume-${hz()}`);try{let H=u6(U,"projects",W);await Tz(H,{recursive:!0});let q=u6(H,`${Q}.jsonl`);await nQ(q,G);let V=Y?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,B=V??u6(xz(),".claude"),z;try{z=await N_(u6(B,".credentials.json"),"utf-8")}catch(N){if(!D1(N))throw N}if(!V&&!(Y??process.env).ANTHROPIC_API_KEY&&!(Y??process.env).CLAUDE_CODE_OAUTH_TOKEN)z=await p6$()??z;if(await c6$(z,u6(U,".credentials.json")),await l6$(u6(V??xz(),".claude.json"),u6(U,".claude.json")),$.listSubkeys){let N=u6(H,Q),w=await v4($.listSubkeys({projectKey:W,sessionId:Q}),X,`SessionStore.listSubkeys() timed out after ${X}ms for session ${Q}`);for(let O of w){let D=WX(N,O+".jsonl");if(!O||O_(O)||O.split(/[\\/]/).includes("..")||!D.startsWith(N+uz)){X$(`[SessionStore] skipping unsafe subpath from listSubkeys: ${O}`,{level:"warn"});continue}let M=await v4($.load({projectKey:W,sessionId:Q,subpath:O}),X,`SessionStore.load() timed out after ${X}ms for session ${Q} subpath ${O}`);if(!M||M.length===0)continue;let j=[],A=[];for(let k of M)if(gz(k))j.push(k);else A.push(k);if(A.length>0)await Tz(K_(D),{recursive:!0}),await nQ(D,A);if(j.length>0){let k=j.at(-1),u=WX(N,O+".meta.json");await Tz(K_(u),{recursive:!0});let{type:G$,...u$}=k;await w_(u,B$(u$),{mode:384})}}}return U}catch(H){throw await KG(U),H}}function yz($,Q,J,Y){let{systemPrompt:X,settings:W,managedSettings:G,settingSources:U,sandbox:H,...q}=$??{},V,B,z;if(X===void 0)V="";else if(typeof X==="string")V=X;else if(Array.isArray(X))V=X;else if(X.type==="preset")B=X.append,z=X.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.152";let{abortController:N=f9(),additionalDirectories:w=[],agent:O,agents:D,allowedTools:M=[],betas:j,canUseTool:A,continue:k,cwd:u,debug:G$,debugFile:u$,disallowedTools:e$=[],tools:m6,env:F6,executable:a1=VX()?"bun":"node",executableArgs:i0=[],extraArgs:S4={},fallbackModel:S9,enableFileCheckpointing:W1,toolConfig:i,forkSession:GX,hooks:UX,includeHookEvents:k9,includePartialMessages:v9,forwardSubagentText:C9,onElicitation:HX,persistSession:m$,sessionStore:s$,sessionStoreFlush:k4,thinking:T9,effort:A_,maxThinkingTokens:VG,maxTurns:I_,maxBudgetUsd:R_,taskBudget:P_,mcpServers:mz,model:E_,outputFormat:lz,permissionMode:b_="default",allowDangerouslySkipPermissions:__=!1,permissionPromptToolName:S_,plugins:k_,getOAuthToken:cz,getHostAuthToken:pz,workload:dz,resume:iz,resumeSessionAt:v_,sessionId:C_,skills:nz,stderr:T_,strictMcpConfig:x_}=q;if(s$&&m$===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(s$&&k&&!iz&&!s$.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(s$&&W1)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(s$&&q.spawnClaudeCodeProcess)X$("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});let BG=q.pathToClaudeCodeExecutable;if(!BG){let k6=m6$(import.meta.url),X4=g6$(k6),s1=K2((n0)=>X4.resolve(n0));if(!s1)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);BG=s1}let rz=lz?.type==="json_schema"?lz.schema:void 0,V6=F6?{...F6}:{...process.env};if(!V6.CLAUDE_CODE_ENTRYPOINT)V6.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!V6.CLAUDE_AGENT_SDK_VERSION)V6.CLAUDE_AGENT_SDK_VERSION="0.3.152";if(W1)V6.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(cz)V6.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(pz)V6.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(i?.askUserQuestion?.previewFormat)V6.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=i.askUserQuestion.previewFormat;let zG={};if(qG.propagation.inject(qG.context.active(),zG),"traceparent"in zG){for(let k6 of["TRACEPARENT","TRACESTATE"])if(!(k6 in(F6??{})))delete V6[k6]}for(let[k6,X4]of Object.entries(zG)){let s1=k6.toUpperCase();if(!(s1 in(F6??{})))V6[s1]=X4}let oz={},tz=new Map;if(mz)for(let[k6,X4]of Object.entries(mz))if(X4.type==="sdk"&&X4.instance)tz.set(k6,X4.instance);else oz[k6]=X4;let x9;if(T9)switch(T9.type){case"adaptive":x9={type:"adaptive",display:T9.display};break;case"enabled":x9={type:"enabled",budgetTokens:T9.budgetTokens,display:T9.display};break;case"disabled":x9={type:"disabled"};break}else if(VG!==void 0)x9=VG===0?{type:"disabled"}:{type:"enabled",budgetTokens:VG};if(J){if(V6.CLAUDE_CONFIG_DIR=J,process.platform==="win32")V6.CLAUDE_SECURESTORAGE_CONFIG_DIR=F6?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??F6?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let az=new LU({abortController:N,additionalDirectories:w,agent:O,betas:j,cwd:u,debug:G$,debugFile:u$,executable:a1,executableArgs:i0,extraArgs:dz?{...S4,workload:dz}:S4,pathToClaudeCodeExecutable:BG,env:V6,forkSession:GX,stderr:T_,thinkingConfig:x9,effort:A_,maxTurns:I_,maxBudgetUsd:R_,taskBudget:P_,model:E_,fallbackModel:S9,jsonSchema:rz,permissionMode:b_,allowDangerouslySkipPermissions:__,permissionPromptToolName:S_,continueConversation:s$?void 0:k,resume:iz,resumeSessionAt:v_,sessionId:C_,settings:typeof W==="object"?B$(W):W,managedSettings:G?B$(G):void 0,settingSources:U,skills:nz,allowedTools:M,disallowedTools:e$,tools:m6,mcpServers:oz,strictMcpConfig:x_,canUseTool:!!A,hooks:!!UX,includeHookEvents:k9,includePartialMessages:v9,persistSession:m$,sessionMirror:!!s$,plugins:k_,sandbox:H,spawnClaudeCodeProcess:q.spawnClaudeCodeProcess,deferSpawn:Y}),y_={systemPrompt:V,appendSystemPrompt:B,planModeInstructions:q.planModeInstructions,appendSubagentSystemPrompt:q.appendSubagentSystemPrompt,toolAliases:q.toolAliases,excludeDynamicSections:z,agents:D,title:q.title,skills:nz,webSearchIsolationExemptMcpServers:q.webSearchIsolationExemptMcpServers,promptSuggestions:q.promptSuggestions,agentProgressSummaries:q.agentProgressSummaries,forwardSubagentText:C9},NG=new RU(az,Q,A,UX,N,tz,rz,y_,HX,cz,pz);if(s$){let k6=()=>u6(V6.CLAUDE_CONFIG_DIR??u6(xz(),".claude"),"projects"),X4=k4==="eager",s1=new PU(async(n0,wG)=>{let y9=z_(n0,k6());if(y9)await s$.append(y9,wG);else X$(`[SessionStore] dropping mirror frame: filePath ${n0} is not under ${k6()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},void 0,(n0,wG)=>{let y9=z_(n0,k6());if(y9)NG.reportMirrorError(y9,wG.message)},X4?0:z5,X4?0:N5);NG.setTranscriptMirrorBatcher(s1)}return{queryInstance:NG,transport:az,abortController:N,processEnv:V6}}function fz($,Q,J,Y){if(typeof J==="string")Q.write(B$({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:J}]},parent_tool_use_id:null})+`
116
116
  `);else $.streamInput(J).catch((X)=>Y.abort(X))}var d6$=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function KG($){for(let Q=0;;Q++)try{return await f6$($,{recursive:!0,force:!0})}catch(J){if(Q>=4||!d6$.has(o$(J)??""))return;await KX((Q+1)*100)}}function i6$($,Q){$.waitForExit().catch(()=>{}).finally(()=>KG(Q))}function tj$({prompt:$,options:Q}){if((Q?.resume||Q?.continue)&&Q?.sessionStore){let{queryInstance:W,transport:G,abortController:U,processEnv:H}=yz({...Q},typeof $==="string",void 0,!0),q=WX(Q.cwd??"."),V=Q.sessionStore,B=Q.loadTimeoutMs??60000,z=Q.resume;return(async()=>{if(!z)z=(await v4(V.listSessions(J4(q)),B,`SessionStore.listSessions() timed out after ${B}ms`)).slice().sort((O,D)=>D.mtime-O.mtime)[0]?.sessionId;if(!z)return;return F_(V,z,q,Q.env,Q.loadTimeoutMs)})().then((w)=>{if(w){G.updateResume(z);let O={CLAUDE_CONFIG_DIR:w};if(process.platform==="win32"){let D=Q.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??Q.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";O.CLAUDE_SECURESTORAGE_CONFIG_DIR=D,H.CLAUDE_SECURESTORAGE_CONFIG_DIR=D}G.updateEnv(O),H.CLAUDE_CONFIG_DIR=w,W.addCleanupCallback(()=>i6$(G,w))}if(!W.isClosed())G.spawn()}).catch((w)=>{let O=j4(w);G.spawnAbort(O),W.setError(O)}),fz(W,G,$,U),W}let{queryInstance:J,transport:Y,abortController:X}=yz(Q,typeof $==="string");return fz(J,Y,$,X),J}async function aj$({options:$,initializeTimeoutMs:Q=60000}={}){let J,Y=$?.resume;if((Y||$?.continue)&&$?.sessionStore){let U=WX($.cwd??".");if(!Y){if(!$.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let H=$.loadTimeoutMs??60000;Y=(await v4($.sessionStore.listSessions(J4(U)),H,`SessionStore.listSessions() timed out after ${H}ms`)).slice().sort((V,B)=>B.mtime-V.mtime)[0]?.sessionId}if(Y)J=await F_($.sessionStore,Y,U,$.env,$.loadTimeoutMs)}let X,W,G;try{let z=function(){if(B)return;B=!0,V.close()},U=yz(J&&Y&&Y!==$?.resume?{...$,resume:Y}:$,!1,J);X=U.queryInstance;let{transport:H,abortController:q}=U;W=H;let V=U.queryInstance;if(J){let N=J;V.addCleanupCallback(()=>{G=H.waitForExit().catch(()=>{}).then(()=>KG(N))})}await v4(V.initializationResult(),Q,`Subprocess initialization did not complete within ${Q}ms — check authentication and network connectivity`);let B=!1;return{query(N){if(B)throw Error("WarmQuery.query() can only be called once");B=!0;try{fz(V,H,N,q)}catch(w){throw V.close(),w}if(typeof N==="string")V.setIsSingleUserTurn(!0);return V},close:z,async[Symbol.asyncDispose](){B=!0,V.close(),await G}}}catch(U){if(X?.close(),J&&!G){let H=W;G=(H?H.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>KG(J))}throw await G,U}}async function sj$($,Q){if(Q?.sessionStore)return t6$(Q.sessionStore,$,Q);return OZ($,Q)}async function ej$($){if($?.sessionStore)return r6$($.sessionStore,$);return FZ($)}async function $A$($,Q){if(Q?.sessionStore)return a6$(Q.sessionStore,$,Q);return ZZ($,Q)}async function QA$($,Q,J){if(J?.sessionStore)return s6$(J.sessionStore,$,Q,J.dir);return AZ($,Q,J)}async function JA$($,Q,J){if(J?.sessionStore)return e6$(J.sessionStore,$,Q,J.dir);return IZ($,Q,J)}async function XA$($,Q){if(!Z$($))throw Error(`Invalid sessionId: ${$}`);if(Q?.sessionStore){if(!Q.sessionStore.delete)return;let J=J4(Q.dir);await Q.sessionStore.delete({projectKey:J,sessionId:$});return}return RZ($,Q)}async function YA$($,Q){if(Q?.sessionStore)return $4$(Q.sessionStore,$,Q);return bZ($,Q)}async function WA$($,Q,J){if(!Z$($))throw Error(`Invalid sessionId: ${$}`);let Y=await L1($,J?.dir);if(!Y)throw Error(`Session ${$} not found`);let X=J4(J?.dir),W=J?.batchSize&&J.batchSize>0?J.batchSize:z5;if(await q_(Y.filePath,{projectKey:X,sessionId:$},Q,W),J?.includeSubagents===!1)return;let G=Y.filePath.replace(/\.jsonl$/,""),U=u6(G,"subagents");for(let H of await n6$(U)){let q=D_(G,H).split(uz);q[q.length-1]=q.at(-1).replace(/\.jsonl$/,"");let V={projectKey:X,sessionId:$,subpath:q.join("/")};await q_(H,V,Q,W);let B=H.replace(/\.jsonl$/,".meta.json");try{let z=g$(await N_(B,"utf8"));await Q.append(V,[{type:"agent_metadata",...z}])}catch(z){if(!D1(z))throw z}}}async function q_($,Q,J,Y){let X=u6$({input:C6$($,{encoding:"utf8"}),crlfDelay:1/0}),W=[],G=0;for await(let U of X){if(!U)continue;if(W.push(g$(U)),G+=U.length,W.length>=Y||G>=N5)await J.append(Q,W),W=[],G=0}if(W.length>0)await J.append(Q,W)}async function n6$($){let Q=[];async function J(Y){let X;try{X=await y6$(Y,{withFileTypes:!0})}catch{return}for(let W of X){let G=u6(Y,W.name);if(W.isDirectory())await J(G);else if(W.isFile()&&W.name.endsWith(".jsonl"))Q.push(G)}}return await J($),Q}async function GA$($,Q){if(Q?.sessionStore)return Q4$(Q.sessionStore,$,Q.dir);return TZ($,Q)}async function UA$($,Q,J){if(J?.sessionStore)return J4$(J.sessionStore,$,Q,J);return xZ($,Q,J)}function Z_($){let Q=WX($??"."),J;try{J=T6$(Q)}catch{J=Q}return J.normalize("NFC")}function J4($){return F0(Z_($))}function M_($){return $.map((Q)=>B$(Q)).join(`
117
117
  `)+`
118
118
  `}function V_($,Q,J){if(Q!==void 0&&Q>0)return $.slice(J,J+Q);if(J>0)return $.slice(J);return $}function gz($){return typeof $==="object"&&$!==null&&"type"in $&&$.type==="agent_metadata"}async function r6$($,Q){let J=Z_(Q.dir),Y=F0(J),X=Q.offset??0,W=Q.limit;if($.listSessionSummaries){let q=await $.listSessionSummaries(Y),V=$.listSessions?new Map((await $.listSessions(Y)).map((w)=>[w.sessionId,w])):void 0,B=[];for(let w of q){let O=V?.get(w.sessionId);if(V&&!O)continue;let D=O!==void 0&&w.mtime<O.mtime;B.push({sessionId:w.sessionId,mtime:D?O.mtime:w.mtime,info:D?void 0:sz(w,J)})}if(V){let w=new Set(q.map((O)=>O.sessionId));for(let[O,D]of V)if(!w.has(O))B.push({sessionId:O,mtime:D.mtime})}else X$("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");B.sort((w,O)=>O.mtime-w.mtime);let z=V_(B,W,X),N=z.filter((w)=>w.info===void 0);if(N.length>0){let w=await B_($,N,Q.dir,J),O=new Map(w.map((D)=>[D.sessionId,D]));for(let D of z)if(D.info===void 0)D.info=O.get(D.sessionId)??null}return z.flatMap((w)=>w.info?[w.info]:[])}if(!$.listSessions)throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");let U=(await $.listSessions(Y)).slice().sort((q,V)=>V.mtime-q.mtime),H=V_(U,W,X);return B_($,H,Q.dir,J)}async function B_($,Q,J,Y){return(await Promise.allSettled(Q.map(async(W)=>{let G=await j_($,W.sessionId,J);if(!G)return null;let U=S8(W.sessionId,L_(G,W.mtime),Y);return U?{...U,lastModified:W.mtime}:null}))).flatMap((W,G)=>{let U=Q[G];if(W.status==="fulfilled")return W.value?[W.value]:[];return[{sessionId:U.sessionId,summary:"",lastModified:U.mtime}]})}function L_($,Q){let J=Buffer.from($,"utf-8"),Y=J.length,X=J.subarray(0,G4).toString("utf-8"),W=Y>G4?J.subarray(Y-G4).toString("utf-8"):X;return{mtime:Q,size:Y,head:X,tail:W}}function o6$($){let Q=$.trimEnd(),J=Q.slice(Q.lastIndexOf(`