diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/progress.yaml b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/progress.yaml new file mode 100644 index 0000000000..fab145de86 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/progress.yaml @@ -0,0 +1,24 @@ +examples: {} +examples_2: {} +examples_3: {} +fixOnlyOneTagName: false +operationIds: + /v1/runs/bulk: + post: BulkWorkflowRuns_runBulk + /v1/runs/bulk/{bulk_run_id}: + get: BulkWorkflowRuns_getBulk + /v1/runs/{workflow_run_id}: + get: WorkflowRuns_getWorkflowRun +operationTags: {} +renameTags: {} +requestSchemaNames: {} +responseDescriptions: {} +responseSchemaNames: {} +securityParameters: + X-Api-Key: + header: + in: header + name: X-Api-Key + securityName: apiKey + type: apiKey +validServerUrls: {} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/ruleset-version b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/ruleset-version new file mode 100644 index 0000000000..67eb68059b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/ruleset-version @@ -0,0 +1 @@ +1.2.12 \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/ruleset.js b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/ruleset.js new file mode 100644 index 0000000000..70d06bc07e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.konfig/ruleset.js @@ -0,0 +1,144 @@ +"use strict";var If=Object.create;var js=Object.defineProperty;var Pf=Object.getOwnPropertyDescriptor;var $f=Object.getOwnPropertyNames;var Tf=Object.getPrototypeOf,kf=Object.prototype.hasOwnProperty;var $t=(r,e)=>()=>(r&&(e=r(r=0)),e);var g=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Jr=(r,e)=>{for(var t in e)js(r,t,{get:e[t],enumerable:!0})},Io=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $f(e))!kf.call(r,n)&&n!==t&&js(r,n,{get:()=>e[n],enumerable:!(s=Pf(e,n))||s.enumerable});return r};var te=(r,e,t)=>(t=r!=null?If(Tf(r)):{},Io(e||!r||!r.__esModule?js(t,"default",{value:r,enumerable:!0}):t,r)),Po=r=>Io(js({},"__esModule",{value:!0}),r);var qo=g((s0,Co)=>{"use strict";var Cs,E,No={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` +`,r:"\r",t:" "},pi;function ft(r){throw{name:"SyntaxError",message:r,at:Cs,text:pi}}function B(r){return r&&r!==E&&ft("Expected '"+r+"' instead of '"+E+"'"),E=pi.charAt(Cs),Cs+=1,E}function Eo(){var r,e="";for(E==="-"&&(e="-",B("-"));E>="0"&&E<="9";)e+=E,B();if(E===".")for(e+=".";B()&&E>="0"&&E<="9";)e+=E;if(E==="e"||E==="E")for(e+=E,B(),(E==="-"||E==="+")&&(e+=E,B());E>="0"&&E<="9";)e+=E,B();return r=Number(e),isFinite(r)||ft("Bad number"),r}function jo(){var r,e,t="",s;if(E==='"')for(;B();){if(E==='"')return B(),t;if(E==="\\")if(B(),E==="u"){for(s=0,e=0;e<4&&(r=parseInt(B(),16),!!isFinite(r));e+=1)s=s*16+r;t+=String.fromCharCode(s)}else if(typeof No[E]=="string")t+=No[E];else break;else t+=E}ft("Bad string")}function Xe(){for(;E&&E<=" ";)B()}function Af(){switch(E){case"t":return B("t"),B("r"),B("u"),B("e"),!0;case"f":return B("f"),B("a"),B("l"),B("s"),B("e"),!1;case"n":return B("n"),B("u"),B("l"),B("l"),null;default:ft("Unexpected '"+E+"'")}}function Nf(){var r=[];if(E==="["){if(B("["),Xe(),E==="]")return B("]"),r;for(;E;){if(r.push(qs()),Xe(),E==="]")return B("]"),r;B(","),Xe()}}ft("Bad array")}function Ef(){var r,e={};if(E==="{"){if(B("{"),Xe(),E==="}")return B("}"),e;for(;E;){if(r=jo(),Xe(),B(":"),Object.prototype.hasOwnProperty.call(e,r)&&ft('Duplicate key "'+r+'"'),e[r]=qs(),Xe(),E==="}")return B("}"),e;B(","),Xe()}}ft("Bad object")}function qs(){switch(Xe(),E){case"{":return Ef();case"[":return Nf();case'"':return jo();case"-":return Eo();default:return E>="0"&&E<="9"?Eo():Af()}}Co.exports=function(r,e){var t;return pi=r,Cs=0,E=" ",t=qs(),Xe(),E&&ft("Syntax error"),typeof e=="function"?function s(n,i){var a,o,c=n[i];if(c&&typeof c=="object")for(a in qs)Object.prototype.hasOwnProperty.call(c,a)&&(o=s(c,a),typeof o>"u"?delete c[a]:c[a]=o);return e.call(n,i,c)}({"":t},""):t}});var Mo=g((n0,Ro)=>{"use strict";var hi=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,me,Rs,jf={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},Tt;function mi(r){return hi.lastIndex=0,hi.test(r)?'"'+r.replace(hi,function(e){var t=jf[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+r+'"'}function Ms(r,e){var t,s,n,i,a=me,o,c=e[r];switch(c&&typeof c=="object"&&typeof c.toJSON=="function"&&(c=c.toJSON(r)),typeof Tt=="function"&&(c=Tt.call(e,r,c)),typeof c){case"string":return mi(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(me+=Rs,o=[],Object.prototype.toString.apply(c)==="[object Array]"){for(i=c.length,t=0;t{"use strict";yi.parse=qo();yi.stringify=Mo()});var gi=g((a0,Do)=>{"use strict";var Ls=typeof JSON<"u"?JSON:Lo(),Cf=Array.isArray||function(r){return{}.toString.call(r)==="[object Array]"},qf=Object.keys||function(r){var e=Object.prototype.hasOwnProperty||function(){return!0},t=[];for(var s in r)e.call(r,s)&&t.push(s);return t};Do.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=e.space||"";typeof t=="number"&&(t=Array(t+1).join(" "));var s=typeof e.cycles=="boolean"?e.cycles:!1,n=e.replacer||function(o,c){return c},i=e.cmp&&function(o){return function(c){return function(l,u){var d={key:l,value:c[l]},p={key:u,value:c[u]};return o(d,p)}}}(e.cmp),a=[];return function o(c,l,u,d){var p=t?` +`+new Array(d+1).join(t):"",h=t?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=n.call(c,l,u),u!==void 0){if(typeof u!="object"||u===null)return Ls.stringify(u);if(Cf(u)){for(var _=[],b=0;b{"use strict";var Rf=lr&&lr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(lr,"__esModule",{value:!0});lr.findRedundantSecuritySchemes=void 0;var Zo=Rf(gi());function Mf({operation:r,document:e}){if(!e.security||!r.security)return[];let t=[],s=[];for(let i in r.security)s.push((0,Zo.default)(r.security[i]));let n=new Set;for(let i in e.security)n.add((0,Zo.default)(e.security[i]));for(let i=0;i{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.isAnyZodType=ur.isZodType=void 0;function Lf(r,e){return r.constructor.name===e}ur.isZodType=Lf;function Df(r){return"_def"in r}ur.isAnyZodType=Df});var Ko=g(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.extendZodWithOpenApi=void 0;var Fo=vi();function Zf(r){if(typeof r.ZodSchema.prototype.openapi<"u")return;r.ZodSchema.prototype.openapi=function(o){var c,l,u,d,p,h;let{param:b,...y}=o??{},v=new this.constructor({...this._def,openapi:{_internal:(c=this._def.openapi)===null||c===void 0?void 0:c._internal,metadata:{...(l=this._def.openapi)===null||l===void 0?void 0:l.metadata,...y,param:((d=(u=this._def.openapi)===null||u===void 0?void 0:u.metadata)===null||d===void 0?void 0:d.param)||b?{...(h=(p=this._def.openapi)===null||p===void 0?void 0:p.metadata)===null||h===void 0?void 0:h.param,...b}:void 0}}});return(0,Fo.isZodType)(this,"ZodObject")&&(v.extend=this.extend),v},r.ZodSchema.prototype.internal_openapi=function(o){var c,l;let u=new this.constructor({...this._def,openapi:{_internal:{...(c=this._def.openapi)===null||c===void 0?void 0:c._internal,...o},metadata:(l=this._def.openapi)===null||l===void 0?void 0:l.metadata}});if((0,Fo.isZodType)(this,"ZodObject")){let d=this.extend;u.extend=function(...p){var h,b,y,v,_;let P=d.apply(this,p);return P._def.openapi={_internal:{extendedFrom:!((b=(h=this._def.openapi)===null||h===void 0?void 0:h._internal)===null||b===void 0)&&b.refId?{refId:(v=(y=this._def.openapi)===null||y===void 0?void 0:y._internal)===null||v===void 0?void 0:v.refId,schema:this}:(_=this._def.openapi)===null||_===void 0?void 0:_._internal.extendedFrom},metadata:{}},P}}return u};let e=r.ZodSchema.prototype.optional;r.ZodSchema.prototype.optional=function(...o){let c=e.apply(this,o);return c._def.openapi=this._def.openapi,c};let t=r.ZodSchema.prototype.nullable;r.ZodSchema.prototype.nullable=function(...o){let c=t.apply(this,o);return c._def.openapi=this._def.openapi,c};let s=r.ZodSchema.prototype.default;r.ZodSchema.prototype.default=function(...o){let c=s.apply(this,o);return c._def.openapi=this._def.openapi,c};let n=r.ZodSchema.prototype.describe;r.ZodSchema.prototype.describe=function(...o){let[c]=o;return n.apply(this,o).openapi({description:c})};let i=r.ZodObject.prototype.pick;r.ZodObject.prototype.pick=function(...o){let c=i.apply(this,o);return c._def.openapi=void 0,c};let a=r.ZodObject.prototype.omit;r.ZodObject.prototype.omit=function(...o){let c=a.apply(this,o);return c._def.openapi=void 0,c}}Ds.extendZodWithOpenApi=Zf});var Wo=g(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.ObjectSet=dr.isEqual=void 0;function Zs(r,e){if(r==null||e===null||e===void 0)return r===e;if(r===e||r.valueOf()===e.valueOf())return!0;if(Array.isArray(r)&&(!Array.isArray(e)||r.length!==e.length)||!(r instanceof Object)||!(e instanceof Object))return!1;let t=Object.keys(r);return Object.keys(e).every(s=>t.indexOf(s)!==-1)&&t.every(s=>Zs(r[s],e[s]))}dr.isEqual=Zs;var bi=class{constructor(){this.buckets=new Map}put(e){let t=this.hashCodeOf(e),s=this.buckets.get(t);if(!s){this.buckets.set(t,[e]);return}s.some(i=>Zs(i,e))||s.push(e)}contains(e){let t=this.hashCodeOf(e),s=this.buckets.get(t);return s?s.some(n=>Zs(n,e)):!1}values(){return[...this.buckets.values()].flat()}stats(){let e=0,t=0,s=0;for(let i of this.buckets.values())e+=1,t+=i.length,i.length>1&&(s+=1);let n=e/t;return{totalBuckets:e,collisions:s,totalValues:t,hashEffectiveness:n}}hashCodeOf(e){let t=0;if(Array.isArray(e)){for(let s=0;s{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.uniq=ie.objectEquals=ie.compact=ie.omitBy=ie.omit=ie.mapValues=ie.isNil=ie.isUndefined=void 0;var Jo=Wo();function Uf(r){return r===void 0}ie.isUndefined=Uf;function Yo(r){return r==null}ie.isNil=Yo;function Bf(r,e){let t={};return Object.entries(r).forEach(([s,n])=>{t[s]=e(n)}),t}ie.mapValues=Bf;function Vf(r,e){let t={};return Object.entries(r).forEach(([s,n])=>{e.some(i=>i===s)||(t[s]=n)}),t}ie.omit=Vf;function Ff(r,e){let t={};return Object.entries(r).forEach(([s,n])=>{e(n,s)||(t[s]=n)}),t}ie.omitBy=Ff;function Kf(r){return r.filter(e=>!Yo(e))}ie.compact=Kf;ie.objectEquals=Jo.isEqual;function Wf(r){let e=new Jo.ObjectSet;return r.forEach(t=>e.put(t)),[...e.values()]}ie.uniq=Wf});var zo=g(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.getOpenApiMetadata=void 0;var Ho=_i();function Jf(r){var e,t;return(0,Ho.omitBy)((t=(e=r._def.openapi)===null||e===void 0?void 0:e.metadata)!==null&&t!==void 0?t:{},Ho.isNil)}Us.getOpenApiMetadata=Jf});var Go=g(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.UnknownZodTypeError=Ze.MissingParameterDataError=Ze.ConflictError=Ze.ZodToOpenAPIError=void 0;var fr=class{constructor(e){this.message=e}};Ze.ZodToOpenAPIError=fr;var wi=class extends fr{constructor(e,t){super(e),this.data=t}};Ze.ConflictError=wi;var Si=class extends fr{constructor(e){super(`Missing parameter data, please specify \`${e.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`ZodSchema.openapi\``),this.data=e}};Ze.MissingParameterDataError=Si;var xi=class extends fr{constructor(e){super("Unknown zod object type, please specify `type` and other OpenAPI props using `ZodSchema.openapi`."),this.data=e}};Ze.UnknownZodTypeError=xi});var Qo=g(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.enumInfo=void 0;function Yf(r){let t=Object.keys(r).filter(i=>typeof r[r[i]]!="number").map(i=>r[i]),s=t.filter(i=>typeof i=="number").length,n=s===0?"string":s===t.length?"numeric":"mixed";return{values:t,type:n}}Bs.enumInfo=Yf});var ec=g(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.OpenAPIGenerator=void 0;var Q=_i(),et=Go(),Z=vi(),Hf=Qo(),Xo=["3.0.0","3.0.1","3.0.2","3.0.3","3.1.0"],Oi=class{constructor(e,t){this.definitions=e,this.openAPIVersion=t,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.webhookRefs={},this.rawComponents=[],this.openApiVersionSatisfies=(s,n)=>Xo.indexOf(s)>=Xo.indexOf(n),this.sortDefinitions()}generateDocument(e){return this.definitions.forEach(t=>this.generateSingle(t)),{...e,openapi:this.openAPIVersion,components:this.buildComponents(),paths:this.pathRefs,...Object.keys(this.webhookRefs).length&&{webhooks:this.webhookRefs}}}generateComponents(){return this.definitions.forEach(e=>this.generateSingle(e)),{components:this.buildComponents()}}buildComponents(){var e,t;let s={};return this.rawComponents.forEach(({componentType:n,name:i,component:a})=>{var o;(o=s[n])!==null&&o!==void 0||(s[n]={}),s[n][i]=a}),{...s,schemas:{...(e=s.schemas)!==null&&e!==void 0?e:{},...this.schemaRefs},parameters:{...(t=s.parameters)!==null&&t!==void 0?t:{},...this.paramRefs}}}sortDefinitions(){let e=["schema","parameter","component","route","webhook"];this.definitions.sort((t,s)=>{let n=e.findIndex(a=>a===t.type),i=e.findIndex(a=>a===s.type);return n-i})}generateSingle(e){switch(e.type){case"parameter":this.generateParameterDefinition(e.schema);return;case"schema":this.generateSchemaDefinition(e.schema);return;case"route":this.generateSingleRoute(e.route);return;case"webhook":this.generateSingleWebhook(e.webhook);return;case"component":this.rawComponents.push(e);return}}generateParameterDefinition(e){let t=this.getInternalMetadata(e),s=this.generateParameter(e);return t?.refId&&(this.paramRefs[t.refId]=s),s}getParameterRef(e,t){var s,n,i,a,o;let c=(s=e?.metadata)===null||s===void 0?void 0:s.param,l=!((n=e?._internal)===null||n===void 0)&&n.refId?this.paramRefs[(i=e._internal)===null||i===void 0?void 0:i.refId]:void 0;if(!(!(!((a=e?._internal)===null||a===void 0)&&a.refId)||!l)){if(c&&l.in!==c.in||t?.in&&l.in!==t.in)throw new et.ConflictError(`Conflicting location for parameter ${l.name}`,{key:"in",values:(0,Q.compact)([l.in,t?.in,c?.in])});if(c&&l.name!==c.name||t?.name&&l.name!==t?.name)throw new et.ConflictError("Conflicting names for parameter",{key:"name",values:(0,Q.compact)([l.name,t?.name,c?.name])});return{$ref:`#/components/parameters/${(o=e._internal)===null||o===void 0?void 0:o.refId}`}}}generateInlineParameters(e,t){var s;let n=this.getMetadata(e),i=(s=n?.metadata)===null||s===void 0?void 0:s.param,a=this.getParameterRef(n,{in:t});if(a)return[a];if((0,Z.isZodType)(e,"ZodObject")){let o=e._def.shape();return Object.entries(o).map(([l,u])=>{var d,p;let h=this.getMetadata(u),b=this.getParameterRef(h,{in:t,name:l});if(b)return b;let y=(d=h?.metadata)===null||d===void 0?void 0:d.param;if(y?.name&&y.name!==l)throw new et.ConflictError("Conflicting names for parameter",{key:"name",values:[l,y.name]});if(y?.in&&y.in!==t)throw new et.ConflictError(`Conflicting location for parameter ${(p=y.name)!==null&&p!==void 0?p:l}`,{key:"in",values:[t,y.in]});return this.generateParameter(u.openapi({param:{name:l,in:t}}))})}if(i?.in&&i.in!==t)throw new et.ConflictError(`Conflicting location for parameter ${i.name}`,{key:"in",values:[t,i.in]});return[this.generateParameter(e.openapi({param:{in:t}}))]}generateParameter(e){var t;let s=this.getMetadata(e),n=(t=s?.metadata)===null||t===void 0?void 0:t.param,i=n?.name,a=n?.in;if(!i)throw new et.MissingParameterDataError({missingField:"name"});if(!a)throw new et.MissingParameterDataError({missingField:"in",paramName:i});let o=!this.isOptionalSchema(e)&&!e.isNullable(),c=this.generateSimpleSchema(e);return{in:a,name:i,schema:c,required:o,...n?this.buildParameterMetadata(n):{}}}generateSimpleSchema(e){var t,s,n;let i=this.unwrapChained(e),a=(t=e._def.openapi)!==null&&t!==void 0?t:i._def.openapi,o=this.getDefaultValue(e),c=(s=a?._internal)===null||s===void 0?void 0:s.refId;if(c&&this.schemaRefs[c]){let d=this.schemaRefs[c],p={$ref:this.generateSchemaRef(c)},h=(0,Q.omitBy)(this.buildSchemaMetadata((n=a?.metadata)!==null&&n!==void 0?n:{}),(v,_)=>v===void 0||(0,Q.objectEquals)(v,d[_])),b=h.type?{}:(0,Q.omitBy)(this.constructReferencedOpenAPISchema(e,i,o),(v,_)=>v===void 0||(0,Q.objectEquals)(v,d[_])),y=this.applySchemaMetadata(b,h);return Object.keys(y).length>0?{allOf:[p,y]}:p}let u=(()=>{var d;return a?.metadata!==void 0&&a.metadata.oneOf!==void 0?a.metadata:!((d=a?.metadata)===null||d===void 0)&&d.type?{type:a?.metadata.type}:this.toOpenAPISchema(i,e.isNullable(),o)})();return a?.metadata?this.applySchemaMetadata(u,a.metadata):(0,Q.omitBy)(u,Q.isNil)}generateInnerSchema(e,t){let s=this.generateSimpleSchema(e);return"$ref"in s&&s.$ref?s:t?this.applySchemaMetadata(s,t):s}generateSchemaDefinition(e){var t;let s=this.getMetadata(e),n=(t=s?._internal)===null||t===void 0?void 0:t.refId,i=this.generateSimpleSchema(e),a=s?.metadata?this.applySchemaMetadata(i,s.metadata):i;return n&&(this.schemaRefs[n]=a),a}generateSchemaRef(e){return`#/components/schemas/${e}`}getRequestBody(e){if(!e)return;let{content:t,...s}=e,n=this.getBodyContent(t);return{...s,content:n}}getParameters(e){if(!e)return[];let t=e.query?this.generateInlineParameters(e.query,"query"):[],s=e.params?this.generateInlineParameters(e.params,"path"):[],{headers:n}=e,i=n?(0,Z.isZodType)(n,"ZodObject")?this.generateInlineParameters(n,"header"):n.flatMap(a=>this.generateInlineParameters(a,"header")):[];return[...s,...t,...i]}generatePath(e){let{method:t,path:s,request:n,responses:i,...a}=e,o=(0,Q.mapValues)(i,d=>this.getResponse(d)),c=this.getParameters(n),l=this.getRequestBody(n?.body);return{[t]:{...a,...c.length>0?{parameters:c}:{},...l?{requestBody:l}:{},responses:o}}}generateSingleRoute(e){let t=this.generatePath(e);return this.pathRefs[e.path]={...this.pathRefs[e.path],...t},t}generateSingleWebhook(e){let t=this.generatePath(e);return this.webhookRefs[e.path]={...this.webhookRefs[e.path],...t},t}getResponse({content:e,...t}){let s=e?{content:this.getBodyContent(e)}:{};return{...t,...s}}getBodyContent(e){return(0,Q.mapValues)(e,t=>{if(!(0,Z.isAnyZodType)(t.schema))return t;let{schema:s,...n}=t;return{schema:this.generateInnerSchema(s),...n}})}getZodStringCheck(e,t){return e._def.checks.find(s=>s.kind===t)}mapStringFormat(e){if(e.isUUID)return"uuid";if(e.isEmail)return"email";if(e.isURL)return"uri";if(e.isDatetime)return"date-time"}mapDiscriminator(e,t){if(e.some(n=>{var i,a;return((a=(i=n._def.openapi)===null||i===void 0?void 0:i._internal)===null||a===void 0?void 0:a.refId)===void 0}))return;let s={};return e.forEach(n=>{var i,a,o;let c=(a=(i=n._def.openapi)===null||i===void 0?void 0:i._internal)===null||a===void 0?void 0:a.refId,l=(o=n.shape)===null||o===void 0?void 0:o[t];if((0,Z.isZodType)(l,"ZodEnum")){l._def.values.forEach(d=>{s[d]=this.generateSchemaRef(c)});return}let u=l?._def.value;if(typeof u!="string")throw new Error(`Discriminator ${t} could not be found in one of the values of a discriminated union`);s[u]=this.generateSchemaRef(c)}),{propertyName:t,mapping:s}}mapNullableOfArray(e,t){return t?this.openApiVersionSatisfies(this.openAPIVersion,"3.1.0")?[...e,{type:"null"}]:[...e,{nullable:!0}]:e}mapNullableType(e,t){return t&&this.openApiVersionSatisfies(this.openAPIVersion,"3.1.0")?{type:Array.isArray(e)?[...e,"null"]:[e,"null"]}:{type:e,nullable:t?!0:void 0}}getNumberChecks(e){return Object.assign({},...e.map(t=>{switch(t.kind){case"min":return t.inclusive?{minimum:t.value}:this.openApiVersionSatisfies(this.openAPIVersion,"3.1.0")?{exclusiveMinimum:t.value}:{minimum:t.value,exclusiveMinimum:!0};case"max":return t.inclusive?{maximum:t.value}:this.openApiVersionSatisfies(this.openAPIVersion,"3.1.0")?{exclusiveMaximum:t.value}:{maximum:t.value,exclusiveMaximum:!0};default:return{}}}))}constructReferencedOpenAPISchema(e,t,s){var n,i;let a=e.isNullable(),o=(n=e._def.openapi)!==null&&n!==void 0?n:t._def.openapi;return!((i=o?.metadata)===null||i===void 0)&&i.type?this.mapNullableType(o.metadata.type,a):this.toOpenAPISchema(t,a,s)}toOpenAPISchema(e,t,s){var n,i,a,o,c,l,u;if((0,Z.isZodType)(e,"ZodNull"))return{type:"null"};if((0,Z.isZodType)(e,"ZodString")){let p=this.getZodStringCheck(e,"regex"),h=(n=this.getZodStringCheck(e,"length"))===null||n===void 0?void 0:n.value,b=Number.isFinite(e.minLength)&&(i=e.minLength)!==null&&i!==void 0?i:void 0,y=Number.isFinite(e.maxLength)&&(a=e.maxLength)!==null&&a!==void 0?a:void 0;return{...this.mapNullableType("string",t),minLength:h??b,maxLength:h??y,format:this.mapStringFormat(e),pattern:p?.regex.source,default:s}}if((0,Z.isZodType)(e,"ZodNumber"))return{...this.mapNullableType(e.isInt?"integer":"number",t),...this.getNumberChecks(e._def.checks),default:s};if((0,Z.isZodType)(e,"ZodBoolean"))return{...this.mapNullableType("boolean",t),default:s};if((0,Z.isZodType)(e,"ZodEffects")&&(e._def.effect.type==="refinement"||e._def.effect.type==="preprocess")){let p=e._def.schema;return this.generateInnerSchema(p)}if((0,Z.isZodType)(e,"ZodLiteral"))return{...this.mapNullableType(typeof e._def.value,t),enum:[e._def.value],default:s};if((0,Z.isZodType)(e,"ZodEnum"))return{...this.mapNullableType("string",t),enum:e._def.values,default:s};if((0,Z.isZodType)(e,"ZodNativeEnum")){let{type:p,values:h}=(0,Hf.enumInfo)(e._def.values);if(p==="mixed")throw new et.ZodToOpenAPIError("Enum has mixed string and number values, please specify the OpenAPI type manually");return{...this.mapNullableType(p==="numeric"?"integer":"string",t),enum:h,default:s}}if((0,Z.isZodType)(e,"ZodObject"))return this.toOpenAPIObjectSchema(e,t,s);if((0,Z.isZodType)(e,"ZodArray")){let p=e._def.type;return{...this.mapNullableType("array",t),items:this.generateInnerSchema(p),minItems:(o=e._def.minLength)===null||o===void 0?void 0:o.value,maxItems:(c=e._def.maxLength)===null||c===void 0?void 0:c.value,default:s}}if((0,Z.isZodType)(e,"ZodTuple")){let{items:p}=e._def,h=p.length,b=p.map(v=>this.generateInnerSchema(v)),y=(0,Q.uniq)(b);return y.length===1?{type:"array",items:y[0],minItems:h,maxItems:h}:{...this.mapNullableType("array",t),items:{anyOf:y},minItems:h,maxItems:h}}if((0,Z.isZodType)(e,"ZodUnion")){let p=this.flattenUnionTypes(e);return{anyOf:this.mapNullableOfArray(p.map(h=>this.generateInnerSchema(h)),t),default:s}}if((0,Z.isZodType)(e,"ZodDiscriminatedUnion")){let p=[...e.options.values()],h=p.map(b=>this.generateInnerSchema(b));return t?{oneOf:this.mapNullableOfArray(h,t),default:s}:{oneOf:h,discriminator:this.mapDiscriminator(p,e.discriminator),default:s}}if((0,Z.isZodType)(e,"ZodIntersection")){let h={allOf:this.flattenIntersectionTypes(e).map(b=>this.generateInnerSchema(b))};return t?{anyOf:this.mapNullableOfArray([h],t),default:s}:{...h,default:s}}if((0,Z.isZodType)(e,"ZodRecord")){let p=e._def.valueType;return{...this.mapNullableType("object",t),additionalProperties:this.generateInnerSchema(p),default:s}}if((0,Z.isZodType)(e,"ZodUnknown"))return{};if((0,Z.isZodType)(e,"ZodDate"))return{...this.mapNullableType("string",t),default:s};let d=(u=(l=this.getMetadata(e))===null||l===void 0?void 0:l._internal)===null||u===void 0?void 0:u.refId;throw new et.UnknownZodTypeError({currentSchema:e._def,schemaName:d})}isOptionalSchema(e){return(0,Z.isZodType)(e,"ZodEffects")?this.isOptionalSchema(e._def.schema):(0,Z.isZodType)(e,"ZodDefault")?this.isOptionalSchema(e._def.innerType):e.isOptional()}getDefaultValue(e){if((0,Z.isZodType)(e,"ZodOptional")||(0,Z.isZodType)(e,"ZodNullable"))return this.getDefaultValue(e.unwrap());if((0,Z.isZodType)(e,"ZodEffects"))return this.getDefaultValue(e._def.schema);if((0,Z.isZodType)(e,"ZodDefault"))return e._def.defaultValue()}requiredKeysOf(e){return Object.entries(e._def.shape()).filter(([t,s])=>!this.isOptionalSchema(s)).map(([t,s])=>t)}toOpenAPIObjectSchema(e,t,s){var n,i;let a=(i=(n=e._def.openapi)===null||n===void 0?void 0:n._internal)===null||i===void 0?void 0:i.extendedFrom,o=a?.schema._def.shape(),c=e._def.shape(),l=a?this.requiredKeysOf(a.schema):[],u=this.requiredKeysOf(e),d=o?(0,Q.mapValues)(o,_=>this.generateInnerSchema(_)):{},p=(0,Q.mapValues)(c,_=>this.generateInnerSchema(_)),h=Object.fromEntries(Object.entries(p).filter(([_,P])=>!(0,Q.objectEquals)(d[_],P))),b=u.filter(_=>!l.includes(_)),y=e._def.unknownKeys,v={...this.mapNullableType("object",t),default:s,properties:h,...b.length>0?{required:b}:{},...y==="strict"?{additionalProperties:!1}:{}};return a?{allOf:[{$ref:`#/components/schemas/${a.refId}`},v]}:v}flattenUnionTypes(e){return(0,Z.isZodType)(e,"ZodUnion")?e._def.options.flatMap(s=>this.flattenUnionTypes(s)):[e]}flattenIntersectionTypes(e){if(!(0,Z.isZodType)(e,"ZodIntersection"))return[e];let t=this.flattenIntersectionTypes(e._def.left),s=this.flattenIntersectionTypes(e._def.right);return[...t,...s]}unwrapChained(e){return(0,Z.isZodType)(e,"ZodOptional")||(0,Z.isZodType)(e,"ZodNullable")||(0,Z.isZodType)(e,"ZodBranded")?this.unwrapChained(e.unwrap()):(0,Z.isZodType)(e,"ZodDefault")?this.unwrapChained(e._def.innerType):(0,Z.isZodType)(e,"ZodEffects")&&e._def.effect.type==="refinement"?this.unwrapChained(e._def.schema):e}buildSchemaMetadata(e){return(0,Q.omitBy)((0,Q.omit)(e,["param"]),Q.isNil)}buildParameterMetadata(e){return(0,Q.omitBy)(e,Q.isNil)}getMetadata(e){let t=this.unwrapChained(e);return e._def.openapi?e._def.openapi:t._def.openapi}getInternalMetadata(e){let t=this.unwrapChained(e),s=e._def.openapi?e._def.openapi:t._def.openapi;return s?._internal}applySchemaMetadata(e,t){return(0,Q.omitBy)({...e,...this.buildSchemaMetadata(t)},Q.isNil)}};Vs.OpenAPIGenerator=Oi});var tc=g(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.OpenAPIRegistry=void 0;var Ii=class{constructor(e){this.parents=e,this._definitions=[]}get definitions(){var e,t;return[...(t=(e=this.parents)===null||e===void 0?void 0:e.flatMap(n=>n.definitions))!==null&&t!==void 0?t:[],...this._definitions]}register(e,t){let s=this.schemaWithRefId(e,t);return this._definitions.push({type:"schema",schema:s}),s}registerParameter(e,t){var s,n,i;let a=this.schemaWithRefId(e,t),o=(s=a._def.openapi)===null||s===void 0?void 0:s.metadata,c=a.openapi({...o,param:{...o?.param,name:(i=(n=o?.param)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:e}});return this._definitions.push({type:"parameter",schema:c}),c}registerPath(e){this._definitions.push({type:"route",route:e})}registerWebhook(e){this._definitions.push({type:"webhook",webhook:e})}registerComponent(e,t,s){return this._definitions.push({type:"component",componentType:e,name:t,component:s}),{name:t,ref:{$ref:`#/components/${e}/${t}`}}}schemaWithRefId(e,t){return t.internal_openapi({refId:e})}};Fs.OpenAPIRegistry=Ii});var Ne,Pi=$t(()=>{Ne=class{static isValidExtension(e){return/^x-/.test(e)}getExtension(e){if(!Ne.isValidExtension(e))throw new Error(`Invalid specification extension: '${e}'. Extensions must start with prefix 'x-`);return this[e]?this[e]:null}addExtension(e,t){if(!Ne.isValidExtension(e))throw new Error(`Invalid specification extension: '${e}'. Extensions must start with prefix 'x-`);this[e]=t}listExtensions(){let e=[];for(let t in this)Object.prototype.hasOwnProperty.call(this,t)&&Ne.isValidExtension(t)&&e.push(t);return e}}});function zf(r,e){if(Ne.isValidExtension(e))return r[e]}function Gf(r,e,t){Ne.isValidExtension(e)&&(r[e]=t)}function Qf(r,e){if(!Ne.isValidExtension(e))return r[e]}function Xf(r){return Object.prototype.hasOwnProperty.call(r,"$ref")}function ep(r){return!Object.prototype.hasOwnProperty.call(r,"$ref")}var rc=$t(()=>{Pi()});var $i,Ti,sc=$t(()=>{$i=class{constructor(e,t){this.url=e,this.description=t,this.variables={}}addVariable(e,t){this.variables[e]=t}},Ti=class{constructor(e,t,s){this.default=e,this.enum=t,this.description=s}}});var nc=$t(()=>{Pi();rc();sc()});var K=g(ae=>{"use strict";var Ai=Symbol.for("yaml.alias"),ic=Symbol.for("yaml.document"),Ks=Symbol.for("yaml.map"),ac=Symbol.for("yaml.pair"),Ni=Symbol.for("yaml.scalar"),Ws=Symbol.for("yaml.seq"),Ue=Symbol.for("yaml.node.type"),tp=r=>!!r&&typeof r=="object"&&r[Ue]===Ai,rp=r=>!!r&&typeof r=="object"&&r[Ue]===ic,sp=r=>!!r&&typeof r=="object"&&r[Ue]===Ks,np=r=>!!r&&typeof r=="object"&&r[Ue]===ac,oc=r=>!!r&&typeof r=="object"&&r[Ue]===Ni,ip=r=>!!r&&typeof r=="object"&&r[Ue]===Ws;function cc(r){if(r&&typeof r=="object")switch(r[Ue]){case Ks:case Ws:return!0}return!1}function ap(r){if(r&&typeof r=="object")switch(r[Ue]){case Ai:case Ks:case Ni:case Ws:return!0}return!1}var op=r=>(oc(r)||cc(r))&&!!r.anchor,ki=class{constructor(e){Object.defineProperty(this,Ue,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}};ae.ALIAS=Ai;ae.DOC=ic;ae.MAP=Ks;ae.NODE_TYPE=Ue;ae.NodeBase=ki;ae.PAIR=ac;ae.SCALAR=Ni;ae.SEQ=Ws;ae.hasAnchor=op;ae.isAlias=tp;ae.isCollection=cc;ae.isDocument=rp;ae.isMap=sp;ae.isNode=ap;ae.isPair=np;ae.isScalar=oc;ae.isSeq=ip});var Yr=g(Ei=>{"use strict";var re=K(),de=Symbol("break visit"),lc=Symbol("skip children"),Be=Symbol("remove node");function Js(r,e){let t=uc(e);re.isDocument(r)?pr(null,r.contents,t,Object.freeze([r]))===Be&&(r.contents=null):pr(null,r,t,Object.freeze([]))}Js.BREAK=de;Js.SKIP=lc;Js.REMOVE=Be;function pr(r,e,t,s){let n=dc(r,e,t,s);if(re.isNode(n)||re.isPair(n))return fc(r,s,n),pr(r,n,t,s);if(typeof n!="symbol"){if(re.isCollection(e)){s=Object.freeze(s.concat(e));for(let i=0;i{"use strict";var pc=K(),cp=Yr(),lp={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},up=r=>r.replace(/[!,[\]{}]/g,e=>lp[e]),fe=class{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},fe.defaultYaml,e),this.tags=Object.assign({},fe.defaultTags,t)}clone(){let e=new fe(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new fe(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:fe.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},fe.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:fe.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},fe.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),n=s.shift();switch(n){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[i,a]=s;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=s;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let a=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,a),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),a)}let[,s,n]=e.match(/^(.*!)([^!]*)$/);n||t(`The ${e} tag has no suffix`);let i=this.tags[s];return i?i+decodeURIComponent(n):s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+up(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),n;if(e&&s.length>0&&pc.isNode(e.contents)){let i={};cp.visit(e.contents,(a,o)=>{pc.isNode(o)&&o.tag&&(i[o.tag]=!0)}),n=Object.keys(i)}else n=[];for(let[i,a]of s)i==="!!"&&a==="tag:yaml.org,2002:"||(!e||n.some(o=>o.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(` +`)}};fe.defaultYaml={explicit:!1,version:"1.2"};fe.defaultTags={"!!":"tag:yaml.org,2002:"};hc.Directives=fe});var Hs=g(Hr=>{"use strict";var mc=K(),dp=Yr();function fp(r){if(/[\x00-\x19\s,[\]{}]/.test(r)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(r)}`;throw new Error(t)}return!0}function yc(r){let e=new Set;return dp.visit(r,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function gc(r,e){for(let t=1;;++t){let s=`${r}${t}`;if(!e.has(s))return s}}function pp(r,e){let t=[],s=new Map,n=null;return{onAnchor:i=>{t.push(i),n||(n=yc(r));let a=gc(e,n);return n.add(a),a},setAnchors:()=>{for(let i of t){let a=s.get(i);if(typeof a=="object"&&a.anchor&&(mc.isScalar(a.node)||mc.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:s}}Hr.anchorIsValid=fp;Hr.anchorNames=yc;Hr.createNodeAnchors=pp;Hr.findNewAnchor=gc});var Gr=g(bc=>{"use strict";var hp=Hs(),vc=Yr(),zr=K(),Ci=class extends zr.NodeBase{constructor(e){super(zr.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return vc.visit(e,{Node:(s,n)=>{if(n===this)return vc.visit.BREAK;n.anchor===this.source&&(t=n)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:s,doc:n,maxAliasCount:i}=t,a=this.resolve(n);if(!a){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=s.get(a);if(!o||o.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=zs(n,a,s)),o.count*o.aliasCount>i)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(e,t,s){let n=`*${this.source}`;if(e){if(hp.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${n} `}return n}};function zs(r,e,t){if(zr.isAlias(e)){let s=e.resolve(r),n=t&&s&&t.get(s);return n?n.count*n.aliasCount:0}else if(zr.isCollection(e)){let s=0;for(let n of e.items){let i=zs(r,n,t);i>s&&(s=i)}return s}else if(zr.isPair(e)){let s=zs(r,e.key,t),n=zs(r,e.value,t);return Math.max(s,n)}return 1}bc.Alias=Ci});var mr=g(wc=>{"use strict";var mp=K();function _c(r,e,t){if(Array.isArray(r))return r.map((s,n)=>_c(s,String(n),t));if(r&&typeof r.toJSON=="function"){if(!t||!mp.hasAnchor(r))return r.toJSON(e,t);let s={aliasCount:0,count:1,res:void 0};t.anchors.set(r,s),t.onCreate=i=>{s.res=i,delete t.onCreate};let n=r.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof r=="bigint"&&!t?.keep?Number(r):r}wc.toJS=_c});var X=g(qi=>{"use strict";var Sc=K(),yp=mr(),gp=r=>!r||typeof r!="function"&&typeof r!="object",pt=class extends Sc.NodeBase{constructor(e){super(Sc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:yp.toJS(this.value,e,t)}toString(){return String(this.value)}};pt.BLOCK_FOLDED="BLOCK_FOLDED";pt.BLOCK_LITERAL="BLOCK_LITERAL";pt.PLAIN="PLAIN";pt.QUOTE_DOUBLE="QUOTE_DOUBLE";pt.QUOTE_SINGLE="QUOTE_SINGLE";qi.Scalar=pt;qi.isScalarValue=gp});var Qr=g(Oc=>{"use strict";var vp=Gr(),kt=K(),xc=X(),bp="tag:yaml.org,2002:";function _p(r,e,t){if(e){let s=t.filter(i=>i.tag===e),n=s.find(i=>!i.format)??s[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(s=>s.identify?.(r)&&!s.format)}function wp(r,e,t){if(kt.isDocument(r)&&(r=r.contents),kt.isNode(r))return r;if(kt.isPair(r)){let d=t.schema[kt.MAP].createNode?.(t.schema,null,t);return d.items.push(r),d}(r instanceof String||r instanceof Number||r instanceof Boolean||typeof BigInt<"u"&&r instanceof BigInt)&&(r=r.valueOf());let{aliasDuplicateObjects:s,onAnchor:n,onTagObj:i,schema:a,sourceObjects:o}=t,c;if(s&&r&&typeof r=="object"){if(c=o.get(r),c)return c.anchor||(c.anchor=n(r)),new vp.Alias(c.anchor);c={anchor:null,node:null},o.set(r,c)}e?.startsWith("!!")&&(e=bp+e.slice(2));let l=_p(r,e,a.tags);if(!l){if(r&&typeof r.toJSON=="function"&&(r=r.toJSON()),!r||typeof r!="object"){let d=new xc.Scalar(r);return c&&(c.node=d),d}l=r instanceof Map?a[kt.MAP]:Symbol.iterator in Object(r)?a[kt.SEQ]:a[kt.MAP]}i&&(i(l),delete t.onTagObj);let u=l?.createNode?l.createNode(t.schema,r,t):new xc.Scalar(r);return e&&(u.tag=e),c&&(c.node=u),u}Oc.createNode=wp});var Xr=g(Qs=>{"use strict";var Sp=Qr(),Ee=K();function Ri(r,e,t){let s=t;for(let n=e.length-1;n>=0;--n){let i=e[n];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let a=[];a[i]=s,s=a}else s=new Map([[i,s]])}return Sp.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:r,sourceObjects:new Map})}var Ic=r=>r==null||typeof r=="object"&&!!r[Symbol.iterator]().next().done,Gs=class extends Ee.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(s=>Ee.isNode(s)||Ee.isPair(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ic(e))this.add(t);else{let[s,...n]=e,i=this.get(s,!0);if(Ee.isCollection(i))i.addIn(n,t);else if(i===void 0&&this.schema)this.set(s,Ri(this.schema,n,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}}deleteIn(e){let[t,...s]=e;if(s.length===0)return this.delete(t);let n=this.get(t,!0);if(Ee.isCollection(n))return n.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){let[s,...n]=e,i=this.get(s,!0);return n.length===0?!t&&Ee.isScalar(i)?i.value:i:Ee.isCollection(i)?i.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Ee.isPair(t))return!1;let s=t.value;return s==null||e&&Ee.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[t,...s]=e;if(s.length===0)return this.has(t);let n=this.get(t,!0);return Ee.isCollection(n)?n.hasIn(s):!1}setIn(e,t){let[s,...n]=e;if(n.length===0)this.set(s,t);else{let i=this.get(s,!0);if(Ee.isCollection(i))i.setIn(n,t);else if(i===void 0&&this.schema)this.set(s,Ri(this.schema,n,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}}};Gs.maxFlowStringSingleLineLength=60;Qs.Collection=Gs;Qs.collectionFromPath=Ri;Qs.isEmptyPath=Ic});var es=g(Xs=>{"use strict";var xp=r=>r.replace(/^(?!$)(?: $)?/gm,"#");function Mi(r,e){return/^\n+$/.test(r)?r.substring(1):e?r.replace(/^(?! *$)/gm,e):r}var Op=(r,e,t)=>r.endsWith(` +`)?Mi(t,e):t.includes(` +`)?` +`+Mi(t,e):(r.endsWith(" ")?"":" ")+t;Xs.indentComment=Mi;Xs.lineComment=Op;Xs.stringifyComment=xp});var $c=g(ts=>{"use strict";var Ip="flow",Li="block",en="quoted";function Pp(r,e,t="flow",{indentAtStart:s,lineWidth:n=80,minContentWidth:i=20,onFold:a,onOverflow:o}={}){if(!n||n<0)return r;let c=Math.max(1+i,1+n-e.length);if(r.length<=c)return r;let l=[],u={},d=n-e.length;typeof s=="number"&&(s>n-Math.max(2,i)?l.push(0):d=n-s);let p,h,b=!1,y=-1,v=-1,_=-1;t===Li&&(y=Pc(r,y),y!==-1&&(d=y+c));for(let k;k=r[y+=1];){if(t===en&&k==="\\"){switch(v=y,r[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}_=y}if(k===` +`)t===Li&&(y=Pc(r,y)),d=y+c,p=void 0;else{if(k===" "&&h&&h!==" "&&h!==` +`&&h!==" "){let I=r[y+1];I&&I!==" "&&I!==` +`&&I!==" "&&(p=y)}if(y>=d)if(p)l.push(p),d=p+c,p=void 0;else if(t===en){for(;h===" "||h===" ";)h=k,k=r[y+=1],b=!0;let I=y>_+1?y-2:v-1;if(u[I])return r;l.push(I),u[I]=!0,d=I+c,p=void 0}else b=!0}h=k}if(b&&o&&o(),l.length===0)return r;a&&a();let P=r.slice(0,l[0]);for(let k=0;k{"use strict";var Ve=X(),ht=$c(),rn=r=>({indentAtStart:r.indentAtStart,lineWidth:r.options.lineWidth,minContentWidth:r.options.minContentWidth}),sn=r=>/^(%|---|\.\.\.)/m.test(r);function $p(r,e,t){if(!e||e<0)return!1;let s=e-t,n=r.length;if(n<=s)return!1;for(let i=0,a=0;is)return!0;if(a=i+1,n-a<=s)return!1}return!0}function rs(r,e){let t=JSON.stringify(r);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:s}=e,n=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(sn(r)?" ":""),a="",o=0;for(let c=0,l=t[c];l;l=t[++c])if(l===" "&&t[c+1]==="\\"&&t[c+2]==="n"&&(a+=t.slice(o,c)+"\\ ",c+=1,o=c,l="\\"),l==="\\")switch(t[c+1]){case"u":{a+=t.slice(o,c);let u=t.substr(c+2,4);switch(u){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:u.substr(0,2)==="00"?a+="\\x"+u.substr(2):a+=t.substr(c,6)}c+=5,o=c+1}break;case"n":if(s||t[c+2]==='"'||t.length +`;let d,p;for(p=t.length;p>0;--p){let $=t[p-1];if($!==` +`&&$!==" "&&$!==" ")break}let h=t.substring(p),b=h.indexOf(` +`);b===-1?d="-":t===h||b!==h.length-1?(d="+",i&&i()):d="",h&&(t=t.slice(0,-h.length),h[h.length-1]===` +`&&(h=h.slice(0,-1)),h=h.replace(/\n+(?!\n|$)/g,`$&${l}`));let y=!1,v,_=-1;for(v=0;v")+(y?l?"2":"1":"")+d;if(r&&(I+=" "+o(r.replace(/ ?[\r\n]+/g," ")),n&&n()),u)return t=t.replace(/\n+/g,`$&${l}`),`${I} +${l}${P}${t}${h}`;t=t.replace(/\n+/g,` +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`);let F=ht.foldFlowLines(`${P}${t}${h}`,l,ht.FOLD_BLOCK,rn(s));return`${I} +${l}${F}`}function Tp(r,e,t,s){let{type:n,value:i}=r,{actualString:a,implicitKey:o,indent:c,inFlow:l}=e;if(o&&/[\n[\]{},]/.test(i)||l&&/[[\]{},]/.test(i))return ss(i,e);if(!i||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||l||!i.includes(` +`)?ss(i,e):tn(r,e,t,s);if(!o&&!l&&n!==Ve.Scalar.PLAIN&&i.includes(` +`))return tn(r,e,t,s);if(c===""&&sn(i))return e.forceBlockIndent=!0,tn(r,e,t,s);let u=i.replace(/\n+/g,`$& +${c}`);if(a){let d=b=>b.default&&b.tag!=="tag:yaml.org,2002:str"&&b.test?.test(u),{compat:p,tags:h}=e.doc.schema;if(h.some(d)||p?.some(d))return ss(i,e)}return o?u:ht.foldFlowLines(u,c,ht.FOLD_FLOW,rn(e))}function kp(r,e,t,s){let{implicitKey:n,inFlow:i}=e,a=typeof r.value=="string"?r:Object.assign({},r,{value:String(r.value)}),{type:o}=r;o!==Ve.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=Ve.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Ve.Scalar.BLOCK_FOLDED:case Ve.Scalar.BLOCK_LITERAL:return n||i?ss(a.value,e):tn(a,e,t,s);case Ve.Scalar.QUOTE_DOUBLE:return rs(a.value,e);case Ve.Scalar.QUOTE_SINGLE:return Di(a.value,e);case Ve.Scalar.PLAIN:return Tp(a,e,t,s);default:return null}},l=c(o);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,p=n&&u||d;if(l=c(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}Tc.stringifyString=kp});var yr=g(Zi=>{"use strict";var Ap=Hs(),mt=K(),Np=es(),Ep=ns();function jp(r,e){let t=Object.assign({blockQuote:!0,commentString:Np.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},r.schema.toStringOptions,e),s;switch(t.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:r,indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:s,options:t}}function Cp(r,e){if(e.tag){let n=r.filter(i=>i.tag===e.tag);if(n.length>0)return n.find(i=>i.format===e.format)??n[0]}let t,s;if(mt.isScalar(e)){s=e.value;let n=r.filter(i=>i.identify?.(s));t=n.find(i=>i.format===e.format)??n.find(i=>!i.format)}else s=e,t=r.find(n=>n.nodeClass&&s instanceof n.nodeClass);if(!t){let n=s?.constructor?.name??typeof s;throw new Error(`Tag not resolved for ${n} value`)}return t}function qp(r,e,{anchors:t,doc:s}){if(!s.directives)return"";let n=[],i=(mt.isScalar(r)||mt.isCollection(r))&&r.anchor;i&&Ap.anchorIsValid(i)&&(t.add(i),n.push(`&${i}`));let a=r.tag?r.tag:e.default?null:e.tag;return a&&n.push(s.directives.tagString(a)),n.join(" ")}function Rp(r,e,t,s){if(mt.isPair(r))return r.toString(e,t,s);if(mt.isAlias(r)){if(e.doc.directives)return r.toString(e);if(e.resolvedAliases?.has(r))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(r):e.resolvedAliases=new Set([r]),r=r.resolve(e.doc)}let n,i=mt.isNode(r)?r:e.doc.createNode(r,{onTagObj:c=>n=c});n||(n=Cp(e.doc.schema.tags,i));let a=qp(i,n,e);a.length>0&&(e.indentAtStart=(e.indentAtStart??0)+a.length+1);let o=typeof n.stringify=="function"?n.stringify(i,e,t,s):mt.isScalar(i)?Ep.stringifyString(i,e,t,s):i.toString(e,t,s);return a?mt.isScalar(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} +${e.indent}${o}`:o}Zi.createStringifyContext=jp;Zi.stringify=Rp});var Ec=g(Nc=>{"use strict";var yt=K(),kc=X(),Ac=yr(),is=es();function Mp({key:r,value:e},t,s,n){let{allNullValues:i,doc:a,indent:o,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=t,p=yt.isNode(r)&&r.comment||null;if(d){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(yt.isCollection(r)){let $="With simple keys, collection cannot be used as a key value";throw new Error($)}}let h=!d&&(!r||p&&e==null&&!t.inFlow||yt.isCollection(r)||(yt.isScalar(r)?r.type===kc.Scalar.BLOCK_FOLDED||r.type===kc.Scalar.BLOCK_LITERAL:typeof r=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!h&&(d||!i),indent:o+c});let b=!1,y=!1,v=Ac.stringify(r,t,()=>b=!0,()=>y=!0);if(!h&&!t.inFlow&&v.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(t.inFlow){if(i||e==null)return b&&s&&s(),v===""?"?":h?`? ${v}`:v}else if(i&&!d||e==null&&h)return v=`? ${v}`,p&&!b?v+=is.lineComment(v,t.indent,l(p)):y&&n&&n(),v;b&&(p=null),h?(p&&(v+=is.lineComment(v,t.indent,l(p))),v=`? ${v} +${o}:`):(v=`${v}:`,p&&(v+=is.lineComment(v,t.indent,l(p))));let _="",P=null;if(yt.isNode(e)){if(e.spaceBefore&&(_=` +`),e.commentBefore){let $=l(e.commentBefore);_+=` +${is.indentComment($,t.indent)}`}P=e.comment}else e&&typeof e=="object"&&(e=a.createNode(e));t.implicitKey=!1,!h&&!p&&yt.isScalar(e)&&(t.indentAtStart=v.length+1),y=!1,!u&&c.length>=2&&!t.inFlow&&!h&&yt.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substr(2));let k=!1,I=Ac.stringify(e,t,()=>k=!0,()=>y=!0),F=" ";return _||p?I===""&&!t.inFlow?F=_===` +`?` + +`:_:F=`${_} +${t.indent}`:!h&&yt.isCollection(e)?(!(I[0]==="["||I[0]==="{")||I.includes(` +`))&&(F=` +${t.indent}`):(I===""||I[0]===` +`)&&(F=""),v+=F+I,t.inFlow?k&&s&&s():P&&!k?v+=is.lineComment(v,t.indent,l(P)):y&&n&&n(),v}Nc.stringifyPair=Mp});var Bi=g(Ui=>{"use strict";function Lp(r,...e){r==="debug"&&console.log(...e)}function Dp(r,e){(r==="debug"||r==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}Ui.debug=Lp;Ui.warn=Dp});var Ki=g(Cc=>{"use strict";var Zp=Bi(),Up=yr(),gr=K(),Bp=X(),Vi=mr(),jc="<<";function Vp(r,e,{key:t,value:s}){if(r?.doc.schema.merge&&Fp(t))if(s=gr.isAlias(s)?s.resolve(r.doc):s,gr.isSeq(s))for(let n of s.items)Fi(r,e,n);else if(Array.isArray(s))for(let n of s)Fi(r,e,n);else Fi(r,e,s);else{let n=Vi.toJS(t,"",r);if(e instanceof Map)e.set(n,Vi.toJS(s,n,r));else if(e instanceof Set)e.add(n);else{let i=Kp(t,n,r),a=Vi.toJS(s,i,r);i in e?Object.defineProperty(e,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):e[i]=a}}return e}var Fp=r=>r===jc||gr.isScalar(r)&&r.value===jc&&(!r.type||r.type===Bp.Scalar.PLAIN);function Fi(r,e,t){let s=r&&gr.isAlias(t)?t.resolve(r.doc):t;if(!gr.isMap(s))throw new Error("Merge sources must be maps or map aliases");let n=s.toJSON(null,r,Map);for(let[i,a]of n)e instanceof Map?e.has(i)||e.set(i,a):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return e}function Kp(r,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(gr.isNode(r)&&t&&t.doc){let s=Up.createStringifyContext(t.doc,{});s.anchors=new Set;for(let i of t.anchors.keys())s.anchors.add(i.anchor);s.inFlow=!0,s.inStringifyKey=!0;let n=r.toString(s);if(!t.mapKeyWarned){let i=JSON.stringify(n);i.length>40&&(i=i.substring(0,36)+'..."'),Zp.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return n}return JSON.stringify(e)}Cc.addPairToJSMap=Vp});var tt=g(Wi=>{"use strict";var qc=Qr(),Wp=Ec(),Jp=Ki(),nn=K();function Yp(r,e,t){let s=qc.createNode(r,void 0,t),n=qc.createNode(e,void 0,t);return new vr(s,n)}var vr=class{constructor(e,t=null){Object.defineProperty(this,nn.NODE_TYPE,{value:nn.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return nn.isNode(t)&&(t=t.clone(e)),nn.isNode(s)&&(s=s.clone(e)),new vr(t,s)}toJSON(e,t){let s=t?.mapAsMap?new Map:{};return Jp.addPairToJSMap(t,s,this)}toString(e,t,s){return e?.doc?Wp.stringifyPair(this,e,t,s):JSON.stringify(this)}};Wi.Pair=vr;Wi.createPair=Yp});var Ji=g(Mc=>{"use strict";var Hp=Xr(),At=K(),Rc=yr(),as=es();function zp(r,e,t){return(e.inFlow??r.flow?Qp:Gp)(r,e,t)}function Gp({comment:r,items:e},t,{blockItemPrefix:s,flowChars:n,itemIndent:i,onChompKeep:a,onComment:o}){let{indent:c,options:{commentString:l}}=t,u=Object.assign({},t,{indent:i,type:null}),d=!1,p=[];for(let b=0;bv=null,()=>d=!0);v&&(_+=as.lineComment(_,i,l(v))),d&&v&&(d=!1),p.push(s+_)}let h;if(p.length===0)h=n.start+n.end;else{h=p[0];for(let b=1;bP=null);vd||k.includes(` +`))&&(u=!0),p.push(k),d=p.length}let h,{start:b,end:y}=s;if(p.length===0)h=b+y;else if(u||(u=p.reduce((_,P)=>_+P.length+2,2)>Hp.Collection.maxFlowStringSingleLineLength),u){h=b;for(let v of p)h+=v?` +${o}${a}${v}`:` +`;h+=` +${a}${y}`}else h=`${b} ${p.join(" ")} ${y}`;return r&&(h+=as.lineComment(h,c(r),a),i&&i()),h}function an({indent:r,options:{commentString:e}},t,s,n){if(s&&n&&(s=s.replace(/^\n+/,"")),s){let i=as.indentComment(e(s),r);t.push(i.trimStart())}}Mc.stringifyCollection=zp});var Nt=g(zi=>{"use strict";var Xp=Ji(),eh=Ki(),th=Xr(),gt=K(),Yi=tt(),rh=X();function os(r,e){let t=gt.isScalar(e)?e.value:e;for(let s of r)if(gt.isPair(s)&&(s.key===e||s.key===t||gt.isScalar(s.key)&&s.key.value===t))return s}var Hi=class extends th.Collection{constructor(e){super(gt.MAP,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:map"}add(e,t){let s;gt.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new Yi.Pair(e,e?.value):s=new Yi.Pair(e.key,e.value);let n=os(this.items,s.key),i=this.schema?.sortMapEntries;if(n){if(!t)throw new Error(`Key ${s.key} already set`);gt.isScalar(n.value)&&rh.isScalarValue(s.value)?n.value.value=s.value:n.value=s.value}else if(i){let a=this.items.findIndex(o=>i(s,o)<0);a===-1?this.items.push(s):this.items.splice(a,0,s)}else this.items.push(s)}delete(e){let t=os(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=os(this.items,e)?.value;return(!t&>.isScalar(n)?n.value:n)??void 0}has(e){return!!os(this.items,e)}set(e,t){this.add(new Yi.Pair(e,t),!0)}toJSON(e,t,s){let n=s?new s:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(n);for(let i of this.items)eh.addPairToJSMap(t,n,i);return n}toString(e,t,s){if(!e)return JSON.stringify(this);for(let n of this.items)if(!gt.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Xp.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}};zi.YAMLMap=Hi;zi.findPair=os});var br=g(Dc=>{"use strict";var sh=K(),nh=tt(),Lc=Nt();function ih(r,e,t){let{keepUndefined:s,replacer:n}=t,i=new Lc.YAMLMap(r),a=(o,c)=>{if(typeof n=="function")c=n.call(e,o,c);else if(Array.isArray(n)&&!n.includes(o))return;(c!==void 0||s)&&i.items.push(nh.createPair(o,c,t))};if(e instanceof Map)for(let[o,c]of e)a(o,c);else if(e&&typeof e=="object")for(let o of Object.keys(e))a(o,e[o]);return typeof r.sortMapEntries=="function"&&i.items.sort(r.sortMapEntries),i}var ah={collection:"map",createNode:ih,default:!0,nodeClass:Lc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(r,e){return sh.isMap(r)||e("Expected a mapping for this tag"),r}};Dc.map=ah});var Et=g(Zc=>{"use strict";var oh=Ji(),ch=Xr(),cn=K(),lh=X(),uh=mr(),Gi=class extends ch.Collection{constructor(e){super(cn.SEQ,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:seq"}add(e){this.items.push(e)}delete(e){let t=on(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let s=on(e);if(typeof s!="number")return;let n=this.items[s];return!t&&cn.isScalar(n)?n.value:n}has(e){let t=on(e);return typeof t=="number"&&t=0?e:null}Zc.YAMLSeq=Gi});var _r=g(Bc=>{"use strict";var dh=Qr(),fh=K(),Uc=Et();function ph(r,e,t){let{replacer:s}=t,n=new Uc.YAMLSeq(r);if(e&&Symbol.iterator in Object(e)){let i=0;for(let a of e){if(typeof s=="function"){let o=e instanceof Set?a:String(i++);a=s.call(e,o,a)}n.items.push(dh.createNode(a,void 0,t))}}return n}var hh={collection:"seq",createNode:ph,default:!0,nodeClass:Uc.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(r,e){return fh.isSeq(r)||e("Expected a sequence for this tag"),r}};Bc.seq=hh});var cs=g(Vc=>{"use strict";var mh=ns(),yh={identify:r=>typeof r=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:r=>r,stringify(r,e,t,s){return e=Object.assign({actualString:!0},e),mh.stringifyString(r,e,t,s)}};Vc.string=yh});var ln=g(Wc=>{"use strict";var Fc=X(),Kc={identify:r=>r==null,createNode:()=>new Fc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Fc.Scalar(null),stringify:({source:r},e)=>typeof r=="string"&&Kc.test.test(r)?r:e.options.nullStr};Wc.nullTag=Kc});var Qi=g(Yc=>{"use strict";var gh=X(),Jc={identify:r=>typeof r=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:r=>new gh.Scalar(r[0]==="t"||r[0]==="T"),stringify({source:r,value:e},t){if(r&&Jc.test.test(r)){let s=r[0]==="t"||r[0]==="T";if(e===s)return r}return e?t.options.trueStr:t.options.falseStr}};Yc.boolTag=Jc});var wr=g(Hc=>{"use strict";function vh({format:r,minFractionDigits:e,tag:t,value:s}){if(typeof s=="bigint")return String(s);let n=typeof s=="number"?s:Number(s);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let i=JSON.stringify(s);if(!r&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=e-(i.length-a-1);for(;o-- >0;)i+="0"}return i}Hc.stringifyNumber=vh});var ea=g(un=>{"use strict";var bh=X(),Xi=wr(),_h={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Xi.stringifyNumber},wh={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():Xi.stringifyNumber(r)}},Sh={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(r){let e=new bh.Scalar(parseFloat(r)),t=r.indexOf(".");return t!==-1&&r[r.length-1]==="0"&&(e.minFractionDigits=r.length-t-1),e},stringify:Xi.stringifyNumber};un.float=Sh;un.floatExp=wh;un.floatNaN=_h});var ra=g(fn=>{"use strict";var zc=wr(),dn=r=>typeof r=="bigint"||Number.isInteger(r),ta=(r,e,t,{intAsBigInt:s})=>s?BigInt(r):parseInt(r.substring(e),t);function Gc(r,e,t){let{value:s}=r;return dn(s)&&s>=0?t+s.toString(e):zc.stringifyNumber(r)}var xh={identify:r=>dn(r)&&r>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(r,e,t)=>ta(r,2,8,t),stringify:r=>Gc(r,8,"0o")},Oh={identify:dn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(r,e,t)=>ta(r,0,10,t),stringify:zc.stringifyNumber},Ih={identify:r=>dn(r)&&r>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(r,e,t)=>ta(r,2,16,t),stringify:r=>Gc(r,16,"0x")};fn.int=Oh;fn.intHex=Ih;fn.intOct=xh});var Xc=g(Qc=>{"use strict";var Ph=br(),$h=ln(),Th=_r(),kh=cs(),Ah=Qi(),sa=ea(),na=ra(),Nh=[Ph.map,Th.seq,kh.string,$h.nullTag,Ah.boolTag,na.intOct,na.int,na.intHex,sa.floatNaN,sa.floatExp,sa.float];Qc.schema=Nh});var rl=g(tl=>{"use strict";var Eh=X(),jh=br(),Ch=_r();function el(r){return typeof r=="bigint"||Number.isInteger(r)}var pn=({value:r})=>JSON.stringify(r),qh=[{identify:r=>typeof r=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:r=>r,stringify:pn},{identify:r=>r==null,createNode:()=>new Eh.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:pn},{identify:r=>typeof r=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:r=>r==="true",stringify:pn},{identify:el,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(r,e,{intAsBigInt:t})=>t?BigInt(r):parseInt(r,10),stringify:({value:r})=>el(r)?r.toString():JSON.stringify(r)},{identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:r=>parseFloat(r),stringify:pn}],Rh={default:!0,tag:"",test:/^/,resolve(r,e){return e(`Unresolved plain scalar ${JSON.stringify(r)}`),r}},Mh=[jh.map,Ch.seq].concat(qh,Rh);tl.schema=Mh});var aa=g(sl=>{"use strict";var ia=X(),Lh=ns(),Dh={identify:r=>r instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(r,e){if(typeof Buffer=="function")return Buffer.from(r,"base64");if(typeof atob=="function"){let t=atob(r.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let n=0;n{"use strict";var hn=K(),oa=tt(),Zh=X(),Uh=Et();function nl(r,e){if(hn.isSeq(r))for(let t=0;t1&&e("Each pair must have its own sequence indicator");let n=s.items[0]||new oa.Pair(new Zh.Scalar(null));if(s.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${s.commentBefore} +${n.key.commentBefore}`:s.commentBefore),s.comment){let i=n.value??n.key;i.comment=i.comment?`${s.comment} +${i.comment}`:s.comment}s=n}r.items[t]=hn.isPair(s)?s:new oa.Pair(s)}}else e("Expected a sequence for this tag");return r}function il(r,e,t){let{replacer:s}=t,n=new Uh.YAMLSeq(r);n.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let a of e){typeof s=="function"&&(a=s.call(e,String(i++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let l=Object.keys(a);if(l.length===1)o=l[0],c=a[o];else throw new TypeError(`Expected { key: value } tuple: ${a}`)}else o=a;n.items.push(oa.createPair(o,c,t))}return n}var Bh={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:nl,createNode:il};mn.createPairs=il;mn.pairs=Bh;mn.resolvePairs=nl});var ua=g(la=>{"use strict";var Vh=Et(),ca=mr(),ol=K(),ls=Nt(),al=yn(),rt=class extends Vh.YAMLSeq{constructor(){super(),this.add=ls.YAMLMap.prototype.add.bind(this),this.delete=ls.YAMLMap.prototype.delete.bind(this),this.get=ls.YAMLMap.prototype.get.bind(this),this.has=ls.YAMLMap.prototype.has.bind(this),this.set=ls.YAMLMap.prototype.set.bind(this),this.tag=rt.tag}toJSON(e,t){if(!t)return super.toJSON(e);let s=new Map;t?.onCreate&&t.onCreate(s);for(let n of this.items){let i,a;if(ol.isPair(n)?(i=ca.toJS(n.key,"",t),a=ca.toJS(n.value,i,t)):i=ca.toJS(n,"",t),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,a)}return s}};rt.tag="tag:yaml.org,2002:omap";var Fh={collection:"seq",identify:r=>r instanceof Map,nodeClass:rt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(r,e){let t=al.resolvePairs(r,e),s=[];for(let{key:n}of t.items)ol.isScalar(n)&&(s.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):s.push(n.value));return Object.assign(new rt,t)},createNode(r,e,t){let s=al.createPairs(r,e,t),n=new rt;return n.items=s.items,n}};la.YAMLOMap=rt;la.omap=Fh});var fl=g(da=>{"use strict";var cl=X();function ll({value:r,source:e},t){return e&&(r?ul:dl).test.test(e)?e:r?t.options.trueStr:t.options.falseStr}var ul={identify:r=>r===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new cl.Scalar(!0),stringify:ll},dl={identify:r=>r===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new cl.Scalar(!1),stringify:ll};da.falseTag=dl;da.trueTag=ul});var pl=g(gn=>{"use strict";var Kh=X(),fa=wr(),Wh={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fa.stringifyNumber},Jh={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r.replace(/_/g,"")),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():fa.stringifyNumber(r)}},Yh={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(r){let e=new Kh.Scalar(parseFloat(r.replace(/_/g,""))),t=r.indexOf(".");if(t!==-1){let s=r.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:fa.stringifyNumber};gn.float=Yh;gn.floatExp=Jh;gn.floatNaN=Wh});var ml=g(ds=>{"use strict";var hl=wr(),us=r=>typeof r=="bigint"||Number.isInteger(r);function vn(r,e,t,{intAsBigInt:s}){let n=r[0];if((n==="-"||n==="+")&&(e+=1),r=r.substring(e).replace(/_/g,""),s){switch(t){case 2:r=`0b${r}`;break;case 8:r=`0o${r}`;break;case 16:r=`0x${r}`;break}let a=BigInt(r);return n==="-"?BigInt(-1)*a:a}let i=parseInt(r,t);return n==="-"?-1*i:i}function pa(r,e,t){let{value:s}=r;if(us(s)){let n=s.toString(e);return s<0?"-"+t+n.substr(1):t+n}return hl.stringifyNumber(r)}var Hh={identify:us,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(r,e,t)=>vn(r,2,2,t),stringify:r=>pa(r,2,"0b")},zh={identify:us,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(r,e,t)=>vn(r,1,8,t),stringify:r=>pa(r,8,"0")},Gh={identify:us,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(r,e,t)=>vn(r,0,10,t),stringify:hl.stringifyNumber},Qh={identify:us,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(r,e,t)=>vn(r,2,16,t),stringify:r=>pa(r,16,"0x")};ds.int=Gh;ds.intBin=Hh;ds.intHex=Qh;ds.intOct=zh});var ma=g(ha=>{"use strict";var _n=K(),wn=tt(),bn=Nt(),st=class extends bn.YAMLMap{constructor(e){super(e),this.tag=st.tag}add(e){let t;_n.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new wn.Pair(e.key,null):t=new wn.Pair(e,null),bn.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let s=bn.findPair(this.items,e);return!t&&_n.isPair(s)?_n.isScalar(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let s=bn.findPair(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new wn.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}};st.tag="tag:yaml.org,2002:set";var Xh={collection:"map",identify:r=>r instanceof Set,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:set",resolve(r,e){if(_n.isMap(r)){if(r.hasAllNullValues(!0))return Object.assign(new st,r);e("Set items must all have null values")}else e("Expected a mapping for this tag");return r},createNode(r,e,t){let{replacer:s}=t,n=new st(r);if(e&&Symbol.iterator in Object(e))for(let i of e)typeof s=="function"&&(i=s.call(e,i,i)),n.items.push(wn.createPair(i,null,t));return n}};ha.YAMLSet=st;ha.set=Xh});var ga=g(Sn=>{"use strict";var em=wr();function ya(r,e){let t=r[0],s=t==="-"||t==="+"?r.substring(1):r,n=a=>e?BigInt(a):Number(a),i=s.replace(/_/g,"").split(":").reduce((a,o)=>a*n(60)+n(o),n(0));return t==="-"?n(-1)*i:i}function yl(r){let{value:e}=r,t=a=>a;if(typeof e=="bigint")t=a=>BigInt(a);else if(isNaN(e)||!isFinite(e))return em.stringifyNumber(r);let s="";e<0&&(s="-",e*=t(-1));let n=t(60),i=[e%n];return e<60?i.unshift(0):(e=(e-i[0])/n,i.unshift(e%n),e>=60&&(e=(e-i[0])/n,i.unshift(e))),s+i.map(a=>a<10?"0"+String(a):String(a)).join(":").replace(/000000\d*$/,"")}var tm={identify:r=>typeof r=="bigint"||Number.isInteger(r),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(r,e,{intAsBigInt:t})=>ya(r,t),stringify:yl},rm={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:r=>ya(r,!1),stringify:yl},gl={identify:r=>r instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(r){let e=r.match(gl.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,s,n,i,a,o]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,s-1,n,i||0,a||0,o||0,c),u=e[8];if(u&&u!=="Z"){let d=ya(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:r})=>r.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")};Sn.floatTime=rm;Sn.intTime=tm;Sn.timestamp=gl});var _l=g(bl=>{"use strict";var sm=br(),nm=ln(),im=_r(),am=cs(),om=aa(),vl=fl(),va=pl(),xn=ml(),cm=ua(),lm=yn(),um=ma(),ba=ga(),dm=[sm.map,im.seq,am.string,nm.nullTag,vl.trueTag,vl.falseTag,xn.intBin,xn.intOct,xn.int,xn.intHex,va.floatNaN,va.floatExp,va.float,om.binary,cm.omap,lm.pairs,um.set,ba.intTime,ba.floatTime,ba.timestamp];bl.schema=dm});var Al=g(Sa=>{"use strict";var Ol=br(),fm=ln(),Il=_r(),pm=cs(),hm=Qi(),_a=ea(),wa=ra(),mm=Xc(),ym=rl(),Pl=aa(),$l=ua(),Tl=yn(),wl=_l(),kl=ma(),On=ga(),Sl=new Map([["core",mm.schema],["failsafe",[Ol.map,Il.seq,pm.string]],["json",ym.schema],["yaml11",wl.schema],["yaml-1.1",wl.schema]]),xl={binary:Pl.binary,bool:hm.boolTag,float:_a.float,floatExp:_a.floatExp,floatNaN:_a.floatNaN,floatTime:On.floatTime,int:wa.int,intHex:wa.intHex,intOct:wa.intOct,intTime:On.intTime,map:Ol.map,null:fm.nullTag,omap:$l.omap,pairs:Tl.pairs,seq:Il.seq,set:kl.set,timestamp:On.timestamp},gm={"tag:yaml.org,2002:binary":Pl.binary,"tag:yaml.org,2002:omap":$l.omap,"tag:yaml.org,2002:pairs":Tl.pairs,"tag:yaml.org,2002:set":kl.set,"tag:yaml.org,2002:timestamp":On.timestamp};function vm(r,e){let t=Sl.get(e);if(!t)if(Array.isArray(r))t=[];else{let s=Array.from(Sl.keys()).filter(n=>n!=="yaml11").map(n=>JSON.stringify(n)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(r))for(let s of r)t=t.concat(s);else typeof r=="function"&&(t=r(t.slice()));return t.map(s=>{if(typeof s!="string")return s;let n=xl[s];if(n)return n;let i=Object.keys(xl).map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown custom tag "${s}"; use one of ${i}`)})}Sa.coreKnownTags=gm;Sa.getTags=vm});var Oa=g(Nl=>{"use strict";var xa=K(),bm=br(),_m=_r(),wm=cs(),In=Al(),Sm=(r,e)=>r.keye.key?1:0,fs=class{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:n,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?In.getTags(e,"compat"):e?In.getTags(null,e):null,this.merge=!!s,this.name=typeof i=="string"&&i||"core",this.knownTags=n?In.coreKnownTags:{},this.tags=In.getTags(t,this.name),this.toStringOptions=o??null,Object.defineProperty(this,xa.MAP,{value:bm.map}),Object.defineProperty(this,xa.SCALAR,{value:wm.string}),Object.defineProperty(this,xa.SEQ,{value:_m.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?Sm:null}clone(){let e=Object.create(fs.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Nl.Schema=fs});var jl=g(El=>{"use strict";var xm=K(),Ia=yr(),ps=es();function Om(r,e){let t=[],s=e.directives===!0;if(e.directives!==!1&&r.directives){let c=r.directives.toString(r);c?(t.push(c),s=!0):r.directives.docStart&&(s=!0)}s&&t.push("---");let n=Ia.createStringifyContext(r,e),{commentString:i}=n.options;if(r.commentBefore){t.length!==1&&t.unshift("");let c=i(r.commentBefore);t.unshift(ps.indentComment(c,""))}let a=!1,o=null;if(r.contents){if(xm.isNode(r.contents)){if(r.contents.spaceBefore&&s&&t.push(""),r.contents.commentBefore){let u=i(r.contents.commentBefore);t.push(ps.indentComment(u,""))}n.forceBlockIndent=!!r.comment,o=r.contents.comment}let c=o?void 0:()=>a=!0,l=Ia.stringify(r.contents,n,()=>o=null,c);o&&(l+=ps.lineComment(l,"",i(o))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(Ia.stringify(r.contents,n));if(r.directives?.docEnd)if(r.comment){let c=i(r.comment);c.includes(` +`)?(t.push("..."),t.push(ps.indentComment(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=r.comment;c&&a&&(c=c.replace(/^\n+/,"")),c&&((!a||o)&&t[t.length-1]!==""&&t.push(""),t.push(ps.indentComment(i(c),"")))}return t.join(` +`)+` +`}El.stringifyDocument=Om});var ql=g(Cl=>{"use strict";function hs(r,e,t,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let n=0,i=s.length;n{"use strict";var Im=Gr(),Sr=Xr(),we=K(),Pm=tt(),$m=mr(),Tm=Oa(),km=yr(),Am=jl(),Pa=Hs(),Nm=ql(),Em=Qr(),$a=ji(),ms=class{constructor(e,t,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,we.NODE_TYPE,{value:we.DOC});let n=null;typeof t=="function"||Array.isArray(t)?n=t:s===void 0&&t&&(s=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},s);this.options=i;let{version:a}=i;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new $a.Directives({version:a}),this.setSchema(a,s),e===void 0?this.contents=null:this.contents=this.createNode(e,n,s)}clone(){let e=Object.create(ms.prototype,{[we.NODE_TYPE]:{value:we.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=we.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){xr(this.contents)&&this.contents.add(e)}addIn(e,t){xr(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let s=Pa.anchorNames(this);e.anchor=!t||s.has(t)?Pa.findNewAnchor(t||"a",s):t}return new Im.Alias(e.anchor)}createNode(e,t,s){let n;if(typeof t=="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let v=P=>typeof P=="number"||P instanceof String||P instanceof Number,_=t.filter(v).map(String);_.length>0&&(t=t.concat(_)),n=t}else s===void 0&&t&&(s=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:l,tag:u}=s??{},{onAnchor:d,setAnchors:p,sourceObjects:h}=Pa.createNodeAnchors(this,a||"a"),b={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:h},y=Em.createNode(e,u,b);return o&&we.isCollection(y)&&(y.flow=!0),p(),y}createPair(e,t,s={}){let n=this.createNode(e,null,s),i=this.createNode(t,null,s);return new Pm.Pair(n,i)}delete(e){return xr(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Sr.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):xr(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return we.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Sr.isEmptyPath(e)?!t&&we.isScalar(this.contents)?this.contents.value:this.contents:we.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return we.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Sr.isEmptyPath(e)?this.contents!==void 0:we.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Sr.collectionFromPath(this.schema,[e],t):xr(this.contents)&&this.contents.set(e,t)}setIn(e,t){Sr.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Sr.collectionFromPath(this.schema,Array.from(e),t):xr(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new $a.Directives({version:"1.1"}),s={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new $a.Directives({version:e}),s={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(s)this.schema=new Tm.Schema(Object.assign(s,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:n,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100,stringify:km.stringify},c=$m.toJS(this.contents,t??"",o);if(typeof i=="function")for(let{count:l,res:u}of o.anchors.values())i(u,l);return typeof a=="function"?Nm.applyReviver(a,{"":c},"",c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Am.stringifyDocument(this,e)}};function xr(r){if(we.isCollection(r))return!0;throw new Error("Expected a YAML collection as document contents")}Rl.Document=ms});var bs=g(vs=>{"use strict";var gs=class extends Error{constructor(e,t,s,n){super(),this.name=e,this.code=s,this.message=n,this.pos=t}},Ta=class extends gs{constructor(e,t,s){super("YAMLParseError",e,t,s)}},ka=class extends gs{constructor(e,t,s){super("YAMLWarning",e,t,s)}},jm=(r,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(o=>e.linePos(o));let{line:s,col:n}=t.linePos[0];t.message+=` at line ${s}, column ${n}`;let i=n-1,a=r.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){let o=Math.min(i-39,a.length-79);a="\u2026"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(a.substring(0,i))){let o=r.substring(e.lineStarts[s-2],e.lineStarts[s-1]);o.length>80&&(o=o.substring(0,79)+`\u2026 +`),a=o+a}if(/[^ ]/.test(a)){let o=1,c=t.linePos[1];c&&c.line===s&&c.col>n&&(o=Math.min(c.col-n,80-i));let l=" ".repeat(i)+"^".repeat(o);t.message+=`: + +${a} +${l} +`}};vs.YAMLError=gs;vs.YAMLParseError=Ta;vs.YAMLWarning=ka;vs.prettifyError=jm});var _s=g(Ml=>{"use strict";function Cm(r,{flow:e,indicator:t,next:s,offset:n,onError:i,startOnNewline:a}){let o=!1,c=a,l=a,u="",d="",p=!1,h=!1,b=!1,y=null,v=null,_=null,P=null,k=null;for(let $ of r)switch(b&&($.type!=="space"&&$.type!=="newline"&&$.type!=="comma"&&i($.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),$.type){case"space":!e&&c&&t!=="doc-start"&&$.source[0]===" "&&i($,"TAB_AS_INDENT","Tabs are not allowed as indentation"),l=!0;break;case"comment":{l||i($,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let ce=$.source.substring(1)||" ";u?u+=d+ce:u=ce,d="",c=!1;break}case"newline":c?u?u+=$.source:o=!0:d+=$.source,c=!0,p=!0,(y||v)&&(h=!0),l=!0;break;case"anchor":y&&i($,"MULTIPLE_ANCHORS","A node can have at most one anchor"),$.source.endsWith(":")&&i($.offset+$.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=$,k===null&&(k=$.offset),c=!1,l=!1,b=!0;break;case"tag":{v&&i($,"MULTIPLE_TAGS","A node can have at most one tag"),v=$,k===null&&(k=$.offset),c=!1,l=!1,b=!0;break}case t:(y||v)&&i($,"BAD_PROP_ORDER",`Anchors and tags must be after the ${$.source} indicator`),P&&i($,"UNEXPECTED_TOKEN",`Unexpected ${$.source} in ${e??"collection"}`),P=$,c=!1,l=!1;break;case"comma":if(e){_&&i($,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),_=$,c=!1,l=!1;break}default:i($,"UNEXPECTED_TOKEN",`Unexpected ${$.type} token`),c=!1,l=!1}let I=r[r.length-1],F=I?I.offset+I.source.length:n;return b&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&i(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:_,found:P,spaceBefore:o,comment:u,hasNewline:p,hasNewlineAfterProp:h,anchor:y,tag:v,end:F,start:k??F}}Ml.resolveProps=Cm});var Pn=g(Ll=>{"use strict";function Aa(r){if(!r)return null;switch(r.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(r.source.includes(` +`))return!0;if(r.end){for(let e of r.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of r.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Aa(e.key)||Aa(e.value))return!0}return!1;default:return!0}}Ll.containsNewline=Aa});var Na=g(Dl=>{"use strict";var qm=Pn();function Rm(r,e,t){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===r&&(s.source==="]"||s.source==="}")&&qm.containsNewline(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Dl.flowIndentCheck=Rm});var Ea=g(Ul=>{"use strict";var Zl=K();function Mm(r,e,t){let{uniqueKeys:s}=r.options;if(s===!1)return!1;let n=typeof s=="function"?s:(i,a)=>i===a||Zl.isScalar(i)&&Zl.isScalar(a)&&i.value===a.value&&!(i.value==="<<"&&r.schema.merge);return e.some(i=>n(i.key,t))}Ul.mapIncludes=Mm});var Jl=g(Wl=>{"use strict";var Bl=tt(),Lm=Nt(),Vl=_s(),Dm=Pn(),Fl=Na(),Zm=Ea(),Kl="All mapping items must start at the same column";function Um({composeNode:r,composeEmptyNode:e},t,s,n){let i=new Lm.YAMLMap(t.schema);t.atRoot&&(t.atRoot=!1);let a=s.offset,o=null;for(let c of s.items){let{start:l,key:u,sep:d,value:p}=c,h=Vl.resolveProps(l,{indicator:"explicit-key-ind",next:u??d?.[0],offset:a,onError:n,startOnNewline:!0}),b=!h.found;if(b){if(u&&(u.type==="block-seq"?n(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==s.indent&&n(a,"BAD_INDENT",Kl)),!h.anchor&&!h.tag&&!d){o=h.end,h.comment&&(i.comment?i.comment+=` +`+h.comment:i.comment=h.comment);continue}(h.hasNewlineAfterProp||Dm.containsNewline(u))&&n(u??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&n(a,"BAD_INDENT",Kl);let y=h.end,v=u?r(t,u,h,n):e(t,y,l,null,h,n);t.schema.compat&&Fl.flowIndentCheck(s.indent,u,n),Zm.mapIncludes(t,i.items,v)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let _=Vl.resolveProps(d??[],{indicator:"map-value-ind",next:p,offset:v.range[2],onError:n,startOnNewline:!u||u.type==="block-scalar"});if(a=_.end,_.found){b&&(p?.type==="block-map"&&!_.hasNewline&&n(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&h.start<_.found.offset-1024&&n(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let P=p?r(t,p,_,n):e(t,a,d,null,_,n);t.schema.compat&&Fl.flowIndentCheck(s.indent,p,n),a=P.range[2];let k=new Bl.Pair(v,P);t.options.keepSourceTokens&&(k.srcToken=c),i.items.push(k)}else{b&&n(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(v.comment?v.comment+=` +`+_.comment:v.comment=_.comment);let P=new Bl.Pair(v);t.options.keepSourceTokens&&(P.srcToken=c),i.items.push(P)}}return o&&o{"use strict";var Bm=Et(),Vm=_s(),Fm=Na();function Km({composeNode:r,composeEmptyNode:e},t,s,n){let i=new Bm.YAMLSeq(t.schema);t.atRoot&&(t.atRoot=!1);let a=s.offset,o=null;for(let{start:c,value:l}of s.items){let u=Vm.resolveProps(c,{indicator:"seq-item-ind",next:l,offset:a,onError:n,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||l)l&&l.type==="block-seq"?n(u.end,"BAD_INDENT","All sequence items must start at the same column"):n(a,"MISSING_CHAR","Sequence item without - indicator");else{o=u.end,u.comment&&(i.comment=u.comment);continue}let d=l?r(t,l,u,n):e(t,u.end,c,null,u,n);t.schema.compat&&Fm.flowIndentCheck(s.indent,l,n),a=d.range[2],i.items.push(d)}return i.range=[s.offset,a,o??a],i}Yl.resolveBlockSeq=Km});var Or=g(zl=>{"use strict";function Wm(r,e,t,s){let n="";if(r){let i=!1,a="";for(let o of r){let{source:c,type:l}=o;switch(l){case"space":i=!0;break;case"comment":{t&&!i&&s(o,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=a+u:n=u,a="";break}case"newline":n&&(a+=c),i=!0;break;default:s(o,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:n,offset:e}}zl.resolveEnd=Wm});var eu=g(Xl=>{"use strict";var Jm=K(),Ym=tt(),Gl=Nt(),Hm=Et(),zm=Or(),Ql=_s(),Gm=Pn(),Qm=Ea(),ja="Block collections are not allowed within flow collections",Ca=r=>r&&(r.type==="block-map"||r.type==="block-seq");function Xm({composeNode:r,composeEmptyNode:e},t,s,n){let i=s.start.source==="{",a=i?"flow map":"flow sequence",o=i?new Gl.YAMLMap(t.schema):new Hm.YAMLSeq(t.schema);o.flow=!0;let c=t.atRoot;c&&(t.atRoot=!1);let l=s.offset+s.start.source.length;for(let b=0;b0){let b=zm.resolveEnd(p,h,t.options.strict,n);b.comment&&(o.comment?o.comment+=` +`+b.comment:o.comment=b.comment),o.range=[s.offset,h,b.offset]}else o.range=[s.offset,h,h];return o}Xl.resolveFlowCollection=Xm});var su=g(ru=>{"use strict";var tu=K(),ey=X(),ty=Jl(),ry=Hl(),sy=eu();function ny(r,e,t,s,n){let i;switch(t.type){case"block-map":{i=ty.resolveBlockMap(r,e,t,n);break}case"block-seq":{i=ry.resolveBlockSeq(r,e,t,n);break}case"flow-collection":{i=sy.resolveFlowCollection(r,e,t,n);break}}if(!s)return i;let a=e.directives.tagName(s.source,p=>n(s,"TAG_RESOLVE_FAILED",p));if(!a)return i;let o=i.constructor;if(a==="!"||a===o.tagName)return i.tag=o.tagName,i;let c=tu.isMap(i)?"map":"seq",l=e.schema.tags.find(p=>p.collection===c&&p.tag===a);if(!l){let p=e.schema.knownTags[a];if(p&&p.collection===c)e.schema.tags.push(Object.assign({},p,{default:!1})),l=p;else return n(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),i.tag=a,i}let u=l.resolve(i,p=>n(s,"TAG_RESOLVE_FAILED",p),e.options),d=tu.isNode(u)?u:new ey.Scalar(u);return d.range=i.range,d.tag=a,l?.format&&(d.format=l.format),d}ru.composeCollection=ny});var Ra=g(nu=>{"use strict";var qa=X();function iy(r,e,t){let s=r.offset,n=ay(r,e,t);if(!n)return{value:"",type:null,comment:"",range:[s,s,s]};let i=n.mode===">"?qa.Scalar.BLOCK_FOLDED:qa.Scalar.BLOCK_LITERAL,a=r.source?oy(r.source):[],o=a.length;for(let y=a.length-1;y>=0;--y){let v=a[y][1];if(v===""||v==="\r")o=y;else break}if(o===0){let y=n.chomp==="+"&&a.length>0?` +`.repeat(Math.max(1,a.length-1)):"",v=s+n.length;return r.source&&(v+=r.source.length),{value:y,type:i,comment:n.comment,range:[s,v,v]}}let c=r.indent+n.indent,l=r.offset+n.length,u=0;for(let y=0;yc&&(c=v.length);else{if(v.length=o;--y)a[y][0].length>c&&(o=y+1);let d="",p="",h=!1;for(let y=0;yc||_[0]===" "?(p===" "?p=` +`:!h&&p===` +`&&(p=` + +`),d+=p+v.slice(c)+_,p=` +`,h=!0):_===""?p===` +`?d+=` +`:p=` +`:(d+=p+_,p=" ",h=!1)}switch(n.chomp){case"-":break;case"+":for(let y=o;y{"use strict";var Ma=X(),cy=Or();function ly(r,e,t){let{offset:s,type:n,source:i,end:a}=r,o,c,l=(p,h,b)=>t(s+p,h,b);switch(n){case"scalar":o=Ma.Scalar.PLAIN,c=uy(i,l);break;case"single-quoted-scalar":o=Ma.Scalar.QUOTE_SINGLE,c=dy(i,l);break;case"double-quoted-scalar":o=Ma.Scalar.QUOTE_DOUBLE,c=fy(i,l);break;default:return t(r,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[s,s+i.length,s+i.length]}}let u=s+i.length,d=cy.resolveEnd(a,u,e,t);return{value:c,type:o,comment:d.comment,range:[s,u,d.offset]}}function uy(r,e){let t="";switch(r[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${r[0]}`;break}case"@":case"`":{t=`reserved character ${r[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),iu(r)}function dy(r,e){return(r[r.length-1]!=="'"||r.length===1)&&e(r.length,"MISSING_CHAR","Missing closing 'quote"),iu(r.slice(1,-1)).replace(/''/g,"'")}function iu(r){let e,t;try{e=new RegExp(`(.*?)(?i?r.slice(i,s+1):n)}else t+=n}return(r[r.length-1]!=='"'||r.length===1)&&e(r.length,"MISSING_CHAR",'Missing closing "quote'),t}function py(r,e){let t="",s=r[e+1];for(;(s===" "||s===" "||s===` +`||s==="\r")&&!(s==="\r"&&r[e+2]!==` +`);)s===` +`&&(t+=` +`),e+=1,s=r[e+1];return t||(t=" "),{fold:t,offset:e}}var hy={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` +`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function my(r,e,t,s){let n=r.substr(e,t),a=n.length===t&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(a)){let o=r.substr(e-2,t+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}return String.fromCodePoint(a)}au.resolveFlowScalar=ly});var lu=g(cu=>{"use strict";var Ir=K(),ou=X(),yy=Ra(),gy=La();function vy(r,e,t,s){let{value:n,type:i,comment:a,range:o}=e.type==="block-scalar"?yy.resolveBlockScalar(e,r.options.strict,s):gy.resolveFlowScalar(e,r.options.strict,s),c=t?r.directives.tagName(t.source,d=>s(t,"TAG_RESOLVE_FAILED",d)):null,l=t&&c?by(r.schema,n,c,t,s):e.type==="scalar"?_y(r,n,e,s):r.schema[Ir.SCALAR],u;try{let d=l.resolve(n,p=>s(t??e,"TAG_RESOLVE_FAILED",p),r.options);u=Ir.isScalar(d)?d:new ou.Scalar(d)}catch(d){let p=d instanceof Error?d.message:String(d);s(t??e,"TAG_RESOLVE_FAILED",p),u=new ou.Scalar(n)}return u.range=o,u.source=n,i&&(u.type=i),c&&(u.tag=c),l.format&&(u.format=l.format),a&&(u.comment=a),u}function by(r,e,t,s,n){if(t==="!")return r[Ir.SCALAR];let i=[];for(let o of r.tags)if(!o.collection&&o.tag===t)if(o.default&&o.test)i.push(o);else return o;for(let o of i)if(o.test?.test(e))return o;let a=r.knownTags[t];return a&&!a.collection?(r.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(n(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),r[Ir.SCALAR])}function _y({directives:r,schema:e},t,s,n){let i=e.tags.find(a=>a.default&&a.test?.test(t))||e[Ir.SCALAR];if(e.compat){let a=e.compat.find(o=>o.default&&o.test?.test(t))??e[Ir.SCALAR];if(i.tag!==a.tag){let o=r.tagString(i.tag),c=r.tagString(a.tag),l=`Value may be parsed as either ${o} or ${c}`;n(s,"TAG_RESOLVE_FAILED",l,!0)}}return i}cu.composeScalar=vy});var du=g(uu=>{"use strict";function wy(r,e,t){if(e){t===null&&(t=e.length);for(let s=t-1;s>=0;--s){let n=e[s];switch(n.type){case"space":case"comment":case"newline":r-=n.source.length;continue}for(n=e[++s];n?.type==="space";)r+=n.source.length,n=e[++s];break}}return r}uu.emptyScalarPosition=wy});var hu=g(Za=>{"use strict";var Sy=Gr(),xy=su(),fu=lu(),Oy=Or(),Iy=du(),Py={composeNode:pu,composeEmptyNode:Da};function pu(r,e,t,s){let{spaceBefore:n,comment:i,anchor:a,tag:o}=t,c,l=!0;switch(e.type){case"alias":c=$y(r,e,s),(a||o)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=fu.composeScalar(r,e,o,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=xy.composeCollection(Py,r,e,o,s),a&&(c.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),c=Da(r,e.offset,void 0,null,t,s),l=!1}}return a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&(c.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?c.comment=i:c.commentBefore=i),r.options.keepSourceTokens&&l&&(c.srcToken=e),c}function Da(r,e,t,s,{spaceBefore:n,comment:i,anchor:a,tag:o,end:c},l){let u={type:"scalar",offset:Iy.emptyScalarPosition(e,t,s),indent:-1,source:""},d=fu.composeScalar(r,u,o,l);return a&&(d.anchor=a.source.substring(1),d.anchor===""&&l(a,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),i&&(d.comment=i,d.range[2]=c),d}function $y({options:r},{offset:e,source:t,end:s},n){let i=new Sy.Alias(t.substring(1));i.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&n(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=e+t.length,o=Oy.resolveEnd(s,a,r.strict,n);return i.range=[e,a,o.offset],o.comment&&(i.comment=o.comment),i}Za.composeEmptyNode=Da;Za.composeNode=pu});var gu=g(yu=>{"use strict";var Ty=ys(),mu=hu(),ky=Or(),Ay=_s();function Ny(r,e,{offset:t,start:s,value:n,end:i},a){let o=Object.assign({_directives:e},r),c=new Ty.Document(void 0,o),l={atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ay.resolveProps(s,{indicator:"doc-start",next:n??i?.[0],offset:t,onError:a,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&a(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?mu.composeNode(l,n,u,a):mu.composeEmptyNode(l,u.end,s,null,u,a);let d=c.contents.range[2],p=ky.resolveEnd(i,d,!1,a);return p.comment&&(c.comment=p.comment),c.range=[t,d,p.offset],c}yu.composeDoc=Ny});var Ba=g(_u=>{"use strict";var Ey=ji(),jy=ys(),ws=bs(),vu=K(),Cy=gu(),qy=Or();function Ss(r){if(typeof r=="number")return[r,r+1];if(Array.isArray(r))return r.length===2?r:[r[0],r[1]];let{offset:e,source:t}=r;return[e,e+(typeof t=="string"?t.length:1)]}function bu(r){let e="",t=!1,s=!1;for(let n=0;n{let a=Ss(t);i?this.warnings.push(new ws.YAMLWarning(a,s,n)):this.errors.push(new ws.YAMLParseError(a,s,n))},this.directives=new Ey.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:s,afterEmptyLine:n}=bu(this.prelude);if(s){let i=e.contents;if(t)e.comment=e.comment?`${e.comment} +${s}`:s;else if(n||e.directives.docStart||!i)e.commentBefore=s;else if(vu.isCollection(i)&&!i.flow&&i.items.length>0){let a=i.items[0];vu.isPair(a)&&(a=a.key);let o=a.commentBefore;a.commentBefore=o?`${s} +${o}`:s}else{let a=i.commentBefore;i.commentBefore=a?`${s} +${a}`:s}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:bu(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(let n of e)yield*this.next(n);yield*this.end(t,s)}*next(e){switch(process.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,s,n)=>{let i=Ss(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",s,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Cy.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new ws.YAMLParseError(Ss(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new ws.YAMLParseError(Ss(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let t=qy.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let s=this.doc.comment;this.doc.comment=s?`${s} +${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ws.YAMLParseError(Ss(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let s=Object.assign({_directives:this.directives},this.options),n=new jy.Document(void 0,s);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}};_u.Composer=Ua});var xu=g($n=>{"use strict";var Ry=Ra(),My=La(),Ly=bs(),wu=ns();function Dy(r,e=!0,t){if(r){let s=(n,i,a)=>{let o=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(t)t(o,i,a);else throw new Ly.YAMLParseError([o,o+1],i,a)};switch(r.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return My.resolveFlowScalar(r,e,s);case"block-scalar":return Ry.resolveBlockScalar(r,e,s)}}return null}function Zy(r,e){let{implicitKey:t=!1,indent:s,inFlow:n=!1,offset:i=-1,type:a="PLAIN"}=e,o=wu.stringifyString({type:a,value:r},{implicitKey:t,indent:s>0?" ".repeat(s):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:s,source:` +`}];switch(o[0]){case"|":case">":{let l=o.indexOf(` +`),u=o.substring(0,l),d=o.substring(l+1)+` +`,p=[{type:"block-scalar-header",offset:i,indent:s,source:u}];return Su(p,c)||p.push({type:"newline",offset:-1,indent:s,source:` +`}),{type:"block-scalar",offset:i,indent:s,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:o,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:o,end:c};default:return{type:"scalar",offset:i,indent:s,source:o,end:c}}}function Uy(r,e,t={}){let{afterKey:s=!1,implicitKey:n=!1,inFlow:i=!1,type:a}=t,o="indent"in r?r.indent:null;if(s&&typeof o=="number"&&(o+=2),!a)switch(r.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let l=r.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let c=wu.stringifyString({type:a,value:e},{implicitKey:n||o===null,indent:o!==null&&o>0?" ".repeat(o):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":By(r,c);break;case'"':Va(r,c,"double-quoted-scalar");break;case"'":Va(r,c,"single-quoted-scalar");break;default:Va(r,c,"scalar")}}function By(r,e){let t=e.indexOf(` +`),s=e.substring(0,t),n=e.substring(t+1)+` +`;if(r.type==="block-scalar"){let i=r.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,r.source=n}else{let{offset:i}=r,a="indent"in r?r.indent:-1,o=[{type:"block-scalar-header",offset:i,indent:a,source:s}];Su(o,"end"in r?r.end:void 0)||o.push({type:"newline",offset:-1,indent:a,source:` +`});for(let c of Object.keys(r))c!=="type"&&c!=="offset"&&delete r[c];Object.assign(r,{type:"block-scalar",indent:a,props:o,source:n})}}function Su(r,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":r.push(t);break;case"newline":return r.push(t),!0}return!1}function Va(r,e,t){switch(r.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":r.type=t,r.source=e;break;case"block-scalar":{let s=r.props.slice(1),n=e.length;r.props[0].type==="block-scalar-header"&&(n-=r.props[0].source.length);for(let i of s)i.offset+=n;delete r.props,Object.assign(r,{type:t,source:e,end:s});break}case"block-map":case"block-seq":{let n={type:"newline",offset:r.offset+e.length,indent:r.indent,source:` +`};delete r.items,Object.assign(r,{type:t,source:e,end:[n]});break}default:{let s="indent"in r?r.indent:-1,n="end"in r&&Array.isArray(r.end)?r.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(r))i!=="type"&&i!=="offset"&&delete r[i];Object.assign(r,{type:t,indent:s,source:e,end:n})}}}$n.createScalarToken=Zy;$n.resolveAsScalar=Dy;$n.setScalarValue=Uy});var Iu=g(Ou=>{"use strict";var Vy=r=>"type"in r?kn(r):Tn(r);function kn(r){switch(r.type){case"block-scalar":{let e="";for(let t of r.props)e+=kn(t);return e+r.source}case"block-map":case"block-seq":{let e="";for(let t of r.items)e+=Tn(t);return e}case"flow-collection":{let e=r.start.source;for(let t of r.items)e+=Tn(t);for(let t of r.end)e+=t.source;return e}case"document":{let e=Tn(r);if(r.end)for(let t of r.end)e+=t.source;return e}default:{let e=r.source;if("end"in r&&r.end)for(let t of r.end)e+=t.source;return e}}}function Tn({start:r,key:e,sep:t,value:s}){let n="";for(let i of r)n+=i.source;if(e&&(n+=kn(e)),t)for(let i of t)n+=i.source;return s&&(n+=kn(s)),n}Ou.stringify=Vy});var ku=g(Tu=>{"use strict";var Fa=Symbol("break visit"),Fy=Symbol("skip children"),Pu=Symbol("remove item");function jt(r,e){"type"in r&&r.type==="document"&&(r={start:r.start,value:r.value}),$u(Object.freeze([]),r,e)}jt.BREAK=Fa;jt.SKIP=Fy;jt.REMOVE=Pu;jt.itemAtPath=(r,e)=>{let t=r;for(let[s,n]of e){let i=t?.[s];if(i&&"items"in i)t=i.items[n];else return}return t};jt.parentCollection=(r,e)=>{let t=jt.itemAtPath(r,e.slice(0,-1)),s=e[e.length-1][0],n=t?.[s];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function $u(r,e,t){let s=t(e,r);if(typeof s=="symbol")return s;for(let n of["key","value"]){let i=e[n];if(i&&"items"in i){for(let a=0;a{"use strict";var Ka=xu(),Ky=Iu(),Wy=ku(),Wa="\uFEFF",Ja="",Ya="",Ha="",Jy=r=>!!r&&"items"in r,Yy=r=>!!r&&(r.type==="scalar"||r.type==="single-quoted-scalar"||r.type==="double-quoted-scalar"||r.type==="block-scalar");function Hy(r){switch(r){case Wa:return"";case Ja:return"";case Ya:return"";case Ha:return"";default:return JSON.stringify(r)}}function zy(r){switch(r){case Wa:return"byte-order-mark";case Ja:return"doc-mode";case Ya:return"flow-error-end";case Ha:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`:case`\r +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(r[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}pe.createScalarToken=Ka.createScalarToken;pe.resolveAsScalar=Ka.resolveAsScalar;pe.setScalarValue=Ka.setScalarValue;pe.stringify=Ky.stringify;pe.visit=Wy.visit;pe.BOM=Wa;pe.DOCUMENT=Ja;pe.FLOW_END=Ya;pe.SCALAR=Ha;pe.isCollection=Jy;pe.isScalar=Yy;pe.prettyToken=Hy;pe.tokenType=zy});var Xa=g(Nu=>{"use strict";var xs=An();function Se(r){switch(r){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var Au="0123456789ABCDEFabcdef".split(""),Gy="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),za=",[]{}".split(""),Qy=` ,[]{} +\r `.split(""),Ga=r=>!r||Qy.includes(r),Qa=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===` +`?!0:t==="\r"?this.buffer[e+1]===` +`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;t===" ";)t=this.buffer[++s+e];if(t==="\r"){let n=this.buffer[s+e+1];if(n===` +`||!n&&!this.atEnd)return e+s+1}return t===` +`||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if(t==="-"||t==="."){let s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&Se(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Se(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Se(t)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ga),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,s=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((s!==-1&&s"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Se(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,s;e:for(let n=this.pos;s=this.buffer[n];++n)switch(s){case" ":t+=1;break;case` +`:e=n,t=0;break;case"\r":{let i=this.buffer[n+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===` +`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext+=this.blockScalarIndent;do{let n=this.continueScalar(e+1);if(n===-1)break;e=this.buffer.indexOf(` +`,n)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}if(!this.blockScalarKeep)do{let n=e-1,i=this.buffer[n];i==="\r"&&(i=this.buffer[--n]);let a=n;for(;i===" "||i===" ";)i=this.buffer[--n];if(i===` +`&&n>=this.pos&&n+1+t>a)e=n;else break}while(!0);return yield xs.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,s=this.pos-1,n;for(;n=this.buffer[++s];)if(n===":"){let i=this.buffer[s+1];if(Se(i)||e&&i===",")break;t=s}else if(Se(n)){let i=this.buffer[s+1];if(n==="\r"&&(i===` +`?(s+=1,n=` +`,i=this.buffer[s+1]):t=s),i==="#"||e&&za.includes(i))break;if(n===` +`){let a=this.continueScalar(s+1);if(a===-1)break;s=Math.max(s,a-2)}}else{if(e&&za.includes(n))break;t=s}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield xs.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Ga))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Se(t)||e&&za.includes(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Se(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Gy.includes(t))t=this.buffer[++e];else if(t==="%"&&Au.includes(this.buffer[e+1])&&Au.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` +`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s===" ");let n=t-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=t),n}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Nu.Lexer=Qa});var to=g(Eu=>{"use strict";var eo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t>1;this.lineStarts[i]{"use strict";var ju=An(),Xy=Xa();function je(r,e){for(let t=0;t=0;)switch(r[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;r[++e]?.type==="space";);return r.splice(e,r.length)}function qu(r){if(r.start.type==="flow-seq-start")for(let e of r.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ru(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var ro=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Xy.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,process.env.LOG_TOKENS&&console.log("|",ju.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=ju.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(t)if(this.stack.length===0)yield t;else{let s=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in s?s.indent:0:t.type==="flow-collection"&&s.type==="document"&&(t.indent=0),t.type==="flow-collection"&&qu(t),s.type){case"document":s.value=t;break;case"block-scalar":s.props.push(t);break;case"block-map":{let n=s.items[s.items.length-1];if(n.value){s.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!je(n.start,"explicit-key-ind");return}break}case"block-seq":{let n=s.items[s.items.length-1];n.value?s.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=s.items[s.items.length-1];!n||n.value?s.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Cu(n.start)===-1&&(t.indent===0||n.start.every(i=>i.type!=="comment"||i.indent=e.indent){let s=!this.onKeyLine&&this.indent===e.indent&&t.sep,n=[];if(s&&t.sep&&!t.value){let i=[];for(let a=0;ae.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(n=t.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(n.push(this.sourceToken),e.items.push({start:n}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!je(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):s||t.value?(n.push(this.sourceToken),e.items.push({start:n})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(je(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]});else if(Ru(t.key)&&!je(t.sep,"newline")){let i=Pr(t.start),a=t.key,o=t.sep;o.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:o}]})}else n.length>0?t.sep=t.sep.concat(n,this.sourceToken):t.sep.push(this.sourceToken);else if(je(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let i=Pr(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:n,key:null,sep:[this.sourceToken]}):je(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);s||t.value?(e.items.push({start:n,key:i,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(i):(Object.assign(t,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(e);if(i){s&&i.type!=="block-seq"&&je(t.start,"explicit-key-ind")&&e.items.push({start:n}),this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||je(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s&&s.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let n=Nn(s),i=Pr(n);qu(e);let a=e.end.splice(1,e.end.length);a.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(` +`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` +`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Nn(e),s=Pr(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Nn(e),s=Pr(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Mu.Parser=ro});var Bu=g(Is=>{"use strict";var Lu=Ba(),eg=ys(),Os=bs(),tg=Bi(),rg=to(),Du=so();function Zu(r){let e=r.prettyErrors!==!1;return{lineCounter:r.lineCounter||e&&new rg.LineCounter||null,prettyErrors:e}}function sg(r,e={}){let{lineCounter:t,prettyErrors:s}=Zu(e),n=new Du.Parser(t?.addNewLine),i=new Lu.Composer(e),a=Array.from(i.compose(n.parse(r)));if(s&&t)for(let o of a)o.errors.forEach(Os.prettifyError(r,t)),o.warnings.forEach(Os.prettifyError(r,t));return a.length>0?a:Object.assign([],{empty:!0},i.streamInfo())}function Uu(r,e={}){let{lineCounter:t,prettyErrors:s}=Zu(e),n=new Du.Parser(t?.addNewLine),i=new Lu.Composer(e),a=null;for(let o of i.compose(n.parse(r),!0,r.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Os.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(a.errors.forEach(Os.prettifyError(r,t)),a.warnings.forEach(Os.prettifyError(r,t))),a}function ng(r,e,t){let s;typeof e=="function"?s=e:t===void 0&&e&&typeof e=="object"&&(t=e);let n=Uu(r,t);if(!n)return null;if(n.warnings.forEach(i=>tg.warn(n.options.logLevel,i)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:s},t))}function ig(r,e,t){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let n=Math.round(t);t=n<1?void 0:n>8?{indent:8}:{indent:n}}if(r===void 0){let{keepUndefined:n}=t??e??{};if(!n)return}return new eg.Document(r,s,t).toString(t)}Is.parse=ng;Is.parseAllDocuments=sg;Is.parseDocument=Uu;Is.stringify=ig});var Fu=g(W=>{"use strict";var ag=Ba(),og=ys(),cg=Oa(),no=bs(),lg=Gr(),vt=K(),ug=tt(),dg=X(),fg=Nt(),pg=Et(),hg=An(),mg=Xa(),yg=to(),gg=so(),En=Bu(),Vu=Yr();W.Composer=ag.Composer;W.Document=og.Document;W.Schema=cg.Schema;W.YAMLError=no.YAMLError;W.YAMLParseError=no.YAMLParseError;W.YAMLWarning=no.YAMLWarning;W.Alias=lg.Alias;W.isAlias=vt.isAlias;W.isCollection=vt.isCollection;W.isDocument=vt.isDocument;W.isMap=vt.isMap;W.isNode=vt.isNode;W.isPair=vt.isPair;W.isScalar=vt.isScalar;W.isSeq=vt.isSeq;W.Pair=ug.Pair;W.Scalar=dg.Scalar;W.YAMLMap=fg.YAMLMap;W.YAMLSeq=pg.YAMLSeq;W.CST=hg;W.Lexer=mg.Lexer;W.LineCounter=yg.LineCounter;W.Parser=gg.Parser;W.parse=En.parse;W.parseAllDocuments=En.parseAllDocuments;W.parseDocument=En.parseDocument;W.stringify=En.stringify;W.visit=Vu.visit;W.visitAsync=Vu.visitAsync});var Ku,$r,Wu=$t(()=>{Ku=te(Fu()),$r=class{static create(e){return new $r(e)}constructor(e){this.rootDoc=e||{openapi:"3.0.0",info:{title:"app",version:"version"},paths:{},components:{schemas:{},responses:{},parameters:{},examples:{},requestBodies:{},headers:{},securitySchemes:{},links:{},callbacks:{}},tags:[],servers:[]}}getSpec(){return this.rootDoc}getSpecAsJson(e,t){return JSON.stringify(this.rootDoc,e,t)}getSpecAsYaml(){return Ku.stringify(this.rootDoc)}static isValidOpenApiVersion(e){e=e||"";let t=/(\d+)\.(\d+).(\d+)/.exec(e);return!!(t&&parseInt(t[1],10)>=3)}addOpenApiVersion(e){if(!$r.isValidOpenApiVersion(e))throw new Error("Invalid OpenApi version: "+e+". Follow convention: 3.x.y");return this.rootDoc.openapi=e,this}addInfo(e){return this.rootDoc.info=e,this}addContact(e){return this.rootDoc.info.contact=e,this}addLicense(e){return this.rootDoc.info.license=e,this}addTitle(e){return this.rootDoc.info.title=e,this}addDescription(e){return this.rootDoc.info.description=e,this}addTermsOfService(e){return this.rootDoc.info.termsOfService=e,this}addVersion(e){return this.rootDoc.info.version=e,this}addPath(e,t){return this.rootDoc.paths[e]={...this.rootDoc.paths[e]||{},...t},this}addSchema(e,t){return this.rootDoc.components.schemas[e]=t,this}addResponse(e,t){return this.rootDoc.components.responses[e]=t,this}addParameter(e,t){return this.rootDoc.components.parameters[e]=t,this}addExample(e,t){return this.rootDoc.components.examples[e]=t,this}addRequestBody(e,t){return this.rootDoc.components.requestBodies[e]=t,this}addHeader(e,t){return this.rootDoc.components.headers[e]=t,this}addSecurityScheme(e,t){return this.rootDoc.components.securitySchemes[e]=t,this}addLink(e,t){return this.rootDoc.components.links[e]=t,this}addCallback(e,t){return this.rootDoc.components.callbacks[e]=t,this}addServer(e){return this.rootDoc.servers.push(e),this}addTag(e){return this.rootDoc.tags.push(e),this}addExternalDocs(e){return this.rootDoc.externalDocs=e,this}addWebhook(e,t){var s;return(s=this.rootDoc).webhooks??(s.webhooks={}),this.rootDoc.webhooks[e]=t,this}}});var Ju=$t(()=>{Wu()});var Yu={};Jr(Yu,{OpenApiBuilder:()=>$r,Server:()=>$i,ServerVariable:()=>Ti,SpecificationExtension:()=>Ne,addExtension:()=>Gf,getExtension:()=>zf,getPath:()=>Qf,isReferenceObject:()=>Xf,isSchemaObject:()=>ep});var Hu=$t(()=>{nc();Ju()});var Gu=g(se=>{"use strict";var zu=se&&se.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,n)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),vg=se&&se.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bg=se&&se.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&zu(e,r,t)},_g=se&&se.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&zu(e,r,t);return vg(e,r),e};Object.defineProperty(se,"__esModule",{value:!0});se.OpenAPI=se.OpenAPIRegistry=se.OpenAPIGenerator=se.extendZodWithOpenApi=void 0;var wg=Ko();Object.defineProperty(se,"extendZodWithOpenApi",{enumerable:!0,get:function(){return wg.extendZodWithOpenApi}});bg(zo(),se);var Sg=ec();Object.defineProperty(se,"OpenAPIGenerator",{enumerable:!0,get:function(){return Sg.OpenAPIGenerator}});var xg=tc();Object.defineProperty(se,"OpenAPIRegistry",{enumerable:!0,get:function(){return xg.OpenAPIRegistry}});se.OpenAPI=_g((Hu(),Po(Yu)))});var Ps=g(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.getParsedType=z.ZodParsedType=z.util=void 0;var Qu;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(let o of i)a[o]=n[o];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},r.find=(n,i)=>{for(let a of n)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}r.joinValues=s,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(Qu=z.util||(z.util={}));z.ZodParsedType=Qu.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Og=r=>{switch(typeof r){case"undefined":return z.ZodParsedType.undefined;case"string":return z.ZodParsedType.string;case"number":return isNaN(r)?z.ZodParsedType.nan:z.ZodParsedType.number;case"boolean":return z.ZodParsedType.boolean;case"function":return z.ZodParsedType.function;case"bigint":return z.ZodParsedType.bigint;case"symbol":return z.ZodParsedType.symbol;case"object":return Array.isArray(r)?z.ZodParsedType.array:r===null?z.ZodParsedType.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?z.ZodParsedType.promise:typeof Map<"u"&&r instanceof Map?z.ZodParsedType.map:typeof Set<"u"&&r instanceof Set?z.ZodParsedType.set:typeof Date<"u"&&r instanceof Date?z.ZodParsedType.date:z.ZodParsedType.object;default:return z.ZodParsedType.unknown}};z.getParsedType=Og});var jn=g(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.ZodError=bt.quotelessJson=bt.ZodIssueCode=void 0;var Xu=Ps();bt.ZodIssueCode=Xu.util.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"]);var Ig=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");bt.quotelessJson=Ig;var $s=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(i){return i.message},s={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,c=0;for(;ct.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};bt.ZodError=$s;$s.create=r=>new $s(r)});var ao=g(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});var Ct=Ps(),le=jn(),Pg=(r,e)=>{let t;switch(r.code){case le.ZodIssueCode.invalid_type:r.received===Ct.ZodParsedType.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case le.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Ct.util.jsonStringifyReplacer)}`;break;case le.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${Ct.util.joinValues(r.keys,", ")}`;break;case le.ZodIssueCode.invalid_union:t="Invalid input";break;case le.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Ct.util.joinValues(r.options)}`;break;case le.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${Ct.util.joinValues(r.options)}, received '${r.received}'`;break;case le.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case le.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case le.ZodIssueCode.invalid_date:t="Invalid date";break;case le.ZodIssueCode.invalid_string:typeof r.validation=="object"?"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:Ct.util.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case le.ZodIssueCode.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(r.minimum)}`:t="Invalid input";break;case le.ZodIssueCode.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(r.maximum)}`:t="Invalid input";break;case le.ZodIssueCode.custom:t="Invalid input";break;case le.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case le.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case le.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,Ct.util.assertNever(r)}return{message:t}};io.default=Pg});var Cn=g(Fe=>{"use strict";var $g=Fe&&Fe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getErrorMap=Fe.setErrorMap=Fe.defaultErrorMap=void 0;var ed=$g(ao());Fe.defaultErrorMap=ed.default;var td=ed.default;function Tg(r){td=r}Fe.setErrorMap=Tg;function kg(){return td}Fe.getErrorMap=kg});var oo=g(J=>{"use strict";var Ag=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(J,"__esModule",{value:!0});J.isAsync=J.isValid=J.isDirty=J.isAborted=J.OK=J.DIRTY=J.INVALID=J.ParseStatus=J.addIssueToContext=J.EMPTY_PATH=J.makeIssue=void 0;var Ng=Cn(),Eg=Ag(ao()),jg=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,i=[...t,...n.path||[]],a={...n,path:i},o="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:i,message:n.message||o}};J.makeIssue=jg;J.EMPTY_PATH=[];function Cg(r,e){let t=(0,J.makeIssue)({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Ng.getErrorMap)(),Eg.default].filter(s=>!!s)});r.common.issues.push(t)}J.addIssueToContext=Cg;var Ts=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return J.INVALID;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t)s.push({key:await n.key,value:await n.value});return Ts.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return J.INVALID;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||n.alwaysSet)&&(s[i.value]=a.value)}return{status:e.value,value:s}}};J.ParseStatus=Ts;J.INVALID=Object.freeze({status:"aborted"});var qg=r=>({status:"dirty",value:r});J.DIRTY=qg;var Rg=r=>({status:"valid",value:r});J.OK=Rg;var Mg=r=>r.status==="aborted";J.isAborted=Mg;var Lg=r=>r.status==="dirty";J.isDirty=Lg;var Dg=r=>r.status==="valid";J.isValid=Dg;var Zg=r=>typeof Promise!==void 0&&r instanceof Promise;J.isAsync=Zg});var sd=g(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0})});var nd=g(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.errorUtil=void 0;var Ug;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Ug=ks.errorUtil||(ks.errorUtil={}))});var pd=g(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.date=f.boolean=f.bigint=f.array=f.any=f.coerce=f.ZodFirstPartyTypeKind=f.late=f.ZodSchema=f.Schema=f.custom=f.ZodPipeline=f.ZodBranded=f.BRAND=f.ZodNaN=f.ZodCatch=f.ZodDefault=f.ZodNullable=f.ZodOptional=f.ZodTransformer=f.ZodEffects=f.ZodPromise=f.ZodNativeEnum=f.ZodEnum=f.ZodLiteral=f.ZodLazy=f.ZodFunction=f.ZodSet=f.ZodMap=f.ZodRecord=f.ZodTuple=f.ZodIntersection=f.ZodDiscriminatedUnion=f.ZodUnion=f.ZodObject=f.objectUtil=f.ZodArray=f.ZodVoid=f.ZodNever=f.ZodUnknown=f.ZodAny=f.ZodNull=f.ZodUndefined=f.ZodSymbol=f.ZodDate=f.ZodBoolean=f.ZodBigInt=f.ZodNumber=f.ZodString=f.ZodType=void 0;f.NEVER=f.void=f.unknown=f.union=f.undefined=f.tuple=f.transformer=f.symbol=f.string=f.strictObject=f.set=f.record=f.promise=f.preprocess=f.pipeline=f.ostring=f.optional=f.onumber=f.oboolean=f.object=f.number=f.nullable=f.null=f.never=f.nativeEnum=f.nan=f.map=f.literal=f.lazy=f.intersection=f.instanceof=f.function=f.enum=f.effect=f.discriminatedUnion=void 0;var qn=Cn(),U=nd(),m=oo(),w=Ps(),O=jn(),Oe=class{constructor(e,t,s,n){this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._path.concat(this._key)}},id=(r,e)=>{if((0,m.isValid)(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,error:new O.ZodError(r.common.issues)}};function R(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:s??o.defaultError}:{message:t??o.defaultError},description:n}}var C=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return(0,w.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,w.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new m.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,w.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,m.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,w.getParsedType)(e)},i=this._parseSync({data:e,path:n.path,parent:n});return id(n,i)}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,w.getParsedType)(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await((0,m.isAsync)(n)?n:Promise.resolve(n));return id(s,i)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let a=e(n),o=()=>i.addIssue({code:O.ZodIssueCode.custom,...s(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new ge({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return xe.create(this)}nullable(){return ot.create(this)}nullish(){return this.optional().nullable()}array(){return ye.create(this)}promise(){return St.create(this)}or(e){return Dt.create([this,e])}and(e){return Zt.create(this,e)}transform(e){return new ge({schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Wt({innerType:this,defaultValue:t,typeName:N.ZodDefault})}brand(){return new Mn({typeName:N.ZodBranded,type:this,...R(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new jr({innerType:this,defaultValue:t,typeName:N.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Jt.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};f.ZodType=C;f.Schema=C;f.ZodSchema=C;var Bg=/^c[^\s-]{8,}$/i,Vg=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Fg=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Kg=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),Ce=class extends C{constructor(){super(...arguments),this._regex=(e,t,s)=>this.refinement(n=>e.test(n),{validation:t,code:O.ZodIssueCode.invalid_string,...U.errorUtil.errToObj(s)}),this.nonempty=e=>this.min(1,U.errorUtil.errToObj(e)),this.trim=()=>new Ce({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.string,received:i.parsedType}),m.INVALID}let s=new m.ParseStatus,n;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(n=this._getOrReturnCtx(e,n),(0,m.addIssueToContext)(n,{code:O.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,o=e.data.length"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...U.errorUtil.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...U.errorUtil.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...U.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...U.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...U.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...U.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...U.errorUtil.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new Ce({checks:[],typeName:N.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...R(r)})};function Wg(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,i=parseInt(r.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return i%a/Math.pow(10,n)}var Ke=class extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.number,received:i.parsedType}),m.INVALID}let s,n=new m.ParseStatus;for(let i of this._def.checks)i.kind==="int"?w.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Wg(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.not_finite,message:i.message}),n.dirty()):w.util.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,U.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.errorUtil.toString(t))}setLimit(e,t,s,n){return new Ke({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.errorUtil.toString(n)}]})}_addCheck(e){return new Ke({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:U.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int")}};f.ZodNumber=Ke;Ke.create=r=>new Ke({checks:[],typeName:N.ZodNumber,coerce:r?.coerce||!1,...R(r)});var qt=class extends C{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==w.ZodParsedType.bigint){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.bigint,received:s.parsedType}),m.INVALID}return(0,m.OK)(e.data)}};f.ZodBigInt=qt;qt.create=r=>{var e;return new qt({typeName:N.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...R(r)})};var Rt=class extends C{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==w.ZodParsedType.boolean){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.boolean,received:s.parsedType}),m.INVALID}return(0,m.OK)(e.data)}};f.ZodBoolean=Rt;Rt.create=r=>new Rt({typeName:N.ZodBoolean,coerce:r?.coerce||!1,...R(r)});var it=class extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.date,received:i.parsedType}),m.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(i,{code:O.ZodIssueCode.invalid_date}),m.INVALID}let s=new m.ParseStatus,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(n=this._getOrReturnCtx(e,n),(0,m.addIssueToContext)(n,{code:O.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):w.util.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new it({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:U.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:U.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew it({checks:[],coerce:r?.coerce||!1,typeName:N.ZodDate,...R(r)});var kr=class extends C{_parse(e){if(this._getType(e)!==w.ZodParsedType.symbol){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.symbol,received:s.parsedType}),m.INVALID}return(0,m.OK)(e.data)}};f.ZodSymbol=kr;kr.create=r=>new kr({typeName:N.ZodSymbol,...R(r)});var Mt=class extends C{_parse(e){if(this._getType(e)!==w.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.undefined,received:s.parsedType}),m.INVALID}return(0,m.OK)(e.data)}};f.ZodUndefined=Mt;Mt.create=r=>new Mt({typeName:N.ZodUndefined,...R(r)});var Lt=class extends C{_parse(e){if(this._getType(e)!==w.ZodParsedType.null){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.null,received:s.parsedType}),m.INVALID}return(0,m.OK)(e.data)}};f.ZodNull=Lt;Lt.create=r=>new Lt({typeName:N.ZodNull,...R(r)});var wt=class extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,m.OK)(e.data)}};f.ZodAny=wt;wt.create=r=>new wt({typeName:N.ZodAny,...R(r)});var nt=class extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,m.OK)(e.data)}};f.ZodUnknown=nt;nt.create=r=>new nt({typeName:N.ZodUnknown,...R(r)});var qe=class extends C{_parse(e){let t=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.never,received:t.parsedType}),m.INVALID}};f.ZodNever=qe;qe.create=r=>new qe({typeName:N.ZodNever,...R(r)});var Ar=class extends C{_parse(e){if(this._getType(e)!==w.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.void,received:s.parsedType}),m.INVALID}return(0,m.OK)(e.data)}};f.ZodVoid=Ar;Ar.create=r=>new Ar({typeName:N.ZodVoid,...R(r)});var ye=class extends C{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==w.ZodParsedType.array)return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.array,received:t.parsedType}),m.INVALID;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,o=t.data.lengthn.maxLength.value&&((0,m.addIssueToContext)(t,{code:O.ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all(t.data.map((a,o)=>n.type._parseAsync(new Oe(t,a,t.path,o)))).then(a=>m.ParseStatus.mergeArray(s,a));let i=t.data.map((a,o)=>n.type._parseSync(new Oe(t,a,t.path,o)));return m.ParseStatus.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new ye({...this._def,minLength:{value:e,message:U.errorUtil.toString(t)}})}max(e,t){return new ye({...this._def,maxLength:{value:e,message:U.errorUtil.toString(t)}})}length(e,t){return new ye({...this._def,exactLength:{value:e,message:U.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};f.ZodArray=ye;ye.create=(r,e)=>new ye({type:r,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...R(e)});var od;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(od=f.objectUtil||(f.objectUtil={}));var ad=r=>e=>new Y({...r,shape:()=>({...r.shape(),...e})});function Tr(r){if(r instanceof Y){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=xe.create(Tr(s))}return new Y({...r._def,shape:()=>e})}else return r instanceof ye?ye.create(Tr(r.element)):r instanceof xe?xe.create(Tr(r.unwrap())):r instanceof ot?ot.create(Tr(r.unwrap())):r instanceof Ie?Ie.create(r.items.map(e=>Tr(e))):r}var Y=class extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=ad(this._def),this.extend=ad(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=w.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==w.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(l,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.object,received:l.parsedType}),m.INVALID}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof qe&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||o.push(l);let c=[];for(let l of a){let u=i[l],d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Oe(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof qe){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")o.length>0&&((0,m.addIssueToContext)(n,{code:O.ZodIssueCode.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of o){let d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Oe(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key;l.push({key:d,value:await u.value,alwaysSet:u.alwaysSet})}return l}).then(l=>m.ParseStatus.mergeObjectSync(s,l)):m.ParseStatus.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return U.errorUtil.errToObj,new Y({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,i,a,o;let c=(a=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,t,s).message)!==null&&a!==void 0?a:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=U.errorUtil.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Y({...this._def,unknownKeys:"strip"})}passthrough(){return new Y({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Y({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>od.mergeShapes(this._def.shape(),e._def.shape()),typeName:N.ZodObject})}catchall(e){return new Y({...this._def,catchall:e})}pick(e){let t={};return w.util.objectKeys(e).map(s=>{this.shape[s]&&(t[s]=this.shape[s])}),new Y({...this._def,shape:()=>t})}omit(e){let t={};return w.util.objectKeys(this.shape).map(s=>{w.util.objectKeys(e).indexOf(s)===-1&&(t[s]=this.shape[s])}),new Y({...this._def,shape:()=>t})}deepPartial(){return Tr(this)}partial(e){let t={};if(e)return w.util.objectKeys(this.shape).map(s=>{w.util.objectKeys(e).indexOf(s)===-1?t[s]=this.shape[s]:t[s]=this.shape[s].optional()}),new Y({...this._def,shape:()=>t});for(let s in this.shape){let n=this.shape[s];t[s]=n.optional()}return new Y({...this._def,shape:()=>t})}required(e){let t={};if(e)w.util.objectKeys(this.shape).map(s=>{if(w.util.objectKeys(e).indexOf(s)===-1)t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof xe;)i=i._def.innerType;t[s]=i}});else for(let s in this.shape){let i=this.shape[s];for(;i instanceof xe;)i=i._def.innerType;t[s]=i}return new Y({...this._def,shape:()=>t})}keyof(){return cd(w.util.objectKeys(this.shape))}};f.ZodObject=Y;Y.create=(r,e)=>new Y({shape:()=>r,unknownKeys:"strip",catchall:qe.create(),typeName:N.ZodObject,...R(e)});Y.strictCreate=(r,e)=>new Y({shape:()=>r,unknownKeys:"strict",catchall:qe.create(),typeName:N.ZodObject,...R(e)});Y.lazycreate=(r,e)=>new Y({shape:r,unknownKeys:"strip",catchall:qe.create(),typeName:N.ZodObject,...R(e)});var Dt=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new O.ZodError(o.ctx.common.issues));return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_union,unionErrors:a}),m.INVALID}if(t.common.async)return Promise.all(s.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(c=>new O.ZodError(c));return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_union,unionErrors:o}),m.INVALID}}get options(){return this._def.options}};f.ZodUnion=Dt;Dt.create=(r,e)=>new Dt({options:r,typeName:N.ZodUnion,...R(e)});var Rn=r=>r instanceof Bt?Rn(r.schema):r instanceof ge?Rn(r.innerType()):r instanceof Vt?[r.value]:r instanceof Ft?r.options:r instanceof Kt?Object.keys(r.enum):r instanceof Wt?Rn(r._def.innerType):r instanceof Mt?[void 0]:r instanceof Lt?[null]:null,Nr=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.ZodParsedType.object)return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.object,received:t.parsedType}),m.INVALID;let s=this.discriminator,n=t.data[s],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):((0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let i of t){let a=Rn(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new Nr({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...R(s)})}};f.ZodDiscriminatedUnion=Nr;function co(r,e){let t=(0,w.getParsedType)(r),s=(0,w.getParsedType)(e);if(r===e)return{valid:!0,data:r};if(t===w.ZodParsedType.object&&s===w.ZodParsedType.object){let n=w.util.objectKeys(e),i=w.util.objectKeys(r).filter(o=>n.indexOf(o)!==-1),a={...r,...e};for(let o of i){let c=co(r[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===w.ZodParsedType.array&&s===w.ZodParsedType.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i{if((0,m.isAborted)(i)||(0,m.isAborted)(a))return m.INVALID;let o=co(i.value,a.value);return o.valid?(((0,m.isDirty)(i)||(0,m.isDirty)(a))&&t.dirty(),{status:t.value,value:o.data}):((0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};f.ZodIntersection=Zt;Zt.create=(r,e,t)=>new Zt({left:r,right:e,typeName:N.ZodIntersection,...R(t)});var Ie=class extends C{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.ZodParsedType.array)return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.array,received:s.parsedType}),m.INVALID;if(s.data.lengththis._def.items.length&&((0,m.addIssueToContext)(s,{code:O.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=s.data.map((a,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Oe(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(i).then(a=>m.ParseStatus.mergeArray(t,a)):m.ParseStatus.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Ie({...this._def,rest:e})}};f.ZodTuple=Ie;Ie.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ie({items:r,typeName:N.ZodTuple,rest:null,...R(e)})};var Ut=class extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.ZodParsedType.object)return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.object,received:s.parsedType}),m.INVALID;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in s.data)n.push({key:i._parse(new Oe(s,o,s.path,o)),value:a._parse(new Oe(s,s.data[o],s.path,o))});return s.common.async?m.ParseStatus.mergeObjectAsync(t,n):m.ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof C?new Ut({keyType:e,valueType:t,typeName:N.ZodRecord,...R(s)}):new Ut({keyType:Ce.create(),valueType:e,typeName:N.ZodRecord,...R(t)})}};f.ZodRecord=Ut;var Er=class extends C{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.ZodParsedType.map)return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.map,received:s.parsedType}),m.INVALID;let n=this._def.keyType,i=this._def.valueType,a=[...s.data.entries()].map(([o,c],l)=>({key:n._parse(new Oe(s,o,s.path,[l,"key"])),value:i._parse(new Oe(s,c,s.path,[l,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return m.INVALID;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of a){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return m.INVALID;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}};f.ZodMap=Er;Er.create=(r,e,t)=>new Er({valueType:e,keyType:r,typeName:N.ZodMap,...R(t)});var at=class extends C{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.ZodParsedType.set)return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.set,received:s.parsedType}),m.INVALID;let n=this._def;n.minSize!==null&&s.data.sizen.maxSize.value&&((0,m.addIssueToContext)(s,{code:O.ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let u of c){if(u.status==="aborted")return m.INVALID;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}let o=[...s.data.values()].map((c,l)=>i._parse(new Oe(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new at({...this._def,minSize:{value:e,message:U.errorUtil.toString(t)}})}max(e,t){return new at({...this._def,maxSize:{value:e,message:U.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};f.ZodSet=at;at.create=(r,e)=>new at({valueType:r,minSize:null,maxSize:null,typeName:N.ZodSet,...R(e)});var _t=class extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.ZodParsedType.function)return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.function,received:t.parsedType}),m.INVALID;function s(o,c){return(0,m.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,qn.getErrorMap)(),qn.defaultErrorMap].filter(l=>!!l),issueData:{code:O.ZodIssueCode.invalid_arguments,argumentsError:c}})}function n(o,c){return(0,m.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,qn.getErrorMap)(),qn.defaultErrorMap].filter(l=>!!l),issueData:{code:O.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;return this._def.returns instanceof St?(0,m.OK)(async(...o)=>{let c=new O.ZodError([]),l=await this._def.args.parseAsync(o,i).catch(p=>{throw c.addIssue(s(o,p)),c}),u=await a(...l);return await this._def.returns._def.type.parseAsync(u,i).catch(p=>{throw c.addIssue(n(u,p)),c})}):(0,m.OK)((...o)=>{let c=this._def.args.safeParse(o,i);if(!c.success)throw new O.ZodError([s(o,c.error)]);let l=a(...c.data),u=this._def.returns.safeParse(l,i);if(!u.success)throw new O.ZodError([n(l,u.error)]);return u.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new _t({...this._def,args:Ie.create(e).rest(nt.create())})}returns(e){return new _t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new _t({args:e||Ie.create([]).rest(nt.create()),returns:t||nt.create(),typeName:N.ZodFunction,...R(s)})}};f.ZodFunction=_t;var Bt=class extends C{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};f.ZodLazy=Bt;Bt.create=(r,e)=>new Bt({getter:r,typeName:N.ZodLazy,...R(e)});var Vt=class extends C{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_literal,expected:this._def.value}),m.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};f.ZodLiteral=Vt;Vt.create=(r,e)=>new Vt({value:r,typeName:N.ZodLiteral,...R(e)});function cd(r,e){return new Ft({values:r,typeName:N.ZodEnum,...R(e)})}var Ft=class extends C{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return(0,m.addIssueToContext)(t,{expected:w.util.joinValues(s),received:t.parsedType,code:O.ZodIssueCode.invalid_type}),m.INVALID}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),s=this._def.values;return(0,m.addIssueToContext)(t,{received:t.data,code:O.ZodIssueCode.invalid_enum_value,options:s}),m.INVALID}return(0,m.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};f.ZodEnum=Ft;Ft.create=cd;var Kt=class extends C{_parse(e){let t=w.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==w.ZodParsedType.string&&s.parsedType!==w.ZodParsedType.number){let n=w.util.objectValues(t);return(0,m.addIssueToContext)(s,{expected:w.util.joinValues(n),received:s.parsedType,code:O.ZodIssueCode.invalid_type}),m.INVALID}if(t.indexOf(e.data)===-1){let n=w.util.objectValues(t);return(0,m.addIssueToContext)(s,{received:s.data,code:O.ZodIssueCode.invalid_enum_value,options:n}),m.INVALID}return(0,m.OK)(e.data)}get enum(){return this._def.values}};f.ZodNativeEnum=Kt;Kt.create=(r,e)=>new Kt({values:r,typeName:N.ZodNativeEnum,...R(e)});var St=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.ZodParsedType.promise&&t.common.async===!1)return(0,m.addIssueToContext)(t,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.promise,received:t.parsedType}),m.INVALID;let s=t.parsedType===w.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,m.OK)(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};f.ZodPromise=St;St.create=(r,e)=>new St({type:r,typeName:N.ZodPromise,...R(e)});var ge=class extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let a=n.transform(s.data);return s.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:s.path,parent:s})):this._def.schema._parseSync({data:a,path:s.path,parent:s})}let i={addIssue:a=>{(0,m.addIssueToContext)(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="refinement"){let a=o=>{let c=n.refinement(o,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m.INVALID:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m.INVALID:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,m.isValid)(a))return a;let o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>(0,m.isValid)(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:t.value,value:o})):a);w.util.assertNever(n)}};f.ZodEffects=ge;f.ZodTransformer=ge;ge.create=(r,e,t)=>new ge({schema:r,typeName:N.ZodEffects,effect:e,...R(t)});ge.createWithPreprocess=(r,e,t)=>new ge({schema:e,effect:{type:"preprocess",transform:r},typeName:N.ZodEffects,...R(t)});var xe=class extends C{_parse(e){return this._getType(e)===w.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};f.ZodOptional=xe;xe.create=(r,e)=>new xe({innerType:r,typeName:N.ZodOptional,...R(e)});var ot=class extends C{_parse(e){return this._getType(e)===w.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};f.ZodNullable=ot;ot.create=(r,e)=>new ot({innerType:r,typeName:N.ZodNullable,...R(e)});var Wt=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===w.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};f.ZodDefault=Wt;Wt.create=(r,e)=>new Wt({innerType:r,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...R(e)});var jr=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return(0,m.isAsync)(s)?s.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()})):{status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};f.ZodCatch=jr;jr.create=(r,e)=>new jr({innerType:r,typeName:N.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...R(e)});var Cr=class extends C{_parse(e){if(this._getType(e)!==w.ZodParsedType.nan){let s=this._getOrReturnCtx(e);return(0,m.addIssueToContext)(s,{code:O.ZodIssueCode.invalid_type,expected:w.ZodParsedType.nan,received:s.parsedType}),m.INVALID}return{status:"valid",value:e.data}}};f.ZodNaN=Cr;Cr.create=r=>new Cr({typeName:N.ZodNaN,...R(r)});f.BRAND=Symbol("zod_brand");var Mn=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};f.ZodBranded=Mn;var Jt=class extends C{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m.INVALID:i.status==="dirty"?(t.dirty(),(0,m.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m.INVALID:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Jt({in:e,out:t,typeName:N.ZodPipeline})}};f.ZodPipeline=Jt;var Jg=(r,e={},t)=>r?wt.create().superRefine((s,n)=>{if(!r(s)){let i=typeof e=="function"?e(s):e,a=typeof i=="string"?{message:i}:i;n.addIssue({code:"custom",...a,fatal:t})}}):wt.create();f.custom=Jg;f.late={object:Y.lazycreate};var N;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline"})(N=f.ZodFirstPartyTypeKind||(f.ZodFirstPartyTypeKind={}));var Yg=(r,e={message:`Input not instance of ${r.name}`})=>(0,f.custom)(t=>t instanceof r,e,!0);f.instanceof=Yg;var ld=Ce.create;f.string=ld;var ud=Ke.create;f.number=ud;var Hg=Cr.create;f.nan=Hg;var zg=qt.create;f.bigint=zg;var dd=Rt.create;f.boolean=dd;var Gg=it.create;f.date=Gg;var Qg=kr.create;f.symbol=Qg;var Xg=Mt.create;f.undefined=Xg;var ev=Lt.create;f.null=ev;var tv=wt.create;f.any=tv;var rv=nt.create;f.unknown=rv;var sv=qe.create;f.never=sv;var nv=Ar.create;f.void=nv;var iv=ye.create;f.array=iv;var av=Y.create;f.object=av;var ov=Y.strictCreate;f.strictObject=ov;var cv=Dt.create;f.union=cv;var lv=Nr.create;f.discriminatedUnion=lv;var uv=Zt.create;f.intersection=uv;var dv=Ie.create;f.tuple=dv;var fv=Ut.create;f.record=fv;var pv=Er.create;f.map=pv;var hv=at.create;f.set=hv;var mv=_t.create;f.function=mv;var yv=Bt.create;f.lazy=yv;var gv=Vt.create;f.literal=gv;var vv=Ft.create;f.enum=vv;var bv=Kt.create;f.nativeEnum=bv;var _v=St.create;f.promise=_v;var fd=ge.create;f.effect=fd;f.transformer=fd;var wv=xe.create;f.optional=wv;var Sv=ot.create;f.nullable=Sv;var xv=ge.createWithPreprocess;f.preprocess=xv;var Ov=Jt.create;f.pipeline=Ov;var Iv=()=>ld().optional();f.ostring=Iv;var Pv=()=>ud().optional();f.onumber=Pv;var $v=()=>dd().optional();f.oboolean=$v;f.coerce={string:r=>Ce.create({...r,coerce:!0}),number:r=>Ke.create({...r,coerce:!0}),boolean:r=>Rt.create({...r,coerce:!0}),bigint:r=>qt.create({...r,coerce:!0}),date:r=>it.create({...r,coerce:!0})};f.NEVER=m.INVALID});var lo=g(Pe=>{"use strict";var Tv=Pe&&Pe.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),qr=Pe&&Pe.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tv(e,r,t)};Object.defineProperty(Pe,"__esModule",{value:!0});qr(Cn(),Pe);qr(oo(),Pe);qr(sd(),Pe);qr(Ps(),Pe);qr(pd(),Pe);qr(jn(),Pe)});var yd=g(he=>{"use strict";var hd=he&&he.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),kv=he&&he.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Av=he&&he.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&hd(e,r,t);return kv(e,r),e},Nv=he&&he.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hd(e,r,t)};Object.defineProperty(he,"__esModule",{value:!0});he.z=void 0;var md=Av(lo());he.z=md;Nv(lo(),he);he.default=md});var Rr=g(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.z=void 0;var Ev=Gu(),gd=yd();Object.defineProperty(Ln,"z",{enumerable:!0,get:function(){return gd.z}});(0,Ev.extendZodWithOpenApi)(gd.z)});var Lr=g(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.getIgnore=ee.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME=ee.OBJECT_WITH_NO_PROPERTIES_RULE_NAME=ee.KONFIG_OAS2_SCHEMA_NAME=ee.NO_ADDITIONAL_PROPERTIES_RULE_NAME=ee.IGNORE_NAME=void 0;var Mr=Rr();ee.IGNORE_NAME="x-konfig-ignore";ee.NO_ADDITIONAL_PROPERTIES_RULE_NAME="no-additional-properties";ee.KONFIG_OAS2_SCHEMA_NAME="konfig-oas2-schema";ee.OBJECT_WITH_NO_PROPERTIES_RULE_NAME="object-with-no-properties";ee.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME="potential-incorrect-type";var jv=Mr.z.object({[ee.NO_ADDITIONAL_PROPERTIES_RULE_NAME]:Mr.z.boolean().optional(),[ee.KONFIG_OAS2_SCHEMA_NAME]:Mr.z.object({paths:Mr.z.string().array()}).optional(),[ee.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME]:Mr.z.boolean().optional(),[ee.OBJECT_WITH_NO_PROPERTIES_RULE_NAME]:Mr.z.boolean().optional()}),Cv=({spec:r})=>{let e=r.info;if(ee.IGNORE_NAME in e){let t=e[ee.IGNORE_NAME],s=jv.safeParse(t);return s.success===!0?s.data:{}}return{}};ee.getIgnore=Cv});var vd=g(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.isSchemaExamplePossibleIncorrectDataType=void 0;function qv({schema:r}){if(typeof r!="object"||r===null||!("type"in r)||!("example"in r))return[];let e=r.type;if(typeof e!="string")return[];let t=r.example;return Rv(e,t)}Dn.isSchemaExamplePossibleIncorrectDataType=qv;var Rv=(r,e)=>r==="string"&&typeof e=="string"?Mv(e):[];function Mv(r){return Dv(r)?[{message:"Could be integer type based on example"}]:Zv(r)?[{message:"Could be number type based on example"}]:Lv(r)?[{message:"Could be boolean type based on example"}]:[]}function Lv(r){return r==="true"||r==="false"}function Dv(r){return/^[-+]?\d+$/.test(r)}function Zv(r){var e=/^-?\d+(?:[.,]\d*?)?$/;if(!e.test(r))return!1;let t=parseFloat(r);return!isNaN(t)}});var Bn=g(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.getSecurityParameterName=void 0;var Uv=({security:r})=>{if(r.type==="oauth2"||r.type==="basic"||r.type==="http")return"Authorization";if(r.type==="apiKey")return r.name;throw Error("Not Implemented")};Un.getSecurityParameterName=Uv});var wd=g(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.hasAny=void 0;var Bv=({a:r,b:e,comparator:t})=>r.filter(s=>e.filter(n=>t(s,n)).length>0).length>0;Vn.hasAny=Bv});var uo=g(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.resolveRefStoplight=void 0;var Vv=require("@stoplight/json-ref-resolver"),Fv=new Vv.Resolver,Kv=async({refOrObject:r,source:e})=>"$ref"in r?(await Fv.resolve(e,{jsonPointer:r.$ref})).result:r;Fn.resolveRefStoplight=Kv});var fo=g(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.getOperationParametersDeprecatedStoplight=void 0;var Wv=uo(),Jv=async({operation:r,document:e})=>{let t=r.parameters?.map(async s=>await(0,Wv.resolveRefStoplight)({refOrObject:s,source:e}));if(t!==void 0)return await Promise.all(t)};Kn.getOperationParametersDeprecatedStoplight=Jv});var po=g(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.getSecuritySchemesStoplight=void 0;var Yv=uo(),Hv=async({document:r})=>{if("securityDefinitions"in r)return r.securityDefinitions;if("components"in r){let e=r.components?.securitySchemes;if(e===void 0)return;let t=await Promise.all(Object.entries(e).map(async([s,n])=>[s,await(0,Yv.resolveRefStoplight)({refOrObject:n,source:r})]));return Object.fromEntries(t)}};Wn.getSecuritySchemesStoplight=Hv});var Sd=g(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.findRedundantSecurityRequirementAndParameterStoplight=void 0;var zv=Bn(),Gv=wd(),Qv=fo(),Xv=po();async function eb({document:r,operation:e}){let t=r.security??e.security;if(t===void 0)return{found:!1};let s=await(0,Xv.getSecuritySchemesStoplight)({document:r});if(s===void 0)return{found:!1};let n=await(0,Qv.getOperationParametersDeprecatedStoplight)({operation:e,document:r});if(n===void 0)return{found:!1};let i=t.flatMap(l=>Object.keys(l).map(u=>{let d=s[u];if(d===void 0)throw Error(`Found security requirement ${u} referring to non-existent security scheme`);return d})),a,o;if((0,Gv.hasAny)({a:n,b:i,comparator:(l,u)=>{let d=l.name===(0,zv.getSecurityParameterName)({security:u});return d?(a=l.name,o=l,d):!1}})){if(a===void 0)throw Error("Name should have been assigned when redundancy was detected.");if(o===void 0)throw Error("Parameter should have been assigned when redundancy was detected.");return{found:!0,name:a,parameter:o,parameters:n}}return{found:!1}}Jn.findRedundantSecurityRequirementAndParameterStoplight=eb});var Zd=g(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.urlRegex=void 0;ri.urlRegex=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/});var Ud=g(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getSecurityIn=or.securitySchemeInSchema=void 0;var k_=Rr();or.securitySchemeInSchema=k_.z.enum(["query","header","cookie"]);function A_({security:r}){return r.type==="basic"||r.type==="http"||r.type==="openIdConnect"||r.type==="oauth2"?"header":or.securitySchemeInSchema.parse(r.in)}or.getSecurityIn=A_});var Bd=g(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.findSecuritySchemesForParametersStoplight=void 0;var N_=Ud(),E_=Bn(),j_=fo(),C_=po();async function q_({document:r,operation:e,caseInsensitive:t}){t=t??!0;let s=await(0,C_.getSecuritySchemesStoplight)({document:r});if(s===void 0)return;let n=await(0,j_.getOperationParametersDeprecatedStoplight)({operation:e,document:r});if(n===void 0)return;let i=Object.entries(s).filter(([a,o])=>{let c=(0,E_.getSecurityParameterName)({security:o}),l=(0,N_.getSecurityIn)({security:o}),u=n.filter(d=>d.in===l);return t?!!u.find(d=>d.name.toLowerCase()===c.toLowerCase()):!!u.find(d=>d.name===c)});if(i.length!==0)return i.map(([a,o])=>({name:a,scheme:o}))}si.findSecuritySchemesForParametersStoplight=q_});var Kd=g(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.operationIdSchema=cr.operationIdRegex=void 0;var R_=Rr();cr.operationIdRegex=/^[a-zA-Z0-9]+_(?![0-9]+$)[a-zA-Z0-9]+$/g;cr.operationIdSchema=R_.z.string().regex(cr.operationIdRegex,'OperationID should be prefixed with Tag + "_" (https://konfigthis.com/docs/tutorials/naming-operation-ids)').brand()});var Wd=g(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.disallowedHeaderNamesRequest=ze.isParameterDisallowed=ze.disallowedHeadersRegex=void 0;ze.disallowedHeadersRegex=/^(Content-Type|Accept)$/;async function M_({parameter:r}){let e=await(0,ze.disallowedHeaderNamesRequest)(r,null,{});return Array.isArray(e)?e.length>0:!1}ze.isParameterDisallowed=M_;var L_=r=>r.in!=="header"?[]:ze.disallowedHeadersRegex.test(r.name)?[{message:"Error"}]:[];ze.disallowedHeaderNamesRequest=L_});var Jd=g(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.tagSchema=void 0;var D_=Rr();ni.tagSchema=D_.z.string().refine(r=>!r.includes(">"),'Detected use of ">" character in tag. This could be from exporting your collection from Postman. Tags should try to follow a flat organizational structure for discoverable SDK methods.').refine(r=>r!=="default",'"default" is too generic for a tag name. Tags should be entities like "Pet" or concepts like "Authentication"').brand("Tag")});var zd=g(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.isJsonString=void 0;function Z_(r){try{JSON.parse(r)}catch{return!1}return!0}ii.isJsonString=Z_});var Gd=g(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.jsonSchema=Ae.objectSchema=Ae.literalSchema=void 0;var Ge=Rr();Ae.literalSchema=Ge.z.union([Ge.z.string(),Ge.z.number(),Ge.z.boolean(),Ge.z.null()]);Ae.objectSchema=Ge.z.lazy(()=>Ge.z.record(Ae.jsonSchema));Ae.jsonSchema=Ge.z.lazy(()=>Ge.z.union([Ae.literalSchema,Ge.z.array(Ae.jsonSchema),Ae.objectSchema])).openapi({oneOf:[{type:"string"},{type:"boolean"},{type:"number"},{type:"object"}],nullable:!0})});var Qd=g(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.canSchemaObjectBeStructured=void 0;var U_=zd(),B_=Gd();function V_({schemaObject:r}){return!(r.type!=="string"||r.example===void 0||!(0,U_.isJsonString)(r.example)||!B_.objectSchema.safeParse(JSON.parse(r.example)).success)}ai.canSchemaObjectBeStructured=V_});var rf=g(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.unaliasJsonPath=Qe.givenPaths=Qe.rulesetJsonPaths=void 0;var F_=Lr();Qe.rulesetJsonPaths={PathItem:["$.paths[*]"],Tags:["$.tags"],Tag:["#Tags.*"],OperationObject:["#PathItem[get,put,post,delete,options,head,patch,trace]"],ParameterObjects:["#OperationObject.parameters.*"],ParameterObjectNames:["#ParameterObjects.name"],ParameterSchemaObject:["#ParameterObjects..schema"],RequestContentObject:["#OperationObject.requestBody.content"],RequestSchemaObject:["#RequestContentObject..schema"],ResponsesObjects:["#OperationObject.responses"],ResponsesObjectHeaderNames:["#ResponsesObjects.*.headers.*~"],ResponsesObjectsKeys:["#ResponsesObjects.*~"],ResponseContentObject:["#ResponsesObjects.*.content.*"],ResponseSchemaObject:["#ResponseContentObject..schema"],AllSchemaObjects:["#RequestSchemaObject","#ResponseSchemaObject","#ParameterSchemaObject"]};Qe.givenPaths={[F_.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME]:["#ResponseSchemaObject..","#RequestSchemaObject..","#ParameterSchemaObject.."]};function tf({path:r}){let e=Object.keys(Qe.rulesetJsonPaths).find(t=>r.includes(t));return e===void 0?[r]:Qe.rulesetJsonPaths[e].flatMap(t=>tf({path:r.replace(`#${e}`,t)}))}Qe.unaliasJsonPath=tf});var sf=g(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.isObjectTypeSchemaWithNoProperties=void 0;function K_({schema:r}){return r.type==="object"&&r.additionalProperties===void 0&&(r.properties===void 0||Object.keys(r.properties).length===0)}oi.isObjectTypeSchemaWithNoProperties=K_});var of=g(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.defaultOr200RangeStatusCodeRegex=void 0;li.defaultOr200RangeStatusCodeRegex=/^(2\d\d|default)$/});var cf=g(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.isMissing2xxResponse=void 0;var W_=of();function J_({responseCodes:r}){return r.find(e=>W_.defaultOr200RangeStatusCodeRegex.test(e))===void 0}ui.isMissing2xxResponse=J_});var yf=g((WS,xo)=>{"use strict";var Y_=r=>{let e=!1,t=!1,s=!1;for(let n=0;n{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let t=n=>e.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(r)?r=r.map(n=>n.trim()).filter(n=>n.length).join("-"):r=r.trim(),r.length===0?"":r.length===1?e.pascalCase?r.toUpperCase():r.toLowerCase():(r!==r.toLowerCase()&&(r=Y_(r)),r=r.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,i)=>i.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),t(r))};xo.exports=mf;xo.exports.default=mf});var gf=g(Ns=>{"use strict";var H_=Ns&&Ns.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ns,"__esModule",{value:!0});var z_=H_(yf());Ns.default=z_.default});var X_={};Jr(X_,{default:()=>Q_});module.exports=Po(X_);var ne=require("@stoplight/spectral-functions"),G=require("@stoplight/spectral-formats"),xf=require("@stoplight/spectral-rulesets");var $o;(function(r){r.Simple="simple",r.Matrix="matrix",r.Label="label",r.Form="form",r.CommaDelimited="commaDelimited",r.SpaceDelimited="spaceDelimited",r.PipeDelimited="pipeDelimited",r.DeepObject="deepObject"})($o||($o={}));var D;(function(r){r[r.Error=0]="Error",r[r.Warning=1]="Warning",r[r.Information=2]="Information",r[r.Hint=3]="Hint"})(D||(D={}));var To;(function(r){r.Article="article",r.HttpService="http_service",r.HttpServer="http_server",r.HttpOperation="http_operation",r.Model="model",r.Generic="generic",r.Unknown="unknown",r.TableOfContents="table_of_contents",r.SpectralRuleset="spectral_ruleset",r.Styleguide="styleguide",r.Image="image"})(To||(To={}));var ko;(function(r){r.Json="json",r.Markdown="markdown",r.Yaml="yaml",r.Javascript="javascript",r.Apng="apng",r.Avif="avif",r.Bmp="bmp",r.Gif="gif",r.Jpeg="jpeg",r.Png="png",r.Svg="svg",r.Webp="webp"})(ko||(ko={}));var Ao=r=>r.length<=1?[]:[{message:"Potential misuse of security has been detected"}];var Bo=te(Uo()),Vo=(r,e,t)=>{let s=[],n=t.document.data;return(0,Bo.findRedundantSecuritySchemes)({operation:r,document:n}).length>0&&s.push({message:"Detected redundant security schemes."}),s};var Zn=te(Lr()),bd=te(vd()),_d=(r,e,t)=>(0,Zn.getIgnore)({spec:t.document.data})[Zn.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME]?[]:(0,bd.isSchemaExamplePossibleIncorrectDataType)({schema:r});var xd=te(Sd()),Od=async(r,e,t)=>{let s=[],n=t.document.data,i=await(0,xd.findRedundantSecurityRequirementAndParameterStoplight)({document:n,operation:r});return i.found&&s.push({message:i.name}),s};var Md=te(Lr()),Ld=require("@stoplight/spectral-functions"),ti=require("@stoplight/spectral-formats");var ho={};Jr(ho,{$id:()=>rb,$schema:()=>sb,additionalProperties:()=>ab,default:()=>ub,definitions:()=>lb,patternProperties:()=>ob,properties:()=>cb,required:()=>ib,title:()=>tb,type:()=>nb});var tb="A JSON Schema for Swagger 2.0 API.",rb="http://swagger.io/v2/schema.json#",sb="http://json-schema.org/draft-07/schema#",nb="object",ib=["swagger","info","paths"],ab=!1,ob={"^x-":{$ref:"#/definitions/vendorExtension"}},cb={swagger:{type:"string",enum:["2.0"],description:"The Swagger version of this document."},info:{$ref:"#/definitions/info"},host:{type:"string",pattern:"^[^{}/ :\\\\]+(?::\\d+)?$",description:"The host (name or ip) of the API. Example: 'swagger.io'"},basePath:{type:"string",pattern:"^/",description:"The base path to the API. Example: '/api'."},schemes:{$ref:"#/definitions/schemesList"},consumes:{description:"A list of MIME types accepted by the API.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},produces:{description:"A list of MIME types the API can produce.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},paths:{$ref:"#/definitions/paths"},definitions:{$ref:"#/definitions/definitions"},parameters:{$ref:"#/definitions/parameterDefinitions"},responses:{$ref:"#/definitions/responseDefinitions"},security:{$ref:"#/definitions/security"},securityDefinitions:{$ref:"#/definitions/securityDefinitions"},tags:{type:"array",items:{$ref:"#/definitions/tag"},uniqueItems:!0},externalDocs:{$ref:"#/definitions/externalDocs"}},lb={info:{type:"object",description:"General information about the API.",required:["version","title"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{title:{type:"string",description:"A unique and precise title of the API."},version:{type:"string",description:"A semantic version number of the API."},description:{type:"string",description:"A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."},termsOfService:{type:"string",description:"The terms of service for the API."},contact:{$ref:"#/definitions/contact"},license:{$ref:"#/definitions/license"}}},contact:{type:"object",description:"Contact information for the owners of the API.",additionalProperties:!1,properties:{name:{type:"string",description:"The identifying name of the contact person/organization."},url:{type:"string",description:"The URL pointing to the contact information.",format:"uri"},email:{type:"string",description:"The email address of the contact person/organization.",format:"email"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},license:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"The name of the license type. It's encouraged to use an OSI compatible license."},url:{type:"string",description:"The URL pointing to the license.",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},paths:{type:"object",description:"Relative paths to the individual endpoints. They must be relative to the 'basePath'.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"},"^/":{$ref:"#/definitions/pathItem"}},additionalProperties:!1},definitions:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},description:"One or more JSON objects describing the schemas being consumed and produced by the API."},parameterDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/parameter"},description:"One or more JSON representations for parameters"},responseDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/response"},description:"One or more JSON representations for responses"},externalDocs:{type:"object",additionalProperties:!1,description:"information about external documentation",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},examples:{type:"object",additionalProperties:!0},mimeType:{type:"string",description:"The MIME type of the HTTP message."},operation:{type:"object",required:["responses"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{tags:{type:"array",items:{type:"string"},uniqueItems:!0},summary:{type:"string",description:"A brief summary of the operation."},description:{type:"string",description:"A longer description of the operation, GitHub Flavored Markdown is allowed."},externalDocs:{$ref:"#/definitions/externalDocs"},operationId:{type:"string",description:"A unique identifier of the operation."},produces:{description:"A list of MIME types the API can produce.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},consumes:{description:"A list of MIME types the API can consume.",allOf:[{$ref:"#/definitions/mediaTypeList"}]},parameters:{$ref:"#/definitions/parametersList"},responses:{$ref:"#/definitions/responses"},schemes:{$ref:"#/definitions/schemesList"},deprecated:{type:"boolean",default:!1},security:{$ref:"#/definitions/security"}}},pathItem:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},get:{$ref:"#/definitions/operation"},put:{$ref:"#/definitions/operation"},post:{$ref:"#/definitions/operation"},delete:{$ref:"#/definitions/operation"},options:{$ref:"#/definitions/operation"},head:{$ref:"#/definitions/operation"},patch:{$ref:"#/definitions/operation"},parameters:{$ref:"#/definitions/parametersList"}}},responses:{type:"object",description:"Response objects names can either be any valid HTTP status code or 'default'.",minProperties:1,additionalProperties:!1,patternProperties:{"^([0-9]{3})$|^(default)$":{$ref:"#/definitions/responseValue"},"^x-":{$ref:"#/definitions/vendorExtension"}},not:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}}},responseValue:{oneOf:[{$ref:"#/definitions/response"},{$ref:"#/definitions/jsonReference"}]},response:{type:"object",required:["description"],properties:{description:{type:"string"},schema:{oneOf:[{$ref:"#/definitions/schema"},{$ref:"#/definitions/fileSchema"}]},headers:{$ref:"#/definitions/headers"},examples:{$ref:"#/definitions/examples"}},additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},headers:{type:"object",additionalProperties:{$ref:"#/definitions/header"}},header:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},vendorExtension:{description:"Any property starting with x- is valid.",additionalProperties:!0,additionalItems:!0},bodyParameter:{type:"object",required:["name","in","schema"],patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},in:{type:"string",description:"Determines the location of the parameter.",enum:["body"]},required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},schema:{$ref:"#/definitions/schema"}},additionalProperties:!1},headerParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["header"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},queryParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["query"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},formDataParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["formData"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array","file"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},pathParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["required"],properties:{required:{type:"boolean",enum:[!0],description:"Determines whether or not this parameter is required or optional."},in:{type:"string",description:"Determines the location of the parameter.",enum:["path"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},nonBodyParameter:{type:"object",required:["name","in","type"],oneOf:[{$ref:"#/definitions/headerParameterSubSchema"},{$ref:"#/definitions/formDataParameterSubSchema"},{$ref:"#/definitions/queryParameterSubSchema"},{$ref:"#/definitions/pathParameterSubSchema"}]},parameter:{oneOf:[{$ref:"#/definitions/bodyParameter"},{$ref:"#/definitions/nonBodyParameter"}]},schema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},maxProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},additionalProperties:{anyOf:[{$ref:"#/definitions/schema"},{type:"boolean"}],default:{}},type:{$ref:"http://json-schema.org/draft-04/schema#/properties/type"},items:{anyOf:[{$ref:"#/definitions/schema"},{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}}],default:{}},allOf:{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}},oneOf:{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}},anyOf:{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}},properties:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},default:{}},discriminator:{type:"string"},readOnly:{type:"boolean",default:!1},xml:{$ref:"#/definitions/xml"},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},fileSchema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["type"],properties:{format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},type:{type:"string",enum:["file"]},readOnly:{type:"boolean",default:!1},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},primitivesItems:{type:"object",additionalProperties:!1,properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},security:{type:"array",items:{$ref:"#/definitions/securityRequirement"},uniqueItems:!0},securityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"},uniqueItems:!0}},xml:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},namespace:{type:"string"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},tag:{type:"object",additionalProperties:!1,required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/externalDocs"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},securityDefinitions:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/basicAuthenticationSecurity"},{$ref:"#/definitions/apiKeySecurity"},{$ref:"#/definitions/oauth2ImplicitSecurity"},{$ref:"#/definitions/oauth2PasswordSecurity"},{$ref:"#/definitions/oauth2ApplicationSecurity"},{$ref:"#/definitions/oauth2AccessCodeSecurity"}]},errorMessage:{properties:{basic:"Invalid basic authentication security definition",apiKey:"Invalid apiKey authentication security definition",oauth2:"Invalid oauth2 authentication security definition"},_:"Invalid security securityDefinitions"}},basicAuthenticationSecurity:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["basic"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},apiKeySecurity:{type:"object",additionalProperties:!1,required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ImplicitSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl","scopes"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["implicit"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2PasswordSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl","scopes"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["password"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ApplicationSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl","scopes"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["application"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2AccessCodeSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl","tokenUrl","scopes"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["accessCode"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2Scopes:{type:"object",additionalProperties:{type:"string"}},mediaTypeList:{type:"array",items:{$ref:"#/definitions/mimeType"},uniqueItems:!0},parametersList:{type:"array",description:"The parameters needed to send a valid API call.",additionalItems:!1,items:{oneOf:[{$ref:"#/definitions/parameter"},{$ref:"#/definitions/jsonReference"}]},uniqueItems:!0},schemesList:{type:"array",description:"The transfer protocol of the API.",items:{type:"string",enum:["http","https","ws","wss"]},uniqueItems:!0},collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes"],default:"csv"},collectionFormatWithMulti:{type:"string",enum:["csv","ssv","tsv","pipes","multi"],default:"csv"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},jsonReference:{type:"object",required:["$ref"],additionalProperties:!1,properties:{$ref:{type:"string"}}}},ub={title:tb,$id:rb,$schema:sb,type:nb,required:ib,additionalProperties:ab,patternProperties:ob,properties:cb,definitions:lb};var mo={};Jr(mo,{$id:()=>db,$schema:()=>fb,additionalProperties:()=>vb,default:()=>_b,definitions:()=>bb,description:()=>pb,patternProperties:()=>gb,properties:()=>yb,required:()=>mb,type:()=>hb});var db="https://spec.openapis.org/oas/3.0/schema/2019-04-02",fb="http://json-schema.org/draft-07/schema#",pb="Validation schema for OpenAPI Specification 3.0.X.",hb="object",mb=["openapi","info","paths"],yb={openapi:{type:"string",pattern:"^3\\.0\\.\\d(-.+)?$"},info:{$ref:"#/definitions/Info"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},servers:{type:"array",items:{$ref:"#/definitions/Server"}},security:{type:"array",items:{$ref:"#/definitions/SecurityRequirement"}},tags:{type:"array",items:{$ref:"#/definitions/Tag"},uniqueItems:!0},paths:{$ref:"#/definitions/Paths"},components:{$ref:"#/definitions/Components"}},gb={"^x-":{}},vb=!1,bb={Reference:{type:"object",required:["$ref"],patternProperties:{"^\\$ref$":{type:"string",format:"uri-reference"}}},Info:{type:"object",required:["title","version"],properties:{title:{type:"string"},description:{type:"string"},termsOfService:{type:"string",format:"uri-reference"},contact:{$ref:"#/definitions/Contact"},license:{$ref:"#/definitions/License"},version:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},Contact:{type:"object",properties:{name:{type:"string"},url:{type:"string",format:"uri-reference"},email:{type:"string",format:"email"}},patternProperties:{"^x-":{}},additionalProperties:!1},License:{type:"object",required:["name"],properties:{name:{type:"string"},url:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},Server:{type:"object",required:["url"],properties:{url:{type:"string"},description:{type:"string"},variables:{type:"object",additionalProperties:{$ref:"#/definitions/ServerVariable"}}},patternProperties:{"^x-":{}},additionalProperties:!1},ServerVariable:{type:"object",required:["default"],properties:{enum:{type:"array",items:{type:"string"}},default:{type:"string"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},Components:{type:"object",properties:{schemas:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}}},responses:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Response"}]}}},parameters:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Parameter"}]}}},examples:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Example"}]}}},requestBodies:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/RequestBody"}]}}},headers:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Header"}]}}},securitySchemes:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/SecurityScheme"}]}}},links:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Link"}]}}},callbacks:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Callback"}]}}}},patternProperties:{"^x-":{}},additionalProperties:!1},Schema:{type:"object",properties:{title:{type:"string"},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{type:"integer",minimum:0},minLength:{type:"integer",minimum:0,default:0},pattern:{type:"string",format:"regex"},maxItems:{type:"integer",minimum:0},minItems:{type:"integer",minimum:0,default:0},uniqueItems:{type:"boolean",default:!1},maxProperties:{type:"integer",minimum:0},minProperties:{type:"integer",minimum:0,default:0},required:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},enum:{type:"array",items:{},minItems:1,uniqueItems:!1},type:{type:"string",enum:["array","boolean","integer","number","object","string"]},not:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},allOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},oneOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},anyOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},properties:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},additionalProperties:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"},{type:"boolean"}],default:!0},description:{type:"string"},format:{type:"string"},default:{},nullable:{type:"boolean",default:!1},discriminator:{$ref:"#/definitions/Discriminator"},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},example:{},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},deprecated:{type:"boolean",default:!1},xml:{$ref:"#/definitions/XML"}},patternProperties:{"^x-":{}},additionalProperties:!1},Discriminator:{type:"object",required:["propertyName"],properties:{propertyName:{type:"string"},mapping:{type:"object",additionalProperties:{type:"string"}}}},XML:{type:"object",properties:{name:{type:"string"},namespace:{type:"string",format:"uri"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{}},additionalProperties:!1},Response:{type:"object",required:["description"],properties:{description:{type:"string"},headers:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Header"},{$ref:"#/definitions/Reference"}]}},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"}},links:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Link"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1},MediaType:{type:"object",properties:{schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}},encoding:{type:"object",additionalProperties:{$ref:"#/definitions/Encoding"}}},patternProperties:{"^x-":{}},additionalProperties:!1,allOf:[{$ref:"#/definitions/ExampleXORExamples"}]},Example:{type:"object",properties:{summary:{type:"string"},description:{type:"string"},value:{},externalValue:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},Header:{type:"object",properties:{description:{type:"string"},required:{type:"boolean",default:!1},deprecated:{type:"boolean",default:!1},allowEmptyValue:{type:"boolean",default:!1},style:{type:"string",enum:["simple"],default:"simple"},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1},schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"},minProperties:1,maxProperties:1},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1,allOf:[{$ref:"#/definitions/ExampleXORExamples"},{$ref:"#/definitions/SchemaXORContent"}]},Paths:{type:"object",patternProperties:{"^\\/":{$ref:"#/definitions/PathItem"},"^x-":{}},additionalProperties:!1},PathItem:{type:"object",properties:{$ref:{type:"string"},summary:{type:"string"},description:{type:"string"},servers:{type:"array",items:{$ref:"#/definitions/Server"}},parameters:{type:"array",items:{oneOf:[{$ref:"#/definitions/Parameter"},{$ref:"#/definitions/Reference"}]},uniqueItems:!0}},patternProperties:{"^(get|put|post|delete|options|head|patch|trace)$":{$ref:"#/definitions/Operation"},"^x-":{}},additionalProperties:!1},Operation:{type:"object",required:["responses"],properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},operationId:{type:"string"},parameters:{type:"array",items:{oneOf:[{$ref:"#/definitions/Parameter"},{$ref:"#/definitions/Reference"}]},uniqueItems:!0},requestBody:{oneOf:[{$ref:"#/definitions/RequestBody"},{$ref:"#/definitions/Reference"}]},responses:{$ref:"#/definitions/Responses"},callbacks:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Callback"},{$ref:"#/definitions/Reference"}]}},deprecated:{type:"boolean",default:!1},security:{type:"array",items:{$ref:"#/definitions/SecurityRequirement"}},servers:{type:"array",items:{$ref:"#/definitions/Server"}}},patternProperties:{"^x-":{}},additionalProperties:!1},Responses:{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/Response"},{$ref:"#/definitions/Reference"}]}},patternProperties:{"^[1-5](?:\\d{2}|XX)$":{oneOf:[{$ref:"#/definitions/Response"},{$ref:"#/definitions/Reference"}]},"^x-":{}},minProperties:1,additionalProperties:!1},SecurityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"}}},Tag:{type:"object",required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"}},patternProperties:{"^x-":{}},additionalProperties:!1},ExternalDocumentation:{type:"object",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},ExampleXORExamples:{description:"Example and examples are mutually exclusive",not:{required:["example","examples"]}},SchemaXORContent:{description:"Schema and content are mutually exclusive, at least one is required",not:{required:["schema","content"]},oneOf:[{required:["schema"]},{required:["content"],description:"Some properties are not allowed if content is present",allOf:[{not:{required:["style"]}},{not:{required:["explode"]}},{not:{required:["allowReserved"]}},{not:{required:["example"]}},{not:{required:["examples"]}}]}]},Parameter:{type:"object",properties:{name:{type:"string"},in:{type:"string"},description:{type:"string"},required:{type:"boolean",default:!1},deprecated:{type:"boolean",default:!1},allowEmptyValue:{type:"boolean",default:!1},style:{type:"string"},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1},schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"},minProperties:1,maxProperties:1},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1,required:["name","in"],allOf:[{$ref:"#/definitions/ExampleXORExamples"},{$ref:"#/definitions/SchemaXORContent"},{$ref:"#/definitions/ParameterLocation"}]},ParameterLocation:{description:"Parameter location",oneOf:[{description:"Parameter in path",required:["required"],properties:{in:{enum:["path"]},style:{enum:["matrix","label","simple"],default:"simple"},required:{enum:[!0]}}},{description:"Parameter in query",properties:{in:{enum:["query"]},style:{enum:["form","spaceDelimited","pipeDelimited","deepObject"],default:"form"}}},{description:"Parameter in header",properties:{in:{enum:["header"]},style:{enum:["simple"],default:"simple"}}},{description:"Parameter in cookie",properties:{in:{enum:["cookie"]},style:{enum:["form"],default:"form"}}}]},RequestBody:{type:"object",required:["content"],properties:{description:{type:"string"},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"}},required:{type:"boolean",default:!1}},patternProperties:{"^x-":{}},additionalProperties:!1},SecurityScheme:{oneOf:[{$ref:"#/definitions/APIKeySecurityScheme"},{$ref:"#/definitions/HTTPSecurityScheme"},{$ref:"#/definitions/OAuth2SecurityScheme"},{$ref:"#/definitions/OpenIdConnectSecurityScheme"}]},APIKeySecurityScheme:{type:"object",required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query","cookie"]},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},HTTPSecurityScheme:{type:"object",required:["scheme","type"],properties:{scheme:{type:"string"},bearerFormat:{type:"string"},description:{type:"string"},type:{type:"string",enum:["http"]}},patternProperties:{"^x-":{}},additionalProperties:!1,oneOf:[{description:"Bearer",properties:{scheme:{enum:["bearer"]}}},{description:"Non Bearer",not:{required:["bearerFormat"]},properties:{scheme:{not:{enum:["bearer"]}}}}]},OAuth2SecurityScheme:{type:"object",required:["type","flows"],properties:{type:{type:"string",enum:["oauth2"]},flows:{$ref:"#/definitions/OAuthFlows"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},OpenIdConnectSecurityScheme:{type:"object",required:["type","openIdConnectUrl"],properties:{type:{type:"string",enum:["openIdConnect"]},openIdConnectUrl:{type:"string",format:"uri-reference"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},OAuthFlows:{type:"object",properties:{implicit:{$ref:"#/definitions/ImplicitOAuthFlow"},password:{$ref:"#/definitions/PasswordOAuthFlow"},clientCredentials:{$ref:"#/definitions/ClientCredentialsFlow"},authorizationCode:{$ref:"#/definitions/AuthorizationCodeOAuthFlow"}},patternProperties:{"^x-":{}},additionalProperties:!1},ImplicitOAuthFlow:{type:"object",required:["authorizationUrl","scopes"],properties:{authorizationUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},PasswordOAuthFlow:{type:"object",required:["tokenUrl","scopes"],properties:{tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},ClientCredentialsFlow:{type:"object",required:["tokenUrl","scopes"],properties:{tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},AuthorizationCodeOAuthFlow:{type:"object",required:["authorizationUrl","tokenUrl","scopes"],properties:{authorizationUrl:{type:"string",format:"uri-reference"},tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},Link:{type:"object",properties:{operationId:{type:"string"},operationRef:{type:"string",format:"uri-reference"},parameters:{type:"object",additionalProperties:{}},requestBody:{},description:{type:"string"},server:{$ref:"#/definitions/Server"}},patternProperties:{"^x-":{}},additionalProperties:!1,not:{description:"Operation Id and Operation Ref are mutually exclusive",required:["operationId","operationRef"]}},Callback:{type:"object",additionalProperties:{$ref:"#/definitions/PathItem"},patternProperties:{"^x-":{}}},Encoding:{type:"object",properties:{contentType:{type:"string"},headers:{type:"object",additionalProperties:{$ref:"#/definitions/Header"}},style:{type:"string",enum:["form","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1}},additionalProperties:!1}},_b={$id:db,$schema:fb,description:pb,type:hb,required:mb,properties:yb,patternProperties:gb,additionalProperties:vb,definitions:bb};var yo={};Jr(yo,{$defs:()=>kb,$id:()=>wb,$ref:()=>$b,$schema:()=>Sb,anyOf:()=>Pb,default:()=>Ab,properties:()=>Ob,required:()=>Ib,type:()=>xb,unevaluatedProperties:()=>Tb});var wb="https://spec.openapis.org/oas/3.1/schema/2021-09-28",Sb="https://json-schema.org/draft/2020-12/schema",xb="object",Ob={openapi:{type:"string",pattern:"^3\\.1\\.\\d+(-.+)?$"},info:{$ref:"#/$defs/info"},jsonSchemaDialect:{type:"string",format:"uri",default:"https://spec.openapis.org/oas/3.1/dialect/base"},servers:{type:"array",items:{$ref:"#/$defs/server"}},paths:{$ref:"#/$defs/paths"},webhooks:{type:"object",additionalProperties:{$ref:"#/$defs/path-item-or-reference"}},components:{$ref:"#/$defs/components"},security:{type:"array",items:{$ref:"#/$defs/security-requirement"}},tags:{type:"array",items:{$ref:"#/$defs/tag"}},externalDocs:{$ref:"#/$defs/external-documentation"}},Ib=["openapi","info"],Pb=[{required:["paths"],errorMessage:'The document must have either "paths", "webhooks" or "components"'},{required:["components"]},{required:["webhooks"]}],$b="#/$defs/specification-extensions",Tb=!1,kb={info:{type:"object",properties:{title:{type:"string"},summary:{type:"string"},description:{type:"string"},termsOfService:{type:"string"},contact:{$ref:"#/$defs/contact"},license:{$ref:"#/$defs/license"},version:{type:"string"}},required:["title","version"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},contact:{type:"object",properties:{name:{type:"string"},url:{type:"string"},email:{type:"string"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},license:{type:"object",properties:{name:{type:"string"},identifier:{type:"string"},url:{type:"string",format:"uri"}},required:["name"],oneOf:[{required:["identifier"]},{required:["url"]}],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},server:{type:"object",properties:{url:{type:"string",format:"uri-template"},description:{type:"string"},variables:{type:"object",additionalProperties:{$ref:"#/$defs/server-variable"}}},required:["url"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"server-variable":{type:"object",properties:{enum:{type:"array",items:{type:"string"},minItems:1},default:{type:"string"},description:{type:"string"}},required:["default"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},components:{type:"object",properties:{schemas:{type:"object",additionalProperties:{$ref:"#/$defs/schema"}},responses:{type:"object",additionalProperties:{$ref:"#/$defs/response-or-reference"}},parameters:{type:"object",additionalProperties:{$ref:"#/$defs/parameter-or-reference"}},examples:{type:"object",additionalProperties:{$ref:"#/$defs/example-or-reference"}},requestBodies:{type:"object",additionalProperties:{$ref:"#/$defs/request-body-or-reference"}},headers:{type:"object",additionalProperties:{$ref:"#/$defs/header-or-reference"}},securitySchemes:{type:"object",additionalProperties:{$ref:"#/$defs/security-scheme-or-reference"}},links:{type:"object",additionalProperties:{$ref:"#/$defs/link-or-reference"}},callbacks:{type:"object",additionalProperties:{$ref:"#/$defs/callbacks-or-reference"}},pathItems:{type:"object",additionalProperties:{$ref:"#/$defs/path-item-or-reference"}}},patternProperties:{"^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$":{$comment:"Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected",propertyNames:{pattern:"^[a-zA-Z0-9._-]+$"}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},paths:{type:"object",patternProperties:{"^/":{$ref:"#/$defs/path-item"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"path-item":{type:"object",properties:{summary:{type:"string"},description:{type:"string"},servers:{type:"array",items:{$ref:"#/$defs/server"}},parameters:{type:"array",items:{$ref:"#/$defs/parameter-or-reference"}}},patternProperties:{"^(get|put|post|delete|options|head|patch|trace)$":{$ref:"#/$defs/operation"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"path-item-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/path-item"}},operation:{type:"object",properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/$defs/external-documentation"},operationId:{type:"string"},parameters:{type:"array",items:{$ref:"#/$defs/parameter-or-reference"}},requestBody:{$ref:"#/$defs/request-body-or-reference"},responses:{$ref:"#/$defs/responses"},callbacks:{type:"object",additionalProperties:{$ref:"#/$defs/callbacks-or-reference"}},deprecated:{default:!1,type:"boolean"},security:{type:"array",items:{$ref:"#/$defs/security-requirement"}},servers:{type:"array",items:{$ref:"#/$defs/server"}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"external-documentation":{type:"object",properties:{description:{type:"string"},url:{type:"string",format:"uri"}},required:["url"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},parameter:{type:"object",properties:{name:{type:"string"},in:{enum:["query","header","path","cookie"]},description:{type:"string"},required:{default:!1,type:"boolean"},deprecated:{default:!1,type:"boolean"},allowEmptyValue:{default:!1,type:"boolean"},schema:{$ref:"#/$defs/schema"},content:{$ref:"#/$defs/content"}},required:["in"],oneOf:[{required:["schema"]},{required:["content"]}],dependentSchemas:{schema:{properties:{style:{type:"string"},explode:{type:"boolean"},allowReserved:{default:!1,type:"boolean"}},allOf:[{$ref:"#/$defs/examples"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie"},{$ref:"#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form"}],$defs:{"styles-for-path":{if:{properties:{in:{const:"path"}},required:["in"]},then:{properties:{name:{pattern:"[^/#?]+$"},style:{default:"simple",enum:["matrix","label","simple"]},required:{const:!0}},required:["required"]}},"styles-for-header":{if:{properties:{in:{const:"header"}},required:["in"]},then:{properties:{style:{default:"simple",const:"simple"}}}},"styles-for-query":{if:{properties:{in:{const:"query"}},required:["in"]},then:{properties:{style:{default:"form",enum:["form","spaceDelimited","pipeDelimited","deepObject"]}}}},"styles-for-cookie":{if:{properties:{in:{const:"cookie"}},required:["in"]},then:{properties:{style:{default:"form",const:"form"}}}},"styles-for-form":{if:{properties:{style:{const:"form"}},required:["style"]},then:{properties:{explode:{default:!0}}},else:{properties:{explode:{default:!1}}}}}}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"parameter-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/parameter"}},"request-body":{type:"object",properties:{description:{type:"string"},content:{$ref:"#/$defs/content"},required:{default:!1,type:"boolean"}},required:["content"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"request-body-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/request-body"}},content:{type:"object",additionalProperties:{$ref:"#/$defs/media-type"},propertyNames:{format:"media-range"}},"media-type":{type:"object",properties:{schema:{$ref:"#/$defs/schema"},encoding:{type:"object",additionalProperties:{$ref:"#/$defs/encoding"}}},allOf:[{$ref:"#/$defs/specification-extensions"},{$ref:"#/$defs/examples"}],unevaluatedProperties:!1},encoding:{type:"object",properties:{contentType:{type:"string",format:"media-range"},headers:{type:"object",additionalProperties:{$ref:"#/$defs/header-or-reference"}},style:{default:"form",enum:["form","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{default:!1,type:"boolean"}},allOf:[{$ref:"#/$defs/specification-extensions"},{$ref:"#/$defs/encoding/$defs/explode-default"}],unevaluatedProperties:!1,$defs:{"explode-default":{if:{properties:{style:{const:"form"}},required:["style"]},then:{properties:{explode:{default:!0}}},else:{properties:{explode:{default:!1}}}}}},responses:{type:"object",properties:{default:{$ref:"#/$defs/response-or-reference"}},patternProperties:{"^[1-5](?:[0-9]{2}|XX)$":{$ref:"#/$defs/response-or-reference"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},response:{type:"object",properties:{description:{type:"string"},headers:{type:"object",additionalProperties:{$ref:"#/$defs/header-or-reference"}},content:{$ref:"#/$defs/content"},links:{type:"object",additionalProperties:{$ref:"#/$defs/link-or-reference"}}},required:["description"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"response-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/response"}},callbacks:{type:"object",$ref:"#/$defs/specification-extensions",additionalProperties:{$ref:"#/$defs/path-item-or-reference"}},"callbacks-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/callbacks"}},example:{type:"object",properties:{summary:{type:"string"},description:{type:"string"},value:!0,externalValue:{type:"string",format:"uri"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"example-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/example"}},link:{type:"object",properties:{operationRef:{type:"string",format:"uri-reference"},operationId:!0,parameters:{$ref:"#/$defs/map-of-strings"},requestBody:!0,description:{type:"string"},body:{$ref:"#/$defs/server"}},oneOf:[{required:["operationRef"]},{required:["operationId"]}],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"link-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/link"}},header:{type:"object",properties:{description:{type:"string"},required:{default:!1,type:"boolean"},deprecated:{default:!1,type:"boolean"},schema:{$ref:"#/$defs/schema"},content:{$ref:"#/$defs/content"}},oneOf:[{required:["schema"]},{required:["content"]}],dependentSchemas:{schema:{properties:{style:{default:"simple",const:"simple"},explode:{default:!1,type:"boolean"}},$ref:"#/$defs/examples"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"header-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/header"}},tag:{type:"object",properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/$defs/external-documentation"}},required:["name"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},reference:{type:"object",properties:{$ref:{type:"string",format:"uri-reference"},summary:{type:"string"},description:{type:"string"}},unevaluatedProperties:!1},schema:{$dynamicAnchor:"meta",type:["object","boolean"]},"security-scheme":{type:"object",properties:{type:{enum:["apiKey","http","mutualTLS","oauth2","openIdConnect"]},description:{type:"string"}},required:["type"],allOf:[{$ref:"#/$defs/specification-extensions"},{$ref:"#/$defs/security-scheme/$defs/type-apikey"},{$ref:"#/$defs/security-scheme/$defs/type-http"},{$ref:"#/$defs/security-scheme/$defs/type-http-bearer"},{$ref:"#/$defs/security-scheme/$defs/type-oauth2"},{$ref:"#/$defs/security-scheme/$defs/type-oidc"}],unevaluatedProperties:!1,$defs:{"type-apikey":{if:{properties:{type:{const:"apiKey"}},required:["type"]},then:{properties:{name:{type:"string"},in:{enum:["query","header","cookie"]}},required:["name","in"]}},"type-http":{if:{properties:{type:{const:"http"}},required:["type"]},then:{properties:{scheme:{type:"string"}},required:["scheme"]}},"type-http-bearer":{if:{properties:{type:{const:"http"},scheme:{type:"string",pattern:"^[Bb][Ee][Aa][Rr][Ee][Rr]$"}},required:["type","scheme"]},then:{properties:{bearerFormat:{type:"string"}}}},"type-oauth2":{if:{properties:{type:{const:"oauth2"}},required:["type"]},then:{properties:{flows:{$ref:"#/$defs/oauth-flows"}},required:["flows"]}},"type-oidc":{if:{properties:{type:{const:"openIdConnect"}},required:["type"]},then:{properties:{openIdConnectUrl:{type:"string",format:"uri"}},required:["openIdConnectUrl"]}}}},"security-scheme-or-reference":{if:{type:"object",required:["$ref"]},then:{$ref:"#/$defs/reference"},else:{$ref:"#/$defs/security-scheme"}},"oauth-flows":{type:"object",properties:{implicit:{$ref:"#/$defs/oauth-flows/$defs/implicit"},password:{$ref:"#/$defs/oauth-flows/$defs/password"},clientCredentials:{$ref:"#/$defs/oauth-flows/$defs/client-credentials"},authorizationCode:{$ref:"#/$defs/oauth-flows/$defs/authorization-code"}},$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1,$defs:{implicit:{type:"object",properties:{authorizationUrl:{type:"string"},refreshUrl:{type:"string"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["authorizationUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},password:{type:"object",properties:{tokenUrl:{type:"string"},refreshUrl:{type:"string"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["tokenUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"client-credentials":{type:"object",properties:{tokenUrl:{type:"string"},refreshUrl:{type:"string"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["tokenUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1},"authorization-code":{type:"object",properties:{authorizationUrl:{type:"string"},tokenUrl:{type:"string"},refreshUrl:{type:"string"},scopes:{$ref:"#/$defs/map-of-strings"}},required:["authorizationUrl","tokenUrl","scopes"],$ref:"#/$defs/specification-extensions",unevaluatedProperties:!1}}},"security-requirement":{type:"object",additionalProperties:{type:"array",items:{type:"string"}}},"specification-extensions":{patternProperties:{"^x-":!0}},examples:{properties:{example:!0,examples:{type:"object",additionalProperties:{$ref:"#/$defs/example-or-reference"}}}},"map-of-strings":{type:"object",additionalProperties:{type:"string"}}},Ab={$id:wb,$schema:Sb,type:xb,properties:Ob,required:Ib,anyOf:Pb,$ref:$b,unevaluatedProperties:Tb,$defs:kb};var V;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(let o of i)a[o]=n[o];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},r.find=(n,i)=>{for(let a of n)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}r.joinValues=s,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(V||(V={}));var x=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xt=r=>{switch(typeof r){case"undefined":return x.undefined;case"string":return x.string;case"number":return isNaN(r)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":return Array.isArray(r)?x.array:r===null?x.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?x.promise:typeof Map<"u"&&r instanceof Map?x.map:typeof Set<"u"&&r instanceof Set?x.set:typeof Date<"u"&&r instanceof Date?x.date:x.object;default:return x.unknown}},S=V.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"]),Nb=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),Re=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(i){return i.message},s={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,c=0;for(;ct.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Re.create=r=>new Re(r);var As=(r,e)=>{let t;switch(r.code){case S.invalid_type:r.received===x.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case S.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,V.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:t=`Unrecognized key(s) in object: ${V.joinValues(r.keys,", ")}`;break;case S.invalid_union:t="Invalid input";break;case S.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${V.joinValues(r.options)}`;break;case S.invalid_enum_value:t=`Invalid enum value. Expected ${V.joinValues(r.options)}, received '${r.received}'`;break;case S.invalid_arguments:t="Invalid function arguments";break;case S.invalid_return_type:t="Invalid function return type";break;case S.invalid_date:t="Invalid date";break;case S.invalid_string:typeof r.validation=="object"?"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:V.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case S.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(r.minimum)}`:t="Invalid input";break;case S.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(r.maximum)}`:t="Invalid input";break;case S.custom:t="Invalid input";break;case S.invalid_intersection_types:t="Intersection results could not be merged";break;case S.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case S.not_finite:t="Number must be finite";break;default:t=e.defaultError,V.assertNever(r)}return{message:t}},Td=As;function Eb(r){Td=r}function Hn(){return Td}var zn=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,i=[...t,...n.path||[]],a={...n,path:i},o="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:i,message:n.message||o}},jb=[];function T(r,e){let t=zn({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Hn(),As].filter(s=>!!s)});r.common.issues.push(t)}var oe=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return j;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t)s.push({key:await n.key,value:await n.value});return oe.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return j;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||n.alwaysSet)&&(s[i.value]=a.value)}return{status:e.value,value:s}}},j=Object.freeze({status:"aborted"}),kd=r=>({status:"dirty",value:r}),ue=r=>({status:"valid",value:r}),go=r=>r.status==="aborted",vo=r=>r.status==="dirty",Gn=r=>r.status==="valid",Qn=r=>typeof Promise!==void 0&&r instanceof Promise,L;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(L||(L={}));var Te=class{constructor(e,t,s,n){this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._path.concat(this._key)}},Id=(r,e)=>{if(Gn(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,error:new Re(r.common.issues)}};function M(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:s??o.defaultError}:{message:t??o.defaultError},description:n}}var q=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return xt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new oe,ctx:{common:e.parent.common,data:e.data,parsedType:xt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Qn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xt(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Id(n,i)}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xt(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(Qn(n)?n:Promise.resolve(n));return Id(s,i)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let a=e(n),o=()=>i.addIssue({code:S.custom,...s(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new be({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return $e.create(this)}nullable(){return dt.create(this)}nullish(){return this.optional().nullable()}array(){return ve.create(this)}promise(){return Pt.create(this)}or(e){return Qt.create([this,e])}and(e){return Xt.create(this,e)}transform(e){return new be({schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ir({innerType:this,defaultValue:t,typeName:A.ZodDefault})}brand(){return new ei({typeName:A.ZodBranded,type:this,...M(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Fr({innerType:this,defaultValue:t,typeName:A.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ar.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Cb=/^c[^\s-]{8,}$/i,qb=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Rb=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Mb=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),Me=class extends q{constructor(){super(...arguments),this._regex=(e,t,s)=>this.refinement(n=>e.test(n),{validation:t,code:S.invalid_string,...L.errToObj(s)}),this.nonempty=e=>this.min(1,L.errToObj(e)),this.trim=()=>new Me({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==x.string){let i=this._getOrReturnCtx(e);return T(i,{code:S.invalid_type,expected:x.string,received:i.parsedType}),j}let s=new oe,n;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(n=this._getOrReturnCtx(e,n),T(n,{code:S.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,o=e.data.length"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...L.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...L.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...L.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...L.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...L.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...L.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...L.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new Me({checks:[],typeName:A.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...M(r)})};function Lb(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,i=parseInt(r.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return i%a/Math.pow(10,n)}var He=class extends q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==x.number){let i=this._getOrReturnCtx(e);return T(i,{code:S.invalid_type,expected:x.number,received:i.parsedType}),j}let s,n=new oe;for(let i of this._def.checks)i.kind==="int"?V.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{code:S.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),T(s,{code:S.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Lb(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),T(s,{code:S.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{code:S.not_finite,message:i.message}),n.dirty()):V.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,L.toString(t))}gt(e,t){return this.setLimit("min",e,!1,L.toString(t))}lte(e,t){return this.setLimit("max",e,!0,L.toString(t))}lt(e,t){return this.setLimit("max",e,!1,L.toString(t))}setLimit(e,t,s,n){return new He({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:L.toString(n)}]})}_addCheck(e){return new He({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:L.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:L.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:L.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int")}};He.create=r=>new He({checks:[],typeName:A.ZodNumber,coerce:r?.coerce||!1,...M(r)});var Yt=class extends q{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==x.bigint){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.bigint,received:s.parsedType}),j}return ue(e.data)}};Yt.create=r=>{var e;return new Yt({typeName:A.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...M(r)})};var Ht=class extends q{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==x.boolean){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.boolean,received:s.parsedType}),j}return ue(e.data)}};Ht.create=r=>new Ht({typeName:A.ZodBoolean,coerce:r?.coerce||!1,...M(r)});var lt=class extends q{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==x.date){let i=this._getOrReturnCtx(e);return T(i,{code:S.invalid_type,expected:x.date,received:i.parsedType}),j}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return T(i,{code:S.invalid_date}),j}let s=new oe,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(n=this._getOrReturnCtx(e,n),T(n,{code:S.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):V.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new lt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:L.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:L.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew lt({checks:[],coerce:r?.coerce||!1,typeName:A.ZodDate,...M(r)});var Zr=class extends q{_parse(e){if(this._getType(e)!==x.symbol){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.symbol,received:s.parsedType}),j}return ue(e.data)}};Zr.create=r=>new Zr({typeName:A.ZodSymbol,...M(r)});var zt=class extends q{_parse(e){if(this._getType(e)!==x.undefined){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.undefined,received:s.parsedType}),j}return ue(e.data)}};zt.create=r=>new zt({typeName:A.ZodUndefined,...M(r)});var Gt=class extends q{_parse(e){if(this._getType(e)!==x.null){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.null,received:s.parsedType}),j}return ue(e.data)}};Gt.create=r=>new Gt({typeName:A.ZodNull,...M(r)});var It=class extends q{constructor(){super(...arguments),this._any=!0}_parse(e){return ue(e.data)}};It.create=r=>new It({typeName:A.ZodAny,...M(r)});var ct=class extends q{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ue(e.data)}};ct.create=r=>new ct({typeName:A.ZodUnknown,...M(r)});var Le=class extends q{_parse(e){let t=this._getOrReturnCtx(e);return T(t,{code:S.invalid_type,expected:x.never,received:t.parsedType}),j}};Le.create=r=>new Le({typeName:A.ZodNever,...M(r)});var Ur=class extends q{_parse(e){if(this._getType(e)!==x.undefined){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.void,received:s.parsedType}),j}return ue(e.data)}};Ur.create=r=>new Ur({typeName:A.ZodVoid,...M(r)});var ve=class extends q{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==x.array)return T(t,{code:S.invalid_type,expected:x.array,received:t.parsedType}),j;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,o=t.data.lengthn.maxLength.value&&(T(t,{code:S.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all(t.data.map((a,o)=>n.type._parseAsync(new Te(t,a,t.path,o)))).then(a=>oe.mergeArray(s,a));let i=t.data.map((a,o)=>n.type._parseSync(new Te(t,a,t.path,o)));return oe.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new ve({...this._def,minLength:{value:e,message:L.toString(t)}})}max(e,t){return new ve({...this._def,maxLength:{value:e,message:L.toString(t)}})}length(e,t){return new ve({...this._def,exactLength:{value:e,message:L.toString(t)}})}nonempty(e){return this.min(1,e)}};ve.create=(r,e)=>new ve({type:r,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...M(e)});var Xn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Xn||(Xn={}));var Pd=r=>e=>new H({...r,shape:()=>({...r.shape(),...e})});function Dr(r){if(r instanceof H){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=$e.create(Dr(s))}return new H({...r._def,shape:()=>e})}else return r instanceof ve?ve.create(Dr(r.element)):r instanceof $e?$e.create(Dr(r.unwrap())):r instanceof dt?dt.create(Dr(r.unwrap())):r instanceof ke?ke.create(r.items.map(e=>Dr(e))):r}var H=class extends q{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=Pd(this._def),this.extend=Pd(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=V.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==x.object){let l=this._getOrReturnCtx(e);return T(l,{code:S.invalid_type,expected:x.object,received:l.parsedType}),j}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Le&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||o.push(l);let c=[];for(let l of a){let u=i[l],d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Te(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Le){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")o.length>0&&(T(n,{code:S.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of o){let d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Te(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key;l.push({key:d,value:await u.value,alwaysSet:u.alwaysSet})}return l}).then(l=>oe.mergeObjectSync(s,l)):oe.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return L.errToObj,new H({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,i,a,o;let c=(a=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,t,s).message)!==null&&a!==void 0?a:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=L.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new H({...this._def,unknownKeys:"strip"})}passthrough(){return new H({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new H({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>Xn.mergeShapes(this._def.shape(),e._def.shape()),typeName:A.ZodObject})}catchall(e){return new H({...this._def,catchall:e})}pick(e){let t={};return V.objectKeys(e).map(s=>{this.shape[s]&&(t[s]=this.shape[s])}),new H({...this._def,shape:()=>t})}omit(e){let t={};return V.objectKeys(this.shape).map(s=>{V.objectKeys(e).indexOf(s)===-1&&(t[s]=this.shape[s])}),new H({...this._def,shape:()=>t})}deepPartial(){return Dr(this)}partial(e){let t={};if(e)return V.objectKeys(this.shape).map(s=>{V.objectKeys(e).indexOf(s)===-1?t[s]=this.shape[s]:t[s]=this.shape[s].optional()}),new H({...this._def,shape:()=>t});for(let s in this.shape){let n=this.shape[s];t[s]=n.optional()}return new H({...this._def,shape:()=>t})}required(e){let t={};if(e)V.objectKeys(this.shape).map(s=>{if(V.objectKeys(e).indexOf(s)===-1)t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof $e;)i=i._def.innerType;t[s]=i}});else for(let s in this.shape){let i=this.shape[s];for(;i instanceof $e;)i=i._def.innerType;t[s]=i}return new H({...this._def,shape:()=>t})}keyof(){return Ad(V.objectKeys(this.shape))}};H.create=(r,e)=>new H({shape:()=>r,unknownKeys:"strip",catchall:Le.create(),typeName:A.ZodObject,...M(e)});H.strictCreate=(r,e)=>new H({shape:()=>r,unknownKeys:"strict",catchall:Le.create(),typeName:A.ZodObject,...M(e)});H.lazycreate=(r,e)=>new H({shape:r,unknownKeys:"strip",catchall:Le.create(),typeName:A.ZodObject,...M(e)});var Qt=class extends q{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new Re(o.ctx.common.issues));return T(t,{code:S.invalid_union,unionErrors:a}),j}if(t.common.async)return Promise.all(s.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(c=>new Re(c));return T(t,{code:S.invalid_union,unionErrors:o}),j}}get options(){return this._def.options}};Qt.create=(r,e)=>new Qt({options:r,typeName:A.ZodUnion,...M(e)});var Yn=r=>r instanceof tr?Yn(r.schema):r instanceof be?Yn(r.innerType()):r instanceof rr?[r.value]:r instanceof sr?r.options:r instanceof nr?Object.keys(r.enum):r instanceof ir?Yn(r._def.innerType):r instanceof zt?[void 0]:r instanceof Gt?[null]:null,Br=class extends q{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==x.object)return T(t,{code:S.invalid_type,expected:x.object,received:t.parsedType}),j;let s=this.discriminator,n=t.data[s],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let i of t){let a=Yn(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new Br({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...M(s)})}};function bo(r,e){let t=xt(r),s=xt(e);if(r===e)return{valid:!0,data:r};if(t===x.object&&s===x.object){let n=V.objectKeys(e),i=V.objectKeys(r).filter(o=>n.indexOf(o)!==-1),a={...r,...e};for(let o of i){let c=bo(r[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===x.array&&s===x.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i{if(go(i)||go(a))return j;let o=bo(i.value,a.value);return o.valid?((vo(i)||vo(a))&&t.dirty(),{status:t.value,value:o.data}):(T(s,{code:S.invalid_intersection_types}),j)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Xt.create=(r,e,t)=>new Xt({left:r,right:e,typeName:A.ZodIntersection,...M(t)});var ke=class extends q{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==x.array)return T(s,{code:S.invalid_type,expected:x.array,received:s.parsedType}),j;if(s.data.lengththis._def.items.length&&(T(s,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=s.data.map((a,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Te(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(i).then(a=>oe.mergeArray(t,a)):oe.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ke({...this._def,rest:e})}};ke.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:r,typeName:A.ZodTuple,rest:null,...M(e)})};var er=class extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==x.object)return T(s,{code:S.invalid_type,expected:x.object,received:s.parsedType}),j;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in s.data)n.push({key:i._parse(new Te(s,o,s.path,o)),value:a._parse(new Te(s,s.data[o],s.path,o))});return s.common.async?oe.mergeObjectAsync(t,n):oe.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof q?new er({keyType:e,valueType:t,typeName:A.ZodRecord,...M(s)}):new er({keyType:Me.create(),valueType:e,typeName:A.ZodRecord,...M(t)})}},Vr=class extends q{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==x.map)return T(s,{code:S.invalid_type,expected:x.map,received:s.parsedType}),j;let n=this._def.keyType,i=this._def.valueType,a=[...s.data.entries()].map(([o,c],l)=>({key:n._parse(new Te(s,o,s.path,[l,"key"])),value:i._parse(new Te(s,c,s.path,[l,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return j;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of a){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return j;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}};Vr.create=(r,e,t)=>new Vr({valueType:e,keyType:r,typeName:A.ZodMap,...M(t)});var ut=class extends q{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==x.set)return T(s,{code:S.invalid_type,expected:x.set,received:s.parsedType}),j;let n=this._def;n.minSize!==null&&s.data.sizen.maxSize.value&&(T(s,{code:S.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let u of c){if(u.status==="aborted")return j;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}let o=[...s.data.values()].map((c,l)=>i._parse(new Te(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new ut({...this._def,minSize:{value:e,message:L.toString(t)}})}max(e,t){return new ut({...this._def,maxSize:{value:e,message:L.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(r,e)=>new ut({valueType:r,minSize:null,maxSize:null,typeName:A.ZodSet,...M(e)});var Ot=class extends q{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==x.function)return T(t,{code:S.invalid_type,expected:x.function,received:t.parsedType}),j;function s(o,c){return zn({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Hn(),As].filter(l=>!!l),issueData:{code:S.invalid_arguments,argumentsError:c}})}function n(o,c){return zn({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Hn(),As].filter(l=>!!l),issueData:{code:S.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;return this._def.returns instanceof Pt?ue(async(...o)=>{let c=new Re([]),l=await this._def.args.parseAsync(o,i).catch(p=>{throw c.addIssue(s(o,p)),c}),u=await a(...l);return await this._def.returns._def.type.parseAsync(u,i).catch(p=>{throw c.addIssue(n(u,p)),c})}):ue((...o)=>{let c=this._def.args.safeParse(o,i);if(!c.success)throw new Re([s(o,c.error)]);let l=a(...c.data),u=this._def.returns.safeParse(l,i);if(!u.success)throw new Re([n(l,u.error)]);return u.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ot({...this._def,args:ke.create(e).rest(ct.create())})}returns(e){return new Ot({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Ot({args:e||ke.create([]).rest(ct.create()),returns:t||ct.create(),typeName:A.ZodFunction,...M(s)})}},tr=class extends q{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};tr.create=(r,e)=>new tr({getter:r,typeName:A.ZodLazy,...M(e)});var rr=class extends q{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return T(t,{code:S.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}};rr.create=(r,e)=>new rr({value:r,typeName:A.ZodLiteral,...M(e)});function Ad(r,e){return new sr({values:r,typeName:A.ZodEnum,...M(e)})}var sr=class extends q{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return T(t,{expected:V.joinValues(s),received:t.parsedType,code:S.invalid_type}),j}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),s=this._def.values;return T(t,{received:t.data,code:S.invalid_enum_value,options:s}),j}return ue(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};sr.create=Ad;var nr=class extends q{_parse(e){let t=V.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==x.string&&s.parsedType!==x.number){let n=V.objectValues(t);return T(s,{expected:V.joinValues(n),received:s.parsedType,code:S.invalid_type}),j}if(t.indexOf(e.data)===-1){let n=V.objectValues(t);return T(s,{received:s.data,code:S.invalid_enum_value,options:n}),j}return ue(e.data)}get enum(){return this._def.values}};nr.create=(r,e)=>new nr({values:r,typeName:A.ZodNativeEnum,...M(e)});var Pt=class extends q{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==x.promise&&t.common.async===!1)return T(t,{code:S.invalid_type,expected:x.promise,received:t.parsedType}),j;let s=t.parsedType===x.promise?t.data:Promise.resolve(t.data);return ue(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pt.create=(r,e)=>new Pt({type:r,typeName:A.ZodPromise,...M(e)});var be=class extends q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let a=n.transform(s.data);return s.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:s.path,parent:s})):this._def.schema._parseSync({data:a,path:s.path,parent:s})}let i={addIssue:a=>{T(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="refinement"){let a=o=>{let c=n.refinement(o,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Gn(a))return a;let o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>Gn(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:t.value,value:o})):a);V.assertNever(n)}};be.create=(r,e,t)=>new be({schema:r,typeName:A.ZodEffects,effect:e,...M(t)});be.createWithPreprocess=(r,e,t)=>new be({schema:e,effect:{type:"preprocess",transform:r},typeName:A.ZodEffects,...M(t)});var $e=class extends q{_parse(e){return this._getType(e)===x.undefined?ue(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(r,e)=>new $e({innerType:r,typeName:A.ZodOptional,...M(e)});var dt=class extends q{_parse(e){return this._getType(e)===x.null?ue(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dt.create=(r,e)=>new dt({innerType:r,typeName:A.ZodNullable,...M(e)});var ir=class extends q{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===x.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ir.create=(r,e)=>new ir({innerType:r,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...M(e)});var Fr=class extends q{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return Qn(s)?s.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()})):{status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};Fr.create=(r,e)=>new Fr({innerType:r,typeName:A.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...M(e)});var Kr=class extends q{_parse(e){if(this._getType(e)!==x.nan){let s=this._getOrReturnCtx(e);return T(s,{code:S.invalid_type,expected:x.nan,received:s.parsedType}),j}return{status:"valid",value:e.data}}};Kr.create=r=>new Kr({typeName:A.ZodNaN,...M(r)});var Db=Symbol("zod_brand"),ei=class extends q{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},ar=class extends q{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?j:i.status==="dirty"?(t.dirty(),kd(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?j:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new ar({in:e,out:t,typeName:A.ZodPipeline})}},Nd=(r,e={},t)=>r?It.create().superRefine((s,n)=>{if(!r(s)){let i=typeof e=="function"?e(s):e,a=typeof i=="string"?{message:i}:i;n.addIssue({code:"custom",...a,fatal:t})}}):It.create(),Zb={object:H.lazycreate},A;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline"})(A||(A={}));var Ub=(r,e={message:`Input not instance of ${r.name}`})=>Nd(t=>t instanceof r,e,!0),Ed=Me.create,jd=He.create,Bb=Kr.create,Vb=Yt.create,Cd=Ht.create,Fb=lt.create,Kb=Zr.create,Wb=zt.create,Jb=Gt.create,Yb=It.create,Hb=ct.create,zb=Le.create,Gb=Ur.create,Qb=ve.create,Xb=H.create,e_=H.strictCreate,t_=Qt.create,r_=Br.create,s_=Xt.create,n_=ke.create,i_=er.create,a_=Vr.create,o_=ut.create,c_=Ot.create,l_=tr.create,u_=rr.create,d_=sr.create,f_=nr.create,p_=Pt.create,$d=be.create,h_=$e.create,m_=dt.create,y_=be.createWithPreprocess,g_=ar.create,v_=()=>Ed().optional(),b_=()=>jd().optional(),__=()=>Cd().optional(),w_={string:r=>Me.create({...r,coerce:!0}),number:r=>He.create({...r,coerce:!0}),boolean:r=>Ht.create({...r,coerce:!0}),bigint:r=>Yt.create({...r,coerce:!0}),date:r=>lt.create({...r,coerce:!0})},S_=j,qd=Object.freeze({__proto__:null,defaultErrorMap:As,setErrorMap:Eb,getErrorMap:Hn,makeIssue:zn,EMPTY_PATH:jb,addIssueToContext:T,ParseStatus:oe,INVALID:j,DIRTY:kd,OK:ue,isAborted:go,isDirty:vo,isValid:Gn,isAsync:Qn,get util(){return V},ZodParsedType:x,getParsedType:xt,ZodType:q,ZodString:Me,ZodNumber:He,ZodBigInt:Yt,ZodBoolean:Ht,ZodDate:lt,ZodSymbol:Zr,ZodUndefined:zt,ZodNull:Gt,ZodAny:It,ZodUnknown:ct,ZodNever:Le,ZodVoid:Ur,ZodArray:ve,get objectUtil(){return Xn},ZodObject:H,ZodUnion:Qt,ZodDiscriminatedUnion:Br,ZodIntersection:Xt,ZodTuple:ke,ZodRecord:er,ZodMap:Vr,ZodSet:ut,ZodFunction:Ot,ZodLazy:tr,ZodLiteral:rr,ZodEnum:sr,ZodNativeEnum:nr,ZodPromise:Pt,ZodEffects:be,ZodTransformer:be,ZodOptional:$e,ZodNullable:dt,ZodDefault:ir,ZodCatch:Fr,ZodNaN:Kr,BRAND:Db,ZodBranded:ei,ZodPipeline:ar,custom:Nd,Schema:q,ZodSchema:q,late:Zb,get ZodFirstPartyTypeKind(){return A},coerce:w_,any:Yb,array:Qb,bigint:Vb,boolean:Cd,date:Fb,discriminatedUnion:r_,effect:$d,enum:d_,function:c_,instanceof:Ub,intersection:s_,lazy:l_,literal:u_,map:a_,nan:Bb,nativeEnum:f_,never:zb,null:Jb,nullable:m_,number:jd,object:Xb,oboolean:__,onumber:b_,optional:h_,ostring:v_,pipeline:g_,preprocess:y_,promise:p_,record:i_,set:o_,strictObject:e_,string:Ed,symbol:Kb,transformer:$d,tuple:n_,undefined:Wb,union:t_,unknown:Hb,void:Gb,NEVER:S_,ZodIssueCode:S,quotelessJson:Nb,ZodError:Re});var x_=qd.string().transform(r=>r.replaceAll("/",".").replaceAll("~0","~").replaceAll("~1","/")).brand(),Rd=r=>x_.parse(r);var _o={"2.0":ho,"3.0":mo,"3.1":yo};function O_(r){return r.keyword==="oneOf"||r.keyword==="required"&&r.params.missingProperty==="$ref"}function I_(r,e){return e["konfig-oas2-schema"]===void 0?!1:e["konfig-oas2-schema"].paths.filter(n=>{if(r.path===void 0)return!1;let i=r.path.join("/"),a=Rd(i);return r.path&&a.includes(n)}).length>0}var P_=[{path:/^components\/securitySchemes\/[^/]+$/,message:"Invalid security scheme"}];function $_(r){for(let e of r)e.keyword==="additionalProperties"&&(e.instancePath=`${e.instancePath}/${String(e.params.additionalProperty)}`);for(let e=0;e0&&O_(t)&&r[e-1]?.instancePath.startsWith(t.instancePath)&&(r.splice(e,1),e--)}}function T_(r){for(let e of r){if(e.path===void 0)continue;let t=e.path.join("/");for(let s of P_)if(s.path.test(t)){e.message=s.message;break}}}var Dd=(r,e,t)=>{let s=t.document.formats;if(s==null)return;let n=s.has(ti.oas2)?_o["2.0"]:s.has(ti.oas3_1)?_o["3.1"]:_o["3.0"],i=(0,Md.getIgnore)({spec:t.document.data}),a=(0,Ld.schema)(r,{allErrors:!0,schema:n,prepareResults:$_},t);return Array.isArray(a)&&(T_(a),a=a.filter(o=>!I_(o,i))),a};var Es=te(Lr()),Of=te(Zd());var Vd=te(Bd()),wo=te(Bn()),Fd=async(r,e,t)=>{let s=t.document.data,n=await(0,Vd.findSecuritySchemesForParametersStoplight)({document:s,operation:r});if(n===void 0)return[];if(n.length===1){let i=n[0];if(i===void 0)throw Error("this makes no sense");return[{message:`Use security requirement "${i.name}" instead of parameter with name "${(0,wo.getSecurityParameterName)({security:i.scheme})}"`}]}return[{message:`Use security requirements ${n.map(i=>`"${i.name}"`).join(", ")} instead of parameters with names ${n.map(i=>`"${(0,wo.getSecurityParameterName)({security:i.scheme})}"`).join(", ")}`}]};var Oo=te(Kd()),di=te(Wd());var Yd=te(Jd()),Hd=async r=>{let e=Yd.tagSchema.safeParse(r);if(e.success)return[];if(!e.error.issues[0])throw Error("At least one issue should exist");return[{message:e.error.issues[0].message}]};var So=(r,e,t)=>{let s=[],n=Object.keys(r);for(let i=0;i(0,Xd.canSchemaObjectBeStructured)({schemaObject:r})?[{message:`Detected JSON example '${r.example}'. Request body schemas should be structured to generate helpful method parameters and classes.`}]:[];var _e=te(rf());var ci=te(Lr()),nf=te(sf()),af=(r,e,t)=>(0,ci.getIgnore)({spec:t.document.data})[ci.OBJECT_WITH_NO_PROPERTIES_RULE_NAME]?[]:(0,nf.isObjectTypeSchemaWithNoProperties)({schema:r})?[{message:"Error found"}]:[];var lf=te(cf()),uf=(r,e)=>(0,lf.isMissing2xxResponse)({responseCodes:Object.keys(r)})?[{message:"Missing 2xx response detected"}]:[];var df=(r,e,t)=>{let s=[],n=r.map(i=>i.name);for(let i=0;itypeof r!="object"?[]:Array.isArray(r)?[]:r===null?[]:"type"in r?r.type!=="object"?[]:"properties"in r?typeof r.properties!="object"?[]:Array.isArray(r.properties)?[]:r.properties===null?[]:Object.keys(r.properties).find(t=>t==="")===void 0?[]:[{message:"Empty name found"}]:[]:[];var BS=gi(),pf=r=>{if(r==null)throw Error("All references should be dereferenced and non-empty");if("$ref"in r)throw Error("All references should be dereferenced by Spectral already");return r};var hf=r=>r.in!=="query"?[]:r.schema===void 0?[]:pf(r.schema).type!=="boolean"?[]:[{message:"Found boolean query parameter"}];var vf=te(gf()),bf=async r=>{let e=(0,vf.default)(r);return/^requestBody$/.test(e)?[{message:"requestBody is not allowed"}]:[]};var _f=r=>r.type!=="string"?[]:r.format==="date-time"?[]:/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\+|-)(\d{2}):(\d{2})$/.test(r.example)?[{message:r.example}]:[];var wf=r=>r.type!=="string"?[]:r.format==="date"?[]:/^(\d{4})-(\d{2})-(\d{2})$/.test(r.example)?[{message:r.example}]:[];var Sf=(r,e,t)=>{let s=[];if(r===null)return[];if(r.type!=="object")return[];if(r.required===void 0)return[];let n=r.required;for(let i=0;i3}var Q_={extends:xf.oas,aliases:_e.rulesetJsonPaths,rules:{"operation-description":"off","operation-success-response":"off","info-contact":"off","oas2-schema":"off","oas3-unused-component":"off","konfig-oas2-schema":{description:"Validate structure of OpenAPI v2 specification.",message:"{{error}}.",recommended:!0,formats:[G.oas2],severity:D.Error,given:"$",then:{function:Dd}},"no-http-basic":{description:"Consider a more secure alternative to HTTP Basic",message:"HTTP Basic is a pretty insecure way to pass credentials around, please consider an alternative.",given:"$.components.securitySchemes[*]",then:{field:"scheme",function:ne.pattern,functionOptions:{notMatch:"basic"}},severity:D.Error},"no-parameter-named-requestbody":{given:_e.rulesetJsonPaths.ParameterObjectNames,message:`Parameter's are not allowed to have a name that can be camelcased to "requestBody" as it is a reserved keyword for Konfig's TypeScript SDK`,then:{function:bf},severity:D.Error},"duplicate-tag-names":{given:_e.rulesetJsonPaths.Tags,then:{function:df},severity:D.Warning},"no-file-extensions-in-paths":{description:"Paths must not include file extensions such as .json, .xml, .html and .txt",message:"Paths must not include file extensions such as .json, .xml, .html and .txt. Use the OpenAPI `content` keyword to tell consumers which Media Types are available.",given:"$.paths[*]~",then:{function:ne.pattern,functionOptions:{notMatch:".(json|xml|html|txt)$"}},severity:D.Error},"adv-security-schemes-defined":{description:"All APIs MUST have a security scheme defined.",message:"This API definition does not have any security scheme defined.",given:"$..components",then:{field:"securitySchemes",function:ne.schema,functionOptions:{schema:{type:"object",minProperties:1}}},formats:[G.oas3],severity:D.Error},"components-schemas-defined-oas2":{description:"APIs should define definitions for developer friendly SDK generation.",message:"{{description}}",given:"$",then:[{function:ne.schema,functionOptions:{schema:{type:"object",properties:{definitions:{type:"object",minProperties:1}},required:["definitions"]}}}],formats:[G.oas2],severity:D.Warning},[Es.OBJECT_WITH_NO_PROPERTIES_RULE_NAME]:{message:'Schema type of "object" has no properties',given:"#AllSchemaObjects",then:[{function:af}],formats:[G.oas3],severity:D.Hint},"invalid-required-property-syntax":{message:"{{error}}",given:_e.rulesetJsonPaths.AllSchemaObjects.map(r=>`${r}..`),then:[{function:Sf}],severity:D.Warning},"missing-date-format":{message:'Schema type of "string" has no format "date" but has example "{{error}}"',given:_e.rulesetJsonPaths.AllSchemaObjects,then:[{function:wf}],formats:[G.oas3],severity:D.Warning},"missing-date-time-format":{message:'Schema type of "string" has no format "date-time" but has example "{{error}}"',given:_e.rulesetJsonPaths.AllSchemaObjects,then:[{function:_f}],formats:[G.oas3],severity:D.Warning},"missing-2xx-response":{message:'Specify a "default" or "2xx" range HTTP Status Code response',given:_e.rulesetJsonPaths.ResponsesObjects,then:{function:uf},severity:D.Warning},"components-schemas-defined-oas3":{description:"APIs should define schemas for developer friendly SDK generation.",message:"{{description}}",given:"$",then:[{function:ne.schema,functionOptions:{schema:{type:"object",properties:{components:{type:"object",properties:{schemas:{type:"object",minProperties:1}},required:["schemas"]}},required:["components"]}}}],formats:[G.oas3],severity:D.Warning},"adv-security-schemes-defined-oas2":{description:"All APIs MUST have a security scheme defined.",message:"This API definition does not have any security scheme defined.",given:"$",then:{field:"securityDefinitions",function:ne.schema,functionOptions:{schema:{type:"object",minProperties:1}}},formats:[G.oas2],severity:D.Error},"list-usage-of-security":{description:"List usage of security implies multiple possible security strategies which is uncommon",message:"Potential misuse of the security field. Only use list when you have multiple security strategies. (i.e. list vs map is significant https://swagger.io/docs/specification/authentication/)",given:["$.security","$.paths..security"],then:{function:Ao},formats:[G.oas3]},"operation-operationId":{message:"Assign Operation#operationId to create better SDK method names.",given:"#OperationObject",then:{field:"operationId",function:ne.truthy}},"redundant-security-schemes":{message:"Remove redundant security schemes from operation object.",given:"#OperationObject",then:{function:Vo}},"redundant-security-and-parameter":{description:"Duplicate security and request parameters will cause generated SDKs to have undesired behavior.",message:'Detected security requirement and parameter with the same name "{{error}}".',given:"#OperationObject",then:{function:Od},formats:[G.oas2,G.oas3],severity:D.Error},"use-security-instead":{given:"#OperationObject",then:{function:Fd},formats:[G.oas2,G.oas3],severity:D.Warning},[Es.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME]:{message:"{{error}}. Ensure your types are correct.",given:_e.givenPaths[Es.POTENTIAL_INCORRECT_DATA_TYPE_RULE_NAME],then:{function:_d},severity:D.Error},"valid-server-urls-oas3":{message:'"{{value}}" is not a valid URL',given:"$.servers.*.url",then:{function:ne.pattern,functionOptions:{match:Of.urlRegex}},formats:[G.oas3],severity:D.Error},"disallowed-header-names-request":{message:"Konfig's Python SDK does not allow 'Accept', 'Content-Type', or 'Authorization' to be specified as a header in the request",given:_e.rulesetJsonPaths.ParameterObjects,then:[{function:di.disallowedHeaderNamesRequest}],formats:[G.oas2,G.oas3],severity:D.Error},"disallowed-header-names-response":{message:"Konfig's Python SDK does not allow 'Accept', 'Content-Type', or 'Authorization' to be specified as a header in the response",given:_e.rulesetJsonPaths.ResponsesObjectHeaderNames,then:{function:ne.pattern,functionOptions:{notMatch:di.disallowedHeadersRegex}},formats:[G.oas2,G.oas3],severity:D.Error},"limited-oas3_1-support":{message:"Konfig has limited support for OAS 3.1",given:"$.openapi",then:{function:ne.pattern,functionOptions:{notMatch:"^3.1.\\d$"}},formats:[G.oas3],severity:D.Error},"boolean-query-parameter":{message:'There is no standard method of serializing boolean values in query parameters according to RFC 6570 (https://www.rfc-editor.org/rfc/rfc6570). Konfig serializes boolean values as the lowercase string values "true" and "false". Note that this might not necessarily be compatible with your server implementation.',given:_e.rulesetJsonPaths.ParameterObjects,then:{function:hf},severity:D.Information},"multiple-tags":{message:"Having more than 1 tag can be confusing as generated SDKs will only show up under one tag.",given:"#OperationObject.tags",then:{function:ne.length,functionOptions:{min:1,max:1}},severity:D.Warning},"empty-property-name":{given:"#AllSchemaObjects..",message:"Empty property names cause generated SDKs to fail",then:{function:ff},severity:D.Error},"empty-request-body-content":{message:"Empty request body content is not allowed for SDK generation ",given:"#RequestContentObject",then:[{function:ne.length,functionOptions:{min:1}}],severity:D.Error},"empty-response-body-schema":{message:"Provide a response body schema to provide helpful information regarding the operation.",given:"#ResponseContentObject",then:[{field:"schema",function:ne.truthy},{field:"schema",function:ne.length,functionOptions:{min:1}}],severity:D.Warning},"duplicate-schema-name-oas3":{given:"$.components.schemas",then:[{function:So}],severity:D.Error,formats:[G.oas3]},"duplicate-schema-name-oas2":{given:"$.definitions",then:[{function:So}],severity:D.Error,formats:[G.oas2]},"structured-request-body":{given:"#RequestSchemaObject",then:[{function:ef}],severity:D.Warning},"tag-naming-convention":{given:"#Tag.name",then:[{function:Hd}],severity:D.Warning},"operationId-pattern":{message:`The operation ID "{{value}}" does not match the regex: "${Oo.operationIdRegex}". Prefix operation IDs with "Tag_" (https://konfigthis.com/docs/tutorials/naming-operation-ids)`,given:"#OperationObject",then:[{field:"operationId",function:ne.pattern,functionOptions:{match:Oo.operationIdRegex}}],severity:D.Warning}}};0&&(module.exports={}); +module.exports = module.exports.default; +//# sourceMappingURL=ruleset.js.map \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/.spectral.yaml b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.spectral.yaml new file mode 100644 index 0000000000..e5b3d17419 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/.spectral.yaml @@ -0,0 +1,2 @@ +extends: + - .konfig/ruleset.js diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/DarkMode-WhiteLogo.png b/generator/konfig-integration-tests/sdks/swift-leap-workflows/DarkMode-WhiteLogo.png new file mode 100644 index 0000000000..e9306feb8a Binary files /dev/null and b/generator/konfig-integration-tests/sdks/swift-leap-workflows/DarkMode-WhiteLogo.png differ diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/LICENSE b/generator/konfig-integration-tests/sdks/swift-leap-workflows/LICENSE new file mode 100644 index 0000000000..6f78cb8b39 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2024- Konfig, Inc. (https://konfigthis.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/LightMode-BlackLogo.png b/generator/konfig-integration-tests/sdks/swift-leap-workflows/LightMode-BlackLogo.png new file mode 100644 index 0000000000..b3c18ed279 Binary files /dev/null and b/generator/konfig-integration-tests/sdks/swift-leap-workflows/LightMode-BlackLogo.png differ diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/README.md b/generator/konfig-integration-tests/sdks/swift-leap-workflows/README.md new file mode 100644 index 0000000000..dfb8cd6c66 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/README.md @@ -0,0 +1,5 @@ +# konfig + +|Language|Version|Package Manager|README|Source| +|-|-|-|-|-| +|Swift|0.1.0|[CocoaPods](https://cocoapods.org/pods/Leap)|[README](https://github.com/leap-ai/leap-workflows-swift-sdk/tree/HEAD/sdks/swift#readme)|[Source](https://github.com/leap-ai/leap-workflows-swift-sdk/tree/HEAD/sdks/swift)| \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/api-fixed.json b/generator/konfig-integration-tests/sdks/swift-leap-workflows/api-fixed.json new file mode 100644 index 0000000000..119b15dea6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/api-fixed.json @@ -0,0 +1,387 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Leap Workflows API", + "description": "The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests.", + "version": "1.0", + "contact": { + "name": "Leap Support", + "url": "https://tryleap.ai/", + "email": "help@tryleap.ai" + }, + "termsOfService": "https://app.getterms.io/view/dlM8u/tos/en-us" + }, + "servers": [ + { + "description": "Base API Server", + "url": "https://api.workflows.tryleap.ai" + } + ], + "tags": [ + { + "description": "Endpoints related to workflow run operations", + "name": "Workflow Runs" + }, + { + "description": "Endpoints related to bulk workflow run operations", + "name": "Bulk Workflow Runs" + } + ], + "paths": { + "/v1/runs": { + "post": { + "tags": [ + "Workflow Runs" + ], + "summary": "Run a workflow", + "operationId": "run_workflow", + "security": [ + { + "api_key": [ + ] + } + ], + "description": "This endpoint lets the user run a specified workflow with the provided workflow definition.", + "parameters": [ + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunWorkflowSchema" + } + } + } + }, + "responses": { + "200": { + "description": "The workflow has been successfully initiated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + } + } + }, + "/v1/runs/{workflow_run_id}": { + "get": { + "tags": [ + "Workflow Runs" + ], + "summary": "Get a workflow run", + "operationId": "WorkflowRuns_getWorkflowRun", + "security": [ + { + "api_key": [ + ] + } + ], + "description": "This endpoint retrieves the details of a specific workflow run using its `workflow_run_id`.", + "parameters": [ + { + "description": "The ID of the workflow run to retrieve.", + "name": "workflow_run_id", + "required": true, + "in": "path", + "example": "rnp_x3p27VQk6MyJfLe", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The workflow run details have been successfully retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + } + } + }, + "/v1/runs/bulk": { + "post": { + "tags": [ + "Bulk Workflow Runs" + ], + "summary": "Run a workflow in bulk", + "operationId": "BulkWorkflowRuns_runBulk", + "security": [ + { + "api_key": [ + ] + } + ], + "description": "This endpoint lets the user run a specified workflow with the provided csv in bulk.", + "parameters": [ + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunBulkWorkflowSchema" + } + } + } + }, + "responses": { + "200": { + "description": "The bulk workflow run has been successfully initiated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + } + } + }, + "/v1/runs/bulk/{bulk_run_id}": { + "get": { + "tags": [ + "Bulk Workflow Runs" + ], + "summary": "Get a bulk workflow run", + "operationId": "BulkWorkflowRuns_getBulk", + "security": [ + { + "api_key": [ + ] + } + ], + "description": "This endpoint retrieves the details of a specific bulk workflow run using its `bulk_run_id`.", + "parameters": [ + { + "description": "The ID of the bulk run to retrieve.", + "name": "bulk_run_id", + "required": true, + "in": "path", + "example": "bulk_9Nmenl7rxIu2FiSsnqNyTe9G", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The bulk run details have been successfully retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + } + } + } + }, + "components": { + "securitySchemes": { + "api_key": { + "type": "apiKey", + "in": "header", + "name": "X-Api-Key" + } + }, + "schemas": { + "RunWorkflowSchema": { + "type": "object", + "properties": { + "workflow_id": { + "description": "The ID of the workflow to be run.", + "type": "string", + "format": "", + "example": "wkf_i3F5UjpZ2Vg" + }, + "webhook_url": { + "description": "The URL to which the workflow results should be sent to on completion.", + "type": "string", + "example": "https://myapp.com/webhook" + }, + "input": { + "description": "Variables that the workflow can use globally and their values.", + "type": "object", + "additionalProperties": true, + "example": { + "first_name": "Sam", + "last_name": "Altman" + } + } + }, + "required": [ + "workflow_id" + ] + }, + "WorkflowRunSchema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "version_id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "completed", + "running", + "failed", + "queued", + "cancelled" + ] + }, + "created_at": { + "type": "string" + }, + "started_at": { + "type": "string", + "nullable": true, + "default": null + }, + "ended_at": { + "type": "string", + "nullable": true, + "default": null + }, + "workflow_id": { + "type": "string" + }, + "error": { + "type": "string", + "nullable": true, + "default": null + }, + "input": { + "type": "object", + "nullable": true, + "default": null + }, + "output": { + "type": "object", + "nullable": true, + "default": null + } + }, + "required": [ + "id", + "version_id", + "status", + "created_at", + "started_at", + "ended_at", + "workflow_id", + "error", + "input", + "output" + ] + }, + "RunBulkWorkflowSchema": { + "type": "object", + "properties": { + "workflow_id": { + "description": "The ID of the workflow to be run in bulk.", + "type": "string", + "format": "", + "example": "wkf_i3F5UjpZ2Vg" + }, + "input_csv_url": { + "description": "A CSV file containing the input data for the bulk run. Each row should contain the input data for a single run.", + "type": "string", + "format": "", + "example": "https://myapp.com/input.csv" + }, + "webhook_url": { + "description": "The URL to which the bulk run results should be sent to on completion.", + "type": "string", + "example": "https://myapp.com/webhook" + } + }, + "required": [ + "workflow_id", + "input_csv_url" + ] + }, + "BulkRunSchema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "version_id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "completed", + "running", + "failed", + "queued", + "cancelled" + ] + }, + "created_at": { + "type": "string" + }, + "workflow_id": { + "type": "string" + }, + "input_csv_url": { + "type": "string" + }, + "output_csv_url": { + "type": "string", + "nullable": true, + "default": null + }, + "error": { + "type": "string", + "nullable": true, + "default": null + }, + "row_count": { + "type": "number" + } + }, + "required": [ + "id", + "version_id", + "status", + "created_at", + "workflow_id", + "input_csv_url", + "output_csv_url", + "error", + "row_count" + ] + } + } + } +} \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/api.json b/generator/konfig-integration-tests/sdks/swift-leap-workflows/api.json new file mode 100644 index 0000000000..b166f80e12 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/api.json @@ -0,0 +1,381 @@ +{ + "openapi": "3.0.0", + "paths": { + "/v1/runs": { + "post": { + "operationId": "run_workflow", + "summary": "Run a workflow", + "description": "This endpoint lets the user run a specified workflow with the provided workflow definition.", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunWorkflowSchema" + } + } + } + }, + "responses": { + "200": { + "description": "The workflow has been successfully initiated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + }, + "tags": [ + "Workflow Runs" + ], + "security": [ + { + "api_key": [] + } + ] + } + }, + "/v1/runs/{workflow_run_id}": { + "get": { + "operationId": "get_workflow_run", + "summary": "Get a workflow run", + "description": "This endpoint retrieves the details of a specific workflow run using its `workflow_run_id`.", + "parameters": [ + { + "name": "workflow_run_id", + "required": true, + "in": "path", + "description": "The ID of the workflow run to retrieve.", + "example": "rnp_x3p27VQk6MyJfLe", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The workflow run details have been successfully retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + }, + "tags": [ + "Workflow Runs" + ], + "security": [ + { + "api_key": [] + } + ] + } + }, + "/v1/runs/bulk": { + "post": { + "operationId": "bulk_run_workflow", + "summary": "Run a workflow in bulk", + "description": "This endpoint lets the user run a specified workflow with the provided csv in bulk.", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunBulkWorkflowSchema" + } + } + } + }, + "responses": { + "200": { + "description": "The bulk workflow run has been successfully initiated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + }, + "tags": [ + "Bulk Workflow Runs" + ], + "security": [ + { + "api_key": [] + } + ] + } + }, + "/v1/runs/bulk/{bulk_run_id}": { + "get": { + "operationId": "get_bulk_workflow_run", + "summary": "Get a bulk workflow run", + "description": "This endpoint retrieves the details of a specific bulk workflow run using its `bulk_run_id`.", + "parameters": [ + { + "name": "bulk_run_id", + "required": true, + "in": "path", + "description": "The ID of the bulk run to retrieve.", + "example": "bulk_9Nmenl7rxIu2FiSsnqNyTe9G", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The bulk run details have been successfully retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkRunSchema" + } + } + } + }, + "401": { + "description": "Unauthorized." + } + }, + "tags": [ + "Bulk Workflow Runs" + ], + "security": [ + { + "api_key": [] + } + ] + } + } + }, + "info": { + "title": "Leap Workflows API", + "description": "The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests.", + "version": "1.0", + "contact": { + "name": "Leap Support", + "url": "https://tryleap.ai/", + "email": "help@tryleap.ai" + }, + "termsOfService": "https://app.getterms.io/view/dlM8u/tos/en-us" + }, + "tags": [ + { + "name": "Workflow Runs", + "description": "Endpoints related to workflow run operations" + }, + { + "name": "Bulk Workflow Runs", + "description": "Endpoints related to bulk workflow run operations" + } + ], + "servers": [ + { + "url": "https://api.workflows.tryleap.ai/", + "description": "Base API Server" + } + ], + "components": { + "securitySchemes": { + "api_key": { + "type": "apiKey", + "in": "header", + "name": "X-Api-Key" + } + }, + "schemas": { + "RunWorkflowSchema": { + "type": "object", + "properties": { + "workflow_id": { + "type": "string", + "format": "", + "description": "The ID of the workflow to be run.", + "example": "wkf_i3F5UjpZ2Vg" + }, + "webhook_url": { + "type": "string", + "description": "The URL to which the workflow results should be sent to on completion.", + "example": "https://myapp.com/webhook" + }, + "input": { + "type": "object", + "additionalProperties": true, + "description": "Variables that the workflow can use globally and their values.", + "example": { + "first_name": "Sam", + "last_name": "Altman" + } + } + }, + "required": [ + "workflow_id" + ] + }, + "WorkflowRunSchema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "version_id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "completed", + "running", + "failed", + "queued", + "cancelled" + ] + }, + "created_at": { + "type": "string" + }, + "started_at": { + "type": "string", + "nullable": true, + "default": null + }, + "ended_at": { + "type": "string", + "nullable": true, + "default": null + }, + "workflow_id": { + "type": "string" + }, + "error": { + "type": "string", + "nullable": true, + "default": null + }, + "input": { + "type": "object", + "nullable": true, + "default": null + }, + "output": { + "type": "object", + "nullable": true, + "default": null + } + }, + "required": [ + "id", + "version_id", + "status", + "created_at", + "started_at", + "ended_at", + "workflow_id", + "error", + "input", + "output" + ] + }, + "RunBulkWorkflowSchema": { + "type": "object", + "properties": { + "workflow_id": { + "type": "string", + "format": "", + "description": "The ID of the workflow to be run in bulk.", + "example": "wkf_i3F5UjpZ2Vg" + }, + "input_csv_url": { + "type": "string", + "format": "", + "description": "A CSV file containing the input data for the bulk run. Each row should contain the input data for a single run.", + "example": "https://myapp.com/input.csv" + }, + "webhook_url": { + "type": "string", + "description": "The URL to which the bulk run results should be sent to on completion.", + "example": "https://myapp.com/webhook" + } + }, + "required": [ + "workflow_id", + "input_csv_url" + ] + }, + "BulkRunSchema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "version_id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "completed", + "running", + "failed", + "queued", + "cancelled" + ] + }, + "created_at": { + "type": "string" + }, + "workflow_id": { + "type": "string" + }, + "input_csv_url": { + "type": "string" + }, + "output_csv_url": { + "type": "string", + "nullable": true, + "default": null + }, + "error": { + "type": "string", + "nullable": true, + "default": null + }, + "row_count": { + "type": "number" + } + }, + "required": [ + "id", + "version_id", + "status", + "created_at", + "workflow_id", + "input_csv_url", + "output_csv_url", + "error", + "row_count" + ] + } + } + } +} \ No newline at end of file diff --git "a/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/.gitbook/assets/Screenshot 2023-12-30 at 1.22.13\342\200\257PM.png" "b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/.gitbook/assets/Screenshot 2023-12-30 at 1.22.13\342\200\257PM.png" new file mode 100644 index 0000000000..13ede3d44d Binary files /dev/null and "b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/.gitbook/assets/Screenshot 2023-12-30 at 1.22.13\342\200\257PM.png" differ diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/README.md b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/README.md new file mode 100644 index 0000000000..af22aaacd8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/README.md @@ -0,0 +1,52 @@ +# Workflows API + +This document outlines how to call the new Leap workflows API. + +## Authenticating Your Account + +To access workflows, you first need to set up an account at `https://app.tryleap.ai` and generate an API key. This API key must be included in your request header under the `X-Api-Key` key to authenticate your account. + +## Initiating a Workflow + +Workflows can be initiated by calling the run method in the SDK, or sending a `POST` request to the following endpoint: + +```text copy +https://api.workflows.tryleap.ai/v1/runs +``` + +Your request body must include the following; + +```json copy +{ + "workflow_id": "123", // Unique ID of the workflow you want to run + "webhook_url": "", // Optional: The URL to receive notifications of workflow completion or failure + "inputs": { + "foo": "bar" // Inputs you want to pass to the workflow + } +} +``` + +## Understanding the Workflow Run Object + +Once a workflow is initiated, the API will immediately respond with a Workflow Run object. + +If you've specified a `webhook_url` when submitting your run, this object will also be sent in the body of a `POST` request once the workflow has completed or failed. + +```typescript copy +{ + "id": string; // Unique ID of the workflow run + "version_id": string; // Version of the workflow being run + "status": "completed" | "running" | "failed"; // Current status of the workflow + "created_at": string; // Date and time when the workflow was initiated + "started_at": string | null; // Date and time when the workflow actually started, if applicable + "ended_at": string | null; // Date and time when the workflow ended, if applicable + "workflow_id": string; // ID of the workflow + "error": string | null; // Any error that occurred during the workflow, or null if the workflow completed successfully + "input": { // Inputs used in the workflow + [key: string]: any; + }, + "output": unknown | null; // Output of the workflow, or null if the workflow failed +} +``` + +This document should help you navigate and access Leap's new workflows. Feel free to contact us if you encounter issues or have additional questions. \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/SUMMARY.md b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/SUMMARY.md new file mode 100644 index 0000000000..943e53b37c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/SUMMARY.md @@ -0,0 +1,5 @@ +# Table of contents + +* [Workflows API](README.md) +* [Leap Services](leap-services.md) +* [πŸ”— Webhooks](webhooks.md) diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/script.html b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/script.html new file mode 100644 index 0000000000..3d6f69a78d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/script.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/webhooks.md b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/webhooks.md new file mode 100644 index 0000000000..b62d7d4d46 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/docs/webhooks.md @@ -0,0 +1,73 @@ +# Webhooks + +Leap workflows currently supports two versions of webhooks, with v2 being the latest. + +### Version 2 (latest) + +Our v2 webhooks support defining your own output schema. + +This means that when catching a webhook response, the `output` object shape will match the outputs that you configure inside of your workflow. + + + +#### **Successful Run Example** + +```json +{ + "id": "rnp_OegyoGJxj9lyk4xbtQ", + "version_id": "vsp_shsgJaeiT1d8H9", + "status": "completed", + "created_at": "2023-12-30T19:35:10.428941+00:00", + "started_at": "2023-12-30T19:35:12.028968+00:00", + "ended_at": "2023-12-30T19:35:20.872681+00:00", + "workflow_id": "wkf_RL2LDs8LNO4LI6", + "error": null, + "input": { + "prompt": "8k portrait of a beatiful tuxedo cat sleeping on a bed, realistic, unlreal engine 5" + }, + "output": { + "imageUrl": ".../-PXO4eirXsolvofZLy-uo.jpeg" + } +} +``` + +#### **Failed Run Example:** + +```json +{ + "id": "rnp_dqsrbuAvpOIw1h48G2", + "version_id": "vsp_vZhmfFZnF0Avb1", + "status": "failed", + "created_at": "2023-12-30T21:49:26.994177+00:00", + "started_at": "2023-12-30T21:49:28.366564+00:00", + "ended_at": null, + "workflow_id": "wkf_RL2LDs8LNO4LI6", + "error": "Variable 'proompt' not found. Available variables to use:\nproompt", + "input": { + "prompt": "8k portrait of a beatiful tuxedo cat sleeping on a bed, realistic, unlreal engine 5" + }, + "output": null +} +``` + + + +### Version 1 + +If you created your workflow before Dec 30 2023, your workflow is likely set to still use the v1 schema for webhooks. + +In this version, the `output` object will contain the entire workflow context. This is often very verbose and can be hard to work with as it contains the full output of every step. + +It is recommended that you upgrade to webhooks version 2. + +#### Checking or Setting Webhook Version + +Webhook versions are set per Workflow. This means you can have different Workflows using different versions and is something we do for backwards compatibility as we roll out changes to the webhook schema. + +You can view your Workflow's active webhook version or upgrade it to a newer version by visiting the Webhook Settings page. + + +
+ + + diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/favicon.jpg b/generator/konfig-integration-tests/sdks/swift-leap-workflows/favicon.jpg new file mode 100644 index 0000000000..da7fb06e42 Binary files /dev/null and b/generator/konfig-integration-tests/sdks/swift-leap-workflows/favicon.jpg differ diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/header.png b/generator/konfig-integration-tests/sdks/swift-leap-workflows/header.png new file mode 100644 index 0000000000..4023a97cc0 Binary files /dev/null and b/generator/konfig-integration-tests/sdks/swift-leap-workflows/header.png differ diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/konfig.yaml b/generator/konfig-integration-tests/sdks/swift-leap-workflows/konfig.yaml new file mode 100644 index 0000000000..b1ea933b6c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/konfig.yaml @@ -0,0 +1,38 @@ +# yaml-language-server: $schema=https://unpkg.com/konfig-lib@latest/konfig-yaml.schema.json + +outputDirectory: /tmp/leap-workflows-sdks-out +specRemotePath: https://api.workflows.tryleap.ai/api-json +specPath: api-fixed.json +specInputPath: api.json +readmeHeader: + image: header.png + title: Leap Workflows + url: https://www.tryleap.ai/ +portal: + favicon: favicon.jpg + primaryColor: '#008ae6' + title: Leap + logo: + light: LightMode-BlackLogo.png + dark: DarkMode-WhiteLogo.png + customSnippet: docs/script.html + documentation: + sidebar: + sections: + - label: Documentation + links: + - id: introduction + path: docs/README.md + - id: webhooks + path: docs/webhooks.md + socials: + website: https://tryleap.ai/ +generators: + swift: + version: 0.1.0 + projectName: Leap + podAuthors: tryleap.ai + outputDirectory: sdks/swift + git: + userId: leap-ai + repoId: leap-workflows-swift-sdk \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.gitignore b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.gitignore new file mode 100644 index 0000000000..259f106714 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.gitignore @@ -0,0 +1,122 @@ +# Created by https://www.toptal.com/developers/gitignore/api/swift,xcode +# Edit at https://www.toptal.com/developers/gitignore?templates=swift,xcode + +### Swift ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +# .swiftpm + +.build/ + +# CocoaPods +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# Pods/ +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Add this lines if you are using Accio dependency management (Deprecated since Xcode 12) +# Dependencies/ +# .accio/ + +# fastlane +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ + +### Xcode ### +# Xcode +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + + + + +## Gcc Patch +/*.gcno + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +**/xcshareddata/WorkspaceSettings.xcsettings + +# End of https://www.toptal.com/developers/gitignore/api/swift,xcode + +# From VSCode Swift Extension +Package.resolved + +# Created by https://www.toptal.com/developers/gitignore/api/cocoapods +# Edit at https://www.toptal.com/developers/gitignore?templates=cocoapods + +### CocoaPods ### +## CocoaPods GitIgnore Template + +# CocoaPods - Only use to conserve bandwidth / Save time on Pushing +# - Also handy if you have a large number of dependant pods +# - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE +Pods/ + +# End of https://www.toptal.com/developers/gitignore/api/cocoapods +.DS_Store \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.konfigignore b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.konfigignore new file mode 100644 index 0000000000..1c33484ea7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.konfigignore @@ -0,0 +1 @@ +Tests/SimpleTest.swift \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.swiftformat b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.swiftformat new file mode 100644 index 0000000000..11e78b37d5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/.swiftformat @@ -0,0 +1,45 @@ +# This file is auto-generated by Konfig: https://konfigthis.com +# +# For rules on SwiftFormat, please refer to https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md +# +# file options + +# uncomment below to exclude files, folders +#--exclude path/to/test1.swift,Snapshots,Build + +# format options + +--allman false +--binarygrouping 4,8 +--commas always +--comments indent +--decimalgrouping 3,6 +--elseposition same-line +--empty void +--exponentcase lowercase +--exponentgrouping disabled +--fractiongrouping disabled +--header ignore +--hexgrouping 4,8 +--hexliteralcase uppercase +--ifdef indent +--indent 4 +--indentcase false +--importgrouping testable-bottom +--linebreaks lf +--maxwidth none +--octalgrouping 4,8 +--operatorfunc spaced +--patternlet hoist +--ranges spaced +--self remove +--semicolons inline +--stripunusedargs always +--swiftversion 5.4 +--trimwhitespace always +--wraparguments preserve +--wrapcollections preserve + +# rules + +--enable isEmpty diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Cartfile b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Cartfile new file mode 100644 index 0000000000..df864d3e26 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Cartfile @@ -0,0 +1 @@ +github "konfig-dev/AnyCodable" ~> 0.6.9 diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/LICENSE b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/LICENSE new file mode 100644 index 0000000000..6f78cb8b39 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2024- Konfig, Inc. (https://konfigthis.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap.podspec b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap.podspec new file mode 100644 index 0000000000..07f2912109 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap.podspec @@ -0,0 +1,16 @@ +Pod::Spec.new do |s| + s.name = 'Leap' + s.swift_version = '5.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '13.0' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '4.0' + s.version = '0.1.0' + s.source = { :git => 'https://github.com/leap-ai/leap-workflows-swift-sdk.git', :tag => 'v0.1.0' } + s.authors = 'tryleap.ai' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.homepage = 'https://github.com/leap-ai/leap-workflows-swift-sdk' + s.summary = 'Leap Swift SDK' + s.source_files = 'Leap/**/*.swift' + s.dependency 'AnyCodable-Konfig', '~> 0.6.9' +end diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIHelper.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIHelper.swift new file mode 100644 index 0000000000..05c1984e2a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIHelper.swift @@ -0,0 +1,122 @@ +// APIHelper.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation + +public struct APIHelper { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { + let destination = source.reduce(into: [String: Any]()) { result, item in + if let value = item.value { + result[item.key] = value + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { + return source.reduce(into: [String: String]()) { result, item in + if let collection = item.value as? [Any?] { + result[item.key] = collection + .compactMap { value in + guard let value = value else { return nil } + return "\(value)" + } + .joined(separator: ",") + } else if let value: Any = item.value { + result[item.key] = "\(value)" + } + } + } + + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { + guard let source = source else { + return nil + } + + return source.reduce(into: [String: Any]()) { result, item in + switch item.value { + case let x as Bool: + result[item.key] = x.description + default: + result[item.key] = item.value + } + } + } + + public static func mapValueToPathItem(_ source: Any) -> Any { + if let collection = source as? [Any?] { + return collection + .compactMap { value in + guard let value = value else { return nil } + return "\(value)" + } + .joined(separator: ",") + } + return source + } + + /// maps all values from source to query parameters + /// + /// explode attribute is respected: collection values might be either joined or split up into seperate key value pairs + public static func mapValuesToQueryItems(_ source: [String: (wrappedValue: Any?, isExplode: Bool)]) -> [URLQueryItem]? { + let destination = source.filter { $0.value.wrappedValue != nil }.reduce(into: [URLQueryItem]()) { result, item in + if let collection = item.value.wrappedValue as? [Any?] { + + let collectionValues: [String] = collection.compactMap { value in + guard let value = value else { return nil } + return "\(value)" + } + + if !item.value.isExplode { + result.append(URLQueryItem(name: item.key, value: collectionValues.joined(separator: ","))) + } else { + collectionValues + .forEach { value in + result.append(URLQueryItem(name: item.key, value: value)) + } + } + + } else if let value = item.value.wrappedValue { + result.append(URLQueryItem(name: item.key, value: "\(value)")) + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + /// maps all values from source to query parameters + /// + /// collection values are always exploded + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { + let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in + if let collection = item.value as? [Any?] { + collection + .compactMap { value in + guard let value = value else { return nil } + return "\(value)" + } + .forEach { value in + result.append(URLQueryItem(name: item.key, value: value)) + } + + } else if let value = item.value { + result.append(URLQueryItem(name: item.key, value: "\(value)")) + } + } + + if destination.isEmpty { + return nil + } + return destination + } +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs.swift new file mode 100644 index 0000000000..ca83b72e12 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs.swift @@ -0,0 +1,71 @@ +// APIs.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +open class LeapAPI { + public static var basePath = "https://api.workflows.tryleap.ai" + public static var customHeaders: [String: String] = [:] + public static var credential: URLCredential? + public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main + public static var apiKey: String?; +} + +open class RequestBuilder { + var credential: URLCredential? + var headers: [String: String] + public let parameters: [String: Any]? + public let method: String + public let URLString: String + public let requestTask: RequestTask = RequestTask() + public let requiresAuthentication: Bool + + /// Optional block to obtain a reference to the request's progress instance when available. + /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. + /// If you need to get the request's progress in older OS versions, please use Alamofire http client. + public var onProgressReady: ((Progress) -> Void)? + + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) { + self.method = method + self.URLString = URLString + self.parameters = parameters + self.headers = headers + self.requiresAuthentication = requiresAuthentication + + addHeaders(LeapAPI.customHeaders) + } + + open func addHeaders(_ aHeaders: [String: String]) { + for (header, value) in aHeaders { + headers[header] = value + } + } + + @discardableResult + open func execute(_ apiResponseQueue: DispatchQueue = LeapAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask + } + + public func addHeader(name: String, value: String) -> Self { + if !value.isEmpty { + headers[name] = value + } + return self + } + + open func addCredential() -> Self { + credential = LeapAPI.credential + return self + } +} + +public protocol RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type + func getBuilder() -> RequestBuilder.Type +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs/BulkWorkflowRunsAPI.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs/BulkWorkflowRunsAPI.swift new file mode 100644 index 0000000000..a257d268e4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs/BulkWorkflowRunsAPI.swift @@ -0,0 +1,368 @@ +// +// BulkWorkflowRunsAPI.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(AnyCodable) +import AnyCodable +#endif + +open class BulkWorkflowRunsAPI { + + let client: LeapClient + + public init(client: LeapClient) { + self.client = client + } + + /** + Get a bulk workflow run + + - parameter bulkRunId: (path) The ID of the bulk run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func getBulkSync(bulkRunId: String, apiResponseQueue: DispatchQueue = LeapAPI.apiResponseQueue, completion: @escaping ((_ data: BulkRunSchema?, _ error: Error?) -> Void)) -> RequestTask { + return getBulkWithRequestBuilder(bulkRunId: bulkRunId).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Get a bulk workflow run + + - parameter bulkRunId: (path) The ID of the bulk run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + private class func getBulkAsyncMappedParams(bulkRunId: String) async throws -> BulkRunSchema { + return try await withCheckedThrowingContinuation { continuation in + getBulkWithRequestBuilder(bulkRunId: bulkRunId).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + /** + Get a bulk workflow run + + - parameter bulkRunId: (path) The ID of the bulk run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open class func getBulk( + bulkRunId: String + ) async throws -> BulkRunSchema { + return try await withCheckedThrowingContinuation { continuation in + getBulkWithRequestBuilder(bulkRunId: bulkRunId).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + /** + Get a bulk workflow run + + - parameter bulkRunId: (path) The ID of the bulk run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open func getBulk( + bulkRunId: String + ) async throws -> BulkRunSchema { + return try await withCheckedThrowingContinuation { continuation in + getBulkWithRequestBuilder(bulkRunId: bulkRunId).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + + /** + Get a bulk workflow run + - GET /v1/runs/bulk/{bulk_run_id} + - This endpoint retrieves the details of a specific bulk workflow run using its `bulk_run_id`. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter bulkRunId: (path) The ID of the bulk run to retrieve. + - returns: RequestBuilder + */ + open class func getBulkWithRequestBuilder( + bulkRunId: String + ) -> RequestBuilder { + let basePath = LeapAPI.basePath; + var localVariablePath = "/v1/runs/bulk/{bulk_run_id}" + let bulkRunIdPreEscape = "\(APIHelper.mapValueToPathItem(bulkRunId))" + let bulkRunIdPostEscape = bulkRunIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{bulk_run_id}", with: bulkRunIdPostEscape, options: .literal, range: nil) + let localVariableURLString = basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: LeapAPI.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "GET", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to GET /v1/runs/bulk/{bulk_run_id}") + } + + /** + Get a bulk workflow run + - GET /v1/runs/bulk/{bulk_run_id} + - This endpoint retrieves the details of a specific bulk workflow run using its `bulk_run_id`. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter bulkRunId: (path) The ID of the bulk run to retrieve. + - returns: RequestBuilder + */ + open func getBulkWithRequestBuilder( + bulkRunId: String + ) -> RequestBuilder { + let basePath = self.client.basePath; + var localVariablePath = "/v1/runs/bulk/{bulk_run_id}" + let bulkRunIdPreEscape = "\(APIHelper.mapValueToPathItem(bulkRunId))" + let bulkRunIdPostEscape = bulkRunIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{bulk_run_id}", with: bulkRunIdPostEscape, options: .literal, range: nil) + let localVariableURLString = basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: self.client.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "GET", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to GET /v1/runs/bulk/{bulk_run_id}") + } + + + /** + Run a workflow in bulk + + - parameter runBulkWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func runBulkSync(runBulkWorkflowSchema: RunBulkWorkflowSchema, apiResponseQueue: DispatchQueue = LeapAPI.apiResponseQueue, completion: @escaping ((_ data: BulkRunSchema?, _ error: Error?) -> Void)) -> RequestTask { + return runBulkWithRequestBuilder(runBulkWorkflowSchema: runBulkWorkflowSchema).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Run a workflow in bulk + + - parameter runBulkWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + private class func runBulkAsyncMappedParams(runBulkWorkflowSchema: RunBulkWorkflowSchema) async throws -> BulkRunSchema { + return try await withCheckedThrowingContinuation { continuation in + runBulkWithRequestBuilder(runBulkWorkflowSchema: runBulkWorkflowSchema).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + /** + Run a workflow in bulk + + - parameter runBulkWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open class func runBulk( + workflowId: String, + inputCsvUrl: String, + webhookUrl: String? = nil + ) async throws -> BulkRunSchema { + let runBulkWorkflowSchema = RunBulkWorkflowSchema( + workflowId: workflowId, + inputCsvUrl: inputCsvUrl, + webhookUrl: webhookUrl + ) + return try await withCheckedThrowingContinuation { continuation in + runBulkWithRequestBuilder(runBulkWorkflowSchema: runBulkWorkflowSchema).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + /** + Run a workflow in bulk + + - parameter runBulkWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open func runBulk( + workflowId: String, + inputCsvUrl: String, + webhookUrl: String? = nil + ) async throws -> BulkRunSchema { + let runBulkWorkflowSchema = RunBulkWorkflowSchema( + workflowId: workflowId, + inputCsvUrl: inputCsvUrl, + webhookUrl: webhookUrl + ) + return try await withCheckedThrowingContinuation { continuation in + runBulkWithRequestBuilder(runBulkWorkflowSchema: runBulkWorkflowSchema).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + + /** + Run a workflow in bulk + - POST /v1/runs/bulk + - This endpoint lets the user run a specified workflow with the provided csv in bulk. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter runBulkWorkflowSchema: (body) + - returns: RequestBuilder + */ + open class func runBulkWithRequestBuilder( + runBulkWorkflowSchema: RunBulkWorkflowSchema + ) -> RequestBuilder { + let basePath = LeapAPI.basePath; + let localVariablePath = "/v1/runs/bulk" + let localVariableURLString = basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: runBulkWorkflowSchema) + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: LeapAPI.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "POST", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to POST /v1/runs/bulk") + } + + /** + Run a workflow in bulk + - POST /v1/runs/bulk + - This endpoint lets the user run a specified workflow with the provided csv in bulk. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter runBulkWorkflowSchema: (body) + - returns: RequestBuilder + */ + open func runBulkWithRequestBuilder( + runBulkWorkflowSchema: RunBulkWorkflowSchema + ) -> RequestBuilder { + let basePath = self.client.basePath; + let localVariablePath = "/v1/runs/bulk" + let localVariableURLString = basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: runBulkWorkflowSchema) + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: self.client.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "POST", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to POST /v1/runs/bulk") + } + +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs/WorkflowRunsAPI.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs/WorkflowRunsAPI.swift new file mode 100644 index 0000000000..1f27949e9b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/APIs/WorkflowRunsAPI.swift @@ -0,0 +1,368 @@ +// +// WorkflowRunsAPI.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(AnyCodable) +import AnyCodable +#endif + +open class WorkflowRunsAPI { + + let client: LeapClient + + public init(client: LeapClient) { + self.client = client + } + + /** + Get a workflow run + + - parameter workflowRunId: (path) The ID of the workflow run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func getWorkflowRunSync(workflowRunId: String, apiResponseQueue: DispatchQueue = LeapAPI.apiResponseQueue, completion: @escaping ((_ data: WorkflowRunSchema?, _ error: Error?) -> Void)) -> RequestTask { + return getWorkflowRunWithRequestBuilder(workflowRunId: workflowRunId).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Get a workflow run + + - parameter workflowRunId: (path) The ID of the workflow run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + private class func getWorkflowRunAsyncMappedParams(workflowRunId: String) async throws -> WorkflowRunSchema { + return try await withCheckedThrowingContinuation { continuation in + getWorkflowRunWithRequestBuilder(workflowRunId: workflowRunId).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + /** + Get a workflow run + + - parameter workflowRunId: (path) The ID of the workflow run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open class func getWorkflowRun( + workflowRunId: String + ) async throws -> WorkflowRunSchema { + return try await withCheckedThrowingContinuation { continuation in + getWorkflowRunWithRequestBuilder(workflowRunId: workflowRunId).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + /** + Get a workflow run + + - parameter workflowRunId: (path) The ID of the workflow run to retrieve. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open func getWorkflowRun( + workflowRunId: String + ) async throws -> WorkflowRunSchema { + return try await withCheckedThrowingContinuation { continuation in + getWorkflowRunWithRequestBuilder(workflowRunId: workflowRunId).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + + /** + Get a workflow run + - GET /v1/runs/{workflow_run_id} + - This endpoint retrieves the details of a specific workflow run using its `workflow_run_id`. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter workflowRunId: (path) The ID of the workflow run to retrieve. + - returns: RequestBuilder + */ + open class func getWorkflowRunWithRequestBuilder( + workflowRunId: String + ) -> RequestBuilder { + let basePath = LeapAPI.basePath; + var localVariablePath = "/v1/runs/{workflow_run_id}" + let workflowRunIdPreEscape = "\(APIHelper.mapValueToPathItem(workflowRunId))" + let workflowRunIdPostEscape = workflowRunIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{workflow_run_id}", with: workflowRunIdPostEscape, options: .literal, range: nil) + let localVariableURLString = basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: LeapAPI.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "GET", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to GET /v1/runs/{workflow_run_id}") + } + + /** + Get a workflow run + - GET /v1/runs/{workflow_run_id} + - This endpoint retrieves the details of a specific workflow run using its `workflow_run_id`. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter workflowRunId: (path) The ID of the workflow run to retrieve. + - returns: RequestBuilder + */ + open func getWorkflowRunWithRequestBuilder( + workflowRunId: String + ) -> RequestBuilder { + let basePath = self.client.basePath; + var localVariablePath = "/v1/runs/{workflow_run_id}" + let workflowRunIdPreEscape = "\(APIHelper.mapValueToPathItem(workflowRunId))" + let workflowRunIdPostEscape = workflowRunIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{workflow_run_id}", with: workflowRunIdPostEscape, options: .literal, range: nil) + let localVariableURLString = basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: self.client.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "GET", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to GET /v1/runs/{workflow_run_id}") + } + + + /** + Run a workflow + + - parameter runWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func workflowSync(runWorkflowSchema: RunWorkflowSchema, apiResponseQueue: DispatchQueue = LeapAPI.apiResponseQueue, completion: @escaping ((_ data: WorkflowRunSchema?, _ error: Error?) -> Void)) -> RequestTask { + return workflowWithRequestBuilder(runWorkflowSchema: runWorkflowSchema).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Run a workflow + + - parameter runWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + private class func workflowAsyncMappedParams(runWorkflowSchema: RunWorkflowSchema) async throws -> WorkflowRunSchema { + return try await withCheckedThrowingContinuation { continuation in + workflowWithRequestBuilder(runWorkflowSchema: runWorkflowSchema).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + /** + Run a workflow + + - parameter runWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open class func workflow( + workflowId: String, + webhookUrl: String? = nil, + input: [String: AnyCodable]? = nil + ) async throws -> WorkflowRunSchema { + let runWorkflowSchema = RunWorkflowSchema( + workflowId: workflowId, + webhookUrl: webhookUrl, + input: input + ) + return try await withCheckedThrowingContinuation { continuation in + workflowWithRequestBuilder(runWorkflowSchema: runWorkflowSchema).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + /** + Run a workflow + + - parameter runWorkflowSchema: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + open func workflow( + workflowId: String, + webhookUrl: String? = nil, + input: [String: AnyCodable]? = nil + ) async throws -> WorkflowRunSchema { + let runWorkflowSchema = RunWorkflowSchema( + workflowId: workflowId, + webhookUrl: webhookUrl, + input: input + ) + return try await withCheckedThrowingContinuation { continuation in + workflowWithRequestBuilder(runWorkflowSchema: runWorkflowSchema).execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response.body) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } + + + + /** + Run a workflow + - POST /v1/runs + - This endpoint lets the user run a specified workflow with the provided workflow definition. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter runWorkflowSchema: (body) + - returns: RequestBuilder + */ + open class func workflowWithRequestBuilder( + runWorkflowSchema: RunWorkflowSchema + ) -> RequestBuilder { + let basePath = LeapAPI.basePath; + let localVariablePath = "/v1/runs" + let localVariableURLString = basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: runWorkflowSchema) + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: LeapAPI.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "POST", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to POST /v1/runs") + } + + /** + Run a workflow + - POST /v1/runs + - This endpoint lets the user run a specified workflow with the provided workflow definition. + - API Key: + - type: apiKey X-Api-Key + - name: api_key + - parameter runWorkflowSchema: (body) + - returns: RequestBuilder + */ + open func workflowWithRequestBuilder( + runWorkflowSchema: RunWorkflowSchema + ) -> RequestBuilder { + let basePath = self.client.basePath; + let localVariablePath = "/v1/runs" + let localVariableURLString = basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: runWorkflowSchema) + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + var localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + do { + try Authentication.setAuthenticationParameters(headers: &localVariableHeaderParameters, url: &localVariableUrlComponents, in: "header", name: "X-Api-Key", value: self.client.apiKey, prefix: nil) + let localVariableRequestBuilder: RequestBuilder.Type = LeapAPI.requestBuilderFactory.getBuilder() + let URLString = localVariableUrlComponents?.string ?? localVariableURLString + return localVariableRequestBuilder.init(method: "POST", URLString: URLString, parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } catch { + print("Error: \(error)") + } + fatalError("Error: Unable to send request to POST /v1/runs") + } + +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Authentication.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Authentication.swift new file mode 100644 index 0000000000..ccc54d6eea --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Authentication.swift @@ -0,0 +1,41 @@ +import Foundation + +class Authentication { + /// Sets the authentication parameters based on the specified location. + /// + /// - Parameters: + /// - headers: The headers dictionary to update. + /// - url: The URL components to update. + /// - location: The location where the authentication parameter should be set. Valid values are "query", "path", and "header". + /// - name: The name of the authentication parameter. + /// - value: The value of the authentication parameter. + /// - prefix: The prefix to use for the authentication parameter. + /// - Returns: The modified headers and URL components. + static func setAuthenticationParameters(headers: inout [String: String], url: inout URLComponents?, in location: String, name: String, value: String?, prefix: String?) throws { + guard value != nil, !(value?.isEmpty ?? true) else { + return // Sometimes there are multiple security schemes, and unused schemes may have an empty value + } + + guard url != nil else { + throw NSError(domain: "AuthenticationError", code: 0, userInfo: [NSLocalizedDescriptionKey: "URL is empty"]) + } + + let finalValue = prefix != nil ? "\(prefix!)\(value!)" : value! + + switch location { + case "query": + if url?.queryItems == nil { + url?.queryItems = [] + } + url?.queryItems?.append(URLQueryItem(name: name, value: finalValue)) + case "path": + // Assuming the path component is "/path/{name}/" + let updatedPath = url?.path.replacingOccurrences(of: "{\(name)}", with: finalValue) + url?.path = updatedPath! + case "header": + headers[name] = finalValue + default: + break + } + } +} \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/CodableHelper.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/CodableHelper.swift new file mode 100644 index 0000000000..1ca84a5293 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/CodableHelper.swift @@ -0,0 +1,49 @@ +// +// CodableHelper.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation + +open class CodableHelper { + private static var customDateFormatter: DateFormatter? + private static var defaultDateFormatter: DateFormatter = OpenISO8601DateFormatter() + + private static var customJSONDecoder: JSONDecoder? + private static var defaultJSONDecoder: JSONDecoder = { + let decoder = JSONDecoder() + decoder.dateDecodingStrategy = .formatted(CodableHelper.dateFormatter) + return decoder + }() + + private static var customJSONEncoder: JSONEncoder? + private static var defaultJSONEncoder: JSONEncoder = { + let encoder = JSONEncoder() + encoder.dateEncodingStrategy = .formatted(CodableHelper.dateFormatter) + encoder.outputFormatting = .prettyPrinted + return encoder + }() + + public static var dateFormatter: DateFormatter { + get { return customDateFormatter ?? defaultDateFormatter } + set { customDateFormatter = newValue } + } + public static var jsonDecoder: JSONDecoder { + get { return customJSONDecoder ?? defaultJSONDecoder } + set { customJSONDecoder = newValue } + } + public static var jsonEncoder: JSONEncoder { + get { return customJSONEncoder ?? defaultJSONEncoder } + set { customJSONEncoder = newValue } + } + + open class func decode(_ type: T.Type, from data: Data) -> Swift.Result where T: Decodable { + return Swift.Result { try jsonDecoder.decode(type, from: data) } + } + + open class func encode(_ value: T) -> Swift.Result where T: Encodable { + return Swift.Result { try jsonEncoder.encode(value) } + } +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Configuration.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Configuration.swift new file mode 100644 index 0000000000..7fc0d0e1ec --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Configuration.swift @@ -0,0 +1,19 @@ +// Configuration.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation + +open class Configuration { + + // This value is used to configure the date formatter that is used to serialize dates into JSON format. + // You must set it prior to encoding any dates, and it will only be read once. + @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") + public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + /// Configures the range of HTTP status codes that will result in a successful response + /// + /// If a HTTP status code is outside of this range the response will be interpreted as failed. + public static var successfulStatusCodeRange: Range = 200..<300 +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Extensions.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Extensions.swift new file mode 100644 index 0000000000..314a341536 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Extensions.swift @@ -0,0 +1,229 @@ +// Extensions.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +#if canImport(AnyCodable) +import AnyCodable +#endif + +extension Bool: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension Float: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension Int: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension Int32: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension Int64: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension Double: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension String: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension URL: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension UUID: JSONEncodable { + func encodeToJSON() -> Any { self } +} + +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue } +} + +private func encodeIfPossible(_ object: T) -> Any { + if let encodableObject = object as? JSONEncodable { + return encodableObject.encodeToJSON() + } else { + return object + } +} + +extension Array: JSONEncodable { + func encodeToJSON() -> Any { + return self.map(encodeIfPossible) + } +} + +extension Set: JSONEncodable { + func encodeToJSON() -> Any { + return Array(self).encodeToJSON() + } +} + +extension Dictionary: JSONEncodable { + func encodeToJSON() -> Any { + var dictionary = [AnyHashable: Any]() + for (key, value) in self { + dictionary[key] = encodeIfPossible(value) + } + return dictionary + } +} + +extension Data: JSONEncodable { + func encodeToJSON() -> Any { + return self.base64EncodedString(options: Data.Base64EncodingOptions()) + } +} + +extension Date: JSONEncodable { + func encodeToJSON() -> Any { + return CodableHelper.dateFormatter.string(from: self) + } +} + +extension JSONEncodable where Self: Encodable { + func encodeToJSON() -> Any { + guard let data = try? CodableHelper.jsonEncoder.encode(self) else { + fatalError("Could not encode to json: \(self)") + } + return data.encodeToJSON() + } +} + +extension String: CodingKey { + + public var stringValue: String { + return self + } + + public init?(stringValue: String) { + self.init(stringLiteral: stringValue) + } + + public var intValue: Int? { + return nil + } + + public init?(intValue: Int) { + return nil + } + +} + +extension KeyedEncodingContainerProtocol { + + public mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T: Encodable { + var arrayContainer = nestedUnkeyedContainer(forKey: key) + try arrayContainer.encode(contentsOf: values) + } + + public mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { + if let values = values { + try encodeArray(values, forKey: key) + } + } + + public mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T: Encodable { + for (key, value) in pairs { + try encode(value, forKey: key) + } + } + + public mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T: Encodable { + if let pairs = pairs { + try encodeMap(pairs) + } + } + + public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws { + var mutableValue = value + let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US")) + try encode(stringValue, forKey: key) + } + + public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws { + if let value = value { + try encode(value, forKey: key) + } + } +} + +extension KeyedDecodingContainerProtocol { + + public func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { + var tmpArray = [T]() + + var nestedContainer = try nestedUnkeyedContainer(forKey: key) + while !nestedContainer.isAtEnd { + let arrayValue = try nestedContainer.decode(T.self) + tmpArray.append(arrayValue) + } + + return tmpArray + } + + public func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? + + if contains(key) { + tmpArray = try decodeArray(T.self, forKey: key) + } + + return tmpArray + } + + public func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] + + for key in allKeys { + if !excludedKeys.contains(key) { + let value = try decode(T.self, forKey: key) + map[key] = value + } + } + + return map + } + + public func decode(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal { + let stringValue = try decode(String.self, forKey: key) + guard let decimalValue = Decimal(string: stringValue) else { + let context = DecodingError.Context(codingPath: [key], debugDescription: "The key \(key) couldn't be converted to a Decimal value") + throw DecodingError.typeMismatch(type, context) + } + + return decimalValue + } + + public func decodeIfPresent(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal? { + guard let stringValue = try decodeIfPresent(String.self, forKey: key) else { + return nil + } + guard let decimalValue = Decimal(string: stringValue) else { + let context = DecodingError.Context(codingPath: [key], debugDescription: "The key \(key) couldn't be converted to a Decimal value") + throw DecodingError.typeMismatch(type, context) + } + + return decimalValue + } + +} + +extension HTTPURLResponse { + var isStatusCodeSuccessful: Bool { + return Configuration.successfulStatusCodeRange.contains(statusCode) + } +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/JSONDataEncoding.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/JSONDataEncoding.swift new file mode 100644 index 0000000000..f407c2b360 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/JSONDataEncoding.swift @@ -0,0 +1,56 @@ +// +// JSONDataEncoding.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +public struct JSONDataEncoding { + + // MARK: Properties + + private static let jsonDataKey = "jsonData" + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. This should have a single key/value + /// pair with "jsonData" as the key and a Data object as the value. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest { + var urlRequest = urlRequest + + guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { + return urlRequest + } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = jsonData + + return urlRequest + } + + public static func encodingParameters(jsonData: Data?) -> [String: Any]? { + var returnedParams: [String: Any]? + if let jsonData = jsonData, !jsonData.isEmpty { + var params: [String: Any] = [:] + params[jsonDataKey] = jsonData + returnedParams = params + } + return returnedParams + } + +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/JSONEncodingHelper.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/JSONEncodingHelper.swift new file mode 100644 index 0000000000..b6ce801f9a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/JSONEncodingHelper.swift @@ -0,0 +1,45 @@ +// +// JSONEncodingHelper.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation + +open class JSONEncodingHelper { + + open class func encodingParameters(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? + + // Encode the Encodable object + if let encodableObj = encodableObj { + let encodeResult = CodableHelper.encode(encodableObj) + do { + let data = try encodeResult.get() + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error.localizedDescription) + } + } + + return params + } + + open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { + var params: [String: Any]? + + if let encodableObj = encodableObj { + do { + let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error.localizedDescription) + return nil + } + } + + return params + } + +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/LeapClient.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/LeapClient.swift new file mode 100644 index 0000000000..c142eab578 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/LeapClient.swift @@ -0,0 +1,15 @@ +public class LeapClient { + public var apiKey: String?; + public var basePath: String + public lazy var bulkWorkflowRuns: BulkWorkflowRunsAPI = { return BulkWorkflowRunsAPI(client: self) }() + public lazy var workflowRuns: WorkflowRunsAPI = { return WorkflowRunsAPI(client: self) }() + + public init( + apiKey: String?, + basePath: String = "https://api.workflows.tryleap.ai" + ) { + self.apiKey = apiKey + self.basePath = basePath + } + +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models.swift new file mode 100644 index 0000000000..274294e7a0 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models.swift @@ -0,0 +1,127 @@ +// Models.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +protocol JSONEncodable { + func encodeToJSON() -> Any +} + +/// An enum where the last case value can be used as a default catch-all. +protocol CaseIterableDefaultsLast: Decodable & CaseIterable & RawRepresentable +where RawValue: Decodable, AllCases: BidirectionalCollection {} + +extension CaseIterableDefaultsLast { + /// Initializes an enum such that if a known raw value is found, then it is decoded. + /// Otherwise the last case is used. + /// - Parameter decoder: A decoder. + public init(from decoder: Decoder) throws { + if let value = try Self(rawValue: decoder.singleValueContainer().decode(RawValue.self)) { + self = value + } else if let lastValue = Self.allCases.last { + self = lastValue + } else { + throw DecodingError.valueNotFound( + Self.Type.self, + .init(codingPath: decoder.codingPath, debugDescription: "CaseIterableDefaultsLast") + ) + } + } +} + +/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`) +/// or not encoded (`.encodeNothing`). Intended for request payloads. +public enum NullEncodable: Hashable { + case encodeNothing + case encodeNull + case encodeValue(Wrapped) +} + +extension NullEncodable: Codable where Wrapped: Codable { + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(Wrapped.self) { + self = .encodeValue(value) + } else if container.decodeNil() { + self = .encodeNull + } else { + self = .encodeNothing + } + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case .encodeNothing: return + case .encodeNull: try container.encodeNil() + case .encodeValue(let wrapped): try container.encode(wrapped) + } + } +} + +public enum ErrorResponse: Error { + case error(Int, Data?, URLResponse?, Error) +} + +public enum DownloadException: Error { + case responseDataMissing + case responseFailed + case requestMissing + case requestMissingPath + case requestMissingURL +} + +public enum DecodableRequestBuilderError: Error { + case emptyDataResponse + case nilHTTPResponse + case unsuccessfulHTTPStatusCode + case jsonDecoding(DecodingError) + case generalError(Error) +} + +open class Response { + public let statusCode: Int + public let header: [String: String] + public let body: T + + public init(statusCode: Int, header: [String: String], body: T) { + self.statusCode = statusCode + self.header = header + self.body = body + } + + public convenience init(response: HTTPURLResponse, body: T) { + let rawHeader = response.allHeaderFields + var header = [String: String]() + for (key, value) in rawHeader { + if let key = key.base as? String, let value = value as? String { + header[key] = value + } + } + self.init(statusCode: response.statusCode, header: header, body: body) + } +} + +public final class RequestTask { + private var lock = NSRecursiveLock() + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + lock.lock() + defer { lock.unlock() } + self.task = task + } + + public func cancel() { + lock.lock() + defer { lock.unlock() } + task?.cancel() + task = nil + } +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/BulkRunSchema.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/BulkRunSchema.swift new file mode 100644 index 0000000000..c5dba28308 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/BulkRunSchema.swift @@ -0,0 +1,71 @@ +// +// BulkRunSchema.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(AnyCodable) +import AnyCodable +#endif + +public struct BulkRunSchema: Codable, JSONEncodable, Hashable { + + public enum Status: String, Codable, CaseIterable { + case completed = "completed" + case running = "running" + case failed = "failed" + case queued = "queued" + case cancelled = "cancelled" + } + public var id: String + public var versionId: String + public var status: Status + public var createdAt: String + public var workflowId: String + public var inputCsvUrl: String + public var outputCsvUrl: String? + public var error: String? + public var rowCount: Double + + public init(id: String, versionId: String, status: Status, createdAt: String, workflowId: String, inputCsvUrl: String, outputCsvUrl: String?, error: String?, rowCount: Double) { + self.id = id + self.versionId = versionId + self.status = status + self.createdAt = createdAt + self.workflowId = workflowId + self.inputCsvUrl = inputCsvUrl + self.outputCsvUrl = outputCsvUrl + self.error = error + self.rowCount = rowCount + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case versionId = "version_id" + case status + case createdAt = "created_at" + case workflowId = "workflow_id" + case inputCsvUrl = "input_csv_url" + case outputCsvUrl = "output_csv_url" + case error + case rowCount = "row_count" + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode(versionId, forKey: .versionId) + try container.encode(status, forKey: .status) + try container.encode(createdAt, forKey: .createdAt) + try container.encode(workflowId, forKey: .workflowId) + try container.encode(inputCsvUrl, forKey: .inputCsvUrl) + try container.encode(outputCsvUrl, forKey: .outputCsvUrl) + try container.encode(error, forKey: .error) + try container.encode(rowCount, forKey: .rowCount) + } +} + diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/RunBulkWorkflowSchema.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/RunBulkWorkflowSchema.swift new file mode 100644 index 0000000000..30c8da6dc9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/RunBulkWorkflowSchema.swift @@ -0,0 +1,43 @@ +// +// RunBulkWorkflowSchema.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(AnyCodable) +import AnyCodable +#endif + +public struct RunBulkWorkflowSchema: Codable, JSONEncodable, Hashable { + + /** The ID of the workflow to be run in bulk. */ + public var workflowId: String + /** A CSV file containing the input data for the bulk run. Each row should contain the input data for a single run. */ + public var inputCsvUrl: String + /** The URL to which the bulk run results should be sent to on completion. */ + public var webhookUrl: String? + + public init(workflowId: String, inputCsvUrl: String, webhookUrl: String? = nil) { + self.workflowId = workflowId + self.inputCsvUrl = inputCsvUrl + self.webhookUrl = webhookUrl + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case workflowId = "workflow_id" + case inputCsvUrl = "input_csv_url" + case webhookUrl = "webhook_url" + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(workflowId, forKey: .workflowId) + try container.encode(inputCsvUrl, forKey: .inputCsvUrl) + try container.encodeIfPresent(webhookUrl, forKey: .webhookUrl) + } +} + diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/RunWorkflowSchema.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/RunWorkflowSchema.swift new file mode 100644 index 0000000000..8b377bc531 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/RunWorkflowSchema.swift @@ -0,0 +1,43 @@ +// +// RunWorkflowSchema.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(AnyCodable) +import AnyCodable +#endif + +public struct RunWorkflowSchema: Codable, JSONEncodable, Hashable { + + /** The ID of the workflow to be run. */ + public var workflowId: String + /** The URL to which the workflow results should be sent to on completion. */ + public var webhookUrl: String? + /** Variables that the workflow can use globally and their values. */ + public var input: [String: AnyCodable]? + + public init(workflowId: String, webhookUrl: String? = nil, input: [String: AnyCodable]? = nil) { + self.workflowId = workflowId + self.webhookUrl = webhookUrl + self.input = input + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case workflowId = "workflow_id" + case webhookUrl = "webhook_url" + case input + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(workflowId, forKey: .workflowId) + try container.encodeIfPresent(webhookUrl, forKey: .webhookUrl) + try container.encodeIfPresent(input, forKey: .input) + } +} + diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/WorkflowRunSchema.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/WorkflowRunSchema.swift new file mode 100644 index 0000000000..b1861767c5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/Models/WorkflowRunSchema.swift @@ -0,0 +1,75 @@ +// +// WorkflowRunSchema.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(AnyCodable) +import AnyCodable +#endif + +public struct WorkflowRunSchema: Codable, JSONEncodable, Hashable { + + public enum Status: String, Codable, CaseIterable { + case completed = "completed" + case running = "running" + case failed = "failed" + case queued = "queued" + case cancelled = "cancelled" + } + public var id: String + public var versionId: String + public var status: Status + public var createdAt: String + public var startedAt: String? + public var endedAt: String? + public var workflowId: String + public var error: String? + public var input: AnyCodable? + public var output: AnyCodable? + + public init(id: String, versionId: String, status: Status, createdAt: String, startedAt: String?, endedAt: String?, workflowId: String, error: String?, input: AnyCodable?, output: AnyCodable?) { + self.id = id + self.versionId = versionId + self.status = status + self.createdAt = createdAt + self.startedAt = startedAt + self.endedAt = endedAt + self.workflowId = workflowId + self.error = error + self.input = input + self.output = output + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case versionId = "version_id" + case status + case createdAt = "created_at" + case startedAt = "started_at" + case endedAt = "ended_at" + case workflowId = "workflow_id" + case error + case input + case output + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode(versionId, forKey: .versionId) + try container.encode(status, forKey: .status) + try container.encode(createdAt, forKey: .createdAt) + try container.encode(startedAt, forKey: .startedAt) + try container.encode(endedAt, forKey: .endedAt) + try container.encode(workflowId, forKey: .workflowId) + try container.encode(error, forKey: .error) + try container.encode(input, forKey: .input) + try container.encode(output, forKey: .output) + } +} + diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/OpenISO8601DateFormatter.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/OpenISO8601DateFormatter.swift new file mode 100644 index 0000000000..125e7b5823 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/OpenISO8601DateFormatter.swift @@ -0,0 +1,56 @@ +// +// OpenISO8601DateFormatter.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation + +// https://stackoverflow.com/a/50281094/976628 +public class OpenISO8601DateFormatter: DateFormatter { + static let withoutSeconds: DateFormatter = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" + return formatter + }() + + static let withoutTime: DateFormatter = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd" + return formatter + }() + + private func setup() { + calendar = Calendar(identifier: .iso8601) + locale = Locale(identifier: "en_US_POSIX") + timeZone = TimeZone(secondsFromGMT: 0) + dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + } + + override init() { + super.init() + setup() + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setup() + } + + override public func date(from string: String) -> Date? { + if let result = super.date(from: string) { + return result + } else if let result = OpenISO8601DateFormatter.withoutSeconds.date(from: string) { + return result + } + + return OpenISO8601DateFormatter.withoutTime.date(from: string) + } +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/SynchronizedDictionary.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/SynchronizedDictionary.swift new file mode 100644 index 0000000000..3c635c5c5c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/SynchronizedDictionary.swift @@ -0,0 +1,36 @@ +// SynchronizedDictionary.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation + +internal struct SynchronizedDictionary { + + private var dictionary = [K: V]() + private let queue = DispatchQueue( + label: "SynchronizedDictionary", + qos: DispatchQoS.userInitiated, + attributes: [DispatchQueue.Attributes.concurrent], + autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit, + target: nil + ) + + internal subscript(key: K) -> V? { + get { + var value: V? + + queue.sync { + value = self.dictionary[key] + } + + return value + } + set { + queue.sync(flags: DispatchWorkItemFlags.barrier) { + self.dictionary[key] = newValue + } + } + } +} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/URLSessionImplementations.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/URLSessionImplementations.swift new file mode 100644 index 0000000000..61005f435a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Leap/URLSessionImplementations.swift @@ -0,0 +1,630 @@ +// URLSessionImplementations.swift +// +// Generated by Konfig +// https://konfigthis.com +// + +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +public protocol URLSessionProtocol { + func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask +} + +extension URLSession: URLSessionProtocol {} + +class URLSessionRequestBuilderFactory: RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type { + return URLSessionRequestBuilder.self + } + + func getBuilder() -> RequestBuilder.Type { + return URLSessionDecodableRequestBuilder.self + } +} + +public typealias LeapAPIChallengeHandler = ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?)) + +// Store the URLSession's delegate to retain its reference +private let sessionDelegate = SessionDelegate() + +// Store the URLSession to retain its reference +private let defaultURLSession = URLSession(configuration: .default, delegate: sessionDelegate, delegateQueue: nil) + +// Store current taskDidReceiveChallenge for every URLSessionTask +private var challengeHandlerStore = SynchronizedDictionary() + +// Store current URLCredential for every URLSessionTask +private var credentialStore = SynchronizedDictionary() + +open class URLSessionRequestBuilder: RequestBuilder { + + /** + May be assigned if you want to control the authentication challenges. + */ + public var taskDidReceiveChallenge: LeapAPIChallengeHandler? + + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication) + } + + /** + May be overridden by a subclass if you want to control the URLSession + configuration. + */ + open func createURLSession() -> URLSessionProtocol { + return defaultURLSession + } + + /** + May be overridden by a subclass if you want to control the Content-Type + that is given to an uploaded form part. + + Return nil to use the default behavior (inferring the Content-Type from + the file extension). Return the desired Content-Type otherwise. + */ + open func contentTypeForFormPart(fileURL: URL) -> String? { + return nil + } + + /** + May be overridden by a subclass if you want to control the URLRequest + configuration (e.g. to override the cache policy). + */ + open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + + guard let url = URL(string: URLString) else { + throw DownloadException.requestMissingURL + } + + var originalRequest = URLRequest(url: url) + + originalRequest.httpMethod = method.rawValue + + headers.forEach { key, value in + originalRequest.setValue(value, forHTTPHeaderField: key) + } + + buildHeaders().forEach { key, value in + originalRequest.setValue(value, forHTTPHeaderField: key) + } + + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) + + return modifiedRequest + } + + @discardableResult + override open func execute(_ apiResponseQueue: DispatchQueue = LeapAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + let urlSession = createURLSession() + + guard let xMethod = HTTPMethod(rawValue: method) else { + fatalError("Unsupported Http method - \(method)") + } + + let encoding: ParameterEncoding + + switch xMethod { + case .get, .head: + encoding = URLEncoding() + + case .options, .post, .put, .patch, .delete, .trace, .connect: + let contentType = headers["Content-Type"] ?? "application/json" + + if contentType == "application/json" { + encoding = JSONDataEncoding() + } else if contentType == "multipart/form-data" { + encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) + } else if contentType == "application/x-www-form-urlencoded" { + encoding = FormURLEncoding() + } else { + fatalError("Unsupported Media Type - \(contentType)") + } + } + + do { + let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) + + var taskIdentifier: Int? + let cleanupRequest = { + if let taskIdentifier = taskIdentifier { + challengeHandlerStore[taskIdentifier] = nil + credentialStore[taskIdentifier] = nil + } + } + + let dataTask = urlSession.dataTask(with: request) { data, response, error in + apiResponseQueue.async { + self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) + cleanupRequest() + } + } + + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { + onProgressReady?(dataTask.progress) + } + + taskIdentifier = dataTask.taskIdentifier + challengeHandlerStore[dataTask.taskIdentifier] = taskDidReceiveChallenge + credentialStore[dataTask.taskIdentifier] = credential + + dataTask.resume() + + requestTask.set(task: dataTask) + } catch { + apiResponseQueue.async { + completion(.failure(ErrorResponse.error(415, nil, nil, error))) + } + } + + return requestTask + } + + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + + if let error = error { + completion(.failure(ErrorResponse.error(-1, data, response, error))) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + completion(.failure(ErrorResponse.error(-2, data, response, DecodableRequestBuilderError.nilHTTPResponse))) + return + } + + guard httpResponse.isStatusCodeSuccessful else { + completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, response, DecodableRequestBuilderError.unsuccessfulHTTPStatusCode))) + return + } + + switch T.self { + case is Void.Type: + + completion(.success(Response(response: httpResponse, body: () as! T))) + + default: + fatalError("Unsupported Response Body Type - \(String(describing: T.self))") + } + + } + + open func buildHeaders() -> [String: String] { + var httpHeaders: [String: String] = [:] + for (key, value) in headers { + httpHeaders[key] = value + } + for (key, value) in LeapAPI.customHeaders { + httpHeaders[key] = value + } + return httpHeaders + } + + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { + + guard let contentDisposition = contentDisposition else { + return nil + } + + let items = contentDisposition.components(separatedBy: ";") + + var filename: String? + + for contentItem in items { + + let filenameKey = "filename=" + guard let range = contentItem.range(of: filenameKey) else { + continue + } + + filename = contentItem + return filename? + .replacingCharacters(in: range, with: "") + .replacingOccurrences(of: "\"", with: "") + .trimmingCharacters(in: .whitespacesAndNewlines) + } + + return filename + + } + + fileprivate func getPath(from url: URL) throws -> String { + + guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { + throw DownloadException.requestMissingPath + } + + if path.hasPrefix("/") { + path.remove(at: path.startIndex) + } + + return path + + } + + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + return url + } + +} + +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + + if let error = error { + completion(.failure(ErrorResponse.error(-1, data, response, error))) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + completion(.failure(ErrorResponse.error(-2, data, response, DecodableRequestBuilderError.nilHTTPResponse))) + return + } + + guard httpResponse.isStatusCodeSuccessful else { + completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, response, DecodableRequestBuilderError.unsuccessfulHTTPStatusCode))) + return + } + + switch T.self { + case is String.Type: + + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" + + completion(.success(Response(response: httpResponse, body: body as! T))) + + case is URL.Type: + do { + + guard error == nil else { + throw DownloadException.responseFailed + } + + guard let data = data else { + throw DownloadException.responseDataMissing + } + + let fileManager = FileManager.default + let cachesDirectory = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0] + let requestURL = try getURL(from: urlRequest) + + var requestPath = try getPath(from: requestURL) + + if let headerFileName = getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { + requestPath = requestPath.appending("/\(headerFileName)") + } else { + requestPath = requestPath.appending("/tmp.Leap.\(UUID().uuidString)") + } + + let filePath = cachesDirectory.appendingPathComponent(requestPath) + let directoryPath = filePath.deletingLastPathComponent().path + + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) + try data.write(to: filePath, options: .atomic) + + completion(.success(Response(response: httpResponse, body: filePath as! T))) + + } catch let requestParserError as DownloadException { + completion(.failure(ErrorResponse.error(400, data, response, requestParserError))) + } catch { + completion(.failure(ErrorResponse.error(400, data, response, error))) + } + + case is Void.Type: + + completion(.success(Response(response: httpResponse, body: () as! T))) + + case is Data.Type: + + completion(.success(Response(response: httpResponse, body: data as! T))) + + default: + + guard let data = data, !data.isEmpty else { + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) + } else { + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) + } + return + } + + let decodeResult = CodableHelper.decode(T.self, from: data) + + switch decodeResult { + case let .success(decodableObj): + completion(.success(Response(response: httpResponse, body: decodableObj))) + case let .failure(error): + completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, response, error))) + } + } + } +} + +private class SessionDelegate: NSObject, URLSessionTaskDelegate { + func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { + + var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling + + var credential: URLCredential? + + if let taskDidReceiveChallenge = challengeHandlerStore[task.taskIdentifier] { + (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) + } else { + if challenge.previousFailureCount > 0 { + disposition = .rejectProtectionSpace + } else { + credential = credentialStore[task.taskIdentifier] ?? session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace) + + if credential != nil { + disposition = .useCredential + } + } + } + + completionHandler(disposition, credential) + } +} + +public enum HTTPMethod: String { + case options = "OPTIONS" + case get = "GET" + case head = "HEAD" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" + case trace = "TRACE" + case connect = "CONNECT" +} + +public protocol ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest +} + +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + + var urlRequest = urlRequest + + guard let parameters = parameters else { return urlRequest } + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { + urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) + urlRequest.url = urlComponents.url + } + + return urlRequest + } +} + +private class FormDataEncoding: ParameterEncoding { + + let contentTypeForFormPart: (_ fileURL: URL) -> String? + + init(contentTypeForFormPart: @escaping (_ fileURL: URL) -> String?) { + self.contentTypeForFormPart = contentTypeForFormPart + } + + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + + var urlRequest = urlRequest + + guard let parameters = parameters, !parameters.isEmpty else { + return urlRequest + } + + let boundary = "Boundary-\(UUID().uuidString)" + + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") + + for (key, value) in parameters { + for value in (value as? Array ?? [value]) { + switch value { + case let fileURL as URL: + + urlRequest = try configureFileUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + fileURL: fileURL + ) + + case let string as String: + + if let data = string.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } + + case let number as NSNumber: + + if let data = number.stringValue.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } + + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + + case let uuid as UUID: + + if let data = uuid.uuidString.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } + + default: + fatalError("Unprocessable value \(value) with key \(key)") + } + } + } + + var body = urlRequest.httpBody.orEmpty + + body.append("\r\n--\(boundary)--\r\n") + + urlRequest.httpBody = body + + return urlRequest + } + + private func configureFileUploadRequest(urlRequest: URLRequest, boundary: String, name: String, fileURL: URL) throws -> URLRequest { + + var urlRequest = urlRequest + + var body = urlRequest.httpBody.orEmpty + + let fileData = try Data(contentsOf: fileURL) + + let mimetype = contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) + + let fileName = fileURL.lastPathComponent + + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. + body.append("--\(boundary)\r\n") + + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") + + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(fileData) + + urlRequest.httpBody = body + + return urlRequest + } + + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { + + var urlRequest = urlRequest + + var body = urlRequest.httpBody.orEmpty + + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. + body.append("--\(boundary)\r\n") + + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") + + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) + + urlRequest.httpBody = body + + return urlRequest + + } + + func mimeType(for url: URL) -> String { + let pathExtension = url.pathExtension + // JSON + if pathExtension == "json" { + return "application/json" + } + // XML + if pathExtension == "xml" { + return "application/xml" + } + // ZIP + if pathExtension == "zip" { + return "application/zip" + } + // PDF + if pathExtension == "pdf" { + return "application/pdf" + } + // Image + if ["png", "jpg", "jpeg", "gif", "bmp", "tiff"].contains(pathExtension) { + return "image/\(pathExtension)" + } + // Default + return "application/octet-stream" + } + +} + +private class FormURLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + + var urlRequest = urlRequest + + var requestBodyComponents = URLComponents() + requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) + + return urlRequest + } +} + +private extension Data { + /// Append string to Data + /// + /// Rather than littering my code with calls to `dataUsingEncoding` to convert strings to Data, and then add that data to the Data, this wraps it in a nice convenient little extension to Data. This converts using UTF-8. + /// + /// - parameter string: The string to be added to the `Data`. + + mutating func append(_ string: String) { + if let data = string.data(using: .utf8) { + append(data) + } + } +} + +private extension Optional where Wrapped == Data { + var orEmpty: Data { + self ?? Data() + } +} + +extension JSONDataEncoding: ParameterEncoding {} diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Package.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Package.swift new file mode 100644 index 0000000000..67c138744e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version:5.1 + +import PackageDescription + +let package = Package( + name: "Leap", + platforms: [ + .iOS(.v12), + .macOS(.v10_13), + .tvOS(.v12), + .watchOS(.v4), + ], + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "Leap", + targets: ["Leap"] + ), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + .package(url: "https://github.com/konfig-dev/AnyCodable", from: "0.6.9"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "Leap", + dependencies: ["AnyCodable", ], + path: "Leap" + ), + .testTarget(name: "Tests", dependencies: ["Leap"], path: "Tests") + ] +) diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/README.md b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/README.md new file mode 100644 index 0000000000..a05f568faf --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/README.md @@ -0,0 +1,259 @@ +
+ +[![Visit Leap Workflows](./header.png)](https://www.tryleap.ai/) + +# [Leap Workflows](https://www.tryleap.ai/) + +The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests. + +[![CocoaPods](https://img.shields.io/badge/pod-v0.1.0-blue)](https://cocoapods.org/pods/Leap) +[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://tryleap.ai/) + +
+ +## Table of Contents + + + +- [Installation](#installation) + * [Swift Package Manager](#swift-package-manager) + * [Carthage](#carthage) + * [CocoaPods](#cocoapods) +- [Getting Started](#getting-started) +- [Reference](#reference) + * [`leap.bulkWorkflowRuns.getBulk`](#leapbulkworkflowrunsgetbulk) + * [`leap.bulkWorkflowRuns.runBulk`](#leapbulkworkflowrunsrunbulk) + * [`leap.workflowRuns.getWorkflowRun`](#leapworkflowrunsgetworkflowrun) + * [`leap.workflowRuns.workflow`](#leapworkflowrunsworkflow) + + + +## Installation + + +### Swift Package Manager + +1. In Xcode, select *File > Add Packages…* and enter `https://github.com/leap-ai/leap-workflows-swift-sdk` as the repository URL. +1. Select the latest version number from our [tags page](https://github.com/leap-ai/leap-workflows-swift-sdk/tags). +1. Add the *Leap* product to the [target of your app](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app). + +### Carthage + +1. Add this line to your `Cartfile`: +```shell +github "leap-ai/leap-workflows-swift-sdk" +``` +2. Follow the [Carthage installation instructions](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). +3. In the future, to update to the latest version of the SDK, run the following command: `carthage update leap-workflows-swift-sdk` + +### CocoaPods + +1. Add `source 'https://github.com/CocoaPods/Specs.git'` to your `Podfile` +2. Add `pod 'Leap', '~> 0.1.0'` to your `Podfile` + +Your `Podfile` should look like: +```ruby +# Podfile +source 'https://github.com/CocoaPods/Specs.git' + +target 'Example' do + pod 'Leap', '~> 0.1.0' +end +``` +3. Run `pod install` + +```shell +❯ pod install +Analyzing dependencies +Downloading dependencies +Installing Leap 0.1.0 +Generating Pods project +Integrating client project +Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed. +``` + +4. In the future, to update to the latest version of the SDK, run: `pod update Leap` + +## Getting Started + +```swift +import Leap + +let leap = LeapClient( + apiKey: "X_API_KEY" + // Defining the base path is optional and defaults to https://api.workflows.tryleap.ai + // basePath: "https://api.workflows.tryleap.ai" +) + +let bulkRunId = "bulkRunId_example" +let getBulkResponse = try await leap.bulkWorkflowRuns.getBulk( + bulkRunId: bulkRunId +) +``` + +## Reference + + +### `leap.bulkWorkflowRuns.getBulk` + +This endpoint retrieves the details of a specific bulk workflow run using its `bulk_run_id`. + +#### πŸ› οΈ Usage + +```swift +let bulkRunId = "bulkRunId_example" +let getBulkResponse = try await leap.bulkWorkflowRuns.getBulk( + bulkRunId: bulkRunId +) +``` + +#### βš™οΈ Parameters + +##### bulkRunId: `String` + +The ID of the bulk run to retrieve. + + +#### πŸ”„ Return + +[BulkRunSchema](./Leap/Models/BulkRunSchema.swift) + +#### 🌐 Endpoint + +`/v1/runs/bulk/{bulk_run_id}` `GET` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + +### `leap.bulkWorkflowRuns.runBulk` + +This endpoint lets the user run a specified workflow with the provided csv in bulk. + +#### πŸ› οΈ Usage + +```swift +let workflowId = "workflowId_example" +let inputCsvUrl = "inputCsvUrl_example" +let webhookUrl = "webhookUrl_example" +let runBulkResponse = try await leap.bulkWorkflowRuns.runBulk( + workflowId: workflowId, + inputCsvUrl: inputCsvUrl, + webhookUrl: webhookUrl +) +``` + +#### βš™οΈ Parameters + +##### workflow_id: `String` + +The ID of the workflow to be run in bulk. + + +##### input_csv_url: `String` + +A CSV file containing the input data for the bulk run. Each row should contain the input data for a single run. + + +##### webhook_url: `String` + +The URL to which the bulk run results should be sent to on completion. + + +#### πŸ”„ Return + +[BulkRunSchema](./Leap/Models/BulkRunSchema.swift) + +#### 🌐 Endpoint + +`/v1/runs/bulk` `POST` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + +### `leap.workflowRuns.getWorkflowRun` + +This endpoint retrieves the details of a specific workflow run using its `workflow_run_id`. + +#### πŸ› οΈ Usage + +```swift +let workflowRunId = "workflowRunId_example" +let getWorkflowRunResponse = try await leap.workflowRuns.getWorkflowRun( + workflowRunId: workflowRunId +) +``` + +#### βš™οΈ Parameters + +##### workflowRunId: `String` + +The ID of the workflow run to retrieve. + + +#### πŸ”„ Return + +[WorkflowRunSchema](./Leap/Models/WorkflowRunSchema.swift) + +#### 🌐 Endpoint + +`/v1/runs/{workflow_run_id}` `GET` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + +### `leap.workflowRuns.workflow` + +This endpoint lets the user run a specified workflow with the provided workflow definition. + +#### πŸ› οΈ Usage + +```swift +let workflowId = "workflowId_example" +let webhookUrl = "webhookUrl_example" +let input = "TODO" +let workflowResponse = try await leap.workflowRuns.workflow( + workflowId: workflowId, + webhookUrl: webhookUrl, + input: input +) +``` + +#### βš™οΈ Parameters + +##### workflow_id: `String` + +The ID of the workflow to be run. + + +##### webhook_url: `String` + +The URL to which the workflow results should be sent to on completion. + + +##### input: `[String: AnyCodable]` + +Variables that the workflow can use globally and their values. + + +#### πŸ”„ Return + +[WorkflowRunSchema](./Leap/Models/WorkflowRunSchema.swift) + +#### 🌐 Endpoint + +`/v1/runs` `POST` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + + +## Author +This TypeScript package is automatically generated by [Konfig](https://konfigthis.com) diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Tests/SimpleTest.swift b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Tests/SimpleTest.swift new file mode 100644 index 0000000000..5be70fb735 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/Tests/SimpleTest.swift @@ -0,0 +1,38 @@ +@testable import Leap + +import XCTest + +class SimpleTest: XCTestCase { + var leap: LeapClient! + + override func setUpWithError() throws { + self.leap = LeapClient( + apiKey: "API_KEY", + basePath: "http://127.0.0.1:4120" + ) + } + + override func tearDownWithError() throws {} + + func simpleTest() async throws { + let expectation = XCTestExpectation(description: "API call successful") + do { + let result = try await self.leap.workflowRuns.getWorkflowRun(workflowRunId: "rnp_x3p27VQk6MyJfLe") + print(result) + expectation.fulfill() + } catch { + print(error) + } + await fulfillment(of: [expectation], timeout: 10.0) + + let expectation2 = XCTestExpectation(description: "API call successful") + do { + let result = try await self.leap.bulkWorkflowRuns.getBulk(bulkRunId: "rnp_x3p27VQk6MyJfLe") + print(result) + expectation2.fulfill() + } catch { + print(error) + } + await fulfillment(of: [expectation2], timeout: 10.0) + } +} \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/header.png b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/header.png new file mode 100644 index 0000000000..4023a97cc0 Binary files /dev/null and b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/header.png differ diff --git a/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/project.yml b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/project.yml new file mode 100644 index 0000000000..1a2d1f9d10 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/swift-leap-workflows/sdks/swift/project.yml @@ -0,0 +1,15 @@ +name: Leap +targets: + Leap: + type: framework + platform: iOS + deploymentTarget: "13.0" + sources: [Leap] + info: + path: ./Info.plist + version: 0.1.0 + settings: + APPLICATION_EXTENSION_API_ONLY: true + scheme: {} + dependencies: + - carthage: AnyCodable \ No newline at end of file diff --git a/generator/konfig-integration-tests/tests/__snapshots__/swift-leap-workflows.test.ts.snap b/generator/konfig-integration-tests/tests/__snapshots__/swift-leap-workflows.test.ts.snap new file mode 100644 index 0000000000..63a21440ba --- /dev/null +++ b/generator/konfig-integration-tests/tests/__snapshots__/swift-leap-workflows.test.ts.snap @@ -0,0 +1,264 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`swift-leap-workflows 1`] = ` +"
+ +[![Visit Leap Workflows](./header.png)](https://www.tryleap.ai/) + +# [Leap Workflows](https://www.tryleap.ai/) + +The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests. + +[![CocoaPods](https://img.shields.io/badge/pod-v0.1.0-blue)](https://cocoapods.org/pods/Leap) +[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://tryleap.ai/) + +
+ +## Table of Contents + + + +- [Installation](#installation) + * [Swift Package Manager](#swift-package-manager) + * [Carthage](#carthage) + * [CocoaPods](#cocoapods) +- [Getting Started](#getting-started) +- [Reference](#reference) + * [\`leap.bulkWorkflowRuns.getBulk\`](#leapbulkworkflowrunsgetbulk) + * [\`leap.bulkWorkflowRuns.runBulk\`](#leapbulkworkflowrunsrunbulk) + * [\`leap.workflowRuns.getWorkflowRun\`](#leapworkflowrunsgetworkflowrun) + * [\`leap.workflowRuns.workflow\`](#leapworkflowrunsworkflow) + + + +## Installation + + +### Swift Package Manager + +1. In Xcode, select *File > Add Packages…* and enter \`https://github.com/leap-ai/leap-workflows-swift-sdk\` as the repository URL. +1. Select the latest version number from our [tags page](https://github.com/leap-ai/leap-workflows-swift-sdk/tags). +1. Add the *Leap* product to the [target of your app](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app). + +### Carthage + +1. Add this line to your \`Cartfile\`: +\`\`\`shell +github "leap-ai/leap-workflows-swift-sdk" +\`\`\` +2. Follow the [Carthage installation instructions](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). +3. In the future, to update to the latest version of the SDK, run the following command: \`carthage update leap-workflows-swift-sdk\` + +### CocoaPods + +1. Add \`source 'https://github.com/CocoaPods/Specs.git'\` to your \`Podfile\` +2. Add \`pod 'Leap', '~> 0.1.0'\` to your \`Podfile\` + +Your \`Podfile\` should look like: +\`\`\`ruby +# Podfile +source 'https://github.com/CocoaPods/Specs.git' + +target 'Example' do + pod 'Leap', '~> 0.1.0' +end +\`\`\` +3. Run \`pod install\` + +\`\`\`shell +❯ pod install +Analyzing dependencies +Downloading dependencies +Installing Leap 0.1.0 +Generating Pods project +Integrating client project +Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed. +\`\`\` + +4. In the future, to update to the latest version of the SDK, run: \`pod update Leap\` + +## Getting Started + +\`\`\`swift +import Leap + +let leap = LeapClient( + apiKey: "X_API_KEY" + // Defining the base path is optional and defaults to https://api.workflows.tryleap.ai + // basePath: "https://api.workflows.tryleap.ai" +) + +let bulkRunId = "bulkRunId_example" +let getBulkResponse = try await leap.bulkWorkflowRuns.getBulk( + bulkRunId: bulkRunId +) +\`\`\` + +## Reference + + +### \`leap.bulkWorkflowRuns.getBulk\` + +This endpoint retrieves the details of a specific bulk workflow run using its \`bulk_run_id\`. + +#### πŸ› οΈ Usage + +\`\`\`swift +let bulkRunId = "bulkRunId_example" +let getBulkResponse = try await leap.bulkWorkflowRuns.getBulk( + bulkRunId: bulkRunId +) +\`\`\` + +#### βš™οΈ Parameters + +##### bulkRunId: \`String\` + +The ID of the bulk run to retrieve. + + +#### πŸ”„ Return + +[BulkRunSchema](./Leap/Models/BulkRunSchema.swift) + +#### 🌐 Endpoint + +\`/v1/runs/bulk/{bulk_run_id}\` \`GET\` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + +### \`leap.bulkWorkflowRuns.runBulk\` + +This endpoint lets the user run a specified workflow with the provided csv in bulk. + +#### πŸ› οΈ Usage + +\`\`\`swift +let workflowId = "workflowId_example" +let inputCsvUrl = "inputCsvUrl_example" +let webhookUrl = "webhookUrl_example" +let runBulkResponse = try await leap.bulkWorkflowRuns.runBulk( + workflowId: workflowId, + inputCsvUrl: inputCsvUrl, + webhookUrl: webhookUrl +) +\`\`\` + +#### βš™οΈ Parameters + +##### workflow_id: \`String\` + +The ID of the workflow to be run in bulk. + + +##### input_csv_url: \`String\` + +A CSV file containing the input data for the bulk run. Each row should contain the input data for a single run. + + +##### webhook_url: \`String\` + +The URL to which the bulk run results should be sent to on completion. + + +#### πŸ”„ Return + +[BulkRunSchema](./Leap/Models/BulkRunSchema.swift) + +#### 🌐 Endpoint + +\`/v1/runs/bulk\` \`POST\` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + +### \`leap.workflowRuns.getWorkflowRun\` + +This endpoint retrieves the details of a specific workflow run using its \`workflow_run_id\`. + +#### πŸ› οΈ Usage + +\`\`\`swift +let workflowRunId = "workflowRunId_example" +let getWorkflowRunResponse = try await leap.workflowRuns.getWorkflowRun( + workflowRunId: workflowRunId +) +\`\`\` + +#### βš™οΈ Parameters + +##### workflowRunId: \`String\` + +The ID of the workflow run to retrieve. + + +#### πŸ”„ Return + +[WorkflowRunSchema](./Leap/Models/WorkflowRunSchema.swift) + +#### 🌐 Endpoint + +\`/v1/runs/{workflow_run_id}\` \`GET\` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + +### \`leap.workflowRuns.workflow\` + +This endpoint lets the user run a specified workflow with the provided workflow definition. + +#### πŸ› οΈ Usage + +\`\`\`swift +let workflowId = "workflowId_example" +let webhookUrl = "webhookUrl_example" +let input = "TODO" +let workflowResponse = try await leap.workflowRuns.workflow( + workflowId: workflowId, + webhookUrl: webhookUrl, + input: input +) +\`\`\` + +#### βš™οΈ Parameters + +##### workflow_id: \`String\` + +The ID of the workflow to be run. + + +##### webhook_url: \`String\` + +The URL to which the workflow results should be sent to on completion. + + +##### input: \`[String: AnyCodable]\` + +Variables that the workflow can use globally and their values. + + +#### πŸ”„ Return + +[WorkflowRunSchema](./Leap/Models/WorkflowRunSchema.swift) + +#### 🌐 Endpoint + +\`/v1/runs\` \`POST\` + +[πŸ”™ **Back to Table of Contents**](#table-of-contents) + +--- + + + +## Author +This TypeScript package is automatically generated by [Konfig](https://konfigthis.com) +" +`; diff --git a/generator/konfig-integration-tests/tests/swift-leap-workflows.test.ts b/generator/konfig-integration-tests/tests/swift-leap-workflows.test.ts new file mode 100644 index 0000000000..42f48cd119 --- /dev/null +++ b/generator/konfig-integration-tests/tests/swift-leap-workflows.test.ts @@ -0,0 +1,6 @@ +import { e2e } from "../util"; +import { test } from "vitest"; + +test("swift-leap-workflows", async () => { + await e2e(4120); +}); \ No newline at end of file