@anthropic-ai/claude-agent-sdk 0.3.277 → 0.3.278

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/browser-sdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
2
 
3
- // Version: 0.3.277
3
+ // Version: 0.3.278
4
4
 
5
5
  // symbol-dispose-prelude: bun build --banner for every SDK bundle; the build
6
6
  // scripts grep for this line's tag. Runs before any module body. bun lowers
@@ -44,7 +44,7 @@ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_S
44
44
  || ${s} === "boolean" || ${n} === null`).assign(d,_t._`[${n}]`)}}}function gee({gen:e,parentData:t,parentDataProperty:r},i){e.if(_t._`${t} !== undefined`,()=>e.assign(_t._`${t}[${r}]`,i))}function iM(e,t,r,i=cu.Correct){let n=i===cu.Correct?_t.operators.EQ:_t.operators.NEQ,o;switch(e){case"null":return _t._`${t} ${n} null`;case"array":o=_t._`Array.isArray(${t})`;break;case"object":o=_t._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(_t._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return _t._`typeof ${t} ${n} ${e}`}return i===cu.Correct?o:_t.not(o);function s(d=_t.nil){return _t.and(_t._`typeof ${t} == "number"`,d,r?_t._`isFinite(${t})`:_t.nil)}}B8.checkDataType=iM;function oM(e,t,r,i){if(e.length===1)return iM(e[0],t,r,i);let n,o=U8.toHash(e);if(o.array&&o.object){let s=_t._`typeof ${t} != "object"`;n=o.null?s:_t._`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=_t.nil;if(o.number)delete o.integer;for(let s in o)n=_t.and(n,iM(s,t,r,i));return n}B8.checkDataTypes=oM;var yee={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?_t._`{type: ${e}}`:_t._`{type: ${t}}`};function sM(e){let t=vee(e);dee.reportError(t,yee)}B8.reportTypeError=sM;function vee(e){let{gen:t,data:r,schema:i}=e,n=U8.schemaRefOrVal(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var Z8=Je(function(K8){Object.defineProperty(K8,"__esModule",{value:!0});K8.assignDefaults=void 0;var du=wt(),Mee=It();function Eee(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)H8(e,n,r[n].default);else if(t==="array"&&Array.isArray(i))i.forEach((n,o)=>H8(e,o,n.default))}K8.assignDefaults=Eee;function H8(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let d=du._`${o}${du.getProperty(t)}`;if(n){Mee.checkStrictMode(e,`default is ignored for: ${d}`);return}let h=du._`${d} === undefined`;if(s.useDefaults==="empty")h=du._`${h} || ${d} === null || ${d} === ""`;i.if(h,du._`${d} = ${du.stringify(r)}`)}});var si=Je(function(J8){Object.defineProperty(J8,"__esModule",{value:!0});J8.validateUnion=J8.validateArray=J8.usePattern=J8.callValidateCode=J8.schemaProperties=J8.allSchemaProperties=J8.noPropertyInData=J8.propertyInData=J8.isOwnProperty=J8.hasPropFunc=J8.reportMissingProp=J8.checkMissingProp=J8.checkReportMissingProp=void 0;var Jt=wt(),aM=It(),ds=vo(),Tee=It();function Aee(e,t){let{gen:r,data:i,it:n}=e;r.if(uM(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Jt._`${t}`},!0),e.error()})}J8.checkReportMissingProp=Aee;function Ree({gen:e,data:t,it:{opts:r}},i,n){return Jt.or(...i.map((o)=>Jt.and(uM(e,t,o,r.ownProperties),Jt._`${n} = ${o}`)))}J8.checkMissingProp=Ree;function Pee(e,t){e.setParams({missingProperty:t},!0),e.error()}J8.reportMissingProp=Pee;function V8(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Jt._`Object.prototype.hasOwnProperty`})}J8.hasPropFunc=V8;function lM(e,t,r){return Jt._`${V8(e)}.call(${t}, ${r})`}J8.isOwnProperty=lM;function Iee(e,t,r,i){let n=Jt._`${t}${Jt.getProperty(r)} !== undefined`;return i?Jt._`${n} && ${lM(e,t,r)}`:n}J8.propertyInData=Iee;function uM(e,t,r,i){let n=Jt._`${t}${Jt.getProperty(r)} === undefined`;return i?Jt.or(n,Jt.not(lM(e,t,r))):n}J8.noPropertyInData=uM;function G8(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}J8.allSchemaProperties=G8;function Cee(e,t){return G8(t).filter((r)=>!aM.alwaysValidSchema(e,t[r]))}J8.schemaProperties=Cee;function $ee({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},d,h,m){let v=m?Jt._`${e}, ${t}, ${i}${n}`:t,g=[[ds.default.instancePath,Jt.strConcat(ds.default.instancePath,o)],[ds.default.parentData,s.parentData],[ds.default.parentDataProperty,s.parentDataProperty],[ds.default.rootData,ds.default.rootData]];if(s.opts.dynamicRef)g.push([ds.default.dynamicAnchors,ds.default.dynamicAnchors]);let S=Jt._`${v}, ${r.object(...g)}`;return h!==Jt.nil?Jt._`${d}.call(${h}, ${S})`:Jt._`${d}(${S})`}J8.callValidateCode=$ee;var Oee=Jt._`new RegExp`;function Dee({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:Jt._`${n.code==="new RegExp"?Oee:Tee.useFunc(e,n)}(${r}, ${i})`})}J8.usePattern=Dee;function Nee(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let d=t.let("valid",!0);return s(()=>t.assign(d,!1)),d}return t.var(o,!0),s(()=>t.break()),o;function s(d){let h=t.const("len",Jt._`${r}.length`);t.forRange("i",0,h,(m)=>{e.subschema({keyword:i,dataProp:m,dataPropType:aM.Type.Num},o),t.if(Jt.not(o),d)})}}J8.validateArray=Nee;function Lee(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((h)=>aM.alwaysValidSchema(n,h))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),d=t.name("_valid");t.block(()=>r.forEach((h,m)=>{let v=e.subschema({keyword:i,schemaProp:m,compositeRule:!0},d);if(t.assign(s,Jt._`${s} || ${d}`),!e.mergeValidEvaluated(v,d))t.if(Jt.not(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}J8.validateUnion=Lee});var rO=Je(function(eO){Object.defineProperty(eO,"__esModule",{value:!0});eO.validateKeywordUsage=eO.validSchemaType=eO.funcKeywordCode=eO.macroKeywordCode=void 0;var wn=wt(),ca=vo(),Jee=si(),Xee=Lf();function Yee(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,d=t.macro.call(s.self,n,o,s),h=Q8(r,i,d);if(s.opts.validateSchema!==!1)s.self.validateSchema(d,!0);let m=r.name("valid");e.subschema({schema:d,schemaPath:wn.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:h,compositeRule:!0},m),e.pass(m,()=>e.error(!0))}eO.macroKeywordCode=Yee;function Qee(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:d,it:h}=e;tte(h,t);let m=!d&&t.compile?t.compile.call(h.self,o,s,h):t.validate,v=Q8(i,n,m),g=i.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1){if(T(),t.modifying)Y8(e);E(()=>e.error())}else{let P=t.async?x():k();if(t.modifying)Y8(e);E(()=>ete(e,P))}}function x(){let P=i.let("ruleErrs",null);return i.try(()=>T(wn._`await `),(R)=>i.assign(g,!1).if(wn._`${R} instanceof ${h.ValidationError}`,()=>i.assign(P,wn._`${R}.errors`),()=>i.throw(R))),P}function k(){let P=wn._`${v}.errors`;return i.assign(P,null),T(wn.nil),P}function T(P=t.async?wn._`await `:wn.nil){let R=h.opts.passContext?ca.default.this:ca.default.self,I=!(("compile"in t)&&!d||t.schema===!1);i.assign(g,wn._`${P}${Jee.callValidateCode(e,v,R,I)}`,t.modifying)}function E(P){var R;i.if(wn.not((R=t.valid)!==null&&R!==void 0?R:g),P)}}eO.funcKeywordCode=Qee;function Y8(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,wn._`${i.parentData}[${i.parentDataProperty}]`))}function ete(e,t){let{gen:r}=e;r.if(wn._`Array.isArray(${t})`,()=>{r.assign(ca.default.vErrors,wn._`${ca.default.vErrors} === null ? ${t} : ${ca.default.vErrors}.concat(${t})`).assign(ca.default.errors,wn._`${ca.default.vErrors}.length`),Xee.extendErrors(e)},()=>e.error())}function tte({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Q8(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:wn.stringify(r)})}function rte(e,t,r=!1){return!t.length||t.some((i)=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}eO.validSchemaType=rte;function nte({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((d)=>!Object.prototype.hasOwnProperty.call(e,d)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){let h=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(h);else throw Error(h)}}}eO.validateKeywordUsage=nte});var sO=Je(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});iO.extendSubschemaMode=iO.extendSubschemaData=iO.getSubschema=void 0;var Ji=wt(),nO=It();function ate(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let d=e.schema[t];return r===void 0?{schema:d,schemaPath:Ji._`${e.schemaPath}${Ji.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:d[r],schemaPath:Ji._`${e.schemaPath}${Ji.getProperty(t)}${Ji.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${nO.escapeFragment(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}iO.getSubschema=ate;function lte(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:d}=t;if(r!==void 0){let{errorPath:m,dataPathArr:v,opts:g}=t,S=d.let("data",Ji._`${t.data}${Ji.getProperty(r)}`,!0);h(S),e.errorPath=Ji.str`${m}${nO.getErrorPath(r,i,g.jsPropertySyntax)}`,e.parentDataProperty=Ji._`${r}`,e.dataPathArr=[...v,e.parentDataProperty]}if(n!==void 0){let m=n instanceof Ji.Name?n:d.let("data",n,!0);if(h(m),s!==void 0)e.propertyName=s}if(o)e.dataTypes=o;function h(m){e.data=m,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,m]}}iO.extendSubschemaData=lte;function ute(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){if(i!==void 0)e.compositeRule=i;if(n!==void 0)e.createErrors=n;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=r}iO.extendSubschemaMode=ute});var cM=Je(function(c4e,aO){aO.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var uO=Je(function(d4e,lO){var fs=lO.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Dy(t,i,n,e,"",e)};fs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};fs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};fs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};fs.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 Dy(e,t,r,i,n,o,s,d,h,m){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,d,h,m);for(var v in i){var g=i[v];if(Array.isArray(g)){if(v in fs.arrayKeywords)for(var S=0;S<g.length;S++)Dy(e,t,r,g[S],n+"/"+v+"/"+S,o,n,v,i,S)}else if(v in fs.propsKeywords){if(g&&typeof g=="object")for(var x in g)Dy(e,t,r,g[x],n+"/"+v+"/"+fte(x),o,n,v,i,x)}else if(v in fs.keywords||e.allKeys&&!(v in fs.skipKeywords))Dy(e,t,r,g,n+"/"+v,o,n,v,i)}r(i,n,o,s,d,h,m)}}function fte(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Uf=Je(function(hO){Object.defineProperty(hO,"__esModule",{value:!0});hO.getSchemaRefs=hO.resolveUrl=hO.normalizeId=hO._getFullPath=hO.getFullPath=hO.inlineRef=void 0;var hte=It(),pte=cM(),mte=uO(),gte=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function yte(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!dM(e);if(!t)return!1;return cO(e)<=t}hO.inlineRef=yte;var vte=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function dM(e){for(let t in e){if(vte.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(dM))return!0;if(typeof r=="object"&&dM(r))return!0}return!1}function cO(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,gte.has(r))continue;if(typeof e[r]=="object")hte.eachItem(e[r],(i)=>t+=cO(i));if(t===1/0)return 1/0}return t}function dO(e,t="",r){if(r!==!1)t=fu(t);let i=e.parse(t);return fO(e,i)}hO.getFullPath=dO;function fO(e,t){return e.serialize(t).split("#")[0]+"#"}hO._getFullPath=fO;var bte=/#\/?$/;function fu(e){return e?e.replace(bte,""):""}hO.normalizeId=fu;function _te(e,t,r){return r=fu(r),e.resolve(t,r)}hO.resolveUrl=_te;var Ste=/^[a-z_][-a-z0-9._]*$/i;function wte(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=fu(e[r]||t),o={"":n},s=dO(i,n,!1),d={},h=new Set;return mte(e,{allKeys:!0},(g,S,x,k)=>{if(k===void 0)return;let T=s+S,E=o[k];if(typeof g[r]=="string")E=P.call(this,g[r]);R.call(this,g.$anchor),R.call(this,g.$dynamicAnchor),o[S]=E;function P(I){let O=this.opts.uriResolver.resolve;if(I=fu(E?O(E,I):I),h.has(I))throw v(I);h.add(I);let D=this.refs[I];if(typeof D=="string")D=this.refs[D];if(typeof D=="object")m(g,D.schema,I);else if(I!==fu(T))if(I[0]==="#")m(g,d[I],I),d[I]=g;else this.refs[I]=T;return I}function R(I){if(typeof I=="string"){if(!Ste.test(I))throw Error(`invalid anchor "${I}"`);P.call(this,`#${I}`)}}}),d;function m(g,S,x){if(S!==void 0&&!pte(g,S))throw v(x)}function v(g){return Error(`reference "${g}" resolves to more than one schema`)}}hO.getSchemaRefs=wte});var Bf=Je(function(RO){Object.defineProperty(RO,"__esModule",{value:!0});RO.getData=RO.KeywordCxt=RO.validateFunctionCode=void 0;var vO=C8(),bO=zf(),fM=nM(),Ny=zf(),Ate=Z8(),Ff=rO(),hM=sO(),st=wt(),ht=vo(),Rte=Uf(),bo=It(),jf=Lf();function Pte(e){if(wO(e)){if(xO(e),SO(e)){$te(e);return}}_O(e,()=>vO.topBoolOrEmptySchema(e))}RO.validateFunctionCode=Pte;function _O({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){if(n.code.es5)e.func(t,st._`${ht.default.data}, ${ht.default.valCxt}`,i.$async,()=>{e.code(st._`"use strict"; ${mO(r,n)}`),Cte(e,n),e.code(o)});else e.func(t,st._`${ht.default.data}, ${Ite(n)}`,i.$async,()=>e.code(mO(r,n)).code(o))}function Ite(e){return st._`{${ht.default.instancePath}="", ${ht.default.parentData}, ${ht.default.parentDataProperty}, ${ht.default.rootData}=${ht.default.data}${e.dynamicRef?st._`, ${ht.default.dynamicAnchors}={}`:st.nil}}={}`}function Cte(e,t){e.if(ht.default.valCxt,()=>{if(e.var(ht.default.instancePath,st._`${ht.default.valCxt}.${ht.default.instancePath}`),e.var(ht.default.parentData,st._`${ht.default.valCxt}.${ht.default.parentData}`),e.var(ht.default.parentDataProperty,st._`${ht.default.valCxt}.${ht.default.parentDataProperty}`),e.var(ht.default.rootData,st._`${ht.default.valCxt}.${ht.default.rootData}`),t.dynamicRef)e.var(ht.default.dynamicAnchors,st._`${ht.default.valCxt}.${ht.default.dynamicAnchors}`)},()=>{if(e.var(ht.default.instancePath,st._`""`),e.var(ht.default.parentData,st._`undefined`),e.var(ht.default.parentDataProperty,st._`undefined`),e.var(ht.default.rootData,ht.default.data),t.dynamicRef)e.var(ht.default.dynamicAnchors,st._`{}`)})}function $te(e){let{schema:t,opts:r,gen:i}=e;_O(e,()=>{if(r.$comment&&t.$comment)MO(e);if(zte(e),i.let(ht.default.vErrors,null),i.let(ht.default.errors,0),r.unevaluated)Ote(e);kO(e),jte(e)});return}function Ote(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",st._`${r}.evaluated`),t.if(st._`${e.evaluated}.dynamicProps`,()=>t.assign(st._`${e.evaluated}.props`,st._`undefined`)),t.if(st._`${e.evaluated}.dynamicItems`,()=>t.assign(st._`${e.evaluated}.items`,st._`undefined`))}function mO(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?st._`/*# sourceURL=${r} */`:st.nil}function Dte(e,t){if(wO(e)){if(xO(e),SO(e)){Nte(e,t);return}}vO.boolOrEmptySchema(e,t)}function SO({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function wO(e){return typeof e.schema!="boolean"}function Nte(e,t){let{schema:r,gen:i,opts:n}=e;if(n.$comment&&r.$comment)MO(e);Ute(e),Fte(e);let o=i.const("_errs",ht.default.errors);kO(e,o),i.var(t,st._`${o} === ${ht.default.errors}`)}function xO(e){bo.checkUnknownRules(e),Lte(e)}function kO(e,t){if(e.opts.jtd)return gO(e,[],!1,t);let r=bO.getSchemaTypes(e.schema),i=bO.coerceAndCheckDataType(e,r);gO(e,r,!i,t)}function Lte(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;if(t.$ref&&i.ignoreKeywordsWithRef&&bo.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function zte(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)bo.checkStrictMode(e,"default is ignored in the schema root")}function Ute(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Rte.resolveUrl(e.opts.uriResolver,e.baseId,t)}function Fte(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function MO({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code(st._`${ht.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=st.str`${i}/$comment`,d=e.scopeValue("root",{ref:t.root});e.code(st._`${ht.default.self}.opts.$comment(${o}, ${s}, ${d}.schema)`)}}function jte(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;if(r.$async)t.if(st._`${ht.default.errors} === 0`,()=>t.return(ht.default.data),()=>t.throw(st._`new ${n}(${ht.default.vErrors})`));else{if(t.assign(st._`${i}.errors`,ht.default.vErrors),o.unevaluated)Bte(e);t.return(st._`${ht.default.errors} === 0`)}}function Bte({gen:e,evaluated:t,props:r,items:i}){if(r instanceof st.Name)e.assign(st._`${t}.props`,r);if(i instanceof st.Name)e.assign(st._`${t}.items`,i)}function gO(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:d,opts:h,self:m}=e,{RULES:v}=m;if(o.$ref&&(h.ignoreKeywordsWithRef||!bo.schemaHasRulesButRef(o,v))){n.block(()=>TO(e,"$ref",v.all.$ref.definition));return}if(!h.jtd)qte(e,t);n.block(()=>{for(let S of v.rules)g(S);g(v.post)});function g(S){if(!fM.shouldUseGroup(o,S))return;if(S.type){if(n.if(Ny.checkDataType(S.type,s,h.strictNumbers)),yO(e,S),t.length===1&&t[0]===S.type&&r)n.else(),Ny.reportTypeError(e);n.endIf()}else yO(e,S);if(!d)n.if(st._`${ht.default.errors} === ${i||0}`)}}function yO(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;if(n)Ate.assignDefaults(e,t.type);r.block(()=>{for(let o of t.rules)if(fM.shouldUseRule(i,o))TO(e,o.keyword,o.definition,t.type)})}function qte(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(Hte(e,t),!e.opts.allowUnionTypes)Kte(e,t);Wte(e,e.dataTypes)}function Hte(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!EO(e.dataTypes,r))pM(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Vte(e,t)}function Kte(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))pM(e,"use allowUnionTypes to allow union type keyword")}function Wte(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&fM.shouldUseRule(e.schema,n)){let{type:o}=n.definition;if(o.length&&!o.some((s)=>Zte(t,s)))pM(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function Zte(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function EO(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Vte(e,t){let r=[];for(let i of e.dataTypes)if(EO(t,i))r.push(i);else if(t.includes("integer")&&i==="number")r.push("integer");e.dataTypes=r}function pM(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,bo.checkStrictMode(e,t,e.opts.strictTypes)}class mM{constructor(e,t,r){if(Ff.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=bo.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",AO(this.$data,e));else if(this.schemaCode=this.schemaValue,!Ff.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ht.default.errors)}result(e,t,r){this.failResult(st.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(st.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(st._`${t} !== undefined && (${st.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?jf.reportExtraError:jf.reportError)(this,this.def.error,t)}$dataError(){jf.reportError(this,this.def.$dataError||jf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');jf.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=st.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=st.nil,t=st.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:n,def:o}=this;if(r.if(st.or(st._`${i} === undefined`,t)),e!==st.nil)r.assign(e,!0);if(n.length||o.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==st.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:i,it:n}=this;return st.or(o(),s());function o(){if(r.length){if(!(t instanceof st.Name))throw Error("ajv implementation error");let d=Array.isArray(r)?r:[r];return st._`${Ny.checkDataTypes(d,t,n.opts.strictNumbers,Ny.DataType.Wrong)}`}return st.nil}function s(){if(i.validateSchema){let d=e.scopeValue("validate$data",{ref:i.validateSchema});return st._`!${d}(${t})`}return st.nil}}subschema(e,t){let r=hM.getSubschema(this.it,e);hM.extendSubschemaData(r,this.it,e),hM.extendSubschemaMode(r,e);let i={...this.it,...r,items:void 0,props:void 0};return Dte(i,t),i}mergeEvaluated(e,t){let{it:r,gen:i}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=bo.mergeEvaluated.props(i,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=bo.mergeEvaluated.items(i,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(t,()=>this.mergeEvaluated(e,st.Name)),!0}}RO.KeywordCxt=mM;function TO(e,t,r,i){let n=new mM(e,r,t);if("code"in r)r.code(n,i);else if(n.$data&&r.validate)Ff.funcKeywordCode(n,r);else if("macro"in r)Ff.macroKeywordCode(n,r);else if(r.compile||r.validate)Ff.funcKeywordCode(n,r)}var Gte=/^\/(?:[^~]|~0|~1)*$/,Jte=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function AO(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return ht.default.rootData;if(e[0]==="/"){if(!Gte.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,o=ht.default.rootData}else{let m=Jte.exec(e);if(!m)throw Error(`Invalid JSON-pointer: ${e}`);let v=+m[1];if(n=m[2],n==="#"){if(v>=t)throw Error(h("property/index",v));return i[t-v]}if(v>t)throw Error(h("data",v));if(o=r[t-v],!n)return o}let s=o,d=n.split("/");for(let m of d)if(m)o=st._`${o}${st.getProperty(bo.unescapeJsonPointer(m))}`,s=st._`${s} && ${o}`;return s;function h(m,v){return`Cannot access ${m} ${v} levels up, current level is ${t}`}}RO.getData=AO});var Ly=Je(function(CO){Object.defineProperty(CO,"__esModule",{value:!0});class IO extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}CO.default=IO});var qf=Je(function(OO){Object.defineProperty(OO,"__esModule",{value:!0});var gM=Uf();class $O extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`);this.missingRef=gM.resolveUrl(e,t,r),this.missingSchema=gM.normalizeId(gM.getFullPath(e,this.missingRef))}}OO.default=$O});var Uy=Je(function(LO){Object.defineProperty(LO,"__esModule",{value:!0});LO.resolveSchema=LO.getCompilingSchema=LO.resolveRef=LO.compileSchema=LO.SchemaEnv=void 0;var Mi=wt(),tre=Ly(),da=vo(),Ei=Uf(),DO=It(),rre=Bf();class Hf{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:Ei.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}LO.SchemaEnv=Hf;function vM(e){let t=NO.call(this,e);if(t)return t;let r=Ei.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Mi.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),d;if(e.$async)d=s.scopeValue("Error",{ref:tre.default,code:Mi._`require("ajv/dist/runtime/validation_error").default`});let h=s.scopeName("validate");e.validateName=h;let m={gen:s,allErrors:this.opts.allErrors,data:da.default.data,parentData:da.default.parentData,parentDataProperty:da.default.parentDataProperty,dataNames:[da.default.data],dataPathArr:[Mi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:Mi.stringify(e.schema)}:{ref:e.schema}),validateName:h,ValidationError:d,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Mi.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Mi._`""`,opts:this.opts,self:this},v;try{this._compilations.add(e),rre.validateFunctionCode(m),s.optimize(this.opts.code.optimize);let g=s.toString();if(v=`${s.scopeRefs(da.default.scope)}return ${g}`,this.opts.code.process)v=this.opts.code.process(v,e);let x=Function(`${da.default.self}`,`${da.default.scope}`,v)(this,this.scope.get());if(this.scope.value(h,{ref:x}),x.errors=null,x.schema=e.schema,x.schemaEnv=e,e.$async)x.$async=!0;if(this.opts.code.source===!0)x.source={validateName:h,validateCode:g,scopeValues:s._values};if(this.opts.unevaluated){let{props:k,items:T}=m;if(x.evaluated={props:k instanceof Mi.Name?void 0:k,items:T instanceof Mi.Name?void 0:T,dynamicProps:k instanceof Mi.Name,dynamicItems:T instanceof Mi.Name},x.source)x.source.evaluated=Mi.stringify(x.evaluated)}return e.validate=x,e}catch(g){if(delete e.validate,delete e.validateName,v)this.logger.error("Error compiling schema, function code:",v);throw g}finally{this._compilations.delete(e)}}LO.compileSchema=vM;function nre(e,t,r){var i;r=Ei.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=sre.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:d}=this.opts;if(s)o=new Hf({schema:s,schemaId:d,root:e,baseId:t})}if(o===void 0)return;return e.refs[r]=ire.call(this,o)}LO.resolveRef=nre;function ire(e){if(Ei.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:vM.call(this,e)}function NO(e){for(let t of this._compilations)if(ore(t,e))return t}LO.getCompilingSchema=NO;function ore(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function sre(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||zy.call(this,e,t)}function zy(e,t){let r=this.opts.uriResolver.parse(t),i=Ei._getFullPath(this.opts.uriResolver,r),n=Ei.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return yM.call(this,r,e);let o=Ei.normalizeId(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let d=zy.call(this,e,s);if(typeof(d===null||d===void 0?void 0:d.schema)!=="object")return;return yM.call(this,r,d)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)vM.call(this,s);if(o===Ei.normalizeId(t)){let{schema:d}=s,{schemaId:h}=this.opts,m=d[h];if(m)n=Ei.resolveUrl(this.opts.uriResolver,n,m);return new Hf({schema:d,schemaId:h,root:e,baseId:n})}return yM.call(this,r,s)}LO.resolveSchema=zy;var are=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function yM(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let d of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let h=r[DO.unescapeFragment(d)];if(h===void 0)return;r=h;let m=typeof r==="object"&&r[this.opts.schemaId];if(!are.has(d)&&m)t=Ei.resolveUrl(this.opts.uriResolver,t,m)}let o;if(typeof r!="boolean"&&r.$ref&&!DO.schemaHasRulesButRef(r,this.RULES)){let d=Ei.resolveUrl(this.opts.uriResolver,t,r.$ref);o=zy.call(this,i,d)}let{schemaId:s}=this.opts;if(o=o||new Hf({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o;return}});var UO=Je(function(y4e,fre){fre.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 SM=Je(function(v4e,KO){var hre=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),jO=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),bM=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),BO=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),pre=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function _M(e){let t="",r=0,i=0;for(i=0;i<e.length;i++){if(r=e[i].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var mre=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function FO(e){return e.length=0,!0}function gre(e,t,r){if(e.length){let i=_M(e);if(i!=="")t.push(i);else return r.error=!0,!1;e.length=0}return!0}function yre(e){let t=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,d=gre;for(let h=0;h<e.length;h++){let m=e[h];if(m==="["||m==="]")continue;if(m===":"){if(o===!0)s=!0;if(!d(n,i,r))break;if(++t>7){r.error=!0;break}if(h>0&&e[h-1]===":")o=!0;i.push(":");continue}else if(m==="%"){if(!d(n,i,r))break;d=FO}else{n.push(m);continue}}if(n.length)if(d===FO)r.zone=n.join("");else if(s)i.push(n.join(""));else i.push(_M(n));return r.address=i.join(""),r}function qO(e){if(vre(e,":")<2)return{host:e,isIPV6:!1};let t=yre(e);if(!t.error){let{address:r,address:i}=t;if(t.zone)r+="%"+t.zone,i+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:i}}else return{host:e,isIPV6:!1}}function vre(e,t){let r=0;for(let i=0;i<e.length;i++)if(e[i]===t)r++;return r}function bre(e){let t=e,r=[],i=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var _re={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Sre=/[@/?#:]/g,wre=/[@/?#]/g;function HO(e,t){let r=t?wre:Sre;return r.lastIndex=0,e.replace(r,(i)=>_re[i])}function xre(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(bM(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(t&&BO(s))r+=s;else r+="%"+o;i+=2;continue}}r+=e[i]}return r}function kre(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(bM(i)){let n=i.toUpperCase(),o=String.fromCharCode(parseInt(n,16));if(o!=="."&&BO(o))t+=o;else t+="%"+n;r+=2;continue}}if(pre(e[r]))t+=e[r];else t+=escape(e[r])}return t}function Mre(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(bM(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Ere(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!jO(r)){let i=qO(r);if(i.isIPV6===!0)r=`[${i.escapedHost}]`;else r=HO(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}KO.exports={nonSimpleDomain:mre,recomposeAuthority:Ere,reescapeHostDelimiters:HO,normalizePercentEncoding:xre,normalizePathEncoding:kre,escapePreservingEscapes:Mre,removeDotSegments:bre,isIPv4:jO,isUUID:hre,normalizeIPv6:qO,stringArrayToHexStripped:_M}});var JO=Je(function(b4e,GO){var{isUUID:Tre}=SM(),Are=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Rre=["http","https","ws","wss","urn","urn:uuid"];function Pre(e){return Rre.indexOf(e)!==-1}function wM(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function WO(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function ZO(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function Ire(e){return e.secure=wM(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Cre(e){if(e.port===(wM(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function $re(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Are);if(r){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=xM(n);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function Ore(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=xM(n);if(o)e=o.serialize(e,t);let s=e,d=e.nss;return s.path=`${i||t.nid}:${d}`,t.skipEscape=!0,s}function Dre(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Tre(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Nre(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var VO={scheme:"http",domainHost:!0,parse:WO,serialize:ZO},Lre={scheme:"https",domainHost:VO.domainHost,parse:WO,serialize:ZO},Fy={scheme:"ws",domainHost:!0,parse:Ire,serialize:Cre},zre={scheme:"wss",domainHost:Fy.domainHost,parse:Fy.parse,serialize:Fy.serialize},Ure={scheme:"urn",parse:$re,serialize:Ore,skipNormalize:!0},Fre={scheme:"urn:uuid",parse:Dre,serialize:Nre,skipNormalize:!0},jy={http:VO,https:Lre,ws:Fy,wss:zre,urn:Ure,"urn:uuid":Fre};Object.setPrototypeOf(jy,null);function xM(e){return e&&(jy[e]||jy[e.toLowerCase()])||void 0}GO.exports={wsIsSecure:wM,SCHEMES:jy,isValidSchemeName:Pre,getSchemeHandler:xM}});var rD=Je(function(_4e,By){var{normalizeIPv6:jre,removeDotSegments:Kf,recomposeAuthority:Bre,normalizePercentEncoding:qre,normalizePathEncoding:Hre,escapePreservingEscapes:Kre,reescapeHostDelimiters:Wre,isIPv4:Zre,nonSimpleDomain:Vre}=SM(),{SCHEMES:Gre,getSchemeHandler:YO}=JO();function Jre(e,t){if(typeof e==="string")e=tne(e,t);else if(typeof e==="object")e=hu(fa(e,t),t);return e}function Xre(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=QO(hu(e,i),hu(t,i),i,!0);return i.skipEscape=!0,fa(n,i)}function QO(e,t,r,i){let n={};if(!i)e=hu(fa(e,r),r),t=hu(fa(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Kf(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Kf(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=Kf(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=Kf(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function Yre(e,t,r){let i=XO(e,r),n=XO(t,r);return i!==void 0&&n!==void 0&&i.toLowerCase()===n.toLowerCase()}function fa(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),n=[],o=YO(i.scheme||r.scheme);if(o&&o.serialize)o.serialize(r,i);if(r.path!==void 0)if(!i.skipEscape){if(r.path=Kre(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=qre(r.path);if(i.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=Bre(r);if(s!==void 0){if(i.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let d=r.path;if(!i.absolutePath&&(!o||!o.absolutePath))d=Kf(d);if(s===void 0&&d[0]==="/"&&d[1]==="/")d="/%2F"+d.slice(2);n.push(d)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var Qre=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ene(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function eD(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(Qre);if(s){if(i.scheme=s[1],i.userinfo=s[3],i.host=s[4],i.port=parseInt(s[5],10),i.path=s[6]||"",i.query=s[7],i.fragment=s[8],isNaN(i.port))i.port=s[5];let d=ene(i,s);if(d!==void 0)i.error=i.error||d,n=!0;if(i.host)if(Zre(i.host)===!1){let v=jre(i.host);i.host=v.host.toLowerCase(),o=v.isIPV6}else o=!0;if(i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path)i.reference="same-document";else if(i.scheme===void 0)i.reference="relative";else if(i.fragment===void 0)i.reference="absolute";else i.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==i.reference)i.error=i.error||"URI is not a "+r.reference+" reference.";let h=YO(r.scheme||i.scheme);if(!r.unicodeSupport&&(!h||!h.unicodeSupport)){if(i.host&&(r.domainHost||h&&h.domainHost)&&o===!1&&Vre(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(m){i.error=i.error||"Host's domain name can not be converted to ASCII: "+m}}if(!h||h&&!h.skipNormalize){if(e.indexOf("%")!==-1){if(i.scheme!==void 0)i.scheme=unescape(i.scheme);if(i.host!==void 0)i.host=Wre(unescape(i.host),o)}if(i.path)i.path=Hre(i.path);if(i.fragment)try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}}if(h&&h.parse)h.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function hu(e,t){return eD(e,t).parsed}function tne(e,t){return tD(e,t).normalized}function tD(e,t){let{parsed:r,malformedAuthorityOrPort:i}=eD(e,t);return{normalized:i?e:fa(r,t),malformedAuthorityOrPort:i}}function XO(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:i}=tD(e,t);return i?void 0:r}if(typeof e==="object")return fa(e,t)}var kM={SCHEMES:Gre,normalize:Jre,resolve:Xre,resolveComponent:QO,equal:Yre,serialize:fa,parse:hu};By.exports=kM;By.exports.default=kM;By.exports.fastUri=kM});var oD=Je(function(iD){Object.defineProperty(iD,"__esModule",{value:!0});var nD=rD();nD.code='require("ajv/dist/runtime/uri").default';iD.default=nD});var hD=Je(function(_o){Object.defineProperty(_o,"__esModule",{value:!0});_o.CodeGen=_o.Name=_o.nil=_o.stringify=_o.str=_o._=_o.KeywordCxt=void 0;var nne=Bf();Object.defineProperty(_o,"KeywordCxt",{enumerable:!0,get:function(){return nne.KeywordCxt}});var pu=wt();Object.defineProperty(_o,"_",{enumerable:!0,get:function(){return pu._}});Object.defineProperty(_o,"str",{enumerable:!0,get:function(){return pu.str}});Object.defineProperty(_o,"stringify",{enumerable:!0,get:function(){return pu.stringify}});Object.defineProperty(_o,"nil",{enumerable:!0,get:function(){return pu.nil}});Object.defineProperty(_o,"Name",{enumerable:!0,get:function(){return pu.Name}});Object.defineProperty(_o,"CodeGen",{enumerable:!0,get:function(){return pu.CodeGen}});var ine=Ly(),cD=qf(),one=rM(),Zf=Uy(),sne=wt(),Wf=Uf(),qy=zf(),EM=It(),sD=UO(),ane=oD(),dD=(e,t)=>new RegExp(e,t);dD.code="new RegExp";var lne=["removeAdditional","useDefaults","coerceTypes"],une=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),cne={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."},dne={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},aD=200;function fne(e){var t,r,i,n,o,s,d,h,m,v,g,S,x,k,T,E,P,R,I,O,D,H,G,oe,ee;let F=e.strict,J=(t=e.code)===null||t===void 0?void 0:t.optimize,a=J===!0||J===void 0?1:J||0,c=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:dD,p=(n=e.uriResolver)!==null&&n!==void 0?n:ane.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:F)!==null&&s!==void 0?s:!0,strictNumbers:(h=(d=e.strictNumbers)!==null&&d!==void 0?d:F)!==null&&h!==void 0?h:!0,strictTypes:(v=(m=e.strictTypes)!==null&&m!==void 0?m:F)!==null&&v!==void 0?v:"log",strictTuples:(S=(g=e.strictTuples)!==null&&g!==void 0?g:F)!==null&&S!==void 0?S:"log",strictRequired:(k=(x=e.strictRequired)!==null&&x!==void 0?x:F)!==null&&k!==void 0?k:!1,code:e.code?{...e.code,optimize:a,regExp:c}:{optimize:a,regExp:c},loopRequired:(T=e.loopRequired)!==null&&T!==void 0?T:aD,loopEnum:(E=e.loopEnum)!==null&&E!==void 0?E:aD,meta:(P=e.meta)!==null&&P!==void 0?P:!0,messages:(R=e.messages)!==null&&R!==void 0?R:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(O=e.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(D=e.addUsedSchema)!==null&&D!==void 0?D:!0,validateSchema:(H=e.validateSchema)!==null&&H!==void 0?H:!0,validateFormats:(G=e.validateFormats)!==null&&G!==void 0?G:!0,unicodeRegExp:(oe=e.unicodeRegExp)!==null&&oe!==void 0?oe:!0,int32range:(ee=e.int32range)!==null&&ee!==void 0?ee:!0,uriResolver:p}}class Hy{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...fne(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new sne.ValueScope({scope:{},prefixes:une,es5:t,lines:r}),this.logger=vne(e.logger);let i=e.validateFormats;if(e.validateFormats=!1,this.RULES=one.getRules(),lD.call(this,cne,e,"NOT SUPPORTED"),lD.call(this,dne,e,"DEPRECATED","warn"),this._metaOpts=gne.call(this),e.formats)pne.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)mne.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);hne.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,i=sD;if(r==="id")i={...sD},i.id=i.$id,delete i.$id;if(t&&e)this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(t);if(!("$async"in r))this.errors=r.errors;return i}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,t);async function i(m,v){await n.call(this,m.$schema);let g=this._addSchema(m,v);return g.validate||o.call(this,g)}async function n(m){if(m&&!this.getSchema(m))await i.call(this,{$ref:m},!0)}async function o(m){try{return this._compileSchemaEnv(m)}catch(v){if(!(v instanceof cD.default))throw v;return s.call(this,v),await d.call(this,v.missingSchema),o.call(this,m)}}function s({missingSchema:m,missingRef:v}){if(this.refs[m])throw Error(`AnySchema ${m} is loaded but ${v} cannot be resolved`)}async function d(m){let v=await h.call(this,m);if(!this.refs[m])await n.call(this,v.$schema);if(!this.refs[m])this.addSchema(v,m,t)}async function h(m){let v=this._loading[m];if(v)return v;try{return await(this._loading[m]=r(m))}finally{delete this._loading[m]}}}addSchema(e,t,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,i);return this}let n;if(typeof e==="object"){let{schemaId:o}=this.opts;if(n=e[o],n!==void 0&&typeof n!="string")throw Error(`schema ${o} must be string`)}return t=Wf.normalizeId(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,i,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return i}getSchema(e){let t;while(typeof(t=uD.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,i=new Zf.SchemaEnv({schema:{},schemaId:r});if(t=Zf.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=uD.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Wf.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(_ne.call(this,r,t),!t)return EM.eachItem(r,(n)=>MM.call(this,n)),this;wne.call(this,t);let i={...t,type:qy.getJSONTypes(t.type),schemaType:qy.getJSONTypes(t.schemaType)};return EM.eachItem(r,i.type.length===0?(n)=>MM.call(this,n,i):(n)=>i.type.forEach((o)=>MM.call(this,n,i,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let i=r.rules.findIndex((n)=>n.keyword===e);if(i>=0)r.rules.splice(i,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((i)=>`${r}${i.instancePath} ${i.message}`).reduce((i,n)=>i+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of t){let n=i.split("/").slice(1),o=e;for(let s of n)o=o[s];for(let s in r){let d=r[s];if(typeof d!="object")continue;let{$data:h}=d.definition,m=o[s];if(h&&m)o[s]=fD(m)}}return e}_removeAllSchemas(e,t){for(let r in e){let i=e[r];if(!t||t.test(r)){if(typeof i=="string")delete e[r];else if(i&&!i.meta)this._cache.delete(i.schema),delete e[r]}}}_addSchema(e,t,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let d=this._cache.get(e);if(d!==void 0)return d;r=Wf.normalizeId(o||r);let h=Wf.getSchemaRefs.call(this,e,r);if(d=new Zf.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:h}),this._cache.set(d.schema,d),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=d}if(i)this.validateSchema(e,!0);return d}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Zf.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Zf.compileSchema.call(this,e)}finally{this.opts=t}}}Hy.ValidationError=ine.default;Hy.MissingRefError=cD.default;_o.default=Hy;function lD(e,t,r,i="error"){for(let n in e){let o=n;if(o in t)this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function uD(e){return e=Wf.normalizeId(e),this.schemas[e]||this.refs[e]}function hne(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function pne(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function mne(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function gne(){let e={...this.opts};for(let t of lne)delete e[t];return e}var yne={log(){},warn(){},error(){}};function vne(e){if(e===!1)return yne;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var bne=/^[a-z_$][a-z0-9_$:-]*$/i;function _ne(e,t){let{RULES:r}=this;if(EM.eachItem(e,(i)=>{if(r.keywords[i])throw Error(`Keyword ${i} is already defined`);if(!bne.test(i))throw Error(`Keyword ${i} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function MM(e,t,r){var i;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:h})=>h===r);if(!s)s={type:r,rules:[]},o.rules.push(s);if(o.keywords[e]=!0,!t)return;let d={keyword:e,definition:{...t,type:qy.getJSONTypes(t.type),schemaType:qy.getJSONTypes(t.schemaType)}};if(t.before)Sne.call(this,s,d,t.before);else s.rules.push(d);o.all[e]=d,(i=t.implements)===null||i===void 0||i.forEach((h)=>this.addKeyword(h))}function Sne(e,t,r){let i=e.rules.findIndex((n)=>n.keyword===r);if(i>=0)e.rules.splice(i,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function wne(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=fD(t);e.validateSchema=this.compile(t,!0)}var xne={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fD(e){return{anyOf:[e,xne]}}});var mD=Je(function(pD){Object.defineProperty(pD,"__esModule",{value:!0});var Ene={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pD.default=Ene});var SD=Je(function(bD){Object.defineProperty(bD,"__esModule",{value:!0});bD.callRef=bD.getValidate=void 0;var Ane=qf(),gD=si(),Dn=wt(),mu=vo(),yD=Uy(),Ky=It(),Rne={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:d,self:h}=i,{root:m}=o;if((r==="#"||r==="#/")&&n===m.baseId)return g();let v=yD.resolveRef.call(h,m,n,r);if(v===void 0)throw new Ane.default(i.opts.uriResolver,n,r);if(v instanceof yD.SchemaEnv)return S(v);return x(v);function g(){if(o===m)return Wy(e,s,o,o.$async);let k=t.scopeValue("root",{ref:m});return Wy(e,Dn._`${k}.validate`,m,m.$async)}function S(k){let T=vD(e,k);Wy(e,T,k,k.$async)}function x(k){let T=t.scopeValue("schema",d.code.source===!0?{ref:k,code:Dn.stringify(k)}:{ref:k}),E=t.name("valid"),P=e.subschema({schema:k,dataTypes:[],schemaPath:Dn.nil,topSchemaRef:T,errSchemaPath:r},E);e.mergeEvaluated(P),e.ok(E)}}};function vD(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Dn._`${r.scopeValue("wrapper",{ref:t})}.validate`}bD.getValidate=vD;function Wy(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:d,opts:h}=o,m=h.passContext?mu.default.this:Dn.nil;if(i)v();else g();function v(){if(!d.$async)throw Error("async schema referenced by sync schema");let k=n.let("valid");n.try(()=>{if(n.code(Dn._`await ${gD.callValidateCode(e,t,m)}`),x(t),!s)n.assign(k,!0)},(T)=>{if(n.if(Dn._`!(${T} instanceof ${o.ValidationError})`,()=>n.throw(T)),S(T),!s)n.assign(k,!1)}),e.ok(k)}function g(){e.result(gD.callValidateCode(e,t,m),()=>x(t),()=>S(t))}function S(k){let T=Dn._`${k}.errors`;n.assign(mu.default.vErrors,Dn._`${mu.default.vErrors} === null ? ${T} : ${mu.default.vErrors}.concat(${T})`),n.assign(mu.default.errors,Dn._`${mu.default.vErrors}.length`)}function x(k){var T;if(!o.opts.unevaluated)return;let E=(T=r===null||r===void 0?void 0:r.validate)===null||T===void 0?void 0:T.evaluated;if(o.props!==!0)if(E&&!E.dynamicProps){if(E.props!==void 0)o.props=Ky.mergeEvaluated.props(n,E.props,o.props)}else{let P=n.var("props",Dn._`${k}.evaluated.props`);o.props=Ky.mergeEvaluated.props(n,P,o.props,Dn.Name)}if(o.items!==!0)if(E&&!E.dynamicItems){if(E.items!==void 0)o.items=Ky.mergeEvaluated.items(n,E.items,o.items)}else{let P=n.var("items",Dn._`${k}.evaluated.items`);o.items=Ky.mergeEvaluated.items(n,P,o.items,Dn.Name)}}}bD.callRef=Wy;bD.default=Rne});var xD=Je(function(wD){Object.defineProperty(wD,"__esModule",{value:!0});var Cne=mD(),$ne=SD(),One=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Cne.default,$ne.default];wD.default=One});var MD=Je(function(kD){Object.defineProperty(kD,"__esModule",{value:!0});var Vy=wt(),hs=Vy.operators,Zy={maximum:{okStr:"<=",ok:hs.LTE,fail:hs.GT},minimum:{okStr:">=",ok:hs.GTE,fail:hs.LT},exclusiveMaximum:{okStr:"<",ok:hs.LT,fail:hs.GTE},exclusiveMinimum:{okStr:">",ok:hs.GT,fail:hs.LTE}},Nne={message:({keyword:e,schemaCode:t})=>Vy.str`must be ${Zy[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Vy._`{comparison: ${Zy[e].okStr}, limit: ${t}}`},Lne={keyword:Object.keys(Zy),type:"number",schemaType:"number",$data:!0,error:Nne,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data(Vy._`${r} ${Zy[t].fail} ${i} || isNaN(${r})`)}};kD.default=Lne});var TD=Je(function(ED){Object.defineProperty(ED,"__esModule",{value:!0});var Vf=wt(),Une={message:({schemaCode:e})=>Vf.str`must be multiple of ${e}`,params:({schemaCode:e})=>Vf._`{multipleOf: ${e}}`},Fne={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Une,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),d=o?Vf._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:Vf._`${s} !== parseInt(${s})`;e.fail$data(Vf._`(${i} === 0 || (${s} = ${r}/${i}, ${d}))`)}};ED.default=Fne});var PD=Je(function(RD){Object.defineProperty(RD,"__esModule",{value:!0});function AD(e){let t=e.length,r=0,i=0,n;while(i<t)if(r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t){if(n=e.charCodeAt(i),(n&64512)===56320)i++}return r}RD.default=AD;AD.code='require("ajv/dist/runtime/ucs2length").default'});var CD=Je(function(ID){Object.defineProperty(ID,"__esModule",{value:!0});var ha=wt(),qne=It(),Hne=PD(),Kne={message({keyword:e,schemaCode:t}){return ha.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>ha._`{limit: ${e}}`},Wne={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Kne,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?ha.operators.GT:ha.operators.LT,s=n.opts.unicode===!1?ha._`${r}.length`:ha._`${qne.useFunc(e.gen,Hne.default)}(${r})`;e.fail$data(ha._`${s} ${o} ${i}`)}};ID.default=Wne});var OD=Je(function($D){Object.defineProperty($D,"__esModule",{value:!0});var Vne=si(),Gne=It(),gu=wt(),Jne={message:({schemaCode:e})=>gu.str`must match pattern "${e}"`,params:({schemaCode:e})=>gu._`{pattern: ${e}}`},Xne={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Jne,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,d=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:h}=s.opts.code,m=h.code==="new RegExp"?gu._`new RegExp`:Gne.useFunc(t,h),v=t.let("valid");t.try(()=>t.assign(v,gu._`${m}(${o}, ${d}).test(${r})`),()=>t.assign(v,!1)),e.fail$data(gu._`!${v}`)}else{let h=Vne.usePattern(e,n);e.fail$data(gu._`!${h}.test(${r})`)}}};$D.default=Xne});var ND=Je(function(DD){Object.defineProperty(DD,"__esModule",{value:!0});var Gf=wt(),Qne={message({keyword:e,schemaCode:t}){return Gf.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Gf._`{limit: ${e}}`},eie={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Qne,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?Gf.operators.GT:Gf.operators.LT;e.fail$data(Gf._`Object.keys(${r}).length ${n} ${i}`)}};DD.default=eie});var zD=Je(function(LD){Object.defineProperty(LD,"__esModule",{value:!0});var Xf=si(),Jf=wt(),rie=It(),nie={message:({params:{missingProperty:e}})=>Jf.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Jf._`{missingProperty: ${e}}`},iie={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nie,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:d}=s;if(!o&&r.length===0)return;let h=r.length>=d.loopRequired;if(s.allErrors)m();else v();if(d.strictRequired){let x=e.parentSchema.properties,{definedProperties:k}=e.it;for(let T of r)if((x===null||x===void 0?void 0:x[T])===void 0&&!k.has(T)){let E=s.schemaEnv.baseId+s.errSchemaPath,P=`required property "${T}" is not defined at "${E}" (strictRequired)`;rie.checkStrictMode(s,P,s.opts.strictRequired)}}function m(){if(h||o)e.block$data(Jf.nil,g);else for(let x of r)Xf.checkReportMissingProp(e,x)}function v(){let x=t.let("missing");if(h||o){let k=t.let("valid",!0);e.block$data(k,()=>S(x,k)),e.ok(k)}else t.if(Xf.checkMissingProp(e,r,x)),Xf.reportMissingProp(e,x),t.else()}function g(){t.forOf("prop",i,(x)=>{e.setParams({missingProperty:x}),t.if(Xf.noPropertyInData(t,n,x,d.ownProperties),()=>e.error())})}function S(x,k){e.setParams({missingProperty:x}),t.forOf(x,i,()=>{t.assign(k,Xf.propertyInData(t,n,x,d.ownProperties)),t.if(Jf.not(k),()=>{e.error(),t.break()})},Jf.nil)}}};LD.default=iie});var FD=Je(function(UD){Object.defineProperty(UD,"__esModule",{value:!0});var Yf=wt(),sie={message({keyword:e,schemaCode:t}){return Yf.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Yf._`{limit: ${e}}`},aie={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:sie,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?Yf.operators.GT:Yf.operators.LT;e.fail$data(Yf._`${r}.length ${n} ${i}`)}};UD.default=aie});var Gy=Je(function(BD){Object.defineProperty(BD,"__esModule",{value:!0});var jD=cM();jD.code='require("ajv/dist/runtime/equal").default';BD.default=jD});var HD=Je(function(qD){Object.defineProperty(qD,"__esModule",{value:!0});var TM=zf(),Qr=wt(),cie=It(),die=Gy(),fie={message:({params:{i:e,j:t}})=>Qr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Qr._`{i: ${e}, j: ${t}}`},hie={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:fie,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:d}=e;if(!i&&!n)return;let h=t.let("valid"),m=o.items?TM.getSchemaTypes(o.items):[];e.block$data(h,v,Qr._`${s} === false`),e.ok(h);function v(){let k=t.let("i",Qr._`${r}.length`),T=t.let("j");e.setParams({i:k,j:T}),t.assign(h,!0),t.if(Qr._`${k} > 1`,()=>(g()?S:x)(k,T))}function g(){return m.length>0&&!m.some((k)=>k==="object"||k==="array")}function S(k,T){let E=t.name("item"),P=TM.checkDataTypes(m,E,d.opts.strictNumbers,TM.DataType.Wrong),R=t.const("indices",Qr._`{}`);t.for(Qr._`;${k}--;`,()=>{if(t.let(E,Qr._`${r}[${k}]`),t.if(P,Qr._`continue`),m.length>1)t.if(Qr._`typeof ${E} == "string"`,Qr._`${E} += "_"`);t.if(Qr._`typeof ${R}[${E}] == "number"`,()=>{t.assign(T,Qr._`${R}[${E}]`),e.error(),t.assign(h,!1).break()}).code(Qr._`${R}[${E}] = ${k}`)})}function x(k,T){let E=cie.useFunc(t,die.default),P=t.name("outer");t.label(P).for(Qr._`;${k}--;`,()=>t.for(Qr._`${T} = ${k}; ${T}--;`,()=>t.if(Qr._`${E}(${r}[${k}], ${r}[${T}])`,()=>{e.error(),t.assign(h,!1).break(P)})))}}};qD.default=hie});var WD=Je(function(KD){Object.defineProperty(KD,"__esModule",{value:!0});var AM=wt(),mie=It(),gie=Gy(),yie={message:"must be equal to constant",params:({schemaCode:e})=>AM._`{allowedValue: ${e}}`},vie={keyword:"const",$data:!0,error:yie,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;if(i||o&&typeof o=="object")e.fail$data(AM._`!${mie.useFunc(t,gie.default)}(${r}, ${n})`);else e.fail(AM._`${o} !== ${r}`)}};KD.default=vie});var VD=Je(function(ZD){Object.defineProperty(ZD,"__esModule",{value:!0});var Qf=wt(),_ie=It(),Sie=Gy(),wie={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Qf._`{allowedValues: ${e}}`},xie={keyword:"enum",schemaType:"array",$data:!0,error:wie,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw Error("enum must have non-empty array");let d=n.length>=s.opts.loopEnum,h,m=()=>h!==null&&h!==void 0?h:h=_ie.useFunc(t,Sie.default),v;if(d||i)v=t.let("valid"),e.block$data(v,g);else{if(!Array.isArray(n))throw Error("ajv implementation error");let x=t.const("vSchema",o);v=Qf.or(...n.map((k,T)=>S(x,T)))}e.pass(v);function g(){t.assign(v,!1),t.forOf("v",o,(x)=>t.if(Qf._`${m()}(${r}, ${x})`,()=>t.assign(v,!0).break()))}function S(x,k){let T=n[k];return typeof T==="object"&&T!==null?Qf._`${m()}(${r}, ${x}[${k}])`:Qf._`${r} === ${T}`}}};ZD.default=xie});var JD=Je(function(GD){Object.defineProperty(GD,"__esModule",{value:!0});var Mie=MD(),Eie=TD(),Tie=CD(),Aie=OD(),Rie=ND(),Pie=zD(),Iie=FD(),Cie=HD(),$ie=WD(),Oie=VD(),Die=[Mie.default,Eie.default,Tie.default,Aie.default,Rie.default,Pie.default,Iie.default,Cie.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$ie.default,Oie.default];GD.default=Die});var PM=Je(function(YD){Object.defineProperty(YD,"__esModule",{value:!0});YD.validateAdditionalItems=void 0;var pa=wt(),RM=It(),Lie={message:({params:{len:e}})=>pa.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>pa._`{limit: ${e}}`},zie={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Lie,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){RM.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}XD(e,i)}};function XD(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let d=r.const("len",pa._`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass(pa._`${d} <= ${t.length}`);else if(typeof i=="object"&&!RM.alwaysValidSchema(s,i)){let m=r.var("valid",pa._`${d} <= ${t.length}`);r.if(pa.not(m),()=>h(m)),e.ok(m)}function h(m){r.forRange("i",t.length,d,(v)=>{if(e.subschema({keyword:o,dataProp:v,dataPropType:RM.Type.Num},m),!s.allErrors)r.if(pa.not(m),()=>r.break())})}}YD.validateAdditionalItems=XD;YD.default=zie});var IM=Je(function(r9){Object.defineProperty(r9,"__esModule",{value:!0});r9.validateTuple=void 0;var e9=wt(),Jy=It(),Fie=si(),jie={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return t9(e,"additionalItems",t);if(r.items=!0,Jy.alwaysValidSchema(r,t))return;e.ok(Fie.validateArray(e))}};function t9(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:d}=e;if(v(n),d.opts.unevaluated&&r.length&&d.items!==!0)d.items=Jy.mergeEvaluated.items(i,r.length,d.items);let h=i.name("valid"),m=i.const("len",e9._`${o}.length`);r.forEach((g,S)=>{if(Jy.alwaysValidSchema(d,g))return;i.if(e9._`${m} > ${S}`,()=>e.subschema({keyword:s,schemaProp:S,dataProp:S},h)),e.ok(h)});function v(g){let{opts:S,errSchemaPath:x}=d,k=r.length,T=k===g.minItems&&(k===g.maxItems||g[t]===!1);if(S.strictTuples&&!T){let E=`"${s}" is ${k}-tuple, but minItems or maxItems/${t} are not specified or different at path "${x}"`;Jy.checkStrictMode(d,E,S.strictTuples)}}}r9.validateTuple=t9;r9.default=jie});var o9=Je(function(i9){Object.defineProperty(i9,"__esModule",{value:!0});var qie=IM(),Hie={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>qie.validateTuple(e,"items")};i9.default=Hie});var l9=Je(function(a9){Object.defineProperty(a9,"__esModule",{value:!0});var s9=wt(),Wie=It(),Zie=si(),Vie=PM(),Gie={message:({params:{len:e}})=>s9.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s9._`{limit: ${e}}`},Jie={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Gie,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;if(i.items=!0,Wie.alwaysValidSchema(i,t))return;if(n)Vie.validateAdditionalItems(e,n);else e.ok(Zie.validateArray(e))}};a9.default=Jie});var c9=Je(function(u9){Object.defineProperty(u9,"__esModule",{value:!0});var ai=wt(),Xy=It(),Yie={message:({params:{min:e,max:t}})=>t===void 0?ai.str`must contain at least ${e} valid item(s)`:ai.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ai._`{minContains: ${e}}`:ai._`{minContains: ${e}, maxContains: ${t}}`},Qie={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Yie,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,d,{minContains:h,maxContains:m}=i;if(o.opts.next)s=h===void 0?1:h,d=m;else s=1;let v=t.const("len",ai._`${n}.length`);if(e.setParams({min:s,max:d}),d===void 0&&s===0){Xy.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&s>d){Xy.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Xy.alwaysValidSchema(o,r)){let T=ai._`${v} >= ${s}`;if(d!==void 0)T=ai._`${T} && ${v} <= ${d}`;e.pass(T);return}o.items=!0;let g=t.name("valid");if(d===void 0&&s===1)x(g,()=>t.if(g,()=>t.break()));else if(s===0){if(t.let(g,!0),d!==void 0)t.if(ai._`${n}.length > 0`,S)}else t.let(g,!1),S();e.result(g,()=>e.reset());function S(){let T=t.name("_valid"),E=t.let("count",0);x(T,()=>t.if(T,()=>k(E)))}function x(T,E){t.forRange("i",0,v,(P)=>{e.subschema({keyword:"contains",dataProp:P,dataPropType:Xy.Type.Num,compositeRule:!0},T),E()})}function k(T){if(t.code(ai._`${T}++`),d===void 0)t.if(ai._`${T} >= ${s}`,()=>t.assign(g,!0).break());else if(t.if(ai._`${T} > ${d}`,()=>t.assign(g,!1).break()),s===1)t.assign(g,!0);else t.if(ai._`${T} >= ${s}`,()=>t.assign(g,!0))}}};u9.default=Qie});var g9=Je(function(h9){Object.defineProperty(h9,"__esModule",{value:!0});h9.validateSchemaDeps=h9.validatePropertyDeps=h9.error=void 0;var CM=wt(),toe=It(),eh=si();h9.error={message:({params:{property:e,depsCount:t,deps:r}})=>CM.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>CM._`{property: ${e},
45
45
  missingProperty: ${i},
46
46
  depsCount: ${t},
47
- deps: ${r}}`};var roe={keyword:"dependencies",type:"object",schemaType:"object",error:h9.error,code(e){let[t,r]=noe(e);d9(e,t),f9(e,r)}};function noe({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function d9(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let d=t[s];if(d.length===0)continue;let h=eh.propertyInData(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:d.length,deps:d.join(", ")}),n.allErrors)r.if(h,()=>{for(let m of d)eh.checkReportMissingProp(e,m)});else r.if(CM._`${h} && (${eh.checkMissingProp(e,d,o)})`),eh.reportMissingProp(e,o),r.else()}}h9.validatePropertyDeps=d9;function f9(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let d in t){if(toe.alwaysValidSchema(o,t[d]))continue;r.if(eh.propertyInData(r,i,d,o.opts.ownProperties),()=>{let h=e.subschema({keyword:n,schemaProp:d},s);e.mergeValidEvaluated(h,s)},()=>r.var(s,!0)),e.ok(s)}}h9.validateSchemaDeps=f9;h9.default=roe});var b9=Je(function(v9){Object.defineProperty(v9,"__esModule",{value:!0});var y9=wt(),soe=It(),aoe={message:"property name must be valid",params:({params:e})=>y9._`{propertyName: ${e.propertyName}}`},loe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:aoe,code(e){let{gen:t,schema:r,data:i,it:n}=e;if(soe.alwaysValidSchema(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if(y9.not(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};v9.default=loe});var $M=Je(function(_9){Object.defineProperty(_9,"__esModule",{value:!0});var Yy=si(),Ti=wt(),coe=vo(),Qy=It(),doe={message:"must NOT have additional properties",params:({params:e})=>Ti._`{additionalProperty: ${e.additionalProperty}}`},foe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:doe,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:d,opts:h}=s;if(s.props=!0,h.removeAdditional!=="all"&&Qy.alwaysValidSchema(s,r))return;let m=Yy.allSchemaProperties(i.properties),v=Yy.allSchemaProperties(i.patternProperties);g(),e.ok(Ti._`${o} === ${coe.default.errors}`);function g(){t.forIn("key",n,(E)=>{if(!m.length&&!v.length)k(E);else t.if(S(E),()=>k(E))})}function S(E){let P;if(m.length>8){let R=Qy.schemaRefOrVal(s,i.properties,"properties");P=Yy.isOwnProperty(t,R,E)}else if(m.length)P=Ti.or(...m.map((R)=>Ti._`${E} === ${R}`));else P=Ti.nil;if(v.length)P=Ti.or(P,...v.map((R)=>Ti._`${Yy.usePattern(e,R)}.test(${E})`));return Ti.not(P)}function x(E){t.code(Ti._`delete ${n}[${E}]`)}function k(E){if(h.removeAdditional==="all"||h.removeAdditional&&r===!1){x(E);return}if(r===!1){if(e.setParams({additionalProperty:E}),e.error(),!d)t.break();return}if(typeof r=="object"&&!Qy.alwaysValidSchema(s,r)){let P=t.name("valid");if(h.removeAdditional==="failing")T(E,P,!1),t.if(Ti.not(P),()=>{e.reset(),x(E)});else if(T(E,P),!d)t.if(Ti.not(P),()=>t.break())}}function T(E,P,R){let I={keyword:"additionalProperties",dataProp:E,dataPropType:Qy.Type.Str};if(R===!1)Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(I,P)}}};_9.default=foe});var k9=Je(function(x9){Object.defineProperty(x9,"__esModule",{value:!0});var poe=Bf(),w9=si(),OM=It(),S9=$M(),moe={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)S9.default.code(new poe.KeywordCxt(o,S9.default,"additionalProperties"));let s=w9.allSchemaProperties(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=OM.mergeEvaluated.props(t,OM.toHash(s),o.props);let d=s.filter((g)=>!OM.alwaysValidSchema(o,r[g]));if(d.length===0)return;let h=t.name("valid");for(let g of d){if(m(g))v(g);else{if(t.if(w9.propertyInData(t,n,g,o.opts.ownProperties)),v(g),!o.allErrors)t.else().var(h,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(h)}function m(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function v(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},h)}}};x9.default=moe});var R9=Je(function(A9){Object.defineProperty(A9,"__esModule",{value:!0});var M9=si(),ev=wt(),E9=It(),T9=It(),yoe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,d=M9.allSchemaProperties(r),h=d.filter((T)=>E9.alwaysValidSchema(o,r[T]));if(d.length===0||h.length===d.length&&(!o.opts.unevaluated||o.props===!0))return;let m=s.strictSchema&&!s.allowMatchingProperties&&n.properties,v=t.name("valid");if(o.props!==!0&&!(o.props instanceof ev.Name))o.props=T9.evaluatedPropsToName(t,o.props);let{props:g}=o;S();function S(){for(let T of d){if(m)x(T);if(o.allErrors)k(T);else t.var(v,!0),k(T),t.if(v)}}function x(T){for(let E in m)if(new RegExp(T).test(E))E9.checkStrictMode(o,`property ${E} matches pattern ${T} (use allowMatchingProperties)`)}function k(T){t.forIn("key",i,(E)=>{t.if(ev._`${M9.usePattern(e,T)}.test(${E})`,()=>{let P=h.includes(T);if(!P)e.subschema({keyword:"patternProperties",schemaProp:T,dataProp:E,dataPropType:T9.Type.Str},v);if(o.opts.unevaluated&&g!==!0)t.assign(ev._`${g}[${E}]`,!0);else if(!P&&!o.allErrors)t.if(ev.not(v),()=>t.break())})})}}};A9.default=yoe});var I9=Je(function(P9){Object.defineProperty(P9,"__esModule",{value:!0});var boe=It(),_oe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if(boe.alwaysValidSchema(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};P9.default=_oe});var $9=Je(function(C9){Object.defineProperty(C9,"__esModule",{value:!0});var woe=si(),xoe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:woe.validateUnion,error:{message:"must match a schema in anyOf"}};C9.default=xoe});var D9=Je(function(O9){Object.defineProperty(O9,"__esModule",{value:!0});var tv=wt(),Moe=It(),Eoe={message:"must match exactly one schema in oneOf",params:({params:e})=>tv._`{passingSchemas: ${e.passing}}`},Toe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Eoe,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),d=t.let("passing",null),h=t.name("_valid");e.setParams({passing:d}),t.block(m),e.result(s,()=>e.reset(),()=>e.error(!0));function m(){o.forEach((v,g)=>{let S;if(Moe.alwaysValidSchema(n,v))t.var(h,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},h);if(g>0)t.if(tv._`${h} && ${s}`).assign(s,!1).assign(d,tv._`[${d}, ${g}]`).else();t.if(h,()=>{if(t.assign(s,!0),t.assign(d,g),S)e.mergeEvaluated(S,tv.Name)})})}}};O9.default=Toe});var L9=Je(function(N9){Object.defineProperty(N9,"__esModule",{value:!0});var Roe=It(),Poe={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if(Roe.alwaysValidSchema(i,o))return;let d=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(d)})}};N9.default=Poe});var j9=Je(function(F9){Object.defineProperty(F9,"__esModule",{value:!0});var rv=wt(),U9=It(),Coe={message:({params:e})=>rv.str`must match "${e.ifClause}" schema`,params:({params:e})=>rv._`{failingKeyword: ${e.ifClause}}`},$oe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Coe,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)U9.checkStrictMode(i,'"if" without "then" and "else" is ignored');let n=z9(i,"then"),o=z9(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),d=t.name("_valid");if(h(),e.reset(),n&&o){let v=t.let("ifClause");e.setParams({ifClause:v}),t.if(d,m("then",v),m("else",v))}else if(n)t.if(d,m("then"));else t.if(rv.not(d),m("else"));e.pass(s,()=>e.error(!0));function h(){let v=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);e.mergeEvaluated(v)}function m(v,g){return()=>{let S=e.subschema({keyword:v},d);if(t.assign(s,d),e.mergeValidEvaluated(S,s),g)t.assign(g,rv._`${v}`);else e.setParams({ifClause:v})}}}};function z9(e,t){let r=e.schema[t];return r!==void 0&&!U9.alwaysValidSchema(e,r)}F9.default=$oe});var q9=Je(function(B9){Object.defineProperty(B9,"__esModule",{value:!0});var Doe=It(),Noe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Doe.checkStrictMode(r,`"${e}" without "if" is ignored`)}};B9.default=Noe});var K9=Je(function(H9){Object.defineProperty(H9,"__esModule",{value:!0});var zoe=PM(),Uoe=o9(),Foe=IM(),joe=l9(),Boe=c9(),qoe=g9(),Hoe=b9(),Koe=$M(),Woe=k9(),Zoe=R9(),Voe=I9(),Goe=$9(),Joe=D9(),Xoe=L9(),Yoe=j9(),Qoe=q9();function ese(e=!1){let t=[Voe.default,Goe.default,Joe.default,Xoe.default,Yoe.default,Qoe.default,Hoe.default,Koe.default,qoe.default,Woe.default,Zoe.default];if(e)t.push(Uoe.default,joe.default);else t.push(zoe.default,Foe.default);return t.push(Boe.default),t}H9.default=ese});var Z9=Je(function(W9){Object.defineProperty(W9,"__esModule",{value:!0});var hr=wt(),rse={message:({schemaCode:e})=>hr.str`must match format "${e}"`,params:({schemaCode:e})=>hr._`{format: ${e}}`},nse={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:rse,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:d}=e,{opts:h,errSchemaPath:m,schemaEnv:v,self:g}=d;if(!h.validateFormats)return;if(n)S();else x();function S(){let k=r.scopeValue("formats",{ref:g.formats,code:h.code.formats}),T=r.const("fDef",hr._`${k}[${s}]`),E=r.let("fType"),P=r.let("format");r.if(hr._`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>r.assign(E,hr._`${T}.type || "string"`).assign(P,hr._`${T}.validate`),()=>r.assign(E,hr._`"string"`).assign(P,T)),e.fail$data(hr.or(R(),I()));function R(){if(h.strictSchema===!1)return hr.nil;return hr._`${s} && !${P}`}function I(){let O=v.$async?hr._`(${T}.async ? await ${P}(${i}) : ${P}(${i}))`:hr._`${P}(${i})`,D=hr._`(typeof ${P} == "function" ? ${O} : ${P}.test(${i}))`;return hr._`${P} && ${P} !== true && ${E} === ${t} && !${D}`}}function x(){let k=g.formats[o];if(!k){R();return}if(k===!0)return;let[T,E,P]=I(k);if(T===t)e.pass(O());function R(){if(h.strictSchema===!1){g.logger.warn(D());return}throw Error(D());function D(){return`unknown format "${o}" ignored in schema at path "${m}"`}}function I(D){let H=D instanceof RegExp?hr.regexpCode(D):h.code.formats?hr._`${h.code.formats}${hr.getProperty(o)}`:void 0,G=r.scopeValue("formats",{key:o,ref:D,code:H});if(typeof D=="object"&&!(D instanceof RegExp))return[D.type||"string",D.validate,hr._`${G}.validate`];return["string",D,G]}function O(){if(typeof k=="object"&&!(k instanceof RegExp)&&k.async){if(!v.$async)throw Error("async format in sync schema");return hr._`await ${P}(${i})`}return typeof E=="function"?hr._`${P}(${i})`:hr._`${P}.test(${i})`}}}};W9.default=nse});var G9=Je(function(V9){Object.defineProperty(V9,"__esModule",{value:!0});var ose=Z9(),sse=[ose.default];V9.default=sse});var Y9=Je(function(J9){Object.defineProperty(J9,"__esModule",{value:!0});J9.contentVocabulary=J9.metadataVocabulary=void 0;J9.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];J9.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var t5=Je(function(e5){Object.defineProperty(e5,"__esModule",{value:!0});var use=xD(),cse=JD(),dse=K9(),fse=G9(),Q9=Y9(),hse=[use.default,cse.default,(0,dse.default)(),fse.default,Q9.metadataVocabulary,Q9.contentVocabulary];e5.default=hse});var o5=Je(function(n5){Object.defineProperty(n5,"__esModule",{value:!0});n5.DiscrError=void 0;var r5;(function(e){e.Tag="tag",e.Mapping="mapping"})(r5||(n5.DiscrError=r5={}))});var l5=Je(function(a5){Object.defineProperty(a5,"__esModule",{value:!0});var yu=wt(),DM=o5(),s5=Uy(),mse=qf(),gse=It(),yse={message:({params:{discrError:e,tagName:t}})=>e===DM.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>yu._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},vse={keyword:"discriminator",type:"object",schemaType:"object",error:yse,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let d=i.propertyName;if(typeof d!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let h=t.let("valid",!1),m=t.const("tag",yu._`${r}${yu.getProperty(d)}`);t.if(yu._`typeof ${m} == "string"`,()=>v(),()=>e.error(!1,{discrError:DM.DiscrError.Tag,tag:m,tagName:d})),e.ok(h);function v(){let x=S();t.if(!1);for(let k in x)t.elseIf(yu._`${m} === ${k}`),t.assign(h,g(x[k]));t.else(),e.error(!1,{discrError:DM.DiscrError.Mapping,tag:m,tagName:d}),t.endIf()}function g(x){let k=t.name("valid"),T=e.subschema({keyword:"oneOf",schemaProp:x},k);return e.mergeEvaluated(T,yu.Name),k}function S(){var x;let k={},T=P(n),E=!0;for(let O=0;O<s.length;O++){let D=s[O];if((D===null||D===void 0?void 0:D.$ref)&&!gse.schemaHasRulesButRef(D,o.self.RULES)){let G=D.$ref;if(D=s5.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,G),D instanceof s5.SchemaEnv)D=D.schema;if(D===void 0)throw new mse.default(o.opts.uriResolver,o.baseId,G)}let H=(x=D===null||D===void 0?void 0:D.properties)===null||x===void 0?void 0:x[d];if(typeof H!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${d}"`);E=E&&(T||P(D)),R(H,O)}if(!E)throw Error(`discriminator: "${d}" must be required`);return k;function P({required:O}){return Array.isArray(O)&&O.includes(d)}function R(O,D){if(O.const)I(O.const,D);else if(O.enum)for(let H of O.enum)I(H,D);else throw Error(`discriminator: "properties/${d}" must have "const" or "enum"`)}function I(O,D){if(typeof O!="string"||O in k)throw Error(`discriminator: "${d}" values must be unique strings`);k[O]=D}}}};a5.default=vse});var u5=Je(function(pCe,_se){_se.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 LM=Je(function(Nn,NM){Object.defineProperty(Nn,"__esModule",{value:!0});Nn.MissingRefError=Nn.ValidationError=Nn.CodeGen=Nn.Name=Nn.nil=Nn.stringify=Nn.str=Nn._=Nn.KeywordCxt=Nn.Ajv=void 0;var Sse=hD(),wse=t5(),xse=l5(),c5=u5(),kse=["/properties"],nv="http://json-schema.org/draft-07/schema";class th extends Sse.default{_addVocabularies(){if(super._addVocabularies(),wse.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(xse.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(c5,kse):c5;this.addMetaSchema(e,nv,!1),this.refs["http://json-schema.org/schema"]=nv}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(nv)?nv:void 0)}}Nn.Ajv=th;NM.exports=Nn=th;NM.exports.Ajv=th;Object.defineProperty(Nn,"__esModule",{value:!0});Nn.default=th;var Mse=Bf();Object.defineProperty(Nn,"KeywordCxt",{enumerable:!0,get:function(){return Mse.KeywordCxt}});var vu=wt();Object.defineProperty(Nn,"_",{enumerable:!0,get:function(){return vu._}});Object.defineProperty(Nn,"str",{enumerable:!0,get:function(){return vu.str}});Object.defineProperty(Nn,"stringify",{enumerable:!0,get:function(){return vu.stringify}});Object.defineProperty(Nn,"nil",{enumerable:!0,get:function(){return vu.nil}});Object.defineProperty(Nn,"Name",{enumerable:!0,get:function(){return vu.Name}});Object.defineProperty(Nn,"CodeGen",{enumerable:!0,get:function(){return vu.CodeGen}});var Ese=Ly();Object.defineProperty(Nn,"ValidationError",{enumerable:!0,get:function(){return Ese.default}});var Tse=qf();Object.defineProperty(Nn,"MissingRefError",{enumerable:!0,get:function(){return Tse.default}})});var _5=Je(function(v5){Object.defineProperty(v5,"__esModule",{value:!0});v5.formatNames=v5.fastFormats=v5.fullFormats=void 0;function Xi(e,t){return{validate:e,compare:t}}v5.fullFormats={date:Xi(p5,jM),time:Xi(UM(!0),BM),"date-time":Xi(d5(!0),g5),"iso-time":Xi(UM(),m5),"iso-date-time":Xi(d5(),y5),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Dse,"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:Bse,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:Nse,int32:{type:"number",validate:Use},int64:{type:"number",validate:Fse},float:{type:"number",validate:h5},double:{type:"number",validate:h5},password:!0,binary:!0};v5.fastFormats={...v5.fullFormats,date:Xi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,jM),time:Xi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,BM),"date-time":Xi(/^\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,g5),"iso-time":Xi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m5),"iso-date-time":Xi(/^\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,y5),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};v5.formatNames=Object.keys(v5.fullFormats);function Pse(e){return e%4===0&&(e%100!==0||e%400===0)}var Ise=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Cse=[0,31,28,31,30,31,30,31,31,30,31,30,31];function p5(e){let t=Ise.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&Pse(r)?29:Cse[i])}function jM(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var zM=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function UM(e){return function(r){let i=zM.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],d=i[4],h=i[5]==="-"?-1:1,m=+(i[6]||0),v=+(i[7]||0);if(m>23||v>59||e&&!d)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-v*h,S=n-m*h-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function BM(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function m5(e,t){if(!(e&&t))return;let r=zM.exec(e),i=zM.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var FM=/t|\s/i;function d5(e){let t=UM(e);return function(i){let n=i.split(FM);return n.length===2&&p5(n[0])&&t(n[1])}}function g5(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function y5(e,t){if(!(e&&t))return;let[r,i]=e.split(FM),[n,o]=t.split(FM),s=jM(r,n);if(s===void 0)return;return s||BM(i,o)}var $se=/\/|:/,Ose=/^(?:[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 Dse(e){return $se.test(e)&&Ose.test(e)}var f5=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Nse(e){return f5.lastIndex=0,f5.test(e)}var Lse=-2147483648,zse=2147483647;function Use(e){return Number.isInteger(e)&&e<=zse&&e>=Lse}function Fse(e){return Number.isInteger(e)}function h5(){return!0}var jse=/[^\\]\\Z/;function Bse(e){if(jse.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var w5=Je(function(S5){Object.defineProperty(S5,"__esModule",{value:!0});S5.formatLimitDefinition=void 0;var Hse=LM(),Ai=wt(),ps=Ai.operators,iv={formatMaximum:{okStr:"<=",ok:ps.LTE,fail:ps.GT},formatMinimum:{okStr:">=",ok:ps.GTE,fail:ps.LT},formatExclusiveMaximum:{okStr:"<",ok:ps.LT,fail:ps.GTE},formatExclusiveMinimum:{okStr:">",ok:ps.GT,fail:ps.LTE}},Kse={message:({keyword:e,schemaCode:t})=>Ai.str`should be ${iv[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ai._`{comparison: ${iv[e].okStr}, limit: ${t}}`};S5.formatLimitDefinition={keyword:Object.keys(iv),type:"string",schemaType:"string",$data:!0,error:Kse,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:d}=o;if(!s.validateFormats)return;let h=new Hse.KeywordCxt(o,d.RULES.all.format.definition,"format");if(h.$data)m();else v();function m(){let S=t.scopeValue("formats",{ref:d.formats,code:s.code.formats}),x=t.const("fmt",Ai._`${S}[${h.schemaCode}]`);e.fail$data(Ai.or(Ai._`typeof ${x} != "object"`,Ai._`${x} instanceof RegExp`,Ai._`typeof ${x}.compare != "function"`,g(x)))}function v(){let S=h.schema,x=d.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let k=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Ai._`${s.code.formats}${Ai.getProperty(S)}`:void 0});e.fail$data(g(k))}function g(S){return Ai._`${S}.compare(${r}, ${i}) ${iv[n].fail} 0`}},dependencies:["format"]};var Wse=(e)=>(e.addKeyword(S5.formatLimitDefinition),e);S5.default=Wse});var E5=Je(function(rh,M5){Object.defineProperty(rh,"__esModule",{value:!0});var bu=_5(),Vse=w5(),KM=wt(),x5=new KM.Name("fullFormats"),Gse=new KM.Name("fastFormats"),WM=(e,t={keywords:!0})=>{if(Array.isArray(t))return k5(e,t,bu.fullFormats,x5),e;let[r,i]=t.mode==="fast"?[bu.fastFormats,Gse]:[bu.fullFormats,x5],n=t.formats||bu.formatNames;if(k5(e,n,r,i),t.keywords)(0,Vse.default)(e);return e};WM.get=(e,t="full")=>{let i=(t==="fast"?bu.fastFormats:bu.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function k5(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=KM._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}M5.exports=rh=WM;Object.defineProperty(rh,"__esModule",{value:!0});rh.default=WM});function iE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Su(e,t){if(t<=0)return"";if(e.length<=t)return e;let r=e.slice(0,t),i=r.charCodeAt(t-1);return V5(i>=55296&&i<=56319?r.slice(0,-1):r)}function V5(e){if(typeof Buffer<"u")return Buffer.from(e,"utf16le").toString("utf16le");return G5(e)}function G5(e){let r=[];for(let i=0;i<e.length;i+=8192){let n=Math.min(i+8192,e.length),o=new Uint16Array(n-i);for(let s=i;s<n;s++)o[s-i]=e.charCodeAt(s);r.push(String.fromCharCode(...o))}return r.join("")}var uae=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,cae=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function Yi(e){return!Array.isArray?fE(e)==="[object Array]":Array.isArray(e)}var X5=1/0;function Y5(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-X5?"-0":t}function Q5(e){return e==null?"":Y5(e)}function Ri(e){return typeof e==="string"}function cE(e){return typeof e==="number"}function e7(e){return e===!0||e===!1||t7(e)&&fE(e)=="[object Boolean]"}function dE(e){return typeof e==="object"}function t7(e){return dE(e)&&e!==null}function Ln(e){return e!==void 0&&e!==null}function dv(e){return!e.trim().length}function fE(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var r7="Incorrect 'index' type",n7=(e)=>`Invalid value for key ${e}`,i7=(e)=>`Pattern length exceeds max of ${e}.`,o7=(e)=>`Missing ${e} property in key`,s7=(e)=>`Property 'weight' in key '${e}' must be a positive integer`,oE=Object.prototype.hasOwnProperty;class hE{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((r)=>{let i=pE(r);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight}),this._keys.forEach((r)=>{r.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function pE(e){let t=null,r=null,i=null,n=1,o=null;if(Ri(e)||Yi(e))i=e,t=sE(e),r=fv(e);else{if(!oE.call(e,"name"))throw Error(o7("name"));let s=e.name;if(i=s,oE.call(e,"weight")){if(n=e.weight,n<=0)throw Error(s7(s))}t=sE(s),r=fv(s),o=e.getFn}return{path:t,id:r,weight:n,src:i,getFn:o}}function sE(e){return Yi(e)?e:e.split(".")}function fv(e){return Yi(e)?e.join("."):e}function a7(e,t){let r=[],i=!1,n=(o,s,d)=>{if(!Ln(o))return;if(!s[d])r.push(o);else{let h=s[d],m=o[h];if(!Ln(m))return;if(d===s.length-1&&(Ri(m)||cE(m)||e7(m)))r.push(Q5(m));else if(Yi(m)){i=!0;for(let v=0,g=m.length;v<g;v+=1)n(m[v],s,d+1)}else if(s.length)n(m,s,d+1)}};return n(e,Ri(t)?t.split("."):t,0),i?r:r[0]}var l7={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},u7={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},c7={location:0,threshold:0.6,distance:100},d7={useExtendedSearch:!1,getFn:a7,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},pt={...u7,...l7,...c7,...d7},f7=/[^ ]+/g;function h7(e=1,t=3){let r=new Map,i=Math.pow(10,t);return{get(n){let o=n.match(f7).length;if(r.has(o))return r.get(o);let s=1/Math.pow(o,0.5*e),d=parseFloat(Math.round(s*i)/i);return r.set(o,d),d},clear(){r.clear()}}}class sh{constructor({getFn:e=pt.getFn,fieldNormWeight:t=pt.fieldNormWeight}={}){this.norm=h7(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,r)=>{this._keysMap[t.id]=r})}create(){if(this.isCreated||!this.docs.length)return;if(this.isCreated=!0,Ri(this.docs[0]))this.docs.forEach((e,t)=>{this._addString(e,t)});else this.docs.forEach((e,t)=>{this._addObject(e,t)});this.norm.clear()}add(e){let t=this.size();if(Ri(e))this._addString(e,t);else this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t<r;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!Ln(e)||dv(e))return;let r={v:e,i:t,n:this.norm.get(e)};this.records.push(r)}_addObject(e,t){let r={i:t,$:{}};this.keys.forEach((i,n)=>{let o=i.getFn?i.getFn(e):this.getFn(e,i.path);if(!Ln(o))return;if(Yi(o)){let s=[],d=[{nestedArrIndex:-1,value:o}];while(d.length){let{nestedArrIndex:h,value:m}=d.pop();if(!Ln(m))continue;if(Ri(m)&&!dv(m)){let v={v:m,i:h,n:this.norm.get(m)};s.push(v)}else if(Yi(m))m.forEach((v,g)=>{d.push({nestedArrIndex:g,value:v})})}r.$[n]=s}else if(Ri(o)&&!dv(o)){let s={v:o,n:this.norm.get(o)};r.$[n]=s}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function mE(e,t,{getFn:r=pt.getFn,fieldNormWeight:i=pt.fieldNormWeight}={}){let n=new sh({getFn:r,fieldNormWeight:i});return n.setKeys(e.map(pE)),n.setSources(t),n.create(),n}function p7(e,{getFn:t=pt.getFn,fieldNormWeight:r=pt.fieldNormWeight}={}){let{keys:i,records:n}=e,o=new sh({getFn:t,fieldNormWeight:r});return o.setKeys(i),o.setIndexRecords(n),o}function ih(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:n=pt.distance,ignoreLocation:o=pt.ignoreLocation}={}){let s=t/e.length;if(o)return s;let d=Math.abs(i-r);if(!n)return d?1:s;return s+d/n}function m7(e=[],t=pt.minMatchCharLength){let r=[],i=-1,n=-1,o=0;for(let s=e.length;o<s;o+=1){let d=e[o];if(d&&i===-1)i=o;else if(!d&&i!==-1){if(n=o-1,n-i+1>=t)r.push([i,n]);i=-1}}if(e[o-1]&&o-i>=t)r.push([i,o-1]);return r}var ys=32;function g7(e,t,r,{location:i=pt.location,distance:n=pt.distance,threshold:o=pt.threshold,findAllMatches:s=pt.findAllMatches,minMatchCharLength:d=pt.minMatchCharLength,includeMatches:h=pt.includeMatches,ignoreLocation:m=pt.ignoreLocation}={}){if(t.length>ys)throw Error(i7(ys));let v=t.length,g=e.length,S=Math.max(0,Math.min(i,g)),x=o,k=S,T=d>1||h,E=T?Array(g):[],P;while((P=e.indexOf(t,k))>-1){let G=ih(t,{currentLocation:P,expectedLocation:S,distance:n,ignoreLocation:m});if(x=Math.min(G,x),k=P+v,T){let oe=0;while(oe<v)E[P+oe]=1,oe+=1}}k=-1;let R=[],I=1,O=v+g,D=1<<v-1;for(let G=0;G<v;G+=1){let oe=0,ee=O;while(oe<ee){if(ih(t,{errors:G,currentLocation:S+ee,expectedLocation:S,distance:n,ignoreLocation:m})<=x)oe=ee;else O=ee;ee=Math.floor((O-oe)/2+oe)}O=ee;let F=Math.max(1,S-ee+1),J=s?g:Math.min(S+ee,g)+v,a=Array(J+2);a[J+1]=(1<<G)-1;for(let p=J;p>=F;p-=1){let u=p-1,f=r[e.charAt(u)];if(T)E[u]=+!!f;if(a[p]=(a[p+1]<<1|1)&f,G)a[p]|=(R[p+1]|R[p])<<1|1|R[p+1];if(a[p]&D){if(I=ih(t,{errors:G,currentLocation:u,expectedLocation:S,distance:n,ignoreLocation:m}),I<=x){if(x=I,k=u,k<=S)break;F=Math.max(1,2*S-k)}}}if(ih(t,{errors:G+1,currentLocation:S,expectedLocation:S,distance:n,ignoreLocation:m})>x)break;R=a}let H={isMatch:k>=0,score:Math.max(0.001,I)};if(T){let G=m7(E,d);if(!G.length)H.isMatch=!1;else if(h)H.indices=G}return H}function y7(e){let t={};for(let r=0,i=e.length;r<i;r+=1){let n=e.charAt(r);t[n]=(t[n]||0)|1<<i-r-1}return t}class vv{constructor(e,{location:t=pt.location,threshold:r=pt.threshold,distance:i=pt.distance,includeMatches:n=pt.includeMatches,findAllMatches:o=pt.findAllMatches,minMatchCharLength:s=pt.minMatchCharLength,isCaseSensitive:d=pt.isCaseSensitive,ignoreLocation:h=pt.ignoreLocation}={}){if(this.options={location:t,threshold:r,distance:i,includeMatches:n,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:d,ignoreLocation:h},this.pattern=d?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;let m=(g,S)=>{this.chunks.push({pattern:g,alphabet:y7(g),startIndex:S})},v=this.pattern.length;if(v>ys){let g=0,S=v%ys,x=v-S;while(g<x)m(this.pattern.substr(g,ys),g),g+=ys;if(S){let k=v-ys;m(this.pattern.substr(k),k)}}else m(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,includeMatches:r}=this.options;if(!t)e=e.toLowerCase();if(this.pattern===e){let x={isMatch:!0,score:0};if(r)x.indices=[[0,e.length-1]];return x}let{location:i,distance:n,threshold:o,findAllMatches:s,minMatchCharLength:d,ignoreLocation:h}=this.options,m=[],v=0,g=!1;this.chunks.forEach(({pattern:x,alphabet:k,startIndex:T})=>{let{isMatch:E,score:P,indices:R}=g7(e,x,k,{location:i+T,distance:n,threshold:o,findAllMatches:s,minMatchCharLength:d,includeMatches:r,ignoreLocation:h});if(E)g=!0;if(v+=P,E&&R)m=[...m,...R]});let S={isMatch:g,score:g?v/this.chunks.length:1};if(g&&r)S.indices=m;return S}}class Qi{constructor(e){this.pattern=e}static isMultiMatch(e){return aE(e,this.multiRegex)}static isSingleMatch(e){return aE(e,this.singleRegex)}search(){}}function aE(e,t){let r=e.match(t);return r?r[1]:null}class gE extends Qi{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class yE extends Qi{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class vE extends Qi{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class bE extends Qi{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class _E extends Qi{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class SE extends Qi{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class bv extends Qi{constructor(e,{location:t=pt.location,threshold:r=pt.threshold,distance:i=pt.distance,includeMatches:n=pt.includeMatches,findAllMatches:o=pt.findAllMatches,minMatchCharLength:s=pt.minMatchCharLength,isCaseSensitive:d=pt.isCaseSensitive,ignoreLocation:h=pt.ignoreLocation}={}){super(e);this._bitapSearch=new vv(e,{location:t,threshold:r,distance:i,includeMatches:n,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:d,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class _v extends Qi{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,r,i=[],n=this.pattern.length;while((r=e.indexOf(this.pattern,t))>-1)t=r+n,i.push([r,t-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}var hv=[gE,_v,vE,bE,SE,_E,yE,bv],lE=hv.length,v7=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,b7="|";function _7(e,t={}){return e.split(b7).map((r)=>{let i=r.trim().split(v7).filter((o)=>o&&!!o.trim()),n=[];for(let o=0,s=i.length;o<s;o+=1){let d=i[o],h=!1,m=-1;while(!h&&++m<lE){let v=hv[m],g=v.isMultiMatch(d);if(g)n.push(new v(g,t)),h=!0}if(h)continue;m=-1;while(++m<lE){let v=hv[m],g=v.isSingleMatch(d);if(g){n.push(new v(g,t));break}}}return n})}var S7=new Set([bv.type,_v.type]);class wE{constructor(e,{isCaseSensitive:t=pt.isCaseSensitive,includeMatches:r=pt.includeMatches,minMatchCharLength:i=pt.minMatchCharLength,ignoreLocation:n=pt.ignoreLocation,findAllMatches:o=pt.findAllMatches,location:s=pt.location,threshold:d=pt.threshold,distance:h=pt.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:n,location:s,threshold:d,distance:h},this.pattern=t?e:e.toLowerCase(),this.query=_7(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:r,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let n=0,o=[],s=0;for(let d=0,h=t.length;d<h;d+=1){let m=t[d];o.length=0,n=0;for(let v=0,g=m.length;v<g;v+=1){let S=m[v],{isMatch:x,indices:k,score:T}=S.search(e);if(x){if(n+=1,s+=T,r){let E=S.constructor.type;if(S7.has(E))o=[...o,...k];else o.push(k)}}else{s=0,n=0,o.length=0;break}}if(n){let v={isMatch:!0,score:s/n};if(r)v.indices=o;return v}}return{isMatch:!1,score:1}}}var pv=[];function w7(...e){pv.push(...e)}function mv(e,t){for(let r=0,i=pv.length;r<i;r+=1){let n=pv[r];if(n.condition(e,t))return new n(e,t)}return new vv(e,t)}var oh={AND:"$and",OR:"$or"},gv={PATH:"$path",PATTERN:"$val"},yv=(e)=>!!(e[oh.AND]||e[oh.OR]),x7=(e)=>!!e[gv.PATH],k7=(e)=>!Yi(e)&&dE(e)&&!yv(e),uE=(e)=>({[oh.AND]:Object.keys(e).map((t)=>({[t]:e[t]}))});function xE(e,t,{auto:r=!0}={}){let i=(n)=>{let o=Object.keys(n),s=x7(n);if(!s&&o.length>1&&!yv(n))return i(uE(n));if(k7(n)){let h=s?n[gv.PATH]:o[0],m=s?n[gv.PATTERN]:n[h];if(!Ri(m))throw Error(n7(h));let v={keyId:fv(h),pattern:m};if(r)v.searcher=mv(m,t);return v}let d={children:[],operator:o[0]};return o.forEach((h)=>{let m=n[h];if(Yi(m))m.forEach((v)=>{d.children.push(i(v))})}),d};if(!yv(e))e=uE(e);return i(e)}function M7(e,{ignoreFieldNorm:t=pt.ignoreFieldNorm}){e.forEach((r)=>{let i=1;r.matches.forEach(({key:n,norm:o,score:s})=>{let d=n?n.weight:null;i*=Math.pow(s===0&&d?Number.EPSILON:s,(d||1)*(t?1:o))}),r.score=i})}function E7(e,t){let r=e.matches;if(t.matches=[],!Ln(r))return;r.forEach((i)=>{if(!Ln(i.indices)||!i.indices.length)return;let{indices:n,value:o}=i,s={indices:n,value:o};if(i.key)s.key=i.key.src;if(i.idx>-1)s.refIndex=i.idx;t.matches.push(s)})}function T7(e,t){t.score=e.score}function A7(e,t,{includeMatches:r=pt.includeMatches,includeScore:i=pt.includeScore}={}){let n=[];if(r)n.push(E7);if(i)n.push(T7);return e.map((o)=>{let{idx:s}=o,d={item:t[s],refIndex:s};if(n.length)n.forEach((h)=>{h(o,d)});return d})}class So{constructor(e,t={},r){this.options={...pt,...t},this.options.useExtendedSearch,this._keyStore=new hE(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof sh))throw Error(r7);this._myIndex=t||mE(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){if(!Ln(e))return;this._docs.push(e),this._myIndex.add(e)}remove(e=()=>!1){let t=[];for(let r=0,i=this._docs.length;r<i;r+=1){let n=this._docs[r];if(e(n,r))this.removeAt(r),r-=1,i-=1,t.push(n)}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){let{includeMatches:r,includeScore:i,shouldSort:n,sortFn:o,ignoreFieldNorm:s}=this.options,d=Ri(e)?Ri(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);if(M7(d,{ignoreFieldNorm:s}),n)d.sort(o);if(cE(t)&&t>-1)d=d.slice(0,t);return A7(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){let t=mv(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach(({v:n,i:o,n:s})=>{if(!Ln(n))return;let{isMatch:d,score:h,indices:m}=t.searchIn(n);if(d)i.push({item:n,idx:o,matches:[{score:h,value:n,norm:s,indices:m}]})}),i}_searchLogical(e){let t=xE(e,this.options),r=(s,d,h)=>{if(!s.children){let{keyId:v,searcher:g}=s,S=this._findMatches({key:this._keyStore.get(v),value:this._myIndex.getValueForItemAtKeyId(d,v),searcher:g});if(S&&S.length)return[{idx:h,item:d,matches:S}];return[]}let m=[];for(let v=0,g=s.children.length;v<g;v+=1){let S=s.children[v],x=r(S,d,h);if(x.length)m.push(...x);else if(s.operator===oh.AND)return[]}return m},i=this._myIndex.records,n={},o=[];return i.forEach(({$:s,i:d})=>{if(Ln(s)){let h=r(t,s,d);if(h.length){if(!n[d])n[d]={idx:d,item:s,matches:[]},o.push(n[d]);h.forEach(({matches:m})=>{n[d].matches.push(...m)})}}}),o}_searchObjectList(e){let t=mv(e,this.options),{keys:r,records:i}=this._myIndex,n=[];return i.forEach(({$:o,i:s})=>{if(!Ln(o))return;let d=[];if(r.forEach((h,m)=>{d.push(...this._findMatches({key:h,value:o[m],searcher:t}))}),d.length)n.push({idx:s,item:o,matches:d})}),n}_findMatches({key:e,value:t,searcher:r}){if(!Ln(t))return[];let i=[];if(Yi(t))t.forEach(({v:n,i:o,n:s})=>{if(!Ln(n))return;let{isMatch:d,score:h,indices:m}=r.searchIn(n);if(d)i.push({score:h,key:e,value:n,idx:o,norm:s,indices:m})});else{let{v:n,n:o}=t,{isMatch:s,score:d,indices:h}=r.searchIn(n);if(s)i.push({score:d,key:e,value:n,norm:o,indices:h})}return i}}So.version="7.0.0";So.createIndex=mE;So.parseIndex=p7;So.config=pt;So.parseQuery=xE;w7(wE);var kE=/[:_-]/g;class Sv{fuse;constructor(e){let t=e.map((r)=>{let{name:i,displayName:n}=r,o=i.split(kE).filter(Boolean),s=n!==i?n.split(kE).filter(Boolean):[];return{descriptionKey:(r.description??"").split(" ").map((d)=>d.toLowerCase().replace(/[^a-z0-9]/g,"")).filter(Boolean),partKey:o.length>1?o:void 0,displayPartKey:s.length>1?s:void 0,commandName:i,displayName:n,candidate:r,aliasKey:r.aliases}});this.fuse=new So(t,{includeScore:!0,threshold:0.3,location:0,distance:100,keys:[{name:"commandName",weight:3},{name:"displayName",weight:2},{name:"partKey",weight:2},{name:"aliasKey",weight:2},{name:"displayPartKey",weight:1},{name:"descriptionKey",weight:0.5}]})}search(e,t){let{getScoreBoost:r,filter:i}=t??{},n=e.trim().toLowerCase(),o=this.fuse.search(n);if(i)o=o.filter((h)=>i(h.item.candidate));return o.map((h)=>{let m=h.item.commandName.toLowerCase(),v=h.item.displayName.toLowerCase(),g=h.item.aliasKey?.map((x)=>x.toLowerCase())??[],S=r?r(h.item.candidate):0;return{r:h,name:m,display:v,aliases:g,boost:S}}).sort((h,m)=>{let v=h.name,g=m.name,S=h.aliases,x=m.aliases,k=v===n||h.display===n,T=g===n||m.display===n;if(k&&!T)return-1;if(T&&!k)return 1;let E=S.some((J)=>J===n),P=x.some((J)=>J===n);if(E&&!P)return-1;if(P&&!E)return 1;let R=(J,a)=>Math.min(J.startsWith(n)?J.length:1/0,a.startsWith(n)?a.length:1/0),I=R(v,h.display),O=R(g,m.display),D=I<1/0,H=O<1/0;if(D&&!H)return-1;if(H&&!D)return 1;if(D&&H&&I!==O)return I-O;let G=S.find((J)=>J.startsWith(n)),oe=x.find((J)=>J.startsWith(n));if(G&&!oe)return-1;if(oe&&!G)return 1;if(G&&oe&&G.length!==oe.length)return G.length-oe.length;let ee=Math.floor((h.r.score??0)*10),F=Math.floor((m.r.score??0)*10);if(ee!==F)return ee-F;return m.boost-h.boost}).map((h)=>h.r.item.candidate)}}function ma(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((d,h,m)=>{d?.removeEventListener("abort",h),m()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}function wv(){if(typeof setImmediate==="function")return new Promise((e)=>setImmediate(e));if(typeof MessageChannel==="function")return new Promise((e)=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),e()},t.port2.postMessage(null)});return ma(0)}var ME=16,RE=8,R7=6,P7=4,PE=8,I7=3,C7=1,$7=100,EE=64,TE=4;class xv{paths=[];lowerPaths=[];charBits=new Int32Array(0);pathLens=new Uint16Array(0);topLevelCache=null;matchPositions=new Int32Array(EE);readyCount=0;buildGen=0;loadFromFileList(e){let t=new Set,r=[];for(let i of e)if(i.length>0&&!t.has(i))t.add(i),r.push(i);this.buildIndex(r)}loadFromFileListAsync(e){let t=()=>{},r=new Promise((n)=>{t=n}),i=this.buildAsync(e,t);return{queryable:r,done:i}}async buildAsync(e,t){let r=++this.buildGen,i=new Set,n=[],o=performance.now();for(let d=0;d<e.length;d++){let h=e[d];if(h.length>0&&!i.has(h))i.add(h),n.push(h);if((d&255)===255&&performance.now()-o>TE){if(await wv(),this.buildGen!==r)return t(),!1;o=performance.now()}}this.resetArrays(n),o=performance.now();let s=!0;for(let d=0;d<n.length;d++)if(this.indexPath(d),(d&255)===255&&performance.now()-o>TE){if(this.readyCount=d+1,s)t(),s=!1;if(await wv(),this.buildGen!==r)return!1;o=performance.now()}return this.readyCount=n.length,t(),!0}buildIndex(e){this.buildGen++,this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=z7(e,$7)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let r=t.length;this.pathLens[e]=r;let i=0;for(let n=0;n<r;n++){let o=t.charCodeAt(n);if(o>=97&&o<=122)i|=1<<o-97}this.charBits[e]=i}search(e,t){if(t<=0)return[];if(e.length===0){if(this.topLevelCache)return this.topLevelCache.slice(0,t).map(({path:I,score:O})=>({path:I,score:O,positions:[]}));return[]}let r=e!==e.toLowerCase(),i=r?e:e.toLowerCase(),n=Math.min(i.length,EE),o=Array(n),s=0;for(let I=0;I<n;I++){let O=i.charAt(I);o[I]=O;let D=O.charCodeAt(0);if(D>=97&&D<=122)s|=1<<D-97}let d=n*(ME+RE)+PE+32,h=[],m=-1/0,{paths:v,lowerPaths:g,charBits:S,pathLens:x,readyCount:k}=this,T=this.matchPositions;e:for(let I=0;I<k;I++){if((S[I]&s)!==s)continue;let O=r?v[I]:g[I],D=O.indexOf(o[0]);if(D===-1)continue;T[0]=D;let H=0,G=0,oe=D;for(let a=1;a<n;a++){if(D=O.indexOf(o[a],oe+1),D===-1)continue e;T[a]=D;let c=D-oe-1;if(c===0)G+=P7;else H+=I7+c*C7;oe=D}if(h.length===t&&d+G-H<=m)continue;let ee=v[I],F=x[I],J=n*ME+G-H;J+=AE(ee,T[0],!0);for(let a=1;a<n;a++)J+=AE(ee,T[a],!1);if(J+=Math.max(0,32-(F>>2)),h.length<t){if(h.push({pathIndex:I,fuzzScore:J}),h.length===t)h.sort((a,c)=>a.fuzzScore-c.fuzzScore),m=h[0].fuzzScore}else if(J>m){let a=0,c=h.length;while(a<c){let p=a+c>>1;if(h[p].fuzzScore<J)a=p+1;else c=p}h.splice(a,0,{pathIndex:I,fuzzScore:J}),h.shift(),m=h[0].fuzzScore}}h.sort((I,O)=>O.fuzzScore-I.fuzzScore);let E=h.length,P=Math.max(E,1),R=Array(E);for(let I=0;I<E;I++){let O=h[I].pathIndex,D=v[O],H=g[O],G=r?D:H,oe=Array(n),ee=0;for(let a=0;a<n;a++){let c=G.indexOf(o[a],ee);oe[a]=c,ee=c+1}if(!r&&H.length!==D.length)L7(D,oe);let F=I/P,J=D.includes("test")?Math.min(F*1.05,1):F;R[I]={path:D,score:J,positions:oe}}return R}}function AE(e,t,r){if(t===0)return r?PE:0;let i=e.charCodeAt(t-1);if(O7(i))return RE;if(D7(i)&&N7(e.charCodeAt(t)))return R7;return 0}function O7(e){return e===47||e===92||e===45||e===95||e===46||e===32}function D7(e){return e>=97&&e<=122}function N7(e){return e>=65&&e<=90}function L7(e,t){let r=0,i=0,n=0;while(n<t.length&&r<e.length){let o=e.codePointAt(r),s=o>65535?2:1,d=String.fromCodePoint(o).toLowerCase().length;while(n<t.length&&t[n]<i+d)t[n]=r,n++;r+=s,i+=d}}function z7(e,t){let r=new Set;for(let n of e){let o=n.length;for(let d=0;d<n.length;d++){let h=n.charCodeAt(d);if(h===47||h===92){o=d;break}}let s=n.slice(0,o);if(s.length>0){if(r.add(s),r.size>=t)break}}let i=Array.from(r);return i.sort((n,o)=>{let s=n.length-o.length;if(s!==0)return s;return n<o?-1:n>o?1:0}),i.slice(0,t).map((n)=>({path:n,score:0,positions:[]}))}class li extends Error{}var U7=["signed_out","identity_changed","transient","refresh_failed"];function IE(e){return U7.some((t)=>t===e)}var{writeFileSync:Bke}=(()=>({}));var wu=function(){return"/"};dn();var Mu=()=>globalThis.crypto.randomUUID();pn();pn();function ab(e){return e}var aT="[\\w-]{1,63}",qU=new RegExp(`^${aT}$`);var Yae=new RegExp(`^a(?:${aT}-)?[0-9a-f]{16}$`);function lT(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=sb("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var HU="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function uT(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?lT(e,HU):null}function KU(){this.__data__=[],this.size=0}var cT=KU;function WU(e,t){return e===t||e!==e&&t!==t}var xh=WU;function ZU(e,t){var r=e.length;while(r--)if(xh(e[r][0],t))return r;return-1}var Mo=ZU;var VU=Array.prototype,GU=VU.splice;function JU(e){var t=this.__data__,r=Mo(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else GU.call(t,r,1);return--this.size,!0}var dT=JU;function XU(e){var t=this.__data__,r=Mo(t,e);return r<0?void 0:t[r][1]}var fT=XU;function YU(e){return Mo(this.__data__,e)>-1}var hT=YU;function QU(e,t){var r=this.__data__,i=Mo(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var pT=QU;function wa(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}wa.prototype.clear=cT;wa.prototype.delete=dT;wa.prototype.get=fT;wa.prototype.has=hT;wa.prototype.set=pT;var Eo=wa;function eF(){this.__data__=new Eo,this.size=0}var mT=eF;function tF(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var gT=tF;function rF(e){return this.__data__.get(e)}var yT=rF;function nF(e){return this.__data__.has(e)}var vT=nF;var iF=typeof global=="object"&&global&&global.Object===Object&&global,kh=iF;var oF=typeof self=="object"&&self&&self.Object===Object&&self,sF=kh||oF||Function("return this")(),Fr=sF;var aF=Fr.Symbol,Jn=aF;var bT=Object.prototype,{hasOwnProperty:lF,toString:uF}=bT,Uu=Jn?Jn.toStringTag:void 0;function cF(e){var t=lF.call(e,Uu),r=e[Uu];try{e[Uu]=void 0;var i=!0}catch(o){}var n=uF.call(e);if(i)if(t)e[Uu]=r;else delete e[Uu];return n}var _T=cF;var dF=Object.prototype,fF=dF.toString;function hF(e){return fF.call(e)}var ST=hF;var pF="[object Null]",mF="[object Undefined]",wT=Jn?Jn.toStringTag:void 0;function gF(e){if(e==null)return e===void 0?mF:pF;return wT&&wT in Object(e)?_T(e):ST(e)}var ui=gF;function yF(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var xa=yF;var vF="[object AsyncFunction]",bF="[object Function]",_F="[object GeneratorFunction]",SF="[object Proxy]";function wF(e){if(!xa(e))return!1;var t=ui(e);return t==bF||t==_F||t==vF||t==SF}var Mh=wF;var xF=Fr["__core-js_shared__"],Eh=xF;var xT=function(){var e=/[^.]+$/.exec(Eh&&Eh.keys&&Eh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function kF(e){return!!xT&&xT in e}var kT=kF;var MF=Function.prototype,EF=MF.toString;function TF(e){if(e!=null){try{return EF.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var io=TF;var AF=/[\\^$.*+?()[\]{}|]/g,RF=/^\[object .+?Constructor\]$/,PF=Function.prototype,IF=Object.prototype,CF=PF.toString,$F=IF.hasOwnProperty,OF=RegExp("^"+CF.call($F).replace(AF,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function DF(e){if(!xa(e)||kT(e))return!1;var t=Mh(e)?OF:RF;return t.test(io(e))}var MT=DF;function NF(e,t){return e==null?void 0:e[t]}var ET=NF;function LF(e,t){var r=ET(e,t);return MT(r)?r:void 0}var Mn=LF;var zF=Mn(Fr,"Map"),To=zF;var UF=Mn(Object,"create"),oo=UF;function FF(){this.__data__=oo?oo(null):{},this.size=0}var TT=FF;function jF(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var AT=jF;var BF="__lodash_hash_undefined__",qF=Object.prototype,HF=qF.hasOwnProperty;function KF(e){var t=this.__data__;if(oo){var r=t[e];return r===BF?void 0:r}return HF.call(t,e)?t[e]:void 0}var RT=KF;var WF=Object.prototype,ZF=WF.hasOwnProperty;function VF(e){var t=this.__data__;return oo?t[e]!==void 0:ZF.call(t,e)}var PT=VF;var GF="__lodash_hash_undefined__";function JF(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oo&&t===void 0?GF:t,this}var IT=JF;function ka(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}ka.prototype.clear=TT;ka.prototype.delete=AT;ka.prototype.get=RT;ka.prototype.has=PT;ka.prototype.set=IT;var lb=ka;function XF(){this.size=0,this.__data__={hash:new lb,map:new(To||Eo),string:new lb}}var CT=XF;function YF(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var $T=YF;function QF(e,t){var r=e.__data__;return $T(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ao=QF;function ej(e){var t=Ao(this,e).delete(e);return this.size-=t?1:0,t}var OT=ej;function tj(e){return Ao(this,e).get(e)}var DT=tj;function rj(e){return Ao(this,e).has(e)}var NT=rj;function nj(e,t){var r=Ao(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var LT=nj;function Ma(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Ma.prototype.clear=CT;Ma.prototype.delete=OT;Ma.prototype.get=DT;Ma.prototype.has=NT;Ma.prototype.set=LT;var Es=Ma;var ij=200;function oj(e,t){var r=this.__data__;if(r instanceof Eo){var i=r.__data__;if(!To||i.length<ij-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Es(i)}return r.set(e,t),this.size=r.size,this}var zT=oj;function Ea(e){var t=this.__data__=new Eo(e);this.size=t.size}Ea.prototype.clear=mT;Ea.prototype.delete=gT;Ea.prototype.get=yT;Ea.prototype.has=vT;Ea.prototype.set=zT;var Ta=Ea;var sj="__lodash_hash_undefined__";function aj(e){return this.__data__.set(e,sj),this}var UT=aj;function lj(e){return this.__data__.has(e)}var FT=lj;function Th(e){var t=-1,r=e==null?0:e.length;this.__data__=new Es;while(++t<r)this.add(e[t])}Th.prototype.add=Th.prototype.push=UT;Th.prototype.has=FT;var jT=Th;function uj(e,t){var r=-1,i=e==null?0:e.length;while(++r<i)if(t(e[r],r,e))return!0;return!1}var BT=uj;function cj(e,t){return e.has(t)}var qT=cj;var dj=1,fj=2;function hj(e,t,r,i,n,o){var s=r&dj,d=e.length,h=t.length;if(d!=h&&!(s&&h>d))return!1;var m=o.get(e),v=o.get(t);if(m&&v)return m==t&&v==e;var g=-1,S=!0,x=r&fj?new jT:void 0;o.set(e,t),o.set(t,e);while(++g<d){var k=e[g],T=t[g];if(i)var E=s?i(T,k,g,t,e,o):i(k,T,g,e,t,o);if(E!==void 0){if(E)continue;S=!1;break}if(x){if(!BT(t,function(P,R){if(!qT(x,R)&&(k===P||n(k,P,r,i,o)))return x.push(R)})){S=!1;break}}else if(!(k===T||n(k,T,r,i,o))){S=!1;break}}return o.delete(e),o.delete(t),S}var Ah=hj;var pj=Fr.Uint8Array,ub=pj;function mj(e){var t=-1,r=Array(e.size);return e.forEach(function(i,n){r[++t]=[n,i]}),r}var HT=mj;function gj(e){var t=-1,r=Array(e.size);return e.forEach(function(i){r[++t]=i}),r}var KT=gj;var yj=1,vj=2,bj="[object Boolean]",_j="[object Date]",Sj="[object Error]",wj="[object Map]",xj="[object Number]",kj="[object RegExp]",Mj="[object Set]",Ej="[object String]",Tj="[object Symbol]",Aj="[object ArrayBuffer]",Rj="[object DataView]",WT=Jn?Jn.prototype:void 0,cb=WT?WT.valueOf:void 0;function Pj(e,t,r,i,n,o,s){switch(r){case Rj:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Aj:if(e.byteLength!=t.byteLength||!o(new ub(e),new ub(t)))return!1;return!0;case bj:case _j:case xj:return xh(+e,+t);case Sj:return e.name==t.name&&e.message==t.message;case kj:case Ej:return e==t+"";case wj:var d=HT;case Mj:var h=i&yj;if(d||(d=KT),e.size!=t.size&&!h)return!1;var m=s.get(e);if(m)return m==t;i|=vj,s.set(e,t);var v=Ah(d(e),d(t),i,n,o,s);return s.delete(e),v;case Tj:if(cb)return cb.call(e)==cb.call(t)}return!1}var ZT=Pj;function Ij(e,t){var r=-1,i=t.length,n=e.length;while(++r<i)e[n+r]=t[r];return e}var VT=Ij;var Cj=Array.isArray,Kr=Cj;function $j(e,t,r){var i=t(e);return Kr(e)?i:VT(i,r(e))}var GT=$j;function Oj(e,t){var r=-1,i=e==null?0:e.length,n=0,o=[];while(++r<i){var s=e[r];if(t(s,r,e))o[n++]=s}return o}var JT=Oj;function Dj(){return[]}var XT=Dj;var Nj=Object.prototype,Lj=Nj.propertyIsEnumerable,YT=Object.getOwnPropertySymbols,zj=!YT?XT:function(e){if(e==null)return[];return e=Object(e),JT(YT(e),function(t){return Lj.call(e,t)})},QT=zj;function Uj(e,t){var r=-1,i=Array(e);while(++r<e)i[r]=t(r);return i}var eA=Uj;function Fj(e){return e!=null&&typeof e=="object"}var ci=Fj;var jj="[object Arguments]";function Bj(e){return ci(e)&&ui(e)==jj}var db=Bj;var tA=Object.prototype,{hasOwnProperty:qj,propertyIsEnumerable:Hj}=tA,Kj=db(function(){return arguments}())?db:function(e){return ci(e)&&qj.call(e,"callee")&&!Hj.call(e,"callee")},Rh=Kj;var Ih={};cn(Ih,{default:()=>Aa});function Wj(){return!1}var rA=Wj;var oA=typeof Ih=="object"&&Ih&&!Ih.nodeType&&Ih,nA=oA&&typeof Ph=="object"&&Ph&&!Ph.nodeType&&Ph,Zj=nA&&nA.exports===oA,iA=Zj?Fr.Buffer:void 0,Vj=iA?iA.isBuffer:void 0,Gj=Vj||rA,Aa=Gj;var Jj=9007199254740991,Xj=/^(?:0|[1-9]\d*)$/;function Yj(e,t){var r=typeof e;return t=t==null?Jj:t,!!t&&(r=="number"||r!="symbol"&&Xj.test(e))&&(e>-1&&e%1==0&&e<t)}var Ch=Yj;var Qj=9007199254740991;function eB(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Qj}var Ra=eB;var tB="[object Arguments]",rB="[object Array]",nB="[object Boolean]",iB="[object Date]",oB="[object Error]",sB="[object Function]",aB="[object Map]",lB="[object Number]",uB="[object Object]",cB="[object RegExp]",dB="[object Set]",fB="[object String]",hB="[object WeakMap]",pB="[object ArrayBuffer]",mB="[object DataView]",gB="[object Float32Array]",yB="[object Float64Array]",vB="[object Int8Array]",bB="[object Int16Array]",_B="[object Int32Array]",SB="[object Uint8Array]",wB="[object Uint8ClampedArray]",xB="[object Uint16Array]",kB="[object Uint32Array]",Gt={};Gt[gB]=Gt[yB]=Gt[vB]=Gt[bB]=Gt[_B]=Gt[SB]=Gt[wB]=Gt[xB]=Gt[kB]=!0;Gt[tB]=Gt[rB]=Gt[pB]=Gt[nB]=Gt[mB]=Gt[iB]=Gt[oB]=Gt[sB]=Gt[aB]=Gt[lB]=Gt[uB]=Gt[cB]=Gt[dB]=Gt[fB]=Gt[hB]=!1;function MB(e){return ci(e)&&Ra(e.length)&&!!Gt[ui(e)]}var sA=MB;function EB(e){return function(t){return e(t)}}var aA=EB;var Oh={};cn(Oh,{default:()=>Dh});var lA=typeof Oh=="object"&&Oh&&!Oh.nodeType&&Oh,Fu=lA&&typeof $h=="object"&&$h&&!$h.nodeType&&$h,TB=Fu&&Fu.exports===lA,fb=TB&&kh.process,AB=function(){try{var e=Fu&&Fu.require&&Fu.require("util").types;if(e)return e;return fb&&fb.binding&&fb.binding("util")}catch(t){}}(),Dh=AB;var uA=Dh&&Dh.isTypedArray,RB=uA?aA(uA):sA,Nh=RB;var PB=Object.prototype,IB=PB.hasOwnProperty;function CB(e,t){var r=Kr(e),i=!r&&Rh(e),n=!r&&!i&&Aa(e),o=!r&&!i&&!n&&Nh(e),s=r||i||n||o,d=s?eA(e.length,String):[],h=d.length;for(var m in e)if((t||IB.call(e,m))&&!(s&&(m=="length"||n&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||Ch(m,h))))d.push(m);return d}var cA=CB;var $B=Object.prototype;function OB(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||$B;return e===r}var dA=OB;function DB(e,t){return function(r){return e(t(r))}}var fA=DB;var NB=fA(Object.keys,Object),hA=NB;var LB=Object.prototype,zB=LB.hasOwnProperty;function UB(e){if(!dA(e))return hA(e);var t=[];for(var r in Object(e))if(zB.call(e,r)&&r!="constructor")t.push(r);return t}var pA=UB;function FB(e){return e!=null&&Ra(e.length)&&!Mh(e)}var mA=FB;function jB(e){return mA(e)?cA(e):pA(e)}var Pa=jB;function BB(e){return GT(e,Pa,QT)}var hb=BB;var qB=1,HB=Object.prototype,KB=HB.hasOwnProperty;function WB(e,t,r,i,n,o){var s=r&qB,d=hb(e),h=d.length,m=hb(t),v=m.length;if(h!=v&&!s)return!1;var g=h;while(g--){var S=d[g];if(!(s?S in t:KB.call(t,S)))return!1}var x=o.get(e),k=o.get(t);if(x&&k)return x==t&&k==e;var T=!0;o.set(e,t),o.set(t,e);var E=s;while(++g<h){S=d[g];var P=e[S],R=t[S];if(i)var I=s?i(R,P,S,t,e,o):i(P,R,S,e,t,o);if(!(I===void 0?P===R||n(P,R,r,i,o):I)){T=!1;break}E||(E=S=="constructor")}if(T&&!E){var O=e.constructor,D=t.constructor;if(O!=D&&(("constructor"in e)&&("constructor"in t))&&!(typeof O=="function"&&O instanceof O&&typeof D=="function"&&D instanceof D))T=!1}return o.delete(e),o.delete(t),T}var gA=WB;var ZB=Mn(Fr,"DataView"),Lh=ZB;var VB=Mn(Fr,"Promise"),zh=VB;var GB=Mn(Fr,"Set"),Uh=GB;var JB=Mn(Fr,"WeakMap"),Fh=JB;var yA="[object Map]",XB="[object Object]",vA="[object Promise]",bA="[object Set]",_A="[object WeakMap]",SA="[object DataView]",YB=io(Lh),QB=io(To),eq=io(zh),tq=io(Uh),rq=io(Fh),Ts=ui;if(Lh&&Ts(new Lh(new ArrayBuffer(1)))!=SA||To&&Ts(new To)!=yA||zh&&Ts(zh.resolve())!=vA||Uh&&Ts(new Uh)!=bA||Fh&&Ts(new Fh)!=_A)Ts=function(e){var t=ui(e),r=t==XB?e.constructor:void 0,i=r?io(r):"";if(i)switch(i){case YB:return SA;case QB:return yA;case eq:return vA;case tq:return bA;case rq:return _A}return t};var pb=Ts;var nq=1,wA="[object Arguments]",xA="[object Array]",jh="[object Object]",iq=Object.prototype,kA=iq.hasOwnProperty;function oq(e,t,r,i,n,o){var s=Kr(e),d=Kr(t),h=s?xA:pb(e),m=d?xA:pb(t);h=h==wA?jh:h,m=m==wA?jh:m;var v=h==jh,g=m==jh,S=h==m;if(S&&Aa(e)){if(!Aa(t))return!1;s=!0,v=!1}if(S&&!v)return o||(o=new Ta),s||Nh(e)?Ah(e,t,r,i,n,o):ZT(e,t,h,r,i,n,o);if(!(r&nq)){var x=v&&kA.call(e,"__wrapped__"),k=g&&kA.call(t,"__wrapped__");if(x||k){var T=x?e.value():e,E=k?t.value():t;return o||(o=new Ta),n(T,E,r,i,o)}}if(!S)return!1;return o||(o=new Ta),gA(e,t,r,i,n,o)}var MA=oq;function EA(e,t,r,i,n){if(e===t)return!0;if(e==null||t==null||!ci(e)&&!ci(t))return e!==e&&t!==t;return MA(e,t,r,i,EA,n)}var Ia=EA;function sq(e,t){return Ia(e,t)}var Ca=sq;dn();var aq;function so(){return aq===!0}class di{#e;#t=new WeakMap;constructor(e){this.#e=e}of(e){let t=this.#t.get(e);if(t!==void 0)return t;let r=this.#e();return this.#t.set(e,r),r}}var TA=globalThis.process?.getBuiltinModule?.("async_hooks"),mb=TA?(e)=>TA.AsyncResource.bind(e):(e)=>e;function $a(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function ir(){let e=new Set;return{subscribe(t){let r=mb(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}class AA{mergedSettings=null;perSource=new Map;parsedFiles=new Map;folderListings=new Map;managedFileReads=new Map;primedFiles=new Set;policyWalks=0;walkedFolders=new Map;policy={};lastPolicyEnvComposition=null;isLoadingFromDisk=!1;autoModeUntrustedSourceWarned=!1;changed=ir();internalWrites=new Map;enabledSources;pluginBase;epoch=0;systemSpaceServingLogged=!1;systemAttestationContradicted=!1;backendReadResetTail=Promise.resolve();backgroundWorkTail=Promise.resolve();invalidated=ir();pluginBaseLoaded=!1;primer;localStoreProbes=new RA;retained=new Map;retainedListings=new Map;setPluginBase(e){this.pluginBase=e,this.pluginBaseLoaded=!0}clearPluginBase(){this.pluginBase=void 0}invalidateAll(e){if(this.epoch++,this.mergedSettings=null,this.perSource.clear(),this.parsedFiles.clear(),this.primedFiles.clear(),this.policyWalks=0,this.walkedFolders.clear(),this.folderListings.clear(),this.policy={},e?.userLayer==="retain"&&so()&&this.primer!==void 0){for(let[t,r]of this.retained)this.parsedFiles.set(t,r.parsed),this.primedFiles.add(t);for(let[t,r]of this.retainedListings)this.folderListings.set(t,r.names)}else this.retained.clear(),this.retainedListings.clear();this.invalidated.emit()}invalidatePolicyLayer(){this.mergedSettings=null,this.perSource.delete("policySettings"),this.policy={}}onInvalidate(e){return this.invalidated.subscribe(e)}seedParsedFile(e,t,r,i){if(i!==this.epoch)return!1;let n=this.parsedFiles.get(e),o=n===void 0||!Ca(n,r);if(this.parsedFiles.set(e,r),o||this.primedFiles.has(e))this.primedFiles.add(e);let s=this.retained.get(e);if(s!==void 0)s.parsed=r;if(o)this.dropDerivedCaches(t);return!0}walkReadDiffers(e,t){let r=this.parsedFiles.get(e);return r!==void 0&&!this.primedFiles.has(e)&&!Ca(r,t)}unseedParsedFile(e,t,r){if(r!==this.epoch)return;if(this.retained.delete(e),!this.primedFiles.has(e)||t==="policySettings"&&this.policyWalks>0)return;this.primedFiles.delete(e),this.parsedFiles.delete(e),this.dropDerivedCaches(t)}dropDerivedCaches(e){if(this.perSource.delete(e),this.mergedSettings=null,e==="policySettings")this.policy={}}primedFolderListing(e){return so()?this.folderListings.get(e):void 0}folderListingForPolicyWalk(e){if(!so())return;this.policyWalks++;let t=this.folderListings.get(e);if(!this.walkedFolders.has(e)||t!==void 0)this.walkedFolders.set(e,t??null);return t}noteWalkListing(e,t){if(!so())return;this.walkedFolders.set(e,t)}get policyWalkCount(){return this.policyWalks}policyInstallVerdict(e,t,r){let i=this.parsedFiles.get(e);if(i===void 0||Ca(i,t))return"install";if(!this.primedFiles.has(e))return"raced";if(this.policyWalks===0)return"install";return this.policyWalks>r?"raced":"deferred"}folderInstallVerdict(e,t,r){if(!this.walkedFolders.has(e))return this.hasParsedDropInOutside(e,t)?"raced":"install";let i=this.walkedFolders.get(e);if(i!==null&&i!==void 0&&Ca(i,t))return"install";return this.policyWalks>r?"raced":"deferred"}seedFolderListing(e,t,r){if(r!==this.epoch)return!1;let i=this.folderListings.get(e);this.folderListings.set(e,t);let n=this.retainedListings.get(e);if(n!==void 0)n.names=t;if(i!==void 0&&!Ca(i,t))this.dropDerivedCaches("policySettings");return!0}walkReadManagedFileIn(e,t){for(let[r,i]of this.parsedFiles)if(!r.includes("\x00")&&!this.primedFiles.has(r)&&(i.settings!==null||i.errors.length>0)&&(r===e||rn(r)===t))return!0;return!1}walkRead(e){return this.parsedFiles.has(e)&&!this.primedFiles.has(e)}hasParsedDropInOutside(e,t){for(let r of this.parsedFiles.keys())if(!r.includes("\x00")&&!this.primedFiles.has(r)&&rn(r)===e&&!t.includes(vs(r)))return!0;return!1}clearFolderListing(e,t){if(t!==this.epoch)return;if(this.retainedListings.delete(e),!this.folderListings.has(e)||this.walkedFolders.has(e))return;this.folderListings.delete(e),this.dropDerivedCaches("policySettings")}retainLayer(e,t){let r={parsed:t};return this.retained.set(e,r),()=>{if(this.retained.get(e)===r)this.retained.delete(e)}}dropRetainedLayer(e){this.retained.delete(e)}retainFolderListing(e,t){let r={names:t};return this.retainedListings.set(e,r),()=>{if(this.retainedListings.get(e)===r)this.retainedListings.delete(e)}}}class RA{ownerUidsByRoot=new Map;realHomeDir=void 0;canonicalRootOwnerUids(e,t){let r=this.ownerUidsByRoot.get(e);if(r!==void 0)return r;let i=t(e);return this.ownerUidsByRoot.set(e,i),i}hasCanonicalRootOwnerUids(e){return this.ownerUidsByRoot.has(e)}primeCanonicalRootOwnerUids(e,t){if(this.ownerUidsByRoot.has(e))return!1;return this.ownerUidsByRoot.set(e,t),!0}clearCanonicalRootOwnerUids(){this.ownerUidsByRoot.clear()}normalizedRealHomeDir(e){return this.realHomeDir??=e(),this.realHomeDir}clearNormalizedRealHomeDir(){this.realHomeDir=void 0}}var uq=new di(()=>new AA);function Bh(){return{sent:new Set,rejected:new Set,declaredTools:void 0,declaredToolsDecided:!1,readsTranscriptRecord:!0,nameOnlyAnnouncements:new Set,surfacedOnWire:new Set,advisorHeld:void 0}}function gb(e){let t=Bh();return t.declaredTools=e.declaredTools,t.declaredToolsDecided=e.declaredToolsDecided,t.readsTranscriptRecord=e.readsTranscriptRecord,t.advisorHeld=e.advisorHeld,t}var{realpathSync:IA}=(()=>({}));var PA=function(){return"/"};function CA(e){return process.platform==="darwin"?e.normalize("NFC"):e}function yb(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof IA==="function")try{let t=PA();try{e=CA(IA(t))}catch{e=CA(t)}}catch{}return e}var $A=yb(),qfe=(()=>{if(typeof process>"u"||typeof process.cwd!=="function")return null;try{return process.cwd()}catch{return null}})();class vb{spawner=void 0;pairings=new Map;mainEnsureInFlight=!1;mainSlotBlocked=!1}class bb{#e=Bh();#t=void 0;stickyBetas(){return this.#e}unlatchStickyBetas(){this.#e=gb(this.#e)}atisLatch(){return this.#t}replaceAtisLatch(e){this.#t=e}reset(){this.#e=Bh(),this.#t=void 0}}var cq=function(){try{var e=Mn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),_b=cq;function dq(e,t,r){if(t=="__proto__"&&_b)_b(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0});else e[t]=r}var OA=dq;function fq(e){return function(t,r,i){var n=-1,o=Object(t),s=i(t),d=s.length;while(d--){var h=s[e?d:++n];if(r(o[h],h,o)===!1)break}return t}}var DA=fq;var hq=DA(),NA=hq;function pq(e,t){return e&&NA(e,t,Pa)}var LA=pq;var mq=1,gq=2;function yq(e,t,r,i){var n=r.length,o=n,s=!i;if(e==null)return!o;e=Object(e);while(n--){var d=r[n];if(s&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}while(++n<o){d=r[n];var h=d[0],m=e[h],v=d[1];if(s&&d[2]){if(m===void 0&&!(h in e))return!1}else{var g=new Ta;if(i)var S=i(m,v,h,e,t,g);if(!(S===void 0?Ia(v,m,mq|gq,i,g):S))return!1}}return!0}var zA=yq;function vq(e){return e===e&&!xa(e)}var qh=vq;function bq(e){var t=Pa(e),r=t.length;while(r--){var i=t[r],n=e[i];t[r]=[i,n,qh(n)]}return t}var UA=bq;function _q(e,t){return function(r){if(r==null)return!1;return r[e]===t&&(t!==void 0||(e in Object(r)))}}var Hh=_q;function Sq(e){var t=UA(e);if(t.length==1&&t[0][2])return Hh(t[0][0],t[0][1]);return function(r){return r===e||zA(r,e,t)}}var FA=Sq;var wq="[object Symbol]";function xq(e){return typeof e=="symbol"||ci(e)&&ui(e)==wq}var Oa=xq;var kq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mq=/^\w*$/;function Eq(e,t){if(Kr(e))return!1;var r=typeof e;if(r=="number"||r=="symbol"||r=="boolean"||e==null||Oa(e))return!0;return Mq.test(e)||!kq.test(e)||t!=null&&e in Object(t)}var Da=Eq;var Tq="Expected a function";function Sb(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(Tq);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Sb.Cache||Es),r}Sb.Cache=Es;var ju=Sb;var Aq=500;function Rq(e){var t=ju(e,function(i){if(r.size===Aq)r.clear();return i}),r=t.cache;return t}var jA=Rq;var Pq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Iq=/\\(\\)?/g,Cq=jA(function(e){var t=[];if(e.charCodeAt(0)===46)t.push("");return e.replace(Pq,function(r,i,n,o){t.push(n?o.replace(Iq,"$1"):i||r)}),t}),BA=Cq;function $q(e,t){var r=-1,i=e==null?0:e.length,n=Array(i);while(++r<i)n[r]=t(e[r],r,e);return n}var qA=$q;var Oq=1/0,HA=Jn?Jn.prototype:void 0,KA=HA?HA.toString:void 0;function WA(e){if(typeof e=="string")return e;if(Kr(e))return qA(e,WA)+"";if(Oa(e))return KA?KA.call(e):"";var t=e+"";return t=="0"&&1/e==-Oq?"-0":t}var ZA=WA;function Dq(e){return e==null?"":ZA(e)}var VA=Dq;function Nq(e,t){if(Kr(e))return e;return Da(e,t)?[e]:BA(VA(e))}var Kh=Nq;var Lq=1/0;function zq(e){if(typeof e=="string"||Oa(e))return e;var t=e+"";return t=="0"&&1/e==-Lq?"-0":t}var Ro=zq;function Uq(e,t){t=Kh(t,e);var r=0,i=t.length;while(e!=null&&r<i)e=e[Ro(t[r++])];return r&&r==i?e:void 0}var Wh=Uq;function Fq(e,t,r){var i=e==null?void 0:Wh(e,t);return i===void 0?r:i}var GA=Fq;function jq(e,t){return e!=null&&t in Object(e)}var JA=jq;function Bq(e,t,r){t=Kh(t,e);var i=-1,n=t.length,o=!1;while(++i<n){var s=Ro(t[i]);if(!(o=e!=null&&r(e,s)))break;e=e[s]}if(o||++i!=n)return o;return n=e==null?0:e.length,!!n&&Ra(n)&&Ch(s,n)&&(Kr(e)||Rh(e))}var XA=Bq;function qq(e,t){return e!=null&&XA(e,t,JA)}var YA=qq;var Hq=1,Kq=2;function Wq(e,t){if(Da(e)&&qh(t))return Hh(Ro(e),t);return function(r){var i=GA(r,e);return i===void 0&&i===t?YA(r,e):Ia(t,i,Hq|Kq)}}var QA=Wq;function Zq(e){return e}var eR=Zq;function Vq(e){return function(t){return t==null?void 0:t[e]}}var tR=Vq;function Gq(e){return function(t){return Wh(t,e)}}var rR=Gq;function Jq(e){return Da(e)?tR(Ro(e)):rR(e)}var nR=Jq;function Xq(e){if(typeof e=="function")return e;if(e==null)return eR;if(typeof e=="object")return Kr(e)?QA(e[0],e[1]):FA(e);return nR(e)}var Zh=Xq;function Yq(e,t){var r={};return t=Zh(t,3),LA(e,function(i,n,o){OA(r,n,t(i,n,o))}),r}var wb=Yq;function Qq(e,t){var r,i=-1,n=e.length;while(++i<n){var o=t(e[i]);if(o!==void 0)r=r===void 0?o:r+o}return r}var iR=Qq;function eH(e,t){return e&&e.length?iR(e,Zh(t,2)):0}var Na=eH;function Vh(e){let t=Object.create(null);return Object.assign(t,e)}class xb{#e=0;#t=0;#r=0;#n=0;#i=Date.now();#o=void 0;#u=0;#l=0;#s=0;#c=!1;#a=Vh();#f=null;#h=null;#d=null;totalCostUSD(){return this.#e}restoredCostUSD(){return this.#s}totalAPIDuration(){return this.#t}totalAPIDurationWithoutRetries(){return this.#r}totalToolDuration(){return this.#n}totalDuration(){return Math.max(0,Date.now()-this.#i)}sessionStartTime(){return this.#o??this.#i}totalLinesAdded(){return this.#u}totalLinesRemoved(){return this.#l}hasUnknownModelCost(){return this.#c}modelUsage(){return this.#a}usageForModel(e){return this.#a[e]}totalInputTokens(){return Na(Object.values(this.#a),"inputTokens")}totalOutputTokens(){return Na(Object.values(this.#a),"outputTokens")}totalCacheReadInputTokens(){return Na(Object.values(this.#a),"cacheReadInputTokens")}totalCacheCreationInputTokens(){return Na(Object.values(this.#a),"cacheCreationInputTokens")}totalWebSearchRequests(){return Na(Object.values(this.#a),"webSearchRequests")}recordApiDuration(e,t){this.#t+=e,this.#r+=t}recordCost(e,t,r){this.#a[r]=t,this.#e+=e}recordToolDuration(e){this.#n+=e}recordLinesChanged(e,t){this.#u+=e,this.#l+=t}markUnknownModelCost(){this.#c=!0}zeroDurationsAndCostForTests(){this.#t=0,this.#r=0,this.#e=0,this.#s=0}restartClock(){this.#i=Date.now(),this.anchorLogicalStart(void 0)}anchorLogicalStart(e){this.#o=e===void 0?void 0:Math.min(e,this.#i)}restore({totalCostUSD:e,totalAPIDuration:t,totalAPIDurationWithoutRetries:r,totalToolDuration:i,totalLinesAdded:n,totalLinesRemoved:o,lastDuration:s,startTime:d,modelUsage:h,hasUnknownModelCost:m},v){if(this.#d=v,this.#e=e,this.#s=e,this.#t=t,this.#r=r,this.#n=i,this.#u=n,this.#l=o,this.#c=m??!1,h)this.#a=Vh(h);if(s!==void 0)this.#i=Date.now()-s;this.anchorLogicalStart(d)}registerSaver(e){this.#f=e}runSaver(e,t){(this.#f??(t?t.#f:null))?.(e)}registerTranscriptRecorder(e){this.#h=e}runTranscriptRecorder(e,t,r){(this.#h??(r?r.#h:null))?.(e,t)}snapshot(){return{ownerSessionId:this.#d,totalCostUSD:this.#e,totalAPIDuration:this.#t,totalAPIDurationWithoutRetries:this.#r,totalToolDuration:this.#n,startTime:this.#i,sessionLogicalStartTime:this.#o,totalLinesAdded:this.#u,totalLinesRemoved:this.#l,restoredCostUSD:this.#s,hasUnknownModelCost:this.#c,modelUsage:wb(this.#a,(e)=>({...e}))}}restoreSnapshot(e){this.#d=e.ownerSessionId,this.#e=e.totalCostUSD,this.#t=e.totalAPIDuration,this.#r=e.totalAPIDurationWithoutRetries,this.#n=e.totalToolDuration,this.#i=e.startTime,this.#o=e.sessionLogicalStartTime,this.#u=e.totalLinesAdded,this.#l=e.totalLinesRemoved,this.#s=e.restoredCostUSD,this.#c=e.hasUnknownModelCost,this.#a=Vh(wb(e.modelUsage,(t)=>({...t})))}claim(e){this.#d??=e}scopeTo(e){this.#d=e}ownerSessionId(){return this.#d}belongsTo(e){return this.#d===e}reset(e){this.#d=e,this.#e=0,this.#s=0,this.#t=0,this.#r=0,this.#n=0,this.#i=Date.now(),this.anchorLogicalStart(void 0),this.#u=0,this.#l=0,this.#c=!1,this.#a=Vh()}}class kb{#e=!1;fableConsentSessionFallback(){return this.#e}replaceFableConsentSessionFallback(e){this.#e=e}reset(){this.#e=!1}}class Mb{#e={registeredHooks:null};#t=void 0;#r=void 0;holder(){return this.#e}mainThreadAgentType(){return this.#t}replaceMainThreadAgentType(e){this.#t=e}mainThreadAgentHooks(){return this.#r}replaceMainThreadAgentHooks(e){this.#r=e}reset(){this.#e={registeredHooks:null},this.#t=void 0,this.#r=void 0}}class Eb{#e=new Map;skills(){return this.#e}lookup(e){return this.#e.get(e)}record(e,t){this.#e.set(e,t)}forget(e){this.#e.delete(e)}forgetAll(){this.#e.clear()}reset(){this.#e=new Map}}class Tb{#e=[];#t;#r;#n;#i;approvedServers(){return this.#e}approveServers(e,t){for(let r of t)if(!this.#e.some((i)=>i.name===r&&i.workspaceKey===e))this.#e.push({name:r,workspaceKey:e})}registerClientsAccessor(e){this.#t=e}acquireClientsAccessor(e){if(this.#t)return()=>{};return this.#t=e,()=>{if(this.#t===e)this.#t=void 0}}clientsFromAccessor(){return this.#t?.()}registerConnectedClientWiring(e){this.#r=e}connectedClientWiring(){return this.#r}registerToolsSwapper(e){this.#n=e}acquireToolsSwapper(e){if(this.#n)return()=>{};return this.#n=e,()=>{if(this.#n===e)this.#n=void 0}}swapServerTools(e,t){if(!this.#n)return!1;return this.#n(e,t)}registerConnections(e){this.#i=e}acquireConnections(e){if(this.#i)return()=>{};return this.#i=e,()=>{if(this.#i===e)this.#i=void 0}}connections(){return this.#i}reset(){this.#e=[],this.#t=void 0}}class Ab{#e=void 0;#t=void 0;#r=void 0;#n=void 0;#i=void 0;#o=void 0;#u=!1;#l=!1;#s=void 0;#c=!1;#a=void 0;#f=void 0;mainLoopModelOverride(){return this.#e}overrideMainLoopModel(e){this.#e=e}mainLoopEffortState(){return this.#t}replaceMainLoopEffortState(e){this.#t=e}initialMainLoopModel(){return this.#r}replaceInitialMainLoopModel(e){this.#r=e}initialModelSettingLayer(){return this.#n}replaceInitialModelSettingLayer(e){this.#n=e}resolvedOrgDefault(){return this.#i}replaceResolvedOrgDefault(e){this.#i=e}initialEnvDefaultModel(){return this.#o}replaceInitialEnvDefaultModel(e){this.#o=e}refusalFallbackOccurred(){return this.#u}markRefusalFallbackOccurred(e){this.#u=!0,this.#s??=e}refusalFallbackHeaderArmed(){return this.#l}armRefusalFallbackHeader(e){this.#l=!0,this.#s??=e}refusalFallbackLatchOriginRequestId(){return this.#s}silentLaneServerArmed(){return this.#c}armSilentLaneFromServer(){this.#c=!0}forgetRefusalFallbackOccurred(){this.#u=!1,this.#l=!1,this.#c=!1,this.#s=void 0}refusalFallbackModelLatch(){return this.#a}replaceRefusalFallbackModelLatch(e){this.#a=e}unlatchRefusalFallbackModel(){this.#a=void 0}availabilityFallbackChain(){return this.#f}replaceAvailabilityFallbackChain(e){this.#f=e}reset(){this.#e=void 0,this.#t=void 0,this.#r=void 0,this.#n=void 0,this.#i=void 0,this.#o=void 0,this.#u=!1,this.#l=!1,this.#c=!1,this.#s=void 0,this.#a=void 0,this.#f=void 0}}class Rb{#e=new Map;#t=0;#r=void 0;#n=null;sections(){return this.#e}recordSection(e,t){this.#e.set(e,t)}forgetAllSections(){this.#e.clear()}noteInvalidation(e="other"){this.#t+=1,this.#r=e}epoch(){return this.#t}lastInvalidationReason(){return this.#r}registerWordingLatchClear(e){this.#n=e}clearWordingLatch(e){(this.#n??(e?e.#n:null))?.()}reset(){this.#e=new Map}}class Pb{#e=null;#t=null;#r=null;#n=null;#i=null;#o=0;#u=void 0;#l=null;#s=null;#c=!1;#a=null;#f=null;#h=!1;lastAPIRequest(){return this.#e}replaceLastAPIRequest(e){this.#e=e}lastCancelledAPIMessageId(){return this.#t}replaceLastCancelledAPIMessageId(e){this.#t=e}lastAPIRequestMessages(){return this.#r}replaceLastAPIRequestMessages(e){this.#r=e}lastClassifierRequests(){return this.#n}replaceLastClassifierRequests(e){this.#n=e}promptId(){return this.#i}replacePromptId(e){this.#i=e}promptIndex(){return this.#o}replacePromptIndex(e){this.#o=e}incrementPromptIndex(){return this.#o++,this.#o}lastMainRequestId(){return this.#u}replaceLastMainRequestId(e){this.#u=e}lastMainThreadCacheTtlMs(){return this.#l}replaceLastMainThreadCacheTtlMs(e){this.#l=e,this.#s=Date.now(),this.#c=!0}lastMainThreadRequestAt(){return this.#s}mainThreadRequestedInProcess(){return this.#c}recordMainThreadTurnStart(){this.#c=!0}replaceLastMainThreadRequest(e,t){this.#s=e,this.#l=t}lastMainThreadContextTokens(){return this.#a}replaceLastMainThreadContextTokens(e){this.#a=e}stageResumeSeed(e){this.#d=e}applyResumeSeed(e){this.#d=null,this.#l=e.ttlMs,this.#s=e.requestAt,this.#a=e.contextTokens}#d=null;clearLastMainThreadRequest(e){let t=e!==void 0&&this.#d?.sessionId===e?this.#d:null;this.#d=null,this.#l=t?.ttlMs??null,this.#s=t?.requestAt??null,this.#a=t?.contextTokens??null,this.#c=!1}lastApiCompletionTimestamp(){return this.#f}replaceLastApiCompletionTimestamp(e){this.#f=e}pendingPostCompaction(){return this.#h}replacePendingPostCompaction(e){this.#h=e}reset(){this.#e=null,this.#t=null,this.#r=null,this.#n=null,this.#i=null,this.#o=0,this.#u=void 0,this.#l=null,this.#s=null,this.#c=!1,this.#a=null,this.#d=null,this.#f=null,this.#h=!1}}class Ib{#e=[];#t=Object.create(null);#r=null;#n=0;#i=!1;#o=0;tasks(){return this.#e}schedule(e){this.#e.push(e)}replaceTasks(e){this.#e=e}chainStartedAt(e){return this.#t[e]}recordChainStart(e,t){this.#t[e]=t}forgetChainStart(e){delete this.#t[e]}tickInFlightPrompt(){return this.#r}replaceTickInFlightPrompt(e){this.#r=e}consecutiveKeepalives(){return this.#n}replaceConsecutiveKeepalives(e){this.#n=e}ended(){return this.#i}replaceEnded(e){this.#i=e}wakeFires(){return this.#o}recordWakeFire(){this.#o++}resetWakeFires(){this.#o=0}reset(){this.#e=[],this.#t=Object.create(null),this.#r=null,this.#n=0,this.#i=!1,this.#o=0}}class Cb{#e=!1;#t=!1;#r=!1;#n=!1;#i=!1;#o=!1;#u=!1;#l=!1;#s=!1;#c=!1;#a=!1;#f=null;#h=null;#d=null;#p=!1;#m=null;#g=!1;#y=!1;#b=!1;#v=!1;#S=!1;#_=void 0;#x=void 0;#k=void 0;#w=null;#M=null;onboardingShownThisSession(){return this.#e}replaceOnboardingShownThisSession(e){this.#e=e}lspRecommendationShownThisSession(){return this.#t}replaceLspRecommendationShownThisSession(e){this.#t=e}sessionTrustAccepted(){return this.#r}replaceSessionTrustAccepted(e){this.#r=e}homeTrustDialogAccepted(){return this.#n}replaceHomeTrustDialogAccepted(e){this.#n=e}hasExitedPlanMode(){return this.#i}replaceHasExitedPlanMode(e){this.#i=e}needsPlanModeExitAttachment(){return this.#o}replaceNeedsPlanModeExitAttachment(e){this.#o=e}needsAutoModeExitAttachment(){return this.#u}replaceNeedsAutoModeExitAttachment(e){this.#u=e}memoryToggledOff(){return this.#l}replaceMemoryToggledOff(e){this.#l=e}restoredMemoryPause(){return this.#s}replaceRestoredMemoryPause(e){this.#s=e}teardownUnwindRequested(){return this.#p}replaceTeardownUnwindRequested(e){this.#p=e}backgroundAutoModeSetupInFlight(){return this.#c}replaceBackgroundAutoModeSetupInFlight(e){this.#c=e}launchEffortPinsReleasedForSession(){return this.#a}markLaunchEffortPinsReleasedForSession(){this.#a=!0}restoreLaunchEffortPinsReleasedForSession(e){this.#a=e}deferredToolStubGateLatch(){return this.#f}replaceDeferredToolStubGateLatch(e){this.#f=e}verifySkillRolloutGateLatch(){return this.#h}replaceVerifySkillRolloutGateLatch(e){this.#h=e}commitSkillRolloutGateLatch(){return this.#d}replaceCommitSkillRolloutGateLatch(e){this.#d=e}memoryToolsShapeLatch(){return this.#m}replaceMemoryToolsShapeLatch(e){this.#m=e}proposeGoalAvailabilityLogged(){return this.#g}markProposeGoalAvailabilityLogged(){this.#g=!0}activeRoutine(){return this.#x}replaceActiveRoutine(e){this.#x=e}inheritedTeamName(){return this.#k}replaceInheritedTeamName(e){this.#k=e}teleportedSessionInfo(){return this.#w}replaceTeleportedSessionInfo(e){this.#w=e}markFirstTeleportMessageLogged(){if(this.#w)this.#w.hasLoggedFirstMessage=!0}cachedClaudeMdContent(){return this.#M}replaceCachedClaudeMdContent(e){this.#M=e}accountSkillsSyncEnabled(){return this.#y}replaceAccountSkillsSyncEnabled(e){this.#y=e}skillsSyncVetoed(){return this.#b}replaceSkillsSyncVetoed(e){this.#b=e}accountPluginsSyncEnabled(){return this.#v}replaceAccountPluginsSyncEnabled(e){this.#v=e}pluginsSyncVetoed(){return this.#S}replacePluginsSyncVetoed(e){this.#S=e}armPendingContextCompacted(e){this.#_=e}consumePendingContextCompacted(){let e=this.#_;return this.#_=void 0,e}forgetPendingContextCompacted(){this.#_=void 0}reset(){this.#y=!1,this.#b=!1,this.#v=!1,this.#S=!1,this.#e=!1,this.#t=!1,this.#r=!1,this.#n=!1,this.#i=!1,this.#o=!1,this.#u=!1,this.#l=!1,this.#s=!1,this.#p=!1,this.#c=!1,this.#a=!1,this.#f=null,this.#h=null,this.#d=null,this.#m=null,this.#g=!1,this.#x=void 0,this.#k=void 0,this.#w=null,this.#M=null,this.#_=void 0}}class $b{#e=new Map;#t=new Map;#r=null;#n=new Map;#i=new Set;#o=new Set;#u=new Set;#l=new Set;#s=new Set;#c=new Set;#a=new Set;#f=new Set;#h=new Set;#d=new Map;#p=new Set;#m=void 0;#g=void 0;#y=void 0;#b=void 0;#v=void 0;planSlugCache(){return this.#e}forgetPlanSlug(e){this.#e.delete(e)}pendingBranchLinks(){return this.#t}replacePendingBranchLinks(){this.#t=new Map}vimSharedState(){return this.#r}replaceVimSharedState(e){this.#r=e}agentColorMap(){return this.#n}sessionCreatedTeams(){return this.#i}surfacedHookSpawnFailures(){return this.#o}bareMcpServerMatchersWarned(){return this.#u}pendingConversationEditKinds(){return this.#l}clientTruncatedAssistantIds(){return this.#s}heldStatelessReplyIds(){return this.#c}unsupportedThreadKeys(){return this.#a}pendingPrLinks(){return this.#f}policyPredicateTelemetryEmitted(){return this.#h}humanAttachmentDigests(){return this.#d}chromeAvailabilityStagesLogged(){return this.#p}replaceChromeAvailabilityStagesLogged(e){if(this.#p=new Set,e)this.#m=Date.now()}chromeAvailabilityAnchorMs(){return this.#m}pendingGoalIdleCheckin(){return this.#g}replacePendingGoalIdleCheckin(e){this.#g=e}pendingGoalReprompt(){return this.#y}replacePendingGoalReprompt(e){this.#y=e}goalInterruptionStreak(){return this.#b}replaceGoalInterruptionStreak(e){this.#b=e}workerCheckin(){return this.#v}replaceWorkerCheckin(e){this.#v=e}reset(){this.#e=new Map,this.#t=new Map,this.#r=null,this.#n=new Map,this.#i=new Set,this.#o=new Set,this.#u=new Set,this.#l=new Set,this.#s=new Set,this.#c=new Set,this.#a=new Set,this.#f=new Set,this.#h=new Set,this.#d=new Map,this.#p=new Set,this.#m=void 0,clearTimeout(this.#g),this.#g=void 0,clearTimeout(this.#y),this.#y=void 0,this.#b=void 0,clearInterval(this.#v?.timer),this.#v=void 0}}var oR={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};class Ob{#e=!1;#t=void 0;#r=void 0;#n=void 0;#i=void 0;#o=null;#u=!1;#l=void 0;#s=oR;#c=!1;#a="idle";attacherCapsChanged=ir();rvSupervisorLinkChanged=ir();sdkDialogHostActive(){return this.#e}markSdkDialogHostActive(e){this.#e=e}sdkSupportedDialogKinds(){return this.#t}sdkSupportedDialogKindsSource(){return this.#r}declareDialogKinds(e,t){this.#t=e,this.#r=e===void 0?void 0:t}sdkPerTaskStopAffordance(){return this.#n}declarePerTaskStopAffordance(e){this.#n=e}sdkRapidFollowupPreempt(){return this.#i}declareRapidFollowupPreempt(e){this.#i=e}attacherCaps(){return this.#o}replaceAttacherCaps(e){this.#o=e,this.attacherCapsChanged.emit()}rvSupervisorLinkLive(){return this.#u}replaceRvSupervisorLinkLive(e){if(this.#u===e)return;this.#u=e,this.rvSupervisorLinkChanged.emit()}sdkBetas(){return this.#l}replaceSdkBetas(e){this.#l=e}caps(){return this.#s}replaceCaps(e){this.#s=e}markRemote(e){this.#s={...this.#s,workspace:e?"remote":"local"}}replBridgeActive(){return this.#c}replaceReplBridgeActive(e){if(this.#c===e)return;this.#c=e}mainLoopBusy(){return this.#a!=="idle"}mainQueryRunning(){return this.#a==="running"}replaceMainLoopStatus(e){this.#a=e}reset(){this.#e=!1,this.#t=void 0,this.#r=void 0,this.#n=void 0,this.#i=void 0,this.#o=null,this.#l=void 0,this.#s=oR,this.#c=!1,this.#a="idle",this.#u=!1,this.attacherCapsChanged.clear(),this.rvSupervisorLinkChanged.clear()}}class Db{#e=0;#t=null;#r=0;outputTokensAtTurnStart(){return this.#e}budget(){return this.#t}continuationCount(){return this.#r}snapshotForTurn(e,t){this.#e=e,this.#t=t,this.#r=0}incrementContinuation(){this.#r++}reset(){this.#e=0,this.#t=null,this.#r=0}}var sR=150;class Nb{#e=Date.now();#t=!1;interactionFired=ir();#r=void 0;terminalFocusFired=ir();#n=!1;#i;lastInteractionTime(){return this.#e}recordInteraction(e){if(e)this.#o();else this.#t=!0}flushIfDirty(){if(this.#t)this.#o()}#o(){this.#e=Date.now(),this.#t=!1,this.interactionFired.emit()}resetBaseline(){this.#e=Date.now(),this.#t=!1}terminalFocus(){return this.#r}updateTerminalFocus(e){this.#r=e,this.terminalFocusFired.emit()}scrollDraining(){return this.#n}markScrollActivity(){if(this.#n=!0,this.#i)clearTimeout(this.#i);this.#i=setTimeout(()=>{this.#n=!1,this.#i=void 0},sR),this.#i.unref?.()}async waitForScrollIdle(){while(this.#n)await new Promise((e)=>setTimeout(e,sR))}reset(){this.#e=Date.now(),this.#r=void 0,this.interactionFired.clear(),this.terminalFocusFired.clear()}}var tH=["sdk_single_prompt_gate","subagent_estimate","subagent_final_turn"];class Lb{byAgent=new Map;attemptsByAgent=new Map;cappedFailuresByAgent=new Map;armGateEventEmitted=new Set;vetoedUnderPrompt=new Map;sidecarIo=Promise.resolve();rehydrateAttemptedSessions=new Set;sidecarReadsAhead=new Map;get(e){return this.byAgent.get(e)}has(e){return this.byAgent.has(e)}put(e,t){this.byAgent.set(e,t)}remove(e){this.byAgent.delete(e)}nextAttemptNumber(e){let t=(this.attemptsByAgent.get(e)??0)+1;return this.attemptsByAgent.set(e,t),t}consecutiveCountedFailures(e){return this.cappedFailuresByAgent.get(e)??0}recordCountedFailure(e){let t=(this.cappedFailuresByAgent.get(e)??0)+1;return this.cappedFailuresByAgent.set(e,t),t}clearCountedFailures(e){this.cappedFailuresByAgent.delete(e)}recordVeto(e,t){this.vetoedUnderPrompt.set(e,t)}isVetoedUnder(e,t){return this.vetoedUnderPrompt.get(e)===t}latchArmGateEvent(e){if(this.armGateEventEmitted.has(e))return!1;return this.armGateEventEmitted.add(e),!0}enqueueSidecarIo(e,t){return this.sidecarIo=this.sidecarIo.then(e,e).catch(t),this.sidecarIo}sidecarIoSettled(){return this.sidecarIo}hasAttemptedRehydrate(e){return this.rehydrateAttemptedSessions.has(e)}markRehydrateAttempted(e){this.rehydrateAttemptedSessions.add(e)}keepSidecarReadAhead(e,t){this.sidecarReadsAhead.delete(e);while(this.sidecarReadsAhead.size>=8){let r=this.sidecarReadsAhead.keys().next().value;if(r===void 0)break;this.sidecarReadsAhead.delete(r)}this.sidecarReadsAhead.set(e,t)}takeSidecarReadAhead(e){let t=this.sidecarReadsAhead.get(e);return this.sidecarReadsAhead.delete(e),t}dropSidecarReadAhead(e){this.sidecarReadsAhead.delete(e)}forgetSubagentTelemetry(e){this.attemptsByAgent.delete(e),this.cappedFailuresByAgent.delete(e),this.vetoedUnderPrompt.delete(e);for(let t of tH)this.armGateEventEmitted.delete(`${e}:${t}`)}}class zb{#e=void 0;get current(){return this.#e}adopt(e){this.#e=e}}class Ub{#e=null;#t=null;mainAgentId(e){return this.#e??=ab(e),this.#e}projectDir(){return this.#t}replaceProjectDir(e){this.#t=e}}class Fb{openToolUseId;answeredThisSession=!1;get answered(){return this.answeredThisSession}markAnswered(){this.answeredThisSession=!0}isOpenElsewhere(e){return this.openToolUseId!==void 0&&this.openToolUseId!==e}open(e){this.openToolUseId=e}closeFor(e){if(e!==void 0&&this.openToolUseId===e)this.openToolUseId=void 0}}class jb{granted=!1;isGranted(){return this.granted}grant(){this.granted=!0}}class Bb{inFlight=null;startedForTurnEnd=!1;reset(){this.inFlight?.abort(),this.inFlight=null,this.startedForTurnEnd=!1}}class qb{firstSyncPromise=null;syncErrors=[];syncedLaneOpened=!1;removalsDeferredHere=new Set;pendingTrashRemovals=[];ensureBucketRoot=null;deferredRelist=null}class Hb{abortController=null;reset(){this.abortController?.abort(),this.abortController=null}arm(){let e=new AbortController;return this.abortController=e,e}}class Kb{#e=void 0;#t=void 0;ccrSessionID(){return this.#e}latchCcrSessionID(e){this.#e=e}syncEnabled(){return this.#t}latchSyncEnabled(e){return this.#t=e,e}}class Wb{autonomousPreambleDelivered=!1;lastLoopFileDelivered=null;reset(){this.autonomousPreambleDelivered=!1,this.lastLoopFileDelivered=null}}class Zb{exchanges=[];replace(e){this.exchanges=e}append(e,t,r){this.exchanges=[...this.exchanges,{question:e,response:t,...r&&{fallbackNotice:r}}].slice(-20)}pendingReopen=null;reopenAway=!1;get reopenPending(){return this.pendingReopen!==null}armReopen(e,t){if(this.pendingReopen){this.pendingReopen.owners.add(e);return}this.pendingReopen={owners:new Set([e]),cancel:t()}}clearPendingReopen(e){let t=this.pendingReopen;if(!t){this.reopenAway=!1;return}if(e!==void 0){if(t.owners.delete(e),t.owners.size>0)return}t.cancel(),this.pendingReopen=null,this.reopenAway=!1}reopener=null;setReopener(e){this.reopener=e}get hasReopener(){return this.reopener!==null}reopenNow(){return this.reopener?.()??!1}inFlightQuestions=[];get inFlight(){return this.inFlightQuestions.at(-1)??null}pendingBesidesTop(){return this.inFlightQuestions.slice(0,-1)}setInFlight(e){if(!this.inFlightQuestions.includes(e))this.inFlightQuestions=[...this.inFlightQuestions,e]}clearInFlight(e){if(this.inFlightQuestions.includes(e))this.inFlightQuestions=this.inFlightQuestions.filter((t)=>t!==e)}}var{lstatSync:aSe,readFileSync:lSe,readlinkSync:uSe,realpathSync:cSe,statSync:dSe}=(()=>({}));var{readlink:hSe}=(()=>({}));function aR(e,t){return e}function Ee(e,t,r,i,n){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function z(e,t,r,i){if(r==="a"&&!i)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)}var La=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return La=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(i)=>(+i^r()&15>>+i/4).toString(16))};Xt();var iH=/^[a-z][a-z0-9+.-]*:/i,lR=(e)=>iH.test(e),nn=(e)=>(nn=Array.isArray,nn(e)),Vb=nn;function Xu(e){if(typeof e!=="object")return{};return e??{}}function Gb(e){if(!e)return!0;for(let t in e)return!1;return!0}function uR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var cR=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new Ze(`${e} must be an integer`);if(t<0)throw new Ze(`${e} must be a positive integer`);return t};var Yu=(e)=>{try{return JSON.parse(e)}catch(t){return}};var fi=(e,t)=>new Promise((r)=>{if(t?.aborted)return r();let i=()=>{clearTimeout(n),r()},n=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e);t?.addEventListener("abort",i,{once:!0})});var Yn="0.112.1";var pR=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function oH(){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 sH=()=>{let e=oH();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":fR(Deno.build.os),"X-Stainless-Arch":dR(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":Yn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":fR(globalThis.process.platform??"unknown"),"X-Stainless-Arch":dR(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=aH();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function aH(){if(typeof navigator>"u"||!navigator)return null;let e=[{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:t,pattern:r}of e){let i=r.exec(navigator.userAgent);if(i){let n=i[1]||0,o=i[2]||0,s=i[3]||0;return{browser:t,version:`${n}.${o}.${s}`}}}return null}var dR=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},fR=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},hR,Qu=()=>hR??(hR=sH());function mR(){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 Jb(...e){let t=globalThis.ReadableStream;if(typeof t>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Jh(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Jb({start(){},async pull(r){let{done:i,value:n}=await t.next();if(i)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function ec(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gR(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var yR=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});var Xb="RFC3986",Yb=(e)=>String(e),Qb={RFC1738:(e)=>String(e).replace(/%20/g,"+"),RFC3986:Yb},vR="RFC1738";var Xh=(e,t)=>(Xh=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Xh(e,t)),Di=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var e_=1024,bR=(e,t,r,i,n)=>{if(e.length===0)return e;let o=e;if(typeof e==="symbol")o=Symbol.prototype.toString.call(e);else if(typeof e!=="string")o=String(e);if(r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});let s="";for(let d=0;d<o.length;d+=e_){let h=o.length>=e_?o.slice(d,d+e_):o,m=[];for(let v=0;v<h.length;++v){let g=h.charCodeAt(v);if(g===45||g===46||g===95||g===126||g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122||n===vR&&(g===40||g===41)){m[m.length]=h.charAt(v);continue}if(g<128){m[m.length]=Di[g];continue}if(g<2048){m[m.length]=Di[192|g>>6]+Di[128|g&63];continue}if(g<55296||g>=57344){m[m.length]=Di[224|g>>12]+Di[128|g>>6&63]+Di[128|g&63];continue}v+=1,g=65536+((g&1023)<<10|h.charCodeAt(v)&1023),m[m.length]=Di[240|g>>18]+Di[128|g>>12&63]+Di[128|g>>6&63]+Di[128|g&63]}s+=m.join("")}return s};function _R(e){if(!e||typeof e!=="object")return!1;return!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function t_(e,t){if(nn(e)){let r=[];for(let i=0;i<e.length;i+=1)r.push(t(e[i]));return r}return t(e)}var wR={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},xR=function(e,t){Array.prototype.push.apply(e,nn(t)?t:[t])},SR,Pr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:bR,encodeValuesOnly:!1,format:Xb,formatter:Yb,indices:!1,serializeDate(e){return(SR??(SR=Function.prototype.call.bind(Date.prototype.toISOString)))(e)},skipNulls:!1,strictNullHandling:!1};function cH(e){return typeof e==="string"||typeof e==="number"||typeof e==="boolean"||typeof e==="symbol"||typeof e==="bigint"}var r_={};function kR(e,t,r,i,n,o,s,d,h,m,v,g,S,x,k,T,E,P){let R=e,I=P,O=0,D=!1;while((I=I.get(r_))!==void 0&&!D){let F=I.get(e);if(O+=1,typeof F<"u")if(F===O)throw RangeError("Cyclic object value");else D=!0;if(typeof I.get(r_)>"u")O=0}if(typeof m==="function")R=m(t,R);else if(R instanceof Date)R=S?.(R);else if(r==="comma"&&nn(R))R=t_(R,function(F){if(F instanceof Date)return S?.(F);return F});if(R===null){if(o)return h&&!T?h(t,Pr.encoder,E,"key",x):t;R=""}if(cH(R)||_R(R)){if(h){let F=T?t:h(t,Pr.encoder,E,"key",x);return[k?.(F)+"="+k?.(h(R,Pr.encoder,E,"value",x))]}return[k?.(t)+"="+k?.(String(R))]}let H=[];if(typeof R>"u")return H;let G;if(r==="comma"&&nn(R)){if(T&&h)R=t_(R,h);G=[{value:R.length>0?R.join(",")||null:void 0}]}else if(nn(m))G=m;else{let F=Object.keys(R);G=v?F.sort(v):F}let oe=d?String(t).replace(/\./g,"%2E"):String(t),ee=i&&nn(R)&&R.length===1?oe+"[]":oe;if(n&&nn(R)&&R.length===0)return ee+"[]";for(let F=0;F<G.length;++F){let J=G[F],a=typeof J==="object"&&typeof J.value<"u"?J.value:R[J];if(s&&a===null)continue;let c=g&&d?J.replace(/\./g,"%2E"):J,p=nn(R)?typeof r==="function"?r(ee,c):ee:ee+(g?"."+c:"["+c+"]");P.set(e,O);let u=new WeakMap;u.set(r_,P),xR(H,kR(a,p,r,i,n,o,s,d,r==="comma"&&T&&nn(R)?null:h,m,v,g,S,x,k,T,E,u))}return H}function dH(e=Pr){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!=="function")throw TypeError("Encoder has to be a function.");let t=e.charset||Pr.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Xb;if(typeof e.format<"u"){if(!Xh(Qb,e.format))throw TypeError("Unknown format option provided.");r=e.format}let i=Qb[r],n=Pr.filter;if(typeof e.filter==="function"||nn(e.filter))n=e.filter;let o;if(e.arrayFormat&&e.arrayFormat in wR)o=e.arrayFormat;else if("indices"in e)o=e.indices?"indices":"repeat";else o=Pr.arrayFormat;if("commaRoundTrip"in e&&typeof e.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof e.allowDots>"u"?!!e.encodeDotInKeys===!0?!0:Pr.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==="boolean"?e.addQueryPrefix:Pr.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays==="boolean"?!!e.allowEmptyArrays:Pr.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel==="boolean"?e.charsetSentinel:Pr.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Pr.delimiter:e.delimiter,encode:typeof e.encode==="boolean"?e.encode:Pr.encode,encodeDotInKeys:typeof e.encodeDotInKeys==="boolean"?e.encodeDotInKeys:Pr.encodeDotInKeys,encoder:typeof e.encoder==="function"?e.encoder:Pr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==="boolean"?e.encodeValuesOnly:Pr.encodeValuesOnly,filter:n,format:r,formatter:i,serializeDate:typeof e.serializeDate==="function"?e.serializeDate:Pr.serializeDate,skipNulls:typeof e.skipNulls==="boolean"?e.skipNulls:Pr.skipNulls,sort:typeof e.sort==="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling==="boolean"?e.strictNullHandling:Pr.strictNullHandling}}function MR(e,t={}){let r=e,i=dH(t),n,o;if(typeof i.filter==="function")o=i.filter,r=o("",r);else if(nn(i.filter))o=i.filter,n=o;let s=[];if(typeof r!=="object"||r===null)return"";let d=wR[i.arrayFormat],h=d==="comma"&&i.commaRoundTrip;if(!n)n=Object.keys(r);if(i.sort)n.sort(i.sort);let m=new WeakMap;for(let S=0;S<n.length;++S){let x=n[S];if(i.skipNulls&&r[x]===null)continue;xR(s,kR(r[x],x,d,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,m))}let v=s.join(i.delimiter),g=i.addQueryPrefix===!0?"?":"";if(i.charsetSentinel)if(i.charset==="iso-8859-1")g+="utf8=%26%2310003%3B&";else g+="utf8=%E2%9C%93&";return v.length>0?g+v:""}function ER(e){return MR(e,{arrayFormat:"brackets"})}Xt();Xt();var AR="urn:ietf:params:oauth:grant-type:jwt-bearer",RR="refresh_token",Yh="/v1/oauth/token",Rs="oauth-2025-04-20",PR="oidc-federation-2026-04-01",IR=120,za=30,CR=5,TR=1048576;function Qh(e){if(!e)return;let t;try{t=new URL(e)}catch(i){throw new zt(`Invalid token endpoint base URL "${e}": ${i}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new zt(`Refusing to send credential over non-https token endpoint "${e}"`)}async function ep(e,t){let r=await pH(e),i;try{i=JSON.parse(r)}catch{throw new zt(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,En(r),t)}if(!i.access_token)throw new zt(`Token endpoint response missing access_token: ${JSON.stringify(En(i))}`,e.status,En(i),t);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new zt(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,e.status,En(i),t);return i}var n_=2000,hH=new Set(["error","error_description","error_uri"]);function En(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=n_)return e;return e.slice(0,n_)+`... <${e.length-n_} more chars>`}return JSON.stringify(En(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,i]of Object.entries(e))if(hH.has(r))t[r]=i;return t}return null}async function tp(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),i=e,n;try{i=await r.promises.realpath(e),n=await r.promises.stat(i)}catch{return}let o=n.mode&511;if(o&18)throw new zt(`Credentials file at ${i} is group/world-writable (mode 0o${o.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${i}\`.`);if(o&36)throw new zt(`Credentials file at ${i} is group/world-readable (mode 0o${o.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${i} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function rp(e,t){let r=await import("node:fs"),i=await Promise.resolve().then(() => (dn(),{})),n=rn(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let o=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(o,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(o,e)}catch(s){throw await r.promises.unlink(o).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function pH(e){if(!e.body)return"";let t=e.body.getReader(),r=[],i=0;for(;;){let{done:o,value:s}=await t.read();if(o)break;if(i+s.length>TR){let d=TR-i;if(d>0)r.push(s.subarray(0,d));await t.cancel();break}r.push(s),i+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,d)=>s+d.length,0));let o=0;for(let s of r)n.set(s,o),o+=s.length}return new TextDecoder("utf-8").decode(n)}class zt extends Ze{constructor(e,t=null,r=null,i=null){super(e);this.statusCode=t,this.body=r,this.requestId=i}}function hi(){return Math.floor(Date.now()/1000)}class i_{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let r=t.expiresAt-hi();if(r>IR)return t.token;if(r>za)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(hi()-this.lastAdvisoryError<CR)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=hi(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var Mt=(e)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0;return};Xt();function DR(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),i=0;for(let n of e)r.set(n,i),i+=n.length;return r}var $R;function Ua(e){let t;return($R??(t=new globalThis.TextEncoder,$R=t.encode.bind(t)))(e)}var OR;function o_(e){let t;return(OR??(t=new globalThis.TextDecoder,OR=t.decode.bind(t)))(e)}var rc="warn",ip={off:0,error:200,warn:300,info:400,debug:500},op=(e,t,r)=>{if(!e)return;if(uR(ip,e))return e;r.warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(ip))}`);return};function tc(){}function np(e,t,r){if(!t||ip[e]>ip[r])return tc;else return t[e].bind(t)}var mH={error:tc,warn:tc,info:tc,debug:tc},NR=new WeakMap;function a_(e,t){let r=NR.get(e);if(r&&r[0]===t)return r[1];let i={error:np("error",e,t),warn:np("warn",e,t),info:np("info",e,t),debug:np("debug",e,t)};return NR.set(e,[t,i]),i}function Ot(e){let t=e.logger,r=e.logLevel??"off";if(!t)return mH;return a_(t,r)}var LR,s_;function zR(){let e=Mt("ANTHROPIC_LOG");if(!s_||e!==LR)LR=e,s_=a_(console,op(e,"process.env['ANTHROPIC_LOG']",a_(console,rc))??rc);return s_}var Ni=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,r])=>[t,t.toLowerCase()==="authorization"||t.toLowerCase()==="api-key"||t.toLowerCase()==="x-api-key"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var sp="1.0",gH=/^[A-Za-z0-9_.-]+$/;function UR(e){if(!e)throw Error("profile name is empty");if(e==="."||e==="..")throw Error(`profile name "${e}" is not allowed`);if(e.includes("/")||e.includes("\\"))throw Error(`profile name "${e}" must not contain path separators`);if(!gH.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var FR=async(e)=>{var t,r;let i=await l_();if(i===null)return null;let n=e??await BR();if(n===null)return null;UR(n);let o=await import("node:fs"),s=await Promise.resolve().then(() => (dn(),{})),d=Qt(i,"configs",`${n}.json`),h;try{h=await o.promises.readFile(d,"utf-8")}catch(g){if(g?.code!=="ENOENT")throw Error(`failed to read config file ${d}: ${g}`);h=null}if(h===null){let g=Mt("ANTHROPIC_ORGANIZATION_ID"),S=Mt("ANTHROPIC_IDENTITY_TOKEN_FILE"),x=Mt("ANTHROPIC_FEDERATION_RULE_ID");if(x&&g)return{fromFile:!1,config:{organization_id:g,workspace_id:Mt("ANTHROPIC_WORKSPACE_ID"),base_url:Mt("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:x,service_account_id:Mt("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:S?{source:"file",path:S}:void 0,scope:Mt("ANTHROPIC_SCOPE")}}};return null}let m;try{m=JSON.parse(h)}catch(g){throw Error(`failed to parse config file ${d}: ${g}`)}if(!m.authentication)throw Error(`config file ${d} is missing "authentication"`);let v=m.authentication.type;if(v!=="oidc_federation"&&v!=="user_oauth")throw Error(`authentication.type "${v}" is not a known authentication type`);if(m.organization_id??(m.organization_id=Mt("ANTHROPIC_ORGANIZATION_ID")),m.workspace_id??(m.workspace_id=Mt("ANTHROPIC_WORKSPACE_ID")),m.base_url??(m.base_url=Mt("ANTHROPIC_BASE_URL")),(t=m.authentication).scope??(t.scope=Mt("ANTHROPIC_SCOPE")),m.authentication.type==="oidc_federation"){if(!m.authentication.identity_token){let g=Mt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(g)m.authentication.identity_token={source:"file",path:g}}if(!m.authentication.federation_rule_id)m.authentication.federation_rule_id=Mt("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=m.authentication).service_account_id??(r.service_account_id=Mt("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:m,fromFile:!0}};var jR=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await l_();if(!r)return null;let i=t??await BR();if(!i)return null;UR(i);let n=await Promise.resolve().then(() => (dn(),{}));return Qt(r,"credentials",`${i}.json`)},l_=async()=>{if(!yH())return null;let e=await Promise.resolve().then(() => (dn(),{})),t=Mt("ANTHROPIC_CONFIG_DIR");if(t)return t;if(Qu()["X-Stainless-OS"]==="Windows"){let o=Mt("APPDATA");if(o)return Qt(o,"Anthropic");let s=Mt("USERPROFILE");if(s)return Qt(s,"AppData","Roaming","Anthropic");return null}let i=Mt("XDG_CONFIG_HOME");if(i)return Qt(i,"anthropic");let n=Mt("HOME");if(n)return Qt(n,".config","anthropic");return null},yH=()=>{let e=Qu()["X-Stainless-Runtime"];return e==="node"||e==="deno"},BR=async()=>{let e=await l_();if(!e)return null;let t=Mt("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),i=await Promise.resolve().then(() => (dn(),{})),n=Qt(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(o){if(o?.code!=="ENOENT")throw Error(`failed to read ${n}: ${o}`);return"default"}};Xt();function u_(e){if(!e)throw new Ze("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new Ze(`Failed to read identity token file at ${e}: ${n}`)}let i=r.trim();if(!i)throw new Ze(`Identity token file at ${e} is empty`);return i}}function qR(e){if(!e)throw new Ze("Identity token value is empty");return()=>e}function HR(e){return async()=>{Qh(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new zt(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:AR,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let i=`${e.baseURL}${Yh}`,n;try{n=await e.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${Rs},${PR}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Yn} oidcFederationProvider`},body:JSON.stringify(r)})}catch(h){throw new zt(`Failed to reach token endpoint ${i}: ${h}`)}let o=n.headers.get("Request-Id");if(!n.ok){let h=await n.text().catch(()=>""),m=En(h),v="";if(n.status===401)v=` Ensure your federation rule matches your identity token. ${e.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 zt(`Token exchange failed with status ${n.status}${o?` (request-id ${o})`:""}: ${m}${v}`,n.status,m,o)}let s=await ep(n,o),d=Number(s.expires_in);if(!Number.isFinite(d))throw new zt(`Token endpoint response missing required fields: ${JSON.stringify(En(s))}`,n.status,En(s),o);return{token:s.access_token,expiresAt:hi()+d}}}function KR(e){return async(t)=>{let r=await import("node:fs");await tp(e.credentialsPath,e.onSafetyWarning);let i;try{i=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(E){throw new zt(`Credentials file not found at ${e.credentialsPath}: ${E}`)}let n;try{n=JSON.parse(i)}catch(E){throw new zt(`Credentials file at ${e.credentialsPath} is not valid JSON: ${E}`)}let o=n.access_token;if(!o)throw new zt(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||hi()<s-za))return{token:o,expiresAt:s??null};let d=n.refresh_token;if(!e.clientId||!d)throw new zt(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${d?"set":"empty"})`);Qh(e.baseURL);let h={grant_type:RR,refresh_token:d,client_id:e.clientId},m=`${e.baseURL}${Yh}`,v;try{v=await e.fetch(m,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":Rs,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Yn} userOAuthProvider`},body:JSON.stringify(h)})}catch(E){throw new zt(`User OAuth refresh failed to reach token endpoint: ${E}`)}let g=v.headers.get("Request-Id");if(!v.ok){let E=await v.text().catch(()=>"");throw new zt(`User OAuth refresh failed (HTTP ${v.status}): ${En(E)}`,v.status,En(E),g)}let S=await ep(v,g),x=Number(S.expires_in);if(!Number.isFinite(x))throw new zt(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(En(S))}`,v.status,En(S),g);let k=hi()+x,T=S.refresh_token||d;return await rp(e.credentialsPath,{...n,version:sp,type:"oauth_token",access_token:S.access_token,expires_at:k,refresh_token:T}),{token:S.access_token,expiresAt:k}}}function c_(e,t){let r=e.authentication.credentials_path??null,i=(e.base_url||t.baseURL).replace(/\/+$/,""),n=vH(e,r,i,t),o={};if(e.workspace_id&&e.authentication.type==="user_oauth")o["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:o,baseURL:e.base_url||void 0}}async function WR(e,t){let r=await FR(t);if(!r)return null;let{config:i,fromFile:n}=r,o=i.authentication.credentials_path||!n?i:{...i,authentication:{...i.authentication,credentials_path:await jR(i,t)??void 0}};return c_(o,e)}function vH(e,t,r,i){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,o=bH(n);if(!o)throw new zt("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new zt("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(!e.organization_id)throw new zt("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=HR({identityTokenProvider:o,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent});if(t)return _H(s,t,i.onCacheWriteError,i.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new zt("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return KR({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let n=e.authentication.type;throw new zt(`authentication.type "${n}" is not a known authentication type`)}}}function bH(e){if(e.identity_token){let i=e.identity_token.source;if(i!=="file")throw new zt(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new zt('identity_token.source "file" requires a non-empty path');return u_(e.identity_token.path)}let t=Mt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return u_(t);let r=Mt("ANTHROPIC_IDENTITY_TOKEN");if(r)return qR(r);return null}function _H(e,t,r,i){return async(n)=>{let o=await import("node:fs");await tp(t,i);let s;try{let h=await o.promises.readFile(t,"utf-8");s=JSON.parse(h);let m=s?.access_token;if(m&&!n?.forceRefresh){let v=s?.expires_at;if(v==null||hi()<v-za)return{token:m,expiresAt:v??null}}}catch(h){if(h?.code!=="ENOENT"&&!(h instanceof SyntaxError))r?.(h)}let d=await e(n);try{await rp(t,{...s??{},version:sp,type:"oauth_token",access_token:d.token,expires_at:d.expiresAt})}catch(h){r?.(h)}return d}}Xt();var Fn,jn;class Po{constructor(){Fn.set(this,void 0),jn.set(this,void 0),Ee(this,Fn,new Uint8Array,"f"),Ee(this,jn,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?Ua(e):e;Ee(this,Fn,DR([z(this,Fn,"f"),t]),"f");let r=[],i;while((i=SH(z(this,Fn,"f"),z(this,jn,"f")))!=null){if(i.carriage&&z(this,jn,"f")==null){Ee(this,jn,i.index,"f");continue}if(z(this,jn,"f")!=null&&(i.index!==z(this,jn,"f")+1||i.carriage)){r.push(o_(z(this,Fn,"f").subarray(0,z(this,jn,"f")-1))),Ee(this,Fn,z(this,Fn,"f").subarray(z(this,jn,"f")),"f"),Ee(this,jn,null,"f");continue}let n=z(this,jn,"f")!==null?i.preceding-1:i.preceding,o=o_(z(this,Fn,"f").subarray(0,n));r.push(o),Ee(this,Fn,z(this,Fn,"f").subarray(i.index),"f"),Ee(this,jn,null,"f")}return r}flush(){if(!z(this,Fn,"f").length)return[];return this.decode(`
47
+ deps: ${r}}`};var roe={keyword:"dependencies",type:"object",schemaType:"object",error:h9.error,code(e){let[t,r]=noe(e);d9(e,t),f9(e,r)}};function noe({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function d9(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let d=t[s];if(d.length===0)continue;let h=eh.propertyInData(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:d.length,deps:d.join(", ")}),n.allErrors)r.if(h,()=>{for(let m of d)eh.checkReportMissingProp(e,m)});else r.if(CM._`${h} && (${eh.checkMissingProp(e,d,o)})`),eh.reportMissingProp(e,o),r.else()}}h9.validatePropertyDeps=d9;function f9(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let d in t){if(toe.alwaysValidSchema(o,t[d]))continue;r.if(eh.propertyInData(r,i,d,o.opts.ownProperties),()=>{let h=e.subschema({keyword:n,schemaProp:d},s);e.mergeValidEvaluated(h,s)},()=>r.var(s,!0)),e.ok(s)}}h9.validateSchemaDeps=f9;h9.default=roe});var b9=Je(function(v9){Object.defineProperty(v9,"__esModule",{value:!0});var y9=wt(),soe=It(),aoe={message:"property name must be valid",params:({params:e})=>y9._`{propertyName: ${e.propertyName}}`},loe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:aoe,code(e){let{gen:t,schema:r,data:i,it:n}=e;if(soe.alwaysValidSchema(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if(y9.not(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};v9.default=loe});var $M=Je(function(_9){Object.defineProperty(_9,"__esModule",{value:!0});var Yy=si(),Ti=wt(),coe=vo(),Qy=It(),doe={message:"must NOT have additional properties",params:({params:e})=>Ti._`{additionalProperty: ${e.additionalProperty}}`},foe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:doe,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:d,opts:h}=s;if(s.props=!0,h.removeAdditional!=="all"&&Qy.alwaysValidSchema(s,r))return;let m=Yy.allSchemaProperties(i.properties),v=Yy.allSchemaProperties(i.patternProperties);g(),e.ok(Ti._`${o} === ${coe.default.errors}`);function g(){t.forIn("key",n,(E)=>{if(!m.length&&!v.length)k(E);else t.if(S(E),()=>k(E))})}function S(E){let P;if(m.length>8){let R=Qy.schemaRefOrVal(s,i.properties,"properties");P=Yy.isOwnProperty(t,R,E)}else if(m.length)P=Ti.or(...m.map((R)=>Ti._`${E} === ${R}`));else P=Ti.nil;if(v.length)P=Ti.or(P,...v.map((R)=>Ti._`${Yy.usePattern(e,R)}.test(${E})`));return Ti.not(P)}function x(E){t.code(Ti._`delete ${n}[${E}]`)}function k(E){if(h.removeAdditional==="all"||h.removeAdditional&&r===!1){x(E);return}if(r===!1){if(e.setParams({additionalProperty:E}),e.error(),!d)t.break();return}if(typeof r=="object"&&!Qy.alwaysValidSchema(s,r)){let P=t.name("valid");if(h.removeAdditional==="failing")T(E,P,!1),t.if(Ti.not(P),()=>{e.reset(),x(E)});else if(T(E,P),!d)t.if(Ti.not(P),()=>t.break())}}function T(E,P,R){let I={keyword:"additionalProperties",dataProp:E,dataPropType:Qy.Type.Str};if(R===!1)Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(I,P)}}};_9.default=foe});var k9=Je(function(x9){Object.defineProperty(x9,"__esModule",{value:!0});var poe=Bf(),w9=si(),OM=It(),S9=$M(),moe={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)S9.default.code(new poe.KeywordCxt(o,S9.default,"additionalProperties"));let s=w9.allSchemaProperties(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=OM.mergeEvaluated.props(t,OM.toHash(s),o.props);let d=s.filter((g)=>!OM.alwaysValidSchema(o,r[g]));if(d.length===0)return;let h=t.name("valid");for(let g of d){if(m(g))v(g);else{if(t.if(w9.propertyInData(t,n,g,o.opts.ownProperties)),v(g),!o.allErrors)t.else().var(h,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(h)}function m(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function v(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},h)}}};x9.default=moe});var R9=Je(function(A9){Object.defineProperty(A9,"__esModule",{value:!0});var M9=si(),ev=wt(),E9=It(),T9=It(),yoe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,d=M9.allSchemaProperties(r),h=d.filter((T)=>E9.alwaysValidSchema(o,r[T]));if(d.length===0||h.length===d.length&&(!o.opts.unevaluated||o.props===!0))return;let m=s.strictSchema&&!s.allowMatchingProperties&&n.properties,v=t.name("valid");if(o.props!==!0&&!(o.props instanceof ev.Name))o.props=T9.evaluatedPropsToName(t,o.props);let{props:g}=o;S();function S(){for(let T of d){if(m)x(T);if(o.allErrors)k(T);else t.var(v,!0),k(T),t.if(v)}}function x(T){for(let E in m)if(new RegExp(T).test(E))E9.checkStrictMode(o,`property ${E} matches pattern ${T} (use allowMatchingProperties)`)}function k(T){t.forIn("key",i,(E)=>{t.if(ev._`${M9.usePattern(e,T)}.test(${E})`,()=>{let P=h.includes(T);if(!P)e.subschema({keyword:"patternProperties",schemaProp:T,dataProp:E,dataPropType:T9.Type.Str},v);if(o.opts.unevaluated&&g!==!0)t.assign(ev._`${g}[${E}]`,!0);else if(!P&&!o.allErrors)t.if(ev.not(v),()=>t.break())})})}}};A9.default=yoe});var I9=Je(function(P9){Object.defineProperty(P9,"__esModule",{value:!0});var boe=It(),_oe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if(boe.alwaysValidSchema(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};P9.default=_oe});var $9=Je(function(C9){Object.defineProperty(C9,"__esModule",{value:!0});var woe=si(),xoe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:woe.validateUnion,error:{message:"must match a schema in anyOf"}};C9.default=xoe});var D9=Je(function(O9){Object.defineProperty(O9,"__esModule",{value:!0});var tv=wt(),Moe=It(),Eoe={message:"must match exactly one schema in oneOf",params:({params:e})=>tv._`{passingSchemas: ${e.passing}}`},Toe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Eoe,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),d=t.let("passing",null),h=t.name("_valid");e.setParams({passing:d}),t.block(m),e.result(s,()=>e.reset(),()=>e.error(!0));function m(){o.forEach((v,g)=>{let S;if(Moe.alwaysValidSchema(n,v))t.var(h,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},h);if(g>0)t.if(tv._`${h} && ${s}`).assign(s,!1).assign(d,tv._`[${d}, ${g}]`).else();t.if(h,()=>{if(t.assign(s,!0),t.assign(d,g),S)e.mergeEvaluated(S,tv.Name)})})}}};O9.default=Toe});var L9=Je(function(N9){Object.defineProperty(N9,"__esModule",{value:!0});var Roe=It(),Poe={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if(Roe.alwaysValidSchema(i,o))return;let d=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(d)})}};N9.default=Poe});var j9=Je(function(F9){Object.defineProperty(F9,"__esModule",{value:!0});var rv=wt(),U9=It(),Coe={message:({params:e})=>rv.str`must match "${e.ifClause}" schema`,params:({params:e})=>rv._`{failingKeyword: ${e.ifClause}}`},$oe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Coe,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)U9.checkStrictMode(i,'"if" without "then" and "else" is ignored');let n=z9(i,"then"),o=z9(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),d=t.name("_valid");if(h(),e.reset(),n&&o){let v=t.let("ifClause");e.setParams({ifClause:v}),t.if(d,m("then",v),m("else",v))}else if(n)t.if(d,m("then"));else t.if(rv.not(d),m("else"));e.pass(s,()=>e.error(!0));function h(){let v=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);e.mergeEvaluated(v)}function m(v,g){return()=>{let S=e.subschema({keyword:v},d);if(t.assign(s,d),e.mergeValidEvaluated(S,s),g)t.assign(g,rv._`${v}`);else e.setParams({ifClause:v})}}}};function z9(e,t){let r=e.schema[t];return r!==void 0&&!U9.alwaysValidSchema(e,r)}F9.default=$oe});var q9=Je(function(B9){Object.defineProperty(B9,"__esModule",{value:!0});var Doe=It(),Noe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Doe.checkStrictMode(r,`"${e}" without "if" is ignored`)}};B9.default=Noe});var K9=Je(function(H9){Object.defineProperty(H9,"__esModule",{value:!0});var zoe=PM(),Uoe=o9(),Foe=IM(),joe=l9(),Boe=c9(),qoe=g9(),Hoe=b9(),Koe=$M(),Woe=k9(),Zoe=R9(),Voe=I9(),Goe=$9(),Joe=D9(),Xoe=L9(),Yoe=j9(),Qoe=q9();function ese(e=!1){let t=[Voe.default,Goe.default,Joe.default,Xoe.default,Yoe.default,Qoe.default,Hoe.default,Koe.default,qoe.default,Woe.default,Zoe.default];if(e)t.push(Uoe.default,joe.default);else t.push(zoe.default,Foe.default);return t.push(Boe.default),t}H9.default=ese});var Z9=Je(function(W9){Object.defineProperty(W9,"__esModule",{value:!0});var hr=wt(),rse={message:({schemaCode:e})=>hr.str`must match format "${e}"`,params:({schemaCode:e})=>hr._`{format: ${e}}`},nse={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:rse,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:d}=e,{opts:h,errSchemaPath:m,schemaEnv:v,self:g}=d;if(!h.validateFormats)return;if(n)S();else x();function S(){let k=r.scopeValue("formats",{ref:g.formats,code:h.code.formats}),T=r.const("fDef",hr._`${k}[${s}]`),E=r.let("fType"),P=r.let("format");r.if(hr._`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>r.assign(E,hr._`${T}.type || "string"`).assign(P,hr._`${T}.validate`),()=>r.assign(E,hr._`"string"`).assign(P,T)),e.fail$data(hr.or(R(),I()));function R(){if(h.strictSchema===!1)return hr.nil;return hr._`${s} && !${P}`}function I(){let O=v.$async?hr._`(${T}.async ? await ${P}(${i}) : ${P}(${i}))`:hr._`${P}(${i})`,D=hr._`(typeof ${P} == "function" ? ${O} : ${P}.test(${i}))`;return hr._`${P} && ${P} !== true && ${E} === ${t} && !${D}`}}function x(){let k=g.formats[o];if(!k){R();return}if(k===!0)return;let[T,E,P]=I(k);if(T===t)e.pass(O());function R(){if(h.strictSchema===!1){g.logger.warn(D());return}throw Error(D());function D(){return`unknown format "${o}" ignored in schema at path "${m}"`}}function I(D){let H=D instanceof RegExp?hr.regexpCode(D):h.code.formats?hr._`${h.code.formats}${hr.getProperty(o)}`:void 0,G=r.scopeValue("formats",{key:o,ref:D,code:H});if(typeof D=="object"&&!(D instanceof RegExp))return[D.type||"string",D.validate,hr._`${G}.validate`];return["string",D,G]}function O(){if(typeof k=="object"&&!(k instanceof RegExp)&&k.async){if(!v.$async)throw Error("async format in sync schema");return hr._`await ${P}(${i})`}return typeof E=="function"?hr._`${P}(${i})`:hr._`${P}.test(${i})`}}}};W9.default=nse});var G9=Je(function(V9){Object.defineProperty(V9,"__esModule",{value:!0});var ose=Z9(),sse=[ose.default];V9.default=sse});var Y9=Je(function(J9){Object.defineProperty(J9,"__esModule",{value:!0});J9.contentVocabulary=J9.metadataVocabulary=void 0;J9.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];J9.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var t5=Je(function(e5){Object.defineProperty(e5,"__esModule",{value:!0});var use=xD(),cse=JD(),dse=K9(),fse=G9(),Q9=Y9(),hse=[use.default,cse.default,(0,dse.default)(),fse.default,Q9.metadataVocabulary,Q9.contentVocabulary];e5.default=hse});var o5=Je(function(n5){Object.defineProperty(n5,"__esModule",{value:!0});n5.DiscrError=void 0;var r5;(function(e){e.Tag="tag",e.Mapping="mapping"})(r5||(n5.DiscrError=r5={}))});var l5=Je(function(a5){Object.defineProperty(a5,"__esModule",{value:!0});var yu=wt(),DM=o5(),s5=Uy(),mse=qf(),gse=It(),yse={message:({params:{discrError:e,tagName:t}})=>e===DM.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>yu._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},vse={keyword:"discriminator",type:"object",schemaType:"object",error:yse,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let d=i.propertyName;if(typeof d!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let h=t.let("valid",!1),m=t.const("tag",yu._`${r}${yu.getProperty(d)}`);t.if(yu._`typeof ${m} == "string"`,()=>v(),()=>e.error(!1,{discrError:DM.DiscrError.Tag,tag:m,tagName:d})),e.ok(h);function v(){let x=S();t.if(!1);for(let k in x)t.elseIf(yu._`${m} === ${k}`),t.assign(h,g(x[k]));t.else(),e.error(!1,{discrError:DM.DiscrError.Mapping,tag:m,tagName:d}),t.endIf()}function g(x){let k=t.name("valid"),T=e.subschema({keyword:"oneOf",schemaProp:x},k);return e.mergeEvaluated(T,yu.Name),k}function S(){var x;let k={},T=P(n),E=!0;for(let O=0;O<s.length;O++){let D=s[O];if((D===null||D===void 0?void 0:D.$ref)&&!gse.schemaHasRulesButRef(D,o.self.RULES)){let G=D.$ref;if(D=s5.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,G),D instanceof s5.SchemaEnv)D=D.schema;if(D===void 0)throw new mse.default(o.opts.uriResolver,o.baseId,G)}let H=(x=D===null||D===void 0?void 0:D.properties)===null||x===void 0?void 0:x[d];if(typeof H!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${d}"`);E=E&&(T||P(D)),R(H,O)}if(!E)throw Error(`discriminator: "${d}" must be required`);return k;function P({required:O}){return Array.isArray(O)&&O.includes(d)}function R(O,D){if(O.const)I(O.const,D);else if(O.enum)for(let H of O.enum)I(H,D);else throw Error(`discriminator: "properties/${d}" must have "const" or "enum"`)}function I(O,D){if(typeof O!="string"||O in k)throw Error(`discriminator: "${d}" values must be unique strings`);k[O]=D}}}};a5.default=vse});var u5=Je(function(pCe,_se){_se.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 LM=Je(function(Nn,NM){Object.defineProperty(Nn,"__esModule",{value:!0});Nn.MissingRefError=Nn.ValidationError=Nn.CodeGen=Nn.Name=Nn.nil=Nn.stringify=Nn.str=Nn._=Nn.KeywordCxt=Nn.Ajv=void 0;var Sse=hD(),wse=t5(),xse=l5(),c5=u5(),kse=["/properties"],nv="http://json-schema.org/draft-07/schema";class th extends Sse.default{_addVocabularies(){if(super._addVocabularies(),wse.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(xse.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(c5,kse):c5;this.addMetaSchema(e,nv,!1),this.refs["http://json-schema.org/schema"]=nv}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(nv)?nv:void 0)}}Nn.Ajv=th;NM.exports=Nn=th;NM.exports.Ajv=th;Object.defineProperty(Nn,"__esModule",{value:!0});Nn.default=th;var Mse=Bf();Object.defineProperty(Nn,"KeywordCxt",{enumerable:!0,get:function(){return Mse.KeywordCxt}});var vu=wt();Object.defineProperty(Nn,"_",{enumerable:!0,get:function(){return vu._}});Object.defineProperty(Nn,"str",{enumerable:!0,get:function(){return vu.str}});Object.defineProperty(Nn,"stringify",{enumerable:!0,get:function(){return vu.stringify}});Object.defineProperty(Nn,"nil",{enumerable:!0,get:function(){return vu.nil}});Object.defineProperty(Nn,"Name",{enumerable:!0,get:function(){return vu.Name}});Object.defineProperty(Nn,"CodeGen",{enumerable:!0,get:function(){return vu.CodeGen}});var Ese=Ly();Object.defineProperty(Nn,"ValidationError",{enumerable:!0,get:function(){return Ese.default}});var Tse=qf();Object.defineProperty(Nn,"MissingRefError",{enumerable:!0,get:function(){return Tse.default}})});var _5=Je(function(v5){Object.defineProperty(v5,"__esModule",{value:!0});v5.formatNames=v5.fastFormats=v5.fullFormats=void 0;function Xi(e,t){return{validate:e,compare:t}}v5.fullFormats={date:Xi(p5,jM),time:Xi(UM(!0),BM),"date-time":Xi(d5(!0),g5),"iso-time":Xi(UM(),m5),"iso-date-time":Xi(d5(),y5),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Dse,"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:Bse,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:Nse,int32:{type:"number",validate:Use},int64:{type:"number",validate:Fse},float:{type:"number",validate:h5},double:{type:"number",validate:h5},password:!0,binary:!0};v5.fastFormats={...v5.fullFormats,date:Xi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,jM),time:Xi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,BM),"date-time":Xi(/^\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,g5),"iso-time":Xi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m5),"iso-date-time":Xi(/^\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,y5),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};v5.formatNames=Object.keys(v5.fullFormats);function Pse(e){return e%4===0&&(e%100!==0||e%400===0)}var Ise=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Cse=[0,31,28,31,30,31,30,31,31,30,31,30,31];function p5(e){let t=Ise.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&Pse(r)?29:Cse[i])}function jM(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var zM=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function UM(e){return function(r){let i=zM.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],d=i[4],h=i[5]==="-"?-1:1,m=+(i[6]||0),v=+(i[7]||0);if(m>23||v>59||e&&!d)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-v*h,S=n-m*h-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function BM(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function m5(e,t){if(!(e&&t))return;let r=zM.exec(e),i=zM.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var FM=/t|\s/i;function d5(e){let t=UM(e);return function(i){let n=i.split(FM);return n.length===2&&p5(n[0])&&t(n[1])}}function g5(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function y5(e,t){if(!(e&&t))return;let[r,i]=e.split(FM),[n,o]=t.split(FM),s=jM(r,n);if(s===void 0)return;return s||BM(i,o)}var $se=/\/|:/,Ose=/^(?:[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 Dse(e){return $se.test(e)&&Ose.test(e)}var f5=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Nse(e){return f5.lastIndex=0,f5.test(e)}var Lse=-2147483648,zse=2147483647;function Use(e){return Number.isInteger(e)&&e<=zse&&e>=Lse}function Fse(e){return Number.isInteger(e)}function h5(){return!0}var jse=/[^\\]\\Z/;function Bse(e){if(jse.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var w5=Je(function(S5){Object.defineProperty(S5,"__esModule",{value:!0});S5.formatLimitDefinition=void 0;var Hse=LM(),Ai=wt(),ps=Ai.operators,iv={formatMaximum:{okStr:"<=",ok:ps.LTE,fail:ps.GT},formatMinimum:{okStr:">=",ok:ps.GTE,fail:ps.LT},formatExclusiveMaximum:{okStr:"<",ok:ps.LT,fail:ps.GTE},formatExclusiveMinimum:{okStr:">",ok:ps.GT,fail:ps.LTE}},Kse={message:({keyword:e,schemaCode:t})=>Ai.str`should be ${iv[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ai._`{comparison: ${iv[e].okStr}, limit: ${t}}`};S5.formatLimitDefinition={keyword:Object.keys(iv),type:"string",schemaType:"string",$data:!0,error:Kse,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:d}=o;if(!s.validateFormats)return;let h=new Hse.KeywordCxt(o,d.RULES.all.format.definition,"format");if(h.$data)m();else v();function m(){let S=t.scopeValue("formats",{ref:d.formats,code:s.code.formats}),x=t.const("fmt",Ai._`${S}[${h.schemaCode}]`);e.fail$data(Ai.or(Ai._`typeof ${x} != "object"`,Ai._`${x} instanceof RegExp`,Ai._`typeof ${x}.compare != "function"`,g(x)))}function v(){let S=h.schema,x=d.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let k=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Ai._`${s.code.formats}${Ai.getProperty(S)}`:void 0});e.fail$data(g(k))}function g(S){return Ai._`${S}.compare(${r}, ${i}) ${iv[n].fail} 0`}},dependencies:["format"]};var Wse=(e)=>(e.addKeyword(S5.formatLimitDefinition),e);S5.default=Wse});var E5=Je(function(rh,M5){Object.defineProperty(rh,"__esModule",{value:!0});var bu=_5(),Vse=w5(),KM=wt(),x5=new KM.Name("fullFormats"),Gse=new KM.Name("fastFormats"),WM=(e,t={keywords:!0})=>{if(Array.isArray(t))return k5(e,t,bu.fullFormats,x5),e;let[r,i]=t.mode==="fast"?[bu.fastFormats,Gse]:[bu.fullFormats,x5],n=t.formats||bu.formatNames;if(k5(e,n,r,i),t.keywords)(0,Vse.default)(e);return e};WM.get=(e,t="full")=>{let i=(t==="fast"?bu.fastFormats:bu.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function k5(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=KM._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}M5.exports=rh=WM;Object.defineProperty(rh,"__esModule",{value:!0});rh.default=WM});function iE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Su(e,t){if(t<=0)return"";if(e.length<=t)return e;let r=e.slice(0,t),i=r.charCodeAt(t-1);return V5(i>=55296&&i<=56319?r.slice(0,-1):r)}function V5(e){if(typeof Buffer<"u")return Buffer.from(e,"utf16le").toString("utf16le");return G5(e)}function G5(e){let r=[];for(let i=0;i<e.length;i+=8192){let n=Math.min(i+8192,e.length),o=new Uint16Array(n-i);for(let s=i;s<n;s++)o[s-i]=e.charCodeAt(s);r.push(String.fromCharCode(...o))}return r.join("")}var uae=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,cae=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function Yi(e){return!Array.isArray?fE(e)==="[object Array]":Array.isArray(e)}var X5=1/0;function Y5(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-X5?"-0":t}function Q5(e){return e==null?"":Y5(e)}function Ri(e){return typeof e==="string"}function cE(e){return typeof e==="number"}function e7(e){return e===!0||e===!1||t7(e)&&fE(e)=="[object Boolean]"}function dE(e){return typeof e==="object"}function t7(e){return dE(e)&&e!==null}function Ln(e){return e!==void 0&&e!==null}function dv(e){return!e.trim().length}function fE(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var r7="Incorrect 'index' type",n7=(e)=>`Invalid value for key ${e}`,i7=(e)=>`Pattern length exceeds max of ${e}.`,o7=(e)=>`Missing ${e} property in key`,s7=(e)=>`Property 'weight' in key '${e}' must be a positive integer`,oE=Object.prototype.hasOwnProperty;class hE{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((r)=>{let i=pE(r);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight}),this._keys.forEach((r)=>{r.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function pE(e){let t=null,r=null,i=null,n=1,o=null;if(Ri(e)||Yi(e))i=e,t=sE(e),r=fv(e);else{if(!oE.call(e,"name"))throw Error(o7("name"));let s=e.name;if(i=s,oE.call(e,"weight")){if(n=e.weight,n<=0)throw Error(s7(s))}t=sE(s),r=fv(s),o=e.getFn}return{path:t,id:r,weight:n,src:i,getFn:o}}function sE(e){return Yi(e)?e:e.split(".")}function fv(e){return Yi(e)?e.join("."):e}function a7(e,t){let r=[],i=!1,n=(o,s,d)=>{if(!Ln(o))return;if(!s[d])r.push(o);else{let h=s[d],m=o[h];if(!Ln(m))return;if(d===s.length-1&&(Ri(m)||cE(m)||e7(m)))r.push(Q5(m));else if(Yi(m)){i=!0;for(let v=0,g=m.length;v<g;v+=1)n(m[v],s,d+1)}else if(s.length)n(m,s,d+1)}};return n(e,Ri(t)?t.split("."):t,0),i?r:r[0]}var l7={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},u7={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},c7={location:0,threshold:0.6,distance:100},d7={useExtendedSearch:!1,getFn:a7,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},pt={...u7,...l7,...c7,...d7},f7=/[^ ]+/g;function h7(e=1,t=3){let r=new Map,i=Math.pow(10,t);return{get(n){let o=n.match(f7).length;if(r.has(o))return r.get(o);let s=1/Math.pow(o,0.5*e),d=parseFloat(Math.round(s*i)/i);return r.set(o,d),d},clear(){r.clear()}}}class sh{constructor({getFn:e=pt.getFn,fieldNormWeight:t=pt.fieldNormWeight}={}){this.norm=h7(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,r)=>{this._keysMap[t.id]=r})}create(){if(this.isCreated||!this.docs.length)return;if(this.isCreated=!0,Ri(this.docs[0]))this.docs.forEach((e,t)=>{this._addString(e,t)});else this.docs.forEach((e,t)=>{this._addObject(e,t)});this.norm.clear()}add(e){let t=this.size();if(Ri(e))this._addString(e,t);else this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t<r;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!Ln(e)||dv(e))return;let r={v:e,i:t,n:this.norm.get(e)};this.records.push(r)}_addObject(e,t){let r={i:t,$:{}};this.keys.forEach((i,n)=>{let o=i.getFn?i.getFn(e):this.getFn(e,i.path);if(!Ln(o))return;if(Yi(o)){let s=[],d=[{nestedArrIndex:-1,value:o}];while(d.length){let{nestedArrIndex:h,value:m}=d.pop();if(!Ln(m))continue;if(Ri(m)&&!dv(m)){let v={v:m,i:h,n:this.norm.get(m)};s.push(v)}else if(Yi(m))m.forEach((v,g)=>{d.push({nestedArrIndex:g,value:v})})}r.$[n]=s}else if(Ri(o)&&!dv(o)){let s={v:o,n:this.norm.get(o)};r.$[n]=s}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function mE(e,t,{getFn:r=pt.getFn,fieldNormWeight:i=pt.fieldNormWeight}={}){let n=new sh({getFn:r,fieldNormWeight:i});return n.setKeys(e.map(pE)),n.setSources(t),n.create(),n}function p7(e,{getFn:t=pt.getFn,fieldNormWeight:r=pt.fieldNormWeight}={}){let{keys:i,records:n}=e,o=new sh({getFn:t,fieldNormWeight:r});return o.setKeys(i),o.setIndexRecords(n),o}function ih(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:n=pt.distance,ignoreLocation:o=pt.ignoreLocation}={}){let s=t/e.length;if(o)return s;let d=Math.abs(i-r);if(!n)return d?1:s;return s+d/n}function m7(e=[],t=pt.minMatchCharLength){let r=[],i=-1,n=-1,o=0;for(let s=e.length;o<s;o+=1){let d=e[o];if(d&&i===-1)i=o;else if(!d&&i!==-1){if(n=o-1,n-i+1>=t)r.push([i,n]);i=-1}}if(e[o-1]&&o-i>=t)r.push([i,o-1]);return r}var ys=32;function g7(e,t,r,{location:i=pt.location,distance:n=pt.distance,threshold:o=pt.threshold,findAllMatches:s=pt.findAllMatches,minMatchCharLength:d=pt.minMatchCharLength,includeMatches:h=pt.includeMatches,ignoreLocation:m=pt.ignoreLocation}={}){if(t.length>ys)throw Error(i7(ys));let v=t.length,g=e.length,S=Math.max(0,Math.min(i,g)),x=o,k=S,T=d>1||h,E=T?Array(g):[],P;while((P=e.indexOf(t,k))>-1){let G=ih(t,{currentLocation:P,expectedLocation:S,distance:n,ignoreLocation:m});if(x=Math.min(G,x),k=P+v,T){let oe=0;while(oe<v)E[P+oe]=1,oe+=1}}k=-1;let R=[],I=1,O=v+g,D=1<<v-1;for(let G=0;G<v;G+=1){let oe=0,ee=O;while(oe<ee){if(ih(t,{errors:G,currentLocation:S+ee,expectedLocation:S,distance:n,ignoreLocation:m})<=x)oe=ee;else O=ee;ee=Math.floor((O-oe)/2+oe)}O=ee;let F=Math.max(1,S-ee+1),J=s?g:Math.min(S+ee,g)+v,a=Array(J+2);a[J+1]=(1<<G)-1;for(let p=J;p>=F;p-=1){let u=p-1,f=r[e.charAt(u)];if(T)E[u]=+!!f;if(a[p]=(a[p+1]<<1|1)&f,G)a[p]|=(R[p+1]|R[p])<<1|1|R[p+1];if(a[p]&D){if(I=ih(t,{errors:G,currentLocation:u,expectedLocation:S,distance:n,ignoreLocation:m}),I<=x){if(x=I,k=u,k<=S)break;F=Math.max(1,2*S-k)}}}if(ih(t,{errors:G+1,currentLocation:S,expectedLocation:S,distance:n,ignoreLocation:m})>x)break;R=a}let H={isMatch:k>=0,score:Math.max(0.001,I)};if(T){let G=m7(E,d);if(!G.length)H.isMatch=!1;else if(h)H.indices=G}return H}function y7(e){let t={};for(let r=0,i=e.length;r<i;r+=1){let n=e.charAt(r);t[n]=(t[n]||0)|1<<i-r-1}return t}class vv{constructor(e,{location:t=pt.location,threshold:r=pt.threshold,distance:i=pt.distance,includeMatches:n=pt.includeMatches,findAllMatches:o=pt.findAllMatches,minMatchCharLength:s=pt.minMatchCharLength,isCaseSensitive:d=pt.isCaseSensitive,ignoreLocation:h=pt.ignoreLocation}={}){if(this.options={location:t,threshold:r,distance:i,includeMatches:n,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:d,ignoreLocation:h},this.pattern=d?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;let m=(g,S)=>{this.chunks.push({pattern:g,alphabet:y7(g),startIndex:S})},v=this.pattern.length;if(v>ys){let g=0,S=v%ys,x=v-S;while(g<x)m(this.pattern.substr(g,ys),g),g+=ys;if(S){let k=v-ys;m(this.pattern.substr(k),k)}}else m(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,includeMatches:r}=this.options;if(!t)e=e.toLowerCase();if(this.pattern===e){let x={isMatch:!0,score:0};if(r)x.indices=[[0,e.length-1]];return x}let{location:i,distance:n,threshold:o,findAllMatches:s,minMatchCharLength:d,ignoreLocation:h}=this.options,m=[],v=0,g=!1;this.chunks.forEach(({pattern:x,alphabet:k,startIndex:T})=>{let{isMatch:E,score:P,indices:R}=g7(e,x,k,{location:i+T,distance:n,threshold:o,findAllMatches:s,minMatchCharLength:d,includeMatches:r,ignoreLocation:h});if(E)g=!0;if(v+=P,E&&R)m=[...m,...R]});let S={isMatch:g,score:g?v/this.chunks.length:1};if(g&&r)S.indices=m;return S}}class Qi{constructor(e){this.pattern=e}static isMultiMatch(e){return aE(e,this.multiRegex)}static isSingleMatch(e){return aE(e,this.singleRegex)}search(){}}function aE(e,t){let r=e.match(t);return r?r[1]:null}class gE extends Qi{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class yE extends Qi{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class vE extends Qi{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class bE extends Qi{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class _E extends Qi{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class SE extends Qi{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class bv extends Qi{constructor(e,{location:t=pt.location,threshold:r=pt.threshold,distance:i=pt.distance,includeMatches:n=pt.includeMatches,findAllMatches:o=pt.findAllMatches,minMatchCharLength:s=pt.minMatchCharLength,isCaseSensitive:d=pt.isCaseSensitive,ignoreLocation:h=pt.ignoreLocation}={}){super(e);this._bitapSearch=new vv(e,{location:t,threshold:r,distance:i,includeMatches:n,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:d,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class _v extends Qi{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,r,i=[],n=this.pattern.length;while((r=e.indexOf(this.pattern,t))>-1)t=r+n,i.push([r,t-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}var hv=[gE,_v,vE,bE,SE,_E,yE,bv],lE=hv.length,v7=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,b7="|";function _7(e,t={}){return e.split(b7).map((r)=>{let i=r.trim().split(v7).filter((o)=>o&&!!o.trim()),n=[];for(let o=0,s=i.length;o<s;o+=1){let d=i[o],h=!1,m=-1;while(!h&&++m<lE){let v=hv[m],g=v.isMultiMatch(d);if(g)n.push(new v(g,t)),h=!0}if(h)continue;m=-1;while(++m<lE){let v=hv[m],g=v.isSingleMatch(d);if(g){n.push(new v(g,t));break}}}return n})}var S7=new Set([bv.type,_v.type]);class wE{constructor(e,{isCaseSensitive:t=pt.isCaseSensitive,includeMatches:r=pt.includeMatches,minMatchCharLength:i=pt.minMatchCharLength,ignoreLocation:n=pt.ignoreLocation,findAllMatches:o=pt.findAllMatches,location:s=pt.location,threshold:d=pt.threshold,distance:h=pt.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:n,location:s,threshold:d,distance:h},this.pattern=t?e:e.toLowerCase(),this.query=_7(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:r,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let n=0,o=[],s=0;for(let d=0,h=t.length;d<h;d+=1){let m=t[d];o.length=0,n=0;for(let v=0,g=m.length;v<g;v+=1){let S=m[v],{isMatch:x,indices:k,score:T}=S.search(e);if(x){if(n+=1,s+=T,r){let E=S.constructor.type;if(S7.has(E))o=[...o,...k];else o.push(k)}}else{s=0,n=0,o.length=0;break}}if(n){let v={isMatch:!0,score:s/n};if(r)v.indices=o;return v}}return{isMatch:!1,score:1}}}var pv=[];function w7(...e){pv.push(...e)}function mv(e,t){for(let r=0,i=pv.length;r<i;r+=1){let n=pv[r];if(n.condition(e,t))return new n(e,t)}return new vv(e,t)}var oh={AND:"$and",OR:"$or"},gv={PATH:"$path",PATTERN:"$val"},yv=(e)=>!!(e[oh.AND]||e[oh.OR]),x7=(e)=>!!e[gv.PATH],k7=(e)=>!Yi(e)&&dE(e)&&!yv(e),uE=(e)=>({[oh.AND]:Object.keys(e).map((t)=>({[t]:e[t]}))});function xE(e,t,{auto:r=!0}={}){let i=(n)=>{let o=Object.keys(n),s=x7(n);if(!s&&o.length>1&&!yv(n))return i(uE(n));if(k7(n)){let h=s?n[gv.PATH]:o[0],m=s?n[gv.PATTERN]:n[h];if(!Ri(m))throw Error(n7(h));let v={keyId:fv(h),pattern:m};if(r)v.searcher=mv(m,t);return v}let d={children:[],operator:o[0]};return o.forEach((h)=>{let m=n[h];if(Yi(m))m.forEach((v)=>{d.children.push(i(v))})}),d};if(!yv(e))e=uE(e);return i(e)}function M7(e,{ignoreFieldNorm:t=pt.ignoreFieldNorm}){e.forEach((r)=>{let i=1;r.matches.forEach(({key:n,norm:o,score:s})=>{let d=n?n.weight:null;i*=Math.pow(s===0&&d?Number.EPSILON:s,(d||1)*(t?1:o))}),r.score=i})}function E7(e,t){let r=e.matches;if(t.matches=[],!Ln(r))return;r.forEach((i)=>{if(!Ln(i.indices)||!i.indices.length)return;let{indices:n,value:o}=i,s={indices:n,value:o};if(i.key)s.key=i.key.src;if(i.idx>-1)s.refIndex=i.idx;t.matches.push(s)})}function T7(e,t){t.score=e.score}function A7(e,t,{includeMatches:r=pt.includeMatches,includeScore:i=pt.includeScore}={}){let n=[];if(r)n.push(E7);if(i)n.push(T7);return e.map((o)=>{let{idx:s}=o,d={item:t[s],refIndex:s};if(n.length)n.forEach((h)=>{h(o,d)});return d})}class So{constructor(e,t={},r){this.options={...pt,...t},this.options.useExtendedSearch,this._keyStore=new hE(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof sh))throw Error(r7);this._myIndex=t||mE(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){if(!Ln(e))return;this._docs.push(e),this._myIndex.add(e)}remove(e=()=>!1){let t=[];for(let r=0,i=this._docs.length;r<i;r+=1){let n=this._docs[r];if(e(n,r))this.removeAt(r),r-=1,i-=1,t.push(n)}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){let{includeMatches:r,includeScore:i,shouldSort:n,sortFn:o,ignoreFieldNorm:s}=this.options,d=Ri(e)?Ri(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);if(M7(d,{ignoreFieldNorm:s}),n)d.sort(o);if(cE(t)&&t>-1)d=d.slice(0,t);return A7(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){let t=mv(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach(({v:n,i:o,n:s})=>{if(!Ln(n))return;let{isMatch:d,score:h,indices:m}=t.searchIn(n);if(d)i.push({item:n,idx:o,matches:[{score:h,value:n,norm:s,indices:m}]})}),i}_searchLogical(e){let t=xE(e,this.options),r=(s,d,h)=>{if(!s.children){let{keyId:v,searcher:g}=s,S=this._findMatches({key:this._keyStore.get(v),value:this._myIndex.getValueForItemAtKeyId(d,v),searcher:g});if(S&&S.length)return[{idx:h,item:d,matches:S}];return[]}let m=[];for(let v=0,g=s.children.length;v<g;v+=1){let S=s.children[v],x=r(S,d,h);if(x.length)m.push(...x);else if(s.operator===oh.AND)return[]}return m},i=this._myIndex.records,n={},o=[];return i.forEach(({$:s,i:d})=>{if(Ln(s)){let h=r(t,s,d);if(h.length){if(!n[d])n[d]={idx:d,item:s,matches:[]},o.push(n[d]);h.forEach(({matches:m})=>{n[d].matches.push(...m)})}}}),o}_searchObjectList(e){let t=mv(e,this.options),{keys:r,records:i}=this._myIndex,n=[];return i.forEach(({$:o,i:s})=>{if(!Ln(o))return;let d=[];if(r.forEach((h,m)=>{d.push(...this._findMatches({key:h,value:o[m],searcher:t}))}),d.length)n.push({idx:s,item:o,matches:d})}),n}_findMatches({key:e,value:t,searcher:r}){if(!Ln(t))return[];let i=[];if(Yi(t))t.forEach(({v:n,i:o,n:s})=>{if(!Ln(n))return;let{isMatch:d,score:h,indices:m}=r.searchIn(n);if(d)i.push({score:h,key:e,value:n,idx:o,norm:s,indices:m})});else{let{v:n,n:o}=t,{isMatch:s,score:d,indices:h}=r.searchIn(n);if(s)i.push({score:d,key:e,value:n,norm:o,indices:h})}return i}}So.version="7.0.0";So.createIndex=mE;So.parseIndex=p7;So.config=pt;So.parseQuery=xE;w7(wE);var kE=/[:_-]/g;class Sv{fuse;constructor(e){let t=e.map((r)=>{let{name:i,displayName:n}=r,o=i.split(kE).filter(Boolean),s=n!==i?n.split(kE).filter(Boolean):[];return{descriptionKey:(r.description??"").split(" ").map((d)=>d.toLowerCase().replace(/[^a-z0-9]/g,"")).filter(Boolean),partKey:o.length>1?o:void 0,displayPartKey:s.length>1?s:void 0,commandName:i,displayName:n,candidate:r,aliasKey:r.aliases}});this.fuse=new So(t,{includeScore:!0,threshold:0.3,location:0,distance:100,keys:[{name:"commandName",weight:3},{name:"displayName",weight:2},{name:"partKey",weight:2},{name:"aliasKey",weight:2},{name:"displayPartKey",weight:1},{name:"descriptionKey",weight:0.5}]})}search(e,t){let{getScoreBoost:r,filter:i}=t??{},n=e.trim().toLowerCase(),o=this.fuse.search(n);if(i)o=o.filter((h)=>i(h.item.candidate));return o.map((h)=>{let m=h.item.commandName.toLowerCase(),v=h.item.displayName.toLowerCase(),g=h.item.aliasKey?.map((x)=>x.toLowerCase())??[],S=r?r(h.item.candidate):0;return{r:h,name:m,display:v,aliases:g,boost:S}}).sort((h,m)=>{let v=h.name,g=m.name,S=h.aliases,x=m.aliases,k=v===n||h.display===n,T=g===n||m.display===n;if(k&&!T)return-1;if(T&&!k)return 1;let E=S.some((J)=>J===n),P=x.some((J)=>J===n);if(E&&!P)return-1;if(P&&!E)return 1;let R=(J,a)=>Math.min(J.startsWith(n)?J.length:1/0,a.startsWith(n)?a.length:1/0),I=R(v,h.display),O=R(g,m.display),D=I<1/0,H=O<1/0;if(D&&!H)return-1;if(H&&!D)return 1;if(D&&H&&I!==O)return I-O;let G=S.find((J)=>J.startsWith(n)),oe=x.find((J)=>J.startsWith(n));if(G&&!oe)return-1;if(oe&&!G)return 1;if(G&&oe&&G.length!==oe.length)return G.length-oe.length;let ee=Math.floor((h.r.score??0)*10),F=Math.floor((m.r.score??0)*10);if(ee!==F)return ee-F;return m.boost-h.boost}).map((h)=>h.r.item.candidate)}}function ma(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((d,h,m)=>{d?.removeEventListener("abort",h),m()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}function wv(){if(typeof setImmediate==="function")return new Promise((e)=>setImmediate(e));if(typeof MessageChannel==="function")return new Promise((e)=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),e()},t.port2.postMessage(null)});return ma(0)}var ME=16,RE=8,R7=6,P7=4,PE=8,I7=3,C7=1,$7=100,EE=64,TE=4;class xv{paths=[];lowerPaths=[];charBits=new Int32Array(0);pathLens=new Uint16Array(0);topLevelCache=null;matchPositions=new Int32Array(EE);readyCount=0;buildGen=0;loadFromFileList(e){let t=new Set,r=[];for(let i of e)if(i.length>0&&!t.has(i))t.add(i),r.push(i);this.buildIndex(r)}loadFromFileListAsync(e){let t=()=>{},r=new Promise((n)=>{t=n}),i=this.buildAsync(e,t);return{queryable:r,done:i}}async buildAsync(e,t){let r=++this.buildGen,i=new Set,n=[],o=performance.now();for(let d=0;d<e.length;d++){let h=e[d];if(h.length>0&&!i.has(h))i.add(h),n.push(h);if((d&255)===255&&performance.now()-o>TE){if(await wv(),this.buildGen!==r)return t(),!1;o=performance.now()}}this.resetArrays(n),o=performance.now();let s=!0;for(let d=0;d<n.length;d++)if(this.indexPath(d),(d&255)===255&&performance.now()-o>TE){if(this.readyCount=d+1,s)t(),s=!1;if(await wv(),this.buildGen!==r)return!1;o=performance.now()}return this.readyCount=n.length,t(),!0}buildIndex(e){this.buildGen++,this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=z7(e,$7)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let r=t.length;this.pathLens[e]=r;let i=0;for(let n=0;n<r;n++){let o=t.charCodeAt(n);if(o>=97&&o<=122)i|=1<<o-97}this.charBits[e]=i}search(e,t){if(t<=0)return[];if(e.length===0){if(this.topLevelCache)return this.topLevelCache.slice(0,t).map(({path:I,score:O})=>({path:I,score:O,positions:[]}));return[]}let r=e!==e.toLowerCase(),i=r?e:e.toLowerCase(),n=Math.min(i.length,EE),o=Array(n),s=0;for(let I=0;I<n;I++){let O=i.charAt(I);o[I]=O;let D=O.charCodeAt(0);if(D>=97&&D<=122)s|=1<<D-97}let d=n*(ME+RE)+PE+32,h=[],m=-1/0,{paths:v,lowerPaths:g,charBits:S,pathLens:x,readyCount:k}=this,T=this.matchPositions;e:for(let I=0;I<k;I++){if((S[I]&s)!==s)continue;let O=r?v[I]:g[I],D=O.indexOf(o[0]);if(D===-1)continue;T[0]=D;let H=0,G=0,oe=D;for(let a=1;a<n;a++){if(D=O.indexOf(o[a],oe+1),D===-1)continue e;T[a]=D;let c=D-oe-1;if(c===0)G+=P7;else H+=I7+c*C7;oe=D}if(h.length===t&&d+G-H<=m)continue;let ee=v[I],F=x[I],J=n*ME+G-H;J+=AE(ee,T[0],!0);for(let a=1;a<n;a++)J+=AE(ee,T[a],!1);if(J+=Math.max(0,32-(F>>2)),h.length<t){if(h.push({pathIndex:I,fuzzScore:J}),h.length===t)h.sort((a,c)=>a.fuzzScore-c.fuzzScore),m=h[0].fuzzScore}else if(J>m){let a=0,c=h.length;while(a<c){let p=a+c>>1;if(h[p].fuzzScore<J)a=p+1;else c=p}h.splice(a,0,{pathIndex:I,fuzzScore:J}),h.shift(),m=h[0].fuzzScore}}h.sort((I,O)=>O.fuzzScore-I.fuzzScore);let E=h.length,P=Math.max(E,1),R=Array(E);for(let I=0;I<E;I++){let O=h[I].pathIndex,D=v[O],H=g[O],G=r?D:H,oe=Array(n),ee=0;for(let a=0;a<n;a++){let c=G.indexOf(o[a],ee);oe[a]=c,ee=c+1}if(!r&&H.length!==D.length)L7(D,oe);let F=I/P,J=D.includes("test")?Math.min(F*1.05,1):F;R[I]={path:D,score:J,positions:oe}}return R}}function AE(e,t,r){if(t===0)return r?PE:0;let i=e.charCodeAt(t-1);if(O7(i))return RE;if(D7(i)&&N7(e.charCodeAt(t)))return R7;return 0}function O7(e){return e===47||e===92||e===45||e===95||e===46||e===32}function D7(e){return e>=97&&e<=122}function N7(e){return e>=65&&e<=90}function L7(e,t){let r=0,i=0,n=0;while(n<t.length&&r<e.length){let o=e.codePointAt(r),s=o>65535?2:1,d=String.fromCodePoint(o).toLowerCase().length;while(n<t.length&&t[n]<i+d)t[n]=r,n++;r+=s,i+=d}}function z7(e,t){let r=new Set;for(let n of e){let o=n.length;for(let d=0;d<n.length;d++){let h=n.charCodeAt(d);if(h===47||h===92){o=d;break}}let s=n.slice(0,o);if(s.length>0){if(r.add(s),r.size>=t)break}}let i=Array.from(r);return i.sort((n,o)=>{let s=n.length-o.length;if(s!==0)return s;return n<o?-1:n>o?1:0}),i.slice(0,t).map((n)=>({path:n,score:0,positions:[]}))}class li extends Error{}var U7=["signed_out","identity_changed","transient","refresh_failed"];function IE(e){return U7.some((t)=>t===e)}var{writeFileSync:Bke}=(()=>({}));var wu=function(){return"/"};dn();var Mu=()=>globalThis.crypto.randomUUID();pn();pn();function ab(e){return e}var aT="[\\w-]{1,63}",qU=new RegExp(`^${aT}$`);var Yae=new RegExp(`^a(?:${aT}-)?[0-9a-f]{16}$`);function lT(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=sb("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var HU="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function uT(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?lT(e,HU):null}function KU(){this.__data__=[],this.size=0}var cT=KU;function WU(e,t){return e===t||e!==e&&t!==t}var xh=WU;function ZU(e,t){var r=e.length;while(r--)if(xh(e[r][0],t))return r;return-1}var Mo=ZU;var VU=Array.prototype,GU=VU.splice;function JU(e){var t=this.__data__,r=Mo(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else GU.call(t,r,1);return--this.size,!0}var dT=JU;function XU(e){var t=this.__data__,r=Mo(t,e);return r<0?void 0:t[r][1]}var fT=XU;function YU(e){return Mo(this.__data__,e)>-1}var hT=YU;function QU(e,t){var r=this.__data__,i=Mo(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var pT=QU;function wa(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}wa.prototype.clear=cT;wa.prototype.delete=dT;wa.prototype.get=fT;wa.prototype.has=hT;wa.prototype.set=pT;var Eo=wa;function eF(){this.__data__=new Eo,this.size=0}var mT=eF;function tF(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var gT=tF;function rF(e){return this.__data__.get(e)}var yT=rF;function nF(e){return this.__data__.has(e)}var vT=nF;var iF=typeof global=="object"&&global&&global.Object===Object&&global,kh=iF;var oF=typeof self=="object"&&self&&self.Object===Object&&self,sF=kh||oF||Function("return this")(),Fr=sF;var aF=Fr.Symbol,Jn=aF;var bT=Object.prototype,{hasOwnProperty:lF,toString:uF}=bT,Uu=Jn?Jn.toStringTag:void 0;function cF(e){var t=lF.call(e,Uu),r=e[Uu];try{e[Uu]=void 0;var i=!0}catch(o){}var n=uF.call(e);if(i)if(t)e[Uu]=r;else delete e[Uu];return n}var _T=cF;var dF=Object.prototype,fF=dF.toString;function hF(e){return fF.call(e)}var ST=hF;var pF="[object Null]",mF="[object Undefined]",wT=Jn?Jn.toStringTag:void 0;function gF(e){if(e==null)return e===void 0?mF:pF;return wT&&wT in Object(e)?_T(e):ST(e)}var ui=gF;function yF(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var xa=yF;var vF="[object AsyncFunction]",bF="[object Function]",_F="[object GeneratorFunction]",SF="[object Proxy]";function wF(e){if(!xa(e))return!1;var t=ui(e);return t==bF||t==_F||t==vF||t==SF}var Mh=wF;var xF=Fr["__core-js_shared__"],Eh=xF;var xT=function(){var e=/[^.]+$/.exec(Eh&&Eh.keys&&Eh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function kF(e){return!!xT&&xT in e}var kT=kF;var MF=Function.prototype,EF=MF.toString;function TF(e){if(e!=null){try{return EF.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var io=TF;var AF=/[\\^$.*+?()[\]{}|]/g,RF=/^\[object .+?Constructor\]$/,PF=Function.prototype,IF=Object.prototype,CF=PF.toString,$F=IF.hasOwnProperty,OF=RegExp("^"+CF.call($F).replace(AF,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function DF(e){if(!xa(e)||kT(e))return!1;var t=Mh(e)?OF:RF;return t.test(io(e))}var MT=DF;function NF(e,t){return e==null?void 0:e[t]}var ET=NF;function LF(e,t){var r=ET(e,t);return MT(r)?r:void 0}var Mn=LF;var zF=Mn(Fr,"Map"),To=zF;var UF=Mn(Object,"create"),oo=UF;function FF(){this.__data__=oo?oo(null):{},this.size=0}var TT=FF;function jF(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var AT=jF;var BF="__lodash_hash_undefined__",qF=Object.prototype,HF=qF.hasOwnProperty;function KF(e){var t=this.__data__;if(oo){var r=t[e];return r===BF?void 0:r}return HF.call(t,e)?t[e]:void 0}var RT=KF;var WF=Object.prototype,ZF=WF.hasOwnProperty;function VF(e){var t=this.__data__;return oo?t[e]!==void 0:ZF.call(t,e)}var PT=VF;var GF="__lodash_hash_undefined__";function JF(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oo&&t===void 0?GF:t,this}var IT=JF;function ka(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}ka.prototype.clear=TT;ka.prototype.delete=AT;ka.prototype.get=RT;ka.prototype.has=PT;ka.prototype.set=IT;var lb=ka;function XF(){this.size=0,this.__data__={hash:new lb,map:new(To||Eo),string:new lb}}var CT=XF;function YF(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var $T=YF;function QF(e,t){var r=e.__data__;return $T(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ao=QF;function ej(e){var t=Ao(this,e).delete(e);return this.size-=t?1:0,t}var OT=ej;function tj(e){return Ao(this,e).get(e)}var DT=tj;function rj(e){return Ao(this,e).has(e)}var NT=rj;function nj(e,t){var r=Ao(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var LT=nj;function Ma(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Ma.prototype.clear=CT;Ma.prototype.delete=OT;Ma.prototype.get=DT;Ma.prototype.has=NT;Ma.prototype.set=LT;var Es=Ma;var ij=200;function oj(e,t){var r=this.__data__;if(r instanceof Eo){var i=r.__data__;if(!To||i.length<ij-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Es(i)}return r.set(e,t),this.size=r.size,this}var zT=oj;function Ea(e){var t=this.__data__=new Eo(e);this.size=t.size}Ea.prototype.clear=mT;Ea.prototype.delete=gT;Ea.prototype.get=yT;Ea.prototype.has=vT;Ea.prototype.set=zT;var Ta=Ea;var sj="__lodash_hash_undefined__";function aj(e){return this.__data__.set(e,sj),this}var UT=aj;function lj(e){return this.__data__.has(e)}var FT=lj;function Th(e){var t=-1,r=e==null?0:e.length;this.__data__=new Es;while(++t<r)this.add(e[t])}Th.prototype.add=Th.prototype.push=UT;Th.prototype.has=FT;var jT=Th;function uj(e,t){var r=-1,i=e==null?0:e.length;while(++r<i)if(t(e[r],r,e))return!0;return!1}var BT=uj;function cj(e,t){return e.has(t)}var qT=cj;var dj=1,fj=2;function hj(e,t,r,i,n,o){var s=r&dj,d=e.length,h=t.length;if(d!=h&&!(s&&h>d))return!1;var m=o.get(e),v=o.get(t);if(m&&v)return m==t&&v==e;var g=-1,S=!0,x=r&fj?new jT:void 0;o.set(e,t),o.set(t,e);while(++g<d){var k=e[g],T=t[g];if(i)var E=s?i(T,k,g,t,e,o):i(k,T,g,e,t,o);if(E!==void 0){if(E)continue;S=!1;break}if(x){if(!BT(t,function(P,R){if(!qT(x,R)&&(k===P||n(k,P,r,i,o)))return x.push(R)})){S=!1;break}}else if(!(k===T||n(k,T,r,i,o))){S=!1;break}}return o.delete(e),o.delete(t),S}var Ah=hj;var pj=Fr.Uint8Array,ub=pj;function mj(e){var t=-1,r=Array(e.size);return e.forEach(function(i,n){r[++t]=[n,i]}),r}var HT=mj;function gj(e){var t=-1,r=Array(e.size);return e.forEach(function(i){r[++t]=i}),r}var KT=gj;var yj=1,vj=2,bj="[object Boolean]",_j="[object Date]",Sj="[object Error]",wj="[object Map]",xj="[object Number]",kj="[object RegExp]",Mj="[object Set]",Ej="[object String]",Tj="[object Symbol]",Aj="[object ArrayBuffer]",Rj="[object DataView]",WT=Jn?Jn.prototype:void 0,cb=WT?WT.valueOf:void 0;function Pj(e,t,r,i,n,o,s){switch(r){case Rj:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Aj:if(e.byteLength!=t.byteLength||!o(new ub(e),new ub(t)))return!1;return!0;case bj:case _j:case xj:return xh(+e,+t);case Sj:return e.name==t.name&&e.message==t.message;case kj:case Ej:return e==t+"";case wj:var d=HT;case Mj:var h=i&yj;if(d||(d=KT),e.size!=t.size&&!h)return!1;var m=s.get(e);if(m)return m==t;i|=vj,s.set(e,t);var v=Ah(d(e),d(t),i,n,o,s);return s.delete(e),v;case Tj:if(cb)return cb.call(e)==cb.call(t)}return!1}var ZT=Pj;function Ij(e,t){var r=-1,i=t.length,n=e.length;while(++r<i)e[n+r]=t[r];return e}var VT=Ij;var Cj=Array.isArray,Kr=Cj;function $j(e,t,r){var i=t(e);return Kr(e)?i:VT(i,r(e))}var GT=$j;function Oj(e,t){var r=-1,i=e==null?0:e.length,n=0,o=[];while(++r<i){var s=e[r];if(t(s,r,e))o[n++]=s}return o}var JT=Oj;function Dj(){return[]}var XT=Dj;var Nj=Object.prototype,Lj=Nj.propertyIsEnumerable,YT=Object.getOwnPropertySymbols,zj=!YT?XT:function(e){if(e==null)return[];return e=Object(e),JT(YT(e),function(t){return Lj.call(e,t)})},QT=zj;function Uj(e,t){var r=-1,i=Array(e);while(++r<e)i[r]=t(r);return i}var eA=Uj;function Fj(e){return e!=null&&typeof e=="object"}var ci=Fj;var jj="[object Arguments]";function Bj(e){return ci(e)&&ui(e)==jj}var db=Bj;var tA=Object.prototype,{hasOwnProperty:qj,propertyIsEnumerable:Hj}=tA,Kj=db(function(){return arguments}())?db:function(e){return ci(e)&&qj.call(e,"callee")&&!Hj.call(e,"callee")},Rh=Kj;var Ih={};cn(Ih,{default:()=>Aa});function Wj(){return!1}var rA=Wj;var oA=typeof Ih=="object"&&Ih&&!Ih.nodeType&&Ih,nA=oA&&typeof Ph=="object"&&Ph&&!Ph.nodeType&&Ph,Zj=nA&&nA.exports===oA,iA=Zj?Fr.Buffer:void 0,Vj=iA?iA.isBuffer:void 0,Gj=Vj||rA,Aa=Gj;var Jj=9007199254740991,Xj=/^(?:0|[1-9]\d*)$/;function Yj(e,t){var r=typeof e;return t=t==null?Jj:t,!!t&&(r=="number"||r!="symbol"&&Xj.test(e))&&(e>-1&&e%1==0&&e<t)}var Ch=Yj;var Qj=9007199254740991;function eB(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Qj}var Ra=eB;var tB="[object Arguments]",rB="[object Array]",nB="[object Boolean]",iB="[object Date]",oB="[object Error]",sB="[object Function]",aB="[object Map]",lB="[object Number]",uB="[object Object]",cB="[object RegExp]",dB="[object Set]",fB="[object String]",hB="[object WeakMap]",pB="[object ArrayBuffer]",mB="[object DataView]",gB="[object Float32Array]",yB="[object Float64Array]",vB="[object Int8Array]",bB="[object Int16Array]",_B="[object Int32Array]",SB="[object Uint8Array]",wB="[object Uint8ClampedArray]",xB="[object Uint16Array]",kB="[object Uint32Array]",Gt={};Gt[gB]=Gt[yB]=Gt[vB]=Gt[bB]=Gt[_B]=Gt[SB]=Gt[wB]=Gt[xB]=Gt[kB]=!0;Gt[tB]=Gt[rB]=Gt[pB]=Gt[nB]=Gt[mB]=Gt[iB]=Gt[oB]=Gt[sB]=Gt[aB]=Gt[lB]=Gt[uB]=Gt[cB]=Gt[dB]=Gt[fB]=Gt[hB]=!1;function MB(e){return ci(e)&&Ra(e.length)&&!!Gt[ui(e)]}var sA=MB;function EB(e){return function(t){return e(t)}}var aA=EB;var Oh={};cn(Oh,{default:()=>Dh});var lA=typeof Oh=="object"&&Oh&&!Oh.nodeType&&Oh,Fu=lA&&typeof $h=="object"&&$h&&!$h.nodeType&&$h,TB=Fu&&Fu.exports===lA,fb=TB&&kh.process,AB=function(){try{var e=Fu&&Fu.require&&Fu.require("util").types;if(e)return e;return fb&&fb.binding&&fb.binding("util")}catch(t){}}(),Dh=AB;var uA=Dh&&Dh.isTypedArray,RB=uA?aA(uA):sA,Nh=RB;var PB=Object.prototype,IB=PB.hasOwnProperty;function CB(e,t){var r=Kr(e),i=!r&&Rh(e),n=!r&&!i&&Aa(e),o=!r&&!i&&!n&&Nh(e),s=r||i||n||o,d=s?eA(e.length,String):[],h=d.length;for(var m in e)if((t||IB.call(e,m))&&!(s&&(m=="length"||n&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||Ch(m,h))))d.push(m);return d}var cA=CB;var $B=Object.prototype;function OB(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||$B;return e===r}var dA=OB;function DB(e,t){return function(r){return e(t(r))}}var fA=DB;var NB=fA(Object.keys,Object),hA=NB;var LB=Object.prototype,zB=LB.hasOwnProperty;function UB(e){if(!dA(e))return hA(e);var t=[];for(var r in Object(e))if(zB.call(e,r)&&r!="constructor")t.push(r);return t}var pA=UB;function FB(e){return e!=null&&Ra(e.length)&&!Mh(e)}var mA=FB;function jB(e){return mA(e)?cA(e):pA(e)}var Pa=jB;function BB(e){return GT(e,Pa,QT)}var hb=BB;var qB=1,HB=Object.prototype,KB=HB.hasOwnProperty;function WB(e,t,r,i,n,o){var s=r&qB,d=hb(e),h=d.length,m=hb(t),v=m.length;if(h!=v&&!s)return!1;var g=h;while(g--){var S=d[g];if(!(s?S in t:KB.call(t,S)))return!1}var x=o.get(e),k=o.get(t);if(x&&k)return x==t&&k==e;var T=!0;o.set(e,t),o.set(t,e);var E=s;while(++g<h){S=d[g];var P=e[S],R=t[S];if(i)var I=s?i(R,P,S,t,e,o):i(P,R,S,e,t,o);if(!(I===void 0?P===R||n(P,R,r,i,o):I)){T=!1;break}E||(E=S=="constructor")}if(T&&!E){var O=e.constructor,D=t.constructor;if(O!=D&&(("constructor"in e)&&("constructor"in t))&&!(typeof O=="function"&&O instanceof O&&typeof D=="function"&&D instanceof D))T=!1}return o.delete(e),o.delete(t),T}var gA=WB;var ZB=Mn(Fr,"DataView"),Lh=ZB;var VB=Mn(Fr,"Promise"),zh=VB;var GB=Mn(Fr,"Set"),Uh=GB;var JB=Mn(Fr,"WeakMap"),Fh=JB;var yA="[object Map]",XB="[object Object]",vA="[object Promise]",bA="[object Set]",_A="[object WeakMap]",SA="[object DataView]",YB=io(Lh),QB=io(To),eq=io(zh),tq=io(Uh),rq=io(Fh),Ts=ui;if(Lh&&Ts(new Lh(new ArrayBuffer(1)))!=SA||To&&Ts(new To)!=yA||zh&&Ts(zh.resolve())!=vA||Uh&&Ts(new Uh)!=bA||Fh&&Ts(new Fh)!=_A)Ts=function(e){var t=ui(e),r=t==XB?e.constructor:void 0,i=r?io(r):"";if(i)switch(i){case YB:return SA;case QB:return yA;case eq:return vA;case tq:return bA;case rq:return _A}return t};var pb=Ts;var nq=1,wA="[object Arguments]",xA="[object Array]",jh="[object Object]",iq=Object.prototype,kA=iq.hasOwnProperty;function oq(e,t,r,i,n,o){var s=Kr(e),d=Kr(t),h=s?xA:pb(e),m=d?xA:pb(t);h=h==wA?jh:h,m=m==wA?jh:m;var v=h==jh,g=m==jh,S=h==m;if(S&&Aa(e)){if(!Aa(t))return!1;s=!0,v=!1}if(S&&!v)return o||(o=new Ta),s||Nh(e)?Ah(e,t,r,i,n,o):ZT(e,t,h,r,i,n,o);if(!(r&nq)){var x=v&&kA.call(e,"__wrapped__"),k=g&&kA.call(t,"__wrapped__");if(x||k){var T=x?e.value():e,E=k?t.value():t;return o||(o=new Ta),n(T,E,r,i,o)}}if(!S)return!1;return o||(o=new Ta),gA(e,t,r,i,n,o)}var MA=oq;function EA(e,t,r,i,n){if(e===t)return!0;if(e==null||t==null||!ci(e)&&!ci(t))return e!==e&&t!==t;return MA(e,t,r,i,EA,n)}var Ia=EA;function sq(e,t){return Ia(e,t)}var Ca=sq;dn();var aq;function so(){return aq===!0}class di{#e;#t=new WeakMap;constructor(e){this.#e=e}of(e){let t=this.#t.get(e);if(t!==void 0)return t;let r=this.#e();return this.#t.set(e,r),r}}var TA=globalThis.process?.getBuiltinModule?.("async_hooks"),mb=TA?(e)=>TA.AsyncResource.bind(e):(e)=>e;function $a(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function ir(){let e=new Set;return{subscribe(t){let r=mb(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}class AA{mergedSettings=null;perSource=new Map;parsedFiles=new Map;folderListings=new Map;managedFileReads=new Map;primedFiles=new Set;policyWalks=0;walkedFolders=new Map;policy={};lastPolicyEnvComposition=null;isLoadingFromDisk=!1;autoModeUntrustedSourceWarned=!1;changed=ir();internalWrites=new Map;enabledSources;pluginBase;epoch=0;systemSpaceServingLogged=!1;systemAttestationContradicted=!1;backendReadResetTail=Promise.resolve();backgroundWorkTail=Promise.resolve();invalidated=ir();pluginBaseLoaded=!1;primer;localStoreProbes=new RA;retained=new Map;retainedListings=new Map;setPluginBase(e){this.pluginBase=e,this.pluginBaseLoaded=!0}clearPluginBase(){this.pluginBase=void 0}invalidateAll(e){if(this.epoch++,this.mergedSettings=null,this.perSource.clear(),this.parsedFiles.clear(),this.primedFiles.clear(),this.policyWalks=0,this.walkedFolders.clear(),this.folderListings.clear(),this.policy={},e?.userLayer==="retain"&&so()&&this.primer!==void 0){for(let[t,r]of this.retained)this.parsedFiles.set(t,r.parsed),this.primedFiles.add(t);for(let[t,r]of this.retainedListings)this.folderListings.set(t,r.names)}else this.retained.clear(),this.retainedListings.clear();this.invalidated.emit()}invalidatePolicyLayer(){this.mergedSettings=null,this.perSource.delete("policySettings"),this.policy={}}onInvalidate(e){return this.invalidated.subscribe(e)}seedParsedFile(e,t,r,i){if(i!==this.epoch)return!1;let n=this.parsedFiles.get(e),o=n===void 0||!Ca(n,r);if(this.parsedFiles.set(e,r),o||this.primedFiles.has(e))this.primedFiles.add(e);let s=this.retained.get(e);if(s!==void 0)s.parsed=r;if(o)this.dropDerivedCaches(t);return!0}walkReadDiffers(e,t){let r=this.parsedFiles.get(e);return r!==void 0&&!this.primedFiles.has(e)&&!Ca(r,t)}unseedParsedFile(e,t,r){if(r!==this.epoch)return;if(this.retained.delete(e),!this.primedFiles.has(e)||t==="policySettings"&&this.policyWalks>0)return;this.primedFiles.delete(e),this.parsedFiles.delete(e),this.dropDerivedCaches(t)}dropDerivedCaches(e){if(this.perSource.delete(e),this.mergedSettings=null,e==="policySettings")this.policy={}}primedFolderListing(e){return so()?this.folderListings.get(e):void 0}folderListingForPolicyWalk(e){if(!so())return;this.policyWalks++;let t=this.folderListings.get(e);if(!this.walkedFolders.has(e)||t!==void 0)this.walkedFolders.set(e,t??null);return t}noteWalkListing(e,t){if(!so())return;this.walkedFolders.set(e,t)}get policyWalkCount(){return this.policyWalks}policyInstallVerdict(e,t,r){let i=this.parsedFiles.get(e);if(i===void 0||Ca(i,t))return"install";if(!this.primedFiles.has(e))return"raced";if(this.policyWalks===0)return"install";return this.policyWalks>r?"raced":"deferred"}folderInstallVerdict(e,t,r){if(!this.walkedFolders.has(e))return this.hasParsedDropInOutside(e,t)?"raced":"install";let i=this.walkedFolders.get(e);if(i!==null&&i!==void 0&&Ca(i,t))return"install";return this.policyWalks>r?"raced":"deferred"}seedFolderListing(e,t,r){if(r!==this.epoch)return!1;let i=this.folderListings.get(e);this.folderListings.set(e,t);let n=this.retainedListings.get(e);if(n!==void 0)n.names=t;if(i!==void 0&&!Ca(i,t))this.dropDerivedCaches("policySettings");return!0}walkReadManagedFileIn(e,t){for(let[r,i]of this.parsedFiles)if(!r.includes("\x00")&&!this.primedFiles.has(r)&&(i.settings!==null||i.errors.length>0)&&(r===e||rn(r)===t))return!0;return!1}walkRead(e){return this.parsedFiles.has(e)&&!this.primedFiles.has(e)}hasParsedDropInOutside(e,t){for(let r of this.parsedFiles.keys())if(!r.includes("\x00")&&!this.primedFiles.has(r)&&rn(r)===e&&!t.includes(vs(r)))return!0;return!1}clearFolderListing(e,t){if(t!==this.epoch)return;if(this.retainedListings.delete(e),!this.folderListings.has(e)||this.walkedFolders.has(e))return;this.folderListings.delete(e),this.dropDerivedCaches("policySettings")}retainLayer(e,t){let r={parsed:t};return this.retained.set(e,r),()=>{if(this.retained.get(e)===r)this.retained.delete(e)}}dropRetainedLayer(e){this.retained.delete(e)}retainFolderListing(e,t){let r={names:t};return this.retainedListings.set(e,r),()=>{if(this.retainedListings.get(e)===r)this.retainedListings.delete(e)}}}class RA{ownerUidsByRoot=new Map;realHomeDir=void 0;canonicalRootOwnerUids(e,t){let r=this.ownerUidsByRoot.get(e);if(r!==void 0)return r;let i=t(e);return this.ownerUidsByRoot.set(e,i),i}hasCanonicalRootOwnerUids(e){return this.ownerUidsByRoot.has(e)}primeCanonicalRootOwnerUids(e,t){if(this.ownerUidsByRoot.has(e))return!1;return this.ownerUidsByRoot.set(e,t),!0}clearCanonicalRootOwnerUids(){this.ownerUidsByRoot.clear()}normalizedRealHomeDir(e){return this.realHomeDir??=e(),this.realHomeDir}clearNormalizedRealHomeDir(){this.realHomeDir=void 0}}var uq=new di(()=>new AA);function Bh(){return{sent:new Set,rejected:new Set,declaredTools:void 0,declaredToolsDecided:!1,readsTranscriptRecord:!0,nameOnlyAnnouncements:new Set,surfacedOnWire:new Set,advisorHeld:void 0}}function gb(e){let t=Bh();return t.declaredTools=e.declaredTools,t.declaredToolsDecided=e.declaredToolsDecided,t.readsTranscriptRecord=e.readsTranscriptRecord,t.advisorHeld=e.advisorHeld,t}var{realpathSync:IA}=(()=>({}));var PA=function(){return"/"};function CA(e){return process.platform==="darwin"?e.normalize("NFC"):e}function yb(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof IA==="function")try{let t=PA();try{e=CA(IA(t))}catch{e=CA(t)}}catch{}return e}var $A=yb(),qfe=(()=>{if(typeof process>"u"||typeof process.cwd!=="function")return null;try{return process.cwd()}catch{return null}})();class vb{spawner=void 0;pairings=new Map;mainEnsureInFlight=!1;mainSlotBlocked=!1}class bb{#e=Bh();#t=void 0;stickyBetas(){return this.#e}unlatchStickyBetas(){this.#e=gb(this.#e)}atisLatch(){return this.#t}replaceAtisLatch(e){this.#t=e}reset(){this.#e=Bh(),this.#t=void 0}}var cq=function(){try{var e=Mn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),_b=cq;function dq(e,t,r){if(t=="__proto__"&&_b)_b(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0});else e[t]=r}var OA=dq;function fq(e){return function(t,r,i){var n=-1,o=Object(t),s=i(t),d=s.length;while(d--){var h=s[e?d:++n];if(r(o[h],h,o)===!1)break}return t}}var DA=fq;var hq=DA(),NA=hq;function pq(e,t){return e&&NA(e,t,Pa)}var LA=pq;var mq=1,gq=2;function yq(e,t,r,i){var n=r.length,o=n,s=!i;if(e==null)return!o;e=Object(e);while(n--){var d=r[n];if(s&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}while(++n<o){d=r[n];var h=d[0],m=e[h],v=d[1];if(s&&d[2]){if(m===void 0&&!(h in e))return!1}else{var g=new Ta;if(i)var S=i(m,v,h,e,t,g);if(!(S===void 0?Ia(v,m,mq|gq,i,g):S))return!1}}return!0}var zA=yq;function vq(e){return e===e&&!xa(e)}var qh=vq;function bq(e){var t=Pa(e),r=t.length;while(r--){var i=t[r],n=e[i];t[r]=[i,n,qh(n)]}return t}var UA=bq;function _q(e,t){return function(r){if(r==null)return!1;return r[e]===t&&(t!==void 0||(e in Object(r)))}}var Hh=_q;function Sq(e){var t=UA(e);if(t.length==1&&t[0][2])return Hh(t[0][0],t[0][1]);return function(r){return r===e||zA(r,e,t)}}var FA=Sq;var wq="[object Symbol]";function xq(e){return typeof e=="symbol"||ci(e)&&ui(e)==wq}var Oa=xq;var kq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mq=/^\w*$/;function Eq(e,t){if(Kr(e))return!1;var r=typeof e;if(r=="number"||r=="symbol"||r=="boolean"||e==null||Oa(e))return!0;return Mq.test(e)||!kq.test(e)||t!=null&&e in Object(t)}var Da=Eq;var Tq="Expected a function";function Sb(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(Tq);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Sb.Cache||Es),r}Sb.Cache=Es;var ju=Sb;var Aq=500;function Rq(e){var t=ju(e,function(i){if(r.size===Aq)r.clear();return i}),r=t.cache;return t}var jA=Rq;var Pq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Iq=/\\(\\)?/g,Cq=jA(function(e){var t=[];if(e.charCodeAt(0)===46)t.push("");return e.replace(Pq,function(r,i,n,o){t.push(n?o.replace(Iq,"$1"):i||r)}),t}),BA=Cq;function $q(e,t){var r=-1,i=e==null?0:e.length,n=Array(i);while(++r<i)n[r]=t(e[r],r,e);return n}var qA=$q;var Oq=1/0,HA=Jn?Jn.prototype:void 0,KA=HA?HA.toString:void 0;function WA(e){if(typeof e=="string")return e;if(Kr(e))return qA(e,WA)+"";if(Oa(e))return KA?KA.call(e):"";var t=e+"";return t=="0"&&1/e==-Oq?"-0":t}var ZA=WA;function Dq(e){return e==null?"":ZA(e)}var VA=Dq;function Nq(e,t){if(Kr(e))return e;return Da(e,t)?[e]:BA(VA(e))}var Kh=Nq;var Lq=1/0;function zq(e){if(typeof e=="string"||Oa(e))return e;var t=e+"";return t=="0"&&1/e==-Lq?"-0":t}var Ro=zq;function Uq(e,t){t=Kh(t,e);var r=0,i=t.length;while(e!=null&&r<i)e=e[Ro(t[r++])];return r&&r==i?e:void 0}var Wh=Uq;function Fq(e,t,r){var i=e==null?void 0:Wh(e,t);return i===void 0?r:i}var GA=Fq;function jq(e,t){return e!=null&&t in Object(e)}var JA=jq;function Bq(e,t,r){t=Kh(t,e);var i=-1,n=t.length,o=!1;while(++i<n){var s=Ro(t[i]);if(!(o=e!=null&&r(e,s)))break;e=e[s]}if(o||++i!=n)return o;return n=e==null?0:e.length,!!n&&Ra(n)&&Ch(s,n)&&(Kr(e)||Rh(e))}var XA=Bq;function qq(e,t){return e!=null&&XA(e,t,JA)}var YA=qq;var Hq=1,Kq=2;function Wq(e,t){if(Da(e)&&qh(t))return Hh(Ro(e),t);return function(r){var i=GA(r,e);return i===void 0&&i===t?YA(r,e):Ia(t,i,Hq|Kq)}}var QA=Wq;function Zq(e){return e}var eR=Zq;function Vq(e){return function(t){return t==null?void 0:t[e]}}var tR=Vq;function Gq(e){return function(t){return Wh(t,e)}}var rR=Gq;function Jq(e){return Da(e)?tR(Ro(e)):rR(e)}var nR=Jq;function Xq(e){if(typeof e=="function")return e;if(e==null)return eR;if(typeof e=="object")return Kr(e)?QA(e[0],e[1]):FA(e);return nR(e)}var Zh=Xq;function Yq(e,t){var r={};return t=Zh(t,3),LA(e,function(i,n,o){OA(r,n,t(i,n,o))}),r}var wb=Yq;function Qq(e,t){var r,i=-1,n=e.length;while(++i<n){var o=t(e[i]);if(o!==void 0)r=r===void 0?o:r+o}return r}var iR=Qq;function eH(e,t){return e&&e.length?iR(e,Zh(t,2)):0}var Na=eH;function Vh(e){let t=Object.create(null);return Object.assign(t,e)}class xb{#e=0;#t=0;#r=0;#n=0;#i=Date.now();#o=void 0;#u=0;#l=0;#s=0;#c=!1;#a=Vh();#f=null;#h=null;#d=null;totalCostUSD(){return this.#e}restoredCostUSD(){return this.#s}totalAPIDuration(){return this.#t}totalAPIDurationWithoutRetries(){return this.#r}totalToolDuration(){return this.#n}totalDuration(){return Math.max(0,Date.now()-this.#i)}sessionStartTime(){return this.#o??this.#i}totalLinesAdded(){return this.#u}totalLinesRemoved(){return this.#l}hasUnknownModelCost(){return this.#c}modelUsage(){return this.#a}usageForModel(e){return this.#a[e]}totalInputTokens(){return Na(Object.values(this.#a),"inputTokens")}totalOutputTokens(){return Na(Object.values(this.#a),"outputTokens")}totalCacheReadInputTokens(){return Na(Object.values(this.#a),"cacheReadInputTokens")}totalCacheCreationInputTokens(){return Na(Object.values(this.#a),"cacheCreationInputTokens")}totalWebSearchRequests(){return Na(Object.values(this.#a),"webSearchRequests")}recordApiDuration(e,t){this.#t+=e,this.#r+=t}recordCost(e,t,r){this.#a[r]=t,this.#e+=e}recordToolDuration(e){this.#n+=e}recordLinesChanged(e,t){this.#u+=e,this.#l+=t}markUnknownModelCost(){this.#c=!0}zeroDurationsAndCostForTests(){this.#t=0,this.#r=0,this.#e=0,this.#s=0}restartClock(){this.#i=Date.now(),this.anchorLogicalStart(void 0)}anchorLogicalStart(e){this.#o=e===void 0?void 0:Math.min(e,this.#i)}restore({totalCostUSD:e,totalAPIDuration:t,totalAPIDurationWithoutRetries:r,totalToolDuration:i,totalLinesAdded:n,totalLinesRemoved:o,lastDuration:s,startTime:d,modelUsage:h,hasUnknownModelCost:m},v){if(this.#d=v,this.#e=e,this.#s=e,this.#t=t,this.#r=r,this.#n=i,this.#u=n,this.#l=o,this.#c=m??!1,h)this.#a=Vh(h);if(s!==void 0)this.#i=Date.now()-s;this.anchorLogicalStart(d)}registerSaver(e){this.#f=e}runSaver(e,t){(this.#f??(t?t.#f:null))?.(e)}registerTranscriptRecorder(e){this.#h=e}runTranscriptRecorder(e,t,r){(this.#h??(r?r.#h:null))?.(e,t)}snapshot(){return{ownerSessionId:this.#d,totalCostUSD:this.#e,totalAPIDuration:this.#t,totalAPIDurationWithoutRetries:this.#r,totalToolDuration:this.#n,startTime:this.#i,sessionLogicalStartTime:this.#o,totalLinesAdded:this.#u,totalLinesRemoved:this.#l,restoredCostUSD:this.#s,hasUnknownModelCost:this.#c,modelUsage:wb(this.#a,(e)=>({...e}))}}restoreSnapshot(e){this.#d=e.ownerSessionId,this.#e=e.totalCostUSD,this.#t=e.totalAPIDuration,this.#r=e.totalAPIDurationWithoutRetries,this.#n=e.totalToolDuration,this.#i=e.startTime,this.#o=e.sessionLogicalStartTime,this.#u=e.totalLinesAdded,this.#l=e.totalLinesRemoved,this.#s=e.restoredCostUSD,this.#c=e.hasUnknownModelCost,this.#a=Vh(wb(e.modelUsage,(t)=>({...t})))}claim(e){this.#d??=e}scopeTo(e){this.#d=e}ownerSessionId(){return this.#d}belongsTo(e){return this.#d===e}reset(e){this.#d=e,this.#e=0,this.#s=0,this.#t=0,this.#r=0,this.#n=0,this.#i=Date.now(),this.anchorLogicalStart(void 0),this.#u=0,this.#l=0,this.#c=!1,this.#a=Vh()}}class kb{#e=!1;fableConsentSessionFallback(){return this.#e}replaceFableConsentSessionFallback(e){this.#e=e}reset(){this.#e=!1}}class Mb{#e={registeredHooks:null};#t=void 0;#r=void 0;holder(){return this.#e}mainThreadAgentType(){return this.#t}replaceMainThreadAgentType(e){this.#t=e}mainThreadAgentHooks(){return this.#r}replaceMainThreadAgentHooks(e){this.#r=e}reset(){this.#e={registeredHooks:null},this.#t=void 0,this.#r=void 0}}class Eb{#e=new Map;skills(){return this.#e}lookup(e){return this.#e.get(e)}record(e,t){this.#e.set(e,t)}forget(e){this.#e.delete(e)}forgetAll(){this.#e.clear()}reset(){this.#e=new Map}}class Tb{#e=[];#t;#r;#n;#i;approvedServers(){return this.#e}approveServers(e,t){for(let r of t)if(!this.#e.some((i)=>i.name===r&&i.workspaceKey===e))this.#e.push({name:r,workspaceKey:e})}registerClientsAccessor(e){this.#t=e}acquireClientsAccessor(e){if(this.#t)return()=>{};return this.#t=e,()=>{if(this.#t===e)this.#t=void 0}}clientsFromAccessor(){return this.#t?.()}registerConnectedClientWiring(e){this.#r=e}connectedClientWiring(){return this.#r}registerToolsSwapper(e){this.#n=e}acquireToolsSwapper(e){if(this.#n)return()=>{};return this.#n=e,()=>{if(this.#n===e)this.#n=void 0}}swapServerTools(e,t){if(!this.#n)return!1;return this.#n(e,t)}registerConnections(e){this.#i=e}acquireConnections(e){if(this.#i)return()=>{};return this.#i=e,()=>{if(this.#i===e)this.#i=void 0}}connections(){return this.#i}reset(){this.#e=[],this.#t=void 0}}class Ab{#e=void 0;#t=void 0;#r=void 0;#n=void 0;#i=void 0;#o=void 0;#u=!1;#l=!1;#s=void 0;#c=!1;#a=void 0;#f=void 0;mainLoopModelOverride(){return this.#e}overrideMainLoopModel(e){this.#e=e}mainLoopEffortState(){return this.#t}replaceMainLoopEffortState(e){this.#t=e}initialMainLoopModel(){return this.#r}replaceInitialMainLoopModel(e){this.#r=e}initialModelSettingLayer(){return this.#n}replaceInitialModelSettingLayer(e){this.#n=e}resolvedOrgDefault(){return this.#i}replaceResolvedOrgDefault(e){this.#i=e}initialEnvDefaultModel(){return this.#o}replaceInitialEnvDefaultModel(e){this.#o=e}refusalFallbackOccurred(){return this.#u}markRefusalFallbackOccurred(e){this.#u=!0,this.#s??=e}refusalFallbackHeaderArmed(){return this.#l}armRefusalFallbackHeader(e){this.#l=!0,this.#s??=e}refusalFallbackLatchOriginRequestId(){return this.#s}silentLaneServerArmed(){return this.#c}armSilentLaneFromServer(){this.#c=!0}forgetRefusalFallbackOccurred(){this.#u=!1,this.#l=!1,this.#c=!1,this.#s=void 0}refusalFallbackModelLatch(){return this.#a}replaceRefusalFallbackModelLatch(e){this.#a=e}unlatchRefusalFallbackModel(){this.#a=void 0}availabilityFallbackChain(){return this.#f}replaceAvailabilityFallbackChain(e){this.#f=e}reset(){this.#e=void 0,this.#t=void 0,this.#r=void 0,this.#n=void 0,this.#i=void 0,this.#o=void 0,this.#u=!1,this.#l=!1,this.#c=!1,this.#s=void 0,this.#a=void 0,this.#f=void 0}}class Rb{#e=new Map;#t=0;#r=void 0;#n=null;sections(){return this.#e}recordSection(e,t){this.#e.set(e,t)}forgetAllSections(){this.#e.clear()}noteInvalidation(e="other"){this.#t+=1,this.#r=e}epoch(){return this.#t}lastInvalidationReason(){return this.#r}registerWordingLatchClear(e){this.#n=e}clearWordingLatch(e){(this.#n??(e?e.#n:null))?.()}reset(){this.#e=new Map}}class Pb{#e=null;#t=null;#r=null;#n=null;#i=null;#o=0;#u=void 0;#l=null;#s=null;#c=!1;#a=null;#f=null;#h=!1;lastAPIRequest(){return this.#e}replaceLastAPIRequest(e){this.#e=e}lastCancelledAPIMessageId(){return this.#t}replaceLastCancelledAPIMessageId(e){this.#t=e}lastAPIRequestMessages(){return this.#r}replaceLastAPIRequestMessages(e){this.#r=e}lastClassifierRequests(){return this.#n}replaceLastClassifierRequests(e){this.#n=e}promptId(){return this.#i}replacePromptId(e){this.#i=e}promptIndex(){return this.#o}replacePromptIndex(e){this.#o=e}incrementPromptIndex(){return this.#o++,this.#o}lastMainRequestId(){return this.#u}replaceLastMainRequestId(e){this.#u=e}lastMainThreadCacheTtlMs(){return this.#l}replaceLastMainThreadCacheTtlMs(e){this.#l=e,this.#s=Date.now(),this.#c=!0}lastMainThreadRequestAt(){return this.#s}mainThreadRequestedInProcess(){return this.#c}recordMainThreadTurnStart(){this.#c=!0}replaceLastMainThreadRequest(e,t){this.#s=e,this.#l=t}lastMainThreadContextTokens(){return this.#a}replaceLastMainThreadContextTokens(e){this.#a=e}stageResumeSeed(e){this.#d=e}applyResumeSeed(e){this.#d=null,this.#l=e.ttlMs,this.#s=e.requestAt,this.#a=e.contextTokens}#d=null;clearLastMainThreadRequest(e){let t=e!==void 0&&this.#d?.sessionId===e?this.#d:null;this.#d=null,this.#l=t?.ttlMs??null,this.#s=t?.requestAt??null,this.#a=t?.contextTokens??null,this.#c=!1}lastApiCompletionTimestamp(){return this.#f}replaceLastApiCompletionTimestamp(e){this.#f=e}pendingPostCompaction(){return this.#h}replacePendingPostCompaction(e){this.#h=e}reset(){this.#e=null,this.#t=null,this.#r=null,this.#n=null,this.#i=null,this.#o=0,this.#u=void 0,this.#l=null,this.#s=null,this.#c=!1,this.#a=null,this.#d=null,this.#f=null,this.#h=!1}}class Ib{#e=[];#t=Object.create(null);#r=null;#n=0;#i=!1;#o=0;tasks(){return this.#e}schedule(e){this.#e.push(e)}replaceTasks(e){this.#e=e}chainStartedAt(e){return this.#t[e]}recordChainStart(e,t){this.#t[e]=t}forgetChainStart(e){delete this.#t[e]}tickInFlightPrompt(){return this.#r}replaceTickInFlightPrompt(e){this.#r=e}consecutiveKeepalives(){return this.#n}replaceConsecutiveKeepalives(e){this.#n=e}ended(){return this.#i}replaceEnded(e){this.#i=e}wakeFires(){return this.#o}recordWakeFire(){this.#o++}resetWakeFires(){this.#o=0}reset(){this.#e=[],this.#t=Object.create(null),this.#r=null,this.#n=0,this.#i=!1,this.#o=0}}class Cb{#e=!1;#t=!1;#r=!1;#n=!1;#i=!1;#o=!1;#u=!1;#l=!1;#s=!1;#c=!1;#a=!1;#f=null;#h=null;#d=null;#p=!1;#m=null;#y=!1;#g=!1;#v=!1;#b=!1;#S=!1;#_=void 0;#x=void 0;#k=void 0;#w=null;#M=null;onboardingShownThisSession(){return this.#e}replaceOnboardingShownThisSession(e){this.#e=e}lspRecommendationShownThisSession(){return this.#t}replaceLspRecommendationShownThisSession(e){this.#t=e}sessionTrustAccepted(){return this.#r}replaceSessionTrustAccepted(e){this.#r=e}homeTrustDialogAccepted(){return this.#n}replaceHomeTrustDialogAccepted(e){this.#n=e}hasExitedPlanMode(){return this.#i}replaceHasExitedPlanMode(e){this.#i=e}needsPlanModeExitAttachment(){return this.#o}replaceNeedsPlanModeExitAttachment(e){this.#o=e}needsAutoModeExitAttachment(){return this.#u}replaceNeedsAutoModeExitAttachment(e){this.#u=e}memoryToggledOff(){return this.#l}replaceMemoryToggledOff(e){this.#l=e}restoredMemoryPause(){return this.#s}replaceRestoredMemoryPause(e){this.#s=e}teardownUnwindRequested(){return this.#p}replaceTeardownUnwindRequested(e){this.#p=e}backgroundAutoModeSetupInFlight(){return this.#c}replaceBackgroundAutoModeSetupInFlight(e){this.#c=e}launchEffortPinsReleasedForSession(){return this.#a}markLaunchEffortPinsReleasedForSession(){this.#a=!0}restoreLaunchEffortPinsReleasedForSession(e){this.#a=e}deferredToolStubGateLatch(){return this.#f}replaceDeferredToolStubGateLatch(e){this.#f=e}verifySkillRolloutGateLatch(){return this.#h}replaceVerifySkillRolloutGateLatch(e){this.#h=e}commitSkillRolloutGateLatch(){return this.#d}replaceCommitSkillRolloutGateLatch(e){this.#d=e}memoryToolsShapeLatch(){return this.#m}replaceMemoryToolsShapeLatch(e){this.#m=e}proposeGoalAvailabilityLogged(){return this.#y}markProposeGoalAvailabilityLogged(){this.#y=!0}activeRoutine(){return this.#x}replaceActiveRoutine(e){this.#x=e}inheritedTeamName(){return this.#k}replaceInheritedTeamName(e){this.#k=e}teleportedSessionInfo(){return this.#w}replaceTeleportedSessionInfo(e){this.#w=e}markFirstTeleportMessageLogged(){if(this.#w)this.#w.hasLoggedFirstMessage=!0}cachedClaudeMdContent(){return this.#M}replaceCachedClaudeMdContent(e){this.#M=e}accountSkillsSyncEnabled(){return this.#g}replaceAccountSkillsSyncEnabled(e){this.#g=e}skillsSyncVetoed(){return this.#v}replaceSkillsSyncVetoed(e){this.#v=e}accountPluginsSyncEnabled(){return this.#b}replaceAccountPluginsSyncEnabled(e){this.#b=e}pluginsSyncVetoed(){return this.#S}replacePluginsSyncVetoed(e){this.#S=e}armPendingContextCompacted(e){this.#_=e}consumePendingContextCompacted(){let e=this.#_;return this.#_=void 0,e}forgetPendingContextCompacted(){this.#_=void 0}reset(){this.#g=!1,this.#v=!1,this.#b=!1,this.#S=!1,this.#e=!1,this.#t=!1,this.#r=!1,this.#n=!1,this.#i=!1,this.#o=!1,this.#u=!1,this.#l=!1,this.#s=!1,this.#p=!1,this.#c=!1,this.#a=!1,this.#f=null,this.#h=null,this.#d=null,this.#m=null,this.#y=!1,this.#x=void 0,this.#k=void 0,this.#w=null,this.#M=null,this.#_=void 0}}class $b{#e=new Map;#t=new Map;#r=null;#n=new Map;#i=new Set;#o=new Set;#u=new Set;#l=new Set;#s=new Set;#c=new Set;#a=new Set;#f=new Set;#h=new Set;#d=new Map;#p=new Set;#m=void 0;#y=void 0;#g=void 0;#v=void 0;#b=void 0;planSlugCache(){return this.#e}forgetPlanSlug(e){this.#e.delete(e)}pendingBranchLinks(){return this.#t}replacePendingBranchLinks(){this.#t=new Map}vimSharedState(){return this.#r}replaceVimSharedState(e){this.#r=e}agentColorMap(){return this.#n}sessionCreatedTeams(){return this.#i}surfacedHookSpawnFailures(){return this.#o}bareMcpServerMatchersWarned(){return this.#u}pendingConversationEditKinds(){return this.#l}clientTruncatedAssistantIds(){return this.#s}heldStatelessReplyIds(){return this.#c}unsupportedThreadKeys(){return this.#a}pendingPrLinks(){return this.#f}policyPredicateTelemetryEmitted(){return this.#h}humanAttachmentDigests(){return this.#d}chromeAvailabilityStagesLogged(){return this.#p}replaceChromeAvailabilityStagesLogged(e){if(this.#p=new Set,e)this.#m=Date.now()}chromeAvailabilityAnchorMs(){return this.#m}pendingGoalIdleCheckin(){return this.#y}replacePendingGoalIdleCheckin(e){this.#y=e}pendingGoalReprompt(){return this.#g}replacePendingGoalReprompt(e){this.#g=e}goalInterruptionStreak(){return this.#v}replaceGoalInterruptionStreak(e){this.#v=e}workerCheckin(){return this.#b}replaceWorkerCheckin(e){this.#b=e}reset(){this.#e=new Map,this.#t=new Map,this.#r=null,this.#n=new Map,this.#i=new Set,this.#o=new Set,this.#u=new Set,this.#l=new Set,this.#s=new Set,this.#c=new Set,this.#a=new Set,this.#f=new Set,this.#h=new Set,this.#d=new Map,this.#p=new Set,this.#m=void 0,clearTimeout(this.#y),this.#y=void 0,clearTimeout(this.#g),this.#g=void 0,this.#v=void 0,clearInterval(this.#b?.timer),this.#b=void 0}}var oR={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};class Ob{#e=!1;#t=void 0;#r=void 0;#n=void 0;#i=void 0;#o=null;#u=!1;#l=void 0;#s=oR;#c=!1;#a="idle";attacherCapsChanged=ir();rvSupervisorLinkChanged=ir();sdkDialogHostActive(){return this.#e}markSdkDialogHostActive(e){this.#e=e}sdkSupportedDialogKinds(){return this.#t}sdkSupportedDialogKindsSource(){return this.#r}declareDialogKinds(e,t){this.#t=e,this.#r=e===void 0?void 0:t}sdkPerTaskStopAffordance(){return this.#n}declarePerTaskStopAffordance(e){this.#n=e}sdkRapidFollowupPreempt(){return this.#i}declareRapidFollowupPreempt(e){this.#i=e}attacherCaps(){return this.#o}replaceAttacherCaps(e){this.#o=e,this.attacherCapsChanged.emit()}rvSupervisorLinkLive(){return this.#u}replaceRvSupervisorLinkLive(e){if(this.#u===e)return;this.#u=e,this.rvSupervisorLinkChanged.emit()}sdkBetas(){return this.#l}replaceSdkBetas(e){this.#l=e}caps(){return this.#s}replaceCaps(e){this.#s=e}markRemote(e){this.#s={...this.#s,workspace:e?"remote":"local"}}replBridgeActive(){return this.#c}replaceReplBridgeActive(e){if(this.#c===e)return;this.#c=e}mainLoopBusy(){return this.#a!=="idle"}mainQueryRunning(){return this.#a==="running"}replaceMainLoopStatus(e){this.#a=e}reset(){this.#e=!1,this.#t=void 0,this.#r=void 0,this.#n=void 0,this.#i=void 0,this.#o=null,this.#l=void 0,this.#s=oR,this.#c=!1,this.#a="idle",this.#u=!1,this.attacherCapsChanged.clear(),this.rvSupervisorLinkChanged.clear()}}class Db{#e=0;#t=null;#r=0;outputTokensAtTurnStart(){return this.#e}budget(){return this.#t}continuationCount(){return this.#r}snapshotForTurn(e,t){this.#e=e,this.#t=t,this.#r=0}incrementContinuation(){this.#r++}reset(){this.#e=0,this.#t=null,this.#r=0}}var sR=150;class Nb{#e=Date.now();#t=!1;interactionFired=ir();#r=void 0;terminalFocusFired=ir();#n=!1;#i;lastInteractionTime(){return this.#e}recordInteraction(e){if(e)this.#o();else this.#t=!0}flushIfDirty(){if(this.#t)this.#o()}#o(){this.#e=Date.now(),this.#t=!1,this.interactionFired.emit()}resetBaseline(){this.#e=Date.now(),this.#t=!1}terminalFocus(){return this.#r}updateTerminalFocus(e){this.#r=e,this.terminalFocusFired.emit()}scrollDraining(){return this.#n}markScrollActivity(){if(this.#n=!0,this.#i)clearTimeout(this.#i);this.#i=setTimeout(()=>{this.#n=!1,this.#i=void 0},sR),this.#i.unref?.()}async waitForScrollIdle(){while(this.#n)await new Promise((e)=>setTimeout(e,sR))}reset(){this.#e=Date.now(),this.#r=void 0,this.interactionFired.clear(),this.terminalFocusFired.clear()}}var tH=["sdk_single_prompt_gate","subagent_estimate","subagent_final_turn"];class Lb{byAgent=new Map;attemptsByAgent=new Map;cappedFailuresByAgent=new Map;armGateEventEmitted=new Set;vetoedUnderPrompt=new Map;sidecarIo=Promise.resolve();rehydrateAttemptedSessions=new Set;sidecarReadsAhead=new Map;get(e){return this.byAgent.get(e)}has(e){return this.byAgent.has(e)}put(e,t){this.byAgent.set(e,t)}remove(e){this.byAgent.delete(e)}nextAttemptNumber(e){let t=(this.attemptsByAgent.get(e)??0)+1;return this.attemptsByAgent.set(e,t),t}consecutiveCountedFailures(e){return this.cappedFailuresByAgent.get(e)??0}recordCountedFailure(e){let t=(this.cappedFailuresByAgent.get(e)??0)+1;return this.cappedFailuresByAgent.set(e,t),t}clearCountedFailures(e){this.cappedFailuresByAgent.delete(e)}recordVeto(e,t){this.vetoedUnderPrompt.set(e,t)}isVetoedUnder(e,t){return this.vetoedUnderPrompt.get(e)===t}latchArmGateEvent(e){if(this.armGateEventEmitted.has(e))return!1;return this.armGateEventEmitted.add(e),!0}enqueueSidecarIo(e,t){return this.sidecarIo=this.sidecarIo.then(e,e).catch(t),this.sidecarIo}sidecarIoSettled(){return this.sidecarIo}hasAttemptedRehydrate(e){return this.rehydrateAttemptedSessions.has(e)}markRehydrateAttempted(e){this.rehydrateAttemptedSessions.add(e)}keepSidecarReadAhead(e,t){this.sidecarReadsAhead.delete(e);while(this.sidecarReadsAhead.size>=8){let r=this.sidecarReadsAhead.keys().next().value;if(r===void 0)break;this.sidecarReadsAhead.delete(r)}this.sidecarReadsAhead.set(e,t)}takeSidecarReadAhead(e){let t=this.sidecarReadsAhead.get(e);return this.sidecarReadsAhead.delete(e),t}dropSidecarReadAhead(e){this.sidecarReadsAhead.delete(e)}forgetSubagentTelemetry(e){this.attemptsByAgent.delete(e),this.cappedFailuresByAgent.delete(e),this.vetoedUnderPrompt.delete(e);for(let t of tH)this.armGateEventEmitted.delete(`${e}:${t}`)}}class zb{#e=void 0;get current(){return this.#e}adopt(e){this.#e=e}}class Ub{#e=null;#t=null;mainAgentId(e){return this.#e??=ab(e),this.#e}projectDir(){return this.#t}replaceProjectDir(e){this.#t=e}}class Fb{openToolUseId;answeredThisSession=!1;get answered(){return this.answeredThisSession}markAnswered(){this.answeredThisSession=!0}isOpenElsewhere(e){return this.openToolUseId!==void 0&&this.openToolUseId!==e}open(e){this.openToolUseId=e}closeFor(e){if(e!==void 0&&this.openToolUseId===e)this.openToolUseId=void 0}}class jb{granted=!1;isGranted(){return this.granted}grant(){this.granted=!0}}class Bb{inFlight=null;startedForTurnEnd=!1;reset(){this.inFlight?.abort(),this.inFlight=null,this.startedForTurnEnd=!1}}class qb{firstSyncPromise=null;syncErrors=[];syncedLaneOpened=!1;removalsDeferredHere=new Set;pendingTrashRemovals=[];ensureBucketRoot=null;deferredRelist=null}class Hb{abortController=null;reset(){this.abortController?.abort(),this.abortController=null}arm(){let e=new AbortController;return this.abortController=e,e}}class Kb{#e=void 0;#t=void 0;ccrSessionID(){return this.#e}latchCcrSessionID(e){this.#e=e}syncEnabled(){return this.#t}latchSyncEnabled(e){return this.#t=e,e}}class Wb{autonomousPreambleDelivered=!1;lastLoopFileDelivered=null;reset(){this.autonomousPreambleDelivered=!1,this.lastLoopFileDelivered=null}}class Zb{exchanges=[];replace(e){this.exchanges=e}append(e,t,r){this.exchanges=[...this.exchanges,{question:e,response:t,...r&&{fallbackNotice:r}}].slice(-20)}pendingReopen=null;reopenAway=!1;get reopenPending(){return this.pendingReopen!==null}armReopen(e,t){if(this.pendingReopen){this.pendingReopen.owners.add(e);return}this.pendingReopen={owners:new Set([e]),cancel:t()}}clearPendingReopen(e){let t=this.pendingReopen;if(!t){this.reopenAway=!1;return}if(e!==void 0){if(t.owners.delete(e),t.owners.size>0)return}t.cancel(),this.pendingReopen=null,this.reopenAway=!1}reopener=null;setReopener(e){this.reopener=e}get hasReopener(){return this.reopener!==null}reopenNow(){return this.reopener?.()??!1}inFlightQuestions=[];get inFlight(){return this.inFlightQuestions.at(-1)??null}pendingBesidesTop(){return this.inFlightQuestions.slice(0,-1)}setInFlight(e){if(!this.inFlightQuestions.includes(e))this.inFlightQuestions=[...this.inFlightQuestions,e]}clearInFlight(e){if(this.inFlightQuestions.includes(e))this.inFlightQuestions=this.inFlightQuestions.filter((t)=>t!==e)}}var{lstatSync:aSe,readFileSync:lSe,readlinkSync:uSe,realpathSync:cSe,statSync:dSe}=(()=>({}));var{readlink:hSe}=(()=>({}));function aR(e,t){return e}function Ee(e,t,r,i,n){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function z(e,t,r,i){if(r==="a"&&!i)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)}var La=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return La=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(i)=>(+i^r()&15>>+i/4).toString(16))};Xt();var iH=/^[a-z][a-z0-9+.-]*:/i,lR=(e)=>iH.test(e),nn=(e)=>(nn=Array.isArray,nn(e)),Vb=nn;function Xu(e){if(typeof e!=="object")return{};return e??{}}function Gb(e){if(!e)return!0;for(let t in e)return!1;return!0}function uR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var cR=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new Ze(`${e} must be an integer`);if(t<0)throw new Ze(`${e} must be a positive integer`);return t};var Yu=(e)=>{try{return JSON.parse(e)}catch(t){return}};var fi=(e,t)=>new Promise((r)=>{if(t?.aborted)return r();let i=()=>{clearTimeout(n),r()},n=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e);t?.addEventListener("abort",i,{once:!0})});var Yn="0.112.1";var pR=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function oH(){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 sH=()=>{let e=oH();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":fR(Deno.build.os),"X-Stainless-Arch":dR(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":Yn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":fR(globalThis.process.platform??"unknown"),"X-Stainless-Arch":dR(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=aH();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Yn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function aH(){if(typeof navigator>"u"||!navigator)return null;let e=[{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:t,pattern:r}of e){let i=r.exec(navigator.userAgent);if(i){let n=i[1]||0,o=i[2]||0,s=i[3]||0;return{browser:t,version:`${n}.${o}.${s}`}}}return null}var dR=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},fR=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},hR,Qu=()=>hR??(hR=sH());function mR(){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 Jb(...e){let t=globalThis.ReadableStream;if(typeof t>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Jh(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Jb({start(){},async pull(r){let{done:i,value:n}=await t.next();if(i)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function ec(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gR(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var yR=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});var Xb="RFC3986",Yb=(e)=>String(e),Qb={RFC1738:(e)=>String(e).replace(/%20/g,"+"),RFC3986:Yb},vR="RFC1738";var Xh=(e,t)=>(Xh=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Xh(e,t)),Di=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var e_=1024,bR=(e,t,r,i,n)=>{if(e.length===0)return e;let o=e;if(typeof e==="symbol")o=Symbol.prototype.toString.call(e);else if(typeof e!=="string")o=String(e);if(r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});let s="";for(let d=0;d<o.length;d+=e_){let h=o.length>=e_?o.slice(d,d+e_):o,m=[];for(let v=0;v<h.length;++v){let g=h.charCodeAt(v);if(g===45||g===46||g===95||g===126||g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122||n===vR&&(g===40||g===41)){m[m.length]=h.charAt(v);continue}if(g<128){m[m.length]=Di[g];continue}if(g<2048){m[m.length]=Di[192|g>>6]+Di[128|g&63];continue}if(g<55296||g>=57344){m[m.length]=Di[224|g>>12]+Di[128|g>>6&63]+Di[128|g&63];continue}v+=1,g=65536+((g&1023)<<10|h.charCodeAt(v)&1023),m[m.length]=Di[240|g>>18]+Di[128|g>>12&63]+Di[128|g>>6&63]+Di[128|g&63]}s+=m.join("")}return s};function _R(e){if(!e||typeof e!=="object")return!1;return!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function t_(e,t){if(nn(e)){let r=[];for(let i=0;i<e.length;i+=1)r.push(t(e[i]));return r}return t(e)}var wR={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},xR=function(e,t){Array.prototype.push.apply(e,nn(t)?t:[t])},SR,Pr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:bR,encodeValuesOnly:!1,format:Xb,formatter:Yb,indices:!1,serializeDate(e){return(SR??(SR=Function.prototype.call.bind(Date.prototype.toISOString)))(e)},skipNulls:!1,strictNullHandling:!1};function cH(e){return typeof e==="string"||typeof e==="number"||typeof e==="boolean"||typeof e==="symbol"||typeof e==="bigint"}var r_={};function kR(e,t,r,i,n,o,s,d,h,m,v,g,S,x,k,T,E,P){let R=e,I=P,O=0,D=!1;while((I=I.get(r_))!==void 0&&!D){let F=I.get(e);if(O+=1,typeof F<"u")if(F===O)throw RangeError("Cyclic object value");else D=!0;if(typeof I.get(r_)>"u")O=0}if(typeof m==="function")R=m(t,R);else if(R instanceof Date)R=S?.(R);else if(r==="comma"&&nn(R))R=t_(R,function(F){if(F instanceof Date)return S?.(F);return F});if(R===null){if(o)return h&&!T?h(t,Pr.encoder,E,"key",x):t;R=""}if(cH(R)||_R(R)){if(h){let F=T?t:h(t,Pr.encoder,E,"key",x);return[k?.(F)+"="+k?.(h(R,Pr.encoder,E,"value",x))]}return[k?.(t)+"="+k?.(String(R))]}let H=[];if(typeof R>"u")return H;let G;if(r==="comma"&&nn(R)){if(T&&h)R=t_(R,h);G=[{value:R.length>0?R.join(",")||null:void 0}]}else if(nn(m))G=m;else{let F=Object.keys(R);G=v?F.sort(v):F}let oe=d?String(t).replace(/\./g,"%2E"):String(t),ee=i&&nn(R)&&R.length===1?oe+"[]":oe;if(n&&nn(R)&&R.length===0)return ee+"[]";for(let F=0;F<G.length;++F){let J=G[F],a=typeof J==="object"&&typeof J.value<"u"?J.value:R[J];if(s&&a===null)continue;let c=g&&d?J.replace(/\./g,"%2E"):J,p=nn(R)?typeof r==="function"?r(ee,c):ee:ee+(g?"."+c:"["+c+"]");P.set(e,O);let u=new WeakMap;u.set(r_,P),xR(H,kR(a,p,r,i,n,o,s,d,r==="comma"&&T&&nn(R)?null:h,m,v,g,S,x,k,T,E,u))}return H}function dH(e=Pr){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!=="function")throw TypeError("Encoder has to be a function.");let t=e.charset||Pr.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Xb;if(typeof e.format<"u"){if(!Xh(Qb,e.format))throw TypeError("Unknown format option provided.");r=e.format}let i=Qb[r],n=Pr.filter;if(typeof e.filter==="function"||nn(e.filter))n=e.filter;let o;if(e.arrayFormat&&e.arrayFormat in wR)o=e.arrayFormat;else if("indices"in e)o=e.indices?"indices":"repeat";else o=Pr.arrayFormat;if("commaRoundTrip"in e&&typeof e.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof e.allowDots>"u"?!!e.encodeDotInKeys===!0?!0:Pr.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==="boolean"?e.addQueryPrefix:Pr.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays==="boolean"?!!e.allowEmptyArrays:Pr.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel==="boolean"?e.charsetSentinel:Pr.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Pr.delimiter:e.delimiter,encode:typeof e.encode==="boolean"?e.encode:Pr.encode,encodeDotInKeys:typeof e.encodeDotInKeys==="boolean"?e.encodeDotInKeys:Pr.encodeDotInKeys,encoder:typeof e.encoder==="function"?e.encoder:Pr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==="boolean"?e.encodeValuesOnly:Pr.encodeValuesOnly,filter:n,format:r,formatter:i,serializeDate:typeof e.serializeDate==="function"?e.serializeDate:Pr.serializeDate,skipNulls:typeof e.skipNulls==="boolean"?e.skipNulls:Pr.skipNulls,sort:typeof e.sort==="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling==="boolean"?e.strictNullHandling:Pr.strictNullHandling}}function MR(e,t={}){let r=e,i=dH(t),n,o;if(typeof i.filter==="function")o=i.filter,r=o("",r);else if(nn(i.filter))o=i.filter,n=o;let s=[];if(typeof r!=="object"||r===null)return"";let d=wR[i.arrayFormat],h=d==="comma"&&i.commaRoundTrip;if(!n)n=Object.keys(r);if(i.sort)n.sort(i.sort);let m=new WeakMap;for(let S=0;S<n.length;++S){let x=n[S];if(i.skipNulls&&r[x]===null)continue;xR(s,kR(r[x],x,d,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,m))}let v=s.join(i.delimiter),g=i.addQueryPrefix===!0?"?":"";if(i.charsetSentinel)if(i.charset==="iso-8859-1")g+="utf8=%26%2310003%3B&";else g+="utf8=%E2%9C%93&";return v.length>0?g+v:""}function ER(e){return MR(e,{arrayFormat:"brackets"})}Xt();Xt();var AR="urn:ietf:params:oauth:grant-type:jwt-bearer",RR="refresh_token",Yh="/v1/oauth/token",Rs="oauth-2025-04-20",PR="oidc-federation-2026-04-01",IR=120,za=30,CR=5,TR=1048576;function Qh(e){if(!e)return;let t;try{t=new URL(e)}catch(i){throw new zt(`Invalid token endpoint base URL "${e}": ${i}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new zt(`Refusing to send credential over non-https token endpoint "${e}"`)}async function ep(e,t){let r=await pH(e),i;try{i=JSON.parse(r)}catch{throw new zt(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,En(r),t)}if(!i.access_token)throw new zt(`Token endpoint response missing access_token: ${JSON.stringify(En(i))}`,e.status,En(i),t);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new zt(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,e.status,En(i),t);return i}var n_=2000,hH=new Set(["error","error_description","error_uri"]);function En(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=n_)return e;return e.slice(0,n_)+`... <${e.length-n_} more chars>`}return JSON.stringify(En(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,i]of Object.entries(e))if(hH.has(r))t[r]=i;return t}return null}async function tp(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),i=e,n;try{i=await r.promises.realpath(e),n=await r.promises.stat(i)}catch{return}let o=n.mode&511;if(o&18)throw new zt(`Credentials file at ${i} is group/world-writable (mode 0o${o.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${i}\`.`);if(o&36)throw new zt(`Credentials file at ${i} is group/world-readable (mode 0o${o.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${i} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function rp(e,t){let r=await import("node:fs"),i=await Promise.resolve().then(() => (dn(),{})),n=rn(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let o=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(o,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(o,e)}catch(s){throw await r.promises.unlink(o).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function pH(e){if(!e.body)return"";let t=e.body.getReader(),r=[],i=0;for(;;){let{done:o,value:s}=await t.read();if(o)break;if(i+s.length>TR){let d=TR-i;if(d>0)r.push(s.subarray(0,d));await t.cancel();break}r.push(s),i+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,d)=>s+d.length,0));let o=0;for(let s of r)n.set(s,o),o+=s.length}return new TextDecoder("utf-8").decode(n)}class zt extends Ze{constructor(e,t=null,r=null,i=null){super(e);this.statusCode=t,this.body=r,this.requestId=i}}function hi(){return Math.floor(Date.now()/1000)}class i_{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let r=t.expiresAt-hi();if(r>IR)return t.token;if(r>za)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(hi()-this.lastAdvisoryError<CR)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=hi(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var Mt=(e)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0;return};Xt();function DR(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),i=0;for(let n of e)r.set(n,i),i+=n.length;return r}var $R;function Ua(e){let t;return($R??(t=new globalThis.TextEncoder,$R=t.encode.bind(t)))(e)}var OR;function o_(e){let t;return(OR??(t=new globalThis.TextDecoder,OR=t.decode.bind(t)))(e)}var rc="warn",ip={off:0,error:200,warn:300,info:400,debug:500},op=(e,t,r)=>{if(!e)return;if(uR(ip,e))return e;r.warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(ip))}`);return};function tc(){}function np(e,t,r){if(!t||ip[e]>ip[r])return tc;else return t[e].bind(t)}var mH={error:tc,warn:tc,info:tc,debug:tc},NR=new WeakMap;function a_(e,t){let r=NR.get(e);if(r&&r[0]===t)return r[1];let i={error:np("error",e,t),warn:np("warn",e,t),info:np("info",e,t),debug:np("debug",e,t)};return NR.set(e,[t,i]),i}function Ot(e){let t=e.logger,r=e.logLevel??"off";if(!t)return mH;return a_(t,r)}var LR,s_;function zR(){let e=Mt("ANTHROPIC_LOG");if(!s_||e!==LR)LR=e,s_=a_(console,op(e,"process.env['ANTHROPIC_LOG']",a_(console,rc))??rc);return s_}var Ni=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,r])=>[t,t.toLowerCase()==="authorization"||t.toLowerCase()==="api-key"||t.toLowerCase()==="x-api-key"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var sp="1.0",gH=/^[A-Za-z0-9_.-]+$/;function UR(e){if(!e)throw Error("profile name is empty");if(e==="."||e==="..")throw Error(`profile name "${e}" is not allowed`);if(e.includes("/")||e.includes("\\"))throw Error(`profile name "${e}" must not contain path separators`);if(!gH.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var FR=async(e)=>{var t,r;let i=await l_();if(i===null)return null;let n=e??await BR();if(n===null)return null;UR(n);let o=await import("node:fs"),s=await Promise.resolve().then(() => (dn(),{})),d=Qt(i,"configs",`${n}.json`),h;try{h=await o.promises.readFile(d,"utf-8")}catch(g){if(g?.code!=="ENOENT")throw Error(`failed to read config file ${d}: ${g}`);h=null}if(h===null){let g=Mt("ANTHROPIC_ORGANIZATION_ID"),S=Mt("ANTHROPIC_IDENTITY_TOKEN_FILE"),x=Mt("ANTHROPIC_FEDERATION_RULE_ID");if(x&&g)return{fromFile:!1,config:{organization_id:g,workspace_id:Mt("ANTHROPIC_WORKSPACE_ID"),base_url:Mt("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:x,service_account_id:Mt("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:S?{source:"file",path:S}:void 0,scope:Mt("ANTHROPIC_SCOPE")}}};return null}let m;try{m=JSON.parse(h)}catch(g){throw Error(`failed to parse config file ${d}: ${g}`)}if(!m.authentication)throw Error(`config file ${d} is missing "authentication"`);let v=m.authentication.type;if(v!=="oidc_federation"&&v!=="user_oauth")throw Error(`authentication.type "${v}" is not a known authentication type`);if(m.organization_id??(m.organization_id=Mt("ANTHROPIC_ORGANIZATION_ID")),m.workspace_id??(m.workspace_id=Mt("ANTHROPIC_WORKSPACE_ID")),m.base_url??(m.base_url=Mt("ANTHROPIC_BASE_URL")),(t=m.authentication).scope??(t.scope=Mt("ANTHROPIC_SCOPE")),m.authentication.type==="oidc_federation"){if(!m.authentication.identity_token){let g=Mt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(g)m.authentication.identity_token={source:"file",path:g}}if(!m.authentication.federation_rule_id)m.authentication.federation_rule_id=Mt("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=m.authentication).service_account_id??(r.service_account_id=Mt("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:m,fromFile:!0}};var jR=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await l_();if(!r)return null;let i=t??await BR();if(!i)return null;UR(i);let n=await Promise.resolve().then(() => (dn(),{}));return Qt(r,"credentials",`${i}.json`)},l_=async()=>{if(!yH())return null;let e=await Promise.resolve().then(() => (dn(),{})),t=Mt("ANTHROPIC_CONFIG_DIR");if(t)return t;if(Qu()["X-Stainless-OS"]==="Windows"){let o=Mt("APPDATA");if(o)return Qt(o,"Anthropic");let s=Mt("USERPROFILE");if(s)return Qt(s,"AppData","Roaming","Anthropic");return null}let i=Mt("XDG_CONFIG_HOME");if(i)return Qt(i,"anthropic");let n=Mt("HOME");if(n)return Qt(n,".config","anthropic");return null},yH=()=>{let e=Qu()["X-Stainless-Runtime"];return e==="node"||e==="deno"},BR=async()=>{let e=await l_();if(!e)return null;let t=Mt("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),i=await Promise.resolve().then(() => (dn(),{})),n=Qt(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(o){if(o?.code!=="ENOENT")throw Error(`failed to read ${n}: ${o}`);return"default"}};Xt();function u_(e){if(!e)throw new Ze("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new Ze(`Failed to read identity token file at ${e}: ${n}`)}let i=r.trim();if(!i)throw new Ze(`Identity token file at ${e} is empty`);return i}}function qR(e){if(!e)throw new Ze("Identity token value is empty");return()=>e}function HR(e){return async()=>{Qh(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new zt(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:AR,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let i=`${e.baseURL}${Yh}`,n;try{n=await e.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${Rs},${PR}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Yn} oidcFederationProvider`},body:JSON.stringify(r)})}catch(h){throw new zt(`Failed to reach token endpoint ${i}: ${h}`)}let o=n.headers.get("Request-Id");if(!n.ok){let h=await n.text().catch(()=>""),m=En(h),v="";if(n.status===401)v=` Ensure your federation rule matches your identity token. ${e.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 zt(`Token exchange failed with status ${n.status}${o?` (request-id ${o})`:""}: ${m}${v}`,n.status,m,o)}let s=await ep(n,o),d=Number(s.expires_in);if(!Number.isFinite(d))throw new zt(`Token endpoint response missing required fields: ${JSON.stringify(En(s))}`,n.status,En(s),o);return{token:s.access_token,expiresAt:hi()+d}}}function KR(e){return async(t)=>{let r=await import("node:fs");await tp(e.credentialsPath,e.onSafetyWarning);let i;try{i=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(E){throw new zt(`Credentials file not found at ${e.credentialsPath}: ${E}`)}let n;try{n=JSON.parse(i)}catch(E){throw new zt(`Credentials file at ${e.credentialsPath} is not valid JSON: ${E}`)}let o=n.access_token;if(!o)throw new zt(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||hi()<s-za))return{token:o,expiresAt:s??null};let d=n.refresh_token;if(!e.clientId||!d)throw new zt(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${d?"set":"empty"})`);Qh(e.baseURL);let h={grant_type:RR,refresh_token:d,client_id:e.clientId},m=`${e.baseURL}${Yh}`,v;try{v=await e.fetch(m,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":Rs,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Yn} userOAuthProvider`},body:JSON.stringify(h)})}catch(E){throw new zt(`User OAuth refresh failed to reach token endpoint: ${E}`)}let g=v.headers.get("Request-Id");if(!v.ok){let E=await v.text().catch(()=>"");throw new zt(`User OAuth refresh failed (HTTP ${v.status}): ${En(E)}`,v.status,En(E),g)}let S=await ep(v,g),x=Number(S.expires_in);if(!Number.isFinite(x))throw new zt(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(En(S))}`,v.status,En(S),g);let k=hi()+x,T=S.refresh_token||d;return await rp(e.credentialsPath,{...n,version:sp,type:"oauth_token",access_token:S.access_token,expires_at:k,refresh_token:T}),{token:S.access_token,expiresAt:k}}}function c_(e,t){let r=e.authentication.credentials_path??null,i=(e.base_url||t.baseURL).replace(/\/+$/,""),n=vH(e,r,i,t),o={};if(e.workspace_id&&e.authentication.type==="user_oauth")o["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:o,baseURL:e.base_url||void 0}}async function WR(e,t){let r=await FR(t);if(!r)return null;let{config:i,fromFile:n}=r,o=i.authentication.credentials_path||!n?i:{...i,authentication:{...i.authentication,credentials_path:await jR(i,t)??void 0}};return c_(o,e)}function vH(e,t,r,i){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,o=bH(n);if(!o)throw new zt("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new zt("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(!e.organization_id)throw new zt("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=HR({identityTokenProvider:o,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent});if(t)return _H(s,t,i.onCacheWriteError,i.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new zt("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return KR({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let n=e.authentication.type;throw new zt(`authentication.type "${n}" is not a known authentication type`)}}}function bH(e){if(e.identity_token){let i=e.identity_token.source;if(i!=="file")throw new zt(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new zt('identity_token.source "file" requires a non-empty path');return u_(e.identity_token.path)}let t=Mt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return u_(t);let r=Mt("ANTHROPIC_IDENTITY_TOKEN");if(r)return qR(r);return null}function _H(e,t,r,i){return async(n)=>{let o=await import("node:fs");await tp(t,i);let s;try{let h=await o.promises.readFile(t,"utf-8");s=JSON.parse(h);let m=s?.access_token;if(m&&!n?.forceRefresh){let v=s?.expires_at;if(v==null||hi()<v-za)return{token:m,expiresAt:v??null}}}catch(h){if(h?.code!=="ENOENT"&&!(h instanceof SyntaxError))r?.(h)}let d=await e(n);try{await rp(t,{...s??{},version:sp,type:"oauth_token",access_token:d.token,expires_at:d.expiresAt})}catch(h){r?.(h)}return d}}Xt();var Fn,jn;class Po{constructor(){Fn.set(this,void 0),jn.set(this,void 0),Ee(this,Fn,new Uint8Array,"f"),Ee(this,jn,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?Ua(e):e;Ee(this,Fn,DR([z(this,Fn,"f"),t]),"f");let r=[],i;while((i=SH(z(this,Fn,"f"),z(this,jn,"f")))!=null){if(i.carriage&&z(this,jn,"f")==null){Ee(this,jn,i.index,"f");continue}if(z(this,jn,"f")!=null&&(i.index!==z(this,jn,"f")+1||i.carriage)){r.push(o_(z(this,Fn,"f").subarray(0,z(this,jn,"f")-1))),Ee(this,Fn,z(this,Fn,"f").subarray(z(this,jn,"f")),"f"),Ee(this,jn,null,"f");continue}let n=z(this,jn,"f")!==null?i.preceding-1:i.preceding,o=o_(z(this,Fn,"f").subarray(0,n));r.push(o),Ee(this,Fn,z(this,Fn,"f").subarray(i.index),"f"),Ee(this,jn,null,"f")}return r}flush(){if(!z(this,Fn,"f").length)return[];return this.decode(`
48
48
  `)}}Fn=new WeakMap,jn=new WeakMap;Po.NEWLINE_CHARS=new Set([`
49
49
  `,"\r"]);Po.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function SH(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function ZR(e){for(let i=0;i<e.length-1;i++){if(e[i]===10&&e[i+1]===10)return i+2;if(e[i]===13&&e[i+1]===13)return i+2;if(e[i]===13&&e[i+1]===10&&i+3<e.length&&e[i+2]===13&&e[i+3]===10)return i+4}return-1}Xt();var nc;class on{constructor(e,t,r){this.iterator=e,nc.set(this,void 0),this.controller=t,Ee(this,nc,r,"f")}static rawEvents(e,t=new AbortController){return VR(e,t)}static fromSSEResponse(e,t,r){let i=!1,n=r?Ot(r):console;async function*o(){if(i)throw new Ze("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let d of VR(e,t)){if(d.event==="completion")try{yield JSON.parse(d.data)}catch(h){throw n.error("Could not parse message into JSON:",d.data),n.error("From chunk:",d.raw),h}if(d.event==="message_start"||d.event==="message_delta"||d.event==="message_stop"||d.event==="content_block_start"||d.event==="content_block_delta"||d.event==="content_block_stop"||d.event==="message"||d.event==="user.message"||d.event==="user.interrupt"||d.event==="user.tool_confirmation"||d.event==="user.custom_tool_result"||d.event==="user.tool_result"||d.event==="agent.message"||d.event==="agent.thinking"||d.event==="agent.tool_use"||d.event==="agent.tool_result"||d.event==="agent.mcp_tool_use"||d.event==="agent.mcp_tool_result"||d.event==="agent.custom_tool_use"||d.event==="agent.thread_context_compacted"||d.event==="session.status_running"||d.event==="session.status_idle"||d.event==="session.status_rescheduled"||d.event==="session.status_terminated"||d.event==="session.error"||d.event==="session.deleted"||d.event==="session.updated"||d.event==="span.model_request_start"||d.event==="span.model_request_end"||d.event==="span.outcome_evaluation_start"||d.event==="span.outcome_evaluation_ongoing"||d.event==="span.outcome_evaluation_end"||d.event==="user.define_outcome"||d.event==="agent.thread_message_received"||d.event==="agent.thread_message_sent"||d.event==="agent.session_thread_message_received"||d.event==="agent.session_thread_message_sent"||d.event==="session.thread_created"||d.event==="session.thread_status_created"||d.event==="session.thread_status_running"||d.event==="session.thread_status_idle"||d.event==="session.thread_status_rescheduled"||d.event==="session.thread_status_terminated"||d.event==="event_start"||d.event==="event_delta"||d.event==="system.message")try{yield JSON.parse(d.data)}catch(h){throw n.error("Could not parse message into JSON:",d.data),n.error("From chunk:",d.raw),h}if(d.event==="ping")continue;if(d.event==="error"){let h=Yu(d.data)??d.data,m=h?.error?.type;throw new or(void 0,h,void 0,e.headers,m)}}s=!0}catch(d){if(Xn(d))return;throw d}finally{if(!s)t.abort()}}return new on(o,t,r)}static fromReadableStream(e,t,r){let i=!1;async function*n(){let s=new Po,d=ec(e);for await(let h of d)for(let m of s.decode(h))yield m;for(let h of s.flush())yield h}async function*o(){if(i)throw new Ze("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let d of n()){if(s)continue;if(d)yield JSON.parse(d)}s=!0}catch(d){if(Xn(d))return;throw d}finally{if(!s)t.abort()}}return new on(o,t,r)}[(nc=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),i=(n)=>({next:()=>{if(n.length===0){let o=r.next();e.push(o),t.push(o)}return n.shift()}});return[new on(()=>i(e),this.controller,z(this,nc,"f")),new on(()=>i(t),this.controller,z(this,nc,"f"))]}toReadableStream(){let e=this,t;return Jb({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:i,done:n}=await t.next();if(n)return r.close();let o=Ua(JSON.stringify(i)+`
50
50
  `);r.enqueue(o)}catch(i){r.error(i)}},async cancel(){await t.return?.()}})}}async function*VR(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new Ze("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new Ze("Attempted to iterate over a response with no body")}let r=new GR,i=new Po,n=ec(e.body);for await(let o of wH(n))for(let s of i.decode(o)){let d=r.decode(s);if(d)yield d}for(let o of i.flush()){let s=r.decode(o);if(s)yield s}}async function*wH(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let i=r instanceof ArrayBuffer?new Uint8Array(r):typeof r==="string"?Ua(r):r,n=new Uint8Array(t.length+i.length);n.set(t),n.set(i,t.length),t=n;let o;while((o=ZR(t))!==-1)yield t.slice(0,o),t=t.slice(o)}if(t.length>0)yield t}class GR{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r"))e=e.substring(0,e.length-1);if(!e){if(!this.event&&!this.data.length)return null;let n={event:this.event,data:this.data.join(`
@@ -84,7 +84,7 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
84
84
 
85
85
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
86
86
  `);this.baseURL=o.baseURL,this._baseURLIsExplicit=n.__baseURLIsExplicit??!!e,this.timeout=o.timeout??W_.DEFAULT_TIMEOUT,this.logger=o.logger??console,this.logLevel=rc,this.logLevel=op(o.logLevel,"ClientOptions.logLevel",Ot(this))??op(Mt("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",Ot(this))??rc,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??mR(),Ee(this,Hp,yR,"f"),this.middleware=[...o.middleware??[]];let s=Mt("ANTHROPIC_CUSTOM_HEADERS");if(s){let h={};for(let m of s.split(`
87
- `)){let v=m.indexOf(":");if(v>=0)h[m.substring(0,v).trim()]=m.substring(v+1).trim()}o.defaultHeaders={...h,...o.defaultHeaders}}let d=n.__auth;if(delete o.__auth,delete o.__baseURLIsExplicit,this._options=o,this.apiKey=typeof t==="string"?t:null,this.authToken=r,this.webhookKey=i,d){if(this._authState=d,!this._baseURLIsExplicit&&d.baseURL)this.baseURL=d.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let h=o.credentials??null;if(h)this._authState.provider=h,this._authState.tokenCache=this._makeTokenCache(h);else if(o.config!=null){let m=c_(o.config,this._credentialResolverOptions());this._authState.provider=m.provider,this._authState.tokenCache=this._makeTokenCache(m.provider),this._authState.extraHeaders=m.extraHeaders,this._applyCredentialBaseURL(m.baseURL)}else if(o.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(o.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Ot(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Ot(this).warn(e)}}}_credentialsFetch(){return f_(this.fetch,this.middleware,void 0,this)}_makeTokenCache(e){return new i_(e,(t)=>{Ot(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...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,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await WR(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Ze(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.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(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,ae([{Authorization:`Bearer ${t}`}])}return ae([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return ae([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return ae([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return ER(e)}getUserAgent(){return`${this.constructor.name}/JS ${Yn}`}defaultIdempotencyKey(){return`stainless-node-retry-${La()}`}makeStatusError(e,t,r,i){return or.generate(e,t,r,i)}buildURL(e,t,r){let i=!z(this,K_,"m",eI).call(this)&&r||this.baseURL,n=lR(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Gb(o)||!Gb(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Ze("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(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(Rs))i.append("anthropic-beta",Rs);e.headers=i}}backendMiddleware(){return[]}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new Ps(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:d}=await this.buildRequest(i,{retryCount:n-t}),h="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),m=r===void 0?"":`, retryOf: ${r}`,v=Date.now();if(i.signal?.aborted)throw new Wr;let g=new AbortController,S=await this.fetchWithTimeout(s,o,d,g,i,{requestLogID:h,retryOfRequestLogID:r}).catch(As),x=Date.now();if(S instanceof globalThis.Error){let E=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Wr;let P=Xn(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):"")),R=this.middleware.length>0||!!i.middleware?.length||this.backendMiddleware().length>0;if(R&&!P&&!YR(S))throw Ot(this).info(`[${h}] middleware error (not retryable)`),Ot(this).debug(`[${h}] middleware error (not retryable)`,Ni({retryOfRequestLogID:r,url:s,durationMs:x-v,message:S.message})),S;if(t)return Ot(this).info(`[${h}] connection ${P?"timed out":"failed"} - ${E}`),Ot(this).debug(`[${h}] connection ${P?"timed out":"failed"} (${E})`,Ni({retryOfRequestLogID:r,url:s,durationMs:x-v,message:S.message})),this.retryRequest(i,t,r??h);if(Ot(this).info(`[${h}] connection ${P?"timed out":"failed"} - error; no more retries left`),Ot(this).debug(`[${h}] connection ${P?"timed out":"failed"} (error; no more retries left)`,Ni({retryOfRequestLogID:r,url:s,durationMs:x-v,message:S.message})),P)throw new Bu;if(R&&!d_(S))throw S;throw new ao({cause:S})}let k=[...S.headers.entries()].filter(([E])=>E==="request-id").map(([E,P])=>", "+E+": "+JSON.stringify(P)).join(""),T=`[${h}${m}${k}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-v}ms`;if(!S.ok){let E=await this.shouldRetry(S,i);if(t&&E){let H=`retrying, ${t} attempts remaining`;return await gR(S.body),Ot(this).info(`${T} - ${H}`),Ot(this).debug(`[${h}] response error (${H})`,Ni({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-v})),this.retryRequest(i,t,r??h,S.headers)}let P=E?"error; no more retries left":"error; not retryable";Ot(this).info(`${T} - ${P}`);let R=await S.text().catch((H)=>As(H).message),I=Yu(R),O=I?void 0:R;throw Ot(this).debug(`[${h}] response error (${P})`,Ni({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:O,durationMs:Date.now()-v})),this.makeStatusError(S.status,I,O,S.headers)}return Ot(this).info(T),Ot(this).debug(`[${h}] response start`,Ni({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-v})),{response:S,options:i,controller:g,requestLogID:h,retryOfRequestLogID:r,startTime:v}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new cp(this,r,e)}async fetchWithTimeout(e,t,r,i,n,o){let{signal:s,method:d,...h}=t||{},m=this._makeAbort(i);if(s)s.addEventListener("abort",m,{once:!0});let v=globalThis.ReadableStream&&h.body instanceof globalThis.ReadableStream||typeof h.body==="object"&&h.body!==null&&Symbol.asyncIterator in h.body,g={signal:i.signal,...v?{duplex:"half"}:{},method:"GET",...h};if(d)g.method=d.toUpperCase();let S=this.fetch,x=async(R,I)=>{let O=setTimeout(m,r);try{return await S.call(void 0,R,I)}finally{clearTimeout(O)}},k=n===void 0?x:async(R,I={})=>{let O=typeof R==="string"?R:R instanceof URL?R.href:R.url;if(I.headers=I.headers instanceof Headers?I.headers:new Headers(I.headers),await this.prepareRequest(I,{url:O,options:n}),o)Ot(this).debug(`[${o.requestLogID}] sending request`,Ni({retryOfRequestLogID:o.retryOfRequestLogID,method:I.method,url:O,options:n,headers:I.headers}));return x(R,I)},T=n?.middleware,E=this.backendMiddleware(),P=T?.length||E.length?[...this.middleware,...T??[],...E]:this.middleware;return await f_(k,P,n,this)(e,g)}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let d=parseFloat(o);if(!Number.isNaN(d))n=d}let s=i?.get("retry-after");if(s&&!n){let d=parseFloat(s);if(!Number.isNaN(d))n=d*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let d=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,d)}return await fi(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Ze("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(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;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 d=this.buildURL(n,o,s);if("timeout"in r)cR("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:h,body:m}=this.buildBody({options:r}),v=await this.buildHeaders({options:e,method:i,bodyHeaders:h,retryCount:t});return{req:{method:i,headers:v,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"},...m&&{body:m},...this.fetchOptions??{},...r.fetchOptions??{}},url:d,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=ae([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Qu(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=ae([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Jh(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return z(this,Hp,"f").call(this,{body:e,headers:r})}}W_=ar,Hp=new WeakMap,K_=new WeakSet,eI=function(){return this.baseURL!=="https://api.anthropic.com"};ar.Anthropic=W_;ar.HUMAN_PROMPT=tI;ar.AI_PROMPT=rI;ar.DEFAULT_TIMEOUT=600000;ar.AnthropicError=Ze;ar.APIError=or;ar.APIConnectionError=ao;ar.APIConnectionTimeoutError=Bu;ar.APIUserAbortError=Wr;ar.NotFoundError=Wu;ar.ConflictError=Zu;ar.RateLimitError=Gu;ar.BadRequestError=qu;ar.AuthenticationError=Hu;ar.InternalServerError=Ju;ar.PermissionDeniedError=Ku;ar.UnprocessableEntityError=Vu;ar.toFile=dp;class Bs extends ar{constructor(){super(...arguments);this.completions=new sl(this),this.messages=new js(this),this.models=new ll(this),this.beta=new dr(this)}}Bs.Completions=sl;Bs.Messages=js;Bs.Models=ll;Bs.Beta=dr;Xt();Xt();function Z_(e){return e}function nI(e){return Z_(e)}function ed(e){return Z_(e)}function iI(e){return Z_(e)}class Kp extends Error{telemetryMessage;errorClass;constructor(e,t,r){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e,this.errorClass=r}}var V_=(e,t)=>{try{if(e!==null&&typeof e==="object"&&Object.isExtensible(e)){let r=e,i=Object.entries(t).filter(([n,o])=>o!==void 0&&!(n in r));Object.assign(r,Object.fromEntries(i))}}catch{}return e};function ul(e){return e instanceof Error?e:Error(String(e))}function Wp(e){return e instanceof Error?e.message:String(e)}function qs(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function oI(e){if(typeof e!=="string")return;return/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e)?iI(e):nI("nonconforming")}function Zp(e){return qs(e)==="ENOENT"}function G_(e){return qs(e)==="EISDIR"}dn();dn();function gi(e){return process.platform==="darwin"?e.normalize("NFC"):e}function X_(e){return/^[\\/]{2}/.test(e)||dI(e)}function lI(e){return/(^|[\\/])\.{1,2}[. ]*([\\/]|$)/.test(e)}function ZK(e){return e.length===2&&J_(e[0])==="net"||e.length===3&&J_(e[0])==="network"&&J_(e[1])==="servers"}function J_(e){return e.replace(/[\u200c-\u200f\u202a-\u202e\u206a-\u206f\ufeff]/g,"").toUpperCase().toLowerCase()}var _Se=aR({value:void 0},(e)=>{e.value=void 0});var VK=1024,Vp=new Map;function uI(e){if(!e.startsWith("/"))return null;let t=Vp.get(e);if(t===void 0){if(t=GK(e),Vp.size>=VK)Vp.clear();Vp.set(e,t)}return t}function GK(e){let t=[];for(let r of e.split("/")){if(r===""||r===".")continue;if(r===".."){t.pop();continue}if(t.push(r),ZK(t))return"/"+t.join("/")}return null}function Y_(e){let t=/^[\\/]{2}wsl(?:\$|\.localhost)[\\/]([^\\/]*)/i.exec(e);return t!==null&&!/^\.{0,2}[. ]*$/.test(t[1]??"")}function JK(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function cI(e){if(/^\\\\\?\\volume\{/i.test(e))return sI(e);if(dI(e))return!0;let t=JK(e);if(t!==e&&sI(t))return!0;return X_(t)&&!Y_(t)}function sI(e){return lI(e)||e.includes("/")}function dI(e){return aI.test(e)||e.includes("??")&&aI.test(XK(e))}var aI=/^[\\/]\?\?[\\/]/;function XK(e){return void 0?(void 0).normalize(e):e}var YK=16;class Q_{pending=null;shownThisSession=!1;changed=ir();submitted=[];submittedChanged=ir();subscribe=this.changed.subscribe;getSnapshot=()=>this.pending;subscribeSubmitted=this.submittedChanged.subscribe;submit(e){if(this.shownThisSession)return;if(this.submitted.length>=YK)this.submitted.shift();this.submitted.push(e),this.submittedChanged.emit()}takeSubmitted(){let e=this.submitted;return this.submitted=[],e}offer(e){if(this.shownThisSession)return;this.pending=e,this.changed.emit()}dismiss(){if(this.pending!==null)this.pending=null,this.changed.emit()}markShown(){this.shownThisSession=!0}}class e1{lastEmittedAt=new Map;shouldEmit(e,t,r){let i=this.lastEmittedAt.get(e)||0;if(t-i<r)return!1;if(this.lastEmittedAt.size>=100){let n=this.lastEmittedAt.keys().next().value;if(n!==void 0)this.lastEmittedAt.delete(n)}return this.lastEmittedAt.set(e,t),!0}}var QK=Symbol("permission-stash-evicted");class t1{entriesCap;evictedKeysCap;lanes={write:new Map,read:new Map};evicted={write:new Set,read:new Set};poisoned={write:!1,read:!1};identities=new Map;identitiesEvicted=new Set;identitiesPoisoned=!1;constructor(e=256,t=1048576){this.entriesCap=e;this.evictedKeysCap=t}stash(e,t,r,i="write"){if(e===void 0)return;let n=this.lanes[i],o=this.evicted[i],s=td(e,t);if(o.has(s))return;let d=n.get(s);if(d!==void 0){let h=new Set(r);n.set(s,d.filter((m)=>h.has(m)));return}if(n.size>=this.entriesCap){let h=n.keys().next().value;if(h!==void 0){if(n.delete(h),o.add(h),o.size>this.evictedKeysCap){this.poisoned[i]=!0;let m=o.values().next().value;if(m!==void 0)o.delete(m)}}}n.set(s,r)}holds(e,t,r="write"){return e!==void 0&&this.lanes[r].has(td(e,t))}stashIdentity(e,t,r){if(e===void 0)return;let i=td(e,t),n=this.identities.get(i);if(n!==void 0){if(n===null||r===null||n.dev!==r.dev||n.ino!==r.ino)this.identities.set(i,null);return}if(this.identitiesEvicted.has(i)||this.identitiesPoisoned){this.identities.set(i,null);return}if(this.identities.size>=this.entriesCap){let o=this.identities.keys().next().value;if(o!==void 0){if(this.identities.delete(o),this.identitiesEvicted.add(o),this.identitiesEvicted.size>this.evictedKeysCap){this.identitiesPoisoned=!0;let s=this.identitiesEvicted.values().next().value;if(s!==void 0)this.identitiesEvicted.delete(s)}}}this.identities.set(i,r)}takeIdentity(e,t){if(e===void 0)return;let r=td(e,t),i=this.identities.get(r);return this.identities.delete(r),this.identitiesEvicted.delete(r),i}consume(e,t,r="write"){if(e===void 0)return;let i=this.lanes[r],n=td(e,t),o=i.get(n),s=o===void 0&&(this.evicted[r].delete(n)||this.poisoned[r]),d=`${e}\x00`;for(let h of i.keys())if(h.startsWith(d))i.delete(h);if(r==="read"){for(let h of this.identities.keys())if(h.startsWith(d))this.identities.delete(h)}if(s)return QK;return o}}function td(e,t){return`${e}\x00${t}`}function fI(e){return hI({kind:"root",host:e.host,id:e.id,parentId:e.parentId},e.project)}function hI(e,t){let r=gi(t.originalCwd),i=gi(t.projectRoot),n=gi(t.cwd),o=ir(),s=e.kind==="fork"?e.root.observers:new vb,d=e.kind==="fork"?e.root.autonomousLoopPreamble:new Wb,h=e.kind==="fork"?e.root.precompute:new Lb,m={get originalCwd(){return r},get projectRoot(){return i},get cwd(){return n}},v={host:e.kind==="fork"?e.root.host:e.host,get id(){return e.kind==="fork"?e.root.id:e.id},get parentId(){return e.kind==="fork"?e.root.parentId:e.parentId},get root(){return e.kind==="fork"?e.root:v},project:m,observers:s,autonomousLoopPreamble:d,btwHistory:e.kind==="fork"?e.root.btwHistory:new Zb,ccrRecap:e.kind==="fork"?e.root.ccrRecap:new Bb,conversationLatches:e.kind==="fork"?e.root.conversationLatches:new bb,costLedger:e.kind==="fork"?e.root.costLedger:new xb,engineStore:e.kind==="fork"?e.root.engineStore:new zb,fableConsentSlots:e.kind==="fork"?e.root.fableConsentSlots:new kb,hookRegistry:e.kind==="fork"?e.root.hookRegistry:new Mb,identity:e.kind==="fork"?e.root.identity:new Ub,invokedSkills:e.kind==="fork"?e.root.invokedSkills:new Eb,mcpSessionWiring:e.kind==="fork"?e.root.mcpSessionWiring:new Tb,modelSelection:e.kind==="fork"?e.root.modelSelection:new Ab,promptAssembly:e.kind==="fork"?e.root.promptAssembly:new Rb,promptSuggestion:e.kind==="fork"?e.root.promptSuggestion:new Hb,pendingHint:e.kind==="fork"?e.root.pendingHint:new Q_,pluginsSync:e.kind==="fork"?e.root.pluginsSync:new qb,precompute:h,requestJournal:e.kind==="fork"?e.root.requestJournal:new Pb,sessionCron:e.kind==="fork"?e.root.sessionCron:new Ib,sessionFlags:e.kind==="fork"?e.root.sessionFlags:new Cb,sessionRefsGate:e.kind==="fork"?e.root.sessionRefsGate:new Kb,sessionScratch:e.kind==="fork"?e.root.sessionScratch:new $b,surfaceCapabilities:e.kind==="fork"?e.root.surfaceCapabilities:new Ob,toolProgressThrottle:e.kind==="fork"?e.root.toolProgressThrottle:new e1,turnBudget:e.kind==="fork"?e.root.turnBudget:new Db,userPresence:e.kind==="fork"?e.root.userPresence:new Nb,workflowUsageConsent:e.kind==="fork"?e.root.workflowUsageConsent:new jb,outsideReadPrompt:e.kind==="fork"?e.root.outsideReadPrompt:new Fb,writePermissionStash:e.kind==="fork"?e.root.writePermissionStash:new t1,subscribe(g){let S=o.subscribe(g);if(e.kind!=="fork")return S;let x=e.root,{id:k,parentId:T}=x,E=x.subscribe(()=>{if(x.id===k&&x.parentId===T)return;k=x.id,T=x.parentId,g()});return()=>{S(),E()}},setCwd(g){v.update({project:{cwd:g}})},withProject(g){return hI({kind:"fork",root:v.root},{originalCwd:g.originalCwd??r,projectRoot:g.projectRoot??i,cwd:g.cwd??n})},update(g){let S=!1;if(g.id!==void 0||"parentId"in g){if(e.kind==="fork")throw Error("A withProject fork cannot re-identify the session — update the root session instead");if(g.id!==void 0&&g.id!==e.id)e.id=g.id,S=!0;if("parentId"in g&&g.parentId!==e.parentId)e.parentId=g.parentId,S=!0}let x=g.project;if(x){if(x.originalCwd!==void 0){let k=gi(x.originalCwd);if(k!==r)r=k,S=!0}if(x.projectRoot!==void 0){let k=gi(x.projectRoot);if(k!==i)i=k,S=!0}if(x.cwd!==void 0){let k=gi(x.cwd);if(k!==n)n=k,S=!0}}if(S)o.emit()}};return v}class Gp{#e;#t=new WeakMap;constructor(e){this.#e=e}peek(e){return this.#t.get(e.root)}of(e){let t=e.root,r=this.#t.get(t);if(r!==void 0)return r;let i=this.#e();return this.#t.set(t,i),i}drop(e){this.#t.delete(e.root)}}class r1{#e=!1;#t=null;#r=!1;#n=void 0;#i=!1;#o=!1;#u=!1;#l=!1;#s=void 0;#c=!1;#a=!1;#f=null;#h=null;#d=new Map;#p="cli";#m="fresh";#g=void 0;#y=!1;#b=!1;#v=[];#S=!1;#_=!1;#x=!1;#k=!1;#w="none";#M=!1;#E=!1;#T=!1;#A=!1;#R=void 0;#P=!1;#I=!1;#C=!1;#$=null;#O=!0;#D=null;#N=!1;#L=null;#z=!1;#U=!1;#F={};#j=null;isInteractive(){return this.#e}replaceIsInteractive(e){this.#e=e}printOutputFormat(){return this.#t}replacePrintOutputFormat(e){this.#t=e}thinkingDisplayExplicit(){return this.#r}replaceThinkingDisplayExplicit(e){this.#r=e}permissionPromptToolName(){return this.#n}replacePermissionPromptToolName(e){this.#n=e}hasStreamingInput(){return this.#i}replaceHasStreamingInput(e){this.#i=e}singleShotPrintSession(){return this.#o}replaceSingleShotPrintSession(e){this.#o=e}printInputClosed(){return this.#u}markPrintInputClosed(){this.#u=!0}modelOverrideOptOutForSession(){return this.#l}replaceModelOverrideOptOutForSession(e){this.#l=e}rendererMode(){return this.#s}replaceRendererMode(e){this.#s=e}strictToolResultPairing(){return this.#c}replaceStrictToolResultPairing(e){this.#c=e}restrictedSession(){return this.#a}replaceRestrictedSession(e){this.#a=e}workspaceRestrictionState(){return this.#f}replaceWorkspaceRestrictionState(e){this.#f=e}replaceWorkspaceRestrictionUnsubscribe(e){this.#h?.(),this.#h=e}restrictedWorkspaceRoots(){return this.#d}addRestrictedWorkspaceRoot(e,t){this.#d.set(e,t)}clearRestrictedWorkspaceRoots(){this.#d=new Map}clientType(){return this.#p}replaceClientType(e){this.#p=e}sessionStartType(){return this.#m}replaceSessionStartType(e){this.#m=e}questionPreviewFormat(){return this.#g}replaceQuestionPreviewFormat(e){this.#g=e}extendedQuestionsEnabled(){return this.#y}replaceExtendedQuestionsEnabled(e){this.#y=e}questionOptionDescriptionsOptional(){return this.#b}replaceQuestionOptionDescriptionsOptional(e){this.#b=e}replConfigArgv(){return this.#v}replaceReplConfigArgv(e){this.#v=e}userMsgOptIn(){return this.#S}replaceUserMsgOptIn(e){this.#S=e}searchToolsOptIn(){return this.#_}replaceSearchToolsOptIn(e){this.#_=e}todoToolsOptIn(){return this.#x}replaceTodoToolsOptIn(e){this.#x=e}wizardOperatorToolsEnabled(){return this.#k}replaceWizardOperatorToolsEnabled(e){this.#k=e}pollEventIngress(){return this.#w}markPollEventIngress(e){this.#w=e}replPollDeliveryRequested(){return this.#M}markReplPollDeliveryRequested(){this.#M=!0}sdkAgentProgressSummariesEnabled(){return this.#E}replaceSdkAgentProgressSummariesEnabled(e){this.#E=e}sessionPersistenceDisabled(){return this.#T}replaceSessionPersistenceDisabled(e){this.#T=e}diskless(){return this.#A}replaceDiskless(e){this.#A=e}ccrSessionUrl(){return this.#R}replaceCcrSessionUrl(e){this.#R=e}sessionBypassPermissionsMode(){return this.#P}replaceSessionBypassPermissionsMode(e){this.#P=e}disableSlashCommands(){return this.#I}replaceDisableSlashCommands(e){this.#I=e}disableFileMentions(){return this.#C}replaceDisableFileMentions(e){this.#C=e}sessionUploadsDir(){return this.#$}replaceSessionUploadsDir(e){this.#$=e}mayForwardHomeSettings(){return this.#O}replaceMayForwardHomeSettings(e){this.#O=e}homeSettingsHostConsent(){return this.#D}replaceHomeSettingsHostConsent(e){this.#D=e}scheduledTasksEnabled(){return this.#N}replaceScheduledTasksEnabled(e){this.#N=e}initJsonSchema(){return this.#L}replaceInitJsonSchema(e){this.#L=e}cliSessionConfigCarried(){return this.#z}replaceCliSessionConfigCarried(e){this.#z=e}forkRestrictedLaunchConfig(){return this.#U}replaceForkRestrictedLaunchConfig(e){this.#U=e}forkReplayLaunchConfig(){return this.#F}replaceForkReplayLaunchConfig(e){this.#F=e}projectConfigRoot(){return this.#j}replaceProjectConfigRoot(e){this.#j=e}reset(){this.#e=!1,this.#t=null,this.#r=!1,this.#n=void 0,this.#i=!1,this.#o=!1,this.#u=!1,this.#l=!1,this.#s=void 0,this.#c=!1,this.#a=!1,this.#f=null,this.replaceWorkspaceRestrictionUnsubscribe(null),this.#d=new Map,this.#p="cli",this.#m="fresh",this.#g=void 0,this.#y=!1,this.#b=!1,this.#v=[],this.#S=!1,this.#_=!1,this.#x=!1,this.#k=!1,this.#w="none",this.#M=!1,this.#E=!1,this.#T=!1,this.#A=!1,this.#R=void 0,this.#P=!1,this.#I=!1,this.#C=!1,this.#$=null,this.#O=!0,this.#D=null,this.#N=!1,this.#L=null,this.#z=!1,this.#U=!1,this.#F={},this.#j=null}}class n1{#e=void 0;#t=void 0;#r=void 0;#n=null;#i=null;#o=!1;#u=pI();#l=null;#s=!1;flagSettingsPath(){return this.#e}replaceFlagSettingsPath(e){this.#e=e}flagSettingsExpectedContent(){return this.#t}replaceFlagSettingsExpectedContent(e){this.#t=e}flagSettingsFilePinnedContent(){return this.#r}replaceFlagSettingsFilePinnedContent(e){this.#r=e}flagSettingsInline(){return this.#n}replaceFlagSettingsInline(e){this.#n=e}parentManagedSettings(){return this.#i}replaceParentManagedSettings(e){this.#i=e}parentManagedSettingsInvalid(){return this.#o}replaceParentManagedSettingsInvalid(e){this.#o=e}allowedSettingSources(){return this.#u}replaceAllowedSettingSources(e){this.#u=e}allowedSettingSourcesWithoutRepoDirSources(){let e=this.#u;if(this.#l?.of!==e)this.#l={of:e,result:e.filter((t)=>t!=="projectSettings"&&t!=="localSettings")};return this.#l.result}useCoworkPlugins(){return this.#s}replaceUseCoworkPlugins(e){this.#s=e}reset(){this.#e=void 0,this.#t=void 0,this.#r=void 0,this.#n=null,this.#i=null,this.#o=!1,this.#u=pI(),this.#l=null,this.#s=!1}}function pI(){return["userSettings","projectSettings","localSettings","flagSettings","policySettings"]}class i1{#e=[];#t=[];#r=[];#n=void 0;#i=new Map;#o=new Map;#u=[];#l=[];#s=!1;#c=void 0;#a=void 0;#f=void 0;inlinePlugins(){return this.#e}replaceInlinePlugins(e){this.#e=e}inlinePluginsNoMcp(){return this.#t}replaceInlinePluginsNoMcp(e){this.#t=e}inlinePluginUrls(){return this.#r}replaceInlinePluginUrls(e){this.#r=e}syncedPluginDirs(){return this.#n??[]}syncedPluginDirsRegistered(){return this.#n!==void 0}syncedPluginAttestation(e){return this.#i.get(e)}replaceSyncedPluginDirs(e,t=new Map){this.#n=e,this.#i=t,this.#o=this.#h(this.#o)}clearSyncedPluginDirs(){this.#n=void 0,this.#i=new Map,this.#o=new Map}attestedOfficialPluginMarketplace(e){return this.#o.get(e)}replaceAttestedOfficialPluginIds(e){this.#o=this.#h(e)}#h(e){let t=new Set([...this.#i.values()].map((r)=>`${r.pluginName}@${r.marketplace}`));return new Map([...e].filter(([r,i])=>t.has(`${r.slice(0,r.lastIndexOf("@"))}@${i}`)))}additionalDirectoriesForClaudeMd(){return this.#u}replaceAdditionalDirectoriesForClaudeMd(e){this.#u=e}allowedChannels(){return this.#l}replaceAllowedChannels(e){this.#l=e}hasDevChannels(){return this.#s}replaceHasDevChannels(e){this.#s=e}sessionSkillAllowlist(){return this.#c}replaceSessionSkillAllowlist(e){this.#c=e}chromeFlagOverride(){return this.#a}replaceChromeFlagOverride(e){this.#a=e}teammateAgentId(){return this.#f}replaceTeammateAgentId(e){this.#f=e}reset(){this.#e=[],this.#t=[],this.#r=[],this.clearSyncedPluginDirs(),this.#u=[],this.#l=[],this.#s=!1,this.#c=void 0,this.#a=void 0,this.#f=void 0}}class o1{#e=null;#t=null;modelStrings(){return this.#e}replaceModelStrings(e){this.#e=e}invalidate(){this.#e=null}admin3PSteeringSnapshot(){return this.#t}recordAdmin3PSteeringSnapshot(e){this.#t=e}reset(){this.#e=null,this.#t=null}}var mI=[];class s1{#e=[];#t=[];#r=void 0;errorLog(){return this.#e}recordError(e){if(this.#e.length>=100)this.#e.shift();this.#e.push(e)}recordSlowOperation(e,t){return}slowOperations(){if(this.#t.length===0)return mI;let e=Date.now();if(this.#t.some((t)=>e-t.timestamp>=1e4)){if(this.#t=this.#t.filter((t)=>e-t.timestamp<1e4),this.#t.length===0)return mI}return this.#t}recordDevBarAlert(e){return}devBarAlert(){let e=this.#r;if(e&&Date.now()-e.timestamp>=60000){this.#r=void 0;return}return e}reset(){this.#e=[],this.#t=[],this.#r=void 0}}function gI(){return{rateTokens:null,rateLastRefillMs:null,featureOkLogged:!1,reportedDropReasons:new Set}}class a1{#e=null;#t=null;#r=null;#n=null;#i=null;#o=null;#u=null;#l=null;#s=null;#c=null;#a=null;#f=null;#h=null;#d=[];#p=null;#m=gI();#g=null;#y=null;#b=null;#v={direct:null,proxied:null};#S=null;#_=null;installMeter(e,t,{omitUnits:r=!1}={}){this.#e=e;let i=(n)=>r?void 0:n;this.#t=t("claude_code.session.count",{description:"Count of CLI sessions started"}),this.#r=t("claude_code.lines_of_code.count",{description:"Count of lines of code modified, with the 'type' attribute indicating whether lines were added or removed and the 'model' attribute indicating which model made the change"}),this.#n=t("claude_code.pull_request.count",{description:"Number of pull requests created"}),this.#i=t("claude_code.commit.count",{description:"Number of git commits created"}),this.#o=t("claude_code.cost.usage",{description:"Cost of the Claude Code session",unit:i("USD")}),this.#u=t("claude_code.token.usage",{description:"Number of tokens used",unit:i("tokens")}),this.#l=t("claude_code.code_edit_tool.decision",{description:"Count of code editing tool permission decisions (accept/reject) for Edit, Write, and NotebookEdit tools"}),this.#s=t("claude_code.active_time.total",{description:"Total active time in seconds",unit:i("s")})}meter(){return this.#e}sessionCounter(){return this.#t}locCounter(){return this.#r}prCounter(){return this.#n}commitCounter(){return this.#i}costCounter(){return this.#o}tokenCounter(){return this.#u}codeEditToolDecisionCounter(){return this.#l}activeTimeCounter(){return this.#s}statsStore(){return this.#c}replaceStatsStore(e){this.#c=e}loggerProvider(){return this.#a}replaceLoggerProvider(e){this.#a=e}eventLogger(){return this.#f}eventLoggerOwner(){return this.#h}attachEventLogger(e,t){if(this.#f=e,this.#h=e?t:null,!e)return;let r=this.#d;if(this.#d=null,r)for(let i of r)e.emit(i)}bufferPendingEvent(e){if(this.#d===null||this.#d.length>=100)return!1;return this.#d.push(e),!0}closeWindow(e){this.#d=null,this.#p=e}windowCloseCause(){return this.#p}isWindowOpen(){return this.#d!==null}hostOtel(){return this.#m}meterProvider(){return this.#g}replaceMeterProvider(e){this.#g=e}tracerProvider(){return this.#y}replaceTracerProvider(e){this.#y=e}cachedTelemetryResource(){return this.#b}replaceCachedTelemetryResource(e){this.#b=e}cachedOtlpHttpAgentFactory(e){return this.#v[e?"proxied":"direct"]}replaceCachedOtlpHttpAgentFactory(e,t){this.#v[e?"proxied":"direct"]=t}inClusterOtlpTrustRoots(){return this.#S}replaceInClusterOtlpTrustRoots(e){this.#S=e}inClusterOtlpAgentFactory(){return this.#_}replaceInClusterOtlpAgentFactory(e){this.#_=e}reset(){this.#e=null,this.#t=null,this.#r=null,this.#n=null,this.#i=null,this.#o=null,this.#u=null,this.#l=null,this.#s=null,this.#c=null,this.#a=null,this.#f=null,this.#h=null,this.#d=[],this.#p=null,this.#m=gI(),this.#g=null,this.#y=null,this.#b=null,this.#v={direct:null,proxied:null},this.#S=null,this.#_=null}}class l1{#e=void 0;#t=void 0;#r=!1;#n=void 0;#i=void 0;#o=new Set;#u=void 0;#l=null;#s=null;#c=0;#a=!1;#f=()=>!1;#h=null;#d=void 0;#p=null;#m=null;sessionIngressToken(){return this.#e}replaceSessionIngressToken(e){this.#e=e}oauthTokenFromFd(){return this.#t}replaceOauthTokenFromFd(e){this.#t=e}oauthTokenFromBgSnapshot(){return this.#r}replaceOauthTokenFromBgSnapshot(e){this.#r=e}oauthScopesFromFd(){return this.#n}replaceOauthScopesFromFd(e){this.#n=e}apiKeyFromFd(){return this.#i}replaceApiKeyFromFd(e){this.#i=e}descriptorAnnouncementConsumed(e){return this.#o.has(e)}markDescriptorAnnouncementConsumed(e){this.#o.add(e)}gatewayTokenFromDescriptor(){return this.#u}replaceGatewayTokenFromDescriptor(e){this.#u=e}resetFdCredentialState(){this.#e=void 0,this.#t=void 0,this.#r=!1,this.#n=void 0,this.#i=void 0}gatewayAuth(){return this.#l}replaceGatewayAuth(e){this.#l=e}gatewayServerProcess(){return this.#a}replaceGatewayServerProcess(e){this.#a=e}gatewayRequiredByHostPolicy(){return this.#f()}replaceGatewayRequiredByHostPolicyReader(e){this.#f=e}authenticatedAccount(){return this.#s}authenticatedAccountEpoch(){return this.#c}stampAuthenticatedAccount(e){let t=this.#s;if(e!==null&&t!==null&&e.accountUuid===t.accountUuid&&e.emailAddress===t.emailAddress&&e.organizationUuid===t.organizationUuid)return;this.#c+=1,this.#s=e}startupPolicySnapshot(){return this.#d}replaceStartupPolicySnapshot(e){this.#d=e}gatewayRefreshInFlight(){return this.#h}replaceGatewayRefreshInFlight(e){this.#h=e}sdkOAuthTokenRefreshCallback(){return this.#p}replaceSdkOAuthTokenRefreshCallback(e){this.#p=e}hostAuthTokenRefreshCallback(){return this.#m}replaceHostAuthTokenRefreshCallback(e){this.#m=e}resetForTests(){this.#e=null,this.#t=null,this.#r=!1,this.#n=void 0,this.#i=null,this.#o.clear(),this.#u=void 0,this.#l=null,this.#s=null,this.#c=0,this.#a=!1,this.#f=()=>!1,this.#h=null,this.#d=void 0,this.#p=null,this.#m=null}}class u1{#e=void 0;#t=!1;#r=!1;#n;directConnectServerUrl(){return this.#e}replaceDirectConnectServerUrl(e){this.#e=e}connectNonBlocking(){return this.#t}replaceConnectNonBlocking(e){this.#t=e}strictConfig(){return this.#r}replaceStrictConfig(e){this.#r=e}registerEnsureConnectedClient(e){this.#n=e}ensureConnectedClient(){return this.#n}reset(){this.#e=void 0,this.#t=!1,this.#r=!1}}class c1{#e=null;#t=new Map;#r=new Map;#n=new Set;#i=!1;#o=!1;#u=!1;#l=!1;#s=!1;#c=!1;#a=!1;#f=new Set;#h=!1;#d=!1;#p=!1;#m=new Map;#g=new Map;promptCache1hAllowlist(){return this.#e}replacePromptCache1hAllowlist(e){this.#e=e}thinkingTypeOverrides(){return this.#t}recordThinkingTypeOverride(e,t){this.#t.set(e,t)}servedModelsByRequestedModel(){return this.#r}recordServedModels(e,t){this.#r.set(e,t)}effortUnsupportedModels(){return this.#n}markEffortUnsupported(e){this.#n.add(e)}midConvCachePromotionRejected(){return this.#i}markMidConvCachePromotionRejected(){this.#i=!0}perTurnEffortOkEmitted(){return this.#o}markPerTurnEffortOkEmitted(){this.#o=!0}lateToolAdditionsOkEmitted(){return this.#u}markLateToolAdditionsOkEmitted(){this.#u=!0}toolResultScreeningOkEmitted(){return this.#l}markToolResultScreeningOkEmitted(){this.#l=!0}toolChangeHeaderRefused(){return this.#s}markToolChangeHeaderRefused(){this.#s=!0}thinkingResumptionRefused(){return this.#c}markThinkingResumptionRefused(){this.#c=!0}thinkingHighlightsRefused(){return this.#a}markThinkingHighlightsRefused(){this.#a=!0}toolChangeUnsupportedModels(){return this.#f}markToolChangeUnsupportedModel(e){this.#f.add(e)}internalModelFieldsRefused(){return this.#h}markInternalModelFieldsRefused(){this.#h=!0}internalModelFieldsRefusalAnnounced(){return this.#d}markInternalModelFieldsRefusalAnnounced(){this.#d=!0}thirdPartyServerClassifierRefused(){return this.#p}markThirdPartyServerClassifierRefused(){this.#p=!0}inferenceProfileBackingModels(){return this.#m}recordInferenceProfileBackingModel(e,t){this.#m.set(e,t)}foundryDeploymentCapabilities(){return this.#g}reset(){this.#e=null,this.#t=new Map,this.#r=new Map,this.#n=new Set,this.#i=!1,this.#o=!1,this.#u=!1,this.#l=!1,this.#s=!1,this.#c=!1,this.#a=!1,this.#f=new Set,this.#h=!1,this.#d=!1,this.#p=!1,this.#m=new Map,this.#g=new Map}}class d1{#e=!1;#t=!1;longContext1mCreditsBlocked(){return this.#e}replaceLongContext1mCreditsBlocked(e){this.#e=e}fableCreditsRequired(){return this.#t}replaceFableCreditsRequired(e){this.#t=e}reset(){this.#e=!1,this.#t=!1}}class f1{#e=!1;#t=!1;#r=yI;#n=ir();selectorGate(){return this.#e}selectorGateEverOn(){return this.#t}replaceSelectorGate(e){this.#e=e,this.#t||=e}inheritSelectorGateEverOn(){this.#t=!0}resampleSelectorGate(e){let t=this.#e;if(this.#e=e,this.#t||=e,t!==e)this.#n.emit(e)}subscribeSelectorGateChanged(e){return this.#n.subscribe(e)}replaceHostGateSubscription(e){let t=this.#r;this.#r=e,t()}dropHostGateSubscription(){this.replaceHostGateSubscription(yI)}}function yI(){}class h1{started=!1;stagingReaped=!1;claim(){if(this.started)return!1;return this.started=!0,!0}claimStagingReap(){if(this.stagingReaped)return!1;return this.stagingReaped=!0,!0}}class p1{backgroundHousekeeping;launchOptions;settingsSource;extensionsConfig;modelStringsCache;diagnostics;telemetryHandles;credentialSlots;mcpProcessWiring;requestLatches;accountCreditLatches;proactivity;constructor(e){this.backgroundHousekeeping=e.backgroundHousekeeping,this.launchOptions=e.launchOptions,this.settingsSource=e.settingsSource,this.extensionsConfig=e.extensionsConfig,this.modelStringsCache=e.modelStringsCache,this.diagnostics=e.diagnostics,this.telemetryHandles=e.telemetryHandles,this.credentialSlots=e.credentialSlots,this.mcpProcessWiring=e.mcpProcessWiring,this.requestLatches=e.requestLatches,this.accountCreditLatches=e.accountCreditLatches,this.proactivity=e.proactivity}}function vI(){return new p1({backgroundHousekeeping:new h1,launchOptions:new r1,settingsSource:new n1,extensionsConfig:new i1,modelStringsCache:new o1,diagnostics:new s1,telemetryHandles:new a1,credentialSlots:new l1,mcpProcessWiring:new u1,requestLatches:new c1,accountCreditLatches:new d1,proactivity:new f1})}function tW(e=yb()){return fI({host:vI(),id:uT()??Mu(),project:{originalCwd:e,projectRoot:e,cwd:e}})}var bI=tW($A);function rW(){return _I()?.session??bI}function cl(e){return e.of(bI.host)}function nW(){let e=_I();return e?.session?void 0:e}var _I=()=>{return};function SI(){return nW()?.sessionId??rW().id}var Zwe=new Gp(()=>ir());var Vwe=new Gp(()=>ir());var Gwe=new di(()=>ir());dn();var{appendFile:M1,mkdir:qI,rename:HI,stat:GW,symlink:JW,unlink:E1}=(()=>({}));dn();var wI={home:(e)=>({space:"home",path:e}),workspace:(e)=>({space:"workspace",path:e}),system:(e)=>({space:"system",path:e}),userNamed:(e)=>({space:"userNamed",path:e})};var m1=globalThis.process?.getBuiltinModule?.("async_hooks"),xI=m1!==void 0,g1=m1?new m1.AsyncLocalStorage:{run:(e,t)=>t(),getStore:()=>{return}};function kI({writeBatch:e,sizeOf:t,flushIntervalMs:r=1000,maxBufferSize:i=100,maxBufferBytes:n=1/0,immediateMode:o=!1}){let s=[],d=0,h=null,m=null;function v(){if(h)clearTimeout(h),h=null}function g(T){try{e(T)}catch{}}function S(){if(m)g(m),m=null;if(s.length===0)return;g(s),s=[],d=0,v()}function x(){if(!h)h=setTimeout(S,r)}function k(){if(m){m.push(...s),s=[],d=0,v();return}let T=s;s=[],d=0,v(),m=T,setImmediate(()=>{let E=m;if(m=null,E)g(E)})}return{write(T){if(o){g([T]);return}if(s.push(T),d+=t(T),x(),s.length>=i||d>=n)k()},flush:S,dispose(){S()}}}function iW(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class y1{#e=new Set;#t=!1;get drainStarted(){return this.#t}register(e){let t=iW(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){this.#t=!0;let e=Array.from(this.#e);this.#e.clear();let r=(await Promise.allSettled(e.map(async(i)=>i()))).find((i)=>i.status==="rejected");if(r!==void 0)throw r.reason}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}class MI{cleanup=new y1;preExitFlush=new y1}var oW=new di(()=>new MI);function sW(){return cl(oW)}function EI(e){return sW().cleanup.register(e)}class AI{parsed=new Map;lookup(e){return this.parsed.get(e)}remember(e,t){this.parsed.set(e,t)}reset(){this.parsed.clear()}}var TI=new AI;function RI(e){let t=TI.lookup(e);if(t!==void 0)return t;let r=aW(e);return TI.remember(e,r),r}function aW(e){if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}}function lW(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function uW(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function PI(e,t){if(!t)return!0;let r=lW(e);return uW(r,t)}dn();function Jp(){return process.env.CLAUDE_CONFIG_DIR}var v1=ju(()=>(Jp()??Qt(wu(),".claude")).normalize("NFC"),Jp);function II(){return process.env.CLAUDE_CODE_PROJECT_DIR_NAME}var cW=/^[A-Za-z0-9_-]{1,64}$/,dW=/^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function fW(e){if(!e||!cW.test(e)||dW.test(e))return;return e}function hW(){return`${Jp()??""}\x00${II()??""}`}var Pxe=ju(()=>Jp()?fW(II()):void 0,hW);var dt=(()=>({}));var{appendFile:pW,chmod:mW,copyFile:gW,link:yW,lstat:b1,mkdir:vW,open:Xp,readdir:bW,readFile:CI,readlink:_W,realpath:SW,rename:wW,rmdir:xW,rm:kW,stat:$I,symlink:MW,unlink:EW}=(()=>({}));dn();var TW="→";function AW(){return process.platform==="win32"?0:dt.constants.O_NOFOLLOW|dt.constants.O_NONBLOCK}var Xxe=process.platform==="win32"?/[\\/]+/:/\/+/;function _1(e){let t="";for(let i of e.split(/([\\/]+)/)){if(i==="."||i==="..")break;t+=i}let r=t.replace(/(?<=[^\\/])[\\/]+$/,"");return r===""?e:r}function RW(e){let t=Qt(e).replace(/(?<=[^\\/])[\\/]+$/,"");if(X_(t)&&!Y_(t))return t;return _1(e)}function PW(e){if(e.startsWith("\\\\"))return _1(e);let t=e.replace(/^\/+/,"/"),r=uI(t);if(r!==null)return r;return _1(e)}var Yxe=process.platform==="win32"?RW:PW;var IW={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=qr(r,sn`fs.existsSync(${e})`,0);return dt.existsSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},async stat(e){return $I(e)},async lstat(e){return b1(e)},async openDirNoFollow(e){if(process.platform==="win32")throw Error("openDirNoFollow is a POSIX-only examination probe");await(await Xp(e,dt.constants.O_DIRECTORY|dt.constants.O_NOFOLLOW)).close()},openDirNoFollowSync(e){if(process.platform==="win32")throw Error("openDirNoFollowSync is a POSIX-only examination probe");let t=dt.openSync(e,dt.constants.O_DIRECTORY|dt.constants.O_NOFOLLOW);dt.closeSync(t)},async lstatBigint(e){return b1(e,{bigint:!0})},async statBigint(e){return $I(e,{bigint:!0})},async readdir(e){return bW(e,{withFileTypes:!0})},async unlink(e){return EW(e)},async rmdir(e){return xW(e)},async rm(e,t){return kW(e,t)},async mkdir(e,t){try{await vW(e,{recursive:!0,...t})}catch(r){if(qs(r)!=="EEXIST")throw r}},async readFile(e,t){return CI(e,{encoding:t.encoding})},async rename(e,t){return wW(e,t)},async realpath(e){return gi(await SW(e))},async readlink(e){return _W(e)},async copyFile(e,t){return gW(e,t)},async appendFile(e,t,r){if(r?.mode!==void 0)try{let i=await Xp(e,"ax",r.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(qs(i)!=="EEXIST")throw i}return pW(e,t)},async symlink(e,t,r){return MW(e,t,r)},async link(e,t){return yW(e,t)},async chmod(e,t){return mW(e,t)},statSync(e){let r=[];try{const t=qr(r,sn`fs.statSync(${e})`,0);return dt.statSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},lstatSync(e){let r=[];try{const t=qr(r,sn`fs.lstatSync(${e})`,0);return dt.lstatSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},readFileSync(e,t){let i=[];try{const r=qr(i,sn`fs.readFileSync(${e})`,0);return dt.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{Hr(i,o,s)}},readSync(e,t){let n=[];try{const r=qr(n,sn`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=dt.openSync(e,"r");let h=[],m=0;while(m<t.length){let g=Buffer.allocUnsafe(Math.min(65536,t.length-m)),S=dt.readSync(i,g,0,g.length,m);if(S===0)break;h.push(g.subarray(0,S)),m+=S}return{buffer:Buffer.concat(h,m),bytesRead:m}}finally{if(i!==void 0)dt.closeSync(i)}}catch(o){var s=o,d=1}finally{Hr(n,s,d)}},appendFileSync(e,t,r){let n=[];try{const i=qr(n,sn`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let h=dt.openSync(e,"ax",r.mode);try{dt.appendFileSync(h,t)}finally{dt.closeSync(h)}return}catch(h){if(qs(h)!=="EEXIST")throw h}dt.appendFileSync(e,t)}catch(o){var s=o,d=1}finally{Hr(n,s,d)}},unlinkSync(e){let r=[];try{const t=qr(r,sn`fs.unlinkSync(${e})`,0);dt.unlinkSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},renameSync(e,t){let i=[];try{const r=qr(i,sn`fs.renameSync(${e} ${TW} ${t})`,0);dt.renameSync(e,t)}catch(n){var o=n,s=1}finally{Hr(i,o,s)}},readlinkSync(e){let r=[];try{const t=qr(r,sn`fs.readlinkSync(${e})`,0);return dt.readlinkSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},realpathSync(e){let r=[];try{const t=qr(r,sn`fs.realpathSync(${e})`,0);return gi(dt.realpathSync(e))}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=qr(n,sn`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{dt.mkdirSync(e,i)}catch(h){if(qs(h)!=="EEXIST")throw h}}catch(o){var s=o,d=1}finally{Hr(n,s,d)}},readdirSync(e){let r=[];try{const t=qr(r,sn`fs.readdirSync(${e})`,0);return dt.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},rmSync(e,t){let i=[];try{const r=qr(i,sn`fs.rmSync(${e})`,0);dt.rmSync(e,t)}catch(n){var o=n,s=1}finally{Hr(i,o,s)}},createWriteStream(e){return dt.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return CI(e);let r=await Xp(e,process.platform==="win32"?"r":dt.constants.O_RDONLY|(dt.constants.O_NONBLOCK??0)|(dt.constants.O_NOCTTY??0));try{if(!(await r.stat()).isFile())return Buffer.alloc(0);return await CW(r,t,"file")}finally{await r.close()}},async readFileFdGated(e,t){try{let r=AW();if(r===0){if(!(await b1(e)).isFile())return null}let i=await Xp(e,dt.constants.O_RDONLY|r);try{let n=await i.stat();if(!n.isFile()||n.size>t)return null;let o=Number(n.size),s=Buffer.allocUnsafe(o),d=0;while(d<o){let{bytesRead:h}=await i.read(s,d,o-d,d);if(h===0)break;d+=h}return{content:(d<o?s.subarray(0,d):s).toString("utf8"),stats:n}}finally{await i.close()}}catch{return null}}};function rd(){return IW}async function CW(e,t,r){let i=r!==void 0?r==="file":(await e.stat()).isFile(),n=[],o=0;while(o<t){let s=Buffer.allocUnsafe(Math.min(65536,t-o)),{bytesRead:d}=await e.read(s,0,s.length,i?o:null);if(d===0)break;n.push(s.subarray(0,d)),o+=d}return Buffer.concat(n,o)}dn();var{lstatSync:rke,readFileSync:nke,rmSync:ike,unlinkSync:oke,writeFileSync:ske}=(()=>({}));function $W(e,t,r){if(e.destroyed||e.writableEnded)return!1;return e.write(t,r),!0}class S1{everWritten=!1;drainPromise=void 0;bytesQueued=0;bytesFlushed=0;notifyFlushProgress=void 0;notifyExternallyClocked=void 0;externallyClockedPromise=void 0;externallyClocked=!1;errored=!1;flushConfirmedPromise=void 0;flushCloseListener=void 0;markEverWritten(){this.everWritten=!0}recordQueued(e){this.bytesQueued+=e}recordFlushed(e){this.bytesFlushed+=e,this.notifyFlushProgress?.()}markErrored(){this.errored=!0,this.notifyFlushProgress?.()}outstandingBytes(){return process.stdout.destroyed||this.errored?0:this.bytesQueued-this.bytesFlushed}endStdoutOnce(){if(this.drainPromise===void 0){let e=process.stdout;if(e.isTTY||e.destroyed||e.writableEnded||!this.everWritten)return;this.drainPromise=new Promise((t)=>e.end(t))}return this.drainPromise}fullyFlushed(){if(this.flushConfirmedPromise===void 0)this.flushConfirmedPromise=new Promise((e)=>{let t=()=>{if(this.outstandingBytes()<=0)this.notifyFlushProgress=void 0,e()};this.notifyFlushProgress=t,this.flushCloseListener=t,process.stdout.once("close",t),t()});return this.flushConfirmedPromise}isExternallyClocked(){return this.externallyClocked}ensureExternallyClockedPromise(){return this.externallyClockedPromise??=new Promise((e)=>{this.notifyExternallyClocked=e})}markExternallyClocked(){this.externallyClocked=!0,this.ensureExternallyClockedPromise(),this.notifyExternallyClocked?.(),this.notifyExternallyClocked=void 0}reset(){if(this.flushCloseListener!==void 0)process.stdout.removeListener("close",this.flushCloseListener);Object.assign(this,new S1)}}var hke=new S1;function OI(e){$W(process.stderr,e)}var OW=/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,DI="[^\\s,;&}\\])]+",NI=`"[^"]*"|'[^']*'|[^\\s-]{0,4}\\[REDACTED\\]['"\`]?|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${DI})|${DI}`,DW=["sk","ant","api"].join("-"),yi="[\\w=-]{20,}(?:\\.[0-9a-z]{9})?",UI=[{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:`(?:${OW.source})[\\w.-]*["']?\\s*[=:]\\s*(${NI})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${NI})`,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})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",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(${DW}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:"anthropic-oauth-token",source:`\\b(sk-ant-(?:oat|ort)\\d{2}-[\\w-]{20,})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",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-${yi}`,confidence:"high"},{id:"gitlab-deploy-token",source:`gldt-${yi}`,confidence:"high"},{id:"gitlab-runner-authentication-token",source:`glrt-${yi}`,confidence:"high"},{id:"gitlab-oauth-app-secret",source:`gloas-${yi}`,confidence:"high"},{id:"gitlab-pipeline-trigger-token",source:`glptt-${yi}`,confidence:"high"},{id:"gitlab-kubernetes-agent-token",source:`glagent-${yi}`,confidence:"high"},{id:"gitlab-incoming-mail-token",source:`glimt-${yi}`,confidence:"high"},{id:"gitlab-scim-oauth-token",source:`glsoat-${yi}`,confidence:"high"},{id:"gitlab-ci-build-token",source:`glcbt-${yi}`,confidence:"high"},{id:"gitlab-feed-token",source:`glft-${yi}`,confidence:"high"},{id:"gitlab-feature-flag-client-token",source:`glffct-${yi}`,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[a-z](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-rotation-token",source:"xoxe(?:\\.xox[a-z])?-[0-9]-[A-Za-z0-9-]{28,}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"slack-workflow-token",source:"\\bxwfp-[a-zA-Z0-9-]{20,}",confidence:"high"},{id:"slack-webhook-url",source:"(?:https?://)?hooks\\.slack\\.com/(?:services|workflows|triggers)/[A-Za-z0-9+/_-]{40,}",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"}],NW=64;function x1(e,t){let r=/-----BEGIN[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi,i=/-----END[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi;r.lastIndex=t;let n=r.exec(e);if(!n)return null;i.lastIndex=n.index+n[0].length+NW;let o=i.exec(e);if(!o)return null;return{start:n.index,end:o.index+o[0].length}}function LW(e){return x1(e,0)!==null}function zW(e){let t=x1(e,0);if(!t)return e;let r="",i=0;while(t)r+=e.slice(i,t.start)+"[REDACTED]",i=t.end,t=x1(e,i);return r+e.slice(i)}var LI=`(?:[\\x60'"\\s;]|\\\\[nr]|$)`,zI="(?=[^a-zA-Z0-9_\\-+=]|$)",UW="(?<![a-zA-Z0-9_\\-])";function FW(){return UI.map((e)=>({id:e.id,confidence:e.confidence,re:new RegExp(e.confidence!=="high"?e.source:UW+(e.source.endsWith(LI)?e.source.slice(0,-LI.length)+zI:e.source+zI),(e.flags??"").replace("g","")+"g")}))}function w1(e){return UI.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function k1(e,t){if(typeof t!=="string")return"[REDACTED]";let r=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",i=e.lastIndexOf(t);return`${e.slice(0,i)}${r}[REDACTED]${r}${e.slice(i+t.length)}`}var jW=512,BW=512;class FI{testRules=null;redactRules=null;displayRules=null;resultCache=new Map;scan(e){this.testRules??=w1(!1);let t=[];for(let r of this.testRules)if(r.confidence==="high"&&r.re.test(e))t.push({ruleId:r.id,label:r.id.split("-").map((i)=>VW[i]??iE(i)).join(" ")});if(LW(e))t.push({ruleId:"private-key",label:"Private Key"});return t}redactContext(e){this.redactRules??=w1(!0);let t=zW(e);for(let r of this.redactRules)if(r.confidence==="low")t=t.replace(r.re,k1);return t}redactTokens(e){this.redactRules??=w1(!0);let t=e;for(let r of this.redactRules)if(r.confidence==="high")t=t.replace(r.re,k1);return t}redact(e){let t=e.length<=jW;if(t){let i=this.resultCache.get(e);if(i!==void 0)return i}let r=this.redactTokens(this.redactContext(e));if(t){if(this.resultCache.size>=BW)this.resultCache.delete(this.resultCache.keys().next().value);this.resultCache.set(e,r)}return r}redactForDisplay(e){this.displayRules??=FW();let t=e;for(let r of this.displayRules){if(r.confidence!=="high")continue;t=t.replace(r.re,WW)}return t}}var qW=new FI;function jI(e){return qW.redact(e)}var HW=/[$\x60|;&<>()\s]/,KW=/[/.@:~*?\\]/;function WW(e,t){let r=typeof t==="string"?t:e;if(HW.test(r)||KW.test(r))return e;return k1(e,t)}var Yp="(^|[^a-z0-9+.-]|%[0-9a-f]{2})",ZW="https?|wss?|ftps?",BI="ssh\\+git|git\\+ssh|ssh|git",vke=new RegExp(`[a-z](?:[a-z0-9+.-]{1,31}:\\/+|:\\/\\/)|(?:https?|ftps?):(?!\\/)|${Yp}(?:wss?|file):(?!\\/)|${Yp}(?:${BI}):(?!\\/)(?=[^@/?#\\s]*?(?::|%3a))`,"i");var bke=new RegExp(`${Yp}(?:${ZW}):(?!\\/\\/)|${Yp}(?:${BI}):(?!\\/\\/)`,"gi");var VW={aws:"AWS",gcp:"GCP",api:"API",pat:"PAT",ad:"AD",tf:"TF",oauth:"OAuth",npm:"NPM",pypi:"PyPI",jwt:"JWT",ci:"CI",scim:"SCIM",github:"GitHub",gitlab:"GitLab",openai:"OpenAI",digitalocean:"DigitalOcean",huggingface:"HuggingFace",hashicorp:"HashiCorp",sendgrid:"SendGrid"};var A1={verbose:0,debug:1,info:2,warn:3,error:4},XW=10485760;function YW(e){return Object.hasOwn(A1,e)}function KI(e){return cI(e)?null:Ii(e)}function WI(){}var QW={sessionId:"",fromBackend:!1};function ZI(e,t,r,i){let n=Qt(t,"debug"),o=Qt(n,`${e.sessionId}.txt`),s;if(r===null)s=o;else if(i!==null&&r===i)s=Qt(i,`${e.sessionId}.txt`);else s=r;let d=!e.fromBackend&&s===o?"v5":"raw";return{target:s,arm:d,configHome:t,rotate:d==="raw"&&!(rn(s)===n&&s.endsWith(".txt")),pointLatest:d==="raw"&&s!==o}}function T1(e){return wI.userNamed(ga(e)?e:Ii(e))}function eZ(e){return e.code==="Failed"&&e.telemetryCode==="ENOENT"}function tZ(e,t=xI){return t?e:void 0}async function VI(e,t,r,i){let n={namespace:"log",sessionId:t,channel:"debug"},o=await g1.run(!0,()=>e.append(n,[{data:r}],i?{markLatest:!0}:void 0));if(o.ok)return"landed";return i&&o.error.code==="InvalidArgument"&&o.error.argument==="opts.markLatest"?"refused":"dropped"}class GI{deps;minLevel;filter;toStderr;filePath;runtimeDebugEnabled=!1;hasFormattedOutput=!1;debugFromLaunch;storageV5;writer=null;redirect=null;pendingWrite=Promise.resolve();unflushedChunks=[];backendLinesLogged=0;exiting=!1;exitHandlerRegistered=!1;successor=null;writtenBytes=-1;rotating=!1;resolvedLogPath=null;overrideDirectory=null;rotationTarget=null;latestMarked=!1;latestRefused=!1;constructor(e){this.deps=e;if(this.storageV5=tZ(e.storageV5),e.launchIdentity!==void 0){this.minLevel=e.launchIdentity.minLevel,this.filter=e.launchIdentity.filter,this.toStderr=e.launchIdentity.toStderr,this.filePath=e.launchIdentity.filePath,this.debugFromLaunch=e.launchIdentity.debugFromLaunch;return}let t=Array.isArray(e.argv)?e.argv:[],r=t.indexOf("--"),i=r===-1?t:t.slice(0,r),n=e.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();this.minLevel=n&&YW(n)?n:"debug";let o=i.find((d)=>d.startsWith("--debug="));this.filter=o?RI(o.substring(8)):null,this.toStderr=i.includes("--debug-to-stderr")||i.includes("-d2e");let s=null;for(let d=0;d<i.length;d++){let h=i[d];if(h.startsWith("--debug-file=")){s=KI(h.substring(13));break}if(h==="--debug-file"&&d+1<i.length){s=KI(i[d+1]);break}}this.filePath=s,this.debugFromLaunch=$a(e.env.DEBUG)||$a(e.env.DEBUG_SDK)||i.includes("--debug")||i.includes("-d")||this.toStderr||o!==void 0||this.filePath!==null}isDebugMode(){return this.runtimeDebugEnabled||this.debugFromLaunch}drainsSyncAtExit(){return!(so()&&this.storageV5!==void 0&&this.deps.syncExitDrain===!1)}launchIdentity(){return{minLevel:this.minLevel,filter:this.filter,toStderr:this.toStderr,filePath:this.filePath,debugFromLaunch:this.debugFromLaunch,isAnt:this.deps.isAnt,isTestEnvironment:this.deps.isTestEnvironment}}enableDebugLogging(){let e=this.isDebugMode()||this.deps.isAnt;return this.runtimeDebugEnabled=!0,e}logPath(){return this.filePath??(this.overrideDirectory!==null&&this.overrideDirectory===this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR?Qt(this.overrideDirectory,`${this.deps.sessionId()}.txt`):null)??this.resolvedLogPath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??this.defaultLogPath()}defaultLogPath(e=this.deps.sessionId()){return Qt(this.deps.configHomeDir(),"debug",`${e}.txt`)}learnedOverrideDirectory(){return this.overrideDirectory}isArmed(){return this.storageV5!==void 0}log(e,{level:t}={level:"debug"}){if(A1[t]<A1[this.minLevel])return;if(!this.shouldLog(e))return;let r=jI(e.trim());if(r.includes(`
87
+ `)){let v=m.indexOf(":");if(v>=0)h[m.substring(0,v).trim()]=m.substring(v+1).trim()}o.defaultHeaders={...h,...o.defaultHeaders}}let d=n.__auth;if(delete o.__auth,delete o.__baseURLIsExplicit,this._options=o,this.apiKey=typeof t==="string"?t:null,this.authToken=r,this.webhookKey=i,d){if(this._authState=d,!this._baseURLIsExplicit&&d.baseURL)this.baseURL=d.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let h=o.credentials??null;if(h)this._authState.provider=h,this._authState.tokenCache=this._makeTokenCache(h);else if(o.config!=null){let m=c_(o.config,this._credentialResolverOptions());this._authState.provider=m.provider,this._authState.tokenCache=this._makeTokenCache(m.provider),this._authState.extraHeaders=m.extraHeaders,this._applyCredentialBaseURL(m.baseURL)}else if(o.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(o.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Ot(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Ot(this).warn(e)}}}_credentialsFetch(){return f_(this.fetch,this.middleware,void 0,this)}_makeTokenCache(e){return new i_(e,(t)=>{Ot(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...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,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await WR(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Ze(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.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(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,ae([{Authorization:`Bearer ${t}`}])}return ae([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return ae([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return ae([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return ER(e)}getUserAgent(){return`${this.constructor.name}/JS ${Yn}`}defaultIdempotencyKey(){return`stainless-node-retry-${La()}`}makeStatusError(e,t,r,i){return or.generate(e,t,r,i)}buildURL(e,t,r){let i=!z(this,K_,"m",eI).call(this)&&r||this.baseURL,n=lR(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Gb(o)||!Gb(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Ze("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(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(Rs))i.append("anthropic-beta",Rs);e.headers=i}}backendMiddleware(){return[]}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new Ps(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:d}=await this.buildRequest(i,{retryCount:n-t}),h="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),m=r===void 0?"":`, retryOf: ${r}`,v=Date.now();if(i.signal?.aborted)throw new Wr;let g=new AbortController,S=await this.fetchWithTimeout(s,o,d,g,i,{requestLogID:h,retryOfRequestLogID:r}).catch(As),x=Date.now();if(S instanceof globalThis.Error){let E=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Wr;let P=Xn(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):"")),R=this.middleware.length>0||!!i.middleware?.length||this.backendMiddleware().length>0;if(R&&!P&&!YR(S))throw Ot(this).info(`[${h}] middleware error (not retryable)`),Ot(this).debug(`[${h}] middleware error (not retryable)`,Ni({retryOfRequestLogID:r,url:s,durationMs:x-v,message:S.message})),S;if(t)return Ot(this).info(`[${h}] connection ${P?"timed out":"failed"} - ${E}`),Ot(this).debug(`[${h}] connection ${P?"timed out":"failed"} (${E})`,Ni({retryOfRequestLogID:r,url:s,durationMs:x-v,message:S.message})),this.retryRequest(i,t,r??h);if(Ot(this).info(`[${h}] connection ${P?"timed out":"failed"} - error; no more retries left`),Ot(this).debug(`[${h}] connection ${P?"timed out":"failed"} (error; no more retries left)`,Ni({retryOfRequestLogID:r,url:s,durationMs:x-v,message:S.message})),P)throw new Bu;if(R&&!d_(S))throw S;throw new ao({cause:S})}let k=[...S.headers.entries()].filter(([E])=>E==="request-id").map(([E,P])=>", "+E+": "+JSON.stringify(P)).join(""),T=`[${h}${m}${k}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-v}ms`;if(!S.ok){let E=await this.shouldRetry(S,i);if(t&&E){let H=`retrying, ${t} attempts remaining`;return await gR(S.body),Ot(this).info(`${T} - ${H}`),Ot(this).debug(`[${h}] response error (${H})`,Ni({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-v})),this.retryRequest(i,t,r??h,S.headers)}let P=E?"error; no more retries left":"error; not retryable";Ot(this).info(`${T} - ${P}`);let R=await S.text().catch((H)=>As(H).message),I=Yu(R),O=I?void 0:R;throw Ot(this).debug(`[${h}] response error (${P})`,Ni({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:O,durationMs:Date.now()-v})),this.makeStatusError(S.status,I,O,S.headers)}return Ot(this).info(T),Ot(this).debug(`[${h}] response start`,Ni({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-v})),{response:S,options:i,controller:g,requestLogID:h,retryOfRequestLogID:r,startTime:v}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new cp(this,r,e)}async fetchWithTimeout(e,t,r,i,n,o){let{signal:s,method:d,...h}=t||{},m=this._makeAbort(i);if(s)s.addEventListener("abort",m,{once:!0});let v=globalThis.ReadableStream&&h.body instanceof globalThis.ReadableStream||typeof h.body==="object"&&h.body!==null&&Symbol.asyncIterator in h.body,g={signal:i.signal,...v?{duplex:"half"}:{},method:"GET",...h};if(d)g.method=d.toUpperCase();let S=this.fetch,x=async(R,I)=>{let O=setTimeout(m,r);try{return await S.call(void 0,R,I)}finally{clearTimeout(O)}},k=n===void 0?x:async(R,I={})=>{let O=typeof R==="string"?R:R instanceof URL?R.href:R.url;if(I.headers=I.headers instanceof Headers?I.headers:new Headers(I.headers),await this.prepareRequest(I,{url:O,options:n}),o)Ot(this).debug(`[${o.requestLogID}] sending request`,Ni({retryOfRequestLogID:o.retryOfRequestLogID,method:I.method,url:O,options:n,headers:I.headers}));return x(R,I)},T=n?.middleware,E=this.backendMiddleware(),P=T?.length||E.length?[...this.middleware,...T??[],...E]:this.middleware;return await f_(k,P,n,this)(e,g)}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let d=parseFloat(o);if(!Number.isNaN(d))n=d}let s=i?.get("retry-after");if(s&&!n){let d=parseFloat(s);if(!Number.isNaN(d))n=d*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let d=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,d)}return await fi(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Ze("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(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;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 d=this.buildURL(n,o,s);if("timeout"in r)cR("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:h,body:m}=this.buildBody({options:r}),v=await this.buildHeaders({options:e,method:i,bodyHeaders:h,retryCount:t});return{req:{method:i,headers:v,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"},...m&&{body:m},...this.fetchOptions??{},...r.fetchOptions??{}},url:d,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=ae([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Qu(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=ae([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Jh(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return z(this,Hp,"f").call(this,{body:e,headers:r})}}W_=ar,Hp=new WeakMap,K_=new WeakSet,eI=function(){return this.baseURL!=="https://api.anthropic.com"};ar.Anthropic=W_;ar.HUMAN_PROMPT=tI;ar.AI_PROMPT=rI;ar.DEFAULT_TIMEOUT=600000;ar.AnthropicError=Ze;ar.APIError=or;ar.APIConnectionError=ao;ar.APIConnectionTimeoutError=Bu;ar.APIUserAbortError=Wr;ar.NotFoundError=Wu;ar.ConflictError=Zu;ar.RateLimitError=Gu;ar.BadRequestError=qu;ar.AuthenticationError=Hu;ar.InternalServerError=Ju;ar.PermissionDeniedError=Ku;ar.UnprocessableEntityError=Vu;ar.toFile=dp;class Bs extends ar{constructor(){super(...arguments);this.completions=new sl(this),this.messages=new js(this),this.models=new ll(this),this.beta=new dr(this)}}Bs.Completions=sl;Bs.Messages=js;Bs.Models=ll;Bs.Beta=dr;Xt();Xt();function Z_(e){return e}function nI(e){return Z_(e)}function ed(e){return Z_(e)}function iI(e){return Z_(e)}class Kp extends Error{telemetryMessage;errorClass;constructor(e,t,r){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e,this.errorClass=r}}var V_=(e,t)=>{try{if(e!==null&&typeof e==="object"&&Object.isExtensible(e)){let r=e,i=Object.entries(t).filter(([n,o])=>o!==void 0&&!(n in r));Object.assign(r,Object.fromEntries(i))}}catch{}return e};function ul(e){return e instanceof Error?e:Error(String(e))}function Wp(e){return e instanceof Error?e.message:String(e)}function qs(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function oI(e){if(typeof e!=="string")return;return/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e)?iI(e):nI("nonconforming")}function Zp(e){return qs(e)==="ENOENT"}function G_(e){return qs(e)==="EISDIR"}dn();dn();function gi(e){return process.platform==="darwin"?e.normalize("NFC"):e}function X_(e){return/^[\\/]{2}/.test(e)||dI(e)}function lI(e){return/(^|[\\/])\.{1,2}[. ]*([\\/]|$)/.test(e)}function ZK(e){return e.length===2&&J_(e[0])==="net"||e.length===3&&J_(e[0])==="network"&&J_(e[1])==="servers"}function J_(e){return e.replace(/[\u200c-\u200f\u202a-\u202e\u206a-\u206f\ufeff]/g,"").toUpperCase().toLowerCase()}var _Se=aR({value:void 0},(e)=>{e.value=void 0});var VK=1024,Vp=new Map;function uI(e){if(!e.startsWith("/"))return null;let t=Vp.get(e);if(t===void 0){if(t=GK(e),Vp.size>=VK)Vp.clear();Vp.set(e,t)}return t}function GK(e){let t=[];for(let r of e.split("/")){if(r===""||r===".")continue;if(r===".."){t.pop();continue}if(t.push(r),ZK(t))return"/"+t.join("/")}return null}function Y_(e){let t=/^[\\/]{2}wsl(?:\$|\.localhost)[\\/]([^\\/]*)/i.exec(e);return t!==null&&!/^\.{0,2}[. ]*$/.test(t[1]??"")}function JK(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function cI(e){if(/^\\\\\?\\volume\{/i.test(e))return sI(e);if(dI(e))return!0;let t=JK(e);if(t!==e&&sI(t))return!0;return X_(t)&&!Y_(t)}function sI(e){return lI(e)||e.includes("/")}function dI(e){return aI.test(e)||e.includes("??")&&aI.test(XK(e))}var aI=/^[\\/]\?\?[\\/]/;function XK(e){return void 0?(void 0).normalize(e):e}var YK=16;class Q_{pending=null;shownThisSession=!1;changed=ir();submitted=[];submittedChanged=ir();subscribe=this.changed.subscribe;getSnapshot=()=>this.pending;subscribeSubmitted=this.submittedChanged.subscribe;submit(e){if(this.shownThisSession)return;if(this.submitted.length>=YK)this.submitted.shift();this.submitted.push(e),this.submittedChanged.emit()}takeSubmitted(){let e=this.submitted;return this.submitted=[],e}offer(e){if(this.shownThisSession)return;this.pending=e,this.changed.emit()}dismiss(){if(this.pending!==null)this.pending=null,this.changed.emit()}markShown(){this.shownThisSession=!0}}class e1{lastEmittedAt=new Map;shouldEmit(e,t,r){let i=this.lastEmittedAt.get(e)||0;if(t-i<r)return!1;if(this.lastEmittedAt.size>=100){let n=this.lastEmittedAt.keys().next().value;if(n!==void 0)this.lastEmittedAt.delete(n)}return this.lastEmittedAt.set(e,t),!0}}var QK=Symbol("permission-stash-evicted");class t1{entriesCap;evictedKeysCap;lanes={write:new Map,read:new Map};evicted={write:new Set,read:new Set};poisoned={write:!1,read:!1};identities=new Map;identitiesEvicted=new Set;identitiesPoisoned=!1;constructor(e=256,t=1048576){this.entriesCap=e;this.evictedKeysCap=t}stash(e,t,r,i="write"){if(e===void 0)return;let n=this.lanes[i],o=this.evicted[i],s=td(e,t);if(o.has(s))return;let d=n.get(s);if(d!==void 0){let h=new Set(r);n.set(s,d.filter((m)=>h.has(m)));return}if(n.size>=this.entriesCap){let h=n.keys().next().value;if(h!==void 0){if(n.delete(h),o.add(h),o.size>this.evictedKeysCap){this.poisoned[i]=!0;let m=o.values().next().value;if(m!==void 0)o.delete(m)}}}n.set(s,r)}holds(e,t,r="write"){return e!==void 0&&this.lanes[r].has(td(e,t))}stashIdentity(e,t,r){if(e===void 0)return;let i=td(e,t),n=this.identities.get(i);if(n!==void 0){if(n===null||r===null||n.dev!==r.dev||n.ino!==r.ino)this.identities.set(i,null);return}if(this.identitiesEvicted.has(i)||this.identitiesPoisoned){this.identities.set(i,null);return}if(this.identities.size>=this.entriesCap){let o=this.identities.keys().next().value;if(o!==void 0){if(this.identities.delete(o),this.identitiesEvicted.add(o),this.identitiesEvicted.size>this.evictedKeysCap){this.identitiesPoisoned=!0;let s=this.identitiesEvicted.values().next().value;if(s!==void 0)this.identitiesEvicted.delete(s)}}}this.identities.set(i,r)}takeIdentity(e,t){if(e===void 0)return;let r=td(e,t),i=this.identities.get(r);return this.identities.delete(r),this.identitiesEvicted.delete(r),i}consume(e,t,r="write"){if(e===void 0)return;let i=this.lanes[r],n=td(e,t),o=i.get(n),s=o===void 0&&(this.evicted[r].delete(n)||this.poisoned[r]),d=`${e}\x00`;for(let h of i.keys())if(h.startsWith(d))i.delete(h);if(r==="read"){for(let h of this.identities.keys())if(h.startsWith(d))this.identities.delete(h)}if(s)return QK;return o}}function td(e,t){return`${e}\x00${t}`}function fI(e){return hI({kind:"root",host:e.host,id:e.id,parentId:e.parentId},e.project)}function hI(e,t){let r=gi(t.originalCwd),i=gi(t.projectRoot),n=gi(t.cwd),o=ir(),s=e.kind==="fork"?e.root.observers:new vb,d=e.kind==="fork"?e.root.autonomousLoopPreamble:new Wb,h=e.kind==="fork"?e.root.precompute:new Lb,m={get originalCwd(){return r},get projectRoot(){return i},get cwd(){return n}},v={host:e.kind==="fork"?e.root.host:e.host,get id(){return e.kind==="fork"?e.root.id:e.id},get parentId(){return e.kind==="fork"?e.root.parentId:e.parentId},get root(){return e.kind==="fork"?e.root:v},project:m,observers:s,autonomousLoopPreamble:d,btwHistory:e.kind==="fork"?e.root.btwHistory:new Zb,ccrRecap:e.kind==="fork"?e.root.ccrRecap:new Bb,conversationLatches:e.kind==="fork"?e.root.conversationLatches:new bb,costLedger:e.kind==="fork"?e.root.costLedger:new xb,engineStore:e.kind==="fork"?e.root.engineStore:new zb,fableConsentSlots:e.kind==="fork"?e.root.fableConsentSlots:new kb,hookRegistry:e.kind==="fork"?e.root.hookRegistry:new Mb,identity:e.kind==="fork"?e.root.identity:new Ub,invokedSkills:e.kind==="fork"?e.root.invokedSkills:new Eb,mcpSessionWiring:e.kind==="fork"?e.root.mcpSessionWiring:new Tb,modelSelection:e.kind==="fork"?e.root.modelSelection:new Ab,promptAssembly:e.kind==="fork"?e.root.promptAssembly:new Rb,promptSuggestion:e.kind==="fork"?e.root.promptSuggestion:new Hb,pendingHint:e.kind==="fork"?e.root.pendingHint:new Q_,pluginsSync:e.kind==="fork"?e.root.pluginsSync:new qb,precompute:h,requestJournal:e.kind==="fork"?e.root.requestJournal:new Pb,sessionCron:e.kind==="fork"?e.root.sessionCron:new Ib,sessionFlags:e.kind==="fork"?e.root.sessionFlags:new Cb,sessionRefsGate:e.kind==="fork"?e.root.sessionRefsGate:new Kb,sessionScratch:e.kind==="fork"?e.root.sessionScratch:new $b,surfaceCapabilities:e.kind==="fork"?e.root.surfaceCapabilities:new Ob,toolProgressThrottle:e.kind==="fork"?e.root.toolProgressThrottle:new e1,turnBudget:e.kind==="fork"?e.root.turnBudget:new Db,userPresence:e.kind==="fork"?e.root.userPresence:new Nb,workflowUsageConsent:e.kind==="fork"?e.root.workflowUsageConsent:new jb,outsideReadPrompt:e.kind==="fork"?e.root.outsideReadPrompt:new Fb,writePermissionStash:e.kind==="fork"?e.root.writePermissionStash:new t1,subscribe(g){let S=o.subscribe(g);if(e.kind!=="fork")return S;let x=e.root,{id:k,parentId:T}=x,E=x.subscribe(()=>{if(x.id===k&&x.parentId===T)return;k=x.id,T=x.parentId,g()});return()=>{S(),E()}},setCwd(g){v.update({project:{cwd:g}})},withProject(g){return hI({kind:"fork",root:v.root},{originalCwd:g.originalCwd??r,projectRoot:g.projectRoot??i,cwd:g.cwd??n})},update(g){let S=!1;if(g.id!==void 0||"parentId"in g){if(e.kind==="fork")throw Error("A withProject fork cannot re-identify the session — update the root session instead");if(g.id!==void 0&&g.id!==e.id)e.id=g.id,S=!0;if("parentId"in g&&g.parentId!==e.parentId)e.parentId=g.parentId,S=!0}let x=g.project;if(x){if(x.originalCwd!==void 0){let k=gi(x.originalCwd);if(k!==r)r=k,S=!0}if(x.projectRoot!==void 0){let k=gi(x.projectRoot);if(k!==i)i=k,S=!0}if(x.cwd!==void 0){let k=gi(x.cwd);if(k!==n)n=k,S=!0}}if(S)o.emit()}};return v}class Gp{#e;#t=new WeakMap;constructor(e){this.#e=e}peek(e){return this.#t.get(e.root)}of(e){let t=e.root,r=this.#t.get(t);if(r!==void 0)return r;let i=this.#e();return this.#t.set(t,i),i}drop(e){this.#t.delete(e.root)}}class r1{#e=!1;#t=null;#r=!1;#n=void 0;#i=!1;#o=!1;#u=!1;#l=!1;#s=void 0;#c=!1;#a=!1;#f=null;#h=null;#d=new Map;#p="cli";#m="fresh";#y=void 0;#g=!1;#v=!1;#b=[];#S=!1;#_=!1;#x=!1;#k=!1;#w="none";#M=!1;#E=!1;#T=!1;#A=!1;#R=void 0;#P=!1;#I=!1;#C=!1;#$=null;#O=!0;#D=null;#N=!1;#L=null;#z=!1;#U=!1;#F={};#j=null;isInteractive(){return this.#e}replaceIsInteractive(e){this.#e=e}printOutputFormat(){return this.#t}replacePrintOutputFormat(e){this.#t=e}thinkingDisplayExplicit(){return this.#r}replaceThinkingDisplayExplicit(e){this.#r=e}permissionPromptToolName(){return this.#n}replacePermissionPromptToolName(e){this.#n=e}hasStreamingInput(){return this.#i}replaceHasStreamingInput(e){this.#i=e}singleShotPrintSession(){return this.#o}replaceSingleShotPrintSession(e){this.#o=e}printInputClosed(){return this.#u}markPrintInputClosed(){this.#u=!0}modelOverrideOptOutForSession(){return this.#l}replaceModelOverrideOptOutForSession(e){this.#l=e}rendererMode(){return this.#s}replaceRendererMode(e){this.#s=e}strictToolResultPairing(){return this.#c}replaceStrictToolResultPairing(e){this.#c=e}restrictedSession(){return this.#a}replaceRestrictedSession(e){this.#a=e}workspaceRestrictionState(){return this.#f}replaceWorkspaceRestrictionState(e){this.#f=e}replaceWorkspaceRestrictionUnsubscribe(e){this.#h?.(),this.#h=e}restrictedWorkspaceRoots(){return this.#d}addRestrictedWorkspaceRoot(e,t){this.#d.set(e,t)}clearRestrictedWorkspaceRoots(){this.#d=new Map}clientType(){return this.#p}replaceClientType(e){this.#p=e}sessionStartType(){return this.#m}replaceSessionStartType(e){this.#m=e}questionPreviewFormat(){return this.#y}replaceQuestionPreviewFormat(e){this.#y=e}extendedQuestionsEnabled(){return this.#g}replaceExtendedQuestionsEnabled(e){this.#g=e}questionOptionDescriptionsOptional(){return this.#v}replaceQuestionOptionDescriptionsOptional(e){this.#v=e}replConfigArgv(){return this.#b}replaceReplConfigArgv(e){this.#b=e}userMsgOptIn(){return this.#S}replaceUserMsgOptIn(e){this.#S=e}searchToolsOptIn(){return this.#_}replaceSearchToolsOptIn(e){this.#_=e}todoToolsOptIn(){return this.#x}replaceTodoToolsOptIn(e){this.#x=e}wizardOperatorToolsEnabled(){return this.#k}replaceWizardOperatorToolsEnabled(e){this.#k=e}pollEventIngress(){return this.#w}markPollEventIngress(e){this.#w=e}replPollDeliveryRequested(){return this.#M}markReplPollDeliveryRequested(){this.#M=!0}sdkAgentProgressSummariesEnabled(){return this.#E}replaceSdkAgentProgressSummariesEnabled(e){this.#E=e}sessionPersistenceDisabled(){return this.#T}replaceSessionPersistenceDisabled(e){this.#T=e}diskless(){return this.#A}replaceDiskless(e){this.#A=e}ccrSessionUrl(){return this.#R}replaceCcrSessionUrl(e){this.#R=e}sessionBypassPermissionsMode(){return this.#P}replaceSessionBypassPermissionsMode(e){this.#P=e}disableSlashCommands(){return this.#I}replaceDisableSlashCommands(e){this.#I=e}disableFileMentions(){return this.#C}replaceDisableFileMentions(e){this.#C=e}sessionUploadsDir(){return this.#$}replaceSessionUploadsDir(e){this.#$=e}mayForwardHomeSettings(){return this.#O}replaceMayForwardHomeSettings(e){this.#O=e}homeSettingsHostConsent(){return this.#D}replaceHomeSettingsHostConsent(e){this.#D=e}scheduledTasksEnabled(){return this.#N}replaceScheduledTasksEnabled(e){this.#N=e}initJsonSchema(){return this.#L}replaceInitJsonSchema(e){this.#L=e}cliSessionConfigCarried(){return this.#z}replaceCliSessionConfigCarried(e){this.#z=e}forkRestrictedLaunchConfig(){return this.#U}replaceForkRestrictedLaunchConfig(e){this.#U=e}forkReplayLaunchConfig(){return this.#F}replaceForkReplayLaunchConfig(e){this.#F=e}projectConfigRoot(){return this.#j}replaceProjectConfigRoot(e){this.#j=e}reset(){this.#e=!1,this.#t=null,this.#r=!1,this.#n=void 0,this.#i=!1,this.#o=!1,this.#u=!1,this.#l=!1,this.#s=void 0,this.#c=!1,this.#a=!1,this.#f=null,this.replaceWorkspaceRestrictionUnsubscribe(null),this.#d=new Map,this.#p="cli",this.#m="fresh",this.#y=void 0,this.#g=!1,this.#v=!1,this.#b=[],this.#S=!1,this.#_=!1,this.#x=!1,this.#k=!1,this.#w="none",this.#M=!1,this.#E=!1,this.#T=!1,this.#A=!1,this.#R=void 0,this.#P=!1,this.#I=!1,this.#C=!1,this.#$=null,this.#O=!0,this.#D=null,this.#N=!1,this.#L=null,this.#z=!1,this.#U=!1,this.#F={},this.#j=null}}class n1{#e=void 0;#t=void 0;#r=void 0;#n=null;#i=null;#o=!1;#u=pI();#l=null;#s=!1;flagSettingsPath(){return this.#e}replaceFlagSettingsPath(e){this.#e=e}flagSettingsExpectedContent(){return this.#t}replaceFlagSettingsExpectedContent(e){this.#t=e}flagSettingsFilePinnedContent(){return this.#r}replaceFlagSettingsFilePinnedContent(e){this.#r=e}flagSettingsInline(){return this.#n}replaceFlagSettingsInline(e){this.#n=e}parentManagedSettings(){return this.#i}replaceParentManagedSettings(e){this.#i=e}parentManagedSettingsInvalid(){return this.#o}replaceParentManagedSettingsInvalid(e){this.#o=e}allowedSettingSources(){return this.#u}replaceAllowedSettingSources(e){this.#u=e}allowedSettingSourcesWithoutRepoDirSources(){let e=this.#u;if(this.#l?.of!==e)this.#l={of:e,result:e.filter((t)=>t!=="projectSettings"&&t!=="localSettings")};return this.#l.result}useCoworkPlugins(){return this.#s}replaceUseCoworkPlugins(e){this.#s=e}reset(){this.#e=void 0,this.#t=void 0,this.#r=void 0,this.#n=null,this.#i=null,this.#o=!1,this.#u=pI(),this.#l=null,this.#s=!1}}function pI(){return["userSettings","projectSettings","localSettings","flagSettings","policySettings"]}class i1{#e=[];#t=[];#r=[];#n=void 0;#i=new Map;#o=new Map;#u=[];#l=[];#s=!1;#c=void 0;#a=void 0;#f=void 0;inlinePlugins(){return this.#e}replaceInlinePlugins(e){this.#e=e}inlinePluginsNoMcp(){return this.#t}replaceInlinePluginsNoMcp(e){this.#t=e}inlinePluginUrls(){return this.#r}replaceInlinePluginUrls(e){this.#r=e}syncedPluginDirs(){return this.#n??[]}syncedPluginDirsRegistered(){return this.#n!==void 0}syncedPluginAttestation(e){return this.#i.get(e)}replaceSyncedPluginDirs(e,t=new Map){this.#n=e,this.#i=t,this.#o=this.#h(this.#o)}clearSyncedPluginDirs(){this.#n=void 0,this.#i=new Map,this.#o=new Map}attestedOfficialPluginMarketplace(e){return this.#o.get(e)}replaceAttestedOfficialPluginIds(e){this.#o=this.#h(e)}#h(e){let t=new Set([...this.#i.values()].map((r)=>`${r.pluginName}@${r.marketplace}`));return new Map([...e].filter(([r,i])=>t.has(`${r.slice(0,r.lastIndexOf("@"))}@${i}`)))}additionalDirectoriesForClaudeMd(){return this.#u}replaceAdditionalDirectoriesForClaudeMd(e){this.#u=e}allowedChannels(){return this.#l}replaceAllowedChannels(e){this.#l=e}hasDevChannels(){return this.#s}replaceHasDevChannels(e){this.#s=e}sessionSkillAllowlist(){return this.#c}replaceSessionSkillAllowlist(e){this.#c=e}chromeFlagOverride(){return this.#a}replaceChromeFlagOverride(e){this.#a=e}teammateAgentId(){return this.#f}replaceTeammateAgentId(e){this.#f=e}reset(){this.#e=[],this.#t=[],this.#r=[],this.clearSyncedPluginDirs(),this.#u=[],this.#l=[],this.#s=!1,this.#c=void 0,this.#a=void 0,this.#f=void 0}}class o1{#e=null;#t=null;modelStrings(){return this.#e}replaceModelStrings(e){this.#e=e}invalidate(){this.#e=null}admin3PSteeringSnapshot(){return this.#t}recordAdmin3PSteeringSnapshot(e){this.#t=e}reset(){this.#e=null,this.#t=null}}var mI=[];class s1{#e=[];#t=[];#r=void 0;errorLog(){return this.#e}recordError(e){if(this.#e.length>=100)this.#e.shift();this.#e.push(e)}recordSlowOperation(e,t){return}slowOperations(){if(this.#t.length===0)return mI;let e=Date.now();if(this.#t.some((t)=>e-t.timestamp>=1e4)){if(this.#t=this.#t.filter((t)=>e-t.timestamp<1e4),this.#t.length===0)return mI}return this.#t}recordDevBarAlert(e){return}devBarAlert(){let e=this.#r;if(e&&Date.now()-e.timestamp>=60000){this.#r=void 0;return}return e}reset(){this.#e=[],this.#t=[],this.#r=void 0}}function gI(){return{rateTokens:null,rateLastRefillMs:null,featureOkLogged:!1,reportedDropReasons:new Set}}class a1{#e=null;#t=null;#r=null;#n=null;#i=null;#o=null;#u=null;#l=null;#s=null;#c=null;#a=null;#f=null;#h=null;#d=[];#p=null;#m=gI();#y=null;#g=null;#v=null;#b={direct:null,proxied:null};#S=null;#_=null;installMeter(e,t,{omitUnits:r=!1}={}){this.#e=e;let i=(n)=>r?void 0:n;this.#t=t("claude_code.session.count",{description:"Count of CLI sessions started"}),this.#r=t("claude_code.lines_of_code.count",{description:"Count of lines of code modified, with the 'type' attribute indicating whether lines were added or removed and the 'model' attribute indicating which model made the change"}),this.#n=t("claude_code.pull_request.count",{description:"Number of pull requests created"}),this.#i=t("claude_code.commit.count",{description:"Number of git commits created"}),this.#o=t("claude_code.cost.usage",{description:"Cost of the Claude Code session",unit:i("USD")}),this.#u=t("claude_code.token.usage",{description:"Number of tokens used",unit:i("tokens")}),this.#l=t("claude_code.code_edit_tool.decision",{description:"Count of code editing tool permission decisions (accept/reject) for Edit, Write, and NotebookEdit tools"}),this.#s=t("claude_code.active_time.total",{description:"Total active time in seconds",unit:i("s")})}meter(){return this.#e}sessionCounter(){return this.#t}locCounter(){return this.#r}prCounter(){return this.#n}commitCounter(){return this.#i}costCounter(){return this.#o}tokenCounter(){return this.#u}codeEditToolDecisionCounter(){return this.#l}activeTimeCounter(){return this.#s}statsStore(){return this.#c}replaceStatsStore(e){this.#c=e}loggerProvider(){return this.#a}replaceLoggerProvider(e){this.#a=e}eventLogger(){return this.#f}eventLoggerOwner(){return this.#h}attachEventLogger(e,t){if(this.#f=e,this.#h=e?t:null,!e)return;let r=this.#d;if(this.#d=null,r)for(let i of r)e.emit(i)}bufferPendingEvent(e){if(this.#d===null||this.#d.length>=100)return!1;return this.#d.push(e),!0}closeWindow(e){this.#d=null,this.#p=e}windowCloseCause(){return this.#p}isWindowOpen(){return this.#d!==null}hostOtel(){return this.#m}meterProvider(){return this.#y}replaceMeterProvider(e){this.#y=e}tracerProvider(){return this.#g}replaceTracerProvider(e){this.#g=e}cachedTelemetryResource(){return this.#v}replaceCachedTelemetryResource(e){this.#v=e}cachedOtlpHttpAgentFactory(e){return this.#b[e?"proxied":"direct"]}replaceCachedOtlpHttpAgentFactory(e,t){this.#b[e?"proxied":"direct"]=t}inClusterOtlpTrustRoots(){return this.#S}replaceInClusterOtlpTrustRoots(e){this.#S=e}inClusterOtlpAgentFactory(){return this.#_}replaceInClusterOtlpAgentFactory(e){this.#_=e}reset(){this.#e=null,this.#t=null,this.#r=null,this.#n=null,this.#i=null,this.#o=null,this.#u=null,this.#l=null,this.#s=null,this.#c=null,this.#a=null,this.#f=null,this.#h=null,this.#d=[],this.#p=null,this.#m=gI(),this.#y=null,this.#g=null,this.#v=null,this.#b={direct:null,proxied:null},this.#S=null,this.#_=null}}class l1{#e=void 0;#t=void 0;#r=!1;#n=void 0;#i=void 0;#o=new Set;#u=void 0;#l=null;#s=null;#c=0;#a=!1;#f=()=>!1;#h=null;#d=void 0;#p=null;#m=null;sessionIngressToken(){return this.#e}replaceSessionIngressToken(e){this.#e=e}oauthTokenFromFd(){return this.#t}replaceOauthTokenFromFd(e){this.#t=e}oauthTokenFromBgSnapshot(){return this.#r}replaceOauthTokenFromBgSnapshot(e){this.#r=e}oauthScopesFromFd(){return this.#n}replaceOauthScopesFromFd(e){this.#n=e}apiKeyFromFd(){return this.#i}replaceApiKeyFromFd(e){this.#i=e}descriptorAnnouncementConsumed(e){return this.#o.has(e)}markDescriptorAnnouncementConsumed(e){this.#o.add(e)}gatewayTokenFromDescriptor(){return this.#u}replaceGatewayTokenFromDescriptor(e){this.#u=e}resetFdCredentialState(){this.#e=void 0,this.#t=void 0,this.#r=!1,this.#n=void 0,this.#i=void 0}gatewayAuth(){return this.#l}replaceGatewayAuth(e){this.#l=e}gatewayServerProcess(){return this.#a}replaceGatewayServerProcess(e){this.#a=e}gatewayRequiredByHostPolicy(){return this.#f()}replaceGatewayRequiredByHostPolicyReader(e){this.#f=e}authenticatedAccount(){return this.#s}authenticatedAccountEpoch(){return this.#c}stampAuthenticatedAccount(e){let t=this.#s;if(e!==null&&t!==null&&e.accountUuid===t.accountUuid&&e.emailAddress===t.emailAddress&&e.organizationUuid===t.organizationUuid)return;this.#c+=1,this.#s=e}startupPolicySnapshot(){return this.#d}replaceStartupPolicySnapshot(e){this.#d=e}gatewayRefreshInFlight(){return this.#h}replaceGatewayRefreshInFlight(e){this.#h=e}sdkOAuthTokenRefreshCallback(){return this.#p}replaceSdkOAuthTokenRefreshCallback(e){this.#p=e}hostAuthTokenRefreshCallback(){return this.#m}replaceHostAuthTokenRefreshCallback(e){this.#m=e}resetForTests(){this.#e=null,this.#t=null,this.#r=!1,this.#n=void 0,this.#i=null,this.#o.clear(),this.#u=void 0,this.#l=null,this.#s=null,this.#c=0,this.#a=!1,this.#f=()=>!1,this.#h=null,this.#d=void 0,this.#p=null,this.#m=null}}class u1{#e=void 0;#t=!1;#r=!1;#n;directConnectServerUrl(){return this.#e}replaceDirectConnectServerUrl(e){this.#e=e}connectNonBlocking(){return this.#t}replaceConnectNonBlocking(e){this.#t=e}strictConfig(){return this.#r}replaceStrictConfig(e){this.#r=e}registerEnsureConnectedClient(e){this.#n=e}ensureConnectedClient(){return this.#n}reset(){this.#e=void 0,this.#t=!1,this.#r=!1}}class c1{#e=null;#t=new Map;#r=new Map;#n=new Set;#i=!1;#o=!1;#u=!1;#l=!1;#s=!1;#c=!1;#a=!1;#f=new Set;#h=!1;#d=!1;#p=!1;#m=!1;#y=void 0;#g=void 0;#v=new Map;#b=new Map;promptCache1hAllowlist(){return this.#e}replacePromptCache1hAllowlist(e){this.#e=e}thinkingTypeOverrides(){return this.#t}recordThinkingTypeOverride(e,t){this.#t.set(e,t)}servedModelsByRequestedModel(){return this.#r}recordServedModels(e,t){this.#r.set(e,t)}effortUnsupportedModels(){return this.#n}markEffortUnsupported(e){this.#n.add(e)}midConvCachePromotionRejected(){return this.#i}markMidConvCachePromotionRejected(){this.#i=!0}perTurnEffortOkEmitted(){return this.#o}markPerTurnEffortOkEmitted(){this.#o=!0}lateToolAdditionsOkEmitted(){return this.#u}markLateToolAdditionsOkEmitted(){this.#u=!0}toolResultScreeningOkEmitted(){return this.#l}markToolResultScreeningOkEmitted(){this.#l=!0}toolChangeHeaderRefused(){return this.#s}markToolChangeHeaderRefused(){this.#s=!0}thinkingResumptionRefused(){return this.#c}markThinkingResumptionRefused(){this.#c=!0}thinkingHighlightsRefused(){return this.#a}markThinkingHighlightsRefused(){this.#a=!0}toolChangeUnsupportedModels(){return this.#f}markToolChangeUnsupportedModel(e){this.#f.add(e)}internalModelFieldsRefused(){return this.#h}markInternalModelFieldsRefused(){this.#h=!0}internalModelFieldsRefusalAnnounced(){return this.#d}markInternalModelFieldsRefusalAnnounced(){this.#d=!0}thirdPartyServerClassifierRefused(){return this.#p}markThirdPartyServerClassifierRefused(){this.#p=!0}observedGateway(){return this.#y}serverClassifierFallbackChoice(){return this.#g}setServerClassifierFallbackChoice(e){this.#g=e}clearServerClassifierFallbackChoice(){this.#g=void 0}noteObservedGateway(e){this.#y??=e}takeServerClassifierFallbackAnnouncement(){if(!this.#p||this.#m)return!1;return this.#m=!0,!0}inferenceProfileBackingModels(){return this.#v}recordInferenceProfileBackingModel(e,t){this.#v.set(e,t)}foundryDeploymentCapabilities(){return this.#b}reset(){this.#e=null,this.#t=new Map,this.#r=new Map,this.#n=new Set,this.#i=!1,this.#o=!1,this.#u=!1,this.#l=!1,this.#s=!1,this.#c=!1,this.#a=!1,this.#f=new Set,this.#h=!1,this.#d=!1,this.#p=!1,this.#m=!1,this.#y=void 0,this.#g=void 0,this.#v=new Map,this.#b=new Map}}class d1{#e=!1;#t=!1;longContext1mCreditsBlocked(){return this.#e}replaceLongContext1mCreditsBlocked(e){this.#e=e}fableCreditsRequired(){return this.#t}replaceFableCreditsRequired(e){this.#t=e}reset(){this.#e=!1,this.#t=!1}}class f1{#e=!1;#t=!1;#r=yI;#n=ir();selectorGate(){return this.#e}selectorGateEverOn(){return this.#t}replaceSelectorGate(e){this.#e=e,this.#t||=e}inheritSelectorGateEverOn(){this.#t=!0}resampleSelectorGate(e){let t=this.#e;if(this.#e=e,this.#t||=e,t!==e)this.#n.emit(e)}subscribeSelectorGateChanged(e){return this.#n.subscribe(e)}replaceHostGateSubscription(e){let t=this.#r;this.#r=e,t()}dropHostGateSubscription(){this.replaceHostGateSubscription(yI)}}function yI(){}class h1{started=!1;stagingReaped=!1;claim(){if(this.started)return!1;return this.started=!0,!0}claimStagingReap(){if(this.stagingReaped)return!1;return this.stagingReaped=!0,!0}}class p1{backgroundHousekeeping;launchOptions;settingsSource;extensionsConfig;modelStringsCache;diagnostics;telemetryHandles;credentialSlots;mcpProcessWiring;requestLatches;accountCreditLatches;proactivity;constructor(e){this.backgroundHousekeeping=e.backgroundHousekeeping,this.launchOptions=e.launchOptions,this.settingsSource=e.settingsSource,this.extensionsConfig=e.extensionsConfig,this.modelStringsCache=e.modelStringsCache,this.diagnostics=e.diagnostics,this.telemetryHandles=e.telemetryHandles,this.credentialSlots=e.credentialSlots,this.mcpProcessWiring=e.mcpProcessWiring,this.requestLatches=e.requestLatches,this.accountCreditLatches=e.accountCreditLatches,this.proactivity=e.proactivity}}function vI(){return new p1({backgroundHousekeeping:new h1,launchOptions:new r1,settingsSource:new n1,extensionsConfig:new i1,modelStringsCache:new o1,diagnostics:new s1,telemetryHandles:new a1,credentialSlots:new l1,mcpProcessWiring:new u1,requestLatches:new c1,accountCreditLatches:new d1,proactivity:new f1})}function tW(e=yb()){return fI({host:vI(),id:uT()??Mu(),project:{originalCwd:e,projectRoot:e,cwd:e}})}var bI=tW($A);function rW(){return _I()?.session??bI}function cl(e){return e.of(bI.host)}function nW(){let e=_I();return e?.session?void 0:e}var _I=()=>{return};function SI(){return nW()?.sessionId??rW().id}var Zwe=new Gp(()=>ir());var Vwe=new Gp(()=>ir());var Gwe=new di(()=>ir());dn();var{appendFile:M1,mkdir:qI,rename:HI,stat:GW,symlink:JW,unlink:E1}=(()=>({}));dn();var wI={home:(e)=>({space:"home",path:e}),workspace:(e)=>({space:"workspace",path:e}),system:(e)=>({space:"system",path:e}),userNamed:(e)=>({space:"userNamed",path:e})};var m1=globalThis.process?.getBuiltinModule?.("async_hooks"),xI=m1!==void 0,g1=m1?new m1.AsyncLocalStorage:{run:(e,t)=>t(),getStore:()=>{return}};function kI({writeBatch:e,sizeOf:t,flushIntervalMs:r=1000,maxBufferSize:i=100,maxBufferBytes:n=1/0,immediateMode:o=!1}){let s=[],d=0,h=null,m=null;function v(){if(h)clearTimeout(h),h=null}function g(T){try{e(T)}catch{}}function S(){if(m)g(m),m=null;if(s.length===0)return;g(s),s=[],d=0,v()}function x(){if(!h)h=setTimeout(S,r)}function k(){if(m){m.push(...s),s=[],d=0,v();return}let T=s;s=[],d=0,v(),m=T,setImmediate(()=>{let E=m;if(m=null,E)g(E)})}return{write(T){if(o){g([T]);return}if(s.push(T),d+=t(T),x(),s.length>=i||d>=n)k()},flush:S,dispose(){S()}}}function iW(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class y1{#e=new Set;#t=!1;get drainStarted(){return this.#t}register(e){let t=iW(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){this.#t=!0;let e=Array.from(this.#e);this.#e.clear();let r=(await Promise.allSettled(e.map(async(i)=>i()))).find((i)=>i.status==="rejected");if(r!==void 0)throw r.reason}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}class MI{cleanup=new y1;preExitFlush=new y1}var oW=new di(()=>new MI);function sW(){return cl(oW)}function EI(e){return sW().cleanup.register(e)}class AI{parsed=new Map;lookup(e){return this.parsed.get(e)}remember(e,t){this.parsed.set(e,t)}reset(){this.parsed.clear()}}var TI=new AI;function RI(e){let t=TI.lookup(e);if(t!==void 0)return t;let r=aW(e);return TI.remember(e,r),r}function aW(e){if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}}function lW(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function uW(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function PI(e,t){if(!t)return!0;let r=lW(e);return uW(r,t)}dn();function Jp(){return process.env.CLAUDE_CONFIG_DIR}var v1=ju(()=>(Jp()??Qt(wu(),".claude")).normalize("NFC"),Jp);function II(){return process.env.CLAUDE_CODE_PROJECT_DIR_NAME}var cW=/^[A-Za-z0-9_-]{1,64}$/,dW=/^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function fW(e){if(!e||!cW.test(e)||dW.test(e))return;return e}function hW(){return`${Jp()??""}\x00${II()??""}`}var Pxe=ju(()=>Jp()?fW(II()):void 0,hW);var dt=(()=>({}));var{appendFile:pW,chmod:mW,copyFile:gW,link:yW,lstat:b1,mkdir:vW,open:Xp,readdir:bW,readFile:CI,readlink:_W,realpath:SW,rename:wW,rmdir:xW,rm:kW,stat:$I,symlink:MW,unlink:EW}=(()=>({}));dn();var TW="→";function AW(){return process.platform==="win32"?0:dt.constants.O_NOFOLLOW|dt.constants.O_NONBLOCK}var Xxe=process.platform==="win32"?/[\\/]+/:/\/+/;function _1(e){let t="";for(let i of e.split(/([\\/]+)/)){if(i==="."||i==="..")break;t+=i}let r=t.replace(/(?<=[^\\/])[\\/]+$/,"");return r===""?e:r}function RW(e){let t=Qt(e).replace(/(?<=[^\\/])[\\/]+$/,"");if(X_(t)&&!Y_(t))return t;return _1(e)}function PW(e){if(e.startsWith("\\\\"))return _1(e);let t=e.replace(/^\/+/,"/"),r=uI(t);if(r!==null)return r;return _1(e)}var Yxe=process.platform==="win32"?RW:PW;var IW={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=qr(r,sn`fs.existsSync(${e})`,0);return dt.existsSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},async stat(e){return $I(e)},async lstat(e){return b1(e)},async openDirNoFollow(e){if(process.platform==="win32")throw Error("openDirNoFollow is a POSIX-only examination probe");await(await Xp(e,dt.constants.O_DIRECTORY|dt.constants.O_NOFOLLOW)).close()},openDirNoFollowSync(e){if(process.platform==="win32")throw Error("openDirNoFollowSync is a POSIX-only examination probe");let t=dt.openSync(e,dt.constants.O_DIRECTORY|dt.constants.O_NOFOLLOW);dt.closeSync(t)},async lstatBigint(e){return b1(e,{bigint:!0})},async statBigint(e){return $I(e,{bigint:!0})},async readdir(e){return bW(e,{withFileTypes:!0})},async unlink(e){return EW(e)},async rmdir(e){return xW(e)},async rm(e,t){return kW(e,t)},async mkdir(e,t){try{await vW(e,{recursive:!0,...t})}catch(r){if(qs(r)!=="EEXIST")throw r}},async readFile(e,t){return CI(e,{encoding:t.encoding})},async rename(e,t){return wW(e,t)},async realpath(e){return gi(await SW(e))},async readlink(e){return _W(e)},async copyFile(e,t){return gW(e,t)},async appendFile(e,t,r){if(r?.mode!==void 0)try{let i=await Xp(e,"ax",r.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(qs(i)!=="EEXIST")throw i}return pW(e,t)},async symlink(e,t,r){return MW(e,t,r)},async link(e,t){return yW(e,t)},async chmod(e,t){return mW(e,t)},statSync(e){let r=[];try{const t=qr(r,sn`fs.statSync(${e})`,0);return dt.statSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},lstatSync(e){let r=[];try{const t=qr(r,sn`fs.lstatSync(${e})`,0);return dt.lstatSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},readFileSync(e,t){let i=[];try{const r=qr(i,sn`fs.readFileSync(${e})`,0);return dt.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{Hr(i,o,s)}},readSync(e,t){let n=[];try{const r=qr(n,sn`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=dt.openSync(e,"r");let h=[],m=0;while(m<t.length){let g=Buffer.allocUnsafe(Math.min(65536,t.length-m)),S=dt.readSync(i,g,0,g.length,m);if(S===0)break;h.push(g.subarray(0,S)),m+=S}return{buffer:Buffer.concat(h,m),bytesRead:m}}finally{if(i!==void 0)dt.closeSync(i)}}catch(o){var s=o,d=1}finally{Hr(n,s,d)}},appendFileSync(e,t,r){let n=[];try{const i=qr(n,sn`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let h=dt.openSync(e,"ax",r.mode);try{dt.appendFileSync(h,t)}finally{dt.closeSync(h)}return}catch(h){if(qs(h)!=="EEXIST")throw h}dt.appendFileSync(e,t)}catch(o){var s=o,d=1}finally{Hr(n,s,d)}},unlinkSync(e){let r=[];try{const t=qr(r,sn`fs.unlinkSync(${e})`,0);dt.unlinkSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},renameSync(e,t){let i=[];try{const r=qr(i,sn`fs.renameSync(${e} ${TW} ${t})`,0);dt.renameSync(e,t)}catch(n){var o=n,s=1}finally{Hr(i,o,s)}},readlinkSync(e){let r=[];try{const t=qr(r,sn`fs.readlinkSync(${e})`,0);return dt.readlinkSync(e)}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},realpathSync(e){let r=[];try{const t=qr(r,sn`fs.realpathSync(${e})`,0);return gi(dt.realpathSync(e))}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=qr(n,sn`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{dt.mkdirSync(e,i)}catch(h){if(qs(h)!=="EEXIST")throw h}}catch(o){var s=o,d=1}finally{Hr(n,s,d)}},readdirSync(e){let r=[];try{const t=qr(r,sn`fs.readdirSync(${e})`,0);return dt.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{Hr(r,n,o)}},rmSync(e,t){let i=[];try{const r=qr(i,sn`fs.rmSync(${e})`,0);dt.rmSync(e,t)}catch(n){var o=n,s=1}finally{Hr(i,o,s)}},createWriteStream(e){return dt.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return CI(e);let r=await Xp(e,process.platform==="win32"?"r":dt.constants.O_RDONLY|(dt.constants.O_NONBLOCK??0)|(dt.constants.O_NOCTTY??0));try{if(!(await r.stat()).isFile())return Buffer.alloc(0);return await CW(r,t,"file")}finally{await r.close()}},async readFileFdGated(e,t){try{let r=AW();if(r===0){if(!(await b1(e)).isFile())return null}let i=await Xp(e,dt.constants.O_RDONLY|r);try{let n=await i.stat();if(!n.isFile()||n.size>t)return null;let o=Number(n.size),s=Buffer.allocUnsafe(o),d=0;while(d<o){let{bytesRead:h}=await i.read(s,d,o-d,d);if(h===0)break;d+=h}return{content:(d<o?s.subarray(0,d):s).toString("utf8"),stats:n}}finally{await i.close()}}catch{return null}}};function rd(){return IW}async function CW(e,t,r){let i=r!==void 0?r==="file":(await e.stat()).isFile(),n=[],o=0;while(o<t){let s=Buffer.allocUnsafe(Math.min(65536,t-o)),{bytesRead:d}=await e.read(s,0,s.length,i?o:null);if(d===0)break;n.push(s.subarray(0,d)),o+=d}return Buffer.concat(n,o)}dn();var{lstatSync:rke,readFileSync:nke,rmSync:ike,unlinkSync:oke,writeFileSync:ske}=(()=>({}));function $W(e,t,r){if(e.destroyed||e.writableEnded)return!1;return e.write(t,r),!0}class S1{everWritten=!1;drainPromise=void 0;bytesQueued=0;bytesFlushed=0;notifyFlushProgress=void 0;notifyExternallyClocked=void 0;externallyClockedPromise=void 0;externallyClocked=!1;errored=!1;flushConfirmedPromise=void 0;flushCloseListener=void 0;markEverWritten(){this.everWritten=!0}recordQueued(e){this.bytesQueued+=e}recordFlushed(e){this.bytesFlushed+=e,this.notifyFlushProgress?.()}markErrored(){this.errored=!0,this.notifyFlushProgress?.()}outstandingBytes(){return process.stdout.destroyed||this.errored?0:this.bytesQueued-this.bytesFlushed}endStdoutOnce(){if(this.drainPromise===void 0){let e=process.stdout;if(e.isTTY||e.destroyed||e.writableEnded||!this.everWritten)return;this.drainPromise=new Promise((t)=>e.end(t))}return this.drainPromise}fullyFlushed(){if(this.flushConfirmedPromise===void 0)this.flushConfirmedPromise=new Promise((e)=>{let t=()=>{if(this.outstandingBytes()<=0)this.notifyFlushProgress=void 0,e()};this.notifyFlushProgress=t,this.flushCloseListener=t,process.stdout.once("close",t),t()});return this.flushConfirmedPromise}isExternallyClocked(){return this.externallyClocked}ensureExternallyClockedPromise(){return this.externallyClockedPromise??=new Promise((e)=>{this.notifyExternallyClocked=e})}markExternallyClocked(){this.externallyClocked=!0,this.ensureExternallyClockedPromise(),this.notifyExternallyClocked?.(),this.notifyExternallyClocked=void 0}reset(){if(this.flushCloseListener!==void 0)process.stdout.removeListener("close",this.flushCloseListener);Object.assign(this,new S1)}}var hke=new S1;function OI(e){$W(process.stderr,e)}var OW=/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,DI="[^\\s,;&}\\])]+",NI=`"[^"]*"|'[^']*'|[^\\s-]{0,4}\\[REDACTED\\]['"\`]?|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${DI})|${DI}`,DW=["sk","ant","api"].join("-"),yi="[\\w=-]{20,}(?:\\.[0-9a-z]{9})?",UI=[{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:`(?:${OW.source})[\\w.-]*["']?\\s*[=:]\\s*(${NI})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${NI})`,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})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",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(${DW}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:"anthropic-oauth-token",source:`\\b(sk-ant-(?:oat|ort)\\d{2}-[\\w-]{20,})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",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-${yi}`,confidence:"high"},{id:"gitlab-deploy-token",source:`gldt-${yi}`,confidence:"high"},{id:"gitlab-runner-authentication-token",source:`glrt-${yi}`,confidence:"high"},{id:"gitlab-oauth-app-secret",source:`gloas-${yi}`,confidence:"high"},{id:"gitlab-pipeline-trigger-token",source:`glptt-${yi}`,confidence:"high"},{id:"gitlab-kubernetes-agent-token",source:`glagent-${yi}`,confidence:"high"},{id:"gitlab-incoming-mail-token",source:`glimt-${yi}`,confidence:"high"},{id:"gitlab-scim-oauth-token",source:`glsoat-${yi}`,confidence:"high"},{id:"gitlab-ci-build-token",source:`glcbt-${yi}`,confidence:"high"},{id:"gitlab-feed-token",source:`glft-${yi}`,confidence:"high"},{id:"gitlab-feature-flag-client-token",source:`glffct-${yi}`,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[a-z](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-rotation-token",source:"xoxe(?:\\.xox[a-z])?-[0-9]-[A-Za-z0-9-]{28,}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"slack-workflow-token",source:"\\bxwfp-[a-zA-Z0-9-]{20,}",confidence:"high"},{id:"slack-webhook-url",source:"(?:https?://)?hooks\\.slack\\.com/(?:services|workflows|triggers)/[A-Za-z0-9+/_-]{40,}",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"}],NW=64;function x1(e,t){let r=/-----BEGIN[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi,i=/-----END[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi;r.lastIndex=t;let n=r.exec(e);if(!n)return null;i.lastIndex=n.index+n[0].length+NW;let o=i.exec(e);if(!o)return null;return{start:n.index,end:o.index+o[0].length}}function LW(e){return x1(e,0)!==null}function zW(e){let t=x1(e,0);if(!t)return e;let r="",i=0;while(t)r+=e.slice(i,t.start)+"[REDACTED]",i=t.end,t=x1(e,i);return r+e.slice(i)}var LI=`(?:[\\x60'"\\s;]|\\\\[nr]|$)`,zI="(?=[^a-zA-Z0-9_\\-+=]|$)",UW="(?<![a-zA-Z0-9_\\-])";function FW(){return UI.map((e)=>({id:e.id,confidence:e.confidence,re:new RegExp(e.confidence!=="high"?e.source:UW+(e.source.endsWith(LI)?e.source.slice(0,-LI.length)+zI:e.source+zI),(e.flags??"").replace("g","")+"g")}))}function w1(e){return UI.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function k1(e,t){if(typeof t!=="string")return"[REDACTED]";let r=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",i=e.lastIndexOf(t);return`${e.slice(0,i)}${r}[REDACTED]${r}${e.slice(i+t.length)}`}var jW=512,BW=512;class FI{testRules=null;redactRules=null;displayRules=null;resultCache=new Map;scan(e){this.testRules??=w1(!1);let t=[];for(let r of this.testRules)if(r.confidence==="high"&&r.re.test(e))t.push({ruleId:r.id,label:r.id.split("-").map((i)=>VW[i]??iE(i)).join(" ")});if(LW(e))t.push({ruleId:"private-key",label:"Private Key"});return t}redactContext(e){this.redactRules??=w1(!0);let t=zW(e);for(let r of this.redactRules)if(r.confidence==="low")t=t.replace(r.re,k1);return t}redactTokens(e){this.redactRules??=w1(!0);let t=e;for(let r of this.redactRules)if(r.confidence==="high")t=t.replace(r.re,k1);return t}redact(e){let t=e.length<=jW;if(t){let i=this.resultCache.get(e);if(i!==void 0)return i}let r=this.redactTokens(this.redactContext(e));if(t){if(this.resultCache.size>=BW)this.resultCache.delete(this.resultCache.keys().next().value);this.resultCache.set(e,r)}return r}redactForDisplay(e){this.displayRules??=FW();let t=e;for(let r of this.displayRules){if(r.confidence!=="high")continue;t=t.replace(r.re,WW)}return t}}var qW=new FI;function jI(e){return qW.redact(e)}var HW=/[$\x60|;&<>()\s]/,KW=/[/.@:~*?\\]/;function WW(e,t){let r=typeof t==="string"?t:e;if(HW.test(r)||KW.test(r))return e;return k1(e,t)}var Yp="(^|[^a-z0-9+.-]|%[0-9a-f]{2})",ZW="https?|wss?|ftps?",BI="ssh\\+git|git\\+ssh|ssh|git",vke=new RegExp(`[a-z](?:[a-z0-9+.-]{1,31}:\\/+|:\\/\\/)|(?:https?|ftps?):(?!\\/)|${Yp}(?:wss?|file):(?!\\/)|${Yp}(?:${BI}):(?!\\/)(?=[^@/?#\\s]*?(?::|%3a))`,"i");var bke=new RegExp(`${Yp}(?:${ZW}):(?!\\/\\/)|${Yp}(?:${BI}):(?!\\/\\/)`,"gi");var VW={aws:"AWS",gcp:"GCP",api:"API",pat:"PAT",ad:"AD",tf:"TF",oauth:"OAuth",npm:"NPM",pypi:"PyPI",jwt:"JWT",ci:"CI",scim:"SCIM",github:"GitHub",gitlab:"GitLab",openai:"OpenAI",digitalocean:"DigitalOcean",huggingface:"HuggingFace",hashicorp:"HashiCorp",sendgrid:"SendGrid"};var A1={verbose:0,debug:1,info:2,warn:3,error:4},XW=10485760;function YW(e){return Object.hasOwn(A1,e)}function KI(e){return cI(e)?null:Ii(e)}function WI(){}var QW={sessionId:"",fromBackend:!1};function ZI(e,t,r,i){let n=Qt(t,"debug"),o=Qt(n,`${e.sessionId}.txt`),s;if(r===null)s=o;else if(i!==null&&r===i)s=Qt(i,`${e.sessionId}.txt`);else s=r;let d=!e.fromBackend&&s===o?"v5":"raw";return{target:s,arm:d,configHome:t,rotate:d==="raw"&&!(rn(s)===n&&s.endsWith(".txt")),pointLatest:d==="raw"&&s!==o}}function T1(e){return wI.userNamed(ga(e)?e:Ii(e))}function eZ(e){return e.code==="Failed"&&e.telemetryCode==="ENOENT"}function tZ(e,t=xI){return t?e:void 0}async function VI(e,t,r,i){let n={namespace:"log",sessionId:t,channel:"debug"},o=await g1.run(!0,()=>e.append(n,[{data:r}],i?{markLatest:!0}:void 0));if(o.ok)return"landed";return i&&o.error.code==="InvalidArgument"&&o.error.argument==="opts.markLatest"?"refused":"dropped"}class GI{deps;minLevel;filter;toStderr;filePath;runtimeDebugEnabled=!1;hasFormattedOutput=!1;debugFromLaunch;storageV5;writer=null;redirect=null;pendingWrite=Promise.resolve();unflushedChunks=[];backendLinesLogged=0;exiting=!1;exitHandlerRegistered=!1;successor=null;writtenBytes=-1;rotating=!1;resolvedLogPath=null;overrideDirectory=null;rotationTarget=null;latestMarked=!1;latestRefused=!1;constructor(e){this.deps=e;if(this.storageV5=tZ(e.storageV5),e.launchIdentity!==void 0){this.minLevel=e.launchIdentity.minLevel,this.filter=e.launchIdentity.filter,this.toStderr=e.launchIdentity.toStderr,this.filePath=e.launchIdentity.filePath,this.debugFromLaunch=e.launchIdentity.debugFromLaunch;return}let t=Array.isArray(e.argv)?e.argv:[],r=t.indexOf("--"),i=r===-1?t:t.slice(0,r),n=e.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();this.minLevel=n&&YW(n)?n:"debug";let o=i.find((d)=>d.startsWith("--debug="));this.filter=o?RI(o.substring(8)):null,this.toStderr=i.includes("--debug-to-stderr")||i.includes("-d2e");let s=null;for(let d=0;d<i.length;d++){let h=i[d];if(h.startsWith("--debug-file=")){s=KI(h.substring(13));break}if(h==="--debug-file"&&d+1<i.length){s=KI(i[d+1]);break}}this.filePath=s,this.debugFromLaunch=$a(e.env.DEBUG)||$a(e.env.DEBUG_SDK)||i.includes("--debug")||i.includes("-d")||this.toStderr||o!==void 0||this.filePath!==null}isDebugMode(){return this.runtimeDebugEnabled||this.debugFromLaunch}drainsSyncAtExit(){return!(so()&&this.storageV5!==void 0&&this.deps.syncExitDrain===!1)}launchIdentity(){return{minLevel:this.minLevel,filter:this.filter,toStderr:this.toStderr,filePath:this.filePath,debugFromLaunch:this.debugFromLaunch,isAnt:this.deps.isAnt,isTestEnvironment:this.deps.isTestEnvironment}}enableDebugLogging(){let e=this.isDebugMode()||this.deps.isAnt;return this.runtimeDebugEnabled=!0,e}logPath(){return this.filePath??(this.overrideDirectory!==null&&this.overrideDirectory===this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR?Qt(this.overrideDirectory,`${this.deps.sessionId()}.txt`):null)??this.resolvedLogPath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??this.defaultLogPath()}defaultLogPath(e=this.deps.sessionId()){return Qt(this.deps.configHomeDir(),"debug",`${e}.txt`)}learnedOverrideDirectory(){return this.overrideDirectory}isArmed(){return this.storageV5!==void 0}log(e,{level:t}={level:"debug"}){if(A1[t]<A1[this.minLevel])return;if(!this.shouldLog(e))return;let r=jI(e.trim());if(r.includes(`
88
88
  `))r=Rn(r);let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${r}
89
89
  `;if(this.toStderr){this.deps.writeToStderr(n);return}this.write(n)}write(e){let t=this.getWriter(),r=QW;if(this.storageV5!==void 0){if(r={sessionId:this.deps.sessionId(),fromBackend:g1.getStore()===!0},r.fromBackend)this.backendLinesLogged++}if(t.write({origin:r,content:e}),this.exiting)t.flush()}async flush(){let e=this.backendLinesLogged;if(this.writer?.flush(),await this.pendingWrite,this.storageV5!==void 0&&this.successor)return this.successor.flush();for(let t=0;this.backendLinesLogged!==e&&t<3;t++)e=this.backendLinesLogged,this.writer?.flush(),await this.pendingWrite}dispose(e){this.redirect=e;try{this.writer?.dispose()}finally{this.redirect=null,this.writer=null}}succeed(e){this.runtimeDebugEnabled=e.runtimeDebugEnabled,this.hasFormattedOutput=e.hasFormattedOutput,this.pendingWrite=e.pendingWrite,this.unflushedChunks=e.unflushedChunks,this.exitHandlerRegistered=e.exitHandlerRegistered,e.successor=this,e.dispose((t)=>{this.write(t)})}handleExit(){if(this.successor){this.successor.handleExit();return}this.exiting=!0,this.writer?.flush(),this.drainSync()}async maybeRotate(e,t,r=XW){let i=so()&&this.storageV5!==void 0?this.storageV5.hostFiles:void 0;if(this.writtenBytes<0)if(i){let n=await i.stat(T1(e));this.writtenBytes=n.ok&&n.value.kind!=="absent"?n.value.size:0}else this.writtenBytes=await GW(e).then((n)=>n.size).catch(()=>0);else this.writtenBytes+=t;if(this.writtenBytes<=r||this.rotating)return;this.rotating=!0;try{let n=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;if(i){let o=T1(e),s=T1(n),d=await i.rename(o,s);if(!d.ok&&!eZ(d.error)){if(await i.delete(s,{missingOk:!0}),!(await i.rename(o,s)).ok)await i.delete(o,{missingOk:!0})}}else try{await HI(e,n)}catch(o){if(!Zp(o))await E1(n).catch(()=>{}),await HI(e,n).catch(()=>E1(e).catch(()=>{}))}this.writtenBytes=0}finally{this.rotating=!1}}shouldLog(e){if(this.deps.isTestEnvironment&&!this.toStderr&&this.filePath===null)return!1;if(!this.deps.isAnt&&!this.isDebugMode())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;return PI(e,this.filter)}resolveDirToFile(e){return this.resolvedLogPath=Qt(e,`${this.deps.sessionId()}.txt`),this.resolvedLogPath}async appendGroup(e,t,r,i){if(this.storageV5!==void 0&&e.arm==="v5"){await this.appendV5AndMark(this.storageV5,t,r);return}if(i)await qI(rn(e.target),{recursive:!0}).catch(()=>{});let n=e;try{await M1(e.target,r)}catch(o){if(!G_(o))throw o;if(this.storageV5===void 0)n={...e,target:this.resolveDirToFile(e.target)},await M1(n.target,r);else{if(this.overrideDirectory=e.target,n=ZI(t,e.configHome,e.target,e.target),n.arm==="v5"){await this.appendV5AndMark(this.storageV5,t,r);return}await qI(rn(n.target),{recursive:!0}).catch(()=>{});try{await M1(n.target,r)}catch{return}}}if(n.rotate){if(this.storageV5!==void 0&&n.target!==this.rotationTarget)this.rotationTarget=n.target,this.writtenBytes=-1;await this.maybeRotate(n.target,Buffer.byteLength(r)).catch(WI)}if(n.pointLatest)this.markLatestSymlink()}async appendV5AndMark(e,t,r){let i=so(),n=i&&!this.latestMarked&&!this.latestRefused,o=await VI(e,t.sessionId,r,n);if(o==="refused")this.latestRefused=!0,o=await VI(e,t.sessionId,r,!1),this.log("debug log: the storage backend refused markLatest; <debug folder>/latest is not pointed in this process",{level:"warn"});if(o!=="landed")return;if(n&&!this.latestRefused)this.latestMarked=!0;else if(!i)this.markLatestSymlink()}markLatestSymlink(){if(!this.latestMarked)this.latestMarked=!0,this.updateLatestSymlink()}shiftUnflushedChunk(){this.unflushedChunks.shift()}drainSync(){if(this.unflushedChunks.length===0)return;if(!this.drainsSyncAtExit()){this.unflushedChunks.length=0;return}let e=[];for(let t of this.unflushedChunks.splice(0)){let r=e.at(-1);if(r!==void 0&&r.armed===t.armed&&(!t.armed||r.target===t.target))r.parts.push(t);else e.push({target:t.target,armed:t.armed,parts:[t]})}for(let{target:t,armed:r,parts:i}of e){let n=r?t:this.logPath(),o=i.map((s)=>s.content).join("");try{rd().mkdirSync(rn(n))}catch{}try{rd().appendFileSync(n,o)}catch(s){if(G_(s))try{if(!r)rd().appendFileSync(this.resolveDirToFile(n),o);else{let d=(v,g)=>{try{rd().appendFileSync(Qt(n,`${v}.txt`),g)}catch{}},h=i[0]?.sessionId,m="";for(let v of i){if(v.sessionId!==h)d(h,m),h=v.sessionId,m="";m+=v.content}d(h,m)}}catch{}}}}groupLines(e){let t=e[0];if(t===void 0)return[];if(this.storageV5===void 0)return[{decision:{target:this.logPath(),arm:"raw",configHome:"",rotate:!0,pointLatest:!0},origin:t.origin,lines:e}];let r=[];for(let i of e){let n=r.at(-1);if(n!==void 0&&n.origin.sessionId===i.origin.sessionId&&n.origin.fromBackend===i.origin.fromBackend)n.lines.push(i);else r.push({decision:ZI(i.origin,this.deps.configHomeDir(),this.filePath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??null,this.overrideDirectory),origin:i.origin,lines:[i]})}return r}getWriter(){if(this.writer)return this.writer;let e=null,t=this.storageV5!==void 0;if(this.writer=kI({writeBatch:(r)=>{if(this.redirect){this.redirect(r.map((i)=>i.content).join(""));return}if(this.exiting){for(let i of this.groupLines(r))this.unflushedChunks.push({target:i.decision.target,sessionId:i.origin.sessionId,armed:t,content:i.lines.map((n)=>n.content).join("")});this.drainSync();return}for(let i of this.groupLines(r)){let n=i.lines.map((d)=>d.content).join(""),o=rn(i.decision.target),s=i.decision.arm==="raw"&&(i.origin.fromBackend||e!==o);if(i.decision.arm==="raw")e=o;this.unflushedChunks.push({target:i.decision.target,sessionId:i.origin.sessionId,armed:t,content:n}),this.pendingWrite=this.pendingWrite.then(this.appendGroup.bind(this,i.decision,i.origin,n,s)).catch(WI).then(this.shiftUnflushedChunk.bind(this))}},sizeOf:(r)=>r.content.length,flushIntervalMs:1000,maxBufferSize:100,immediateMode:this.isDebugMode()}),this.deps.registerCleanup(async()=>{this.writer?.dispose(),await this.pendingWrite}),!this.exitHandlerRegistered)this.exitHandlerRegistered=!0,this.deps.onExit(this.handleExit.bind(this));return this.writer}async updateLatestSymlink(){try{let e=this.logPath(),t=Qt(rn(e),"latest");await E1(t).catch(()=>{}),await JW(e,t)}catch{}}}class JI{instance=void 0;init={};setInstance(e){this.instance=e}setInit(e){this.init=e}}var rZ=new di(()=>new JI);function nZ(){return cl(rZ)}function iZ(e,t){return new GI({argv:process.argv,env:process.env,sessionId:()=>SI(),configHomeDir:()=>v1(),onExit:(r)=>{process.on("exit",r)},registerCleanup:(r)=>{EI(r)},writeToStderr:(r)=>{OI(r)},isAnt:t?.isAnt??!1,isTestEnvironment:t?.isTestEnvironment??!1,launchIdentity:t,storageV5:e.init.storageV5!==void 0&&e.init.configHome===v1()?e.init.storageV5:void 0,syncExitDrain:e.init.syncExitDrain})}function oZ(){let e=nZ(),t=e.instance;if(t)return t;let r=iZ(e);return e.setInstance(r),r}function $r(e,t={level:"debug"}){oZ().log(e,t)}var Kke=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var sZ={[Symbol.dispose](){}};function aZ(){return sZ}var sn=aZ;function Rn(e,t,r){let n=[];try{const i=qr(n,sn`JSON.stringify(${XI(e)})`,0);return JSON.stringify(e,t,r)}catch(o){var s=o,d=1}finally{Hr(n,s,d)}}var Ui=(e,t)=>{let i=[];try{const r=qr(i,sn`JSON.parse(${XI(e)})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var o=n,s=1}finally{Hr(i,o,s)}};function XI(e){return typeof e==="string"?e.length:e}class Hs{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}get ended(){return this.isDone}[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((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}var lZ=1000;function uZ(){return{eventQueue:[],sink:null,droppedEventCount:0}}function cZ(e,t){if(e.eventQueue.length>=lZ)e.eventQueue.shift(),e.droppedEventCount++;e.eventQueue.push(t)}class YI{state=uZ()}var dZ=new di(()=>new YI);function fZ(){return cl(dZ)}function nd(e,t){let r=fZ().state;if(r.sink===null){cZ(r,{eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function hZ(e,t){nd("tengu_feature_ok",{feature_name:ed(e),...t})}function pZ(e,t,r){nd("tengu_feature_bad",{...r,feature_name:ed(e),error_code:oI(t)})}async function mn(e,t,r){try{let i=await t();return hZ(e),i}catch(i){throw pZ(e,r?.(i)??"error"),i}}function QI(e){return"method"in e&&"id"in e&&e.id!==null}var s2e=Object.freeze({}),a2e=Object.freeze({name:"claude-code",title:"Claude Code",description:"Anthropic's agentic coding tool",websiteUrl:"https://claude.com/claude-code"}),l2e=Symbol("swallow");class R1{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}function id(e){return typeof e==="number"&&Number.isInteger(e)&&e>0?e:void 0}var od=Symbol("suppressControlResponse");class Qp{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;unmatchedControlResponses=new Map;static UNMATCHED_CONTROL_RESPONSES_MAX=1024;cleanupPerformed=!1;sdkMessages;inputStream=new Hs;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpServers=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;latestCommands;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:Mu(),session_id:e.sessionId};this.inputStream.enqueue(r)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpServers.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0||this.workSecretAnswerer!==void 0}remoteControlCallGeneration=0;workSecretAnswerer;constructor(e,t,r,i,n,o=new Map,s,d,h,m,v,g){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=i;this.abortController=n;this.jsonSchema=s;this.initConfig=d;this.onElicitation=h;this.getOAuthToken=m;this.getHostAuthToken=v;this.onUserDialog=g;for(let[S,x]of o)this.connectSdkMcpServer(S,x);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear(),this.unmatchedControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let{transport:r}of this.sdkMcpServers.values())r.close().catch(()=>{});if(this.sdkMcpServers.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),ma(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);else{if(this.unmatchedControlResponses.size>=Qp.UNMATCHED_CONTROL_RESPONSES_MAX){let r=this.unmatchedControlResponses.keys().next().value;if(r!==void 0)this.unmatchedControlResponses.delete(r)}this.unmatchedControlResponses.set(e.response.request_id,e.response)}continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&e.subtype==="commands_changed"&&Array.isArray(e.commands))this.latestCommands=e.commands;if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="active_goal"){this.inputStream.enqueue(e);continue}if(e.type==="autocompact_state"){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();let t=e.is_error?e.subtype==="success"?e.result:e.errors.map((r)=>r.trim()).filter(Boolean).join("; "):void 0;if(this.lastErrorResultText=t||void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)$r("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof li)&&e?.name!=="SSEHttpError"){let t=V_(Error(`Claude Code returned an error result: ${this.lastErrorResultText}`),{telemetryMessage:"Claude Code returned an error result",errorClass:"error_result"});$r(`[Query.readMessages] Replacing exit error with result text. Original: ${Wp(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){$r(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(r===od)return;let i={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(Rn(i)+`
90
90
  `))}catch(r){if(this.cleanupPerformed)return;let i={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Wp(r)}};try{await Promise.resolve(this.transport.write(Rn(i)+`