@sunerpy/kiro-provider 3.2.4 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -54,7 +54,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
54
54
|
missingProperty: ${N},
|
|
55
55
|
depsCount: ${G},
|
|
56
56
|
deps: ${C}}`};var CQI={keyword:"dependencies",type:"object",schemaType:"object",error:dK.error,code(I){let[G,C]=NQI(I);XK(I,G),RK(I,C)}};function NQI({schema:I}){let G={},C={};for(let N in I){if(N==="__proto__")continue;let Y=Array.isArray(I[N])?G:C;Y[N]=I[N]}return[G,C]}function XK(I,G=I.schema){let{gen:C,data:N,it:Y}=I;if(Object.keys(G).length===0)return;let Z=C.let("missing");for(let b in G){let W=G[b];if(W.length===0)continue;let l=(0,W0.propertyInData)(C,N,b,Y.opts.ownProperties);if(I.setParams({property:b,depsCount:W.length,deps:W.join(", ")}),Y.allErrors)C.if(l,()=>{for(let Q of W)(0,W0.checkReportMissingProp)(I,Q)});else C.if(ld._`${l} && (${(0,W0.checkMissingProp)(I,W,Z)})`),(0,W0.reportMissingProp)(I,Z),C.else()}}dK.validatePropertyDeps=XK;function RK(I,G=I.schema){let{gen:C,data:N,keyword:Y,it:Z}=I,b=C.name("valid");for(let W in G){if((0,GQI.alwaysValidSchema)(Z,G[W]))continue;C.if((0,W0.propertyInData)(C,N,W,Z.opts.ownProperties),()=>{let l=I.subschema({keyword:Y,schemaProp:W},b);I.mergeValidEvaluated(l,b)},()=>C.var(b,!0)),I.ok(b)}}dK.validateSchemaDeps=RK;dK.default=CQI});var OK=p((wK)=>{Object.defineProperty(wK,"__esModule",{value:!0});var HK=LI(),bQI=cI(),WQI={message:"property name must be valid",params:({params:I})=>HK._`{propertyName: ${I.propertyName}}`},lQI={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:WQI,code(I){let{gen:G,schema:C,data:N,it:Y}=I;if((0,bQI.alwaysValidSchema)(Y,C))return;let Z=G.name("valid");G.forIn("key",N,(b)=>{I.setParams({propertyName:b}),I.subschema({keyword:"propertyNames",data:b,dataTypes:["string"],propertyName:b,compositeRule:!0},Z),G.if((0,HK.not)(Z),()=>{if(I.error(!0),!Y.allErrors)G.break()})}),I.ok(Z)}};wK.default=lQI});var Qd=p((FK)=>{Object.defineProperty(FK,"__esModule",{value:!0});var kL=HC(),sC=LI(),LQI=cC(),EL=cI(),mQI={message:"must NOT have additional properties",params:({params:I})=>sC._`{additionalProperty: ${I.additionalProperty}}`},VQI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mQI,code(I){let{gen:G,schema:C,parentSchema:N,data:Y,errsCount:Z,it:b}=I;if(!Z)throw Error("ajv implementation error");let{allErrors:W,opts:l}=b;if(b.props=!0,l.removeAdditional!=="all"&&(0,EL.alwaysValidSchema)(b,C))return;let Q=(0,kL.allSchemaProperties)(N.properties),L=(0,kL.allSchemaProperties)(N.patternProperties);m(),I.ok(sC._`${Z} === ${LQI.default.errors}`);function m(){G.forIn("key",Y,(c)=>{if(!Q.length&&!L.length)R(c);else G.if(X(c),()=>R(c))})}function X(c){let H;if(Q.length>8){let w=(0,EL.schemaRefOrVal)(b,N.properties,"properties");H=(0,kL.isOwnProperty)(G,w,c)}else if(Q.length)H=(0,sC.or)(...Q.map((w)=>sC._`${c} === ${w}`));else H=sC.nil;if(L.length)H=(0,sC.or)(H,...L.map((w)=>sC._`${(0,kL.usePattern)(I,w)}.test(${c})`));return(0,sC.not)(H)}function V(c){G.code(sC._`delete ${Y}[${c}]`)}function R(c){if(l.removeAdditional==="all"||l.removeAdditional&&C===!1){V(c);return}if(C===!1){if(I.setParams({additionalProperty:c}),I.error(),!W)G.break();return}if(typeof C=="object"&&!(0,EL.alwaysValidSchema)(b,C)){let H=G.name("valid");if(l.removeAdditional==="failing")d(c,H,!1),G.if((0,sC.not)(H),()=>{I.reset(),V(c)});else if(d(c,H),!W)G.if((0,sC.not)(H),()=>G.break())}}function d(c,H,w){let v={keyword:"additionalProperties",dataProp:c,dataPropType:EL.Type.Str};if(w===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(v,H)}}};FK.default=VQI});var AK=p((gK)=>{Object.defineProperty(gK,"__esModule",{value:!0});var RQI=FZ(),uK=HC(),Ld=cI(),vK=Qd(),dQI={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:G,schema:C,parentSchema:N,data:Y,it:Z}=I;if(Z.opts.removeAdditional==="all"&&N.additionalProperties===void 0)vK.default.code(new RQI.KeywordCxt(Z,vK.default,"additionalProperties"));let b=(0,uK.allSchemaProperties)(C);for(let m of b)Z.definedProperties.add(m);if(Z.opts.unevaluated&&b.length&&Z.props!==!0)Z.props=Ld.mergeEvaluated.props(G,(0,Ld.toHash)(b),Z.props);let W=b.filter((m)=>!(0,Ld.alwaysValidSchema)(Z,C[m]));if(W.length===0)return;let l=G.name("valid");for(let m of W){if(Q(m))L(m);else{if(G.if((0,uK.propertyInData)(G,Y,m,Z.opts.ownProperties)),L(m),!Z.allErrors)G.else().var(l,!0);G.endIf()}I.it.definedProperties.add(m),I.ok(l)}function Q(m){return Z.opts.useDefaults&&!Z.compositeRule&&C[m].default!==void 0}function L(m){I.subschema({keyword:"properties",schemaProp:m,dataProp:m},l)}}};gK.default=dQI});var kK=p((yK)=>{Object.defineProperty(yK,"__esModule",{value:!0});var JK=HC(),zL=LI(),pK=cI(),KK=cI(),cQI={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:G,schema:C,data:N,parentSchema:Y,it:Z}=I,{opts:b}=Z,W=(0,JK.allSchemaProperties)(C),l=W.filter((d)=>(0,pK.alwaysValidSchema)(Z,C[d]));if(W.length===0||l.length===W.length&&(!Z.opts.unevaluated||Z.props===!0))return;let Q=b.strictSchema&&!b.allowMatchingProperties&&Y.properties,L=G.name("valid");if(Z.props!==!0&&!(Z.props instanceof zL.Name))Z.props=(0,KK.evaluatedPropsToName)(G,Z.props);let{props:m}=Z;X();function X(){for(let d of W){if(Q)V(d);if(Z.allErrors)R(d);else G.var(L,!0),R(d),G.if(L)}}function V(d){for(let c in Q)if(new RegExp(d).test(c))(0,pK.checkStrictMode)(Z,`property ${c} matches pattern ${d} (use allowMatchingProperties)`)}function R(d){G.forIn("key",N,(c)=>{G.if(zL._`${(0,JK.usePattern)(I,d)}.test(${c})`,()=>{let H=l.includes(d);if(!H)I.subschema({keyword:"patternProperties",schemaProp:d,dataProp:c,dataPropType:KK.Type.Str},L);if(Z.opts.unevaluated&&m!==!0)G.assign(zL._`${m}[${c}]`,!0);else if(!H&&!Z.allErrors)G.if((0,zL.not)(L),()=>G.break())})})}}};yK.default=cQI});var zK=p((EK)=>{Object.defineProperty(EK,"__esModule",{value:!0});var wQI=cI(),OQI={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(I){let{gen:G,schema:C,it:N}=I;if((0,wQI.alwaysValidSchema)(N,C)){I.fail();return}let Y=G.name("valid");I.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},Y),I.failResult(Y,()=>I.reset(),()=>I.error())},error:{message:"must NOT be valid"}};EK.default=OQI});var DK=p((aK)=>{Object.defineProperty(aK,"__esModule",{value:!0});var uQI=HC(),vQI={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uQI.validateUnion,error:{message:"must match a schema in anyOf"}};aK.default=vQI});var UK=p((qK)=>{Object.defineProperty(qK,"__esModule",{value:!0});var aL=LI(),AQI=cI(),JQI={message:"must match exactly one schema in oneOf",params:({params:I})=>aL._`{passingSchemas: ${I.passing}}`},pQI={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:JQI,code(I){let{gen:G,schema:C,parentSchema:N,it:Y}=I;if(!Array.isArray(C))throw Error("ajv implementation error");if(Y.opts.discriminator&&N.discriminator)return;let Z=C,b=G.let("valid",!1),W=G.let("passing",null),l=G.name("_valid");I.setParams({passing:W}),G.block(Q),I.result(b,()=>I.reset(),()=>I.error(!0));function Q(){Z.forEach((L,m)=>{let X;if((0,AQI.alwaysValidSchema)(Y,L))G.var(l,!0);else X=I.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},l);if(m>0)G.if(aL._`${l} && ${b}`).assign(b,!1).assign(W,aL._`[${W}, ${m}]`).else();G.if(l,()=>{if(G.assign(b,!0),G.assign(W,m),X)I.mergeEvaluated(X,aL.Name)})})}}};qK.default=pQI});var BK=p((jK)=>{Object.defineProperty(jK,"__esModule",{value:!0});var yQI=cI(),kQI={keyword:"allOf",schemaType:"array",code(I){let{gen:G,schema:C,it:N}=I;if(!Array.isArray(C))throw Error("ajv implementation error");let Y=G.name("valid");C.forEach((Z,b)=>{if((0,yQI.alwaysValidSchema)(N,Z))return;let W=I.subschema({keyword:"allOf",schemaProp:b},Y);I.ok(Y),I.mergeEvaluated(W)})}};jK.default=kQI});var SK=p((MK)=>{Object.defineProperty(MK,"__esModule",{value:!0});var DL=LI(),xK=cI(),zQI={message:({params:I})=>DL.str`must match "${I.ifClause}" schema`,params:({params:I})=>DL._`{failingKeyword: ${I.ifClause}}`},aQI={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:zQI,code(I){let{gen:G,parentSchema:C,it:N}=I;if(C.then===void 0&&C.else===void 0)(0,xK.checkStrictMode)(N,'"if" without "then" and "else" is ignored');let Y=nK(N,"then"),Z=nK(N,"else");if(!Y&&!Z)return;let b=G.let("valid",!0),W=G.name("_valid");if(l(),I.reset(),Y&&Z){let L=G.let("ifClause");I.setParams({ifClause:L}),G.if(W,Q("then",L),Q("else",L))}else if(Y)G.if(W,Q("then"));else G.if((0,DL.not)(W),Q("else"));I.pass(b,()=>I.error(!0));function l(){let L=I.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},W);I.mergeEvaluated(L)}function Q(L,m){return()=>{let X=I.subschema({keyword:L},W);if(G.assign(b,W),I.mergeValidEvaluated(X,b),m)G.assign(m,DL._`${L}`);else I.setParams({ifClause:L})}}}};function nK(I,G){let C=I.schema[G];return C!==void 0&&!(0,xK.alwaysValidSchema)(I,C)}MK.default=aQI});var iK=p((sK)=>{Object.defineProperty(sK,"__esModule",{value:!0});var qQI=cI(),UQI={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:I,parentSchema:G,it:C}){if(G.if===void 0)(0,qQI.checkStrictMode)(C,`"${I}" without "if" is ignored`)}};sK.default=UQI});var md=p((TK)=>{Object.defineProperty(TK,"__esModule",{value:!0});var BQI=bd(),nQI=WK(),xQI=Wd(),MQI=LK(),SQI=VK(),sQI=yL(),iQI=OK(),TQI=Qd(),PQI=AK(),tQI=kK(),fQI=zK(),$QI=DK(),_QI=UK(),oQI=BK(),rQI=SK(),eQI=iK();function ILI(I=!1){let G=[fQI.default,$QI.default,_QI.default,oQI.default,rQI.default,eQI.default,iQI.default,TQI.default,sQI.default,PQI.default,tQI.default];if(I)G.push(nQI.default,MQI.default);else G.push(BQI.default,xQI.default);return G.push(SQI.default),G}TK.default=ILI});var tK=p((PK)=>{Object.defineProperty(PK,"__esModule",{value:!0});var oI=LI(),CLI={message:({schemaCode:I})=>oI.str`must match format "${I}"`,params:({schemaCode:I})=>oI._`{format: ${I}}`},NLI={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:CLI,code(I,G){let{gen:C,data:N,$data:Y,schema:Z,schemaCode:b,it:W}=I,{opts:l,errSchemaPath:Q,schemaEnv:L,self:m}=W;if(!l.validateFormats)return;if(Y)X();else V();function X(){let R=C.scopeValue("formats",{ref:m.formats,code:l.code.formats}),d=C.const("fDef",oI._`${R}[${b}]`),c=C.let("fType"),H=C.let("format");C.if(oI._`typeof ${d} == "object" && !(${d} instanceof RegExp)`,()=>C.assign(c,oI._`${d}.type || "string"`).assign(H,oI._`${d}.validate`),()=>C.assign(c,oI._`"string"`).assign(H,d)),I.fail$data((0,oI.or)(w(),v()));function w(){if(l.strictSchema===!1)return oI.nil;return oI._`${b} && !${H}`}function v(){let u=L.$async?oI._`(${d}.async ? await ${H}(${N}) : ${H}(${N}))`:oI._`${H}(${N})`,O=oI._`(typeof ${H} == "function" ? ${u} : ${H}.test(${N}))`;return oI._`${H} && ${H} !== true && ${c} === ${G} && !${O}`}}function V(){let R=m.formats[Z];if(!R){w();return}if(R===!0)return;let[d,c,H]=v(R);if(d===G)I.pass(u());function w(){if(l.strictSchema===!1){m.logger.warn(O());return}throw Error(O());function O(){return`unknown format "${Z}" ignored in schema at path "${Q}"`}}function v(O){let g=O instanceof RegExp?(0,oI.regexpCode)(O):l.code.formats?oI._`${l.code.formats}${(0,oI.getProperty)(Z)}`:void 0,F=C.scopeValue("formats",{key:Z,ref:O,code:g});if(typeof O=="object"&&!(O instanceof RegExp))return[O.type||"string",O.validate,oI._`${F}.validate`];return["string",O,F]}function u(){if(typeof R=="object"&&!(R instanceof RegExp)&&R.async){if(!L.$async)throw Error("async format in sync schema");return oI._`await ${H}(${N})`}return typeof c=="function"?oI._`${H}(${N})`:oI._`${H}.test(${N})`}}}};PK.default=NLI});var Vd=p((fK)=>{Object.defineProperty(fK,"__esModule",{value:!0});var ZLI=tK(),bLI=[ZLI.default];fK.default=bLI});var Xd=p(($K)=>{Object.defineProperty($K,"__esModule",{value:!0});$K.contentVocabulary=$K.metadataVocabulary=void 0;$K.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];$K.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Rd=p((rK)=>{Object.defineProperty(rK,"__esModule",{value:!0});var QLI=Gd(),LLI=Yd(),mLI=md(),VLI=Vd(),oK=Xd(),XLI=[QLI.default,LLI.default,(0,mLI.default)(),VLI.default,oK.metadataVocabulary,oK.contentVocabulary];rK.default=XLI});var Cy=p((Iy)=>{Object.defineProperty(Iy,"__esModule",{value:!0});Iy.DiscrError=void 0;var eK;(function(I){I.Tag="tag",I.Mapping="mapping"})(eK||(Iy.DiscrError=eK={}))});var qL=p((Yy)=>{Object.defineProperty(Yy,"__esModule",{value:!0});var rb=LI(),dd=Cy(),Ny=_l(),dLI=uZ(),hLI=cI(),cLI={message:({params:{discrError:I,tagName:G}})=>I===dd.DiscrError.Tag?`tag "${G}" must be string`:`value of tag "${G}" must be in oneOf`,params:({params:{discrError:I,tag:G,tagName:C}})=>rb._`{error: ${I}, tag: ${C}, tagValue: ${G}}`},HLI={keyword:"discriminator",type:"object",schemaType:"object",error:cLI,code(I){let{gen:G,data:C,schema:N,parentSchema:Y,it:Z}=I,{oneOf:b}=Y;if(!Z.opts.discriminator)throw Error("discriminator: requires discriminator option");let W=N.propertyName;if(typeof W!="string")throw Error("discriminator: requires propertyName");if(N.mapping)throw Error("discriminator: mapping is not supported");if(!b)throw Error("discriminator: requires oneOf keyword");let l=G.let("valid",!1),Q=G.const("tag",rb._`${C}${(0,rb.getProperty)(W)}`);G.if(rb._`typeof ${Q} == "string"`,()=>L(),()=>I.error(!1,{discrError:dd.DiscrError.Tag,tag:Q,tagName:W})),I.ok(l);function L(){let V=X();G.if(!1);for(let R in V)G.elseIf(rb._`${Q} === ${R}`),G.assign(l,m(V[R]));G.else(),I.error(!1,{discrError:dd.DiscrError.Mapping,tag:Q,tagName:W}),G.endIf()}function m(V){let R=G.name("valid"),d=I.subschema({keyword:"oneOf",schemaProp:V},R);return I.mergeEvaluated(d,rb.Name),R}function X(){var V;let R={},d=H(Y),c=!0;for(let u=0;u<b.length;u++){let O=b[u];if((O===null||O===void 0?void 0:O.$ref)&&!(0,hLI.schemaHasRulesButRef)(O,Z.self.RULES)){let F=O.$ref;if(O=Ny.resolveRef.call(Z.self,Z.schemaEnv.root,Z.baseId,F),O instanceof Ny.SchemaEnv)O=O.schema;if(O===void 0)throw new dLI.default(Z.opts.uriResolver,Z.baseId,F)}let g=(V=O===null||O===void 0?void 0:O.properties)===null||V===void 0?void 0:V[W];if(typeof g!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${W}"`);c=c&&(d||H(O)),w(g,u)}if(!c)throw Error(`discriminator: "${W}" must be required`);return R;function H({required:u}){return Array.isArray(u)&&u.includes(W)}function w(u,O){if(u.const)v(u.const,O);else if(u.enum)for(let g of u.enum)v(g,O);else throw Error(`discriminator: "properties/${W}" must have "const" or "enum"`)}function v(u,O){if(typeof u!="string"||u in R)throw Error(`discriminator: "${W}" values must be unique strings`);R[u]=O}}}};Yy.default=HLI});var Zy=p((nvI,OLI)=>{OLI.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 Wy=p((fG,hd)=>{Object.defineProperty(fG,"__esModule",{value:!0});fG.MissingRefError=fG.ValidationError=fG.CodeGen=fG.Name=fG.nil=fG.stringify=fG.str=fG._=fG.KeywordCxt=fG.Ajv=void 0;var FLI=OL(),uLI=Rd(),vLI=qL(),by=Zy(),gLI=["/properties"],UL="http://json-schema.org/draft-07/schema";class l0 extends FLI.default{_addVocabularies(){if(super._addVocabularies(),uLI.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(vLI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(by,gLI):by;this.addMetaSchema(I,UL,!1),this.refs["http://json-schema.org/schema"]=UL}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(UL)?UL:void 0)}}fG.Ajv=l0;hd.exports=fG=l0;hd.exports.Ajv=l0;Object.defineProperty(fG,"__esModule",{value:!0});fG.default=l0;var ALI=FZ();Object.defineProperty(fG,"KeywordCxt",{enumerable:!0,get:function(){return ALI.KeywordCxt}});var eb=LI();Object.defineProperty(fG,"_",{enumerable:!0,get:function(){return eb._}});Object.defineProperty(fG,"str",{enumerable:!0,get:function(){return eb.str}});Object.defineProperty(fG,"stringify",{enumerable:!0,get:function(){return eb.stringify}});Object.defineProperty(fG,"nil",{enumerable:!0,get:function(){return eb.nil}});Object.defineProperty(fG,"Name",{enumerable:!0,get:function(){return eb.Name}});Object.defineProperty(fG,"CodeGen",{enumerable:!0,get:function(){return eb.CodeGen}});var JLI=fb();Object.defineProperty(fG,"ValidationError",{enumerable:!0,get:function(){return JLI.default}});var pLI=uZ();Object.defineProperty(fG,"MissingRefError",{enumerable:!0,get:function(){return pLI.default}})});var Hd=p((Ly)=>{Object.defineProperty(Ly,"__esModule",{value:!0});Ly.dynamicAnchor=void 0;var cd=LI(),kLI=cC(),ly=_l(),ELI=vL(),zLI={keyword:"$dynamicAnchor",schemaType:"string",code:(I)=>Qy(I,I.schema)};function Qy(I,G){let{gen:C,it:N}=I;N.schemaEnv.root.dynamicAnchors[G]=!0;let Y=cd._`${kLI.default.dynamicAnchors}${(0,cd.getProperty)(G)}`,Z=N.errSchemaPath==="#"?N.validateName:aLI(I);C.if(cd._`!${Y}`,()=>C.assign(Y,Z))}Ly.dynamicAnchor=Qy;function aLI(I){let{schemaEnv:G,schema:C,self:N}=I.it,{root:Y,baseId:Z,localRefs:b,meta:W}=G.root,{schemaId:l}=N.opts,Q=new ly.SchemaEnv({schema:C,schemaId:l,root:Y,baseId:Z,localRefs:b,meta:W});return ly.compileSchema.call(N,Q),(0,ELI.getValidate)(I,Q)}Ly.default=zLI});var wd=p((dy)=>{Object.defineProperty(dy,"__esModule",{value:!0});dy.dynamicRef=void 0;var Vy=LI(),qLI=cC(),Xy=vL(),ULI={keyword:"$dynamicRef",schemaType:"string",code:(I)=>Ry(I,I.schema)};function Ry(I,G){let{gen:C,keyword:N,it:Y}=I;if(G[0]!=="#")throw Error(`"${N}" only supports hash fragment reference`);let Z=G.slice(1);if(Y.allErrors)b();else{let l=C.let("valid",!1);b(l),I.ok(l)}function b(l){if(Y.schemaEnv.root.dynamicAnchors[Z]){let Q=C.let("_v",Vy._`${qLI.default.dynamicAnchors}${(0,Vy.getProperty)(Z)}`);C.if(Q,W(Q,l),W(Y.validateName,l))}else W(Y.validateName,l)()}function W(l,Q){return Q?()=>C.block(()=>{(0,Xy.callRef)(I,l),C.let(Q,!0)}):()=>(0,Xy.callRef)(I,l)}}dy.dynamicRef=Ry;dy.default=ULI});var Hy=p((cy)=>{Object.defineProperty(cy,"__esModule",{value:!0});var BLI=Hd(),nLI=cI(),xLI={keyword:"$recursiveAnchor",schemaType:"boolean",code(I){if(I.schema)(0,BLI.dynamicAnchor)(I,"");else(0,nLI.checkStrictMode)(I.it,"$recursiveAnchor: false is ignored")}};cy.default=xLI});var Oy=p((wy)=>{Object.defineProperty(wy,"__esModule",{value:!0});var SLI=wd(),sLI={keyword:"$recursiveRef",schemaType:"string",code:(I)=>(0,SLI.dynamicRef)(I,I.schema)};wy.default=sLI});var Od=p((Fy)=>{Object.defineProperty(Fy,"__esModule",{value:!0});var TLI=Hd(),PLI=wd(),tLI=Hy(),fLI=Oy(),$LI=[TLI.default,PLI.default,tLI.default,fLI.default];Fy.default=$LI});var gy=p((vy)=>{Object.defineProperty(vy,"__esModule",{value:!0});var uy=yL(),oLI={keyword:"dependentRequired",type:"object",schemaType:"object",error:uy.error,code:(I)=>(0,uy.validatePropertyDeps)(I)};vy.default=oLI});var Jy=p((Ay)=>{Object.defineProperty(Ay,"__esModule",{value:!0});var eLI=yL(),I2I={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(I)=>(0,eLI.validateSchemaDeps)(I)};Ay.default=I2I});var Ky=p((py)=>{Object.defineProperty(py,"__esModule",{value:!0});var C2I=cI(),N2I={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:I,parentSchema:G,it:C}){if(G.contains===void 0)(0,C2I.checkStrictMode)(C,`"${I}" without "contains" is ignored`)}};py.default=N2I});var Fd=p((yy)=>{Object.defineProperty(yy,"__esModule",{value:!0});var Z2I=gy(),b2I=Jy(),W2I=Ky(),l2I=[Z2I.default,b2I.default,W2I.default];yy.default=l2I});var zy=p((Ey)=>{Object.defineProperty(Ey,"__esModule",{value:!0});var JY=LI(),ky=cI(),L2I=cC(),m2I={message:"must NOT have unevaluated properties",params:({params:I})=>JY._`{unevaluatedProperty: ${I.unevaluatedProperty}}`},V2I={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:m2I,code(I){let{gen:G,schema:C,data:N,errsCount:Y,it:Z}=I;if(!Y)throw Error("ajv implementation error");let{allErrors:b,props:W}=Z;if(W instanceof JY.Name)G.if(JY._`${W} !== true`,()=>G.forIn("key",N,(m)=>G.if(Q(W,m),()=>l(m))));else if(W!==!0)G.forIn("key",N,(m)=>W===void 0?l(m):G.if(L(W,m),()=>l(m)));Z.props=!0,I.ok(JY._`${Y} === ${L2I.default.errors}`);function l(m){if(C===!1){if(I.setParams({unevaluatedProperty:m}),I.error(),!b)G.break();return}if(!(0,ky.alwaysValidSchema)(Z,C)){let X=G.name("valid");if(I.subschema({keyword:"unevaluatedProperties",dataProp:m,dataPropType:ky.Type.Str},X),!b)G.if((0,JY.not)(X),()=>G.break())}}function Q(m,X){return JY._`!${m} || !${m}[${X}]`}function L(m,X){let V=[];for(let R in m)if(m[R]===!0)V.push(JY._`${X} !== ${R}`);return(0,JY.and)(...V)}}};Ey.default=V2I});var qy=p((Dy)=>{Object.defineProperty(Dy,"__esModule",{value:!0});var KZ=LI(),ay=cI(),R2I={message:({params:{len:I}})=>KZ.str`must NOT have more than ${I} items`,params:({params:{len:I}})=>KZ._`{limit: ${I}}`},d2I={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:R2I,code(I){let{gen:G,schema:C,data:N,it:Y}=I,Z=Y.items||0;if(Z===!0)return;let b=G.const("len",KZ._`${N}.length`);if(C===!1)I.setParams({len:Z}),I.fail(KZ._`${b} > ${Z}`);else if(typeof C=="object"&&!(0,ay.alwaysValidSchema)(Y,C)){let l=G.var("valid",KZ._`${b} <= ${Z}`);G.if((0,KZ.not)(l),()=>W(l,Z)),I.ok(l)}Y.items=!0;function W(l,Q){G.forRange("i",Q,b,(L)=>{if(I.subschema({keyword:"unevaluatedItems",dataProp:L,dataPropType:ay.Type.Num},l),!Y.allErrors)G.if((0,KZ.not)(l),()=>G.break())})}}};Dy.default=d2I});var ud=p((Uy)=>{Object.defineProperty(Uy,"__esModule",{value:!0});var c2I=zy(),H2I=qy(),w2I=[c2I.default,H2I.default];Uy.default=w2I});var jy=p((bgI,F2I)=>{F2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}});var By=p((WgI,u2I)=>{u2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}});var ny=p((lgI,v2I)=>{v2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}});var xy=p((QgI,g2I)=>{g2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}});var My=p((LgI,A2I)=>{A2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}});var Sy=p((mgI,J2I)=>{J2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var sy=p((VgI,p2I)=>{p2I.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var Ty=p((iy)=>{Object.defineProperty(iy,"__esModule",{value:!0});var K2I=jy(),y2I=By(),k2I=ny(),E2I=xy(),z2I=My(),a2I=Sy(),D2I=sy(),q2I=["/properties"];function U2I(I){return[K2I,y2I,k2I,E2I,G(this,z2I),a2I,G(this,D2I)].forEach((C)=>this.addMetaSchema(C,void 0,!1)),this;function G(C,N){return I?C.$dataMetaSchema(N,q2I):N}}iy.default=U2I});var Py=p(($G,gd)=>{Object.defineProperty($G,"__esModule",{value:!0});$G.MissingRefError=$G.ValidationError=$G.CodeGen=$G.Name=$G.nil=$G.stringify=$G.str=$G._=$G.KeywordCxt=$G.Ajv2019=void 0;var B2I=OL(),n2I=Rd(),x2I=Od(),M2I=Fd(),S2I=ud(),s2I=qL(),i2I=Ty(),vd="https://json-schema.org/draft/2019-09/schema";class Q0 extends B2I.default{constructor(I={}){super({...I,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(x2I.default),n2I.default.forEach((I)=>this.addVocabulary(I)),this.addVocabulary(M2I.default),this.addVocabulary(S2I.default),this.opts.discriminator)this.addKeyword(s2I.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:I,meta:G}=this.opts;if(!G)return;i2I.default.call(this,I),this.refs["http://json-schema.org/schema"]=vd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(vd)?vd:void 0)}}$G.Ajv2019=Q0;gd.exports=$G=Q0;gd.exports.Ajv2019=Q0;Object.defineProperty($G,"__esModule",{value:!0});$G.default=Q0;var T2I=FZ();Object.defineProperty($G,"KeywordCxt",{enumerable:!0,get:function(){return T2I.KeywordCxt}});var IW=LI();Object.defineProperty($G,"_",{enumerable:!0,get:function(){return IW._}});Object.defineProperty($G,"str",{enumerable:!0,get:function(){return IW.str}});Object.defineProperty($G,"stringify",{enumerable:!0,get:function(){return IW.stringify}});Object.defineProperty($G,"nil",{enumerable:!0,get:function(){return IW.nil}});Object.defineProperty($G,"Name",{enumerable:!0,get:function(){return IW.Name}});Object.defineProperty($G,"CodeGen",{enumerable:!0,get:function(){return IW.CodeGen}});var P2I=fb();Object.defineProperty($G,"ValidationError",{enumerable:!0,get:function(){return P2I.default}});var t2I=uZ();Object.defineProperty($G,"MissingRefError",{enumerable:!0,get:function(){return t2I.default}})});var $y=p((fy)=>{Object.defineProperty(fy,"__esModule",{value:!0});var _2I=Gd(),o2I=Yd(),r2I=md(),e2I=Od(),ImI=Fd(),GmI=ud(),CmI=Vd(),ty=Xd(),NmI=[e2I.default,_2I.default,o2I.default,(0,r2I.default)(!0),CmI.default,ty.metadataVocabulary,ty.contentVocabulary,ImI.default,GmI.default];fy.default=NmI});var _y=p((vgI,ZmI)=>{ZmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var oy=p((ggI,bmI)=>{bmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var ry=p((AgI,WmI)=>{WmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var ey=p((JgI,lmI)=>{lmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var Ik=p((pgI,QmI)=>{QmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var Gk=p((KgI,LmI)=>{LmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var Ck=p((ygI,mmI)=>{mmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var Nk=p((kgI,VmI)=>{VmI.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var Zk=p((Yk)=>{Object.defineProperty(Yk,"__esModule",{value:!0});var XmI=_y(),RmI=oy(),dmI=ry(),hmI=ey(),cmI=Ik(),HmI=Gk(),wmI=Ck(),OmI=Nk(),FmI=["/properties"];function umI(I){return[XmI,RmI,dmI,hmI,cmI,G(this,HmI),wmI,G(this,OmI)].forEach((C)=>this.addMetaSchema(C,void 0,!1)),this;function G(C,N){return I?C.$dataMetaSchema(N,FmI):N}}Yk.default=umI});var bk=p((_G,Jd)=>{Object.defineProperty(_G,"__esModule",{value:!0});_G.MissingRefError=_G.ValidationError=_G.CodeGen=_G.Name=_G.nil=_G.stringify=_G.str=_G._=_G.KeywordCxt=_G.Ajv2020=void 0;var gmI=OL(),AmI=$y(),JmI=qL(),pmI=Zk(),Ad="https://json-schema.org/draft/2020-12/schema";class L0 extends gmI.default{constructor(I={}){super({...I,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),AmI.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(JmI.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:I,meta:G}=this.opts;if(!G)return;pmI.default.call(this,I),this.refs["http://json-schema.org/schema"]=Ad}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ad)?Ad:void 0)}}_G.Ajv2020=L0;Jd.exports=_G=L0;Jd.exports.Ajv2020=L0;Object.defineProperty(_G,"__esModule",{value:!0});_G.default=L0;var KmI=FZ();Object.defineProperty(_G,"KeywordCxt",{enumerable:!0,get:function(){return KmI.KeywordCxt}});var GW=LI();Object.defineProperty(_G,"_",{enumerable:!0,get:function(){return GW._}});Object.defineProperty(_G,"str",{enumerable:!0,get:function(){return GW.str}});Object.defineProperty(_G,"stringify",{enumerable:!0,get:function(){return GW.stringify}});Object.defineProperty(_G,"nil",{enumerable:!0,get:function(){return GW.nil}});Object.defineProperty(_G,"Name",{enumerable:!0,get:function(){return GW.Name}});Object.defineProperty(_G,"CodeGen",{enumerable:!0,get:function(){return GW.CodeGen}});var ymI=fb();Object.defineProperty(_G,"ValidationError",{enumerable:!0,get:function(){return ymI.default}});var kmI=uZ();Object.defineProperty(_G,"MissingRefError",{enumerable:!0,get:function(){return kmI.default}})});var ME=p((pKI,xE)=>{var kY=KI("constants"),YRI=process.cwd,I2=null,ZRI=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!I2)I2=YRI.call(process);return I2};try{process.cwd()}catch(I){}if(typeof process.chdir==="function"){if(G2=process.chdir,process.chdir=function(I){I2=null,G2.call(process,I)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,G2)}var G2;xE.exports=bRI;function bRI(I){if(kY.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))G(I);if(!I.lutimes)C(I);if(I.chown=Z(I.chown),I.fchown=Z(I.fchown),I.lchown=Z(I.lchown),I.chmod=N(I.chmod),I.fchmod=N(I.fchmod),I.lchmod=N(I.lchmod),I.chownSync=b(I.chownSync),I.fchownSync=b(I.fchownSync),I.lchownSync=b(I.lchownSync),I.chmodSync=Y(I.chmodSync),I.fchmodSync=Y(I.fchmodSync),I.lchmodSync=Y(I.lchmodSync),I.stat=W(I.stat),I.fstat=W(I.fstat),I.lstat=W(I.lstat),I.statSync=l(I.statSync),I.fstatSync=l(I.fstatSync),I.lstatSync=l(I.lstatSync),I.chmod&&!I.lchmod)I.lchmod=function(L,m,X){if(X)process.nextTick(X)},I.lchmodSync=function(){};if(I.chown&&!I.lchown)I.lchown=function(L,m,X,V){if(V)process.nextTick(V)},I.lchownSync=function(){};if(ZRI==="win32")I.rename=typeof I.rename!=="function"?I.rename:function(L){function m(X,V,R){var d=Date.now(),c=0;L(X,V,function H(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-d<60000){if(setTimeout(function(){I.stat(V,function(v,u){if(v&&v.code==="ENOENT")L(X,V,H);else R(w)})},c),c<100)c+=10;return}if(R)R(w)})}if(Object.setPrototypeOf)Object.setPrototypeOf(m,L);return m}(I.rename);I.read=typeof I.read!=="function"?I.read:function(L){function m(X,V,R,d,c,H){var w;if(H&&typeof H==="function"){var v=0;w=function(u,O,g){if(u&&u.code==="EAGAIN"&&v<10)return v++,L.call(I,X,V,R,d,c,w);H.apply(this,arguments)}}return L.call(I,X,V,R,d,c,w)}if(Object.setPrototypeOf)Object.setPrototypeOf(m,L);return m}(I.read),I.readSync=typeof I.readSync!=="function"?I.readSync:function(L){return function(m,X,V,R,d){var c=0;while(!0)try{return L.call(I,m,X,V,R,d)}catch(H){if(H.code==="EAGAIN"&&c<10){c++;continue}throw H}}}(I.readSync);function G(L){L.lchmod=function(m,X,V){L.open(m,kY.O_WRONLY|kY.O_SYMLINK,X,function(R,d){if(R){if(V)V(R);return}L.fchmod(d,X,function(c){L.close(d,function(H){if(V)V(c||H)})})})},L.lchmodSync=function(m,X){var V=L.openSync(m,kY.O_WRONLY|kY.O_SYMLINK,X),R=!0,d;try{d=L.fchmodSync(V,X),R=!1}finally{if(R)try{L.closeSync(V)}catch(c){}else L.closeSync(V)}return d}}function C(L){if(kY.hasOwnProperty("O_SYMLINK")&&L.futimes)L.lutimes=function(m,X,V,R){L.open(m,kY.O_SYMLINK,function(d,c){if(d){if(R)R(d);return}L.futimes(c,X,V,function(H){L.close(c,function(w){if(R)R(H||w)})})})},L.lutimesSync=function(m,X,V){var R=L.openSync(m,kY.O_SYMLINK),d,c=!0;try{d=L.futimesSync(R,X,V),c=!1}finally{if(c)try{L.closeSync(R)}catch(H){}else L.closeSync(R)}return d};else if(L.futimes)L.lutimes=function(m,X,V,R){if(R)process.nextTick(R)},L.lutimesSync=function(){}}function N(L){if(!L)return L;return function(m,X,V){return L.call(I,m,X,function(R){if(Q(R))R=null;if(V)V.apply(this,arguments)})}}function Y(L){if(!L)return L;return function(m,X){try{return L.call(I,m,X)}catch(V){if(!Q(V))throw V}}}function Z(L){if(!L)return L;return function(m,X,V,R){return L.call(I,m,X,V,function(d){if(Q(d))d=null;if(R)R.apply(this,arguments)})}}function b(L){if(!L)return L;return function(m,X,V){try{return L.call(I,m,X,V)}catch(R){if(!Q(R))throw R}}}function W(L){if(!L)return L;return function(m,X,V){if(typeof X==="function")V=X,X=null;function R(d,c){if(c){if(c.uid<0)c.uid+=4294967296;if(c.gid<0)c.gid+=4294967296}if(V)V.apply(this,arguments)}return X?L.call(I,m,X,R):L.call(I,m,R)}}function l(L){if(!L)return L;return function(m,X){var V=X?L.call(I,m,X):L.call(I,m);if(V){if(V.uid<0)V.uid+=4294967296;if(V.gid<0)V.gid+=4294967296}return V}}function Q(L){if(!L)return!0;if(L.code==="ENOSYS")return!0;var m=!process.getuid||process.getuid()!==0;if(m){if(L.code==="EINVAL"||L.code==="EPERM")return!0}return!1}}});var iE=p((KKI,sE)=>{var SE=KI("stream").Stream;sE.exports=WRI;function WRI(I){return{ReadStream:G,WriteStream:C};function G(N,Y){if(!(this instanceof G))return new G(N,Y);SE.call(this);var Z=this;this.path=N,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,Y=Y||{};var b=Object.keys(Y);for(var W=0,l=b.length;W<l;W++){var Q=b[W];this[Q]=Y[Q]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){Z._read()});return}I.open(this.path,this.flags,this.mode,function(L,m){if(L){Z.emit("error",L),Z.readable=!1;return}Z.fd=m,Z.emit("open",m),Z._read()})}function C(N,Y){if(!(this instanceof C))return new C(N,Y);SE.call(this),this.path=N,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,Y=Y||{};var Z=Object.keys(Y);for(var b=0,W=Z.length;b<W;b++){var l=Z[b];this[l]=Y[l]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=I.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var PE=p((yKI,TE)=>{TE.exports=QRI;var lRI=Object.getPrototypeOf||function(I){return I.__proto__};function QRI(I){if(I===null||typeof I!=="object")return I;if(I instanceof Object)var G={__proto__:lRI(I)};else var G=Object.create(null);return Object.getOwnPropertyNames(I).forEach(function(C){Object.defineProperty(G,C,Object.getOwnPropertyDescriptor(I,C))}),G}});var Nh=p((kKI,Ch)=>{var PI=KI("fs"),LRI=ME(),mRI=iE(),VRI=PE(),C2=KI("util"),wG,Y2;if(typeof Symbol==="function"&&typeof Symbol.for==="function")wG=Symbol.for("graceful-fs.queue"),Y2=Symbol.for("graceful-fs.previous");else wG="___graceful-fs.queue",Y2="___graceful-fs.previous";function XRI(){}function fE(I,G){Object.defineProperty(I,wG,{get:function(){return G}})}var DZ=XRI;if(C2.debuglog)DZ=C2.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))DZ=function(){var I=C2.format.apply(C2,arguments);I="GFS4: "+I.split(/\n/).join(`
|
|
57
|
-
GFS4: `),console.error(I)};if(!PI[wG]){if(ed=global[wG]||[],fE(PI,ed),PI.close=function(I){function G(C,N){return I.call(PI,C,function(Y){if(!Y)tE();if(typeof N==="function")N.apply(this,arguments)})}return Object.defineProperty(G,Y2,{value:I}),G}(PI.close),PI.closeSync=function(I){function G(C){I.apply(PI,arguments),tE()}return Object.defineProperty(G,Y2,{value:I}),G}(PI.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){DZ(PI[wG]),KI("assert").equal(PI[wG].length,0)})}var ed;if(!global[wG])fE(global,PI[wG]);Ch.exports=Ih(VRI(PI));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!PI.__patched)Ch.exports=Ih(PI),PI.__patched=!0;function Ih(I){LRI(I),I.gracefulify=Ih,I.createReadStream=O,I.createWriteStream=g;var G=I.readFile;I.readFile=C;function C(J,a,k){if(typeof a==="function")k=a,a=null;return q(J,a,k);function q(A,K,E,s){return G(A,K,function(D){if(D&&(D.code==="EMFILE"||D.code==="ENFILE"))RW([q,[A,K,E],D,s||Date.now(),Date.now()]);else if(typeof E==="function")E.apply(this,arguments)})}}var N=I.writeFile;I.writeFile=Y;function Y(J,a,k,q){if(typeof k==="function")q=k,k=null;return A(J,a,k,q);function A(K,E,s,D,r){return N(K,E,s,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}var Z=I.appendFile;if(Z)I.appendFile=b;function b(J,a,k,q){if(typeof k==="function")q=k,k=null;return A(J,a,k,q);function A(K,E,s,D,r){return Z(K,E,s,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}var W=I.copyFile;if(W)I.copyFile=l;function l(J,a,k,q){if(typeof k==="function")q=k,k=0;return A(J,a,k,q);function A(K,E,s,D,r){return W(K,E,s,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}var Q=I.readdir;I.readdir=m;var L=/^v[0-5]\./;function m(J,a,k){if(typeof a==="function")k=a,a=null;var q=L.test(process.version)?function(E,s,D,r){return Q(E,A(E,s,D,r))}:function(E,s,D,r){return Q(E,s,A(E,s,D,r))};return q(J,a,k);function A(K,E,s,D){return function(r,f){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))RW([q,[K,E,s],r,D||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof s==="function")s.call(this,r,f)}}}}if(process.version.substr(0,4)==="v0.8"){var X=mRI(I);H=X.ReadStream,v=X.WriteStream}var V=I.ReadStream;if(V)H.prototype=Object.create(V.prototype),H.prototype.open=w;var R=I.WriteStream;if(R)v.prototype=Object.create(R.prototype),v.prototype.open=u;Object.defineProperty(I,"ReadStream",{get:function(){return H},set:function(J){H=J},enumerable:!0,configurable:!0}),Object.defineProperty(I,"WriteStream",{get:function(){return v},set:function(J){v=J},enumerable:!0,configurable:!0});var d=H;Object.defineProperty(I,"FileReadStream",{get:function(){return d},set:function(J){d=J},enumerable:!0,configurable:!0});var c=v;Object.defineProperty(I,"FileWriteStream",{get:function(){return c},set:function(J){c=J},enumerable:!0,configurable:!0});function H(J,a){if(this instanceof H)return V.apply(this,arguments),this;else return H.apply(Object.create(H.prototype),arguments)}function w(){var J=this;z(J.path,J.flags,J.mode,function(a,k){if(a){if(J.autoClose)J.destroy();J.emit("error",a)}else J.fd=k,J.emit("open",k),J.read()})}function v(J,a){if(this instanceof v)return R.apply(this,arguments),this;else return v.apply(Object.create(v.prototype),arguments)}function u(){var J=this;z(J.path,J.flags,J.mode,function(a,k){if(a)J.destroy(),J.emit("error",a);else J.fd=k,J.emit("open",k)})}function O(J,a){return new I.ReadStream(J,a)}function g(J,a){return new I.WriteStream(J,a)}var F=I.open;I.open=z;function z(J,a,k,q){if(typeof k==="function")q=k,k=null;return A(J,a,k,q);function A(K,E,s,D,r){return F(K,E,s,function(f,mI){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}return I}function RW(I){DZ("ENQUEUE",I[0].name,I[1]),PI[wG].push(I),Gh()}var N2;function tE(){var I=Date.now();for(var G=0;G<PI[wG].length;++G)if(PI[wG][G].length>2)PI[wG][G][3]=I,PI[wG][G][4]=I;Gh()}function Gh(){if(clearTimeout(N2),N2=void 0,PI[wG].length===0)return;var I=PI[wG].shift(),G=I[0],C=I[1],N=I[2],Y=I[3],Z=I[4];if(Y===void 0)DZ("RETRY",G.name,C),G.apply(null,C);else if(Date.now()-Y>=60000){DZ("TIMEOUT",G.name,C);var b=C.pop();if(typeof b==="function")b.call(null,N)}else{var W=Date.now()-Z,l=Math.max(Z-Y,1),Q=Math.min(l*1.2,100);if(W>=Q)DZ("RETRY",G.name,C),G.apply(null,C.concat([Y]));else PI[wG].push(I)}if(N2===void 0)N2=setTimeout(Gh,0)}});var _E=p((EKI,$E)=>{function FC(I,G){if(typeof G==="boolean")G={forever:G};if(this._originalTimeouts=JSON.parse(JSON.stringify(I)),this._timeouts=I,this._options=G||{},this._maxRetryTime=G&&G.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}$E.exports=FC;FC.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};FC.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};FC.prototype.retry=function(I){if(this._timeout)clearTimeout(this._timeout);if(!I)return!1;var G=new Date().getTime();if(I&&G-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(I);var C=this._timeouts.shift();if(C===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),C=this._timeouts.shift();else return!1;var N=this,Y=setTimeout(function(){if(N._attempts++,N._operationTimeoutCb){if(N._timeout=setTimeout(function(){N._operationTimeoutCb(N._attempts)},N._operationTimeout),N._options.unref)N._timeout.unref()}N._fn(N._attempts)},C);if(this._options.unref)Y.unref();return!0};FC.prototype.attempt=function(I,G){if(this._fn=I,G){if(G.timeout)this._operationTimeout=G.timeout;if(G.cb)this._operationTimeoutCb=G.cb}var C=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){C._operationTimeoutCb()},C._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};FC.prototype.try=function(I){console.log("Using RetryOperation.try() is deprecated"),this.attempt(I)};FC.prototype.start=function(I){console.log("Using RetryOperation.start() is deprecated"),this.attempt(I)};FC.prototype.start=FC.prototype.try;FC.prototype.errors=function(){return this._errors};FC.prototype.attempts=function(){return this._attempts};FC.prototype.mainError=function(){if(this._errors.length===0)return null;var I={},G=null,C=0;for(var N=0;N<this._errors.length;N++){var Y=this._errors[N],Z=Y.message,b=(I[Z]||0)+1;if(I[Z]=b,b>=C)G=Y,C=b}return G}});var rE=p((dRI)=>{var RRI=_E();dRI.operation=function(I){var G=dRI.timeouts(I);return new RRI(G,{forever:I&&I.forever,unref:I&&I.unref,maxRetryTime:I&&I.maxRetryTime})};dRI.timeouts=function(I){if(I instanceof Array)return[].concat(I);var G={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var C in I)G[C]=I[C];if(G.minTimeout>G.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var N=[];for(var Y=0;Y<G.retries;Y++)N.push(this.createTimeout(Y,G));if(I&&I.forever&&!N.length)N.push(this.createTimeout(Y,G));return N.sort(function(Z,b){return Z-b}),N};dRI.createTimeout=function(I,G){var C=G.randomize?Math.random()+1:1,N=Math.round(C*G.minTimeout*Math.pow(G.factor,I));return N=Math.min(N,G.maxTimeout),N};dRI.wrap=function(I,G,C){if(G instanceof Array)C=G,G=null;if(!C){C=[];for(var N in I)if(typeof I[N]==="function")C.push(N)}for(var Y=0;Y<C.length;Y++){var Z=C[Y],b=I[Z];I[Z]=function(l){var Q=dRI.operation(G),L=Array.prototype.slice.call(arguments,1),m=L.pop();L.push(function(X){if(Q.retry(X))return;if(X)arguments[0]=Q.mainError();m.apply(this,arguments)}),Q.attempt(function(){l.apply(I,L)})}.bind(I,b),I[Z].options=G}}});var eE=p((aKI,Z2)=>{Z2.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Z2.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Z2.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var I9=p((DKI,hW)=>{var sI=global.process,qZ=function(I){return I&&typeof I==="object"&&typeof I.removeListener==="function"&&typeof I.emit==="function"&&typeof I.reallyExit==="function"&&typeof I.listeners==="function"&&typeof I.kill==="function"&&typeof I.pid==="number"&&typeof I.on==="function"};if(!qZ(sI))hW.exports=function(){return function(){}};else{if(Yh=KI("assert"),UZ=eE(),Zh=/^win/i.test(sI.platform),dW=KI("events"),typeof dW!=="function")dW=dW.EventEmitter;if(sI.__signal_exit_emitter__)WG=sI.__signal_exit_emitter__;else WG=sI.__signal_exit_emitter__=new dW,WG.count=0,WG.emitted={};if(!WG.infinite)WG.setMaxListeners(1/0),WG.infinite=!0;hW.exports=function(I,G){if(!qZ(global.process))return function(){};if(Yh.equal(typeof I,"function","a callback must be provided for exit handler"),jZ===!1)b2();var C="exit";if(G&&G.alwaysLast)C="afterexit";var N=function(){if(WG.removeListener(C,I),WG.listeners("exit").length===0&&WG.listeners("afterexit").length===0)O0()};return WG.on(C,I),N},O0=function(){if(!jZ||!qZ(global.process))return;jZ=!1,UZ.forEach(function(G){try{sI.removeListener(G,F0[G])}catch(C){}}),sI.emit=u0,sI.reallyExit=W2,WG.count-=1},hW.exports.unload=O0,EY=function(G,C,N){if(WG.emitted[G])return;WG.emitted[G]=!0,WG.emit(G,C,N)},F0={},UZ.forEach(function(I){F0[I]=function(){if(!qZ(global.process))return;var C=sI.listeners(I);if(C.length===WG.count){if(O0(),EY("exit",null,I),EY("afterexit",null,I),Zh&&I==="SIGHUP")I="SIGINT";sI.kill(sI.pid,I)}}}),hW.exports.signals=function(){return UZ},jZ=!1,b2=function(){if(jZ||!qZ(global.process))return;jZ=!0,WG.count+=1,UZ=UZ.filter(function(G){try{return sI.on(G,F0[G]),!0}catch(C){return!1}}),sI.emit=Wh,sI.reallyExit=bh},hW.exports.load=b2,W2=sI.reallyExit,bh=function(G){if(!qZ(global.process))return;sI.exitCode=G||0,EY("exit",sI.exitCode,null),EY("afterexit",sI.exitCode,null),W2.call(sI,sI.exitCode)},u0=sI.emit,Wh=function(G,C){if(G==="exit"&&qZ(global.process)){if(C!==void 0)sI.exitCode=C;var N=u0.apply(this,arguments);return EY("exit",sI.exitCode,null),EY("afterexit",sI.exitCode,null),N}else return u0.apply(this,arguments)}}var Yh,UZ,Zh,dW,WG,O0,EY,F0,jZ,b2,W2,bh,u0,Wh});var C9=p((FRI,lh)=>{var G9=Symbol();function wRI(I,G,C){let N=G[G9];if(N)return G.stat(I,(Z,b)=>{if(Z)return C(Z);C(null,b.mtime,N)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);G.utimes(I,Y,Y,(Z)=>{if(Z)return C(Z);G.stat(I,(b,W)=>{if(b)return C(b);let l=W.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(G,G9,{value:l}),C(null,W.mtime,l)})})}function ORI(I){let G=Date.now();if(I==="s")G=Math.ceil(G/1000)*1000;return new Date(G)}FRI.probe=wRI;FRI.getMtime=ORI});var W9=p((kRI,g0)=>{var gRI=KI("path"),mh=Nh(),ARI=rE(),JRI=I9(),N9=C9(),PN={};function v0(I,G){return G.lockfilePath||`${I}.lock`}function Vh(I,G,C){if(!G.realpath)return C(null,gRI.resolve(I));G.fs.realpath(I,C)}function Lh(I,G,C){let N=v0(I,G);G.fs.mkdir(N,(Y)=>{if(!Y)return N9.probe(N,G.fs,(Z,b,W)=>{if(Z)return G.fs.rmdir(N,()=>{}),C(Z);C(null,b,W)});if(Y.code!=="EEXIST")return C(Y);if(G.stale<=0)return C(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:I}));G.fs.stat(N,(Z,b)=>{if(Z){if(Z.code==="ENOENT")return Lh(I,{...G,stale:0},C);return C(Z)}if(!Y9(b,G))return C(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:I}));Z9(I,G,(W)=>{if(W)return C(W);Lh(I,{...G,stale:0},C)})})})}function Y9(I,G){return I.mtime.getTime()<Date.now()-G.stale}function Z9(I,G,C){G.fs.rmdir(v0(I,G),(N)=>{if(N&&N.code!=="ENOENT")return C(N);C()})}function l2(I,G){let C=PN[I];if(C.updateTimeout)return;if(C.updateDelay=C.updateDelay||G.update,C.updateTimeout=setTimeout(()=>{C.updateTimeout=null,G.fs.stat(C.lockfilePath,(N,Y)=>{let Z=C.lastUpdate+G.stale<Date.now();if(N){if(N.code==="ENOENT"||Z)return Qh(I,C,Object.assign(N,{code:"ECOMPROMISED"}));return C.updateDelay=1000,l2(I,G)}if(C.mtime.getTime()!==Y.mtime.getTime())return Qh(I,C,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let W=N9.getMtime(C.mtimePrecision);G.fs.utimes(C.lockfilePath,W,W,(l)=>{let Q=C.lastUpdate+G.stale<Date.now();if(C.released)return;if(l){if(l.code==="ENOENT"||Q)return Qh(I,C,Object.assign(l,{code:"ECOMPROMISED"}));return C.updateDelay=1000,l2(I,G)}C.mtime=W,C.lastUpdate=Date.now(),C.updateDelay=null,l2(I,G)})})},C.updateDelay),C.updateTimeout.unref)C.updateTimeout.unref()}function Qh(I,G,C){if(G.released=!0,G.updateTimeout)clearTimeout(G.updateTimeout);if(PN[I]===G)delete PN[I];G.options.onCompromised(C)}function pRI(I,G,C){G={stale:1e4,update:null,realpath:!0,retries:0,fs:mh,onCompromised:(N)=>{throw N},...G},G.retries=G.retries||0,G.retries=typeof G.retries==="number"?{retries:G.retries}:G.retries,G.stale=Math.max(G.stale||0,2000),G.update=G.update==null?G.stale/2:G.update||0,G.update=Math.max(Math.min(G.update,G.stale/2),1000),Vh(I,G,(N,Y)=>{if(N)return C(N);let Z=ARI.operation(G.retries);Z.attempt(()=>{Lh(Y,G,(b,W,l)=>{if(Z.retry(b))return;if(b)return C(Z.mainError());let Q=PN[Y]={lockfilePath:v0(Y,G),mtime:W,mtimePrecision:l,options:G,lastUpdate:Date.now()};l2(Y,G),C(null,(L)=>{if(Q.released)return L&&L(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));b9(Y,{...G,realpath:!1},L)})})})})}function b9(I,G,C){G={fs:mh,realpath:!0,...G},Vh(I,G,(N,Y)=>{if(N)return C(N);let Z=PN[Y];if(!Z)return C(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Z.updateTimeout&&clearTimeout(Z.updateTimeout),Z.released=!0,delete PN[Y],Z9(Y,G,C)})}function KRI(I,G,C){G={stale:1e4,realpath:!0,fs:mh,...G},G.stale=Math.max(G.stale||0,2000),Vh(I,G,(N,Y)=>{if(N)return C(N);G.fs.stat(v0(Y,G),(Z,b)=>{if(Z)return Z.code==="ENOENT"?C(null,!1):C(Z);return C(null,!Y9(b,G))})})}function yRI(){return PN}JRI(()=>{for(let I in PN){let G=PN[I].options;try{G.fs.rmdirSync(v0(I,G))}catch(C){}}});kRI.lock=pRI;kRI.unlock=b9;kRI.check=KRI;kRI.getLocks=yRI});var Q9=p((qKI,l9)=>{var qRI=Nh();function URI(I){let G=["mkdir","realpath","stat","rmdir","utimes"],C={...I};return G.forEach((N)=>{C[N]=(...Y)=>{let Z=Y.pop(),b;try{b=I[`${N}Sync`](...Y)}catch(W){return Z(W)}Z(null,b)}}),C}function jRI(I){return(...G)=>new Promise((C,N)=>{G.push((Y,Z)=>{if(Y)N(Y);else C(Z)}),I(...G)})}function BRI(I){return(...G)=>{let C,N;if(G.push((Y,Z)=>{C=Y,N=Z}),I(...G),C)throw C;return N}}function nRI(I){if(I={...I},I.fs=URI(I.fs||qRI),typeof I.retries==="number"&&I.retries>0||I.retries&&typeof I.retries.retries==="number"&&I.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return I}l9.exports={toPromise:jRI,toSync:BRI,toSyncOptions:nRI}});var m9=p((UKI,zY)=>{var cW=W9(),{toPromise:Q2,toSync:L2,toSyncOptions:Xh}=Q9();async function L9(I,G){let C=await Q2(cW.lock)(I,G);return Q2(C)}function xRI(I,G){let C=L2(cW.lock)(I,Xh(G));return L2(C)}function MRI(I,G){return Q2(cW.unlock)(I,G)}function SRI(I,G){return L2(cW.unlock)(I,Xh(G))}function sRI(I,G){return Q2(cW.check)(I,G)}function iRI(I,G){return L2(cW.check)(I,Xh(G))}zY.exports=L9;zY.exports.lock=L9;zY.exports.unlock=MRI;zY.exports.lockSync=xRI;zY.exports.unlockSync=SRI;zY.exports.check=sRI;zY.exports.checkSync=iRI});import{createInterface as DdI}from"readline/promises";var Fh={name:"@sunerpy/kiro-provider",version:"3.2.4",description:"OpenAI Responses-compatible AWS KiroRuntime provider with native and stateless fallback transports",homepage:"https://github.com/sunerpy/kiro-provider#readme",bugs:"https://github.com/sunerpy/kiro-provider/issues",license:"MIT",repository:{type:"git",url:"git+https://github.com/sunerpy/kiro-provider.git"},bin:{"kiro-provider":"dist/cli.js"},files:["dist/cli.js","README.md","LICENSE"],type:"module",publishConfig:{access:"public"},scripts:{fmt:"oxfmt --ignore-path .oxfmtignore --write '**/*.{yml,yaml,json,md}' && biome check --write ./src ./scripts ./__tests__",lint:"biome check ./src ./scripts ./__tests__",typecheck:"tsc --noEmit",test:"bun test",build:"bun run build:npm","build:binary":"bun build --compile --minify src/cli/bin.ts --outfile dist/kiro-provider","build:npm":"bun build src/cli/bin.ts --outfile dist/cli.js --target=bun --minify && chmod +x dist/cli.js","probe:projection-fidelity":"bun run scripts/probe-projection-fidelity.ts","probe:v3-fields":"bun run scripts/probe-v3-request-fields.ts","probe:v3-create-response":"bun run scripts/probe-v3-create-response.ts","study:effort":"bun run scripts/effort-study.ts","study:effort:run":"bun run scripts/run-effort-study.ts","study:effort:responses":"bun run scripts/responses-effort-study.ts","e2e:responses":"bun run scripts/responses-live-e2e.ts","diff:kiro-cli-wire":"bun run scripts/kiro-cli-wire-diff.ts",prepublishOnly:"bun run build:npm","docs:links":"bun run scripts/check-markdown-links.ts","fmt:check":"oxfmt --ignore-path .oxfmtignore --check '**/*.{yml,yaml,json,md}' && biome check ./src ./scripts ./__tests__",check:"bun run fmt:check && bun run typecheck && bun run lint && bun run docs:links && bun run test && bun run build"},dependencies:{"@aws-sdk/core":"3.975.3","@aws/codewhisperer-streaming-client":"^1.0.34","@smithy/node-http-handler":"4.9.7",ajv:"8.20.0","https-proxy-agent":"^9.1.0","js-tiktoken":"1.0.21","proper-lockfile":"^4.1.2",zod:"^3.24.0"},devDependencies:{"@ai-sdk/openai":"4.0.66","@biomejs/biome":"2.2.4","@types/bun":"^1.3.6","@types/node":"^20.0.0","@types/proper-lockfile":"^4.1.4",ai:"7.0.99",openai:"7.13.0",oxfmt:"0.64.0",typescript:"^5.7.3"},engines:{bun:">=1.3.14"},packageManager:"bun@1.3.14"};import{existsSync as mz,readFileSync as Vz,statSync as Xz}from"fs";var h={};T9(h,{void:()=>k3,util:()=>wI,unknown:()=>K3,union:()=>D3,undefined:()=>A3,tuple:()=>j3,transformer:()=>t3,symbol:()=>g3,string:()=>kh,strictObject:()=>a3,setErrorMap:()=>$9,set:()=>x3,record:()=>B3,quotelessJson:()=>t9,promise:()=>P3,preprocess:()=>_3,pipeline:()=>o3,ostring:()=>r3,optional:()=>f3,onumber:()=>e3,oboolean:()=>Iz,objectUtil:()=>h2,object:()=>z3,number:()=>Eh,nullable:()=>$3,null:()=>J3,never:()=>y3,nativeEnum:()=>T3,nan:()=>F3,map:()=>n3,makeIssue:()=>uW,literal:()=>s3,lazy:()=>S3,late:()=>w3,isValid:()=>$N,isDirty:()=>z0,isAsync:()=>MZ,isAborted:()=>E0,intersection:()=>U3,instanceof:()=>O3,getParsedType:()=>tC,getErrorMap:()=>xZ,function:()=>M3,enum:()=>i3,effect:()=>t3,discriminatedUnion:()=>q3,defaultErrorMap:()=>ON,datetimeRegex:()=>ph,date:()=>v3,custom:()=>yh,coerce:()=>Gz,boolean:()=>zh,bigint:()=>u3,array:()=>E3,any:()=>p3,addIssueToContext:()=>T,ZodVoid:()=>gW,ZodUnknown:()=>_N,ZodUnion:()=>tZ,ZodUndefined:()=>TZ,ZodType:()=>dI,ZodTuple:()=>$C,ZodTransformer:()=>KC,ZodSymbol:()=>vW,ZodString:()=>gC,ZodSet:()=>UY,ZodSchema:()=>dI,ZodRecord:()=>AW,ZodReadonly:()=>Ib,ZodPromise:()=>jY,ZodPipeline:()=>KW,ZodParsedType:()=>M,ZodOptional:()=>JC,ZodObject:()=>iI,ZodNumber:()=>oN,ZodNullable:()=>uN,ZodNull:()=>PZ,ZodNever:()=>fC,ZodNativeEnum:()=>oZ,ZodNaN:()=>pW,ZodMap:()=>JW,ZodLiteral:()=>_Z,ZodLazy:()=>$Z,ZodIssueCode:()=>U,ZodIntersection:()=>fZ,ZodFunction:()=>sZ,ZodFirstPartyTypeKind:()=>ZI,ZodError:()=>aG,ZodEnum:()=>eN,ZodEffects:()=>KC,ZodDiscriminatedUnion:()=>a0,ZodDefault:()=>rZ,ZodDate:()=>DY,ZodCatch:()=>eZ,ZodBranded:()=>D0,ZodBoolean:()=>iZ,ZodBigInt:()=>rN,ZodArray:()=>AC,ZodAny:()=>qY,Schema:()=>dI,ParseStatus:()=>VG,OK:()=>uG,NEVER:()=>Cz,INVALID:()=>NI,EMPTY_PATH:()=>_9,DIRTY:()=>aY,BRAND:()=>H3});var wI;(function(I){I.assertEqual=(Y)=>{};function G(Y){}I.assertIs=G;function C(Y){throw Error()}I.assertNever=C,I.arrayToEnum=(Y)=>{let Z={};for(let b of Y)Z[b]=b;return Z},I.getValidEnumValues=(Y)=>{let Z=I.objectKeys(Y).filter((W)=>typeof Y[Y[W]]!=="number"),b={};for(let W of Z)b[W]=Y[W];return I.objectValues(b)},I.objectValues=(Y)=>{return I.objectKeys(Y).map(function(Z){return Y[Z]})},I.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let Z=[];for(let b in Y)if(Object.prototype.hasOwnProperty.call(Y,b))Z.push(b);return Z},I.find=(Y,Z)=>{for(let b of Y)if(Z(b))return b;return},I.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function N(Y,Z=" | "){return Y.map((b)=>typeof b==="string"?`'${b}'`:b).join(Z)}I.joinValues=N,I.jsonStringifyReplacer=(Y,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(wI||(wI={}));var h2;(function(I){I.mergeShapes=(G,C)=>{return{...G,...C}}})(h2||(h2={}));var M=wI.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tC=(I)=>{switch(typeof I){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(I)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray(I))return M.array;if(I===null)return M.null;if(I.then&&typeof I.then==="function"&&I.catch&&typeof I.catch==="function")return M.promise;if(typeof Map<"u"&&I instanceof Map)return M.map;if(typeof Set<"u"&&I instanceof Set)return M.set;if(typeof Date<"u"&&I instanceof Date)return M.date;return M.object;default:return M.unknown}};var U=wI.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),t9=(I)=>{return JSON.stringify(I,null,2).replace(/"([^"]+)":/g,"$1:")};class aG extends Error{get errors(){return this.issues}constructor(I){super();this.issues=[],this.addIssue=(C)=>{this.issues=[...this.issues,C]},this.addIssues=(C=[])=>{this.issues=[...this.issues,...C]};let G=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,G);else this.__proto__=G;this.name="ZodError",this.issues=I}format(I){let G=I||function(Y){return Y.message},C={_errors:[]},N=(Y)=>{for(let Z of Y.issues)if(Z.code==="invalid_union")Z.unionErrors.map(N);else if(Z.code==="invalid_return_type")N(Z.returnTypeError);else if(Z.code==="invalid_arguments")N(Z.argumentsError);else if(Z.path.length===0)C._errors.push(G(Z));else{let b=C,W=0;while(W<Z.path.length){let l=Z.path[W];if(W!==Z.path.length-1)b[l]=b[l]||{_errors:[]};else b[l]=b[l]||{_errors:[]},b[l]._errors.push(G(Z));b=b[l],W++}}};return N(this),C}static assert(I){if(!(I instanceof aG))throw Error(`Not a ZodError: ${I}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wI.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(I=(G)=>G.message){let G={},C=[];for(let N of this.issues)if(N.path.length>0){let Y=N.path[0];G[Y]=G[Y]||[],G[Y].push(I(N))}else C.push(I(N));return{formErrors:C,fieldErrors:G}}get formErrors(){return this.flatten()}}aG.create=(I)=>{return new aG(I)};var f9=(I,G)=>{let C;switch(I.code){case U.invalid_type:if(I.received===M.undefined)C="Required";else C=`Expected ${I.expected}, received ${I.received}`;break;case U.invalid_literal:C=`Invalid literal value, expected ${JSON.stringify(I.expected,wI.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:C=`Unrecognized key(s) in object: ${wI.joinValues(I.keys,", ")}`;break;case U.invalid_union:C="Invalid input";break;case U.invalid_union_discriminator:C=`Invalid discriminator value. Expected ${wI.joinValues(I.options)}`;break;case U.invalid_enum_value:C=`Invalid enum value. Expected ${wI.joinValues(I.options)}, received '${I.received}'`;break;case U.invalid_arguments:C="Invalid function arguments";break;case U.invalid_return_type:C="Invalid function return type";break;case U.invalid_date:C="Invalid date";break;case U.invalid_string:if(typeof I.validation==="object")if("includes"in I.validation){if(C=`Invalid input: must include "${I.validation.includes}"`,typeof I.validation.position==="number")C=`${C} at one or more positions greater than or equal to ${I.validation.position}`}else if("startsWith"in I.validation)C=`Invalid input: must start with "${I.validation.startsWith}"`;else if("endsWith"in I.validation)C=`Invalid input: must end with "${I.validation.endsWith}"`;else wI.assertNever(I.validation);else if(I.validation!=="regex")C=`Invalid ${I.validation}`;else C="Invalid";break;case U.too_small:if(I.type==="array")C=`Array must contain ${I.exact?"exactly":I.inclusive?"at least":"more than"} ${I.minimum} element(s)`;else if(I.type==="string")C=`String must contain ${I.exact?"exactly":I.inclusive?"at least":"over"} ${I.minimum} character(s)`;else if(I.type==="number")C=`Number must be ${I.exact?"exactly equal to ":I.inclusive?"greater than or equal to ":"greater than "}${I.minimum}`;else if(I.type==="bigint")C=`Number must be ${I.exact?"exactly equal to ":I.inclusive?"greater than or equal to ":"greater than "}${I.minimum}`;else if(I.type==="date")C=`Date must be ${I.exact?"exactly equal to ":I.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(I.minimum))}`;else C="Invalid input";break;case U.too_big:if(I.type==="array")C=`Array must contain ${I.exact?"exactly":I.inclusive?"at most":"less than"} ${I.maximum} element(s)`;else if(I.type==="string")C=`String must contain ${I.exact?"exactly":I.inclusive?"at most":"under"} ${I.maximum} character(s)`;else if(I.type==="number")C=`Number must be ${I.exact?"exactly":I.inclusive?"less than or equal to":"less than"} ${I.maximum}`;else if(I.type==="bigint")C=`BigInt must be ${I.exact?"exactly":I.inclusive?"less than or equal to":"less than"} ${I.maximum}`;else if(I.type==="date")C=`Date must be ${I.exact?"exactly":I.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(I.maximum))}`;else C="Invalid input";break;case U.custom:C="Invalid input";break;case U.invalid_intersection_types:C="Intersection results could not be merged";break;case U.not_multiple_of:C=`Number must be a multiple of ${I.multipleOf}`;break;case U.not_finite:C="Number must be finite";break;default:C=G.defaultError,wI.assertNever(I)}return{message:C}},ON=f9;var uh=ON;function $9(I){uh=I}function xZ(){return uh}var uW=(I)=>{let{data:G,path:C,errorMaps:N,issueData:Y}=I,Z=[...C,...Y.path||[]],b={...Y,path:Z};if(Y.message!==void 0)return{...Y,path:Z,message:Y.message};let W="",l=N.filter((Q)=>!!Q).slice().reverse();for(let Q of l)W=Q(b,{data:G,defaultError:W}).message;return{...Y,path:Z,message:W}},_9=[];function T(I,G){let C=xZ(),N=uW({issueData:G,data:I.data,path:I.path,errorMaps:[I.common.contextualErrorMap,I.schemaErrorMap,C,C===ON?void 0:ON].filter((Y)=>!!Y)});I.common.issues.push(N)}class VG{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(I,G){let C=[];for(let N of G){if(N.status==="aborted")return NI;if(N.status==="dirty")I.dirty();C.push(N.value)}return{status:I.value,value:C}}static async mergeObjectAsync(I,G){let C=[];for(let N of G){let Y=await N.key,Z=await N.value;C.push({key:Y,value:Z})}return VG.mergeObjectSync(I,C)}static mergeObjectSync(I,G){let C={};for(let N of G){let{key:Y,value:Z}=N;if(Y.status==="aborted")return NI;if(Z.status==="aborted")return NI;if(Y.status==="dirty")I.dirty();if(Z.status==="dirty")I.dirty();if(Y.value!=="__proto__"&&(typeof Z.value<"u"||N.alwaysSet))C[Y.value]=Z.value}return{status:I.value,value:C}}}var NI=Object.freeze({status:"aborted"}),aY=(I)=>({status:"dirty",value:I}),uG=(I)=>({status:"valid",value:I}),E0=(I)=>I.status==="aborted",z0=(I)=>I.status==="dirty",$N=(I)=>I.status==="valid",MZ=(I)=>typeof Promise<"u"&&I instanceof Promise;var _;(function(I){I.errToObj=(G)=>typeof G==="string"?{message:G}:G||{},I.toString=(G)=>typeof G==="string"?G:G?.message})(_||(_={}));class pC{constructor(I,G,C,N){this._cachedPath=[],this.parent=I,this.data=G,this._path=C,this._key=N}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var vh=(I,G)=>{if($N(G))return{success:!0,data:G.value};else{if(!I.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let C=new aG(I.common.issues);return this._error=C,this._error}}}};function VI(I){if(!I)return{};let{errorMap:G,invalid_type_error:C,required_error:N,description:Y}=I;if(G&&(C||N))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(G)return{errorMap:G,description:Y};return{errorMap:(b,W)=>{let{message:l}=I;if(b.code==="invalid_enum_value")return{message:l??W.defaultError};if(typeof W.data>"u")return{message:l??N??W.defaultError};if(b.code!=="invalid_type")return{message:W.defaultError};return{message:l??C??W.defaultError}},description:Y}}class dI{get description(){return this._def.description}_getType(I){return tC(I.data)}_getOrReturnCtx(I,G){return G||{common:I.parent.common,data:I.data,parsedType:tC(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}_processInputParams(I){return{status:new VG,ctx:{common:I.parent.common,data:I.data,parsedType:tC(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}}_parseSync(I){let G=this._parse(I);if(MZ(G))throw Error("Synchronous parse encountered promise.");return G}_parseAsync(I){let G=this._parse(I);return Promise.resolve(G)}parse(I,G){let C=this.safeParse(I,G);if(C.success)return C.data;throw C.error}safeParse(I,G){let C={common:{issues:[],async:G?.async??!1,contextualErrorMap:G?.errorMap},path:G?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:tC(I)},N=this._parseSync({data:I,path:C.path,parent:C});return vh(C,N)}"~validate"(I){let G={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:tC(I)};if(!this["~standard"].async)try{let C=this._parseSync({data:I,path:[],parent:G});return $N(C)?{value:C.value}:{issues:G.common.issues}}catch(C){if(C?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;G.common={issues:[],async:!0}}return this._parseAsync({data:I,path:[],parent:G}).then((C)=>$N(C)?{value:C.value}:{issues:G.common.issues})}async parseAsync(I,G){let C=await this.safeParseAsync(I,G);if(C.success)return C.data;throw C.error}async safeParseAsync(I,G){let C={common:{issues:[],contextualErrorMap:G?.errorMap,async:!0},path:G?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:tC(I)},N=this._parse({data:I,path:C.path,parent:C}),Y=await(MZ(N)?N:Promise.resolve(N));return vh(C,Y)}refine(I,G){let C=(N)=>{if(typeof G==="string"||typeof G>"u")return{message:G};else if(typeof G==="function")return G(N);else return G};return this._refinement((N,Y)=>{let Z=I(N),b=()=>Y.addIssue({code:U.custom,...C(N)});if(typeof Promise<"u"&&Z instanceof Promise)return Z.then((W)=>{if(!W)return b(),!1;else return!0});if(!Z)return b(),!1;else return!0})}refinement(I,G){return this._refinement((C,N)=>{if(!I(C))return N.addIssue(typeof G==="function"?G(C,N):G),!1;else return!0})}_refinement(I){return new KC({schema:this,typeName:ZI.ZodEffects,effect:{type:"refinement",refinement:I}})}superRefine(I){return this._refinement(I)}constructor(I){this.spa=this.safeParseAsync,this._def=I,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(G)=>this["~validate"](G)}}optional(){return JC.create(this,this._def)}nullable(){return uN.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return AC.create(this)}promise(){return jY.create(this,this._def)}or(I){return tZ.create([this,I],this._def)}and(I){return fZ.create(this,I,this._def)}transform(I){return new KC({...VI(this._def),schema:this,typeName:ZI.ZodEffects,effect:{type:"transform",transform:I}})}default(I){let G=typeof I==="function"?I:()=>I;return new rZ({...VI(this._def),innerType:this,defaultValue:G,typeName:ZI.ZodDefault})}brand(){return new D0({typeName:ZI.ZodBranded,type:this,...VI(this._def)})}catch(I){let G=typeof I==="function"?I:()=>I;return new eZ({...VI(this._def),innerType:this,catchValue:G,typeName:ZI.ZodCatch})}describe(I){return new this.constructor({...this._def,description:I})}pipe(I){return KW.create(this,I)}readonly(){return Ib.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var o9=/^c[^\s-]{8,}$/i,r9=/^[0-9a-z]+$/,e9=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I3=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,G3=/^[a-z0-9_-]{21}$/i,C3=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,N3=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Y3=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Z3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",c2,b3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,W3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,l3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,L3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ah="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",V3=new RegExp(`^${Ah}$`);function Jh(I){let G="[0-5]\\d";if(I.precision)G=`${G}\\.\\d{${I.precision}}`;else if(I.precision==null)G=`${G}(\\.\\d+)?`;let C=I.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${G})${C}`}function X3(I){return new RegExp(`^${Jh(I)}$`)}function ph(I){let G=`${Ah}T${Jh(I)}`,C=[];if(C.push(I.local?"Z?":"Z"),I.offset)C.push("([+-]\\d{2}:?\\d{2})");return G=`${G}(${C.join("|")})`,new RegExp(`^${G}$`)}function R3(I,G){if((G==="v4"||!G)&&b3.test(I))return!0;if((G==="v6"||!G)&&l3.test(I))return!0;return!1}function d3(I,G){if(!C3.test(I))return!1;try{let[C]=I.split(".");if(!C)return!1;let N=C.replace(/-/g,"+").replace(/_/g,"/").padEnd(C.length+(4-C.length%4)%4,"="),Y=JSON.parse(atob(N));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(G&&Y.alg!==G)return!1;return!0}catch{return!1}}function h3(I,G){if((G==="v4"||!G)&&W3.test(I))return!0;if((G==="v6"||!G)&&Q3.test(I))return!0;return!1}class gC extends dI{_parse(I){if(this._def.coerce)I.data=String(I.data);if(this._getType(I)!==M.string){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_type,expected:M.string,received:Y.parsedType}),NI}let C=new VG,N=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(I.data.length<Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),C.dirty()}else if(Y.kind==="max"){if(I.data.length>Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),C.dirty()}else if(Y.kind==="length"){let Z=I.data.length>Y.value,b=I.data.length<Y.value;if(Z||b){if(N=this._getOrReturnCtx(I,N),Z)T(N,{code:U.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(b)T(N,{code:U.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});C.dirty()}}else if(Y.kind==="email"){if(!Y3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"email",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="emoji"){if(!c2)c2=new RegExp(Z3,"u");if(!c2.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"emoji",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="uuid"){if(!I3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"uuid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="nanoid"){if(!G3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"nanoid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="cuid"){if(!o9.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"cuid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="cuid2"){if(!r9.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"cuid2",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="ulid"){if(!e9.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"ulid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="url")try{new URL(I.data)}catch{N=this._getOrReturnCtx(I,N),T(N,{validation:"url",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"regex",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="trim")I.data=I.data.trim();else if(Y.kind==="includes"){if(!I.data.includes(Y.value,Y.position))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),C.dirty()}else if(Y.kind==="toLowerCase")I.data=I.data.toLowerCase();else if(Y.kind==="toUpperCase")I.data=I.data.toUpperCase();else if(Y.kind==="startsWith"){if(!I.data.startsWith(Y.value))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:{startsWith:Y.value},message:Y.message}),C.dirty()}else if(Y.kind==="endsWith"){if(!I.data.endsWith(Y.value))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:{endsWith:Y.value},message:Y.message}),C.dirty()}else if(Y.kind==="datetime"){if(!ph(Y).test(I.data))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:"datetime",message:Y.message}),C.dirty()}else if(Y.kind==="date"){if(!V3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:"date",message:Y.message}),C.dirty()}else if(Y.kind==="time"){if(!X3(Y).test(I.data))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:"time",message:Y.message}),C.dirty()}else if(Y.kind==="duration"){if(!N3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"duration",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="ip"){if(!R3(I.data,Y.version))N=this._getOrReturnCtx(I,N),T(N,{validation:"ip",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="jwt"){if(!d3(I.data,Y.alg))N=this._getOrReturnCtx(I,N),T(N,{validation:"jwt",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="cidr"){if(!h3(I.data,Y.version))N=this._getOrReturnCtx(I,N),T(N,{validation:"cidr",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="base64"){if(!L3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"base64",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="base64url"){if(!m3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"base64url",code:U.invalid_string,message:Y.message}),C.dirty()}else wI.assertNever(Y);return{status:C.value,value:I.data}}_regex(I,G,C){return this.refinement((N)=>I.test(N),{validation:G,code:U.invalid_string,..._.errToObj(C)})}_addCheck(I){return new gC({...this._def,checks:[...this._def.checks,I]})}email(I){return this._addCheck({kind:"email",..._.errToObj(I)})}url(I){return this._addCheck({kind:"url",..._.errToObj(I)})}emoji(I){return this._addCheck({kind:"emoji",..._.errToObj(I)})}uuid(I){return this._addCheck({kind:"uuid",..._.errToObj(I)})}nanoid(I){return this._addCheck({kind:"nanoid",..._.errToObj(I)})}cuid(I){return this._addCheck({kind:"cuid",..._.errToObj(I)})}cuid2(I){return this._addCheck({kind:"cuid2",..._.errToObj(I)})}ulid(I){return this._addCheck({kind:"ulid",..._.errToObj(I)})}base64(I){return this._addCheck({kind:"base64",..._.errToObj(I)})}base64url(I){return this._addCheck({kind:"base64url",..._.errToObj(I)})}jwt(I){return this._addCheck({kind:"jwt",..._.errToObj(I)})}ip(I){return this._addCheck({kind:"ip",..._.errToObj(I)})}cidr(I){return this._addCheck({kind:"cidr",..._.errToObj(I)})}datetime(I){if(typeof I==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:I});return this._addCheck({kind:"datetime",precision:typeof I?.precision>"u"?null:I?.precision,offset:I?.offset??!1,local:I?.local??!1,..._.errToObj(I?.message)})}date(I){return this._addCheck({kind:"date",message:I})}time(I){if(typeof I==="string")return this._addCheck({kind:"time",precision:null,message:I});return this._addCheck({kind:"time",precision:typeof I?.precision>"u"?null:I?.precision,..._.errToObj(I?.message)})}duration(I){return this._addCheck({kind:"duration",..._.errToObj(I)})}regex(I,G){return this._addCheck({kind:"regex",regex:I,..._.errToObj(G)})}includes(I,G){return this._addCheck({kind:"includes",value:I,position:G?.position,..._.errToObj(G?.message)})}startsWith(I,G){return this._addCheck({kind:"startsWith",value:I,..._.errToObj(G)})}endsWith(I,G){return this._addCheck({kind:"endsWith",value:I,..._.errToObj(G)})}min(I,G){return this._addCheck({kind:"min",value:I,..._.errToObj(G)})}max(I,G){return this._addCheck({kind:"max",value:I,..._.errToObj(G)})}length(I,G){return this._addCheck({kind:"length",value:I,..._.errToObj(G)})}nonempty(I){return this.min(1,_.errToObj(I))}trim(){return new gC({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new gC({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new gC({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((I)=>I.kind==="datetime")}get isDate(){return!!this._def.checks.find((I)=>I.kind==="date")}get isTime(){return!!this._def.checks.find((I)=>I.kind==="time")}get isDuration(){return!!this._def.checks.find((I)=>I.kind==="duration")}get isEmail(){return!!this._def.checks.find((I)=>I.kind==="email")}get isURL(){return!!this._def.checks.find((I)=>I.kind==="url")}get isEmoji(){return!!this._def.checks.find((I)=>I.kind==="emoji")}get isUUID(){return!!this._def.checks.find((I)=>I.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((I)=>I.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((I)=>I.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((I)=>I.kind==="cuid2")}get isULID(){return!!this._def.checks.find((I)=>I.kind==="ulid")}get isIP(){return!!this._def.checks.find((I)=>I.kind==="ip")}get isCIDR(){return!!this._def.checks.find((I)=>I.kind==="cidr")}get isBase64(){return!!this._def.checks.find((I)=>I.kind==="base64")}get isBase64url(){return!!this._def.checks.find((I)=>I.kind==="base64url")}get minLength(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I}get maxLength(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I}}gC.create=(I)=>{return new gC({checks:[],typeName:ZI.ZodString,coerce:I?.coerce??!1,...VI(I)})};function c3(I,G){let C=(I.toString().split(".")[1]||"").length,N=(G.toString().split(".")[1]||"").length,Y=C>N?C:N,Z=Number.parseInt(I.toFixed(Y).replace(".","")),b=Number.parseInt(G.toFixed(Y).replace(".",""));return Z%b/10**Y}class oN extends dI{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(I){if(this._def.coerce)I.data=Number(I.data);if(this._getType(I)!==M.number){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_type,expected:M.number,received:Y.parsedType}),NI}let C=void 0,N=new VG;for(let Y of this._def.checks)if(Y.kind==="int"){if(!wI.isInteger(I.data))C=this._getOrReturnCtx(I,C),T(C,{code:U.invalid_type,expected:"integer",received:"float",message:Y.message}),N.dirty()}else if(Y.kind==="min"){if(Y.inclusive?I.data<Y.value:I.data<=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),N.dirty()}else if(Y.kind==="max"){if(Y.inclusive?I.data>Y.value:I.data>=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),N.dirty()}else if(Y.kind==="multipleOf"){if(c3(I.data,Y.value)!==0)C=this._getOrReturnCtx(I,C),T(C,{code:U.not_multiple_of,multipleOf:Y.value,message:Y.message}),N.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(I.data))C=this._getOrReturnCtx(I,C),T(C,{code:U.not_finite,message:Y.message}),N.dirty()}else wI.assertNever(Y);return{status:N.value,value:I.data}}gte(I,G){return this.setLimit("min",I,!0,_.toString(G))}gt(I,G){return this.setLimit("min",I,!1,_.toString(G))}lte(I,G){return this.setLimit("max",I,!0,_.toString(G))}lt(I,G){return this.setLimit("max",I,!1,_.toString(G))}setLimit(I,G,C,N){return new oN({...this._def,checks:[...this._def.checks,{kind:I,value:G,inclusive:C,message:_.toString(N)}]})}_addCheck(I){return new oN({...this._def,checks:[...this._def.checks,I]})}int(I){return this._addCheck({kind:"int",message:_.toString(I)})}positive(I){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(I)})}negative(I){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(I)})}multipleOf(I,G){return this._addCheck({kind:"multipleOf",value:I,message:_.toString(G)})}finite(I){return this._addCheck({kind:"finite",message:_.toString(I)})}safe(I){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(I)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(I)})}get minValue(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I}get maxValue(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I}get isInt(){return!!this._def.checks.find((I)=>I.kind==="int"||I.kind==="multipleOf"&&wI.isInteger(I.value))}get isFinite(){let I=null,G=null;for(let C of this._def.checks)if(C.kind==="finite"||C.kind==="int"||C.kind==="multipleOf")return!0;else if(C.kind==="min"){if(G===null||C.value>G)G=C.value}else if(C.kind==="max"){if(I===null||C.value<I)I=C.value}return Number.isFinite(G)&&Number.isFinite(I)}}oN.create=(I)=>{return new oN({checks:[],typeName:ZI.ZodNumber,coerce:I?.coerce||!1,...VI(I)})};class rN extends dI{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(I){if(this._def.coerce)try{I.data=BigInt(I.data)}catch{return this._getInvalidInput(I)}if(this._getType(I)!==M.bigint)return this._getInvalidInput(I);let C=void 0,N=new VG;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?I.data<Y.value:I.data<=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),N.dirty()}else if(Y.kind==="max"){if(Y.inclusive?I.data>Y.value:I.data>=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),N.dirty()}else if(Y.kind==="multipleOf"){if(I.data%Y.value!==BigInt(0))C=this._getOrReturnCtx(I,C),T(C,{code:U.not_multiple_of,multipleOf:Y.value,message:Y.message}),N.dirty()}else wI.assertNever(Y);return{status:N.value,value:I.data}}_getInvalidInput(I){let G=this._getOrReturnCtx(I);return T(G,{code:U.invalid_type,expected:M.bigint,received:G.parsedType}),NI}gte(I,G){return this.setLimit("min",I,!0,_.toString(G))}gt(I,G){return this.setLimit("min",I,!1,_.toString(G))}lte(I,G){return this.setLimit("max",I,!0,_.toString(G))}lt(I,G){return this.setLimit("max",I,!1,_.toString(G))}setLimit(I,G,C,N){return new rN({...this._def,checks:[...this._def.checks,{kind:I,value:G,inclusive:C,message:_.toString(N)}]})}_addCheck(I){return new rN({...this._def,checks:[...this._def.checks,I]})}positive(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(I)})}negative(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(I)})}multipleOf(I,G){return this._addCheck({kind:"multipleOf",value:I,message:_.toString(G)})}get minValue(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I}get maxValue(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I}}rN.create=(I)=>{return new rN({checks:[],typeName:ZI.ZodBigInt,coerce:I?.coerce??!1,...VI(I)})};class iZ extends dI{_parse(I){if(this._def.coerce)I.data=Boolean(I.data);if(this._getType(I)!==M.boolean){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.boolean,received:C.parsedType}),NI}return uG(I.data)}}iZ.create=(I)=>{return new iZ({typeName:ZI.ZodBoolean,coerce:I?.coerce||!1,...VI(I)})};class DY extends dI{_parse(I){if(this._def.coerce)I.data=new Date(I.data);if(this._getType(I)!==M.date){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_type,expected:M.date,received:Y.parsedType}),NI}if(Number.isNaN(I.data.getTime())){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_date}),NI}let C=new VG,N=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(I.data.getTime()<Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),C.dirty()}else if(Y.kind==="max"){if(I.data.getTime()>Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),C.dirty()}else wI.assertNever(Y);return{status:C.value,value:new Date(I.data.getTime())}}_addCheck(I){return new DY({...this._def,checks:[...this._def.checks,I]})}min(I,G){return this._addCheck({kind:"min",value:I.getTime(),message:_.toString(G)})}max(I,G){return this._addCheck({kind:"max",value:I.getTime(),message:_.toString(G)})}get minDate(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I!=null?new Date(I):null}get maxDate(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I!=null?new Date(I):null}}DY.create=(I)=>{return new DY({checks:[],coerce:I?.coerce||!1,typeName:ZI.ZodDate,...VI(I)})};class vW extends dI{_parse(I){if(this._getType(I)!==M.symbol){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.symbol,received:C.parsedType}),NI}return uG(I.data)}}vW.create=(I)=>{return new vW({typeName:ZI.ZodSymbol,...VI(I)})};class TZ extends dI{_parse(I){if(this._getType(I)!==M.undefined){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.undefined,received:C.parsedType}),NI}return uG(I.data)}}TZ.create=(I)=>{return new TZ({typeName:ZI.ZodUndefined,...VI(I)})};class PZ extends dI{_parse(I){if(this._getType(I)!==M.null){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.null,received:C.parsedType}),NI}return uG(I.data)}}PZ.create=(I)=>{return new PZ({typeName:ZI.ZodNull,...VI(I)})};class qY extends dI{constructor(){super(...arguments);this._any=!0}_parse(I){return uG(I.data)}}qY.create=(I)=>{return new qY({typeName:ZI.ZodAny,...VI(I)})};class _N extends dI{constructor(){super(...arguments);this._unknown=!0}_parse(I){return uG(I.data)}}_N.create=(I)=>{return new _N({typeName:ZI.ZodUnknown,...VI(I)})};class fC extends dI{_parse(I){let G=this._getOrReturnCtx(I);return T(G,{code:U.invalid_type,expected:M.never,received:G.parsedType}),NI}}fC.create=(I)=>{return new fC({typeName:ZI.ZodNever,...VI(I)})};class gW extends dI{_parse(I){if(this._getType(I)!==M.undefined){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.void,received:C.parsedType}),NI}return uG(I.data)}}gW.create=(I)=>{return new gW({typeName:ZI.ZodVoid,...VI(I)})};class AC extends dI{_parse(I){let{ctx:G,status:C}=this._processInputParams(I),N=this._def;if(G.parsedType!==M.array)return T(G,{code:U.invalid_type,expected:M.array,received:G.parsedType}),NI;if(N.exactLength!==null){let Z=G.data.length>N.exactLength.value,b=G.data.length<N.exactLength.value;if(Z||b)T(G,{code:Z?U.too_big:U.too_small,minimum:b?N.exactLength.value:void 0,maximum:Z?N.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:N.exactLength.message}),C.dirty()}if(N.minLength!==null){if(G.data.length<N.minLength.value)T(G,{code:U.too_small,minimum:N.minLength.value,type:"array",inclusive:!0,exact:!1,message:N.minLength.message}),C.dirty()}if(N.maxLength!==null){if(G.data.length>N.maxLength.value)T(G,{code:U.too_big,maximum:N.maxLength.value,type:"array",inclusive:!0,exact:!1,message:N.maxLength.message}),C.dirty()}if(G.common.async)return Promise.all([...G.data].map((Z,b)=>{return N.type._parseAsync(new pC(G,Z,G.path,b))})).then((Z)=>{return VG.mergeArray(C,Z)});let Y=[...G.data].map((Z,b)=>{return N.type._parseSync(new pC(G,Z,G.path,b))});return VG.mergeArray(C,Y)}get element(){return this._def.type}min(I,G){return new AC({...this._def,minLength:{value:I,message:_.toString(G)}})}max(I,G){return new AC({...this._def,maxLength:{value:I,message:_.toString(G)}})}length(I,G){return new AC({...this._def,exactLength:{value:I,message:_.toString(G)}})}nonempty(I){return this.min(1,I)}}AC.create=(I,G)=>{return new AC({type:I,minLength:null,maxLength:null,exactLength:null,typeName:ZI.ZodArray,...VI(G)})};function SZ(I){if(I instanceof iI){let G={};for(let C in I.shape){let N=I.shape[C];G[C]=JC.create(SZ(N))}return new iI({...I._def,shape:()=>G})}else if(I instanceof AC)return new AC({...I._def,type:SZ(I.element)});else if(I instanceof JC)return JC.create(SZ(I.unwrap()));else if(I instanceof uN)return uN.create(SZ(I.unwrap()));else if(I instanceof $C)return $C.create(I.items.map((G)=>SZ(G)));else return I}class iI extends dI{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let I=this._def.shape(),G=wI.objectKeys(I);return this._cached={shape:I,keys:G},this._cached}_parse(I){if(this._getType(I)!==M.object){let l=this._getOrReturnCtx(I);return T(l,{code:U.invalid_type,expected:M.object,received:l.parsedType}),NI}let{status:C,ctx:N}=this._processInputParams(I),{shape:Y,keys:Z}=this._getCached(),b=[];if(!(this._def.catchall instanceof fC&&this._def.unknownKeys==="strip")){for(let l in N.data)if(!Z.includes(l))b.push(l)}let W=[];for(let l of Z){let Q=Y[l],L=N.data[l];W.push({key:{status:"valid",value:l},value:Q._parse(new pC(N,L,N.path,l)),alwaysSet:l in N.data})}if(this._def.catchall instanceof fC){let l=this._def.unknownKeys;if(l==="passthrough")for(let Q of b)W.push({key:{status:"valid",value:Q},value:{status:"valid",value:N.data[Q]}});else if(l==="strict"){if(b.length>0)T(N,{code:U.unrecognized_keys,keys:b}),C.dirty()}else if(l==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let Q of b){let L=N.data[Q];W.push({key:{status:"valid",value:Q},value:l._parse(new pC(N,L,N.path,Q)),alwaysSet:Q in N.data})}}if(N.common.async)return Promise.resolve().then(async()=>{let l=[];for(let Q of W){let L=await Q.key,m=await Q.value;l.push({key:L,value:m,alwaysSet:Q.alwaysSet})}return l}).then((l)=>{return VG.mergeObjectSync(C,l)});else return VG.mergeObjectSync(C,W)}get shape(){return this._def.shape()}strict(I){return _.errToObj,new iI({...this._def,unknownKeys:"strict",...I!==void 0?{errorMap:(G,C)=>{let N=this._def.errorMap?.(G,C).message??C.defaultError;if(G.code==="unrecognized_keys")return{message:_.errToObj(I).message??N};return{message:N}}}:{}})}strip(){return new iI({...this._def,unknownKeys:"strip"})}passthrough(){return new iI({...this._def,unknownKeys:"passthrough"})}extend(I){return new iI({...this._def,shape:()=>({...this._def.shape(),...I})})}merge(I){return new iI({unknownKeys:I._def.unknownKeys,catchall:I._def.catchall,shape:()=>({...this._def.shape(),...I._def.shape()}),typeName:ZI.ZodObject})}setKey(I,G){return this.augment({[I]:G})}catchall(I){return new iI({...this._def,catchall:I})}pick(I){let G={};for(let C of wI.objectKeys(I))if(I[C]&&this.shape[C])G[C]=this.shape[C];return new iI({...this._def,shape:()=>G})}omit(I){let G={};for(let C of wI.objectKeys(this.shape))if(!I[C])G[C]=this.shape[C];return new iI({...this._def,shape:()=>G})}deepPartial(){return SZ(this)}partial(I){let G={};for(let C of wI.objectKeys(this.shape)){let N=this.shape[C];if(I&&!I[C])G[C]=N;else G[C]=N.optional()}return new iI({...this._def,shape:()=>G})}required(I){let G={};for(let C of wI.objectKeys(this.shape))if(I&&!I[C])G[C]=this.shape[C];else{let Y=this.shape[C];while(Y instanceof JC)Y=Y._def.innerType;G[C]=Y}return new iI({...this._def,shape:()=>G})}keyof(){return Kh(wI.objectKeys(this.shape))}}iI.create=(I,G)=>{return new iI({shape:()=>I,unknownKeys:"strip",catchall:fC.create(),typeName:ZI.ZodObject,...VI(G)})};iI.strictCreate=(I,G)=>{return new iI({shape:()=>I,unknownKeys:"strict",catchall:fC.create(),typeName:ZI.ZodObject,...VI(G)})};iI.lazycreate=(I,G)=>{return new iI({shape:I,unknownKeys:"strip",catchall:fC.create(),typeName:ZI.ZodObject,...VI(G)})};class tZ extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C=this._def.options;function N(Y){for(let b of Y)if(b.result.status==="valid")return b.result;for(let b of Y)if(b.result.status==="dirty")return G.common.issues.push(...b.ctx.common.issues),b.result;let Z=Y.map((b)=>new aG(b.ctx.common.issues));return T(G,{code:U.invalid_union,unionErrors:Z}),NI}if(G.common.async)return Promise.all(C.map(async(Y)=>{let Z={...G,common:{...G.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:G.data,path:G.path,parent:Z}),ctx:Z}})).then(N);else{let Y=void 0,Z=[];for(let W of C){let l={...G,common:{...G.common,issues:[]},parent:null},Q=W._parseSync({data:G.data,path:G.path,parent:l});if(Q.status==="valid")return Q;else if(Q.status==="dirty"&&!Y)Y={result:Q,ctx:l};if(l.common.issues.length)Z.push(l.common.issues)}if(Y)return G.common.issues.push(...Y.ctx.common.issues),Y.result;let b=Z.map((W)=>new aG(W));return T(G,{code:U.invalid_union,unionErrors:b}),NI}}get options(){return this._def.options}}tZ.create=(I,G)=>{return new tZ({options:I,typeName:ZI.ZodUnion,...VI(G)})};var FN=(I)=>{if(I instanceof $Z)return FN(I.schema);else if(I instanceof KC)return FN(I.innerType());else if(I instanceof _Z)return[I.value];else if(I instanceof eN)return I.options;else if(I instanceof oZ)return wI.objectValues(I.enum);else if(I instanceof rZ)return FN(I._def.innerType);else if(I instanceof TZ)return[void 0];else if(I instanceof PZ)return[null];else if(I instanceof JC)return[void 0,...FN(I.unwrap())];else if(I instanceof uN)return[null,...FN(I.unwrap())];else if(I instanceof D0)return FN(I.unwrap());else if(I instanceof Ib)return FN(I.unwrap());else if(I instanceof eZ)return FN(I._def.innerType);else return[]};class a0 extends dI{_parse(I){let{ctx:G}=this._processInputParams(I);if(G.parsedType!==M.object)return T(G,{code:U.invalid_type,expected:M.object,received:G.parsedType}),NI;let C=this.discriminator,N=G.data[C],Y=this.optionsMap.get(N);if(!Y)return T(G,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[C]}),NI;if(G.common.async)return Y._parseAsync({data:G.data,path:G.path,parent:G});else return Y._parseSync({data:G.data,path:G.path,parent:G})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(I,G,C){let N=new Map;for(let Y of G){let Z=FN(Y.shape[I]);if(!Z.length)throw Error(`A discriminator value for key \`${I}\` could not be extracted from all schema options`);for(let b of Z){if(N.has(b))throw Error(`Discriminator property ${String(I)} has duplicate value ${String(b)}`);N.set(b,Y)}}return new a0({typeName:ZI.ZodDiscriminatedUnion,discriminator:I,options:G,optionsMap:N,...VI(C)})}}function H2(I,G){let C=tC(I),N=tC(G);if(I===G)return{valid:!0,data:I};else if(C===M.object&&N===M.object){let Y=wI.objectKeys(G),Z=wI.objectKeys(I).filter((W)=>Y.indexOf(W)!==-1),b={...I,...G};for(let W of Z){let l=H2(I[W],G[W]);if(!l.valid)return{valid:!1};b[W]=l.data}return{valid:!0,data:b}}else if(C===M.array&&N===M.array){if(I.length!==G.length)return{valid:!1};let Y=[];for(let Z=0;Z<I.length;Z++){let b=I[Z],W=G[Z],l=H2(b,W);if(!l.valid)return{valid:!1};Y.push(l.data)}return{valid:!0,data:Y}}else if(C===M.date&&N===M.date&&+I===+G)return{valid:!0,data:I};else return{valid:!1}}class fZ extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I),N=(Y,Z)=>{if(E0(Y)||E0(Z))return NI;let b=H2(Y.value,Z.value);if(!b.valid)return T(C,{code:U.invalid_intersection_types}),NI;if(z0(Y)||z0(Z))G.dirty();return{status:G.value,value:b.data}};if(C.common.async)return Promise.all([this._def.left._parseAsync({data:C.data,path:C.path,parent:C}),this._def.right._parseAsync({data:C.data,path:C.path,parent:C})]).then(([Y,Z])=>N(Y,Z));else return N(this._def.left._parseSync({data:C.data,path:C.path,parent:C}),this._def.right._parseSync({data:C.data,path:C.path,parent:C}))}}fZ.create=(I,G,C)=>{return new fZ({left:I,right:G,typeName:ZI.ZodIntersection,...VI(C)})};class $C extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.array)return T(C,{code:U.invalid_type,expected:M.array,received:C.parsedType}),NI;if(C.data.length<this._def.items.length)return T(C,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),NI;if(!this._def.rest&&C.data.length>this._def.items.length)T(C,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G.dirty();let Y=[...C.data].map((Z,b)=>{let W=this._def.items[b]||this._def.rest;if(!W)return null;return W._parse(new pC(C,Z,C.path,b))}).filter((Z)=>!!Z);if(C.common.async)return Promise.all(Y).then((Z)=>{return VG.mergeArray(G,Z)});else return VG.mergeArray(G,Y)}get items(){return this._def.items}rest(I){return new $C({...this._def,rest:I})}}$C.create=(I,G)=>{if(!Array.isArray(I))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new $C({items:I,typeName:ZI.ZodTuple,rest:null,...VI(G)})};class AW extends dI{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.object)return T(C,{code:U.invalid_type,expected:M.object,received:C.parsedType}),NI;let N=[],Y=this._def.keyType,Z=this._def.valueType;for(let b in C.data)N.push({key:Y._parse(new pC(C,b,C.path,b)),value:Z._parse(new pC(C,C.data[b],C.path,b)),alwaysSet:b in C.data});if(C.common.async)return VG.mergeObjectAsync(G,N);else return VG.mergeObjectSync(G,N)}get element(){return this._def.valueType}static create(I,G,C){if(G instanceof dI)return new AW({keyType:I,valueType:G,typeName:ZI.ZodRecord,...VI(C)});return new AW({keyType:gC.create(),valueType:I,typeName:ZI.ZodRecord,...VI(G)})}}class JW extends dI{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.map)return T(C,{code:U.invalid_type,expected:M.map,received:C.parsedType}),NI;let N=this._def.keyType,Y=this._def.valueType,Z=[...C.data.entries()].map(([b,W],l)=>{return{key:N._parse(new pC(C,b,C.path,[l,"key"])),value:Y._parse(new pC(C,W,C.path,[l,"value"]))}});if(C.common.async){let b=new Map;return Promise.resolve().then(async()=>{for(let W of Z){let l=await W.key,Q=await W.value;if(l.status==="aborted"||Q.status==="aborted")return NI;if(l.status==="dirty"||Q.status==="dirty")G.dirty();b.set(l.value,Q.value)}return{status:G.value,value:b}})}else{let b=new Map;for(let W of Z){let{key:l,value:Q}=W;if(l.status==="aborted"||Q.status==="aborted")return NI;if(l.status==="dirty"||Q.status==="dirty")G.dirty();b.set(l.value,Q.value)}return{status:G.value,value:b}}}}JW.create=(I,G,C)=>{return new JW({valueType:G,keyType:I,typeName:ZI.ZodMap,...VI(C)})};class UY extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.set)return T(C,{code:U.invalid_type,expected:M.set,received:C.parsedType}),NI;let N=this._def;if(N.minSize!==null){if(C.data.size<N.minSize.value)T(C,{code:U.too_small,minimum:N.minSize.value,type:"set",inclusive:!0,exact:!1,message:N.minSize.message}),G.dirty()}if(N.maxSize!==null){if(C.data.size>N.maxSize.value)T(C,{code:U.too_big,maximum:N.maxSize.value,type:"set",inclusive:!0,exact:!1,message:N.maxSize.message}),G.dirty()}let Y=this._def.valueType;function Z(W){let l=new Set;for(let Q of W){if(Q.status==="aborted")return NI;if(Q.status==="dirty")G.dirty();l.add(Q.value)}return{status:G.value,value:l}}let b=[...C.data.values()].map((W,l)=>Y._parse(new pC(C,W,C.path,l)));if(C.common.async)return Promise.all(b).then((W)=>Z(W));else return Z(b)}min(I,G){return new UY({...this._def,minSize:{value:I,message:_.toString(G)}})}max(I,G){return new UY({...this._def,maxSize:{value:I,message:_.toString(G)}})}size(I,G){return this.min(I,G).max(I,G)}nonempty(I){return this.min(1,I)}}UY.create=(I,G)=>{return new UY({valueType:I,minSize:null,maxSize:null,typeName:ZI.ZodSet,...VI(G)})};class sZ extends dI{constructor(){super(...arguments);this.validate=this.implement}_parse(I){let{ctx:G}=this._processInputParams(I);if(G.parsedType!==M.function)return T(G,{code:U.invalid_type,expected:M.function,received:G.parsedType}),NI;function C(b,W){return uW({data:b,path:G.path,errorMaps:[G.common.contextualErrorMap,G.schemaErrorMap,xZ(),ON].filter((l)=>!!l),issueData:{code:U.invalid_arguments,argumentsError:W}})}function N(b,W){return uW({data:b,path:G.path,errorMaps:[G.common.contextualErrorMap,G.schemaErrorMap,xZ(),ON].filter((l)=>!!l),issueData:{code:U.invalid_return_type,returnTypeError:W}})}let Y={errorMap:G.common.contextualErrorMap},Z=G.data;if(this._def.returns instanceof jY){let b=this;return uG(async function(...W){let l=new aG([]),Q=await b._def.args.parseAsync(W,Y).catch((X)=>{throw l.addIssue(C(W,X)),l}),L=await Reflect.apply(Z,this,Q);return await b._def.returns._def.type.parseAsync(L,Y).catch((X)=>{throw l.addIssue(N(L,X)),l})})}else{let b=this;return uG(function(...W){let l=b._def.args.safeParse(W,Y);if(!l.success)throw new aG([C(W,l.error)]);let Q=Reflect.apply(Z,this,l.data),L=b._def.returns.safeParse(Q,Y);if(!L.success)throw new aG([N(Q,L.error)]);return L.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...I){return new sZ({...this._def,args:$C.create(I).rest(_N.create())})}returns(I){return new sZ({...this._def,returns:I})}implement(I){return this.parse(I)}strictImplement(I){return this.parse(I)}static create(I,G,C){return new sZ({args:I?I:$C.create([]).rest(_N.create()),returns:G||_N.create(),typeName:ZI.ZodFunction,...VI(C)})}}class $Z extends dI{get schema(){return this._def.getter()}_parse(I){let{ctx:G}=this._processInputParams(I);return this._def.getter()._parse({data:G.data,path:G.path,parent:G})}}$Z.create=(I,G)=>{return new $Z({getter:I,typeName:ZI.ZodLazy,...VI(G)})};class _Z extends dI{_parse(I){if(I.data!==this._def.value){let G=this._getOrReturnCtx(I);return T(G,{received:G.data,code:U.invalid_literal,expected:this._def.value}),NI}return{status:"valid",value:I.data}}get value(){return this._def.value}}_Z.create=(I,G)=>{return new _Z({value:I,typeName:ZI.ZodLiteral,...VI(G)})};function Kh(I,G){return new eN({values:I,typeName:ZI.ZodEnum,...VI(G)})}class eN extends dI{_parse(I){if(typeof I.data!=="string"){let G=this._getOrReturnCtx(I),C=this._def.values;return T(G,{expected:wI.joinValues(C),received:G.parsedType,code:U.invalid_type}),NI}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(I.data)){let G=this._getOrReturnCtx(I),C=this._def.values;return T(G,{received:G.data,code:U.invalid_enum_value,options:C}),NI}return uG(I.data)}get options(){return this._def.values}get enum(){let I={};for(let G of this._def.values)I[G]=G;return I}get Values(){let I={};for(let G of this._def.values)I[G]=G;return I}get Enum(){let I={};for(let G of this._def.values)I[G]=G;return I}extract(I,G=this._def){return eN.create(I,{...this._def,...G})}exclude(I,G=this._def){return eN.create(this.options.filter((C)=>!I.includes(C)),{...this._def,...G})}}eN.create=Kh;class oZ extends dI{_parse(I){let G=wI.getValidEnumValues(this._def.values),C=this._getOrReturnCtx(I);if(C.parsedType!==M.string&&C.parsedType!==M.number){let N=wI.objectValues(G);return T(C,{expected:wI.joinValues(N),received:C.parsedType,code:U.invalid_type}),NI}if(!this._cache)this._cache=new Set(wI.getValidEnumValues(this._def.values));if(!this._cache.has(I.data)){let N=wI.objectValues(G);return T(C,{received:C.data,code:U.invalid_enum_value,options:N}),NI}return uG(I.data)}get enum(){return this._def.values}}oZ.create=(I,G)=>{return new oZ({values:I,typeName:ZI.ZodNativeEnum,...VI(G)})};class jY extends dI{unwrap(){return this._def.type}_parse(I){let{ctx:G}=this._processInputParams(I);if(G.parsedType!==M.promise&&G.common.async===!1)return T(G,{code:U.invalid_type,expected:M.promise,received:G.parsedType}),NI;let C=G.parsedType===M.promise?G.data:Promise.resolve(G.data);return uG(C.then((N)=>{return this._def.type.parseAsync(N,{path:G.path,errorMap:G.common.contextualErrorMap})}))}}jY.create=(I,G)=>{return new jY({type:I,typeName:ZI.ZodPromise,...VI(G)})};class KC extends dI{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZI.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(I){let{status:G,ctx:C}=this._processInputParams(I),N=this._def.effect||null,Y={addIssue:(Z)=>{if(T(C,Z),Z.fatal)G.abort();else G.dirty()},get path(){return C.path}};if(Y.addIssue=Y.addIssue.bind(Y),N.type==="preprocess"){let Z=N.transform(C.data,Y);if(C.common.async)return Promise.resolve(Z).then(async(b)=>{if(G.value==="aborted")return NI;let W=await this._def.schema._parseAsync({data:b,path:C.path,parent:C});if(W.status==="aborted")return NI;if(W.status==="dirty")return aY(W.value);if(G.value==="dirty")return aY(W.value);return W});else{if(G.value==="aborted")return NI;let b=this._def.schema._parseSync({data:Z,path:C.path,parent:C});if(b.status==="aborted")return NI;if(b.status==="dirty")return aY(b.value);if(G.value==="dirty")return aY(b.value);return b}}if(N.type==="refinement"){let Z=(b)=>{let W=N.refinement(b,Y);if(C.common.async)return Promise.resolve(W);if(W instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return b};if(C.common.async===!1){let b=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(b.status==="aborted")return NI;if(b.status==="dirty")G.dirty();return Z(b.value),{status:G.value,value:b.value}}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then((b)=>{if(b.status==="aborted")return NI;if(b.status==="dirty")G.dirty();return Z(b.value).then(()=>{return{status:G.value,value:b.value}})})}if(N.type==="transform")if(C.common.async===!1){let Z=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(!$N(Z))return NI;let b=N.transform(Z.value,Y);if(b instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:G.value,value:b}}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then((Z)=>{if(!$N(Z))return NI;return Promise.resolve(N.transform(Z.value,Y)).then((b)=>({status:G.value,value:b}))});wI.assertNever(N)}}KC.create=(I,G,C)=>{return new KC({schema:I,typeName:ZI.ZodEffects,effect:G,...VI(C)})};KC.createWithPreprocess=(I,G,C)=>{return new KC({schema:G,effect:{type:"preprocess",transform:I},typeName:ZI.ZodEffects,...VI(C)})};class JC extends dI{_parse(I){if(this._getType(I)===M.undefined)return uG(void 0);return this._def.innerType._parse(I)}unwrap(){return this._def.innerType}}JC.create=(I,G)=>{return new JC({innerType:I,typeName:ZI.ZodOptional,...VI(G)})};class uN extends dI{_parse(I){if(this._getType(I)===M.null)return uG(null);return this._def.innerType._parse(I)}unwrap(){return this._def.innerType}}uN.create=(I,G)=>{return new uN({innerType:I,typeName:ZI.ZodNullable,...VI(G)})};class rZ extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C=G.data;if(G.parsedType===M.undefined)C=this._def.defaultValue();return this._def.innerType._parse({data:C,path:G.path,parent:G})}removeDefault(){return this._def.innerType}}rZ.create=(I,G)=>{return new rZ({innerType:I,typeName:ZI.ZodDefault,defaultValue:typeof G.default==="function"?G.default:()=>G.default,...VI(G)})};class eZ extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C={...G,common:{...G.common,issues:[]}},N=this._def.innerType._parse({data:C.data,path:C.path,parent:{...C}});if(MZ(N))return N.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new aG(C.common.issues)},input:C.data})}});else return{status:"valid",value:N.status==="valid"?N.value:this._def.catchValue({get error(){return new aG(C.common.issues)},input:C.data})}}removeCatch(){return this._def.innerType}}eZ.create=(I,G)=>{return new eZ({innerType:I,typeName:ZI.ZodCatch,catchValue:typeof G.catch==="function"?G.catch:()=>G.catch,...VI(G)})};class pW extends dI{_parse(I){if(this._getType(I)!==M.nan){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.nan,received:C.parsedType}),NI}return{status:"valid",value:I.data}}}pW.create=(I)=>{return new pW({typeName:ZI.ZodNaN,...VI(I)})};var H3=Symbol("zod_brand");class D0 extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C=G.data;return this._def.type._parse({data:C,path:G.path,parent:G})}unwrap(){return this._def.type}}class KW extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:C.data,path:C.path,parent:C});if(Y.status==="aborted")return NI;if(Y.status==="dirty")return G.dirty(),aY(Y.value);else return this._def.out._parseAsync({data:Y.value,path:C.path,parent:C})})();else{let N=this._def.in._parseSync({data:C.data,path:C.path,parent:C});if(N.status==="aborted")return NI;if(N.status==="dirty")return G.dirty(),{status:"dirty",value:N.value};else return this._def.out._parseSync({data:N.value,path:C.path,parent:C})}}static create(I,G){return new KW({in:I,out:G,typeName:ZI.ZodPipeline})}}class Ib extends dI{_parse(I){let G=this._def.innerType._parse(I),C=(N)=>{if($N(N))N.value=Object.freeze(N.value);return N};return MZ(G)?G.then((N)=>C(N)):C(G)}unwrap(){return this._def.innerType}}Ib.create=(I,G)=>{return new Ib({innerType:I,typeName:ZI.ZodReadonly,...VI(G)})};function gh(I,G){let C=typeof I==="function"?I(G):typeof I==="string"?{message:I}:I;return typeof C==="string"?{message:C}:C}function yh(I,G={},C){if(I)return qY.create().superRefine((N,Y)=>{let Z=I(N);if(Z instanceof Promise)return Z.then((b)=>{if(!b){let W=gh(G,N),l=W.fatal??C??!0;Y.addIssue({code:"custom",...W,fatal:l})}});if(!Z){let b=gh(G,N),W=b.fatal??C??!0;Y.addIssue({code:"custom",...b,fatal:W})}return});return qY.create()}var w3={object:iI.lazycreate},ZI;(function(I){I.ZodString="ZodString",I.ZodNumber="ZodNumber",I.ZodNaN="ZodNaN",I.ZodBigInt="ZodBigInt",I.ZodBoolean="ZodBoolean",I.ZodDate="ZodDate",I.ZodSymbol="ZodSymbol",I.ZodUndefined="ZodUndefined",I.ZodNull="ZodNull",I.ZodAny="ZodAny",I.ZodUnknown="ZodUnknown",I.ZodNever="ZodNever",I.ZodVoid="ZodVoid",I.ZodArray="ZodArray",I.ZodObject="ZodObject",I.ZodUnion="ZodUnion",I.ZodDiscriminatedUnion="ZodDiscriminatedUnion",I.ZodIntersection="ZodIntersection",I.ZodTuple="ZodTuple",I.ZodRecord="ZodRecord",I.ZodMap="ZodMap",I.ZodSet="ZodSet",I.ZodFunction="ZodFunction",I.ZodLazy="ZodLazy",I.ZodLiteral="ZodLiteral",I.ZodEnum="ZodEnum",I.ZodEffects="ZodEffects",I.ZodNativeEnum="ZodNativeEnum",I.ZodOptional="ZodOptional",I.ZodNullable="ZodNullable",I.ZodDefault="ZodDefault",I.ZodCatch="ZodCatch",I.ZodPromise="ZodPromise",I.ZodBranded="ZodBranded",I.ZodPipeline="ZodPipeline",I.ZodReadonly="ZodReadonly"})(ZI||(ZI={}));var O3=(I,G={message:`Input not instance of ${I.name}`})=>yh((C)=>C instanceof I,G),kh=gC.create,Eh=oN.create,F3=pW.create,u3=rN.create,zh=iZ.create,v3=DY.create,g3=vW.create,A3=TZ.create,J3=PZ.create,p3=qY.create,K3=_N.create,y3=fC.create,k3=gW.create,E3=AC.create,z3=iI.create,a3=iI.strictCreate,D3=tZ.create,q3=a0.create,U3=fZ.create,j3=$C.create,B3=AW.create,n3=JW.create,x3=UY.create,M3=sZ.create,S3=$Z.create,s3=_Z.create,i3=eN.create,T3=oZ.create,P3=jY.create,t3=KC.create,f3=JC.create,$3=uN.create,_3=KC.createWithPreprocess,o3=KW.create,r3=()=>kh().optional(),e3=()=>Eh().optional(),Iz=()=>zh().optional(),Gz={string:(I)=>gC.create({...I,coerce:!0}),number:(I)=>oN.create({...I,coerce:!0}),boolean:(I)=>iZ.create({...I,coerce:!0}),bigint:(I)=>rN.create({...I,coerce:!0}),date:(I)=>DY.create({...I,coerce:!0})};var Cz=NI;import{createHash as Nz}from"crypto";var ah={debug:0,info:1,warn:2,error:3},Yz="info",w2=Yz;function yW(I){w2=I}function Dh(){return w2}function n(I){return Nz("sha256").update("kiro-provider-audit-v1\x00").update(I).digest("hex").slice(0,16)}function y(I,G,C={}){if(ah[I]<ah[w2])return;let N=Object.fromEntries(Object.entries(C).filter((Y)=>Y[1]!==void 0));console.error(JSON.stringify({timestamp:new Date().toISOString(),level:I,event:G,...N}))}import{existsSync as Zz}from"fs";import{homedir as qh}from"os";import{posix as bz,win32 as Wz}from"path";function O2(I){return I===void 0||I.trim().length===0?void 0:I}function vN(I,...G){return I==="win32"?Wz.join(...G):bz.join(...G)}function gN(I={}){let G=I.env??process.env,C=I.platform??process.platform,N=I.homeDirectory??qh();return C==="win32"?O2(G.APPDATA)??vN(C,N,"AppData","Roaming"):O2(G.XDG_CONFIG_HOME)??vN(C,N,".config")}function lz(I={}){let G=I.env??process.env,C=I.platform??process.platform,N=I.homeDirectory??qh();return O2(G.XDG_CONFIG_HOME)??vN(C,N,".config")}function Uh(I={}){let G=I.exists??Zz,C=I.platform??process.platform,N=vN(C,gN(I),"kiro-provider","config.json");if(C!=="win32")return N;let Y=vN(C,lz(I),"kiro-provider","config.json");if(Y!==N&&!G(N)&&G(Y))return Y;return N}var q0=h.enum(["low","medium","high","xhigh","max"]),yC=h.enum(["us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-5","ap-southeast-4","ap-south-1","ap-southeast-6","ap-northeast-3","ap-northeast-2","ap-southeast-1","ap-southeast-2","ap-east-2","ap-southeast-7","ap-northeast-1","ca-central-1","ca-west-1","eu-central-1","eu-west-1","eu-west-2","eu-south-1","eu-west-3","eu-south-2","eu-north-1","eu-central-2","il-central-1","mx-central-1","me-south-1","me-central-1","sa-east-1"]);var Qz=h.array(h.string()).transform((I)=>I.map((G)=>G.trim()).filter((G)=>G.length>0)).refine((I)=>I.length>0,{message:"api_keys must contain at least one non-empty key"}),Lz=h.preprocess((I)=>typeof I==="string"&&I.trim().length===0?null:I,h.string().trim().refine((I)=>URL.canParse(I),{message:"proxy_url must be a valid URL"}).refine((I)=>{if(!URL.canParse(I))return!1;let G=new URL(I).protocol;return G==="http:"||G==="https:"},{message:"proxy_url must be http(s)"}).nullable()).default(null),F2=h.preprocess((I)=>typeof I==="string"&&I.trim().length===0?null:I,h.string().trim().min(1).nullable()).default(null),U0=h.object({host:h.string().trim().min(1).default("127.0.0.1"),port:h.number().int().min(0).max(65535).default(8787),api_keys:Qz,enable_legacy_chat_completions:h.boolean().default(!1),protocol_projection_mode:h.enum(["v3-auto","safe","native-context-safe","legacy-user-prefix"]).default("v3-auto"),responses_fidelity_mode:h.enum(["compatible","strict"]).default("compatible"),responses_instruction_lift:h.enum(["auto","off","experimental"]).default("auto"),responses_native_tool_bridge:h.enum(["auto","off","experimental"]).default("auto"),session_affinity_mode:h.enum(["explicit-only","legacy-initial-input"]).default("explicit-only"),proxy_url:Lz,sdk_http_keep_alive:h.boolean().default(!1),enforce_single_instance:h.boolean().default(!0),instance_lock_path:F2,runtime_endpoint_mode:h.enum(["legacy-q","kiro-runtime"]).default("kiro-runtime"),dynamic_model_catalog:h.boolean().default(!0),model_catalog_ttl_ms:h.number().int().min(1).max(2147483647).default(900000),model_catalog_stale_ttl_ms:h.number().int().min(1).max(2147483647).default(86400000),model_catalog_request_timeout_ms:h.number().int().min(1).max(2147483647).default(1e4),auth_source:h.enum(["local","opencode-shared"]).default("local"),opencode_auth_db_path:F2,default_region:yC.default("us-east-1"),account_selection_strategy:h.enum(["sticky","round-robin","lowest-usage"]).default("lowest-usage"),rate_limit_max_retries:h.number().int().min(0).max(100).default(3),rate_limit_retry_delay_ms:h.number().int().min(1).max(2147483647).default(5000),quota_recheck_interval_ms:h.number().int().min(1).max(2147483647).default(900000),stop_on_overage:h.boolean().default(!0),overage_threshold:h.number().int().min(0).max(1e6).default(0),quota_recheck_timeout_ms:h.number().int().min(1).max(2147483647).default(1e4),quota_recheck_concurrency:h.number().int().min(1).max(32).default(4),account_maintenance_enabled:h.boolean().default(!0),account_maintenance_interval_ms:h.number().int().min(1000).max(2147483647).default(60000),account_maintenance_timeout_ms:h.number().int().min(1000).max(2147483647).default(120000),account_maintenance_concurrency:h.number().int().min(1).max(32).default(4),usage_refresh_interval_ms:h.number().int().min(1000).max(2147483647).default(900000),max_request_iterations:h.number().int().min(1).max(1000).default(20),request_timeout_ms:h.number().int().min(1).max(2147483647).default(120000),stream_idle_timeout_ms:h.number().int().min(1).max(2147483647).default(60000),stream_max_attempts:h.number().int().min(1).max(10).default(3),retry_empty_completion:h.boolean().default(!0),max_request_body_bytes:h.number().int().min(1).max(2147483647).default(10485760),token_expiry_buffer_ms:h.number().int().min(1).max(2147483647).default(300000),session_affinity_ttl_ms:h.number().int().min(1).max(2147483647).default(86400000),session_affinity_max_entries:h.number().int().min(1).max(1e6).default(1e4),reasoning_replay_key_path:F2,reasoning_replay_keys:h.array(h.string().trim().min(1)).default([]),reasoning_replay_ttl_ms:h.number().int().min(1).max(2147483647).default(86400000),reasoning_replay_max_entries:h.number().int().min(1).max(1e6).default(1e4),effort:q0.nullable().default(null),auto_effort_mapping:h.boolean().default(!0),log_level:h.enum(["debug","info","warn","error"]).default("info"),test_upstream_endpoint:h.string().url().optional()});var u2='auth_source "opencode-shared" was removed in kiro-provider 0.7.0. Copy the OpenCode accounts once with "kiro-provider accounts import [--from <path>]", then set auth_source to "local" or delete the key; the provider-owned store (~/.config/kiro-provider/accounts.db) is the only authentication authority.';function Rz(I){if(I.auth_source==="opencode-shared")throw new IY(u2);if(I.opencode_auth_db_path!==null)y("warn","config_opencode_auth_db_path_deprecated",{hint:"opencode_auth_db_path is ignored since 0.7.0 and will be removed; pass --from to kiro-provider accounts import instead"});return I}class IY extends Error{constructor(I,G){super(I,G);this.name="ConfigLoadError"}}var dz=U0.partial().strict(),hz=Object.keys(U0.shape),cz=[{env:"KIRO_PROVIDER_HOST",field:"host",kind:"string"},{env:"KIRO_PROVIDER_PORT",field:"port",kind:"integer"},{env:"KIRO_PROVIDER_API_KEYS",field:"api_keys",kind:"list"},{env:"KIRO_PROVIDER_ENABLE_LEGACY_CHAT_COMPLETIONS",field:"enable_legacy_chat_completions",kind:"boolean"},{env:"KIRO_PROVIDER_PROTOCOL_PROJECTION_MODE",field:"protocol_projection_mode",kind:"string"},{env:"KIRO_PROVIDER_SESSION_AFFINITY_MODE",field:"session_affinity_mode",kind:"string"},{env:"KIRO_PROVIDER_RESPONSES_FIDELITY_MODE",field:"responses_fidelity_mode",kind:"string"},{env:"KIRO_PROVIDER_RESPONSES_INSTRUCTION_LIFT",field:"responses_instruction_lift",kind:"string"},{env:"KIRO_PROVIDER_RESPONSES_NATIVE_TOOL_BRIDGE",field:"responses_native_tool_bridge",kind:"string"},{env:"KIRO_PROVIDER_PROXY_URL",field:"proxy_url",kind:"string"},{env:"KIRO_PROVIDER_SDK_HTTP_KEEP_ALIVE",field:"sdk_http_keep_alive",kind:"boolean"},{env:"KIRO_PROVIDER_ENFORCE_SINGLE_INSTANCE",field:"enforce_single_instance",kind:"boolean"},{env:"KIRO_PROVIDER_INSTANCE_LOCK_PATH",field:"instance_lock_path",kind:"string"},{env:"KIRO_PROVIDER_RUNTIME_ENDPOINT_MODE",field:"runtime_endpoint_mode",kind:"string"},{env:"KIRO_PROVIDER_DYNAMIC_MODEL_CATALOG",field:"dynamic_model_catalog",kind:"boolean"},{env:"KIRO_PROVIDER_MODEL_CATALOG_TTL_MS",field:"model_catalog_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_MODEL_CATALOG_STALE_TTL_MS",field:"model_catalog_stale_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_MODEL_CATALOG_REQUEST_TIMEOUT_MS",field:"model_catalog_request_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_AUTH_SOURCE",field:"auth_source",kind:"string"},{env:"KIRO_PROVIDER_OPENCODE_AUTH_DB_PATH",field:"opencode_auth_db_path",kind:"string"},{env:"KIRO_PROVIDER_DEFAULT_REGION",field:"default_region",kind:"string"},{env:"KIRO_PROVIDER_ACCOUNT_SELECTION_STRATEGY",field:"account_selection_strategy",kind:"string"},{env:"KIRO_PROVIDER_RATE_LIMIT_MAX_RETRIES",field:"rate_limit_max_retries",kind:"integer"},{env:"KIRO_PROVIDER_RATE_LIMIT_RETRY_DELAY_MS",field:"rate_limit_retry_delay_ms",kind:"integer"},{env:"KIRO_PROVIDER_QUOTA_RECHECK_INTERVAL_MS",field:"quota_recheck_interval_ms",kind:"integer"},{env:"KIRO_PROVIDER_STOP_ON_OVERAGE",field:"stop_on_overage",kind:"boolean"},{env:"KIRO_PROVIDER_OVERAGE_THRESHOLD",field:"overage_threshold",kind:"integer"},{env:"KIRO_PROVIDER_QUOTA_RECHECK_TIMEOUT_MS",field:"quota_recheck_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_QUOTA_RECHECK_CONCURRENCY",field:"quota_recheck_concurrency",kind:"integer"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_ENABLED",field:"account_maintenance_enabled",kind:"boolean"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_INTERVAL_MS",field:"account_maintenance_interval_ms",kind:"integer"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_TIMEOUT_MS",field:"account_maintenance_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_CONCURRENCY",field:"account_maintenance_concurrency",kind:"integer"},{env:"KIRO_PROVIDER_USAGE_REFRESH_INTERVAL_MS",field:"usage_refresh_interval_ms",kind:"integer"},{env:"KIRO_PROVIDER_MAX_REQUEST_ITERATIONS",field:"max_request_iterations",kind:"integer"},{env:"KIRO_PROVIDER_REQUEST_TIMEOUT_MS",field:"request_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_STREAM_IDLE_TIMEOUT_MS",field:"stream_idle_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_STREAM_MAX_ATTEMPTS",field:"stream_max_attempts",kind:"integer"},{env:"KIRO_PROVIDER_RETRY_EMPTY_COMPLETION",field:"retry_empty_completion",kind:"boolean"},{env:"KIRO_PROVIDER_MAX_REQUEST_BODY_BYTES",field:"max_request_body_bytes",kind:"integer"},{env:"KIRO_PROVIDER_TOKEN_EXPIRY_BUFFER_MS",field:"token_expiry_buffer_ms",kind:"integer"},{env:"KIRO_PROVIDER_SESSION_AFFINITY_TTL_MS",field:"session_affinity_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_SESSION_AFFINITY_MAX_ENTRIES",field:"session_affinity_max_entries",kind:"integer"},{env:"KIRO_PROVIDER_REASONING_REPLAY_KEY_PATH",field:"reasoning_replay_key_path",kind:"string"},{env:"KIRO_PROVIDER_REASONING_REPLAY_KEYS",field:"reasoning_replay_keys",kind:"list"},{env:"KIRO_PROVIDER_REASONING_REPLAY_TTL_MS",field:"reasoning_replay_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_REASONING_REPLAY_MAX_ENTRIES",field:"reasoning_replay_max_entries",kind:"integer"},{env:"KIRO_PROVIDER_EFFORT",field:"effort",kind:"string"},{env:"KIRO_PROVIDER_AUTO_EFFORT_MAPPING",field:"auto_effort_mapping",kind:"boolean"},{env:"KIRO_PROVIDER_LOG_LEVEL",field:"log_level",kind:"string"},{env:"KIRO_PROVIDER_TEST_UPSTREAM",field:"test_upstream_endpoint",kind:"string"}];function Hz(I){return I===void 0||I.trim().length===0?void 0:I}var wz=/^[+-]?\d+$/;function Oz(I,G){let C=G.trim();if(!wz.test(C))throw new IY(`Invalid environment variable ${I}: expected a decimal integer, got "${G}"`);let N=Number(C);if(!Number.isSafeInteger(N))throw new IY(`Invalid environment variable ${I}: integer out of range, got "${G}"`);return N}function Fz(I){let G=I.trim().toLowerCase();if(G==="true"||G==="1")return!0;if(G==="false"||G==="0")return!1;return I}function uz(I){return I.split(",").map((G)=>G.trim()).filter((G)=>G.length>0)}function vz(I){let G={},C=new Map;for(let{env:N,field:Y,kind:Z}of cz){let b=Hz(I[N]);if(b===void 0)continue;switch(Z){case"integer":G[Y]=Oz(N,b);break;case"boolean":G[Y]=Fz(b);break;case"list":G[Y]=uz(b);break;case"string":G[Y]=b.trim();break}C.set(Y,N)}return{values:G,sources:C}}function gz(I,G){let C=Array.from({length:G.length+1},(N,Y)=>Y);for(let N=1;N<=I.length;N+=1){let Y=C[0];C[0]=N;for(let Z=1;Z<=G.length;Z+=1){let b=C[Z],W=C[Z-1],l=I[N-1]===G[Z-1]?0:1;C[Z]=Math.min(b+1,W+1,Y+l),Y=b}}return C[G.length]}function Az(I){let G=I.toLowerCase(),C;for(let Y of hz){let Z=gz(G,Y);if(C===void 0||Z<C.distance)C={field:Y,distance:Z}}if(!C)return;let N=C.field.startsWith(G)||G.startsWith(C.field);return C.distance<=3||N?C.field:void 0}function Jz(I){let G=I.map((C)=>{let N=Az(C);return N?`"${C}" (did you mean "${N}"?)`:`"${C}"`});return`unknown key${I.length===1?"":"s"} ${G.join(", ")}`}function pz(I,G){if(I.code===h.ZodIssueCode.unrecognized_keys)return Jz(I.keys);let C=I.path.length>0?I.path.join("."):"config",N=G?.get(String(I.path[0]));return`${C}: ${I.message}${N?` (from ${N})`:""}`}function jh(I,G){return I.issues.map((C)=>pz(C,G)).join(", ")}function Kz(I,G){if(G==="win32")return;let C;try{C=Xz(I).mode&511}catch{return}if((C&63)===0)return;y("warn","config_file_permissions_loose",{path:I,mode:`0${C.toString(8)}`,recommended_mode:"0600",hint:"the file may contain api_keys; run chmod 600 on it"})}function yz(I,G){if(!mz(I))return{};Kz(I,G);try{let C=JSON.parse(Vz(I,"utf8"));return dz.parse(C)}catch(C){if(C instanceof h.ZodError)throw new IY(`Invalid configuration file ${I}: ${jh(C)}`,{cause:C});if(C instanceof Error)throw new IY(`Unable to read configuration file ${I}: ${C.message}`,{cause:C});throw C}}function Bh(I={}){let G=I.env??process.env,C=I.platform??process.platform,N=I.configPath??Uh({env:G,platform:C}),Y;try{let Z=yz(N,C),b=vz(G);Y=new Map([...b.sources].filter(([l])=>!(l in(I.overrides??{}))));let W=U0.parse({...Z,...b.values,...I.overrides});return Rz(W)}catch(Z){if(Z instanceof IY)throw Z;if(Z instanceof h.ZodError)throw new IY(`Invalid configuration: ${jh(Z,Y)}`,{cause:Z});throw Z}}class XG extends Error{code;originalError;constructor(I,G,C){super(I);this.name="KiroTokenRefreshError",this.code=G,this.originalError=C}}function j0(I){let G=I.split("|"),C=G[0]??"";if(G.length<2)return{refreshToken:C,authMethod:"desktop"};if(G.at(-1)==="idc")return{refreshToken:C,clientId:G[1],clientSecret:G[2],authMethod:"idc"};return{refreshToken:C,authMethod:"desktop"}}function kW(I,G=120000){if(!I.access||!I.expires)return!0;return Date.now()>=I.expires-G}function Gb(I){if(I.authMethod==="idc"){if(!I.clientId||!I.clientSecret)throw new XG("Missing credentials","MISSING_CREDENTIALS");return`${I.refreshToken}|${I.clientId}|${I.clientSecret}|idc`}return`${I.refreshToken}|desktop`}var kz=["invalid_grant","invalid_client","unauthorized_client","InvalidGrantException","InvalidClientException","UnauthorizedClientException","ExpiredTokenException","InvalidTokenException","ExpiredClientException","Invalid refresh token","Invalid grant provided","Client is expired"],Ez=["MISSING_CREDENTIALS","INVALID_RESPONSE"];function zz(I){return Ez.some((G)=>I===G||I.startsWith(`${G}:`)||I.includes(` ${G}:`))}function _C(I){if(!I)return!1;if(zz(I))return!0;return kz.some((G)=>I.includes(G))}function oC(I){if(!I)return!1;let G=I.toLowerCase();return G.includes("bearer token included in the request is invalid")||G.includes("access token has expired")||G.includes("access_token expired")||G.includes("the access token expired")}var KG={stopOnOverage:!0,overageThreshold:0};function B0(I){return{stopOnOverage:I.stop_on_overage,overageThreshold:I.overage_threshold}}function EW(I){let G=I.usedCount??0,C=I.limitCount??0;return Number.isFinite(G)&&Number.isFinite(C)&&C>0&&G>=C}function az(I){return typeof I==="object"&&I!==null&&typeof I.stopOnOverage==="boolean"&&typeof I.overageThreshold==="number"?I:KG}function zW(I,G){let C=az(G);if(!C.stopOnOverage)return!1;let N=I.overageCount??0;return Number.isFinite(N)&&N>C.overageThreshold}function jI(I,G){return zW(I,G)||EW(I)}function GC(I){return _C(I)}function GY(I){let G=I&&I.length>0?I:"Account needs re-authentication";return _C(G)?G:`InvalidTokenException: ${G}`}function nh(I){return typeof I==="object"&&I!==null&&"code"in I&&typeof I.code==="string"?I.code:void 0}function Cb(I){let G=nh(I),C=I instanceof Error?I.message:String(I);return G?`${G}: ${C}`:C}function aW(I){return{error_name:I instanceof Error?I.name:"UnknownError",error_code:nh(I)}}function xh(I){if(typeof I==="object"&&I!==null&&"unref"in I&&typeof I.unref==="function")I.unref()}class v2{options;initialTimer;intervalTimer;lifecycleController=new AbortController;inFlight;constructor(I){this.options=I}start(){if(!this.options.enabled||this.initialTimer!==void 0||this.intervalTimer!==void 0)return;this.lifecycleController=new AbortController;let I=()=>{this.runOnce(this.lifecycleController.signal).catch((G)=>{if(this.lifecycleController.signal.aborted)return;y("warn","account_maintenance_pass_failed",{...aW(G)})})};this.initialTimer=setTimeout(()=>{this.initialTimer=void 0,I()},this.options.initialDelayMs??5000),this.intervalTimer=setInterval(I,this.options.intervalMs),xh(this.initialTimer),xh(this.intervalTimer),y("info","account_maintenance_started",{interval_ms:this.options.intervalMs,timeout_ms:this.options.timeoutMs,concurrency:this.options.concurrency})}stop(){if(this.initialTimer!==void 0)clearTimeout(this.initialTimer),this.initialTimer=void 0;if(this.intervalTimer!==void 0)clearInterval(this.intervalTimer),this.intervalTimer=void 0;if(!this.lifecycleController.signal.aborted)this.lifecycleController.abort(new DOMException("Account maintenance stopped","AbortError"));y("info","account_maintenance_stopped",{})}runOnce(I){if(!this.options.enabled)return Promise.resolve();if(this.inFlight)return this.inFlight;let G=this.runPass(I).finally(()=>{if(this.inFlight===G)this.inFlight=void 0});return this.inFlight=G,G}async runPass(I){let G=Date.now(),C=AbortSignal.timeout(this.options.timeoutMs),N=I?AbortSignal.any([I,C]):C,Y=this.options.accountManager.reconcileFromDb(),Z=this.overagePolicy(),b=0,W=0,l=[];for(let V of Y){if(GC(V.unhealthyReason)||jI(V,Z))continue;let R=this.authDetails(V);if(R===void 0){W+=1;continue}if(kW(R,this.options.tokenExpiryBufferMs))l.push({account:V,auth:R})}let Q=0,L=async()=>{for(;;){if(N.aborted)throw N.reason;let V=l[Q];if(Q+=1,!V)return;try{await this.options.tokenRefresher.refreshIfNeeded(V.account,V.auth,N),b+=1}catch(R){W+=1,this.recordTokenFailure(V.account,R)}}};await Promise.all(Array.from({length:Math.min(this.options.concurrency,l.length)},L));let m=this.options.accountManager.reconcileFromDb();await this.options.usageRefresher.recheckDueAccounts(m,N);let X=this.options.accountManager.reconcileFromDb();await this.options.usageRefresher.syncDueAccounts(X,N),y("info","account_maintenance_pass_completed",{account_count:X.length,token_due_count:l.length,token_refreshed_count:b,token_failed_count:W,duration_ms:Date.now()-G})}overagePolicy(){return this.options.overagePolicy??this.options.accountManager.getOveragePolicy?.()??KG}authDetails(I){try{return this.options.accountManager.toAuthDetails(I)}catch(G){this.recordTokenFailure(I,G);return}}recordTokenFailure(I,G){let C=Cb(G);if(_C(C))try{this.options.accountManager.markUnhealthy(I,GY(C))}catch{}y("warn","account_maintenance_token_refresh_failed",{account_hash:n(I.id),...aW(G)})}}function Mh(I,G){if(!G)return I;G.start();let C=I.stop.bind(I),N=(Y)=>{try{G.stop()}finally{C(Y)}};try{Object.defineProperty(I,"stop",{configurable:!0,value:N})}catch(Y){try{G.stop()}finally{C(!0)}throw Y}return I}function Dz(I){throw TypeError(`Unsupported account selection strategy: ${String(I)}`)}function BY(I,G,C=KG){if(GC(I.unhealthyReason))return!1;if(jI(I,C))return!1;if(I.rateLimitResetTime>G)return!1;return Sh(I,G)}function Sh(I,G){if(I.isHealthy||oC(I.unhealthyReason))return!0;return I.recoveryTime!==void 0&&I.recoveryTime<=G}function sh(I,G,C=KG){if(!zW(I,C))return!1;if(GC(I.unhealthyReason))return!1;if(EW(I))return!1;return Sh(I,G)}function ih(I,G,C,N=KG){return I.filter((Y)=>BY(Y,G,N)).filter((Y)=>C?.has(Y.id)??!0).sort((Y,Z)=>Y.id.localeCompare(Z.id))}function Th(I,G,C,N=KG){return I.filter((Y)=>BY(Y,G,N)&&(C?.has(Y.id)??!0)).length}class g2{strategy;stickyId;roundRobinCursor=0;constructor(I){this.strategy=I}pick(I,G){return I.find(({id:C})=>C===G)??this.pickByStrategy(I)}retainSticky(I){if(this.stickyId&&!I.some(({id:G})=>G===this.stickyId))this.stickyId=void 0}forget(I){if(this.stickyId===I)this.stickyId=void 0}pickByStrategy(I){switch(this.strategy){case"sticky":{let C=I.find(({id:N})=>N===this.stickyId)??I[0];if(!C)throw RangeError("Candidate list cannot be empty");return this.stickyId=C.id,C}case"round-robin":{let G=I[this.roundRobinCursor%I.length];if(!G)throw RangeError("Candidate list cannot be empty");return this.roundRobinCursor+=1,G}case"lowest-usage":{let G=[...I].sort((C,N)=>(C.usedCount??0)-(N.usedCount??0)||(C.lastUsed??0)-(N.lastUsed??0)||C.id.localeCompare(N.id))[0];if(!G)throw RangeError("Candidate list cannot be empty");return G}default:return Dz(this.strategy)}}}import{createHash as Au}from"crypto";import{Agent as re}from"http";import{Agent as ee}from"https";var LY=CI(EC(),1);var Zl=CI(EC(),1);var bl=CI(EC(),1);var zN=CI(EC(),1);var CC=CI(EC(),1);var aI=CI(qG(),1);var Kb=CI(QY(),1),bu=CI(CY(),1);var CV=CI(d4(),1);var Wl=CI(jG(),1);var lC=CI(SY(),1);var BI=CI(Nl(),1);var hI=CI(pN(),1);var cb=CI(QY(),1);var hb=CI(pN(),1);var eO=async(I,G,C)=>{return{operation:hb.getSmithyContext(G).operation}};function dT(I){return{schemeId:"smithy.api#httpBearerAuth",propertiesExtractor:({profile:G,filepath:C,configFilepath:N,ignoreCache:Y},Z)=>({identityProperties:{profile:G,filepath:C,configFilepath:N,ignoreCache:Y}})}}var IF=(I)=>{let G=[];switch(I.operation){default:G.push(dT(I))}return G},GF=(I)=>{let G=cb.memoizeIdentityProvider(I.token,cb.isIdentityExpired,cb.doesIdentityRequireRefresh);return Object.assign(I,{authSchemePreference:hb.normalizeProvider(I.authSchemePreference??[]),token:G})};var CF=(I)=>{return Object.assign(I,{useDualstackEndpoint:I.useDualstackEndpoint??!1,useFipsEndpoint:I.useFipsEndpoint??!1,defaultSigningName:"amazoncodewhispererstreamingservice"})},NF={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var YF={name:"@aws/codewhisperer-streaming-client",description:"@aws/codewhisperer-streaming-client",version:"1.0.45",scripts:{build:"concurrently 'npm:build:cjs' 'npm:build:es' 'npm:build:types'","build:cjs":"tsc -p tsconfig.cjs.json","build:es":"tsc -p tsconfig.es.json","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",prepack:"npm run clean && npm run build"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{tslib:"^2.6.2","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.974.7","@aws-sdk/middleware-host-header":"^3.972.10","@aws-sdk/middleware-logger":"^3.972.10","@aws-sdk/middleware-recursion-detection":"^3.972.11","@aws-sdk/middleware-user-agent":"^3.972.37","@aws-sdk/region-config-resolver":"^3.972.13","@aws-sdk/token-providers":"^3.1040.0","@aws-sdk/types":"^3.973.8","@aws-sdk/util-endpoints":"^3.996.8","@aws-sdk/util-user-agent-browser":"^3.972.10","@aws-sdk/util-user-agent-node":"^3.973.23","@smithy/config-resolver":"^4.4.17","@smithy/core":"^3.23.17","@smithy/eventstream-serde-browser":"^4.2.14","@smithy/eventstream-serde-config-resolver":"^4.3.14","@smithy/eventstream-serde-node":"^4.2.14","@smithy/fetch-http-handler":"^5.3.17","@smithy/hash-node":"^4.2.14","@smithy/invalid-dependency":"^4.2.14","@smithy/middleware-content-length":"^4.2.14","@smithy/middleware-endpoint":"^4.4.32","@smithy/middleware-retry":"^4.5.7","@smithy/middleware-serde":"^4.2.20","@smithy/middleware-stack":"^4.2.14","@smithy/node-config-provider":"^4.3.14","@smithy/node-http-handler":"^4.6.1","@smithy/protocol-http":"^5.3.14","@smithy/smithy-client":"^4.12.13","@smithy/types":"^4.14.1","@smithy/url-parser":"^4.2.14","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.49","@smithy/util-defaults-mode-node":"^4.2.54","@smithy/util-endpoints":"^3.4.2","@smithy/util-middleware":"^4.2.14","@smithy/util-retry":"^4.3.6","@smithy/util-utf8":"^4.2.2"},devDependencies:{"@tsconfig/node20":"20.1.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3","@types/node":"^20.14.8"},engines:{node:">=20.0.0"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},license:"Apache-2.0"};var e1=CI(EC(),1),Iu=CI(dV(),1);var Ab=CI(qG(),1);var nG=CI(qG(),1);var sF=300000,wb="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var H1=async(I,G={},C)=>{let{SSOOIDCClient:N}=await Promise.resolve().then(() => CI(rV(),1)),Y=(b)=>G.clientConfig?.[b]??G.parentClientConfig?.[b]??C?.[b];return new N(Object.assign({},G.clientConfig??{},{region:I??G.clientConfig?.region,logger:Y("logger"),userAgentAppId:Y("userAgentAppId")}))};var w1=async(I,G,C={},N)=>{let{CreateTokenCommand:Y}=await Promise.resolve().then(() => CI(rV(),1));return(await H1(G,C,N)).send(new Y({clientId:I.clientId,clientSecret:I.clientSecret,refreshToken:I.refreshToken,grantType:"refresh_token"}))};var O1=CI(qG(),1);var eV=(I)=>{if(I.expiration&&I.expiration.getTime()<Date.now())throw new O1.TokenProviderError(`Token is expired. ${wb}`,!1)};var F1=CI(qG(),1);var XY=(I,G,C=!1)=>{if(typeof G>"u")throw new F1.TokenProviderError(`Value not present for '${I}' in SSO Token${C?". Cannot refresh":""}. ${wb}`,!1)};var u1=CI(qG(),1);import{promises as M_}from"fs";var{writeFile:S_}=M_,v1=(I,G)=>{let C=u1.getSSOTokenFilepath(I),N=JSON.stringify(G,null,2);return S_(C,N)};var g1=new Date(0),A1=(I={})=>async({callerClientConfig:G}={})=>{I.logger?.debug("@aws-sdk/token-providers - fromSso");let C=await nG.parseKnownFiles(I),N=nG.getProfileName({profile:I.profile??G?.profile}),Y=C[N];if(!Y)throw new nG.TokenProviderError(`Profile '${N}' could not be found in shared credentials file.`,!1);else if(!Y.sso_session)throw new nG.TokenProviderError(`Profile '${N}' is missing required property 'sso_session'.`);let Z=Y.sso_session,W=(await nG.loadSsoSessionData(I))[Z];if(!W)throw new nG.TokenProviderError(`Sso session '${Z}' could not be found in shared credentials file.`,!1);for(let R of["sso_start_url","sso_region"])if(!W[R])throw new nG.TokenProviderError(`Sso session '${Z}' is missing required property '${R}'.`,!1);let{sso_start_url:l,sso_region:Q}=W,L;try{L=await nG.getSSOTokenFromFile(Z)}catch(R){throw new nG.TokenProviderError(`The SSO session token associated with profile=${N} was not found or is invalid. ${wb}`,!1)}XY("accessToken",L.accessToken),XY("expiresAt",L.expiresAt);let{accessToken:m,expiresAt:X}=L,V={token:m,expiration:new Date(X)};if(V.expiration.getTime()-Date.now()>sF)return V;if(Date.now()-g1.getTime()<30000)return eV(V),V;XY("clientId",L.clientId,!0),XY("clientSecret",L.clientSecret,!0),XY("refreshToken",L.refreshToken,!0);try{g1.setTime(Date.now());let R=await w1(L,Q,I,G);XY("accessToken",R.accessToken),XY("expiresIn",R.expiresIn);let d=new Date(Date.now()+R.expiresIn*1000);try{await v1(Z,{...L,accessToken:R.accessToken,expiresAt:d.toISOString(),refreshToken:R.refreshToken})}catch(c){}return{token:R.accessToken,expiration:d}}catch(R){return eV(V),V}};var IX=(I={})=>Ab.memoize(Ab.chain(A1(I),async()=>{throw new Ab.TokenProviderError("Could not load token from any providers",!1)}),(G)=>G.expiration!==void 0&&G.expiration.getTime()-Date.now()<300000,(G)=>G.expiration!==void 0);var WN=CI(EC(),1);var Gu=CI(QY(),1);var WQ=CI(d4(),1);var GX=CI(UG(),1);var aN=CI(qG(),1);var OQ=CI(B4(),1);var CX=CI(UG(),1);var NX=CI(qG(),1);var ZG=CI(Nl(),1);var _1=CI(t4(),1),o1=CI(QY(),1);var YX=CI(jG(),1);var Jb=CI(UG(),1);var oY=CI(UG(),1);var gG=CI(SY(),1);var cl="ref",rY=-1,lQ=!0,J1="isSet",k1="PartitionResult",QQ="booleanEquals",ZX="getAttr",p1={[cl]:"Endpoint"},bX={[cl]:k1},pb={},K1=[{[cl]:"Region"}],y1={conditions:[[J1,[p1]],[J1,K1],["aws.partition",K1,k1],[QQ,[{[cl]:"UseFIPS"},lQ]],[QQ,[{[cl]:"UseDualStack"},lQ]],[QQ,[{fn:ZX,argv:[bX,"supportsDualStack"]},lQ]],[QQ,[{fn:ZX,argv:[bX,"supportsFIPS"]},lQ]],["stringEquals",[{fn:ZX,argv:[bX,"name"]},"aws-us-gov"]]],results:[[rY],[rY,"Invalid Configuration: FIPS and custom endpoint are not supported"],[rY,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[p1,pb],["https://amazoncodewhispererstreamingservice-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",pb],[rY,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://amazoncodewhispererstreamingservice.{Region}.amazonaws.com",pb],["https://amazoncodewhispererstreamingservice-fips.{Region}.{PartitionResult#dnsSuffix}",pb],[rY,"FIPS is enabled but this partition does not support FIPS"],["https://amazoncodewhispererstreamingservice.{Region}.{PartitionResult#dualStackDnsSuffix}",pb],[rY,"DualStack is enabled but this partition does not support DualStack"],["https://amazoncodewhispererstreamingservice.{Region}.{PartitionResult#dnsSuffix}",pb],[rY,"Invalid Configuration: Missing Region"]]},s_=2,xG=1e8,i_=new Int32Array([-1,1,-1,0,13,3,1,4,xG+12,2,5,xG+12,3,8,6,4,7,xG+11,5,xG+9,xG+10,4,11,9,6,10,xG+8,7,xG+6,xG+7,5,12,xG+5,6,xG+4,xG+5,3,xG+1,14,4,xG+2,xG+3]),E1=gG.BinaryDecisionDiagram.from(i_,s_,y1.conditions,y1.results);var T_=new gG.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),z1=(I,G={})=>{return T_.get(I,()=>gG.decideEndpoint(E1,{endpointParams:I,logger:G.logger}))};gG.customEndpointFunctions.aws=CC.awsEndpointFunctions;var QX=CI(CY(),1);class MG extends hI.ServiceException{constructor(I){super(I);Object.setPrototypeOf(this,MG.prototype)}}class LQ extends MG{name="AccessDeniedException";$fault="client";reason;constructor(I){super({name:"AccessDeniedException",$fault:"client",...I});Object.setPrototypeOf(this,LQ.prototype),this.reason=I.reason}}class mQ extends MG{name="ConflictException";$fault="client";reason;constructor(I){super({name:"ConflictException",$fault:"client",...I});Object.setPrototypeOf(this,mQ.prototype),this.reason=I.reason}}class VQ extends MG{name="InternalServerException";$fault="server";$retryable={};reason;constructor(I){super({name:"InternalServerException",$fault:"server",...I});Object.setPrototypeOf(this,VQ.prototype),this.reason=I.reason}}class XQ extends MG{name="ThrottlingException";$fault="client";$retryable={throttling:!0};reason;constructor(I){super({name:"ThrottlingException",$fault:"client",...I});Object.setPrototypeOf(this,XQ.prototype),this.reason=I.reason}}class RQ extends MG{name="ValidationException";$fault="client";reason;constructor(I){super({name:"ValidationException",$fault:"client",...I});Object.setPrototypeOf(this,RQ.prototype),this.reason=I.reason}}class dQ extends MG{name="ResourceNotFoundException";$fault="client";constructor(I){super({name:"ResourceNotFoundException",$fault:"client",...I});Object.setPrototypeOf(this,dQ.prototype)}}class hQ extends MG{name="ServiceUnavailableException";$fault="server";constructor(I){super({name:"ServiceUnavailableException",$fault:"server",...I});Object.setPrototypeOf(this,hQ.prototype)}}class cQ extends MG{name="ServiceQuotaExceededException";$fault="client";reason;constructor(I){super({name:"ServiceQuotaExceededException",$fault:"client",...I});Object.setPrototypeOf(this,cQ.prototype),this.reason=I.reason}}class HQ extends MG{name="DryRunOperationException";$fault="client";responseCode;constructor(I){super({name:"DryRunOperationException",$fault:"client",...I});Object.setPrototypeOf(this,HQ.prototype),this.responseCode=I.responseCode}}var a1=QX.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazon.aws.codewhisperer.streaming"),P_=[-3,"smithy.ts.sdk.synthetic.com.amazon.aws.codewhisperer.streaming","CodeWhispererStreamingServiceException",0,[],[]];a1.registerError(P_,MG);var lN=QX.TypeRegistry.for("com.amazon.aws.codewhisperer"),t_=[-3,"com.amazon.aws.codewhisperer","AccessDeniedException",{["error"]:"client",["httpError"]:403},["message","reason"],[0,0],1];lN.registerError(t_,LQ);var f_=[-3,"com.amazon.aws.codewhisperer","ConflictException",{["error"]:"client",["httpError"]:409},["message","reason"],[0,0],1];lN.registerError(f_,mQ);var $_=[-3,"com.amazon.aws.codewhisperer","DryRunOperationException",{["error"]:"client"},["message","responseCode"],[0,[1,32]]];lN.registerError($_,HQ);var D1=[-3,"com.amazon.aws.codewhisperer","InternalServerException",{["error"]:"server",["httpError"]:500},["message","reason"],[0,0],1];lN.registerError(D1,VQ);var __=[-3,"com.amazon.aws.codewhisperer","ResourceNotFoundException",{["error"]:"client",["httpError"]:404},["message"],[0],1];lN.registerError(__,dQ);var o_=[-3,"com.amazon.aws.codewhisperer","ServiceQuotaExceededException",{["error"]:"client",["httpError"]:402},["message","reason"],[0,0],1];lN.registerError(o_,cQ);var r_=[-3,"com.amazon.aws.codewhisperer","ServiceUnavailableException",{["error"]:"server",["httpError"]:503},["message"],[0],1];lN.registerError(r_,hQ);var e_=[-3,"com.amazon.aws.codewhisperer","ThrottlingException",{["error"]:"client",["httpError"]:429},["message","reason"],[0,0],1];lN.registerError(e_,XQ);var Io=[-3,"com.amazon.aws.codewhisperer","ValidationException",{["error"]:"client",["httpError"]:400},["message","reason"],[0,0],1];lN.registerError(Io,RQ);var q1=[a1,lN];var LX=[0,"com.amazon.aws.codewhisperer","SensitiveDocument",8,15],II=[0,"com.amazon.aws.codewhisperer","SensitiveString",8,0],Go=[0,"com.amazon.aws.codewhisperer","ToolDescription",8,0],wQ=[0,"com.amazon.aws.codewhisperer","ToolName",8,0],EI=[0,"com.amazon.aws.q","SensitiveString",8,0],Co=[3,"com.amazon.aws.codewhisperer","AdditionalContentEntry",0,["name","description","innerContext"],[[()=>II,0],[()=>II,0],[()=>II,0]],2],No=[3,"com.amazon.aws.codewhisperer","AppStudioState",0,["namespace","propertyName","propertyContext","propertyValue"],[[()=>II,0],[()=>II,0],[()=>II,0],[()=>II,0]],3],Yo=[3,"com.amazon.aws.codewhisperer","AssistantResponseEvent",0,["content","modelId"],[[()=>II,0],0],1],Zo=[3,"com.amazon.aws.codewhisperer","AssistantResponseMessage",0,["content","messageId","supplementaryWebLinks","references","followupPrompt","toolUses","cachePoint","reasoningContent"],[[()=>II,0],0,[()=>t1,0],()=>P1,[()=>U1,0],[()=>nr,0],()=>mX,[()=>Qe,0]],1];var mX=[3,"com.amazon.aws.codewhisperer","CachePoint",0,["type"],[0],1],bo=[3,"com.amazon.aws.codewhisperer","CitationEvent",0,["target","citationLink","citationText"],[()=>Ce,[()=>II,0],[()=>II,0]],2],Wo=[3,"com.amazon.aws.codewhisperer","ClientCacheConfig",0,["useClientCachingOnly"],[2]],lo=[3,"com.amazon.aws.codewhisperer","CodeDescription",0,["href"],[[()=>II,0]],1],Qo=[3,"com.amazon.aws.codewhisperer","CodeEvent",0,["content"],[[()=>II,0]],1],Lo=[3,"com.amazon.aws.codewhisperer","CodeReferenceEvent",0,["references"],[()=>P1]],mo=[3,"com.amazon.aws.codewhisperer","ConsoleState",0,["region","consoleUrl","serviceId","serviceConsolePage","serviceSubconsolePage","taskName","uxErrorMessage"],[0,[()=>II,0],0,0,0,[()=>II,0],[()=>II,0]]],Vo=[3,"com.amazon.aws.codewhisperer","ContextUsageEvent",0,["contextUsagePercentage"],[1]],Xo=[3,"com.amazon.aws.codewhisperer","ConversationState",0,["currentMessage","chatTriggerType","conversationId","workspaceId","history","customizationArn","agentContinuationId","agentTaskType"],[[()=>f1,0],0,0,0,[()=>Kr,0],0,0,0],2],Ro=[3,"com.amazon.aws.codewhisperer","DiagnosticLocation",0,["uri","range"],[[()=>II,0],()=>VX],2],ho=[3,"com.amazon.aws.codewhisperer","DiagnosticRelatedInformation",0,["location","message"],[[()=>Ro,0],[()=>II,0]],2],co=[3,"com.amazon.aws.codewhisperer","DocumentBlock",0,["name","format","source"],[0,0,[()=>be,0]],3],Ho=[3,"com.amazon.aws.codewhisperer","DocumentCitationEvent",0,["source","title","location","sourceContent"],[[()=>II,0],[()=>II,0],[()=>Ze,0],[()=>Er,0]]],wo=[3,"com.amazon.aws.codewhisperer","DocumentCitationSearchResultSpan",0,["searchResultIndex","start","end"],[1,1,1]],Oo=[3,"com.amazon.aws.codewhisperer","DocumentCitationSourceContent",0,["text"],[[()=>II,0]]],WX=[3,"com.amazon.aws.codewhisperer","DocumentCitationSpan",0,["documentIndex","start","end"],[1,1,1]],Fo=[3,"com.amazon.aws.codewhisperer","DocumentCitationWebLocation",0,["url","domain"],[[()=>II,0],[()=>II,0]]],uo=[3,"com.amazon.aws.codewhisperer","DocumentSymbol",0,["name","type","source"],[0,0,0],2],vo=[3,"com.amazon.aws.codewhisperer","DryRunSucceedEvent",0,[],[]],go=[3,"com.amazon.aws.codewhisperer","EditorState",0,["document","cursorState","relevantDocuments","useRelevantDocuments","workspaceFolders"],[[()=>n1,0],()=>Ne,[()=>Dr,0],2,[()=>xr,0]]],Ao=[3,"com.amazon.aws.codewhisperer","EnvironmentVariable",0,["key","value"],[[()=>II,0],[()=>II,0]]],Jo=[3,"com.amazon.aws.codewhisperer","EnvState",0,["operatingSystem","currentWorkingDirectory","environmentVariables","timezoneOffset"],[0,[()=>II,0],[()=>zr,0],1]],U1=[3,"com.amazon.aws.codewhisperer","FollowupPrompt",0,["content","userIntent"],[[()=>II,0],0],1],po=[3,"com.amazon.aws.codewhisperer","FollowupPromptEvent",0,["followupPrompt"],[[()=>U1,0]]],Ko=[3,"com.amazon.aws.codewhisperer","GitState",0,["status"],[[()=>II,0]]],yo=[3,"com.amazon.aws.codewhisperer","ImageBlock",0,["format","source"],[0,[()=>We,0]],2],ko=[3,"com.amazon.aws.codewhisperer","IntentsEvent",0,["intents"],[[()=>er,0]]],Eo=[3,"com.amazon.aws.codewhisperer","InvalidStateEvent",0,["reason","message"],[0,0],2],zo=[3,"com.amazon.aws.codewhisperer","MessageMetadataEvent",0,["conversationId","utteranceId"],[0,0]],ao=[3,"com.amazon.aws.codewhisperer","MetadataEvent",0,["tokenUsage"],[()=>eo]],Do=[3,"com.amazon.aws.codewhisperer","MeteringEvent",0,["usage","unit","unitPlural"],[1,0,0]],lX=[3,"com.amazon.aws.codewhisperer","Position",0,["line","character"],[1,1],2],j1=[3,"com.amazon.aws.codewhisperer","ProgrammingLanguage",0,["languageName"],[0],1],VX=[3,"com.amazon.aws.codewhisperer","Range",0,["start","end"],[()=>lX,()=>lX],2],qo=[3,"com.amazon.aws.codewhisperer","ReasoningContentEvent",8,["text","redactedContent","signature"],[[()=>II,0],21,[()=>II,0]]],Uo=[3,"com.amazon.aws.codewhisperer","ReasoningText",8,["text","signature"],[[()=>II,0],[()=>II,0]],1],jo=[3,"com.amazon.aws.codewhisperer","Reference",0,["licenseName","repository","url","recommendationContentSpan"],[0,0,0,()=>B1]],Bo=[3,"com.amazon.aws.codewhisperer","RelevantTextDocument",0,["relativeFilePath","programmingLanguage","text","documentSymbols","type"],[[()=>II,0],()=>j1,[()=>II,0],()=>T1,0],1],no=[3,"com.amazon.aws.codewhisperer","RuntimeDiagnostic",0,["source","severity","message"],[[()=>II,0],0,[()=>II,0]],3],xo=[3,"com.amazon.aws.codewhisperer","ShellHistoryEntry",0,["command","directory","exitCode","stdout","stderr"],[[()=>II,0],[()=>II,0],1,[()=>II,0],[()=>II,0]],1],Mo=[3,"com.amazon.aws.codewhisperer","ShellState",0,["shellName","shellHistory"],[0,[()=>qr,0]],1],B1=[3,"com.amazon.aws.codewhisperer","Span",0,["start","end"],[1,1]],So=[3,"com.amazon.aws.codewhisperer","SupplementaryWebLink",0,["url","title","snippet"],[[()=>II,0],[()=>II,0],[()=>II,0]],2],so=[3,"com.amazon.aws.codewhisperer","SupplementaryWebLinksEvent",0,["supplementaryWebLinks"],[[()=>t1,0]]],n1=[3,"com.amazon.aws.codewhisperer","TextDocument",0,["relativeFilePath","programmingLanguage","text","documentSymbols"],[[()=>II,0],()=>j1,[()=>II,0],()=>T1],1],io=[3,"com.amazon.aws.codewhisperer","TextDocumentDiagnostic",0,["document","range","source","severity","message","code","codeDescription","tags","relatedInformation","data"],[[()=>n1,0],()=>VX,[()=>II,0],0,[()=>II,0],[()=>II,0],[()=>lo,0],64,[()=>yr,0],[()=>II,0]],5],To=[3,"com.amazon.aws.codewhisperer","ToolInputSchema",0,["json"],[[()=>LX,0]]],x1=[3,"com.amazon.aws.codewhisperer","ToolResult",0,["toolUseId","content","status","toolName"],[0,[()=>Ur,0],0,[()=>wQ,0]],2],Po=[3,"com.amazon.aws.codewhisperer","ToolResultEvent",0,["toolResult"],[[()=>x1,0]]],to=[3,"com.amazon.aws.codewhisperer","ToolSpecification",0,["inputSchema","name","description"],[[()=>To,0],[()=>wQ,0],[()=>Go,0]],2],fo=[3,"com.amazon.aws.codewhisperer","ToolUse",0,["toolUseId","name","input"],[0,[()=>wQ,0],[()=>LX,0]],3],$o=[3,"com.amazon.aws.codewhisperer","ToolUseEvent",0,["toolUseId","name","input","stop"],[0,[()=>wQ,0],[()=>II,0],2],2];var _o=[3,"com.amazon.aws.codewhisperer","UserInputMessage",0,["content","userInputMessageContext","userIntent","origin","images","documents","modelId","cachePoint","clientCacheConfig"],[[()=>II,0],[()=>oo,0],0,0,[()=>ar,0],[()=>kr,0],0,()=>mX,()=>Wo],1],oo=[3,"com.amazon.aws.codewhisperer","UserInputMessageContext",0,["editorState","shellState","gitState","envState","appStudioContext","diagnostic","consoleState","userSettings","additionalContext","toolResults","tools"],[[()=>go,0],[()=>Mo,0],[()=>Ko,0],[()=>Jo,0],[()=>No,0],[()=>Ye,0],[()=>mo,0],()=>ro,[()=>pr,0],[()=>jr,0],[()=>Br,0]]],ro=[3,"com.amazon.aws.codewhisperer","UserSettings",0,["hasConsentedToCrossRegionCalls"],[2]];var eo=[3,"com.amazon.aws.codewhisperer.internal","TokenUsage",0,["uncachedInputTokens","outputTokens","totalTokens","cacheReadInputTokens","cacheWriteInputTokens","contextUsagePercentage","normalizedTokenUsage"],[1,1,1,1,1,1,1],3];var Ir=[3,"com.amazon.aws.codewhisperer.streaming","GenerateAssistantResponseRequest",0,["conversationState","profileArn","agentMode","additionalModelRequestFields"],[[()=>Xo,0],0,[0,{["httpHeader"]:"x-amzn-kiro-agent-mode"}],15],1],Gr=[3,"com.amazon.aws.codewhisperer.streaming","GenerateAssistantResponseResponse",0,["conversationId","generateAssistantResponseResponse"],[[0,{["httpHeader"]:"x-amzn-codewhisperer-conversation-id"}],[()=>Ge,16]],2];var Cr=[3,"com.amazon.aws.q","InteractionComponentsEvent",0,["interactionComponentEntries"],[[()=>ir,0]],1],XX=[3,"com.amazon.aws.q.interactioncomponents","Action",0,["webLink","moduleLink"],[[()=>Jr,0],[()=>Vr,0]]],RX=[3,"com.amazon.aws.q.interactioncomponents","Alert",0,["type","content"],[0,[()=>Mr,0]],2],Nr=[3,"com.amazon.aws.q.interactioncomponents","AlertComponent",0,["text"],[[()=>Hl,0]]],Yr=[3,"com.amazon.aws.q.interactioncomponents","Clarification",0,["questions","dismissible"],[[()=>sr,0],2],1],Zr=[3,"com.amazon.aws.q.interactioncomponents","ClarificationAnswerOption",0,["label","value"],[[()=>EI,0],[()=>EI,0]],2],br=[3,"com.amazon.aws.q.interactioncomponents","ClarificationQuestion",0,["question","options","allowCustom","skippable"],[[()=>EI,0],[()=>Sr,0],2,2],2],Wr=[3,"com.amazon.aws.q.interactioncomponents","CloudWatchTroubleshootingLink",0,["label","investigationPayload","defaultText"],[[()=>EI,0],[()=>EI,0],[()=>EI,0]],2],M1=[3,"com.amazon.aws.q.interactioncomponents","InfrastructureUpdate",0,["transition"],[[()=>lr,0]]],lr=[3,"com.amazon.aws.q.interactioncomponents","InfrastructureUpdateTransition",0,["currentState","nextState"],[[()=>EI,0],[()=>EI,0]],2],Qr=[3,"com.amazon.aws.q.interactioncomponents","InlineArtifact",0,["dsl","summary","title","artifactLabel"],[[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0]],4],Lr=[3,"com.amazon.aws.q.interactioncomponents","InteractionComponent",0,["text","alert","infrastructureUpdate","progress","step","taskDetails","taskReference","suggestions","section","resource","resourceList","action","clarification","inlineArtifact"],[[()=>Hl,0],[()=>RX,0],[()=>M1,0],[()=>S1,0],[()=>i1,0],[()=>vr,0],()=>Ar,[()=>Hr,0],[()=>Rr,0],[()=>dX,0],[()=>s1,0],[()=>XX,0],[()=>Yr,0],[()=>Qr,0]]],mr=[3,"com.amazon.aws.q.interactioncomponents","InteractionComponentEntry",0,["interactionComponent","interactionComponentId"],[[()=>Lr,0],0],1],Vr=[3,"com.amazon.aws.q.interactioncomponents","ModuleLink",0,["cloudWatchTroubleshootingLink"],[[()=>Wr,0]]],S1=[3,"com.amazon.aws.q.interactioncomponents","Progress",0,["content"],[[()=>Tr,0]],1],Xr=[3,"com.amazon.aws.q.interactioncomponents","ProgressComponent",0,["step"],[[()=>i1,0]]],dX=[3,"com.amazon.aws.q.interactioncomponents","Resource",0,["title","link","description","type","ARN","resourceJsonString"],[[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0]],6],s1=[3,"com.amazon.aws.q.interactioncomponents","ResourceList",0,["items","action"],[[()=>Pr,0],[()=>XX,0]],1],Rr=[3,"com.amazon.aws.q.interactioncomponents","Section",0,["title","content","action"],[[()=>EI,0],[()=>tr,0],[()=>XX,0]],2],dr=[3,"com.amazon.aws.q.interactioncomponents","SectionComponent",0,["text","alert","resource","resourceList"],[[()=>Hl,0],[()=>RX,0],[()=>dX,0],[()=>s1,0]]],i1=[3,"com.amazon.aws.q.interactioncomponents","Step",0,["id","state","label","content"],[1,0,[()=>EI,0],[()=>fr,0]],3],hr=[3,"com.amazon.aws.q.interactioncomponents","StepComponent",0,["text"],[[()=>Hl,0]]],cr=[3,"com.amazon.aws.q.interactioncomponents","Suggestion",0,["value"],[[()=>EI,0]],1],Hr=[3,"com.amazon.aws.q.interactioncomponents","Suggestions",0,["items"],[[()=>$r,0]],1],wr=[3,"com.amazon.aws.q.interactioncomponents","TaskAction",0,["label","payload","note","primary","disabled","confirmation"],[[()=>EI,0],[()=>Ie,0],[()=>Fr,0],2,2,[()=>Or,0]],2],Or=[3,"com.amazon.aws.q.interactioncomponents","TaskActionConfirmation",0,["content"],[[()=>EI,0]]],Fr=[3,"com.amazon.aws.q.interactioncomponents","TaskActionNote",0,["content","type"],[[()=>EI,0],0],1],ur=[3,"com.amazon.aws.q.interactioncomponents","TaskComponent",0,["text","infrastructureUpdate","alert","progress"],[[()=>Hl,0],[()=>M1,0],[()=>RX,0],[()=>S1,0]]],vr=[3,"com.amazon.aws.q.interactioncomponents","TaskDetails",0,["overview","content","actions"],[[()=>gr,0],[()=>or,0],[()=>_r,0]],2],gr=[3,"com.amazon.aws.q.interactioncomponents","TaskOverview",0,["label","description"],[[()=>EI,0],[()=>EI,0]],2],Ar=[3,"com.amazon.aws.q.interactioncomponents","TaskReference",0,["taskId"],[0],1],Hl=[3,"com.amazon.aws.q.interactioncomponents","Text",0,["content"],[[()=>EI,0]],1],Jr=[3,"com.amazon.aws.q.interactioncomponents","WebLink",0,["label","url"],[[()=>EI,0],[()=>EI,0]],2];var pr=[1,"com.amazon.aws.codewhisperer","AdditionalContentList",0,[()=>Co,0]],Kr=[1,"com.amazon.aws.codewhisperer","ChatHistory",0,[()=>f1,0]],yr=[1,"com.amazon.aws.codewhisperer","DiagnosticRelatedInformationList",0,[()=>ho,0]];var kr=[1,"com.amazon.aws.codewhisperer","DocumentBlocks",0,[()=>co,0]],Er=[1,"com.amazon.aws.codewhisperer","DocumentCitationSourceContents",0,[()=>Oo,0]],T1=[1,"com.amazon.aws.codewhisperer","DocumentSymbols",0,()=>uo],zr=[1,"com.amazon.aws.codewhisperer","EnvironmentVariables",0,[()=>Ao,0]],ar=[1,"com.amazon.aws.codewhisperer","ImageBlocks",0,[()=>yo,0]],P1=[1,"com.amazon.aws.codewhisperer","References",0,()=>jo],Dr=[1,"com.amazon.aws.codewhisperer","RelevantDocumentList",0,[()=>Bo,0]],qr=[1,"com.amazon.aws.codewhisperer","ShellHistory",0,[()=>xo,0]],t1=[1,"com.amazon.aws.codewhisperer","SupplementaryWebLinks",0,[()=>So,0]],Ur=[1,"com.amazon.aws.codewhisperer","ToolResultContent",0,[()=>me,0]],jr=[1,"com.amazon.aws.codewhisperer","ToolResults",0,[()=>x1,0]],Br=[1,"com.amazon.aws.codewhisperer","Tools",0,[()=>Le,0]],nr=[1,"com.amazon.aws.codewhisperer","ToolUses",0,[()=>fo,0]],xr=[1,"com.amazon.aws.codewhisperer","WorkspaceFolderList",0,[()=>II,0]],Mr=[1,"com.amazon.aws.q.interactioncomponents","AlertComponentList",0,[()=>Nr,0]],Sr=[1,"com.amazon.aws.q.interactioncomponents","ClarificationAnswerOptionsList",0,[()=>Zr,0]],sr=[1,"com.amazon.aws.q.interactioncomponents","ClarificationQuestionList",0,[()=>br,0]],ir=[1,"com.amazon.aws.q.interactioncomponents","InteractionComponentEntryList",0,[()=>mr,0]],Tr=[1,"com.amazon.aws.q.interactioncomponents","ProgressComponentList",0,[()=>Xr,0]],Pr=[1,"com.amazon.aws.q.interactioncomponents","Resources",0,[()=>dX,0]],tr=[1,"com.amazon.aws.q.interactioncomponents","SectionComponentList",0,[()=>dr,0]],fr=[1,"com.amazon.aws.q.interactioncomponents","StepComponentList",0,[()=>hr,0]],$r=[1,"com.amazon.aws.q.interactioncomponents","SuggestionList",0,[()=>cr,0]],_r=[1,"com.amazon.aws.q.interactioncomponents","TaskActionList",0,[()=>wr,0]],or=[1,"com.amazon.aws.q.interactioncomponents","TaskComponentList",0,[()=>ur,0]],rr=[2,"com.amazon.aws.codewhisperer","IntentData",8,0,()=>le],er=[2,"com.amazon.aws.codewhisperer","IntentMap",0,[0,0],[()=>rr,0]],Ie=[2,"com.amazon.aws.q.interactioncomponents","TaskActionPayload",0,[0,0],[()=>EI,0]],f1=[4,"com.amazon.aws.codewhisperer","ChatMessage",0,["userInputMessage","assistantResponseMessage"],[[()=>_o,0],[()=>Zo,0]]],Ge=[4,"com.amazon.aws.codewhisperer","ChatResponseStream",{["streaming"]:1},["messageMetadataEvent","assistantResponseEvent","reasoningContentEvent","dryRunSucceedEvent","codeReferenceEvent","supplementaryWebLinksEvent","followupPromptEvent","codeEvent","intentsEvent","interactionComponentsEvent","toolUseEvent","toolResultEvent","metadataEvent","meteringEvent","contextUsageEvent","citationEvent","documentCitationEvent","invalidStateEvent","error"],[()=>zo,[()=>Yo,0],[()=>qo,0],()=>vo,()=>Lo,[()=>so,0],[()=>po,0],[()=>Qo,0],[()=>ko,0],[()=>Cr,0],[()=>$o,0],[()=>Po,0],()=>ao,()=>Do,()=>Vo,[()=>bo,0],[()=>Ho,0],()=>Eo,[()=>D1,0]]],Ce=[4,"com.amazon.aws.codewhisperer","CitationTarget",0,["location","range"],[1,()=>B1]],Ne=[4,"com.amazon.aws.codewhisperer","CursorState",0,["position","range"],[()=>lX,()=>VX]],Ye=[4,"com.amazon.aws.codewhisperer","Diagnostic",0,["textDocumentDiagnostic","runtimeDiagnostic"],[[()=>io,0],[()=>no,0]]],Ze=[4,"com.amazon.aws.codewhisperer","DocumentCitationLocation",0,["documentPage","documentChar","documentChunk","searchResult","web"],[()=>WX,()=>WX,()=>WX,()=>wo,[()=>Fo,0]]],be=[4,"com.amazon.aws.codewhisperer","DocumentSource",8,["bytes"],[21]];var We=[4,"com.amazon.aws.codewhisperer","ImageSource",8,["bytes"],[21]],le=[4,"com.amazon.aws.codewhisperer","IntentDataType",0,["string"],[0]],Qe=[4,"com.amazon.aws.codewhisperer","ReasoningContent",8,["reasoningText","redactedContent"],[[()=>Uo,0],21]];var Le=[4,"com.amazon.aws.codewhisperer","Tool",0,["toolSpecification","cachePoint"],[[()=>to,0],()=>mX]],me=[4,"com.amazon.aws.codewhisperer","ToolResultContentBlock",0,["text","json"],[[()=>II,0],[()=>LX,0]]];var $1=[9,"com.amazon.aws.codewhisperer.streaming","GenerateAssistantResponse",{["http"]:["POST","/generateAssistantResponse",200]},()=>Ir,()=>Gr];var r1=(I)=>{return{apiVersion:"2023-11-27",base64Decoder:I?.base64Decoder??Jb.fromBase64,base64Encoder:I?.base64Encoder??Jb.toBase64,disableHostPrefix:I?.disableHostPrefix??!1,endpointProvider:I?.endpointProvider??z1,extensions:I?.extensions??[],httpAuthSchemeProvider:I?.httpAuthSchemeProvider??IF,httpAuthSchemes:I?.httpAuthSchemes??[{schemeId:"smithy.api#httpBearerAuth",identityProvider:(G)=>G.getIdentityProvider("smithy.api#httpBearerAuth"),signer:new o1.HttpBearerAuthSigner}],logger:I?.logger??new hI.NoOpLogger,protocol:I?.protocol??_1.AwsRestJsonProtocol,protocolSettings:I?.protocolSettings??{defaultNamespace:"com.amazon.aws.codewhisperer.streaming",errorTypeRegistries:q1,version:"2023-11-27",serviceTarget:"AmazonCodeWhispererStreamingService"},serviceId:I?.serviceId??"CodeWhispererStreaming",urlParser:I?.urlParser??YX.parseUrl,utf8Decoder:I?.utf8Decoder??oY.fromUtf8,utf8Encoder:I?.utf8Encoder??oY.toUtf8}};var Cu=(I)=>{hI.emitWarningIfUnsupportedVersion(process.version);let G=NX.resolveDefaultsModeConfig(I),C=()=>G().then(hI.loadConfigsForDefaultMode),N=r1(I);e1.emitWarningIfUnsupportedVersion(process.version);let Y={profile:I?.profile,logger:N.logger};return{...N,...I,runtime:"node",defaultsMode:G,authSchemePreference:I?.authSchemePreference??aN.loadConfig(Iu.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,Y),bodyLengthChecker:I?.bodyLengthChecker??CX.calculateBodyLength,defaultUserAgentProvider:I?.defaultUserAgentProvider??WN.createDefaultUserAgentProvider({serviceId:N.serviceId,clientVersion:YF.version}),eventStreamSerdeProvider:I?.eventStreamSerdeProvider??WQ.eventStreamSerdeProvider,httpAuthSchemes:I?.httpAuthSchemes??[{schemeId:"smithy.api#httpBearerAuth",identityProvider:(Z)=>Z.getIdentityProvider("smithy.api#httpBearerAuth")||(async(b)=>{return await IX(b)(b)}),signer:new Gu.HttpBearerAuthSigner}],maxAttempts:I?.maxAttempts??aN.loadConfig(BI.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,I),region:I?.region??aN.loadConfig(aI.NODE_REGION_CONFIG_OPTIONS,{...aI.NODE_REGION_CONFIG_FILE_OPTIONS,...Y}),requestHandler:OQ.NodeHttpHandler.create(I?.requestHandler??C),retryMode:I?.retryMode??aN.loadConfig({...BI.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await C()).retryMode||ZG.DEFAULT_RETRY_MODE},I),sha256:I?.sha256??GX.Hash.bind(null,"sha256"),streamCollector:I?.streamCollector??OQ.streamCollector,useDualstackEndpoint:I?.useDualstackEndpoint??aN.loadConfig(aI.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,Y),useFipsEndpoint:I?.useFipsEndpoint??aN.loadConfig(aI.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,Y),userAgentAppId:I?.userAgentAppId??aN.loadConfig(WN.NODE_APP_ID_CONFIG_OPTIONS,Y)}};var NC=CI(EC(),1);var SG=CI(jG(),1);var Nu=(I)=>{let{httpAuthSchemes:G,httpAuthSchemeProvider:C,token:N}=I;return{setHttpAuthScheme(Y){let Z=G.findIndex((b)=>b.schemeId===Y.schemeId);if(Z===-1)G.push(Y);else G.splice(Z,1,Y)},httpAuthSchemes(){return G},setHttpAuthSchemeProvider(Y){C=Y},httpAuthSchemeProvider(){return C},setToken(Y){N=Y},token(){return N}}},Yu=(I)=>{return{httpAuthSchemes:I.httpAuthSchemes(),httpAuthSchemeProvider:I.httpAuthSchemeProvider(),token:I.token()}};var Zu=(I,G)=>{let C=Object.assign(NC.getAwsRegionExtensionConfiguration(I),hI.getDefaultExtensionConfiguration(I),SG.getHttpHandlerExtensionConfiguration(I),Nu(I));return G.forEach((N)=>N.configure(C)),Object.assign(I,NC.resolveAwsRegionExtensionConfiguration(C),hI.resolveDefaultRuntimeConfig(C),SG.resolveHttpHandlerRuntimeConfig(C),Yu(C))};class hX extends hI.Client{config;constructor(...[I]){let G=Cu(I||{});super(G);this.initConfig=G;let C=CF(G),N=zN.resolveUserAgentConfig(C),Y=BI.resolveRetryConfig(N),Z=aI.resolveRegionConfig(Y),b=LY.resolveHostHeaderConfig(Z),W=lC.resolveEndpointConfig(b),l=CC.resolveDefaultAwsRegionalEndpointsConfig(W),Q=CV.resolveEventStreamSerdeConfig(l),L=GF(Q),m=Zu(L,I?.extensions||[]);this.config=m,this.middlewareStack.use(bu.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(zN.getUserAgentPlugin(this.config)),this.middlewareStack.use(BI.getRetryPlugin(this.config)),this.middlewareStack.use(Wl.getContentLengthPlugin(this.config)),this.middlewareStack.use(LY.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Zl.getLoggerPlugin(this.config)),this.middlewareStack.use(bl.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(Kb.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:eO,identityProviderConfigProvider:async(X)=>new Kb.DefaultIdentityProviderConfig({"smithy.api#httpBearerAuth":X.token})})),this.middlewareStack.use(Kb.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class cX extends hI.Command.classBuilder().ep(NF).m(function(I,G,C,N){return[lC.getEndpointPlugin(C,I.getEndpointParameterInstructions())]}).s("AmazonCodeWhispererStreamingService","GenerateAssistantResponse",{eventStream:{output:!0}}).n("CodeWhispererStreamingClient","GenerateAssistantResponseCommand").sc($1).build(){}var VC={CONTENT_LENGTH_EXCEEDS_THRESHOLD:"CONTENT_LENGTH_EXCEEDS_THRESHOLD",DOCUMENT_COUNT_EXCEEDED:"DOCUMENT_COUNT_EXCEEDED",DOCUMENT_DUPLICATE_NAME:"DOCUMENT_DUPLICATE_NAME",DOCUMENT_MAXIMUM_PAGES_EXCEEDED:"DOCUMENT_MAXIMUM_PAGES_EXCEEDED",DOCUMENT_MODEL_NOT_SUPPORTED:"DOCUMENT_MODEL_NOT_SUPPORTED",DOCUMENT_PASSWORD_PROTECTED:"DOCUMENT_PASSWORD_PROTECTED",DOCUMENT_SIZE_EXCEEDED:"DOCUMENT_SIZE_EXCEEDED",IMAGE_COUNT_EXCEEDED:"IMAGE_COUNT_EXCEEDED",IMAGE_DIMENSION_EXCEEDED:"IMAGE_DIMENSION_EXCEEDED",IMAGE_FORMAT_UNSUPPORTED:"IMAGE_FORMAT_UNSUPPORTED",IMAGE_MIME_MISMATCH:"IMAGE_MIME_MISMATCH",IMAGE_SIZE_EXCEEDED:"IMAGE_SIZE_EXCEEDED",INVALID_CONVERSATION_ID:"INVALID_CONVERSATION_ID",INVALID_KMS_GRANT:"INVALID_KMS_GRANT",INVALID_MODEL_ID:"INVALID_MODEL_ID",PROMPT_TOO_LONG:"PROMPT_TOO_LONG",REQUEST_BODY_INVALID:"REQUEST_BODY_INVALID",REQUEST_BODY_INVALID_JSON:"REQUEST_BODY_INVALID_JSON",THINKING_SIGNATURE_INVALID:"THINKING_SIGNATURE_INVALID",TOOL_CONFIG_MISSING:"TOOL_CONFIG_MISSING",TOOL_DUPLICATE:"TOOL_DUPLICATE",TOOL_SCHEMA_INVALID:"TOOL_SCHEMA_INVALID",TOOL_USE_RESULT_MISMATCH:"TOOL_USE_RESULT_MISMATCH"},FQ={CONVERSATION_LIMIT_EXCEEDED:"CONVERSATION_LIMIT_EXCEEDED",MONTHLY_REQUEST_COUNT:"MONTHLY_REQUEST_COUNT",OVERAGE_REQUEST_LIMIT_EXCEEDED:"OVERAGE_REQUEST_LIMIT_EXCEEDED"};var Ju=CI(t4(),1),pu=CI(B4(),1);var Fu=CI(OX(),1);import*as LN from"net";import*as Ol from"tls";import te from"assert";import*as hu from"net";import*as cu from"http";import{Agent as Pe}from"https";var QN=Symbol("AgentBaseInternalState");class FX extends cu.Agent{constructor(I){super(I);this[QN]={}}isSecureEndpoint(I){if(I){if(typeof I.secureEndpoint==="boolean")return I.secureEndpoint;if(typeof I.protocol==="string")return I.protocol==="https:"}let{stack:G}=Error();if(typeof G!=="string")return!1;return G.split(`
|
|
57
|
+
GFS4: `),console.error(I)};if(!PI[wG]){if(ed=global[wG]||[],fE(PI,ed),PI.close=function(I){function G(C,N){return I.call(PI,C,function(Y){if(!Y)tE();if(typeof N==="function")N.apply(this,arguments)})}return Object.defineProperty(G,Y2,{value:I}),G}(PI.close),PI.closeSync=function(I){function G(C){I.apply(PI,arguments),tE()}return Object.defineProperty(G,Y2,{value:I}),G}(PI.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){DZ(PI[wG]),KI("assert").equal(PI[wG].length,0)})}var ed;if(!global[wG])fE(global,PI[wG]);Ch.exports=Ih(VRI(PI));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!PI.__patched)Ch.exports=Ih(PI),PI.__patched=!0;function Ih(I){LRI(I),I.gracefulify=Ih,I.createReadStream=O,I.createWriteStream=g;var G=I.readFile;I.readFile=C;function C(J,a,k){if(typeof a==="function")k=a,a=null;return q(J,a,k);function q(A,K,E,s){return G(A,K,function(D){if(D&&(D.code==="EMFILE"||D.code==="ENFILE"))RW([q,[A,K,E],D,s||Date.now(),Date.now()]);else if(typeof E==="function")E.apply(this,arguments)})}}var N=I.writeFile;I.writeFile=Y;function Y(J,a,k,q){if(typeof k==="function")q=k,k=null;return A(J,a,k,q);function A(K,E,s,D,r){return N(K,E,s,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}var Z=I.appendFile;if(Z)I.appendFile=b;function b(J,a,k,q){if(typeof k==="function")q=k,k=null;return A(J,a,k,q);function A(K,E,s,D,r){return Z(K,E,s,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}var W=I.copyFile;if(W)I.copyFile=l;function l(J,a,k,q){if(typeof k==="function")q=k,k=0;return A(J,a,k,q);function A(K,E,s,D,r){return W(K,E,s,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}var Q=I.readdir;I.readdir=m;var L=/^v[0-5]\./;function m(J,a,k){if(typeof a==="function")k=a,a=null;var q=L.test(process.version)?function(E,s,D,r){return Q(E,A(E,s,D,r))}:function(E,s,D,r){return Q(E,s,A(E,s,D,r))};return q(J,a,k);function A(K,E,s,D){return function(r,f){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))RW([q,[K,E,s],r,D||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof s==="function")s.call(this,r,f)}}}}if(process.version.substr(0,4)==="v0.8"){var X=mRI(I);H=X.ReadStream,v=X.WriteStream}var V=I.ReadStream;if(V)H.prototype=Object.create(V.prototype),H.prototype.open=w;var R=I.WriteStream;if(R)v.prototype=Object.create(R.prototype),v.prototype.open=u;Object.defineProperty(I,"ReadStream",{get:function(){return H},set:function(J){H=J},enumerable:!0,configurable:!0}),Object.defineProperty(I,"WriteStream",{get:function(){return v},set:function(J){v=J},enumerable:!0,configurable:!0});var d=H;Object.defineProperty(I,"FileReadStream",{get:function(){return d},set:function(J){d=J},enumerable:!0,configurable:!0});var c=v;Object.defineProperty(I,"FileWriteStream",{get:function(){return c},set:function(J){c=J},enumerable:!0,configurable:!0});function H(J,a){if(this instanceof H)return V.apply(this,arguments),this;else return H.apply(Object.create(H.prototype),arguments)}function w(){var J=this;z(J.path,J.flags,J.mode,function(a,k){if(a){if(J.autoClose)J.destroy();J.emit("error",a)}else J.fd=k,J.emit("open",k),J.read()})}function v(J,a){if(this instanceof v)return R.apply(this,arguments),this;else return v.apply(Object.create(v.prototype),arguments)}function u(){var J=this;z(J.path,J.flags,J.mode,function(a,k){if(a)J.destroy(),J.emit("error",a);else J.fd=k,J.emit("open",k)})}function O(J,a){return new I.ReadStream(J,a)}function g(J,a){return new I.WriteStream(J,a)}var F=I.open;I.open=z;function z(J,a,k,q){if(typeof k==="function")q=k,k=null;return A(J,a,k,q);function A(K,E,s,D,r){return F(K,E,s,function(f,mI){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))RW([A,[K,E,s,D],f,r||Date.now(),Date.now()]);else if(typeof D==="function")D.apply(this,arguments)})}}return I}function RW(I){DZ("ENQUEUE",I[0].name,I[1]),PI[wG].push(I),Gh()}var N2;function tE(){var I=Date.now();for(var G=0;G<PI[wG].length;++G)if(PI[wG][G].length>2)PI[wG][G][3]=I,PI[wG][G][4]=I;Gh()}function Gh(){if(clearTimeout(N2),N2=void 0,PI[wG].length===0)return;var I=PI[wG].shift(),G=I[0],C=I[1],N=I[2],Y=I[3],Z=I[4];if(Y===void 0)DZ("RETRY",G.name,C),G.apply(null,C);else if(Date.now()-Y>=60000){DZ("TIMEOUT",G.name,C);var b=C.pop();if(typeof b==="function")b.call(null,N)}else{var W=Date.now()-Z,l=Math.max(Z-Y,1),Q=Math.min(l*1.2,100);if(W>=Q)DZ("RETRY",G.name,C),G.apply(null,C.concat([Y]));else PI[wG].push(I)}if(N2===void 0)N2=setTimeout(Gh,0)}});var _E=p((EKI,$E)=>{function FC(I,G){if(typeof G==="boolean")G={forever:G};if(this._originalTimeouts=JSON.parse(JSON.stringify(I)),this._timeouts=I,this._options=G||{},this._maxRetryTime=G&&G.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}$E.exports=FC;FC.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};FC.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};FC.prototype.retry=function(I){if(this._timeout)clearTimeout(this._timeout);if(!I)return!1;var G=new Date().getTime();if(I&&G-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(I);var C=this._timeouts.shift();if(C===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),C=this._timeouts.shift();else return!1;var N=this,Y=setTimeout(function(){if(N._attempts++,N._operationTimeoutCb){if(N._timeout=setTimeout(function(){N._operationTimeoutCb(N._attempts)},N._operationTimeout),N._options.unref)N._timeout.unref()}N._fn(N._attempts)},C);if(this._options.unref)Y.unref();return!0};FC.prototype.attempt=function(I,G){if(this._fn=I,G){if(G.timeout)this._operationTimeout=G.timeout;if(G.cb)this._operationTimeoutCb=G.cb}var C=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){C._operationTimeoutCb()},C._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};FC.prototype.try=function(I){console.log("Using RetryOperation.try() is deprecated"),this.attempt(I)};FC.prototype.start=function(I){console.log("Using RetryOperation.start() is deprecated"),this.attempt(I)};FC.prototype.start=FC.prototype.try;FC.prototype.errors=function(){return this._errors};FC.prototype.attempts=function(){return this._attempts};FC.prototype.mainError=function(){if(this._errors.length===0)return null;var I={},G=null,C=0;for(var N=0;N<this._errors.length;N++){var Y=this._errors[N],Z=Y.message,b=(I[Z]||0)+1;if(I[Z]=b,b>=C)G=Y,C=b}return G}});var rE=p((dRI)=>{var RRI=_E();dRI.operation=function(I){var G=dRI.timeouts(I);return new RRI(G,{forever:I&&I.forever,unref:I&&I.unref,maxRetryTime:I&&I.maxRetryTime})};dRI.timeouts=function(I){if(I instanceof Array)return[].concat(I);var G={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var C in I)G[C]=I[C];if(G.minTimeout>G.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var N=[];for(var Y=0;Y<G.retries;Y++)N.push(this.createTimeout(Y,G));if(I&&I.forever&&!N.length)N.push(this.createTimeout(Y,G));return N.sort(function(Z,b){return Z-b}),N};dRI.createTimeout=function(I,G){var C=G.randomize?Math.random()+1:1,N=Math.round(C*G.minTimeout*Math.pow(G.factor,I));return N=Math.min(N,G.maxTimeout),N};dRI.wrap=function(I,G,C){if(G instanceof Array)C=G,G=null;if(!C){C=[];for(var N in I)if(typeof I[N]==="function")C.push(N)}for(var Y=0;Y<C.length;Y++){var Z=C[Y],b=I[Z];I[Z]=function(l){var Q=dRI.operation(G),L=Array.prototype.slice.call(arguments,1),m=L.pop();L.push(function(X){if(Q.retry(X))return;if(X)arguments[0]=Q.mainError();m.apply(this,arguments)}),Q.attempt(function(){l.apply(I,L)})}.bind(I,b),I[Z].options=G}}});var eE=p((aKI,Z2)=>{Z2.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Z2.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Z2.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var I9=p((DKI,hW)=>{var sI=global.process,qZ=function(I){return I&&typeof I==="object"&&typeof I.removeListener==="function"&&typeof I.emit==="function"&&typeof I.reallyExit==="function"&&typeof I.listeners==="function"&&typeof I.kill==="function"&&typeof I.pid==="number"&&typeof I.on==="function"};if(!qZ(sI))hW.exports=function(){return function(){}};else{if(Yh=KI("assert"),UZ=eE(),Zh=/^win/i.test(sI.platform),dW=KI("events"),typeof dW!=="function")dW=dW.EventEmitter;if(sI.__signal_exit_emitter__)WG=sI.__signal_exit_emitter__;else WG=sI.__signal_exit_emitter__=new dW,WG.count=0,WG.emitted={};if(!WG.infinite)WG.setMaxListeners(1/0),WG.infinite=!0;hW.exports=function(I,G){if(!qZ(global.process))return function(){};if(Yh.equal(typeof I,"function","a callback must be provided for exit handler"),jZ===!1)b2();var C="exit";if(G&&G.alwaysLast)C="afterexit";var N=function(){if(WG.removeListener(C,I),WG.listeners("exit").length===0&&WG.listeners("afterexit").length===0)O0()};return WG.on(C,I),N},O0=function(){if(!jZ||!qZ(global.process))return;jZ=!1,UZ.forEach(function(G){try{sI.removeListener(G,F0[G])}catch(C){}}),sI.emit=u0,sI.reallyExit=W2,WG.count-=1},hW.exports.unload=O0,EY=function(G,C,N){if(WG.emitted[G])return;WG.emitted[G]=!0,WG.emit(G,C,N)},F0={},UZ.forEach(function(I){F0[I]=function(){if(!qZ(global.process))return;var C=sI.listeners(I);if(C.length===WG.count){if(O0(),EY("exit",null,I),EY("afterexit",null,I),Zh&&I==="SIGHUP")I="SIGINT";sI.kill(sI.pid,I)}}}),hW.exports.signals=function(){return UZ},jZ=!1,b2=function(){if(jZ||!qZ(global.process))return;jZ=!0,WG.count+=1,UZ=UZ.filter(function(G){try{return sI.on(G,F0[G]),!0}catch(C){return!1}}),sI.emit=Wh,sI.reallyExit=bh},hW.exports.load=b2,W2=sI.reallyExit,bh=function(G){if(!qZ(global.process))return;sI.exitCode=G||0,EY("exit",sI.exitCode,null),EY("afterexit",sI.exitCode,null),W2.call(sI,sI.exitCode)},u0=sI.emit,Wh=function(G,C){if(G==="exit"&&qZ(global.process)){if(C!==void 0)sI.exitCode=C;var N=u0.apply(this,arguments);return EY("exit",sI.exitCode,null),EY("afterexit",sI.exitCode,null),N}else return u0.apply(this,arguments)}}var Yh,UZ,Zh,dW,WG,O0,EY,F0,jZ,b2,W2,bh,u0,Wh});var C9=p((FRI,lh)=>{var G9=Symbol();function wRI(I,G,C){let N=G[G9];if(N)return G.stat(I,(Z,b)=>{if(Z)return C(Z);C(null,b.mtime,N)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);G.utimes(I,Y,Y,(Z)=>{if(Z)return C(Z);G.stat(I,(b,W)=>{if(b)return C(b);let l=W.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(G,G9,{value:l}),C(null,W.mtime,l)})})}function ORI(I){let G=Date.now();if(I==="s")G=Math.ceil(G/1000)*1000;return new Date(G)}FRI.probe=wRI;FRI.getMtime=ORI});var W9=p((kRI,g0)=>{var gRI=KI("path"),mh=Nh(),ARI=rE(),JRI=I9(),N9=C9(),PN={};function v0(I,G){return G.lockfilePath||`${I}.lock`}function Vh(I,G,C){if(!G.realpath)return C(null,gRI.resolve(I));G.fs.realpath(I,C)}function Lh(I,G,C){let N=v0(I,G);G.fs.mkdir(N,(Y)=>{if(!Y)return N9.probe(N,G.fs,(Z,b,W)=>{if(Z)return G.fs.rmdir(N,()=>{}),C(Z);C(null,b,W)});if(Y.code!=="EEXIST")return C(Y);if(G.stale<=0)return C(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:I}));G.fs.stat(N,(Z,b)=>{if(Z){if(Z.code==="ENOENT")return Lh(I,{...G,stale:0},C);return C(Z)}if(!Y9(b,G))return C(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:I}));Z9(I,G,(W)=>{if(W)return C(W);Lh(I,{...G,stale:0},C)})})})}function Y9(I,G){return I.mtime.getTime()<Date.now()-G.stale}function Z9(I,G,C){G.fs.rmdir(v0(I,G),(N)=>{if(N&&N.code!=="ENOENT")return C(N);C()})}function l2(I,G){let C=PN[I];if(C.updateTimeout)return;if(C.updateDelay=C.updateDelay||G.update,C.updateTimeout=setTimeout(()=>{C.updateTimeout=null,G.fs.stat(C.lockfilePath,(N,Y)=>{let Z=C.lastUpdate+G.stale<Date.now();if(N){if(N.code==="ENOENT"||Z)return Qh(I,C,Object.assign(N,{code:"ECOMPROMISED"}));return C.updateDelay=1000,l2(I,G)}if(C.mtime.getTime()!==Y.mtime.getTime())return Qh(I,C,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let W=N9.getMtime(C.mtimePrecision);G.fs.utimes(C.lockfilePath,W,W,(l)=>{let Q=C.lastUpdate+G.stale<Date.now();if(C.released)return;if(l){if(l.code==="ENOENT"||Q)return Qh(I,C,Object.assign(l,{code:"ECOMPROMISED"}));return C.updateDelay=1000,l2(I,G)}C.mtime=W,C.lastUpdate=Date.now(),C.updateDelay=null,l2(I,G)})})},C.updateDelay),C.updateTimeout.unref)C.updateTimeout.unref()}function Qh(I,G,C){if(G.released=!0,G.updateTimeout)clearTimeout(G.updateTimeout);if(PN[I]===G)delete PN[I];G.options.onCompromised(C)}function pRI(I,G,C){G={stale:1e4,update:null,realpath:!0,retries:0,fs:mh,onCompromised:(N)=>{throw N},...G},G.retries=G.retries||0,G.retries=typeof G.retries==="number"?{retries:G.retries}:G.retries,G.stale=Math.max(G.stale||0,2000),G.update=G.update==null?G.stale/2:G.update||0,G.update=Math.max(Math.min(G.update,G.stale/2),1000),Vh(I,G,(N,Y)=>{if(N)return C(N);let Z=ARI.operation(G.retries);Z.attempt(()=>{Lh(Y,G,(b,W,l)=>{if(Z.retry(b))return;if(b)return C(Z.mainError());let Q=PN[Y]={lockfilePath:v0(Y,G),mtime:W,mtimePrecision:l,options:G,lastUpdate:Date.now()};l2(Y,G),C(null,(L)=>{if(Q.released)return L&&L(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));b9(Y,{...G,realpath:!1},L)})})})})}function b9(I,G,C){G={fs:mh,realpath:!0,...G},Vh(I,G,(N,Y)=>{if(N)return C(N);let Z=PN[Y];if(!Z)return C(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Z.updateTimeout&&clearTimeout(Z.updateTimeout),Z.released=!0,delete PN[Y],Z9(Y,G,C)})}function KRI(I,G,C){G={stale:1e4,realpath:!0,fs:mh,...G},G.stale=Math.max(G.stale||0,2000),Vh(I,G,(N,Y)=>{if(N)return C(N);G.fs.stat(v0(Y,G),(Z,b)=>{if(Z)return Z.code==="ENOENT"?C(null,!1):C(Z);return C(null,!Y9(b,G))})})}function yRI(){return PN}JRI(()=>{for(let I in PN){let G=PN[I].options;try{G.fs.rmdirSync(v0(I,G))}catch(C){}}});kRI.lock=pRI;kRI.unlock=b9;kRI.check=KRI;kRI.getLocks=yRI});var Q9=p((qKI,l9)=>{var qRI=Nh();function URI(I){let G=["mkdir","realpath","stat","rmdir","utimes"],C={...I};return G.forEach((N)=>{C[N]=(...Y)=>{let Z=Y.pop(),b;try{b=I[`${N}Sync`](...Y)}catch(W){return Z(W)}Z(null,b)}}),C}function jRI(I){return(...G)=>new Promise((C,N)=>{G.push((Y,Z)=>{if(Y)N(Y);else C(Z)}),I(...G)})}function BRI(I){return(...G)=>{let C,N;if(G.push((Y,Z)=>{C=Y,N=Z}),I(...G),C)throw C;return N}}function nRI(I){if(I={...I},I.fs=URI(I.fs||qRI),typeof I.retries==="number"&&I.retries>0||I.retries&&typeof I.retries.retries==="number"&&I.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return I}l9.exports={toPromise:jRI,toSync:BRI,toSyncOptions:nRI}});var m9=p((UKI,zY)=>{var cW=W9(),{toPromise:Q2,toSync:L2,toSyncOptions:Xh}=Q9();async function L9(I,G){let C=await Q2(cW.lock)(I,G);return Q2(C)}function xRI(I,G){let C=L2(cW.lock)(I,Xh(G));return L2(C)}function MRI(I,G){return Q2(cW.unlock)(I,G)}function SRI(I,G){return L2(cW.unlock)(I,Xh(G))}function sRI(I,G){return Q2(cW.check)(I,G)}function iRI(I,G){return L2(cW.check)(I,Xh(G))}zY.exports=L9;zY.exports.lock=L9;zY.exports.unlock=MRI;zY.exports.lockSync=xRI;zY.exports.unlockSync=SRI;zY.exports.check=sRI;zY.exports.checkSync=iRI});import{createInterface as DdI}from"readline/promises";var Fh={name:"@sunerpy/kiro-provider",version:"3.2.6",description:"OpenAI Responses-compatible AWS KiroRuntime provider with native and stateless fallback transports",homepage:"https://github.com/sunerpy/kiro-provider#readme",bugs:"https://github.com/sunerpy/kiro-provider/issues",license:"MIT",repository:{type:"git",url:"git+https://github.com/sunerpy/kiro-provider.git"},bin:{"kiro-provider":"dist/cli.js"},files:["dist/cli.js","README.md","LICENSE"],type:"module",publishConfig:{access:"public"},scripts:{fmt:"oxfmt --ignore-path .oxfmtignore --write '**/*.{yml,yaml,json,md}' && biome check --write ./src ./scripts ./__tests__",lint:"biome check ./src ./scripts ./__tests__",typecheck:"tsc --noEmit",test:"bun test",build:"bun run build:npm","build:binary":"bun build --compile --minify src/cli/bin.ts --outfile dist/kiro-provider","build:npm":"bun build src/cli/bin.ts --outfile dist/cli.js --target=bun --minify && chmod +x dist/cli.js","probe:projection-fidelity":"bun run scripts/probe-projection-fidelity.ts","probe:v3-fields":"bun run scripts/probe-v3-request-fields.ts","probe:v3-create-response":"bun run scripts/probe-v3-create-response.ts","study:effort":"bun run scripts/effort-study.ts","study:effort:run":"bun run scripts/run-effort-study.ts","study:effort:responses":"bun run scripts/responses-effort-study.ts","e2e:responses":"bun run scripts/responses-live-e2e.ts","diff:kiro-cli-wire":"bun run scripts/kiro-cli-wire-diff.ts",prepublishOnly:"bun run build:npm","docs:links":"bun run scripts/check-markdown-links.ts","fmt:check":"oxfmt --ignore-path .oxfmtignore --check '**/*.{yml,yaml,json,md}' && biome check ./src ./scripts ./__tests__",check:"bun run fmt:check && bun run typecheck && bun run lint && bun run docs:links && bun run test && bun run build"},dependencies:{"@aws-sdk/core":"3.975.3","@aws/codewhisperer-streaming-client":"^1.0.34","@smithy/node-http-handler":"4.9.7",ajv:"8.20.0","https-proxy-agent":"^9.1.0","js-tiktoken":"1.0.21","proper-lockfile":"^4.1.2",zod:"^3.24.0"},devDependencies:{"@ai-sdk/openai":"4.0.66","@biomejs/biome":"2.2.4","@types/bun":"^1.3.6","@types/node":"^20.0.0","@types/proper-lockfile":"^4.1.4",ai:"7.0.99",openai:"7.13.0",oxfmt:"0.64.0",typescript:"^5.7.3"},engines:{bun:">=1.3.14"},packageManager:"bun@1.3.14"};import{existsSync as mz,readFileSync as Vz,statSync as Xz}from"fs";var h={};T9(h,{void:()=>k3,util:()=>wI,unknown:()=>K3,union:()=>D3,undefined:()=>A3,tuple:()=>j3,transformer:()=>t3,symbol:()=>g3,string:()=>kh,strictObject:()=>a3,setErrorMap:()=>$9,set:()=>x3,record:()=>B3,quotelessJson:()=>t9,promise:()=>P3,preprocess:()=>_3,pipeline:()=>o3,ostring:()=>r3,optional:()=>f3,onumber:()=>e3,oboolean:()=>Iz,objectUtil:()=>h2,object:()=>z3,number:()=>Eh,nullable:()=>$3,null:()=>J3,never:()=>y3,nativeEnum:()=>T3,nan:()=>F3,map:()=>n3,makeIssue:()=>uW,literal:()=>s3,lazy:()=>S3,late:()=>w3,isValid:()=>$N,isDirty:()=>z0,isAsync:()=>MZ,isAborted:()=>E0,intersection:()=>U3,instanceof:()=>O3,getParsedType:()=>tC,getErrorMap:()=>xZ,function:()=>M3,enum:()=>i3,effect:()=>t3,discriminatedUnion:()=>q3,defaultErrorMap:()=>ON,datetimeRegex:()=>ph,date:()=>v3,custom:()=>yh,coerce:()=>Gz,boolean:()=>zh,bigint:()=>u3,array:()=>E3,any:()=>p3,addIssueToContext:()=>T,ZodVoid:()=>gW,ZodUnknown:()=>_N,ZodUnion:()=>tZ,ZodUndefined:()=>TZ,ZodType:()=>dI,ZodTuple:()=>$C,ZodTransformer:()=>KC,ZodSymbol:()=>vW,ZodString:()=>gC,ZodSet:()=>UY,ZodSchema:()=>dI,ZodRecord:()=>AW,ZodReadonly:()=>Ib,ZodPromise:()=>jY,ZodPipeline:()=>KW,ZodParsedType:()=>M,ZodOptional:()=>JC,ZodObject:()=>iI,ZodNumber:()=>oN,ZodNullable:()=>uN,ZodNull:()=>PZ,ZodNever:()=>fC,ZodNativeEnum:()=>oZ,ZodNaN:()=>pW,ZodMap:()=>JW,ZodLiteral:()=>_Z,ZodLazy:()=>$Z,ZodIssueCode:()=>U,ZodIntersection:()=>fZ,ZodFunction:()=>sZ,ZodFirstPartyTypeKind:()=>ZI,ZodError:()=>aG,ZodEnum:()=>eN,ZodEffects:()=>KC,ZodDiscriminatedUnion:()=>a0,ZodDefault:()=>rZ,ZodDate:()=>DY,ZodCatch:()=>eZ,ZodBranded:()=>D0,ZodBoolean:()=>iZ,ZodBigInt:()=>rN,ZodArray:()=>AC,ZodAny:()=>qY,Schema:()=>dI,ParseStatus:()=>VG,OK:()=>uG,NEVER:()=>Cz,INVALID:()=>NI,EMPTY_PATH:()=>_9,DIRTY:()=>aY,BRAND:()=>H3});var wI;(function(I){I.assertEqual=(Y)=>{};function G(Y){}I.assertIs=G;function C(Y){throw Error()}I.assertNever=C,I.arrayToEnum=(Y)=>{let Z={};for(let b of Y)Z[b]=b;return Z},I.getValidEnumValues=(Y)=>{let Z=I.objectKeys(Y).filter((W)=>typeof Y[Y[W]]!=="number"),b={};for(let W of Z)b[W]=Y[W];return I.objectValues(b)},I.objectValues=(Y)=>{return I.objectKeys(Y).map(function(Z){return Y[Z]})},I.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let Z=[];for(let b in Y)if(Object.prototype.hasOwnProperty.call(Y,b))Z.push(b);return Z},I.find=(Y,Z)=>{for(let b of Y)if(Z(b))return b;return},I.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function N(Y,Z=" | "){return Y.map((b)=>typeof b==="string"?`'${b}'`:b).join(Z)}I.joinValues=N,I.jsonStringifyReplacer=(Y,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(wI||(wI={}));var h2;(function(I){I.mergeShapes=(G,C)=>{return{...G,...C}}})(h2||(h2={}));var M=wI.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tC=(I)=>{switch(typeof I){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(I)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray(I))return M.array;if(I===null)return M.null;if(I.then&&typeof I.then==="function"&&I.catch&&typeof I.catch==="function")return M.promise;if(typeof Map<"u"&&I instanceof Map)return M.map;if(typeof Set<"u"&&I instanceof Set)return M.set;if(typeof Date<"u"&&I instanceof Date)return M.date;return M.object;default:return M.unknown}};var U=wI.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),t9=(I)=>{return JSON.stringify(I,null,2).replace(/"([^"]+)":/g,"$1:")};class aG extends Error{get errors(){return this.issues}constructor(I){super();this.issues=[],this.addIssue=(C)=>{this.issues=[...this.issues,C]},this.addIssues=(C=[])=>{this.issues=[...this.issues,...C]};let G=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,G);else this.__proto__=G;this.name="ZodError",this.issues=I}format(I){let G=I||function(Y){return Y.message},C={_errors:[]},N=(Y)=>{for(let Z of Y.issues)if(Z.code==="invalid_union")Z.unionErrors.map(N);else if(Z.code==="invalid_return_type")N(Z.returnTypeError);else if(Z.code==="invalid_arguments")N(Z.argumentsError);else if(Z.path.length===0)C._errors.push(G(Z));else{let b=C,W=0;while(W<Z.path.length){let l=Z.path[W];if(W!==Z.path.length-1)b[l]=b[l]||{_errors:[]};else b[l]=b[l]||{_errors:[]},b[l]._errors.push(G(Z));b=b[l],W++}}};return N(this),C}static assert(I){if(!(I instanceof aG))throw Error(`Not a ZodError: ${I}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wI.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(I=(G)=>G.message){let G={},C=[];for(let N of this.issues)if(N.path.length>0){let Y=N.path[0];G[Y]=G[Y]||[],G[Y].push(I(N))}else C.push(I(N));return{formErrors:C,fieldErrors:G}}get formErrors(){return this.flatten()}}aG.create=(I)=>{return new aG(I)};var f9=(I,G)=>{let C;switch(I.code){case U.invalid_type:if(I.received===M.undefined)C="Required";else C=`Expected ${I.expected}, received ${I.received}`;break;case U.invalid_literal:C=`Invalid literal value, expected ${JSON.stringify(I.expected,wI.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:C=`Unrecognized key(s) in object: ${wI.joinValues(I.keys,", ")}`;break;case U.invalid_union:C="Invalid input";break;case U.invalid_union_discriminator:C=`Invalid discriminator value. Expected ${wI.joinValues(I.options)}`;break;case U.invalid_enum_value:C=`Invalid enum value. Expected ${wI.joinValues(I.options)}, received '${I.received}'`;break;case U.invalid_arguments:C="Invalid function arguments";break;case U.invalid_return_type:C="Invalid function return type";break;case U.invalid_date:C="Invalid date";break;case U.invalid_string:if(typeof I.validation==="object")if("includes"in I.validation){if(C=`Invalid input: must include "${I.validation.includes}"`,typeof I.validation.position==="number")C=`${C} at one or more positions greater than or equal to ${I.validation.position}`}else if("startsWith"in I.validation)C=`Invalid input: must start with "${I.validation.startsWith}"`;else if("endsWith"in I.validation)C=`Invalid input: must end with "${I.validation.endsWith}"`;else wI.assertNever(I.validation);else if(I.validation!=="regex")C=`Invalid ${I.validation}`;else C="Invalid";break;case U.too_small:if(I.type==="array")C=`Array must contain ${I.exact?"exactly":I.inclusive?"at least":"more than"} ${I.minimum} element(s)`;else if(I.type==="string")C=`String must contain ${I.exact?"exactly":I.inclusive?"at least":"over"} ${I.minimum} character(s)`;else if(I.type==="number")C=`Number must be ${I.exact?"exactly equal to ":I.inclusive?"greater than or equal to ":"greater than "}${I.minimum}`;else if(I.type==="bigint")C=`Number must be ${I.exact?"exactly equal to ":I.inclusive?"greater than or equal to ":"greater than "}${I.minimum}`;else if(I.type==="date")C=`Date must be ${I.exact?"exactly equal to ":I.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(I.minimum))}`;else C="Invalid input";break;case U.too_big:if(I.type==="array")C=`Array must contain ${I.exact?"exactly":I.inclusive?"at most":"less than"} ${I.maximum} element(s)`;else if(I.type==="string")C=`String must contain ${I.exact?"exactly":I.inclusive?"at most":"under"} ${I.maximum} character(s)`;else if(I.type==="number")C=`Number must be ${I.exact?"exactly":I.inclusive?"less than or equal to":"less than"} ${I.maximum}`;else if(I.type==="bigint")C=`BigInt must be ${I.exact?"exactly":I.inclusive?"less than or equal to":"less than"} ${I.maximum}`;else if(I.type==="date")C=`Date must be ${I.exact?"exactly":I.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(I.maximum))}`;else C="Invalid input";break;case U.custom:C="Invalid input";break;case U.invalid_intersection_types:C="Intersection results could not be merged";break;case U.not_multiple_of:C=`Number must be a multiple of ${I.multipleOf}`;break;case U.not_finite:C="Number must be finite";break;default:C=G.defaultError,wI.assertNever(I)}return{message:C}},ON=f9;var uh=ON;function $9(I){uh=I}function xZ(){return uh}var uW=(I)=>{let{data:G,path:C,errorMaps:N,issueData:Y}=I,Z=[...C,...Y.path||[]],b={...Y,path:Z};if(Y.message!==void 0)return{...Y,path:Z,message:Y.message};let W="",l=N.filter((Q)=>!!Q).slice().reverse();for(let Q of l)W=Q(b,{data:G,defaultError:W}).message;return{...Y,path:Z,message:W}},_9=[];function T(I,G){let C=xZ(),N=uW({issueData:G,data:I.data,path:I.path,errorMaps:[I.common.contextualErrorMap,I.schemaErrorMap,C,C===ON?void 0:ON].filter((Y)=>!!Y)});I.common.issues.push(N)}class VG{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(I,G){let C=[];for(let N of G){if(N.status==="aborted")return NI;if(N.status==="dirty")I.dirty();C.push(N.value)}return{status:I.value,value:C}}static async mergeObjectAsync(I,G){let C=[];for(let N of G){let Y=await N.key,Z=await N.value;C.push({key:Y,value:Z})}return VG.mergeObjectSync(I,C)}static mergeObjectSync(I,G){let C={};for(let N of G){let{key:Y,value:Z}=N;if(Y.status==="aborted")return NI;if(Z.status==="aborted")return NI;if(Y.status==="dirty")I.dirty();if(Z.status==="dirty")I.dirty();if(Y.value!=="__proto__"&&(typeof Z.value<"u"||N.alwaysSet))C[Y.value]=Z.value}return{status:I.value,value:C}}}var NI=Object.freeze({status:"aborted"}),aY=(I)=>({status:"dirty",value:I}),uG=(I)=>({status:"valid",value:I}),E0=(I)=>I.status==="aborted",z0=(I)=>I.status==="dirty",$N=(I)=>I.status==="valid",MZ=(I)=>typeof Promise<"u"&&I instanceof Promise;var _;(function(I){I.errToObj=(G)=>typeof G==="string"?{message:G}:G||{},I.toString=(G)=>typeof G==="string"?G:G?.message})(_||(_={}));class pC{constructor(I,G,C,N){this._cachedPath=[],this.parent=I,this.data=G,this._path=C,this._key=N}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var vh=(I,G)=>{if($N(G))return{success:!0,data:G.value};else{if(!I.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let C=new aG(I.common.issues);return this._error=C,this._error}}}};function VI(I){if(!I)return{};let{errorMap:G,invalid_type_error:C,required_error:N,description:Y}=I;if(G&&(C||N))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(G)return{errorMap:G,description:Y};return{errorMap:(b,W)=>{let{message:l}=I;if(b.code==="invalid_enum_value")return{message:l??W.defaultError};if(typeof W.data>"u")return{message:l??N??W.defaultError};if(b.code!=="invalid_type")return{message:W.defaultError};return{message:l??C??W.defaultError}},description:Y}}class dI{get description(){return this._def.description}_getType(I){return tC(I.data)}_getOrReturnCtx(I,G){return G||{common:I.parent.common,data:I.data,parsedType:tC(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}_processInputParams(I){return{status:new VG,ctx:{common:I.parent.common,data:I.data,parsedType:tC(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}}_parseSync(I){let G=this._parse(I);if(MZ(G))throw Error("Synchronous parse encountered promise.");return G}_parseAsync(I){let G=this._parse(I);return Promise.resolve(G)}parse(I,G){let C=this.safeParse(I,G);if(C.success)return C.data;throw C.error}safeParse(I,G){let C={common:{issues:[],async:G?.async??!1,contextualErrorMap:G?.errorMap},path:G?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:tC(I)},N=this._parseSync({data:I,path:C.path,parent:C});return vh(C,N)}"~validate"(I){let G={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:tC(I)};if(!this["~standard"].async)try{let C=this._parseSync({data:I,path:[],parent:G});return $N(C)?{value:C.value}:{issues:G.common.issues}}catch(C){if(C?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;G.common={issues:[],async:!0}}return this._parseAsync({data:I,path:[],parent:G}).then((C)=>$N(C)?{value:C.value}:{issues:G.common.issues})}async parseAsync(I,G){let C=await this.safeParseAsync(I,G);if(C.success)return C.data;throw C.error}async safeParseAsync(I,G){let C={common:{issues:[],contextualErrorMap:G?.errorMap,async:!0},path:G?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:tC(I)},N=this._parse({data:I,path:C.path,parent:C}),Y=await(MZ(N)?N:Promise.resolve(N));return vh(C,Y)}refine(I,G){let C=(N)=>{if(typeof G==="string"||typeof G>"u")return{message:G};else if(typeof G==="function")return G(N);else return G};return this._refinement((N,Y)=>{let Z=I(N),b=()=>Y.addIssue({code:U.custom,...C(N)});if(typeof Promise<"u"&&Z instanceof Promise)return Z.then((W)=>{if(!W)return b(),!1;else return!0});if(!Z)return b(),!1;else return!0})}refinement(I,G){return this._refinement((C,N)=>{if(!I(C))return N.addIssue(typeof G==="function"?G(C,N):G),!1;else return!0})}_refinement(I){return new KC({schema:this,typeName:ZI.ZodEffects,effect:{type:"refinement",refinement:I}})}superRefine(I){return this._refinement(I)}constructor(I){this.spa=this.safeParseAsync,this._def=I,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(G)=>this["~validate"](G)}}optional(){return JC.create(this,this._def)}nullable(){return uN.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return AC.create(this)}promise(){return jY.create(this,this._def)}or(I){return tZ.create([this,I],this._def)}and(I){return fZ.create(this,I,this._def)}transform(I){return new KC({...VI(this._def),schema:this,typeName:ZI.ZodEffects,effect:{type:"transform",transform:I}})}default(I){let G=typeof I==="function"?I:()=>I;return new rZ({...VI(this._def),innerType:this,defaultValue:G,typeName:ZI.ZodDefault})}brand(){return new D0({typeName:ZI.ZodBranded,type:this,...VI(this._def)})}catch(I){let G=typeof I==="function"?I:()=>I;return new eZ({...VI(this._def),innerType:this,catchValue:G,typeName:ZI.ZodCatch})}describe(I){return new this.constructor({...this._def,description:I})}pipe(I){return KW.create(this,I)}readonly(){return Ib.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var o9=/^c[^\s-]{8,}$/i,r9=/^[0-9a-z]+$/,e9=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I3=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,G3=/^[a-z0-9_-]{21}$/i,C3=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,N3=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Y3=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Z3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",c2,b3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,W3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,l3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,L3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ah="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",V3=new RegExp(`^${Ah}$`);function Jh(I){let G="[0-5]\\d";if(I.precision)G=`${G}\\.\\d{${I.precision}}`;else if(I.precision==null)G=`${G}(\\.\\d+)?`;let C=I.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${G})${C}`}function X3(I){return new RegExp(`^${Jh(I)}$`)}function ph(I){let G=`${Ah}T${Jh(I)}`,C=[];if(C.push(I.local?"Z?":"Z"),I.offset)C.push("([+-]\\d{2}:?\\d{2})");return G=`${G}(${C.join("|")})`,new RegExp(`^${G}$`)}function R3(I,G){if((G==="v4"||!G)&&b3.test(I))return!0;if((G==="v6"||!G)&&l3.test(I))return!0;return!1}function d3(I,G){if(!C3.test(I))return!1;try{let[C]=I.split(".");if(!C)return!1;let N=C.replace(/-/g,"+").replace(/_/g,"/").padEnd(C.length+(4-C.length%4)%4,"="),Y=JSON.parse(atob(N));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(G&&Y.alg!==G)return!1;return!0}catch{return!1}}function h3(I,G){if((G==="v4"||!G)&&W3.test(I))return!0;if((G==="v6"||!G)&&Q3.test(I))return!0;return!1}class gC extends dI{_parse(I){if(this._def.coerce)I.data=String(I.data);if(this._getType(I)!==M.string){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_type,expected:M.string,received:Y.parsedType}),NI}let C=new VG,N=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(I.data.length<Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),C.dirty()}else if(Y.kind==="max"){if(I.data.length>Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),C.dirty()}else if(Y.kind==="length"){let Z=I.data.length>Y.value,b=I.data.length<Y.value;if(Z||b){if(N=this._getOrReturnCtx(I,N),Z)T(N,{code:U.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(b)T(N,{code:U.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});C.dirty()}}else if(Y.kind==="email"){if(!Y3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"email",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="emoji"){if(!c2)c2=new RegExp(Z3,"u");if(!c2.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"emoji",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="uuid"){if(!I3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"uuid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="nanoid"){if(!G3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"nanoid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="cuid"){if(!o9.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"cuid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="cuid2"){if(!r9.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"cuid2",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="ulid"){if(!e9.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"ulid",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="url")try{new URL(I.data)}catch{N=this._getOrReturnCtx(I,N),T(N,{validation:"url",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"regex",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="trim")I.data=I.data.trim();else if(Y.kind==="includes"){if(!I.data.includes(Y.value,Y.position))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),C.dirty()}else if(Y.kind==="toLowerCase")I.data=I.data.toLowerCase();else if(Y.kind==="toUpperCase")I.data=I.data.toUpperCase();else if(Y.kind==="startsWith"){if(!I.data.startsWith(Y.value))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:{startsWith:Y.value},message:Y.message}),C.dirty()}else if(Y.kind==="endsWith"){if(!I.data.endsWith(Y.value))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:{endsWith:Y.value},message:Y.message}),C.dirty()}else if(Y.kind==="datetime"){if(!ph(Y).test(I.data))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:"datetime",message:Y.message}),C.dirty()}else if(Y.kind==="date"){if(!V3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:"date",message:Y.message}),C.dirty()}else if(Y.kind==="time"){if(!X3(Y).test(I.data))N=this._getOrReturnCtx(I,N),T(N,{code:U.invalid_string,validation:"time",message:Y.message}),C.dirty()}else if(Y.kind==="duration"){if(!N3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"duration",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="ip"){if(!R3(I.data,Y.version))N=this._getOrReturnCtx(I,N),T(N,{validation:"ip",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="jwt"){if(!d3(I.data,Y.alg))N=this._getOrReturnCtx(I,N),T(N,{validation:"jwt",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="cidr"){if(!h3(I.data,Y.version))N=this._getOrReturnCtx(I,N),T(N,{validation:"cidr",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="base64"){if(!L3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"base64",code:U.invalid_string,message:Y.message}),C.dirty()}else if(Y.kind==="base64url"){if(!m3.test(I.data))N=this._getOrReturnCtx(I,N),T(N,{validation:"base64url",code:U.invalid_string,message:Y.message}),C.dirty()}else wI.assertNever(Y);return{status:C.value,value:I.data}}_regex(I,G,C){return this.refinement((N)=>I.test(N),{validation:G,code:U.invalid_string,..._.errToObj(C)})}_addCheck(I){return new gC({...this._def,checks:[...this._def.checks,I]})}email(I){return this._addCheck({kind:"email",..._.errToObj(I)})}url(I){return this._addCheck({kind:"url",..._.errToObj(I)})}emoji(I){return this._addCheck({kind:"emoji",..._.errToObj(I)})}uuid(I){return this._addCheck({kind:"uuid",..._.errToObj(I)})}nanoid(I){return this._addCheck({kind:"nanoid",..._.errToObj(I)})}cuid(I){return this._addCheck({kind:"cuid",..._.errToObj(I)})}cuid2(I){return this._addCheck({kind:"cuid2",..._.errToObj(I)})}ulid(I){return this._addCheck({kind:"ulid",..._.errToObj(I)})}base64(I){return this._addCheck({kind:"base64",..._.errToObj(I)})}base64url(I){return this._addCheck({kind:"base64url",..._.errToObj(I)})}jwt(I){return this._addCheck({kind:"jwt",..._.errToObj(I)})}ip(I){return this._addCheck({kind:"ip",..._.errToObj(I)})}cidr(I){return this._addCheck({kind:"cidr",..._.errToObj(I)})}datetime(I){if(typeof I==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:I});return this._addCheck({kind:"datetime",precision:typeof I?.precision>"u"?null:I?.precision,offset:I?.offset??!1,local:I?.local??!1,..._.errToObj(I?.message)})}date(I){return this._addCheck({kind:"date",message:I})}time(I){if(typeof I==="string")return this._addCheck({kind:"time",precision:null,message:I});return this._addCheck({kind:"time",precision:typeof I?.precision>"u"?null:I?.precision,..._.errToObj(I?.message)})}duration(I){return this._addCheck({kind:"duration",..._.errToObj(I)})}regex(I,G){return this._addCheck({kind:"regex",regex:I,..._.errToObj(G)})}includes(I,G){return this._addCheck({kind:"includes",value:I,position:G?.position,..._.errToObj(G?.message)})}startsWith(I,G){return this._addCheck({kind:"startsWith",value:I,..._.errToObj(G)})}endsWith(I,G){return this._addCheck({kind:"endsWith",value:I,..._.errToObj(G)})}min(I,G){return this._addCheck({kind:"min",value:I,..._.errToObj(G)})}max(I,G){return this._addCheck({kind:"max",value:I,..._.errToObj(G)})}length(I,G){return this._addCheck({kind:"length",value:I,..._.errToObj(G)})}nonempty(I){return this.min(1,_.errToObj(I))}trim(){return new gC({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new gC({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new gC({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((I)=>I.kind==="datetime")}get isDate(){return!!this._def.checks.find((I)=>I.kind==="date")}get isTime(){return!!this._def.checks.find((I)=>I.kind==="time")}get isDuration(){return!!this._def.checks.find((I)=>I.kind==="duration")}get isEmail(){return!!this._def.checks.find((I)=>I.kind==="email")}get isURL(){return!!this._def.checks.find((I)=>I.kind==="url")}get isEmoji(){return!!this._def.checks.find((I)=>I.kind==="emoji")}get isUUID(){return!!this._def.checks.find((I)=>I.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((I)=>I.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((I)=>I.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((I)=>I.kind==="cuid2")}get isULID(){return!!this._def.checks.find((I)=>I.kind==="ulid")}get isIP(){return!!this._def.checks.find((I)=>I.kind==="ip")}get isCIDR(){return!!this._def.checks.find((I)=>I.kind==="cidr")}get isBase64(){return!!this._def.checks.find((I)=>I.kind==="base64")}get isBase64url(){return!!this._def.checks.find((I)=>I.kind==="base64url")}get minLength(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I}get maxLength(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I}}gC.create=(I)=>{return new gC({checks:[],typeName:ZI.ZodString,coerce:I?.coerce??!1,...VI(I)})};function c3(I,G){let C=(I.toString().split(".")[1]||"").length,N=(G.toString().split(".")[1]||"").length,Y=C>N?C:N,Z=Number.parseInt(I.toFixed(Y).replace(".","")),b=Number.parseInt(G.toFixed(Y).replace(".",""));return Z%b/10**Y}class oN extends dI{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(I){if(this._def.coerce)I.data=Number(I.data);if(this._getType(I)!==M.number){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_type,expected:M.number,received:Y.parsedType}),NI}let C=void 0,N=new VG;for(let Y of this._def.checks)if(Y.kind==="int"){if(!wI.isInteger(I.data))C=this._getOrReturnCtx(I,C),T(C,{code:U.invalid_type,expected:"integer",received:"float",message:Y.message}),N.dirty()}else if(Y.kind==="min"){if(Y.inclusive?I.data<Y.value:I.data<=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),N.dirty()}else if(Y.kind==="max"){if(Y.inclusive?I.data>Y.value:I.data>=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),N.dirty()}else if(Y.kind==="multipleOf"){if(c3(I.data,Y.value)!==0)C=this._getOrReturnCtx(I,C),T(C,{code:U.not_multiple_of,multipleOf:Y.value,message:Y.message}),N.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(I.data))C=this._getOrReturnCtx(I,C),T(C,{code:U.not_finite,message:Y.message}),N.dirty()}else wI.assertNever(Y);return{status:N.value,value:I.data}}gte(I,G){return this.setLimit("min",I,!0,_.toString(G))}gt(I,G){return this.setLimit("min",I,!1,_.toString(G))}lte(I,G){return this.setLimit("max",I,!0,_.toString(G))}lt(I,G){return this.setLimit("max",I,!1,_.toString(G))}setLimit(I,G,C,N){return new oN({...this._def,checks:[...this._def.checks,{kind:I,value:G,inclusive:C,message:_.toString(N)}]})}_addCheck(I){return new oN({...this._def,checks:[...this._def.checks,I]})}int(I){return this._addCheck({kind:"int",message:_.toString(I)})}positive(I){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(I)})}negative(I){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(I)})}multipleOf(I,G){return this._addCheck({kind:"multipleOf",value:I,message:_.toString(G)})}finite(I){return this._addCheck({kind:"finite",message:_.toString(I)})}safe(I){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(I)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(I)})}get minValue(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I}get maxValue(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I}get isInt(){return!!this._def.checks.find((I)=>I.kind==="int"||I.kind==="multipleOf"&&wI.isInteger(I.value))}get isFinite(){let I=null,G=null;for(let C of this._def.checks)if(C.kind==="finite"||C.kind==="int"||C.kind==="multipleOf")return!0;else if(C.kind==="min"){if(G===null||C.value>G)G=C.value}else if(C.kind==="max"){if(I===null||C.value<I)I=C.value}return Number.isFinite(G)&&Number.isFinite(I)}}oN.create=(I)=>{return new oN({checks:[],typeName:ZI.ZodNumber,coerce:I?.coerce||!1,...VI(I)})};class rN extends dI{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(I){if(this._def.coerce)try{I.data=BigInt(I.data)}catch{return this._getInvalidInput(I)}if(this._getType(I)!==M.bigint)return this._getInvalidInput(I);let C=void 0,N=new VG;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?I.data<Y.value:I.data<=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),N.dirty()}else if(Y.kind==="max"){if(Y.inclusive?I.data>Y.value:I.data>=Y.value)C=this._getOrReturnCtx(I,C),T(C,{code:U.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),N.dirty()}else if(Y.kind==="multipleOf"){if(I.data%Y.value!==BigInt(0))C=this._getOrReturnCtx(I,C),T(C,{code:U.not_multiple_of,multipleOf:Y.value,message:Y.message}),N.dirty()}else wI.assertNever(Y);return{status:N.value,value:I.data}}_getInvalidInput(I){let G=this._getOrReturnCtx(I);return T(G,{code:U.invalid_type,expected:M.bigint,received:G.parsedType}),NI}gte(I,G){return this.setLimit("min",I,!0,_.toString(G))}gt(I,G){return this.setLimit("min",I,!1,_.toString(G))}lte(I,G){return this.setLimit("max",I,!0,_.toString(G))}lt(I,G){return this.setLimit("max",I,!1,_.toString(G))}setLimit(I,G,C,N){return new rN({...this._def,checks:[...this._def.checks,{kind:I,value:G,inclusive:C,message:_.toString(N)}]})}_addCheck(I){return new rN({...this._def,checks:[...this._def.checks,I]})}positive(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(I)})}negative(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(I)})}multipleOf(I,G){return this._addCheck({kind:"multipleOf",value:I,message:_.toString(G)})}get minValue(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I}get maxValue(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I}}rN.create=(I)=>{return new rN({checks:[],typeName:ZI.ZodBigInt,coerce:I?.coerce??!1,...VI(I)})};class iZ extends dI{_parse(I){if(this._def.coerce)I.data=Boolean(I.data);if(this._getType(I)!==M.boolean){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.boolean,received:C.parsedType}),NI}return uG(I.data)}}iZ.create=(I)=>{return new iZ({typeName:ZI.ZodBoolean,coerce:I?.coerce||!1,...VI(I)})};class DY extends dI{_parse(I){if(this._def.coerce)I.data=new Date(I.data);if(this._getType(I)!==M.date){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_type,expected:M.date,received:Y.parsedType}),NI}if(Number.isNaN(I.data.getTime())){let Y=this._getOrReturnCtx(I);return T(Y,{code:U.invalid_date}),NI}let C=new VG,N=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(I.data.getTime()<Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),C.dirty()}else if(Y.kind==="max"){if(I.data.getTime()>Y.value)N=this._getOrReturnCtx(I,N),T(N,{code:U.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),C.dirty()}else wI.assertNever(Y);return{status:C.value,value:new Date(I.data.getTime())}}_addCheck(I){return new DY({...this._def,checks:[...this._def.checks,I]})}min(I,G){return this._addCheck({kind:"min",value:I.getTime(),message:_.toString(G)})}max(I,G){return this._addCheck({kind:"max",value:I.getTime(),message:_.toString(G)})}get minDate(){let I=null;for(let G of this._def.checks)if(G.kind==="min"){if(I===null||G.value>I)I=G.value}return I!=null?new Date(I):null}get maxDate(){let I=null;for(let G of this._def.checks)if(G.kind==="max"){if(I===null||G.value<I)I=G.value}return I!=null?new Date(I):null}}DY.create=(I)=>{return new DY({checks:[],coerce:I?.coerce||!1,typeName:ZI.ZodDate,...VI(I)})};class vW extends dI{_parse(I){if(this._getType(I)!==M.symbol){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.symbol,received:C.parsedType}),NI}return uG(I.data)}}vW.create=(I)=>{return new vW({typeName:ZI.ZodSymbol,...VI(I)})};class TZ extends dI{_parse(I){if(this._getType(I)!==M.undefined){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.undefined,received:C.parsedType}),NI}return uG(I.data)}}TZ.create=(I)=>{return new TZ({typeName:ZI.ZodUndefined,...VI(I)})};class PZ extends dI{_parse(I){if(this._getType(I)!==M.null){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.null,received:C.parsedType}),NI}return uG(I.data)}}PZ.create=(I)=>{return new PZ({typeName:ZI.ZodNull,...VI(I)})};class qY extends dI{constructor(){super(...arguments);this._any=!0}_parse(I){return uG(I.data)}}qY.create=(I)=>{return new qY({typeName:ZI.ZodAny,...VI(I)})};class _N extends dI{constructor(){super(...arguments);this._unknown=!0}_parse(I){return uG(I.data)}}_N.create=(I)=>{return new _N({typeName:ZI.ZodUnknown,...VI(I)})};class fC extends dI{_parse(I){let G=this._getOrReturnCtx(I);return T(G,{code:U.invalid_type,expected:M.never,received:G.parsedType}),NI}}fC.create=(I)=>{return new fC({typeName:ZI.ZodNever,...VI(I)})};class gW extends dI{_parse(I){if(this._getType(I)!==M.undefined){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.void,received:C.parsedType}),NI}return uG(I.data)}}gW.create=(I)=>{return new gW({typeName:ZI.ZodVoid,...VI(I)})};class AC extends dI{_parse(I){let{ctx:G,status:C}=this._processInputParams(I),N=this._def;if(G.parsedType!==M.array)return T(G,{code:U.invalid_type,expected:M.array,received:G.parsedType}),NI;if(N.exactLength!==null){let Z=G.data.length>N.exactLength.value,b=G.data.length<N.exactLength.value;if(Z||b)T(G,{code:Z?U.too_big:U.too_small,minimum:b?N.exactLength.value:void 0,maximum:Z?N.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:N.exactLength.message}),C.dirty()}if(N.minLength!==null){if(G.data.length<N.minLength.value)T(G,{code:U.too_small,minimum:N.minLength.value,type:"array",inclusive:!0,exact:!1,message:N.minLength.message}),C.dirty()}if(N.maxLength!==null){if(G.data.length>N.maxLength.value)T(G,{code:U.too_big,maximum:N.maxLength.value,type:"array",inclusive:!0,exact:!1,message:N.maxLength.message}),C.dirty()}if(G.common.async)return Promise.all([...G.data].map((Z,b)=>{return N.type._parseAsync(new pC(G,Z,G.path,b))})).then((Z)=>{return VG.mergeArray(C,Z)});let Y=[...G.data].map((Z,b)=>{return N.type._parseSync(new pC(G,Z,G.path,b))});return VG.mergeArray(C,Y)}get element(){return this._def.type}min(I,G){return new AC({...this._def,minLength:{value:I,message:_.toString(G)}})}max(I,G){return new AC({...this._def,maxLength:{value:I,message:_.toString(G)}})}length(I,G){return new AC({...this._def,exactLength:{value:I,message:_.toString(G)}})}nonempty(I){return this.min(1,I)}}AC.create=(I,G)=>{return new AC({type:I,minLength:null,maxLength:null,exactLength:null,typeName:ZI.ZodArray,...VI(G)})};function SZ(I){if(I instanceof iI){let G={};for(let C in I.shape){let N=I.shape[C];G[C]=JC.create(SZ(N))}return new iI({...I._def,shape:()=>G})}else if(I instanceof AC)return new AC({...I._def,type:SZ(I.element)});else if(I instanceof JC)return JC.create(SZ(I.unwrap()));else if(I instanceof uN)return uN.create(SZ(I.unwrap()));else if(I instanceof $C)return $C.create(I.items.map((G)=>SZ(G)));else return I}class iI extends dI{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let I=this._def.shape(),G=wI.objectKeys(I);return this._cached={shape:I,keys:G},this._cached}_parse(I){if(this._getType(I)!==M.object){let l=this._getOrReturnCtx(I);return T(l,{code:U.invalid_type,expected:M.object,received:l.parsedType}),NI}let{status:C,ctx:N}=this._processInputParams(I),{shape:Y,keys:Z}=this._getCached(),b=[];if(!(this._def.catchall instanceof fC&&this._def.unknownKeys==="strip")){for(let l in N.data)if(!Z.includes(l))b.push(l)}let W=[];for(let l of Z){let Q=Y[l],L=N.data[l];W.push({key:{status:"valid",value:l},value:Q._parse(new pC(N,L,N.path,l)),alwaysSet:l in N.data})}if(this._def.catchall instanceof fC){let l=this._def.unknownKeys;if(l==="passthrough")for(let Q of b)W.push({key:{status:"valid",value:Q},value:{status:"valid",value:N.data[Q]}});else if(l==="strict"){if(b.length>0)T(N,{code:U.unrecognized_keys,keys:b}),C.dirty()}else if(l==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let Q of b){let L=N.data[Q];W.push({key:{status:"valid",value:Q},value:l._parse(new pC(N,L,N.path,Q)),alwaysSet:Q in N.data})}}if(N.common.async)return Promise.resolve().then(async()=>{let l=[];for(let Q of W){let L=await Q.key,m=await Q.value;l.push({key:L,value:m,alwaysSet:Q.alwaysSet})}return l}).then((l)=>{return VG.mergeObjectSync(C,l)});else return VG.mergeObjectSync(C,W)}get shape(){return this._def.shape()}strict(I){return _.errToObj,new iI({...this._def,unknownKeys:"strict",...I!==void 0?{errorMap:(G,C)=>{let N=this._def.errorMap?.(G,C).message??C.defaultError;if(G.code==="unrecognized_keys")return{message:_.errToObj(I).message??N};return{message:N}}}:{}})}strip(){return new iI({...this._def,unknownKeys:"strip"})}passthrough(){return new iI({...this._def,unknownKeys:"passthrough"})}extend(I){return new iI({...this._def,shape:()=>({...this._def.shape(),...I})})}merge(I){return new iI({unknownKeys:I._def.unknownKeys,catchall:I._def.catchall,shape:()=>({...this._def.shape(),...I._def.shape()}),typeName:ZI.ZodObject})}setKey(I,G){return this.augment({[I]:G})}catchall(I){return new iI({...this._def,catchall:I})}pick(I){let G={};for(let C of wI.objectKeys(I))if(I[C]&&this.shape[C])G[C]=this.shape[C];return new iI({...this._def,shape:()=>G})}omit(I){let G={};for(let C of wI.objectKeys(this.shape))if(!I[C])G[C]=this.shape[C];return new iI({...this._def,shape:()=>G})}deepPartial(){return SZ(this)}partial(I){let G={};for(let C of wI.objectKeys(this.shape)){let N=this.shape[C];if(I&&!I[C])G[C]=N;else G[C]=N.optional()}return new iI({...this._def,shape:()=>G})}required(I){let G={};for(let C of wI.objectKeys(this.shape))if(I&&!I[C])G[C]=this.shape[C];else{let Y=this.shape[C];while(Y instanceof JC)Y=Y._def.innerType;G[C]=Y}return new iI({...this._def,shape:()=>G})}keyof(){return Kh(wI.objectKeys(this.shape))}}iI.create=(I,G)=>{return new iI({shape:()=>I,unknownKeys:"strip",catchall:fC.create(),typeName:ZI.ZodObject,...VI(G)})};iI.strictCreate=(I,G)=>{return new iI({shape:()=>I,unknownKeys:"strict",catchall:fC.create(),typeName:ZI.ZodObject,...VI(G)})};iI.lazycreate=(I,G)=>{return new iI({shape:I,unknownKeys:"strip",catchall:fC.create(),typeName:ZI.ZodObject,...VI(G)})};class tZ extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C=this._def.options;function N(Y){for(let b of Y)if(b.result.status==="valid")return b.result;for(let b of Y)if(b.result.status==="dirty")return G.common.issues.push(...b.ctx.common.issues),b.result;let Z=Y.map((b)=>new aG(b.ctx.common.issues));return T(G,{code:U.invalid_union,unionErrors:Z}),NI}if(G.common.async)return Promise.all(C.map(async(Y)=>{let Z={...G,common:{...G.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:G.data,path:G.path,parent:Z}),ctx:Z}})).then(N);else{let Y=void 0,Z=[];for(let W of C){let l={...G,common:{...G.common,issues:[]},parent:null},Q=W._parseSync({data:G.data,path:G.path,parent:l});if(Q.status==="valid")return Q;else if(Q.status==="dirty"&&!Y)Y={result:Q,ctx:l};if(l.common.issues.length)Z.push(l.common.issues)}if(Y)return G.common.issues.push(...Y.ctx.common.issues),Y.result;let b=Z.map((W)=>new aG(W));return T(G,{code:U.invalid_union,unionErrors:b}),NI}}get options(){return this._def.options}}tZ.create=(I,G)=>{return new tZ({options:I,typeName:ZI.ZodUnion,...VI(G)})};var FN=(I)=>{if(I instanceof $Z)return FN(I.schema);else if(I instanceof KC)return FN(I.innerType());else if(I instanceof _Z)return[I.value];else if(I instanceof eN)return I.options;else if(I instanceof oZ)return wI.objectValues(I.enum);else if(I instanceof rZ)return FN(I._def.innerType);else if(I instanceof TZ)return[void 0];else if(I instanceof PZ)return[null];else if(I instanceof JC)return[void 0,...FN(I.unwrap())];else if(I instanceof uN)return[null,...FN(I.unwrap())];else if(I instanceof D0)return FN(I.unwrap());else if(I instanceof Ib)return FN(I.unwrap());else if(I instanceof eZ)return FN(I._def.innerType);else return[]};class a0 extends dI{_parse(I){let{ctx:G}=this._processInputParams(I);if(G.parsedType!==M.object)return T(G,{code:U.invalid_type,expected:M.object,received:G.parsedType}),NI;let C=this.discriminator,N=G.data[C],Y=this.optionsMap.get(N);if(!Y)return T(G,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[C]}),NI;if(G.common.async)return Y._parseAsync({data:G.data,path:G.path,parent:G});else return Y._parseSync({data:G.data,path:G.path,parent:G})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(I,G,C){let N=new Map;for(let Y of G){let Z=FN(Y.shape[I]);if(!Z.length)throw Error(`A discriminator value for key \`${I}\` could not be extracted from all schema options`);for(let b of Z){if(N.has(b))throw Error(`Discriminator property ${String(I)} has duplicate value ${String(b)}`);N.set(b,Y)}}return new a0({typeName:ZI.ZodDiscriminatedUnion,discriminator:I,options:G,optionsMap:N,...VI(C)})}}function H2(I,G){let C=tC(I),N=tC(G);if(I===G)return{valid:!0,data:I};else if(C===M.object&&N===M.object){let Y=wI.objectKeys(G),Z=wI.objectKeys(I).filter((W)=>Y.indexOf(W)!==-1),b={...I,...G};for(let W of Z){let l=H2(I[W],G[W]);if(!l.valid)return{valid:!1};b[W]=l.data}return{valid:!0,data:b}}else if(C===M.array&&N===M.array){if(I.length!==G.length)return{valid:!1};let Y=[];for(let Z=0;Z<I.length;Z++){let b=I[Z],W=G[Z],l=H2(b,W);if(!l.valid)return{valid:!1};Y.push(l.data)}return{valid:!0,data:Y}}else if(C===M.date&&N===M.date&&+I===+G)return{valid:!0,data:I};else return{valid:!1}}class fZ extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I),N=(Y,Z)=>{if(E0(Y)||E0(Z))return NI;let b=H2(Y.value,Z.value);if(!b.valid)return T(C,{code:U.invalid_intersection_types}),NI;if(z0(Y)||z0(Z))G.dirty();return{status:G.value,value:b.data}};if(C.common.async)return Promise.all([this._def.left._parseAsync({data:C.data,path:C.path,parent:C}),this._def.right._parseAsync({data:C.data,path:C.path,parent:C})]).then(([Y,Z])=>N(Y,Z));else return N(this._def.left._parseSync({data:C.data,path:C.path,parent:C}),this._def.right._parseSync({data:C.data,path:C.path,parent:C}))}}fZ.create=(I,G,C)=>{return new fZ({left:I,right:G,typeName:ZI.ZodIntersection,...VI(C)})};class $C extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.array)return T(C,{code:U.invalid_type,expected:M.array,received:C.parsedType}),NI;if(C.data.length<this._def.items.length)return T(C,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),NI;if(!this._def.rest&&C.data.length>this._def.items.length)T(C,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G.dirty();let Y=[...C.data].map((Z,b)=>{let W=this._def.items[b]||this._def.rest;if(!W)return null;return W._parse(new pC(C,Z,C.path,b))}).filter((Z)=>!!Z);if(C.common.async)return Promise.all(Y).then((Z)=>{return VG.mergeArray(G,Z)});else return VG.mergeArray(G,Y)}get items(){return this._def.items}rest(I){return new $C({...this._def,rest:I})}}$C.create=(I,G)=>{if(!Array.isArray(I))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new $C({items:I,typeName:ZI.ZodTuple,rest:null,...VI(G)})};class AW extends dI{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.object)return T(C,{code:U.invalid_type,expected:M.object,received:C.parsedType}),NI;let N=[],Y=this._def.keyType,Z=this._def.valueType;for(let b in C.data)N.push({key:Y._parse(new pC(C,b,C.path,b)),value:Z._parse(new pC(C,C.data[b],C.path,b)),alwaysSet:b in C.data});if(C.common.async)return VG.mergeObjectAsync(G,N);else return VG.mergeObjectSync(G,N)}get element(){return this._def.valueType}static create(I,G,C){if(G instanceof dI)return new AW({keyType:I,valueType:G,typeName:ZI.ZodRecord,...VI(C)});return new AW({keyType:gC.create(),valueType:I,typeName:ZI.ZodRecord,...VI(G)})}}class JW extends dI{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.map)return T(C,{code:U.invalid_type,expected:M.map,received:C.parsedType}),NI;let N=this._def.keyType,Y=this._def.valueType,Z=[...C.data.entries()].map(([b,W],l)=>{return{key:N._parse(new pC(C,b,C.path,[l,"key"])),value:Y._parse(new pC(C,W,C.path,[l,"value"]))}});if(C.common.async){let b=new Map;return Promise.resolve().then(async()=>{for(let W of Z){let l=await W.key,Q=await W.value;if(l.status==="aborted"||Q.status==="aborted")return NI;if(l.status==="dirty"||Q.status==="dirty")G.dirty();b.set(l.value,Q.value)}return{status:G.value,value:b}})}else{let b=new Map;for(let W of Z){let{key:l,value:Q}=W;if(l.status==="aborted"||Q.status==="aborted")return NI;if(l.status==="dirty"||Q.status==="dirty")G.dirty();b.set(l.value,Q.value)}return{status:G.value,value:b}}}}JW.create=(I,G,C)=>{return new JW({valueType:G,keyType:I,typeName:ZI.ZodMap,...VI(C)})};class UY extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.parsedType!==M.set)return T(C,{code:U.invalid_type,expected:M.set,received:C.parsedType}),NI;let N=this._def;if(N.minSize!==null){if(C.data.size<N.minSize.value)T(C,{code:U.too_small,minimum:N.minSize.value,type:"set",inclusive:!0,exact:!1,message:N.minSize.message}),G.dirty()}if(N.maxSize!==null){if(C.data.size>N.maxSize.value)T(C,{code:U.too_big,maximum:N.maxSize.value,type:"set",inclusive:!0,exact:!1,message:N.maxSize.message}),G.dirty()}let Y=this._def.valueType;function Z(W){let l=new Set;for(let Q of W){if(Q.status==="aborted")return NI;if(Q.status==="dirty")G.dirty();l.add(Q.value)}return{status:G.value,value:l}}let b=[...C.data.values()].map((W,l)=>Y._parse(new pC(C,W,C.path,l)));if(C.common.async)return Promise.all(b).then((W)=>Z(W));else return Z(b)}min(I,G){return new UY({...this._def,minSize:{value:I,message:_.toString(G)}})}max(I,G){return new UY({...this._def,maxSize:{value:I,message:_.toString(G)}})}size(I,G){return this.min(I,G).max(I,G)}nonempty(I){return this.min(1,I)}}UY.create=(I,G)=>{return new UY({valueType:I,minSize:null,maxSize:null,typeName:ZI.ZodSet,...VI(G)})};class sZ extends dI{constructor(){super(...arguments);this.validate=this.implement}_parse(I){let{ctx:G}=this._processInputParams(I);if(G.parsedType!==M.function)return T(G,{code:U.invalid_type,expected:M.function,received:G.parsedType}),NI;function C(b,W){return uW({data:b,path:G.path,errorMaps:[G.common.contextualErrorMap,G.schemaErrorMap,xZ(),ON].filter((l)=>!!l),issueData:{code:U.invalid_arguments,argumentsError:W}})}function N(b,W){return uW({data:b,path:G.path,errorMaps:[G.common.contextualErrorMap,G.schemaErrorMap,xZ(),ON].filter((l)=>!!l),issueData:{code:U.invalid_return_type,returnTypeError:W}})}let Y={errorMap:G.common.contextualErrorMap},Z=G.data;if(this._def.returns instanceof jY){let b=this;return uG(async function(...W){let l=new aG([]),Q=await b._def.args.parseAsync(W,Y).catch((X)=>{throw l.addIssue(C(W,X)),l}),L=await Reflect.apply(Z,this,Q);return await b._def.returns._def.type.parseAsync(L,Y).catch((X)=>{throw l.addIssue(N(L,X)),l})})}else{let b=this;return uG(function(...W){let l=b._def.args.safeParse(W,Y);if(!l.success)throw new aG([C(W,l.error)]);let Q=Reflect.apply(Z,this,l.data),L=b._def.returns.safeParse(Q,Y);if(!L.success)throw new aG([N(Q,L.error)]);return L.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...I){return new sZ({...this._def,args:$C.create(I).rest(_N.create())})}returns(I){return new sZ({...this._def,returns:I})}implement(I){return this.parse(I)}strictImplement(I){return this.parse(I)}static create(I,G,C){return new sZ({args:I?I:$C.create([]).rest(_N.create()),returns:G||_N.create(),typeName:ZI.ZodFunction,...VI(C)})}}class $Z extends dI{get schema(){return this._def.getter()}_parse(I){let{ctx:G}=this._processInputParams(I);return this._def.getter()._parse({data:G.data,path:G.path,parent:G})}}$Z.create=(I,G)=>{return new $Z({getter:I,typeName:ZI.ZodLazy,...VI(G)})};class _Z extends dI{_parse(I){if(I.data!==this._def.value){let G=this._getOrReturnCtx(I);return T(G,{received:G.data,code:U.invalid_literal,expected:this._def.value}),NI}return{status:"valid",value:I.data}}get value(){return this._def.value}}_Z.create=(I,G)=>{return new _Z({value:I,typeName:ZI.ZodLiteral,...VI(G)})};function Kh(I,G){return new eN({values:I,typeName:ZI.ZodEnum,...VI(G)})}class eN extends dI{_parse(I){if(typeof I.data!=="string"){let G=this._getOrReturnCtx(I),C=this._def.values;return T(G,{expected:wI.joinValues(C),received:G.parsedType,code:U.invalid_type}),NI}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(I.data)){let G=this._getOrReturnCtx(I),C=this._def.values;return T(G,{received:G.data,code:U.invalid_enum_value,options:C}),NI}return uG(I.data)}get options(){return this._def.values}get enum(){let I={};for(let G of this._def.values)I[G]=G;return I}get Values(){let I={};for(let G of this._def.values)I[G]=G;return I}get Enum(){let I={};for(let G of this._def.values)I[G]=G;return I}extract(I,G=this._def){return eN.create(I,{...this._def,...G})}exclude(I,G=this._def){return eN.create(this.options.filter((C)=>!I.includes(C)),{...this._def,...G})}}eN.create=Kh;class oZ extends dI{_parse(I){let G=wI.getValidEnumValues(this._def.values),C=this._getOrReturnCtx(I);if(C.parsedType!==M.string&&C.parsedType!==M.number){let N=wI.objectValues(G);return T(C,{expected:wI.joinValues(N),received:C.parsedType,code:U.invalid_type}),NI}if(!this._cache)this._cache=new Set(wI.getValidEnumValues(this._def.values));if(!this._cache.has(I.data)){let N=wI.objectValues(G);return T(C,{received:C.data,code:U.invalid_enum_value,options:N}),NI}return uG(I.data)}get enum(){return this._def.values}}oZ.create=(I,G)=>{return new oZ({values:I,typeName:ZI.ZodNativeEnum,...VI(G)})};class jY extends dI{unwrap(){return this._def.type}_parse(I){let{ctx:G}=this._processInputParams(I);if(G.parsedType!==M.promise&&G.common.async===!1)return T(G,{code:U.invalid_type,expected:M.promise,received:G.parsedType}),NI;let C=G.parsedType===M.promise?G.data:Promise.resolve(G.data);return uG(C.then((N)=>{return this._def.type.parseAsync(N,{path:G.path,errorMap:G.common.contextualErrorMap})}))}}jY.create=(I,G)=>{return new jY({type:I,typeName:ZI.ZodPromise,...VI(G)})};class KC extends dI{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZI.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(I){let{status:G,ctx:C}=this._processInputParams(I),N=this._def.effect||null,Y={addIssue:(Z)=>{if(T(C,Z),Z.fatal)G.abort();else G.dirty()},get path(){return C.path}};if(Y.addIssue=Y.addIssue.bind(Y),N.type==="preprocess"){let Z=N.transform(C.data,Y);if(C.common.async)return Promise.resolve(Z).then(async(b)=>{if(G.value==="aborted")return NI;let W=await this._def.schema._parseAsync({data:b,path:C.path,parent:C});if(W.status==="aborted")return NI;if(W.status==="dirty")return aY(W.value);if(G.value==="dirty")return aY(W.value);return W});else{if(G.value==="aborted")return NI;let b=this._def.schema._parseSync({data:Z,path:C.path,parent:C});if(b.status==="aborted")return NI;if(b.status==="dirty")return aY(b.value);if(G.value==="dirty")return aY(b.value);return b}}if(N.type==="refinement"){let Z=(b)=>{let W=N.refinement(b,Y);if(C.common.async)return Promise.resolve(W);if(W instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return b};if(C.common.async===!1){let b=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(b.status==="aborted")return NI;if(b.status==="dirty")G.dirty();return Z(b.value),{status:G.value,value:b.value}}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then((b)=>{if(b.status==="aborted")return NI;if(b.status==="dirty")G.dirty();return Z(b.value).then(()=>{return{status:G.value,value:b.value}})})}if(N.type==="transform")if(C.common.async===!1){let Z=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(!$N(Z))return NI;let b=N.transform(Z.value,Y);if(b instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:G.value,value:b}}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then((Z)=>{if(!$N(Z))return NI;return Promise.resolve(N.transform(Z.value,Y)).then((b)=>({status:G.value,value:b}))});wI.assertNever(N)}}KC.create=(I,G,C)=>{return new KC({schema:I,typeName:ZI.ZodEffects,effect:G,...VI(C)})};KC.createWithPreprocess=(I,G,C)=>{return new KC({schema:G,effect:{type:"preprocess",transform:I},typeName:ZI.ZodEffects,...VI(C)})};class JC extends dI{_parse(I){if(this._getType(I)===M.undefined)return uG(void 0);return this._def.innerType._parse(I)}unwrap(){return this._def.innerType}}JC.create=(I,G)=>{return new JC({innerType:I,typeName:ZI.ZodOptional,...VI(G)})};class uN extends dI{_parse(I){if(this._getType(I)===M.null)return uG(null);return this._def.innerType._parse(I)}unwrap(){return this._def.innerType}}uN.create=(I,G)=>{return new uN({innerType:I,typeName:ZI.ZodNullable,...VI(G)})};class rZ extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C=G.data;if(G.parsedType===M.undefined)C=this._def.defaultValue();return this._def.innerType._parse({data:C,path:G.path,parent:G})}removeDefault(){return this._def.innerType}}rZ.create=(I,G)=>{return new rZ({innerType:I,typeName:ZI.ZodDefault,defaultValue:typeof G.default==="function"?G.default:()=>G.default,...VI(G)})};class eZ extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C={...G,common:{...G.common,issues:[]}},N=this._def.innerType._parse({data:C.data,path:C.path,parent:{...C}});if(MZ(N))return N.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new aG(C.common.issues)},input:C.data})}});else return{status:"valid",value:N.status==="valid"?N.value:this._def.catchValue({get error(){return new aG(C.common.issues)},input:C.data})}}removeCatch(){return this._def.innerType}}eZ.create=(I,G)=>{return new eZ({innerType:I,typeName:ZI.ZodCatch,catchValue:typeof G.catch==="function"?G.catch:()=>G.catch,...VI(G)})};class pW extends dI{_parse(I){if(this._getType(I)!==M.nan){let C=this._getOrReturnCtx(I);return T(C,{code:U.invalid_type,expected:M.nan,received:C.parsedType}),NI}return{status:"valid",value:I.data}}}pW.create=(I)=>{return new pW({typeName:ZI.ZodNaN,...VI(I)})};var H3=Symbol("zod_brand");class D0 extends dI{_parse(I){let{ctx:G}=this._processInputParams(I),C=G.data;return this._def.type._parse({data:C,path:G.path,parent:G})}unwrap(){return this._def.type}}class KW extends dI{_parse(I){let{status:G,ctx:C}=this._processInputParams(I);if(C.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:C.data,path:C.path,parent:C});if(Y.status==="aborted")return NI;if(Y.status==="dirty")return G.dirty(),aY(Y.value);else return this._def.out._parseAsync({data:Y.value,path:C.path,parent:C})})();else{let N=this._def.in._parseSync({data:C.data,path:C.path,parent:C});if(N.status==="aborted")return NI;if(N.status==="dirty")return G.dirty(),{status:"dirty",value:N.value};else return this._def.out._parseSync({data:N.value,path:C.path,parent:C})}}static create(I,G){return new KW({in:I,out:G,typeName:ZI.ZodPipeline})}}class Ib extends dI{_parse(I){let G=this._def.innerType._parse(I),C=(N)=>{if($N(N))N.value=Object.freeze(N.value);return N};return MZ(G)?G.then((N)=>C(N)):C(G)}unwrap(){return this._def.innerType}}Ib.create=(I,G)=>{return new Ib({innerType:I,typeName:ZI.ZodReadonly,...VI(G)})};function gh(I,G){let C=typeof I==="function"?I(G):typeof I==="string"?{message:I}:I;return typeof C==="string"?{message:C}:C}function yh(I,G={},C){if(I)return qY.create().superRefine((N,Y)=>{let Z=I(N);if(Z instanceof Promise)return Z.then((b)=>{if(!b){let W=gh(G,N),l=W.fatal??C??!0;Y.addIssue({code:"custom",...W,fatal:l})}});if(!Z){let b=gh(G,N),W=b.fatal??C??!0;Y.addIssue({code:"custom",...b,fatal:W})}return});return qY.create()}var w3={object:iI.lazycreate},ZI;(function(I){I.ZodString="ZodString",I.ZodNumber="ZodNumber",I.ZodNaN="ZodNaN",I.ZodBigInt="ZodBigInt",I.ZodBoolean="ZodBoolean",I.ZodDate="ZodDate",I.ZodSymbol="ZodSymbol",I.ZodUndefined="ZodUndefined",I.ZodNull="ZodNull",I.ZodAny="ZodAny",I.ZodUnknown="ZodUnknown",I.ZodNever="ZodNever",I.ZodVoid="ZodVoid",I.ZodArray="ZodArray",I.ZodObject="ZodObject",I.ZodUnion="ZodUnion",I.ZodDiscriminatedUnion="ZodDiscriminatedUnion",I.ZodIntersection="ZodIntersection",I.ZodTuple="ZodTuple",I.ZodRecord="ZodRecord",I.ZodMap="ZodMap",I.ZodSet="ZodSet",I.ZodFunction="ZodFunction",I.ZodLazy="ZodLazy",I.ZodLiteral="ZodLiteral",I.ZodEnum="ZodEnum",I.ZodEffects="ZodEffects",I.ZodNativeEnum="ZodNativeEnum",I.ZodOptional="ZodOptional",I.ZodNullable="ZodNullable",I.ZodDefault="ZodDefault",I.ZodCatch="ZodCatch",I.ZodPromise="ZodPromise",I.ZodBranded="ZodBranded",I.ZodPipeline="ZodPipeline",I.ZodReadonly="ZodReadonly"})(ZI||(ZI={}));var O3=(I,G={message:`Input not instance of ${I.name}`})=>yh((C)=>C instanceof I,G),kh=gC.create,Eh=oN.create,F3=pW.create,u3=rN.create,zh=iZ.create,v3=DY.create,g3=vW.create,A3=TZ.create,J3=PZ.create,p3=qY.create,K3=_N.create,y3=fC.create,k3=gW.create,E3=AC.create,z3=iI.create,a3=iI.strictCreate,D3=tZ.create,q3=a0.create,U3=fZ.create,j3=$C.create,B3=AW.create,n3=JW.create,x3=UY.create,M3=sZ.create,S3=$Z.create,s3=_Z.create,i3=eN.create,T3=oZ.create,P3=jY.create,t3=KC.create,f3=JC.create,$3=uN.create,_3=KC.createWithPreprocess,o3=KW.create,r3=()=>kh().optional(),e3=()=>Eh().optional(),Iz=()=>zh().optional(),Gz={string:(I)=>gC.create({...I,coerce:!0}),number:(I)=>oN.create({...I,coerce:!0}),boolean:(I)=>iZ.create({...I,coerce:!0}),bigint:(I)=>rN.create({...I,coerce:!0}),date:(I)=>DY.create({...I,coerce:!0})};var Cz=NI;import{createHash as Nz}from"crypto";var ah={debug:0,info:1,warn:2,error:3},Yz="info",w2=Yz;function yW(I){w2=I}function Dh(){return w2}function n(I){return Nz("sha256").update("kiro-provider-audit-v1\x00").update(I).digest("hex").slice(0,16)}function y(I,G,C={}){if(ah[I]<ah[w2])return;let N=Object.fromEntries(Object.entries(C).filter((Y)=>Y[1]!==void 0));console.error(JSON.stringify({timestamp:new Date().toISOString(),level:I,event:G,...N}))}import{existsSync as Zz}from"fs";import{homedir as qh}from"os";import{posix as bz,win32 as Wz}from"path";function O2(I){return I===void 0||I.trim().length===0?void 0:I}function vN(I,...G){return I==="win32"?Wz.join(...G):bz.join(...G)}function gN(I={}){let G=I.env??process.env,C=I.platform??process.platform,N=I.homeDirectory??qh();return C==="win32"?O2(G.APPDATA)??vN(C,N,"AppData","Roaming"):O2(G.XDG_CONFIG_HOME)??vN(C,N,".config")}function lz(I={}){let G=I.env??process.env,C=I.platform??process.platform,N=I.homeDirectory??qh();return O2(G.XDG_CONFIG_HOME)??vN(C,N,".config")}function Uh(I={}){let G=I.exists??Zz,C=I.platform??process.platform,N=vN(C,gN(I),"kiro-provider","config.json");if(C!=="win32")return N;let Y=vN(C,lz(I),"kiro-provider","config.json");if(Y!==N&&!G(N)&&G(Y))return Y;return N}var q0=h.enum(["low","medium","high","xhigh","max"]),yC=h.enum(["us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-5","ap-southeast-4","ap-south-1","ap-southeast-6","ap-northeast-3","ap-northeast-2","ap-southeast-1","ap-southeast-2","ap-east-2","ap-southeast-7","ap-northeast-1","ca-central-1","ca-west-1","eu-central-1","eu-west-1","eu-west-2","eu-south-1","eu-west-3","eu-south-2","eu-north-1","eu-central-2","il-central-1","mx-central-1","me-south-1","me-central-1","sa-east-1"]);var Qz=h.array(h.string()).transform((I)=>I.map((G)=>G.trim()).filter((G)=>G.length>0)).refine((I)=>I.length>0,{message:"api_keys must contain at least one non-empty key"}),Lz=h.preprocess((I)=>typeof I==="string"&&I.trim().length===0?null:I,h.string().trim().refine((I)=>URL.canParse(I),{message:"proxy_url must be a valid URL"}).refine((I)=>{if(!URL.canParse(I))return!1;let G=new URL(I).protocol;return G==="http:"||G==="https:"},{message:"proxy_url must be http(s)"}).nullable()).default(null),F2=h.preprocess((I)=>typeof I==="string"&&I.trim().length===0?null:I,h.string().trim().min(1).nullable()).default(null),U0=h.object({host:h.string().trim().min(1).default("127.0.0.1"),port:h.number().int().min(0).max(65535).default(8787),api_keys:Qz,enable_legacy_chat_completions:h.boolean().default(!1),protocol_projection_mode:h.enum(["v3-auto","safe","native-context-safe","legacy-user-prefix"]).default("v3-auto"),responses_fidelity_mode:h.enum(["compatible","strict"]).default("compatible"),responses_instruction_lift:h.enum(["auto","off","experimental"]).default("auto"),responses_native_tool_bridge:h.enum(["auto","off","experimental"]).default("auto"),session_affinity_mode:h.enum(["explicit-only","legacy-initial-input"]).default("explicit-only"),proxy_url:Lz,sdk_http_keep_alive:h.boolean().default(!1),enforce_single_instance:h.boolean().default(!0),instance_lock_path:F2,runtime_endpoint_mode:h.enum(["legacy-q","kiro-runtime"]).default("kiro-runtime"),dynamic_model_catalog:h.boolean().default(!0),model_catalog_ttl_ms:h.number().int().min(1).max(2147483647).default(900000),model_catalog_stale_ttl_ms:h.number().int().min(1).max(2147483647).default(86400000),model_catalog_request_timeout_ms:h.number().int().min(1).max(2147483647).default(1e4),auth_source:h.enum(["local","opencode-shared"]).default("local"),opencode_auth_db_path:F2,default_region:yC.default("us-east-1"),account_selection_strategy:h.enum(["sticky","round-robin","lowest-usage"]).default("lowest-usage"),rate_limit_max_retries:h.number().int().min(0).max(100).default(3),rate_limit_retry_delay_ms:h.number().int().min(1).max(2147483647).default(5000),quota_recheck_interval_ms:h.number().int().min(1).max(2147483647).default(900000),stop_on_overage:h.boolean().default(!0),overage_threshold:h.number().int().min(0).max(1e6).default(0),quota_recheck_timeout_ms:h.number().int().min(1).max(2147483647).default(1e4),quota_recheck_concurrency:h.number().int().min(1).max(32).default(4),account_maintenance_enabled:h.boolean().default(!0),account_maintenance_interval_ms:h.number().int().min(1000).max(2147483647).default(60000),account_maintenance_timeout_ms:h.number().int().min(1000).max(2147483647).default(120000),account_maintenance_concurrency:h.number().int().min(1).max(32).default(4),usage_refresh_interval_ms:h.number().int().min(1000).max(2147483647).default(900000),max_request_iterations:h.number().int().min(1).max(1000).default(20),request_timeout_ms:h.number().int().min(1).max(2147483647).default(120000),stream_idle_timeout_ms:h.number().int().min(1).max(2147483647).default(60000),stream_max_attempts:h.number().int().min(1).max(10).default(3),retry_empty_completion:h.boolean().default(!0),max_request_body_bytes:h.number().int().min(1).max(2147483647).default(10485760),token_expiry_buffer_ms:h.number().int().min(1).max(2147483647).default(300000),session_affinity_ttl_ms:h.number().int().min(1).max(2147483647).default(86400000),session_affinity_max_entries:h.number().int().min(1).max(1e6).default(1e4),reasoning_replay_key_path:F2,reasoning_replay_keys:h.array(h.string().trim().min(1)).default([]),reasoning_replay_ttl_ms:h.number().int().min(1).max(2147483647).default(86400000),reasoning_replay_max_entries:h.number().int().min(1).max(1e6).default(1e4),effort:q0.nullable().default(null),auto_effort_mapping:h.boolean().default(!0),log_level:h.enum(["debug","info","warn","error"]).default("info"),test_upstream_endpoint:h.string().url().optional()});var u2='auth_source "opencode-shared" was removed in kiro-provider 0.7.0. Copy the OpenCode accounts once with "kiro-provider accounts import [--from <path>]", then set auth_source to "local" or delete the key; the provider-owned store (~/.config/kiro-provider/accounts.db) is the only authentication authority.';function Rz(I){if(I.auth_source==="opencode-shared")throw new IY(u2);if(I.opencode_auth_db_path!==null)y("warn","config_opencode_auth_db_path_deprecated",{hint:"opencode_auth_db_path is ignored since 0.7.0 and will be removed; pass --from to kiro-provider accounts import instead"});return I}class IY extends Error{constructor(I,G){super(I,G);this.name="ConfigLoadError"}}var dz=U0.partial().strict(),hz=Object.keys(U0.shape),cz=[{env:"KIRO_PROVIDER_HOST",field:"host",kind:"string"},{env:"KIRO_PROVIDER_PORT",field:"port",kind:"integer"},{env:"KIRO_PROVIDER_API_KEYS",field:"api_keys",kind:"list"},{env:"KIRO_PROVIDER_ENABLE_LEGACY_CHAT_COMPLETIONS",field:"enable_legacy_chat_completions",kind:"boolean"},{env:"KIRO_PROVIDER_PROTOCOL_PROJECTION_MODE",field:"protocol_projection_mode",kind:"string"},{env:"KIRO_PROVIDER_SESSION_AFFINITY_MODE",field:"session_affinity_mode",kind:"string"},{env:"KIRO_PROVIDER_RESPONSES_FIDELITY_MODE",field:"responses_fidelity_mode",kind:"string"},{env:"KIRO_PROVIDER_RESPONSES_INSTRUCTION_LIFT",field:"responses_instruction_lift",kind:"string"},{env:"KIRO_PROVIDER_RESPONSES_NATIVE_TOOL_BRIDGE",field:"responses_native_tool_bridge",kind:"string"},{env:"KIRO_PROVIDER_PROXY_URL",field:"proxy_url",kind:"string"},{env:"KIRO_PROVIDER_SDK_HTTP_KEEP_ALIVE",field:"sdk_http_keep_alive",kind:"boolean"},{env:"KIRO_PROVIDER_ENFORCE_SINGLE_INSTANCE",field:"enforce_single_instance",kind:"boolean"},{env:"KIRO_PROVIDER_INSTANCE_LOCK_PATH",field:"instance_lock_path",kind:"string"},{env:"KIRO_PROVIDER_RUNTIME_ENDPOINT_MODE",field:"runtime_endpoint_mode",kind:"string"},{env:"KIRO_PROVIDER_DYNAMIC_MODEL_CATALOG",field:"dynamic_model_catalog",kind:"boolean"},{env:"KIRO_PROVIDER_MODEL_CATALOG_TTL_MS",field:"model_catalog_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_MODEL_CATALOG_STALE_TTL_MS",field:"model_catalog_stale_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_MODEL_CATALOG_REQUEST_TIMEOUT_MS",field:"model_catalog_request_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_AUTH_SOURCE",field:"auth_source",kind:"string"},{env:"KIRO_PROVIDER_OPENCODE_AUTH_DB_PATH",field:"opencode_auth_db_path",kind:"string"},{env:"KIRO_PROVIDER_DEFAULT_REGION",field:"default_region",kind:"string"},{env:"KIRO_PROVIDER_ACCOUNT_SELECTION_STRATEGY",field:"account_selection_strategy",kind:"string"},{env:"KIRO_PROVIDER_RATE_LIMIT_MAX_RETRIES",field:"rate_limit_max_retries",kind:"integer"},{env:"KIRO_PROVIDER_RATE_LIMIT_RETRY_DELAY_MS",field:"rate_limit_retry_delay_ms",kind:"integer"},{env:"KIRO_PROVIDER_QUOTA_RECHECK_INTERVAL_MS",field:"quota_recheck_interval_ms",kind:"integer"},{env:"KIRO_PROVIDER_STOP_ON_OVERAGE",field:"stop_on_overage",kind:"boolean"},{env:"KIRO_PROVIDER_OVERAGE_THRESHOLD",field:"overage_threshold",kind:"integer"},{env:"KIRO_PROVIDER_QUOTA_RECHECK_TIMEOUT_MS",field:"quota_recheck_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_QUOTA_RECHECK_CONCURRENCY",field:"quota_recheck_concurrency",kind:"integer"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_ENABLED",field:"account_maintenance_enabled",kind:"boolean"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_INTERVAL_MS",field:"account_maintenance_interval_ms",kind:"integer"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_TIMEOUT_MS",field:"account_maintenance_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_ACCOUNT_MAINTENANCE_CONCURRENCY",field:"account_maintenance_concurrency",kind:"integer"},{env:"KIRO_PROVIDER_USAGE_REFRESH_INTERVAL_MS",field:"usage_refresh_interval_ms",kind:"integer"},{env:"KIRO_PROVIDER_MAX_REQUEST_ITERATIONS",field:"max_request_iterations",kind:"integer"},{env:"KIRO_PROVIDER_REQUEST_TIMEOUT_MS",field:"request_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_STREAM_IDLE_TIMEOUT_MS",field:"stream_idle_timeout_ms",kind:"integer"},{env:"KIRO_PROVIDER_STREAM_MAX_ATTEMPTS",field:"stream_max_attempts",kind:"integer"},{env:"KIRO_PROVIDER_RETRY_EMPTY_COMPLETION",field:"retry_empty_completion",kind:"boolean"},{env:"KIRO_PROVIDER_MAX_REQUEST_BODY_BYTES",field:"max_request_body_bytes",kind:"integer"},{env:"KIRO_PROVIDER_TOKEN_EXPIRY_BUFFER_MS",field:"token_expiry_buffer_ms",kind:"integer"},{env:"KIRO_PROVIDER_SESSION_AFFINITY_TTL_MS",field:"session_affinity_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_SESSION_AFFINITY_MAX_ENTRIES",field:"session_affinity_max_entries",kind:"integer"},{env:"KIRO_PROVIDER_REASONING_REPLAY_KEY_PATH",field:"reasoning_replay_key_path",kind:"string"},{env:"KIRO_PROVIDER_REASONING_REPLAY_KEYS",field:"reasoning_replay_keys",kind:"list"},{env:"KIRO_PROVIDER_REASONING_REPLAY_TTL_MS",field:"reasoning_replay_ttl_ms",kind:"integer"},{env:"KIRO_PROVIDER_REASONING_REPLAY_MAX_ENTRIES",field:"reasoning_replay_max_entries",kind:"integer"},{env:"KIRO_PROVIDER_EFFORT",field:"effort",kind:"string"},{env:"KIRO_PROVIDER_AUTO_EFFORT_MAPPING",field:"auto_effort_mapping",kind:"boolean"},{env:"KIRO_PROVIDER_LOG_LEVEL",field:"log_level",kind:"string"},{env:"KIRO_PROVIDER_TEST_UPSTREAM",field:"test_upstream_endpoint",kind:"string"}];function Hz(I){return I===void 0||I.trim().length===0?void 0:I}var wz=/^[+-]?\d+$/;function Oz(I,G){let C=G.trim();if(!wz.test(C))throw new IY(`Invalid environment variable ${I}: expected a decimal integer, got "${G}"`);let N=Number(C);if(!Number.isSafeInteger(N))throw new IY(`Invalid environment variable ${I}: integer out of range, got "${G}"`);return N}function Fz(I){let G=I.trim().toLowerCase();if(G==="true"||G==="1")return!0;if(G==="false"||G==="0")return!1;return I}function uz(I){return I.split(",").map((G)=>G.trim()).filter((G)=>G.length>0)}function vz(I){let G={},C=new Map;for(let{env:N,field:Y,kind:Z}of cz){let b=Hz(I[N]);if(b===void 0)continue;switch(Z){case"integer":G[Y]=Oz(N,b);break;case"boolean":G[Y]=Fz(b);break;case"list":G[Y]=uz(b);break;case"string":G[Y]=b.trim();break}C.set(Y,N)}return{values:G,sources:C}}function gz(I,G){let C=Array.from({length:G.length+1},(N,Y)=>Y);for(let N=1;N<=I.length;N+=1){let Y=C[0];C[0]=N;for(let Z=1;Z<=G.length;Z+=1){let b=C[Z],W=C[Z-1],l=I[N-1]===G[Z-1]?0:1;C[Z]=Math.min(b+1,W+1,Y+l),Y=b}}return C[G.length]}function Az(I){let G=I.toLowerCase(),C;for(let Y of hz){let Z=gz(G,Y);if(C===void 0||Z<C.distance)C={field:Y,distance:Z}}if(!C)return;let N=C.field.startsWith(G)||G.startsWith(C.field);return C.distance<=3||N?C.field:void 0}function Jz(I){let G=I.map((C)=>{let N=Az(C);return N?`"${C}" (did you mean "${N}"?)`:`"${C}"`});return`unknown key${I.length===1?"":"s"} ${G.join(", ")}`}function pz(I,G){if(I.code===h.ZodIssueCode.unrecognized_keys)return Jz(I.keys);let C=I.path.length>0?I.path.join("."):"config",N=G?.get(String(I.path[0]));return`${C}: ${I.message}${N?` (from ${N})`:""}`}function jh(I,G){return I.issues.map((C)=>pz(C,G)).join(", ")}function Kz(I,G){if(G==="win32")return;let C;try{C=Xz(I).mode&511}catch{return}if((C&63)===0)return;y("warn","config_file_permissions_loose",{path:I,mode:`0${C.toString(8)}`,recommended_mode:"0600",hint:"the file may contain api_keys; run chmod 600 on it"})}function yz(I,G){if(!mz(I))return{};Kz(I,G);try{let C=JSON.parse(Vz(I,"utf8"));return dz.parse(C)}catch(C){if(C instanceof h.ZodError)throw new IY(`Invalid configuration file ${I}: ${jh(C)}`,{cause:C});if(C instanceof Error)throw new IY(`Unable to read configuration file ${I}: ${C.message}`,{cause:C});throw C}}function Bh(I={}){let G=I.env??process.env,C=I.platform??process.platform,N=I.configPath??Uh({env:G,platform:C}),Y;try{let Z=yz(N,C),b=vz(G);Y=new Map([...b.sources].filter(([l])=>!(l in(I.overrides??{}))));let W=U0.parse({...Z,...b.values,...I.overrides});return Rz(W)}catch(Z){if(Z instanceof IY)throw Z;if(Z instanceof h.ZodError)throw new IY(`Invalid configuration: ${jh(Z,Y)}`,{cause:Z});throw Z}}class XG extends Error{code;originalError;constructor(I,G,C){super(I);this.name="KiroTokenRefreshError",this.code=G,this.originalError=C}}function j0(I){let G=I.split("|"),C=G[0]??"";if(G.length<2)return{refreshToken:C,authMethod:"desktop"};if(G.at(-1)==="idc")return{refreshToken:C,clientId:G[1],clientSecret:G[2],authMethod:"idc"};return{refreshToken:C,authMethod:"desktop"}}function kW(I,G=120000){if(!I.access||!I.expires)return!0;return Date.now()>=I.expires-G}function Gb(I){if(I.authMethod==="idc"){if(!I.clientId||!I.clientSecret)throw new XG("Missing credentials","MISSING_CREDENTIALS");return`${I.refreshToken}|${I.clientId}|${I.clientSecret}|idc`}return`${I.refreshToken}|desktop`}var kz=["invalid_grant","invalid_client","unauthorized_client","InvalidGrantException","InvalidClientException","UnauthorizedClientException","ExpiredTokenException","InvalidTokenException","ExpiredClientException","Invalid refresh token","Invalid grant provided","Client is expired"],Ez=["MISSING_CREDENTIALS","INVALID_RESPONSE"];function zz(I){return Ez.some((G)=>I===G||I.startsWith(`${G}:`)||I.includes(` ${G}:`))}function _C(I){if(!I)return!1;if(zz(I))return!0;return kz.some((G)=>I.includes(G))}function oC(I){if(!I)return!1;let G=I.toLowerCase();return G.includes("bearer token included in the request is invalid")||G.includes("access token has expired")||G.includes("access_token expired")||G.includes("the access token expired")}var KG={stopOnOverage:!0,overageThreshold:0};function B0(I){return{stopOnOverage:I.stop_on_overage,overageThreshold:I.overage_threshold}}function EW(I){let G=I.usedCount??0,C=I.limitCount??0;return Number.isFinite(G)&&Number.isFinite(C)&&C>0&&G>=C}function az(I){return typeof I==="object"&&I!==null&&typeof I.stopOnOverage==="boolean"&&typeof I.overageThreshold==="number"?I:KG}function zW(I,G){let C=az(G);if(!C.stopOnOverage)return!1;let N=I.overageCount??0;return Number.isFinite(N)&&N>C.overageThreshold}function jI(I,G){return zW(I,G)||EW(I)}function GC(I){return _C(I)}function GY(I){let G=I&&I.length>0?I:"Account needs re-authentication";return _C(G)?G:`InvalidTokenException: ${G}`}function nh(I){return typeof I==="object"&&I!==null&&"code"in I&&typeof I.code==="string"?I.code:void 0}function Cb(I){let G=nh(I),C=I instanceof Error?I.message:String(I);return G?`${G}: ${C}`:C}function aW(I){return{error_name:I instanceof Error?I.name:"UnknownError",error_code:nh(I)}}function xh(I){if(typeof I==="object"&&I!==null&&"unref"in I&&typeof I.unref==="function")I.unref()}class v2{options;initialTimer;intervalTimer;lifecycleController=new AbortController;inFlight;constructor(I){this.options=I}start(){if(!this.options.enabled||this.initialTimer!==void 0||this.intervalTimer!==void 0)return;this.lifecycleController=new AbortController;let I=()=>{this.runOnce(this.lifecycleController.signal).catch((G)=>{if(this.lifecycleController.signal.aborted)return;y("warn","account_maintenance_pass_failed",{...aW(G)})})};this.initialTimer=setTimeout(()=>{this.initialTimer=void 0,I()},this.options.initialDelayMs??5000),this.intervalTimer=setInterval(I,this.options.intervalMs),xh(this.initialTimer),xh(this.intervalTimer),y("info","account_maintenance_started",{interval_ms:this.options.intervalMs,timeout_ms:this.options.timeoutMs,concurrency:this.options.concurrency})}stop(){if(this.initialTimer!==void 0)clearTimeout(this.initialTimer),this.initialTimer=void 0;if(this.intervalTimer!==void 0)clearInterval(this.intervalTimer),this.intervalTimer=void 0;if(!this.lifecycleController.signal.aborted)this.lifecycleController.abort(new DOMException("Account maintenance stopped","AbortError"));y("info","account_maintenance_stopped",{})}runOnce(I){if(!this.options.enabled)return Promise.resolve();if(this.inFlight)return this.inFlight;let G=this.runPass(I).finally(()=>{if(this.inFlight===G)this.inFlight=void 0});return this.inFlight=G,G}async runPass(I){let G=Date.now(),C=AbortSignal.timeout(this.options.timeoutMs),N=I?AbortSignal.any([I,C]):C,Y=this.options.accountManager.reconcileFromDb(),Z=this.overagePolicy(),b=0,W=0,l=[];for(let V of Y){if(GC(V.unhealthyReason)||jI(V,Z))continue;let R=this.authDetails(V);if(R===void 0){W+=1;continue}if(kW(R,this.options.tokenExpiryBufferMs))l.push({account:V,auth:R})}let Q=0,L=async()=>{for(;;){if(N.aborted)throw N.reason;let V=l[Q];if(Q+=1,!V)return;try{await this.options.tokenRefresher.refreshIfNeeded(V.account,V.auth,N),b+=1}catch(R){W+=1,this.recordTokenFailure(V.account,R)}}};await Promise.all(Array.from({length:Math.min(this.options.concurrency,l.length)},L));let m=this.options.accountManager.reconcileFromDb();await this.options.usageRefresher.recheckDueAccounts(m,N);let X=this.options.accountManager.reconcileFromDb();await this.options.usageRefresher.syncDueAccounts(X,N),y("info","account_maintenance_pass_completed",{account_count:X.length,token_due_count:l.length,token_refreshed_count:b,token_failed_count:W,duration_ms:Date.now()-G})}overagePolicy(){return this.options.overagePolicy??this.options.accountManager.getOveragePolicy?.()??KG}authDetails(I){try{return this.options.accountManager.toAuthDetails(I)}catch(G){this.recordTokenFailure(I,G);return}}recordTokenFailure(I,G){let C=Cb(G);if(_C(C))try{this.options.accountManager.markUnhealthy(I,GY(C))}catch{}y("warn","account_maintenance_token_refresh_failed",{account_hash:n(I.id),...aW(G)})}}function Mh(I,G){if(!G)return I;G.start();let C=I.stop.bind(I),N=(Y)=>{try{G.stop()}finally{C(Y)}};try{Object.defineProperty(I,"stop",{configurable:!0,value:N})}catch(Y){try{G.stop()}finally{C(!0)}throw Y}return I}function Dz(I){throw TypeError(`Unsupported account selection strategy: ${String(I)}`)}function BY(I,G,C=KG){if(GC(I.unhealthyReason))return!1;if(jI(I,C))return!1;if(I.rateLimitResetTime>G)return!1;return Sh(I,G)}function Sh(I,G){if(I.isHealthy||oC(I.unhealthyReason))return!0;return I.recoveryTime!==void 0&&I.recoveryTime<=G}function sh(I,G,C=KG){if(!zW(I,C))return!1;if(GC(I.unhealthyReason))return!1;if(EW(I))return!1;return Sh(I,G)}function ih(I,G,C,N=KG){return I.filter((Y)=>BY(Y,G,N)).filter((Y)=>C?.has(Y.id)??!0).sort((Y,Z)=>Y.id.localeCompare(Z.id))}function Th(I,G,C,N=KG){return I.filter((Y)=>BY(Y,G,N)&&(C?.has(Y.id)??!0)).length}class g2{strategy;stickyId;roundRobinCursor=0;constructor(I){this.strategy=I}pick(I,G){return I.find(({id:C})=>C===G)??this.pickByStrategy(I)}retainSticky(I){if(this.stickyId&&!I.some(({id:G})=>G===this.stickyId))this.stickyId=void 0}forget(I){if(this.stickyId===I)this.stickyId=void 0}pickByStrategy(I){switch(this.strategy){case"sticky":{let C=I.find(({id:N})=>N===this.stickyId)??I[0];if(!C)throw RangeError("Candidate list cannot be empty");return this.stickyId=C.id,C}case"round-robin":{let G=I[this.roundRobinCursor%I.length];if(!G)throw RangeError("Candidate list cannot be empty");return this.roundRobinCursor+=1,G}case"lowest-usage":{let G=[...I].sort((C,N)=>(C.usedCount??0)-(N.usedCount??0)||(C.lastUsed??0)-(N.lastUsed??0)||C.id.localeCompare(N.id))[0];if(!G)throw RangeError("Candidate list cannot be empty");return G}default:return Dz(this.strategy)}}}import{createHash as Au}from"crypto";import{Agent as re}from"http";import{Agent as ee}from"https";var LY=CI(EC(),1);var Zl=CI(EC(),1);var bl=CI(EC(),1);var zN=CI(EC(),1);var CC=CI(EC(),1);var aI=CI(qG(),1);var Kb=CI(QY(),1),bu=CI(CY(),1);var CV=CI(d4(),1);var Wl=CI(jG(),1);var lC=CI(SY(),1);var BI=CI(Nl(),1);var hI=CI(pN(),1);var cb=CI(QY(),1);var hb=CI(pN(),1);var eO=async(I,G,C)=>{return{operation:hb.getSmithyContext(G).operation}};function dT(I){return{schemeId:"smithy.api#httpBearerAuth",propertiesExtractor:({profile:G,filepath:C,configFilepath:N,ignoreCache:Y},Z)=>({identityProperties:{profile:G,filepath:C,configFilepath:N,ignoreCache:Y}})}}var IF=(I)=>{let G=[];switch(I.operation){default:G.push(dT(I))}return G},GF=(I)=>{let G=cb.memoizeIdentityProvider(I.token,cb.isIdentityExpired,cb.doesIdentityRequireRefresh);return Object.assign(I,{authSchemePreference:hb.normalizeProvider(I.authSchemePreference??[]),token:G})};var CF=(I)=>{return Object.assign(I,{useDualstackEndpoint:I.useDualstackEndpoint??!1,useFipsEndpoint:I.useFipsEndpoint??!1,defaultSigningName:"amazoncodewhispererstreamingservice"})},NF={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var YF={name:"@aws/codewhisperer-streaming-client",description:"@aws/codewhisperer-streaming-client",version:"1.0.45",scripts:{build:"concurrently 'npm:build:cjs' 'npm:build:es' 'npm:build:types'","build:cjs":"tsc -p tsconfig.cjs.json","build:es":"tsc -p tsconfig.es.json","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",prepack:"npm run clean && npm run build"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{tslib:"^2.6.2","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.974.7","@aws-sdk/middleware-host-header":"^3.972.10","@aws-sdk/middleware-logger":"^3.972.10","@aws-sdk/middleware-recursion-detection":"^3.972.11","@aws-sdk/middleware-user-agent":"^3.972.37","@aws-sdk/region-config-resolver":"^3.972.13","@aws-sdk/token-providers":"^3.1040.0","@aws-sdk/types":"^3.973.8","@aws-sdk/util-endpoints":"^3.996.8","@aws-sdk/util-user-agent-browser":"^3.972.10","@aws-sdk/util-user-agent-node":"^3.973.23","@smithy/config-resolver":"^4.4.17","@smithy/core":"^3.23.17","@smithy/eventstream-serde-browser":"^4.2.14","@smithy/eventstream-serde-config-resolver":"^4.3.14","@smithy/eventstream-serde-node":"^4.2.14","@smithy/fetch-http-handler":"^5.3.17","@smithy/hash-node":"^4.2.14","@smithy/invalid-dependency":"^4.2.14","@smithy/middleware-content-length":"^4.2.14","@smithy/middleware-endpoint":"^4.4.32","@smithy/middleware-retry":"^4.5.7","@smithy/middleware-serde":"^4.2.20","@smithy/middleware-stack":"^4.2.14","@smithy/node-config-provider":"^4.3.14","@smithy/node-http-handler":"^4.6.1","@smithy/protocol-http":"^5.3.14","@smithy/smithy-client":"^4.12.13","@smithy/types":"^4.14.1","@smithy/url-parser":"^4.2.14","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.49","@smithy/util-defaults-mode-node":"^4.2.54","@smithy/util-endpoints":"^3.4.2","@smithy/util-middleware":"^4.2.14","@smithy/util-retry":"^4.3.6","@smithy/util-utf8":"^4.2.2"},devDependencies:{"@tsconfig/node20":"20.1.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3","@types/node":"^20.14.8"},engines:{node:">=20.0.0"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},license:"Apache-2.0"};var e1=CI(EC(),1),Iu=CI(dV(),1);var Ab=CI(qG(),1);var nG=CI(qG(),1);var sF=300000,wb="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var H1=async(I,G={},C)=>{let{SSOOIDCClient:N}=await Promise.resolve().then(() => CI(rV(),1)),Y=(b)=>G.clientConfig?.[b]??G.parentClientConfig?.[b]??C?.[b];return new N(Object.assign({},G.clientConfig??{},{region:I??G.clientConfig?.region,logger:Y("logger"),userAgentAppId:Y("userAgentAppId")}))};var w1=async(I,G,C={},N)=>{let{CreateTokenCommand:Y}=await Promise.resolve().then(() => CI(rV(),1));return(await H1(G,C,N)).send(new Y({clientId:I.clientId,clientSecret:I.clientSecret,refreshToken:I.refreshToken,grantType:"refresh_token"}))};var O1=CI(qG(),1);var eV=(I)=>{if(I.expiration&&I.expiration.getTime()<Date.now())throw new O1.TokenProviderError(`Token is expired. ${wb}`,!1)};var F1=CI(qG(),1);var XY=(I,G,C=!1)=>{if(typeof G>"u")throw new F1.TokenProviderError(`Value not present for '${I}' in SSO Token${C?". Cannot refresh":""}. ${wb}`,!1)};var u1=CI(qG(),1);import{promises as M_}from"fs";var{writeFile:S_}=M_,v1=(I,G)=>{let C=u1.getSSOTokenFilepath(I),N=JSON.stringify(G,null,2);return S_(C,N)};var g1=new Date(0),A1=(I={})=>async({callerClientConfig:G}={})=>{I.logger?.debug("@aws-sdk/token-providers - fromSso");let C=await nG.parseKnownFiles(I),N=nG.getProfileName({profile:I.profile??G?.profile}),Y=C[N];if(!Y)throw new nG.TokenProviderError(`Profile '${N}' could not be found in shared credentials file.`,!1);else if(!Y.sso_session)throw new nG.TokenProviderError(`Profile '${N}' is missing required property 'sso_session'.`);let Z=Y.sso_session,W=(await nG.loadSsoSessionData(I))[Z];if(!W)throw new nG.TokenProviderError(`Sso session '${Z}' could not be found in shared credentials file.`,!1);for(let R of["sso_start_url","sso_region"])if(!W[R])throw new nG.TokenProviderError(`Sso session '${Z}' is missing required property '${R}'.`,!1);let{sso_start_url:l,sso_region:Q}=W,L;try{L=await nG.getSSOTokenFromFile(Z)}catch(R){throw new nG.TokenProviderError(`The SSO session token associated with profile=${N} was not found or is invalid. ${wb}`,!1)}XY("accessToken",L.accessToken),XY("expiresAt",L.expiresAt);let{accessToken:m,expiresAt:X}=L,V={token:m,expiration:new Date(X)};if(V.expiration.getTime()-Date.now()>sF)return V;if(Date.now()-g1.getTime()<30000)return eV(V),V;XY("clientId",L.clientId,!0),XY("clientSecret",L.clientSecret,!0),XY("refreshToken",L.refreshToken,!0);try{g1.setTime(Date.now());let R=await w1(L,Q,I,G);XY("accessToken",R.accessToken),XY("expiresIn",R.expiresIn);let d=new Date(Date.now()+R.expiresIn*1000);try{await v1(Z,{...L,accessToken:R.accessToken,expiresAt:d.toISOString(),refreshToken:R.refreshToken})}catch(c){}return{token:R.accessToken,expiration:d}}catch(R){return eV(V),V}};var IX=(I={})=>Ab.memoize(Ab.chain(A1(I),async()=>{throw new Ab.TokenProviderError("Could not load token from any providers",!1)}),(G)=>G.expiration!==void 0&&G.expiration.getTime()-Date.now()<300000,(G)=>G.expiration!==void 0);var WN=CI(EC(),1);var Gu=CI(QY(),1);var WQ=CI(d4(),1);var GX=CI(UG(),1);var aN=CI(qG(),1);var OQ=CI(B4(),1);var CX=CI(UG(),1);var NX=CI(qG(),1);var ZG=CI(Nl(),1);var _1=CI(t4(),1),o1=CI(QY(),1);var YX=CI(jG(),1);var Jb=CI(UG(),1);var oY=CI(UG(),1);var gG=CI(SY(),1);var cl="ref",rY=-1,lQ=!0,J1="isSet",k1="PartitionResult",QQ="booleanEquals",ZX="getAttr",p1={[cl]:"Endpoint"},bX={[cl]:k1},pb={},K1=[{[cl]:"Region"}],y1={conditions:[[J1,[p1]],[J1,K1],["aws.partition",K1,k1],[QQ,[{[cl]:"UseFIPS"},lQ]],[QQ,[{[cl]:"UseDualStack"},lQ]],[QQ,[{fn:ZX,argv:[bX,"supportsDualStack"]},lQ]],[QQ,[{fn:ZX,argv:[bX,"supportsFIPS"]},lQ]],["stringEquals",[{fn:ZX,argv:[bX,"name"]},"aws-us-gov"]]],results:[[rY],[rY,"Invalid Configuration: FIPS and custom endpoint are not supported"],[rY,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[p1,pb],["https://amazoncodewhispererstreamingservice-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",pb],[rY,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://amazoncodewhispererstreamingservice.{Region}.amazonaws.com",pb],["https://amazoncodewhispererstreamingservice-fips.{Region}.{PartitionResult#dnsSuffix}",pb],[rY,"FIPS is enabled but this partition does not support FIPS"],["https://amazoncodewhispererstreamingservice.{Region}.{PartitionResult#dualStackDnsSuffix}",pb],[rY,"DualStack is enabled but this partition does not support DualStack"],["https://amazoncodewhispererstreamingservice.{Region}.{PartitionResult#dnsSuffix}",pb],[rY,"Invalid Configuration: Missing Region"]]},s_=2,xG=1e8,i_=new Int32Array([-1,1,-1,0,13,3,1,4,xG+12,2,5,xG+12,3,8,6,4,7,xG+11,5,xG+9,xG+10,4,11,9,6,10,xG+8,7,xG+6,xG+7,5,12,xG+5,6,xG+4,xG+5,3,xG+1,14,4,xG+2,xG+3]),E1=gG.BinaryDecisionDiagram.from(i_,s_,y1.conditions,y1.results);var T_=new gG.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),z1=(I,G={})=>{return T_.get(I,()=>gG.decideEndpoint(E1,{endpointParams:I,logger:G.logger}))};gG.customEndpointFunctions.aws=CC.awsEndpointFunctions;var QX=CI(CY(),1);class MG extends hI.ServiceException{constructor(I){super(I);Object.setPrototypeOf(this,MG.prototype)}}class LQ extends MG{name="AccessDeniedException";$fault="client";reason;constructor(I){super({name:"AccessDeniedException",$fault:"client",...I});Object.setPrototypeOf(this,LQ.prototype),this.reason=I.reason}}class mQ extends MG{name="ConflictException";$fault="client";reason;constructor(I){super({name:"ConflictException",$fault:"client",...I});Object.setPrototypeOf(this,mQ.prototype),this.reason=I.reason}}class VQ extends MG{name="InternalServerException";$fault="server";$retryable={};reason;constructor(I){super({name:"InternalServerException",$fault:"server",...I});Object.setPrototypeOf(this,VQ.prototype),this.reason=I.reason}}class XQ extends MG{name="ThrottlingException";$fault="client";$retryable={throttling:!0};reason;constructor(I){super({name:"ThrottlingException",$fault:"client",...I});Object.setPrototypeOf(this,XQ.prototype),this.reason=I.reason}}class RQ extends MG{name="ValidationException";$fault="client";reason;constructor(I){super({name:"ValidationException",$fault:"client",...I});Object.setPrototypeOf(this,RQ.prototype),this.reason=I.reason}}class dQ extends MG{name="ResourceNotFoundException";$fault="client";constructor(I){super({name:"ResourceNotFoundException",$fault:"client",...I});Object.setPrototypeOf(this,dQ.prototype)}}class hQ extends MG{name="ServiceUnavailableException";$fault="server";constructor(I){super({name:"ServiceUnavailableException",$fault:"server",...I});Object.setPrototypeOf(this,hQ.prototype)}}class cQ extends MG{name="ServiceQuotaExceededException";$fault="client";reason;constructor(I){super({name:"ServiceQuotaExceededException",$fault:"client",...I});Object.setPrototypeOf(this,cQ.prototype),this.reason=I.reason}}class HQ extends MG{name="DryRunOperationException";$fault="client";responseCode;constructor(I){super({name:"DryRunOperationException",$fault:"client",...I});Object.setPrototypeOf(this,HQ.prototype),this.responseCode=I.responseCode}}var a1=QX.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazon.aws.codewhisperer.streaming"),P_=[-3,"smithy.ts.sdk.synthetic.com.amazon.aws.codewhisperer.streaming","CodeWhispererStreamingServiceException",0,[],[]];a1.registerError(P_,MG);var lN=QX.TypeRegistry.for("com.amazon.aws.codewhisperer"),t_=[-3,"com.amazon.aws.codewhisperer","AccessDeniedException",{["error"]:"client",["httpError"]:403},["message","reason"],[0,0],1];lN.registerError(t_,LQ);var f_=[-3,"com.amazon.aws.codewhisperer","ConflictException",{["error"]:"client",["httpError"]:409},["message","reason"],[0,0],1];lN.registerError(f_,mQ);var $_=[-3,"com.amazon.aws.codewhisperer","DryRunOperationException",{["error"]:"client"},["message","responseCode"],[0,[1,32]]];lN.registerError($_,HQ);var D1=[-3,"com.amazon.aws.codewhisperer","InternalServerException",{["error"]:"server",["httpError"]:500},["message","reason"],[0,0],1];lN.registerError(D1,VQ);var __=[-3,"com.amazon.aws.codewhisperer","ResourceNotFoundException",{["error"]:"client",["httpError"]:404},["message"],[0],1];lN.registerError(__,dQ);var o_=[-3,"com.amazon.aws.codewhisperer","ServiceQuotaExceededException",{["error"]:"client",["httpError"]:402},["message","reason"],[0,0],1];lN.registerError(o_,cQ);var r_=[-3,"com.amazon.aws.codewhisperer","ServiceUnavailableException",{["error"]:"server",["httpError"]:503},["message"],[0],1];lN.registerError(r_,hQ);var e_=[-3,"com.amazon.aws.codewhisperer","ThrottlingException",{["error"]:"client",["httpError"]:429},["message","reason"],[0,0],1];lN.registerError(e_,XQ);var Io=[-3,"com.amazon.aws.codewhisperer","ValidationException",{["error"]:"client",["httpError"]:400},["message","reason"],[0,0],1];lN.registerError(Io,RQ);var q1=[a1,lN];var LX=[0,"com.amazon.aws.codewhisperer","SensitiveDocument",8,15],II=[0,"com.amazon.aws.codewhisperer","SensitiveString",8,0],Go=[0,"com.amazon.aws.codewhisperer","ToolDescription",8,0],wQ=[0,"com.amazon.aws.codewhisperer","ToolName",8,0],EI=[0,"com.amazon.aws.q","SensitiveString",8,0],Co=[3,"com.amazon.aws.codewhisperer","AdditionalContentEntry",0,["name","description","innerContext"],[[()=>II,0],[()=>II,0],[()=>II,0]],2],No=[3,"com.amazon.aws.codewhisperer","AppStudioState",0,["namespace","propertyName","propertyContext","propertyValue"],[[()=>II,0],[()=>II,0],[()=>II,0],[()=>II,0]],3],Yo=[3,"com.amazon.aws.codewhisperer","AssistantResponseEvent",0,["content","modelId"],[[()=>II,0],0],1],Zo=[3,"com.amazon.aws.codewhisperer","AssistantResponseMessage",0,["content","messageId","supplementaryWebLinks","references","followupPrompt","toolUses","cachePoint","reasoningContent"],[[()=>II,0],0,[()=>t1,0],()=>P1,[()=>U1,0],[()=>nr,0],()=>mX,[()=>Qe,0]],1];var mX=[3,"com.amazon.aws.codewhisperer","CachePoint",0,["type"],[0],1],bo=[3,"com.amazon.aws.codewhisperer","CitationEvent",0,["target","citationLink","citationText"],[()=>Ce,[()=>II,0],[()=>II,0]],2],Wo=[3,"com.amazon.aws.codewhisperer","ClientCacheConfig",0,["useClientCachingOnly"],[2]],lo=[3,"com.amazon.aws.codewhisperer","CodeDescription",0,["href"],[[()=>II,0]],1],Qo=[3,"com.amazon.aws.codewhisperer","CodeEvent",0,["content"],[[()=>II,0]],1],Lo=[3,"com.amazon.aws.codewhisperer","CodeReferenceEvent",0,["references"],[()=>P1]],mo=[3,"com.amazon.aws.codewhisperer","ConsoleState",0,["region","consoleUrl","serviceId","serviceConsolePage","serviceSubconsolePage","taskName","uxErrorMessage"],[0,[()=>II,0],0,0,0,[()=>II,0],[()=>II,0]]],Vo=[3,"com.amazon.aws.codewhisperer","ContextUsageEvent",0,["contextUsagePercentage"],[1]],Xo=[3,"com.amazon.aws.codewhisperer","ConversationState",0,["currentMessage","chatTriggerType","conversationId","workspaceId","history","customizationArn","agentContinuationId","agentTaskType"],[[()=>f1,0],0,0,0,[()=>Kr,0],0,0,0],2],Ro=[3,"com.amazon.aws.codewhisperer","DiagnosticLocation",0,["uri","range"],[[()=>II,0],()=>VX],2],ho=[3,"com.amazon.aws.codewhisperer","DiagnosticRelatedInformation",0,["location","message"],[[()=>Ro,0],[()=>II,0]],2],co=[3,"com.amazon.aws.codewhisperer","DocumentBlock",0,["name","format","source"],[0,0,[()=>be,0]],3],Ho=[3,"com.amazon.aws.codewhisperer","DocumentCitationEvent",0,["source","title","location","sourceContent"],[[()=>II,0],[()=>II,0],[()=>Ze,0],[()=>Er,0]]],wo=[3,"com.amazon.aws.codewhisperer","DocumentCitationSearchResultSpan",0,["searchResultIndex","start","end"],[1,1,1]],Oo=[3,"com.amazon.aws.codewhisperer","DocumentCitationSourceContent",0,["text"],[[()=>II,0]]],WX=[3,"com.amazon.aws.codewhisperer","DocumentCitationSpan",0,["documentIndex","start","end"],[1,1,1]],Fo=[3,"com.amazon.aws.codewhisperer","DocumentCitationWebLocation",0,["url","domain"],[[()=>II,0],[()=>II,0]]],uo=[3,"com.amazon.aws.codewhisperer","DocumentSymbol",0,["name","type","source"],[0,0,0],2],vo=[3,"com.amazon.aws.codewhisperer","DryRunSucceedEvent",0,[],[]],go=[3,"com.amazon.aws.codewhisperer","EditorState",0,["document","cursorState","relevantDocuments","useRelevantDocuments","workspaceFolders"],[[()=>n1,0],()=>Ne,[()=>Dr,0],2,[()=>xr,0]]],Ao=[3,"com.amazon.aws.codewhisperer","EnvironmentVariable",0,["key","value"],[[()=>II,0],[()=>II,0]]],Jo=[3,"com.amazon.aws.codewhisperer","EnvState",0,["operatingSystem","currentWorkingDirectory","environmentVariables","timezoneOffset"],[0,[()=>II,0],[()=>zr,0],1]],U1=[3,"com.amazon.aws.codewhisperer","FollowupPrompt",0,["content","userIntent"],[[()=>II,0],0],1],po=[3,"com.amazon.aws.codewhisperer","FollowupPromptEvent",0,["followupPrompt"],[[()=>U1,0]]],Ko=[3,"com.amazon.aws.codewhisperer","GitState",0,["status"],[[()=>II,0]]],yo=[3,"com.amazon.aws.codewhisperer","ImageBlock",0,["format","source"],[0,[()=>We,0]],2],ko=[3,"com.amazon.aws.codewhisperer","IntentsEvent",0,["intents"],[[()=>er,0]]],Eo=[3,"com.amazon.aws.codewhisperer","InvalidStateEvent",0,["reason","message"],[0,0],2],zo=[3,"com.amazon.aws.codewhisperer","MessageMetadataEvent",0,["conversationId","utteranceId"],[0,0]],ao=[3,"com.amazon.aws.codewhisperer","MetadataEvent",0,["tokenUsage"],[()=>eo]],Do=[3,"com.amazon.aws.codewhisperer","MeteringEvent",0,["usage","unit","unitPlural"],[1,0,0]],lX=[3,"com.amazon.aws.codewhisperer","Position",0,["line","character"],[1,1],2],j1=[3,"com.amazon.aws.codewhisperer","ProgrammingLanguage",0,["languageName"],[0],1],VX=[3,"com.amazon.aws.codewhisperer","Range",0,["start","end"],[()=>lX,()=>lX],2],qo=[3,"com.amazon.aws.codewhisperer","ReasoningContentEvent",8,["text","redactedContent","signature"],[[()=>II,0],21,[()=>II,0]]],Uo=[3,"com.amazon.aws.codewhisperer","ReasoningText",8,["text","signature"],[[()=>II,0],[()=>II,0]],1],jo=[3,"com.amazon.aws.codewhisperer","Reference",0,["licenseName","repository","url","recommendationContentSpan"],[0,0,0,()=>B1]],Bo=[3,"com.amazon.aws.codewhisperer","RelevantTextDocument",0,["relativeFilePath","programmingLanguage","text","documentSymbols","type"],[[()=>II,0],()=>j1,[()=>II,0],()=>T1,0],1],no=[3,"com.amazon.aws.codewhisperer","RuntimeDiagnostic",0,["source","severity","message"],[[()=>II,0],0,[()=>II,0]],3],xo=[3,"com.amazon.aws.codewhisperer","ShellHistoryEntry",0,["command","directory","exitCode","stdout","stderr"],[[()=>II,0],[()=>II,0],1,[()=>II,0],[()=>II,0]],1],Mo=[3,"com.amazon.aws.codewhisperer","ShellState",0,["shellName","shellHistory"],[0,[()=>qr,0]],1],B1=[3,"com.amazon.aws.codewhisperer","Span",0,["start","end"],[1,1]],So=[3,"com.amazon.aws.codewhisperer","SupplementaryWebLink",0,["url","title","snippet"],[[()=>II,0],[()=>II,0],[()=>II,0]],2],so=[3,"com.amazon.aws.codewhisperer","SupplementaryWebLinksEvent",0,["supplementaryWebLinks"],[[()=>t1,0]]],n1=[3,"com.amazon.aws.codewhisperer","TextDocument",0,["relativeFilePath","programmingLanguage","text","documentSymbols"],[[()=>II,0],()=>j1,[()=>II,0],()=>T1],1],io=[3,"com.amazon.aws.codewhisperer","TextDocumentDiagnostic",0,["document","range","source","severity","message","code","codeDescription","tags","relatedInformation","data"],[[()=>n1,0],()=>VX,[()=>II,0],0,[()=>II,0],[()=>II,0],[()=>lo,0],64,[()=>yr,0],[()=>II,0]],5],To=[3,"com.amazon.aws.codewhisperer","ToolInputSchema",0,["json"],[[()=>LX,0]]],x1=[3,"com.amazon.aws.codewhisperer","ToolResult",0,["toolUseId","content","status","toolName"],[0,[()=>Ur,0],0,[()=>wQ,0]],2],Po=[3,"com.amazon.aws.codewhisperer","ToolResultEvent",0,["toolResult"],[[()=>x1,0]]],to=[3,"com.amazon.aws.codewhisperer","ToolSpecification",0,["inputSchema","name","description"],[[()=>To,0],[()=>wQ,0],[()=>Go,0]],2],fo=[3,"com.amazon.aws.codewhisperer","ToolUse",0,["toolUseId","name","input"],[0,[()=>wQ,0],[()=>LX,0]],3],$o=[3,"com.amazon.aws.codewhisperer","ToolUseEvent",0,["toolUseId","name","input","stop"],[0,[()=>wQ,0],[()=>II,0],2],2];var _o=[3,"com.amazon.aws.codewhisperer","UserInputMessage",0,["content","userInputMessageContext","userIntent","origin","images","documents","modelId","cachePoint","clientCacheConfig"],[[()=>II,0],[()=>oo,0],0,0,[()=>ar,0],[()=>kr,0],0,()=>mX,()=>Wo],1],oo=[3,"com.amazon.aws.codewhisperer","UserInputMessageContext",0,["editorState","shellState","gitState","envState","appStudioContext","diagnostic","consoleState","userSettings","additionalContext","toolResults","tools"],[[()=>go,0],[()=>Mo,0],[()=>Ko,0],[()=>Jo,0],[()=>No,0],[()=>Ye,0],[()=>mo,0],()=>ro,[()=>pr,0],[()=>jr,0],[()=>Br,0]]],ro=[3,"com.amazon.aws.codewhisperer","UserSettings",0,["hasConsentedToCrossRegionCalls"],[2]];var eo=[3,"com.amazon.aws.codewhisperer.internal","TokenUsage",0,["uncachedInputTokens","outputTokens","totalTokens","cacheReadInputTokens","cacheWriteInputTokens","contextUsagePercentage","normalizedTokenUsage"],[1,1,1,1,1,1,1],3];var Ir=[3,"com.amazon.aws.codewhisperer.streaming","GenerateAssistantResponseRequest",0,["conversationState","profileArn","agentMode","additionalModelRequestFields"],[[()=>Xo,0],0,[0,{["httpHeader"]:"x-amzn-kiro-agent-mode"}],15],1],Gr=[3,"com.amazon.aws.codewhisperer.streaming","GenerateAssistantResponseResponse",0,["conversationId","generateAssistantResponseResponse"],[[0,{["httpHeader"]:"x-amzn-codewhisperer-conversation-id"}],[()=>Ge,16]],2];var Cr=[3,"com.amazon.aws.q","InteractionComponentsEvent",0,["interactionComponentEntries"],[[()=>ir,0]],1],XX=[3,"com.amazon.aws.q.interactioncomponents","Action",0,["webLink","moduleLink"],[[()=>Jr,0],[()=>Vr,0]]],RX=[3,"com.amazon.aws.q.interactioncomponents","Alert",0,["type","content"],[0,[()=>Mr,0]],2],Nr=[3,"com.amazon.aws.q.interactioncomponents","AlertComponent",0,["text"],[[()=>Hl,0]]],Yr=[3,"com.amazon.aws.q.interactioncomponents","Clarification",0,["questions","dismissible"],[[()=>sr,0],2],1],Zr=[3,"com.amazon.aws.q.interactioncomponents","ClarificationAnswerOption",0,["label","value"],[[()=>EI,0],[()=>EI,0]],2],br=[3,"com.amazon.aws.q.interactioncomponents","ClarificationQuestion",0,["question","options","allowCustom","skippable"],[[()=>EI,0],[()=>Sr,0],2,2],2],Wr=[3,"com.amazon.aws.q.interactioncomponents","CloudWatchTroubleshootingLink",0,["label","investigationPayload","defaultText"],[[()=>EI,0],[()=>EI,0],[()=>EI,0]],2],M1=[3,"com.amazon.aws.q.interactioncomponents","InfrastructureUpdate",0,["transition"],[[()=>lr,0]]],lr=[3,"com.amazon.aws.q.interactioncomponents","InfrastructureUpdateTransition",0,["currentState","nextState"],[[()=>EI,0],[()=>EI,0]],2],Qr=[3,"com.amazon.aws.q.interactioncomponents","InlineArtifact",0,["dsl","summary","title","artifactLabel"],[[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0]],4],Lr=[3,"com.amazon.aws.q.interactioncomponents","InteractionComponent",0,["text","alert","infrastructureUpdate","progress","step","taskDetails","taskReference","suggestions","section","resource","resourceList","action","clarification","inlineArtifact"],[[()=>Hl,0],[()=>RX,0],[()=>M1,0],[()=>S1,0],[()=>i1,0],[()=>vr,0],()=>Ar,[()=>Hr,0],[()=>Rr,0],[()=>dX,0],[()=>s1,0],[()=>XX,0],[()=>Yr,0],[()=>Qr,0]]],mr=[3,"com.amazon.aws.q.interactioncomponents","InteractionComponentEntry",0,["interactionComponent","interactionComponentId"],[[()=>Lr,0],0],1],Vr=[3,"com.amazon.aws.q.interactioncomponents","ModuleLink",0,["cloudWatchTroubleshootingLink"],[[()=>Wr,0]]],S1=[3,"com.amazon.aws.q.interactioncomponents","Progress",0,["content"],[[()=>Tr,0]],1],Xr=[3,"com.amazon.aws.q.interactioncomponents","ProgressComponent",0,["step"],[[()=>i1,0]]],dX=[3,"com.amazon.aws.q.interactioncomponents","Resource",0,["title","link","description","type","ARN","resourceJsonString"],[[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0],[()=>EI,0]],6],s1=[3,"com.amazon.aws.q.interactioncomponents","ResourceList",0,["items","action"],[[()=>Pr,0],[()=>XX,0]],1],Rr=[3,"com.amazon.aws.q.interactioncomponents","Section",0,["title","content","action"],[[()=>EI,0],[()=>tr,0],[()=>XX,0]],2],dr=[3,"com.amazon.aws.q.interactioncomponents","SectionComponent",0,["text","alert","resource","resourceList"],[[()=>Hl,0],[()=>RX,0],[()=>dX,0],[()=>s1,0]]],i1=[3,"com.amazon.aws.q.interactioncomponents","Step",0,["id","state","label","content"],[1,0,[()=>EI,0],[()=>fr,0]],3],hr=[3,"com.amazon.aws.q.interactioncomponents","StepComponent",0,["text"],[[()=>Hl,0]]],cr=[3,"com.amazon.aws.q.interactioncomponents","Suggestion",0,["value"],[[()=>EI,0]],1],Hr=[3,"com.amazon.aws.q.interactioncomponents","Suggestions",0,["items"],[[()=>$r,0]],1],wr=[3,"com.amazon.aws.q.interactioncomponents","TaskAction",0,["label","payload","note","primary","disabled","confirmation"],[[()=>EI,0],[()=>Ie,0],[()=>Fr,0],2,2,[()=>Or,0]],2],Or=[3,"com.amazon.aws.q.interactioncomponents","TaskActionConfirmation",0,["content"],[[()=>EI,0]]],Fr=[3,"com.amazon.aws.q.interactioncomponents","TaskActionNote",0,["content","type"],[[()=>EI,0],0],1],ur=[3,"com.amazon.aws.q.interactioncomponents","TaskComponent",0,["text","infrastructureUpdate","alert","progress"],[[()=>Hl,0],[()=>M1,0],[()=>RX,0],[()=>S1,0]]],vr=[3,"com.amazon.aws.q.interactioncomponents","TaskDetails",0,["overview","content","actions"],[[()=>gr,0],[()=>or,0],[()=>_r,0]],2],gr=[3,"com.amazon.aws.q.interactioncomponents","TaskOverview",0,["label","description"],[[()=>EI,0],[()=>EI,0]],2],Ar=[3,"com.amazon.aws.q.interactioncomponents","TaskReference",0,["taskId"],[0],1],Hl=[3,"com.amazon.aws.q.interactioncomponents","Text",0,["content"],[[()=>EI,0]],1],Jr=[3,"com.amazon.aws.q.interactioncomponents","WebLink",0,["label","url"],[[()=>EI,0],[()=>EI,0]],2];var pr=[1,"com.amazon.aws.codewhisperer","AdditionalContentList",0,[()=>Co,0]],Kr=[1,"com.amazon.aws.codewhisperer","ChatHistory",0,[()=>f1,0]],yr=[1,"com.amazon.aws.codewhisperer","DiagnosticRelatedInformationList",0,[()=>ho,0]];var kr=[1,"com.amazon.aws.codewhisperer","DocumentBlocks",0,[()=>co,0]],Er=[1,"com.amazon.aws.codewhisperer","DocumentCitationSourceContents",0,[()=>Oo,0]],T1=[1,"com.amazon.aws.codewhisperer","DocumentSymbols",0,()=>uo],zr=[1,"com.amazon.aws.codewhisperer","EnvironmentVariables",0,[()=>Ao,0]],ar=[1,"com.amazon.aws.codewhisperer","ImageBlocks",0,[()=>yo,0]],P1=[1,"com.amazon.aws.codewhisperer","References",0,()=>jo],Dr=[1,"com.amazon.aws.codewhisperer","RelevantDocumentList",0,[()=>Bo,0]],qr=[1,"com.amazon.aws.codewhisperer","ShellHistory",0,[()=>xo,0]],t1=[1,"com.amazon.aws.codewhisperer","SupplementaryWebLinks",0,[()=>So,0]],Ur=[1,"com.amazon.aws.codewhisperer","ToolResultContent",0,[()=>me,0]],jr=[1,"com.amazon.aws.codewhisperer","ToolResults",0,[()=>x1,0]],Br=[1,"com.amazon.aws.codewhisperer","Tools",0,[()=>Le,0]],nr=[1,"com.amazon.aws.codewhisperer","ToolUses",0,[()=>fo,0]],xr=[1,"com.amazon.aws.codewhisperer","WorkspaceFolderList",0,[()=>II,0]],Mr=[1,"com.amazon.aws.q.interactioncomponents","AlertComponentList",0,[()=>Nr,0]],Sr=[1,"com.amazon.aws.q.interactioncomponents","ClarificationAnswerOptionsList",0,[()=>Zr,0]],sr=[1,"com.amazon.aws.q.interactioncomponents","ClarificationQuestionList",0,[()=>br,0]],ir=[1,"com.amazon.aws.q.interactioncomponents","InteractionComponentEntryList",0,[()=>mr,0]],Tr=[1,"com.amazon.aws.q.interactioncomponents","ProgressComponentList",0,[()=>Xr,0]],Pr=[1,"com.amazon.aws.q.interactioncomponents","Resources",0,[()=>dX,0]],tr=[1,"com.amazon.aws.q.interactioncomponents","SectionComponentList",0,[()=>dr,0]],fr=[1,"com.amazon.aws.q.interactioncomponents","StepComponentList",0,[()=>hr,0]],$r=[1,"com.amazon.aws.q.interactioncomponents","SuggestionList",0,[()=>cr,0]],_r=[1,"com.amazon.aws.q.interactioncomponents","TaskActionList",0,[()=>wr,0]],or=[1,"com.amazon.aws.q.interactioncomponents","TaskComponentList",0,[()=>ur,0]],rr=[2,"com.amazon.aws.codewhisperer","IntentData",8,0,()=>le],er=[2,"com.amazon.aws.codewhisperer","IntentMap",0,[0,0],[()=>rr,0]],Ie=[2,"com.amazon.aws.q.interactioncomponents","TaskActionPayload",0,[0,0],[()=>EI,0]],f1=[4,"com.amazon.aws.codewhisperer","ChatMessage",0,["userInputMessage","assistantResponseMessage"],[[()=>_o,0],[()=>Zo,0]]],Ge=[4,"com.amazon.aws.codewhisperer","ChatResponseStream",{["streaming"]:1},["messageMetadataEvent","assistantResponseEvent","reasoningContentEvent","dryRunSucceedEvent","codeReferenceEvent","supplementaryWebLinksEvent","followupPromptEvent","codeEvent","intentsEvent","interactionComponentsEvent","toolUseEvent","toolResultEvent","metadataEvent","meteringEvent","contextUsageEvent","citationEvent","documentCitationEvent","invalidStateEvent","error"],[()=>zo,[()=>Yo,0],[()=>qo,0],()=>vo,()=>Lo,[()=>so,0],[()=>po,0],[()=>Qo,0],[()=>ko,0],[()=>Cr,0],[()=>$o,0],[()=>Po,0],()=>ao,()=>Do,()=>Vo,[()=>bo,0],[()=>Ho,0],()=>Eo,[()=>D1,0]]],Ce=[4,"com.amazon.aws.codewhisperer","CitationTarget",0,["location","range"],[1,()=>B1]],Ne=[4,"com.amazon.aws.codewhisperer","CursorState",0,["position","range"],[()=>lX,()=>VX]],Ye=[4,"com.amazon.aws.codewhisperer","Diagnostic",0,["textDocumentDiagnostic","runtimeDiagnostic"],[[()=>io,0],[()=>no,0]]],Ze=[4,"com.amazon.aws.codewhisperer","DocumentCitationLocation",0,["documentPage","documentChar","documentChunk","searchResult","web"],[()=>WX,()=>WX,()=>WX,()=>wo,[()=>Fo,0]]],be=[4,"com.amazon.aws.codewhisperer","DocumentSource",8,["bytes"],[21]];var We=[4,"com.amazon.aws.codewhisperer","ImageSource",8,["bytes"],[21]],le=[4,"com.amazon.aws.codewhisperer","IntentDataType",0,["string"],[0]],Qe=[4,"com.amazon.aws.codewhisperer","ReasoningContent",8,["reasoningText","redactedContent"],[[()=>Uo,0],21]];var Le=[4,"com.amazon.aws.codewhisperer","Tool",0,["toolSpecification","cachePoint"],[[()=>to,0],()=>mX]],me=[4,"com.amazon.aws.codewhisperer","ToolResultContentBlock",0,["text","json"],[[()=>II,0],[()=>LX,0]]];var $1=[9,"com.amazon.aws.codewhisperer.streaming","GenerateAssistantResponse",{["http"]:["POST","/generateAssistantResponse",200]},()=>Ir,()=>Gr];var r1=(I)=>{return{apiVersion:"2023-11-27",base64Decoder:I?.base64Decoder??Jb.fromBase64,base64Encoder:I?.base64Encoder??Jb.toBase64,disableHostPrefix:I?.disableHostPrefix??!1,endpointProvider:I?.endpointProvider??z1,extensions:I?.extensions??[],httpAuthSchemeProvider:I?.httpAuthSchemeProvider??IF,httpAuthSchemes:I?.httpAuthSchemes??[{schemeId:"smithy.api#httpBearerAuth",identityProvider:(G)=>G.getIdentityProvider("smithy.api#httpBearerAuth"),signer:new o1.HttpBearerAuthSigner}],logger:I?.logger??new hI.NoOpLogger,protocol:I?.protocol??_1.AwsRestJsonProtocol,protocolSettings:I?.protocolSettings??{defaultNamespace:"com.amazon.aws.codewhisperer.streaming",errorTypeRegistries:q1,version:"2023-11-27",serviceTarget:"AmazonCodeWhispererStreamingService"},serviceId:I?.serviceId??"CodeWhispererStreaming",urlParser:I?.urlParser??YX.parseUrl,utf8Decoder:I?.utf8Decoder??oY.fromUtf8,utf8Encoder:I?.utf8Encoder??oY.toUtf8}};var Cu=(I)=>{hI.emitWarningIfUnsupportedVersion(process.version);let G=NX.resolveDefaultsModeConfig(I),C=()=>G().then(hI.loadConfigsForDefaultMode),N=r1(I);e1.emitWarningIfUnsupportedVersion(process.version);let Y={profile:I?.profile,logger:N.logger};return{...N,...I,runtime:"node",defaultsMode:G,authSchemePreference:I?.authSchemePreference??aN.loadConfig(Iu.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,Y),bodyLengthChecker:I?.bodyLengthChecker??CX.calculateBodyLength,defaultUserAgentProvider:I?.defaultUserAgentProvider??WN.createDefaultUserAgentProvider({serviceId:N.serviceId,clientVersion:YF.version}),eventStreamSerdeProvider:I?.eventStreamSerdeProvider??WQ.eventStreamSerdeProvider,httpAuthSchemes:I?.httpAuthSchemes??[{schemeId:"smithy.api#httpBearerAuth",identityProvider:(Z)=>Z.getIdentityProvider("smithy.api#httpBearerAuth")||(async(b)=>{return await IX(b)(b)}),signer:new Gu.HttpBearerAuthSigner}],maxAttempts:I?.maxAttempts??aN.loadConfig(BI.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,I),region:I?.region??aN.loadConfig(aI.NODE_REGION_CONFIG_OPTIONS,{...aI.NODE_REGION_CONFIG_FILE_OPTIONS,...Y}),requestHandler:OQ.NodeHttpHandler.create(I?.requestHandler??C),retryMode:I?.retryMode??aN.loadConfig({...BI.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await C()).retryMode||ZG.DEFAULT_RETRY_MODE},I),sha256:I?.sha256??GX.Hash.bind(null,"sha256"),streamCollector:I?.streamCollector??OQ.streamCollector,useDualstackEndpoint:I?.useDualstackEndpoint??aN.loadConfig(aI.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,Y),useFipsEndpoint:I?.useFipsEndpoint??aN.loadConfig(aI.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,Y),userAgentAppId:I?.userAgentAppId??aN.loadConfig(WN.NODE_APP_ID_CONFIG_OPTIONS,Y)}};var NC=CI(EC(),1);var SG=CI(jG(),1);var Nu=(I)=>{let{httpAuthSchemes:G,httpAuthSchemeProvider:C,token:N}=I;return{setHttpAuthScheme(Y){let Z=G.findIndex((b)=>b.schemeId===Y.schemeId);if(Z===-1)G.push(Y);else G.splice(Z,1,Y)},httpAuthSchemes(){return G},setHttpAuthSchemeProvider(Y){C=Y},httpAuthSchemeProvider(){return C},setToken(Y){N=Y},token(){return N}}},Yu=(I)=>{return{httpAuthSchemes:I.httpAuthSchemes(),httpAuthSchemeProvider:I.httpAuthSchemeProvider(),token:I.token()}};var Zu=(I,G)=>{let C=Object.assign(NC.getAwsRegionExtensionConfiguration(I),hI.getDefaultExtensionConfiguration(I),SG.getHttpHandlerExtensionConfiguration(I),Nu(I));return G.forEach((N)=>N.configure(C)),Object.assign(I,NC.resolveAwsRegionExtensionConfiguration(C),hI.resolveDefaultRuntimeConfig(C),SG.resolveHttpHandlerRuntimeConfig(C),Yu(C))};class hX extends hI.Client{config;constructor(...[I]){let G=Cu(I||{});super(G);this.initConfig=G;let C=CF(G),N=zN.resolveUserAgentConfig(C),Y=BI.resolveRetryConfig(N),Z=aI.resolveRegionConfig(Y),b=LY.resolveHostHeaderConfig(Z),W=lC.resolveEndpointConfig(b),l=CC.resolveDefaultAwsRegionalEndpointsConfig(W),Q=CV.resolveEventStreamSerdeConfig(l),L=GF(Q),m=Zu(L,I?.extensions||[]);this.config=m,this.middlewareStack.use(bu.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(zN.getUserAgentPlugin(this.config)),this.middlewareStack.use(BI.getRetryPlugin(this.config)),this.middlewareStack.use(Wl.getContentLengthPlugin(this.config)),this.middlewareStack.use(LY.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Zl.getLoggerPlugin(this.config)),this.middlewareStack.use(bl.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(Kb.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:eO,identityProviderConfigProvider:async(X)=>new Kb.DefaultIdentityProviderConfig({"smithy.api#httpBearerAuth":X.token})})),this.middlewareStack.use(Kb.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class cX extends hI.Command.classBuilder().ep(NF).m(function(I,G,C,N){return[lC.getEndpointPlugin(C,I.getEndpointParameterInstructions())]}).s("AmazonCodeWhispererStreamingService","GenerateAssistantResponse",{eventStream:{output:!0}}).n("CodeWhispererStreamingClient","GenerateAssistantResponseCommand").sc($1).build(){}var VC={CONTENT_LENGTH_EXCEEDS_THRESHOLD:"CONTENT_LENGTH_EXCEEDS_THRESHOLD",DOCUMENT_COUNT_EXCEEDED:"DOCUMENT_COUNT_EXCEEDED",DOCUMENT_DUPLICATE_NAME:"DOCUMENT_DUPLICATE_NAME",DOCUMENT_MAXIMUM_PAGES_EXCEEDED:"DOCUMENT_MAXIMUM_PAGES_EXCEEDED",DOCUMENT_MODEL_NOT_SUPPORTED:"DOCUMENT_MODEL_NOT_SUPPORTED",DOCUMENT_PASSWORD_PROTECTED:"DOCUMENT_PASSWORD_PROTECTED",DOCUMENT_SIZE_EXCEEDED:"DOCUMENT_SIZE_EXCEEDED",IMAGE_COUNT_EXCEEDED:"IMAGE_COUNT_EXCEEDED",IMAGE_DIMENSION_EXCEEDED:"IMAGE_DIMENSION_EXCEEDED",IMAGE_FORMAT_UNSUPPORTED:"IMAGE_FORMAT_UNSUPPORTED",IMAGE_MIME_MISMATCH:"IMAGE_MIME_MISMATCH",IMAGE_SIZE_EXCEEDED:"IMAGE_SIZE_EXCEEDED",INVALID_CONVERSATION_ID:"INVALID_CONVERSATION_ID",INVALID_KMS_GRANT:"INVALID_KMS_GRANT",INVALID_MODEL_ID:"INVALID_MODEL_ID",PROMPT_TOO_LONG:"PROMPT_TOO_LONG",REQUEST_BODY_INVALID:"REQUEST_BODY_INVALID",REQUEST_BODY_INVALID_JSON:"REQUEST_BODY_INVALID_JSON",THINKING_SIGNATURE_INVALID:"THINKING_SIGNATURE_INVALID",TOOL_CONFIG_MISSING:"TOOL_CONFIG_MISSING",TOOL_DUPLICATE:"TOOL_DUPLICATE",TOOL_SCHEMA_INVALID:"TOOL_SCHEMA_INVALID",TOOL_USE_RESULT_MISMATCH:"TOOL_USE_RESULT_MISMATCH"},FQ={CONVERSATION_LIMIT_EXCEEDED:"CONVERSATION_LIMIT_EXCEEDED",MONTHLY_REQUEST_COUNT:"MONTHLY_REQUEST_COUNT",OVERAGE_REQUEST_LIMIT_EXCEEDED:"OVERAGE_REQUEST_LIMIT_EXCEEDED"};var Ju=CI(t4(),1),pu=CI(B4(),1);var Fu=CI(OX(),1);import*as LN from"net";import*as Ol from"tls";import te from"assert";import*as hu from"net";import*as cu from"http";import{Agent as Pe}from"https";var QN=Symbol("AgentBaseInternalState");class FX extends cu.Agent{constructor(I){super(I);this[QN]={}}isSecureEndpoint(I){if(I){if(typeof I.secureEndpoint==="boolean")return I.secureEndpoint;if(typeof I.protocol==="string")return I.protocol==="https:"}let{stack:G}=Error();if(typeof G!=="string")return!1;return G.split(`
|
|
58
58
|
`).some((C)=>C.indexOf("(https.js:")!==-1||C.indexOf("node:https:")!==-1)}incrementSockets(I){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[I])this.sockets[I]=[];let G=new hu.Socket({writable:!1});return this.sockets[I].push(G),this.totalSocketCount++,G}decrementSockets(I,G){if(!this.sockets[I]||G===null)return;let C=this.sockets[I],N=C.indexOf(G);if(N!==-1){if(C.splice(N,1),this.totalSocketCount--,C.length===0)delete this.sockets[I]}}getName(I){if(this.isSecureEndpoint(I))return Pe.prototype.getName.call(this,I);return super.getName(I)}createSocket(I,G,C){let N={...G,secureEndpoint:this.isSecureEndpoint(G)},Y=this.getName(N),Z=this.incrementSockets(Y);Promise.resolve().then(()=>this.connect(I,N)).then((b)=>{if(this.decrementSockets(Y,Z),typeof b.addRequest==="function")try{return b.addRequest(I,N)}catch(W){return C(W)}this[QN].currentSocket=b,super.createSocket(I,G,C)},(b)=>{this.decrementSockets(Y,Z),C(b)})}createConnection(){let I=this[QN].currentSocket;if(this[QN].currentSocket=void 0,!I)throw Error("No socket was returned in the `connect()` function");return I}get defaultPort(){return this[QN].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(I){if(this[QN])this[QN].defaultPort=I}get protocol(){return this[QN].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(I){if(this[QN])this[QN].protocol=I}}import{URL as fe}from"url";var Hu=CI(OX(),1),JQ=Hu.default("https-proxy-agent:parse-proxy-response");function uX(I){return new Promise((G,C)=>{let N=0,Y=[];function Z(){let L=I.read();if(L)Q(L);else I.once("readable",Z)}function b(){I.removeListener("end",W),I.removeListener("error",l),I.removeListener("readable",Z)}function W(){b(),JQ("onend"),C(Error("Proxy connection ended before receiving CONNECT response"))}function l(L){b(),JQ("onerror %o",L),C(L)}function Q(L){Y.push(L),N+=L.length;let m=Buffer.concat(Y,N),X=m.indexOf(`\r
|
|
59
59
|
\r
|
|
60
60
|
`);if(X===-1){JQ("have not received end of HTTP headers yet..."),Z();return}let V=m.slice(0,X).toString("ascii").split(`\r
|
|
@@ -331,7 +331,7 @@ data: ${JSON.stringify({type:"error",error:{type:G,message:I}})}
|
|
|
331
331
|
`)}function sNI(I){if(I.length<=1)return nN(I);return I.map((G)=>`[${G.role}]
|
|
332
332
|
${nN([G])}`).join(`
|
|
333
333
|
|
|
334
|
-
`)}function iNI(I,G){let C=I.messages.findIndex((b)=>!BC(b)),N=C<0?void 0:I.messages.slice(C).find((b)=>BC(b));if(N!==void 0)return{ok:!1,message:"Kiro Runtime systemPrompt can represent only a leading instruction; intermediate or trailing system/developer input cannot use the native field",code:"unsupported_instruction_position",param:N.path};let Y=G.filter((b)=>nN([b]).length>0);if(Y.length>1)return{ok:!1,message:"Kiro Runtime exposes one systemPrompt string and cannot preserve multiple system/developer message boundaries or role priority",code:"unsupported_instruction_sequence",param:Y[1]?.path};let Z=Y[0];if(Z!==void 0&&Z.content.length!==1)return{ok:!1,message:"Kiro Runtime exposes one systemPrompt string and cannot preserve multiple instruction content-block boundaries",code:"unsupported_instruction_sequence",param:Z.content[1]?.path??Z.path};return{ok:!0,...Z!==void 0?{instruction:Z,systemPrompt:nN([Z])}:{}}}function TNI(I){for(let G of I){if(G.role==="system"||G.role==="developer")continue;let C
|
|
334
|
+
`)}function iNI(I,G){let C=I.messages.findIndex((b)=>!BC(b)),N=C<0?void 0:I.messages.slice(C).find((b)=>BC(b));if(N!==void 0)return{ok:!1,message:"Kiro Runtime systemPrompt can represent only a leading instruction; intermediate or trailing system/developer input cannot use the native field",code:"unsupported_instruction_position",param:N.path};let Y=G.filter((b)=>nN([b]).length>0);if(Y.length>1)return{ok:!1,message:"Kiro Runtime exposes one systemPrompt string and cannot preserve multiple system/developer message boundaries or role priority",code:"unsupported_instruction_sequence",param:Y[1]?.path};let Z=Y[0];if(Z!==void 0&&Z.content.length!==1)return{ok:!1,message:"Kiro Runtime exposes one systemPrompt string and cannot preserve multiple instruction content-block boundaries",code:"unsupported_instruction_sequence",param:Z.content[1]?.path??Z.path};return{ok:!0,...Z!==void 0?{instruction:Z,systemPrompt:nN([Z])}:{}}}function TNI(I){for(let G of I){if(G.role==="system"||G.role==="developer")continue;let C=!1,N=!1;for(let Y of G.content)if(Y.type==="text"){if(N)throw new bI(`Message ${G.path} interleaves multiple text content blocks with non-text content, but Kiro exposes only one text field and cannot preserve their ordering`,"unsupported_content_block_projection",Y.path);C=!0}else if(C)N=!0}}function PNI(I,G){let C=I.messages.filter(BC);if(C.length>0&&I.projectionMode==="safe")throw new bI("Kiro accepted additionalContext structurally but did not preserve instruction content or priority; safe mode cannot project system/developer/instructions","unsupported_instruction_projection");for(let V of C)if(V.content.some((R)=>R.type!=="text")||V.toolCalls.length>0)throw new bI(`Instruction ${V.path} contains non-text content that legacy projection cannot represent`,"unsupported_instruction_projection");let N=iNI(I,C);if(I.projectionMode==="native-context-safe"||(I.projectionMode==="v3-auto"||I.protocol==="responses")&&G&&N.ok){if(!N.ok)throw new bI(N.message,N.code,N.param);if(N.instruction!==void 0&&!G)throw new bI("Kiro Runtime did not advertise system_field_injection for this account; native-context-safe remains fail-closed","native_context_capability_unavailable",N.instruction.path);let V=[],R=new Map;for(let[c,H]of I.messages.entries()){if(BC(H))continue;R.set(c,V.length),V.push(iQ(H))}let d=N.systemPrompt;return{messages:V,projectedIndexByOriginal:R,...d!==void 0?{systemPrompt:d}:{},diagnostics:{projectionMode:I.projectionMode,instructionChannel:d===void 0?"none":"kiro-runtime-system-prompt",inputMessageCount:I.messages.length,outputMessageCount:V.length,prefixInstructionCount:C.length,trailingInstructionCount:0,prefixAction:d===void 0?"none":"native_system_prompt",suffixAction:"none"}}}if(I.projectionMode==="v3-auto"){let V=[],R=new Map;for(let[O,g]of I.messages.entries()){if(BC(g))continue;R.set(O,V.length),V.push(iQ(g))}let d=V.length,c=C.filter((O)=>nN([O]).length>0),H="none",w="none";if(d>0&&c.length>0){let O=c[0]?.path??"kiro-cli-forced-role";V.unshift({role:"user",content:[kI(sNI(c),"kiro-cli-forced-role")],toolCalls:[],path:O},{role:"assistant",content:[kI("I will follow these instructions.","kiro-cli-forced-role-acknowledgement")],toolCalls:[],path:"kiro-cli-forced-role-acknowledgement"}),H="kiro_cli_forced_role";for(let[g,F]of R)R.set(g,F+2);if(V.at(-1)?.role==="assistant")V.push({role:"user",content:[kI("Now follow the instruction.",O)],toolCalls:[],path:O}),w="synthetic_user"}let v=I.messages.length;while(v>0&&BC(I.messages[v-1]))v-=1;let u=v<I.messages.length&&I.messages.slice(0,v).some((O)=>!BC(O))?I.messages.length-v:0;return{messages:V,projectedIndexByOriginal:R,diagnostics:{projectionMode:I.projectionMode,instructionChannel:c.length===0?"none":"kiro-cli-forced-role",inputMessageCount:I.messages.length,outputMessageCount:V.length,prefixInstructionCount:C.length-u,trailingInstructionCount:u,prefixAction:H,suffixAction:w}}}let Z=I.messages.length;while(Z>0&&BC(I.messages[Z-1]))Z-=1;let W=I.messages.slice(0,Z).some((V)=>!BC(V))?I.messages.slice(Z):[],l=W.length>0?C.slice(0,C.length-W.length):C,Q="none",L="none",m=[],X=new Map;if(I.protocol==="responses"){let V=[],R=()=>{if(V.length===0)return;m.push({role:"user",content:[kI(nN(V),V[0]?.path??"instructions")],toolCalls:[],path:V[0]?.path??"instructions"}),V=[],Q="synthetic_leading_user"};for(let[d,c]of I.messages.entries()){if(BC(c)){if(W.length===0||d<Z)V.push(c);continue}let H=iQ(c);if(V.length>0)if(c.role==="user"||c.role==="tool")H={...H,content:[kI(`${nN(V)}
|
|
335
335
|
|
|
336
336
|
`,V[0]?.path??"instructions"),...H.content]},V=[],Q="prepend_first_user";else R();X.set(d,m.length),m.push(H)}R()}else{for(let[V,R]of I.messages.entries()){if(BC(R))continue;X.set(V,m.length),m.push(iQ(R))}if(l.length>0){let V=nN(l),R=m.findIndex((d)=>d.role==="user");if(R<0){m.unshift({role:"user",content:[kI(V,"legacy-user-prefix")],toolCalls:[],path:"legacy-user-prefix"}),Q="synthetic_leading_user";for(let[d,c]of X)X.set(d,c+1)}else{let d=m[R];if(d)m[R]={...d,content:[kI(`${V}
|
|
337
337
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sunerpy/kiro-provider",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "OpenAI Responses-compatible AWS KiroRuntime provider with native and stateless fallback transports",
|
|
5
5
|
"homepage": "https://github.com/sunerpy/kiro-provider#readme",
|
|
6
6
|
"bugs": "https://github.com/sunerpy/kiro-provider/issues",
|