@hey-api/openapi-ts 0.86.0 → 0.86.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,5 +20,5 @@ ${r}`,u.default.writeFileSync(e,r,`utf8`)},dl=({meta:e,outputPath:t,plugin:n,pro
20
20
  `,t=null){if(this.isEmpty()){this.remove({force:!0});return}let n=this._path;if(typeof this._path==`string`){let e=this._path.split(d.default.sep);n=e.slice(0,e.length-1).join(d.default.sep)}re(n),u.default.writeFileSync(this._path,this._toString(e,t))}};const tu=e=>{let t=e.match(/\.[0-9a-z]+$/i),n=t?t[0].slice(1):``;return{extension:n,name:e.slice(0,e.length-(n?n.length+1:0))}},nu=(e,t)=>{let n=S();if(Array.isArray(e))return e.map(e=>nu(e));if(typeof e!=`object`||!e)return e;let r={...e};return Object.entries(r).forEach(([e,i])=>{if(n.plugins[`@hey-api/schemas`]?.config.type===`form`&&[`description`,`x-enum-descriptions`,`x-enum-varnames`,`x-enumNames`,`title`].includes(e)&&t!==`properties`){delete r[e];return}e===`$ref`&&typeof i==`string`&&(r[e]=decodeURIComponent(i)),i&&typeof i==`object`&&(r[e]=nu(i,e))}),r},ru=(e,t)=>{let n=S(),r=ur(e),i=n.plugins[`@hey-api/schemas`];return i?.config.nameBuilder?typeof i.config.nameBuilder==`function`?i.config.nameBuilder(r,t):i.config.nameBuilder.replace(`{{name}}`,r):`${r}Schema`},iu=({files:e,openApi:t,plugin:n})=>{e.schemas=new eu({dir:S().output.path,exportFromIndex:n.config.exportFromIndex,id:`schemas`,name:`schemas.ts`});let r=(t,n)=>{let r=nu(n),i=N.objectExpression({obj:r}),a=N.constVariable({assertion:`const`,exportConst:!0,expression:i,name:ru(t,n)});e.schemas.add(a)};`swagger`in t&&Object.entries(t.definitions??{}).forEach(([e,t])=>{r(e,t)}),`openapi`in t&&Object.entries(t.components?.schemas??{}).forEach(([e,t])=>{r(e,t)})},au={api:new Wl({name:`@hey-api/schemas`}),config:{exportFromIndex:!1,nameBuilder:e=>`${e}Schema`,type:`json`},handler:$l,handlerLegacy:iu,name:`@hey-api/schemas`},ou=w(au),su=({operation:e})=>{let t=[];if(e.summary&&t.push(O(e.summary)),e.description&&(t.length&&t.push(``),t.push(O(e.description))),e.deprecated&&(t.length&&t.push(``),t.push(`@deprecated`)),t.length)return t};var cu=class{constructor(e){this.meta=e}createOperationComment(...e){return su(...e)}getSelector(...e){return[this.meta.name,...e]}};const lu=({meta:e,onImport:t,...n})=>{if(!e)return{created:!1,name:``};let{created:r,name:i}=ks({meta:e,...n});return i&&t(i),{created:r,name:i}},uu=e=>`${e}ModelResponseTransformer`,du=e=>`${T({case:`PascalCase`,value:e})}Data`,fu=e=>`${T({case:`PascalCase`,value:e})}Error`,pu=e=>`${e}Transformer`,mu=e=>`${T({case:`PascalCase`,value:e})}Response`,hu=({importedType:e,throwOnError:t})=>{let n=`OptionsLegacyParser`;return t?`${n}<${e||`unknown`}, ${t}>`:e?`${n}<${e}>`:n},gu=(e,t)=>{let n=S(),{name:r}=ks({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:du}),i=Ns(t.parameters);if(!C(n))return[{isRequired:i,name:`options`,type:hu({importedType:r,throwOnError:`ThrowOnError`})}];if(!t.parameters.length)return[];let a=e=>{if(e.default!==void 0)return JSON.stringify(e.default,null,4)};return n.useOptions?[{default:i?void 0:{},name:`data`,type:r}]:t.parameters.map(e=>{let t=`${r}['${e.name}']`;return{default:e?.default,isRequired:(!e.isRequired&&!a(e)?`?`:``)==``,name:e.name,type:t}})},_u=(e,t)=>{let n=S(),r=N.typeNode(`void`);if(t.responses.filter(e=>e.responseTypes.includes(`success`)).length){let{name:n}=ks({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:mu});r=N.typeUnionNode({types:[n]})}return n.useOptions&&n.plugins[`@hey-api/sdk`]?.config.response===`response`&&(r=N.typeNode(`ApiResult`,[r])),r=x(n).name===`legacy/angular`?N.typeNode(`Observable`,[r]):N.typeNode(`CancelablePromise`,[r]),r},vu=e=>{let t=S();if(!C(t))return[e.deprecated&&`@deprecated`,e.summary&&O(e.summary),e.description&&O(e.description)];let n=[];e.parameters.length&&(n=t.useOptions?[`@param data The data for the request.`,...e.parameters.map(e=>`@param data.${e.name} ${e.description?O(e.description):``}`)]:e.parameters.map(e=>`@param ${e.name} ${e.description?O(e.description):``}`));let r=e.responses.filter(e=>e.responseTypes.includes(`success`));return[e.deprecated&&`@deprecated`,e.summary&&O(e.summary),e.description&&O(e.description),...n,...r.map(e=>`@returns ${e.type} ${e.description?O(e.description):``}`),`@throws ApiError`]},yu=({client:e,onClientImport:t,onImport:n,operation:r})=>{let i=S(),a=mu(r.name),{name:o}=ks({client:e,meta:{$ref:`transformers/${a}`,name:a},nameTransformer:pu});if(o&&n(o),!C(i)){let e=[{spread:`options`}],n=r.parameters.filter(e=>e.in===`body`||e.in===`formData`).map(e=>e.mediaType||(e.in===`formData`?`multipart/form-data`:void 0)).filter(Boolean).filter(ts);return n.length===1&&(n[0]===`multipart/form-data`&&(e=[...e,{spread:`formDataBodySerializer`},{key:`headers`,value:[{key:`Content-Type`,value:null},{spread:`options?.headers`}]}],t?.(`formDataBodySerializer`)),n[0]===`application/x-www-form-urlencoded`&&(e=[...e,{spread:`urlSearchParamsBodySerializer`},{key:`headers`,value:[{key:`Content-Type`,value:n[0]},{spread:`options?.headers`}]}],t?.(`urlSearchParamsBodySerializer`))),e=[...e,{key:`url`,value:r.path}],o&&(e=[...e,{key:`responseTransformer`,value:o}]),N.objectExpression({identifiers:[`responseTransformer`],obj:e})}let s=e=>e.reduce((e,t)=>{let n=t.prop,r=i.useOptions?`data.${t.name}`:t.name;return n===r?e[n]=n:ut(n)===n?e[n]=r:e[`'${n}'`]=r,e},{}),c={method:r.method,url:r.path};r.parametersPath.length&&(c.path=s(r.parametersPath)),r.parametersCookie.length&&(c.cookies=s(r.parametersCookie)),r.parametersHeader.length&&(c.headers=s(r.parametersHeader)),r.parametersQuery.length&&(c.query=s(r.parametersQuery)),r.parametersForm.length&&(c.formData=s(r.parametersForm)),r.parametersBody&&(r.parametersBody.in===`formData`&&(i.useOptions?c.formData=`data.${r.parametersBody.name}`:c.formData=r.parametersBody.name),r.parametersBody.in===`body`&&(i.useOptions?c.body=`data.${r.parametersBody.name}`:c.body=r.parametersBody.name)),r.parametersBody?.mediaType&&(c.mediaType=r.parametersBody?.mediaType),r.responseHeader&&(c.responseHeader=r.responseHeader),o&&(c.responseTransformer=o);let l=r.responses.filter(e=>e.responseTypes.includes(`error`));if(l.length>0){let e={};l.forEach(t=>{e[t.code]=t.description??``}),c.errors=e}return N.objectExpression({identifiers:[`body`,`cookies`,`formData`,`headers`,`path`,`query`,`responseTransformer`],obj:c,shorthand:!0})},bu=({config:e,handleIllegal:t,id:n,operation:r})=>e.plugins[`@hey-api/sdk`]?.config.methodNameBuilder?e.plugins[`@hey-api/sdk`].config.methodNameBuilder(r):t&&n.match(ot)?`${n}_`:n,xu=({client:e,onClientImport:t,onImport:n,operation:r})=>{let i=S(),a=yu({client:e,onClientImport:t,onImport:n,operation:r});if(!C(i)){let t=ks({client:e,meta:{$ref:r.name,name:r.name},nameTransformer:fu}).name,n=r.responses.filter(e=>e.responseTypes.includes(`success`)).length?ks({client:e,meta:{$ref:r.name,name:r.name},nameTransformer:mu}).name:`void`;return[N.returnFunctionCall({args:[a],name:`(options?.client ?? client).${r.method.toLocaleLowerCase()}`,types:t&&n?[n,t,`ThrowOnError`]:t?[`unknown`,t,`ThrowOnError`]:n?[n,`unknown`,`ThrowOnError`]:[]})]}return _e(i)?[N.returnFunctionCall({args:[a],name:`this.httpRequest.request`})]:x(i).name===`legacy/angular`?[N.returnFunctionCall({args:[`OpenAPI`,`this.http`,a],name:`__request`})]:[N.returnFunctionCall({args:[`OpenAPI`,a],name:`__request`})]},Su=({client:e,onClientImport:t,onImport:n,onNode:r,service:i})=>{let a=S(),o=x(a),s=C(a);for(let t of i.operations)t.parameters.length&&lu({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:du,onImport:n}),s||lu({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:fu,onImport:n}),t.responses.filter(e=>e.responseTypes.includes(`success`)).length&&lu({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:mu,onImport:n});let c={default:(`throwOnError`in o.config?o.config.throwOnError:!1)??!1,extends:`boolean`,name:`ThrowOnError`};if(!a.plugins[`@hey-api/sdk`]?.config.asClass&&!_e(a)){for(let l of i.operations){let i={parameters:gu(e,l),returnType:s?_u(e,l):void 0,statements:xu({client:e,onClientImport:t,onImport:n,operation:l}),types:s?void 0:[c]},u=o.name===`legacy/angular`?N.anonymousFunction(i):N.arrowFunction(i);r(N.constVariable({comment:vu(l),exportConst:!0,expression:u,name:bu({config:a,handleIllegal:!0,id:l.name,operation:l})}))}return}let l=i.operations.map(r=>N.methodDeclaration({accessLevel:`public`,comment:vu(r),isStatic:_e(a)===void 0&&o.name!==`legacy/angular`,name:bu({config:a,id:r.name,operation:r}),parameters:gu(e,r),returnType:s?_u(e,r):void 0,statements:xu({client:e,onClientImport:t,onImport:n,operation:r}),types:s?void 0:[c]}));if(!l.length)return;_e(a)?l=[N.constructorDeclaration({multiLine:!1,parameters:[{accessLevel:`public`,isReadOnly:!0,name:`httpRequest`,type:`BaseHttpRequest`}]}),...l]:o.name===`legacy/angular`&&(l=[N.constructorDeclaration({multiLine:!1,parameters:[{accessLevel:`public`,isReadOnly:!0,name:`http`,type:`HttpClient`}]}),...l]);let u=[];l.forEach((e,t)=>{t&&u.push(N.identifier({text:`
21
21
  `})),u.push(e)}),r(N.classDeclaration({decorator:o.name===`legacy/angular`?{args:[{providedIn:`root`}],name:`Injectable`}:void 0,exportClass:!0,name:Go({config:a,name:i.name}),nodes:u}))},Cu=({client:e,files:t,plugin:n})=>{let r=S(),i=C(r);if(t.sdk=new eu({dir:r.output.path,exportFromIndex:n.config.exportFromIndex,id:`sdk`,name:`sdk.ts`}),!i)t.sdk.import({module:ol({config:r,sourceOutput:`sdk`}),name:`createClient`}),t.sdk.import({module:ol({config:r,sourceOutput:`sdk`}),name:`createConfig`}),t.sdk.import({asType:!0,module:ol({config:r,sourceOutput:`sdk`}),name:`OptionsLegacyParser`});else if(x(r).name===`legacy/angular`?(t.sdk.import({module:`@angular/core`,name:`Injectable`}),_e(r)||t.sdk.import({module:`@angular/common/http`,name:`HttpClient`}),t.sdk.import({asType:!0,module:`rxjs`,name:`Observable`})):t.sdk.import({asType:!0,module:`./core/CancelablePromise`,name:`CancelablePromise`}),r.plugins[`@hey-api/sdk`]?.config.response===`response`&&t.sdk.import({asType:!0,module:`./core/ApiResult`,name:`ApiResult`}),_e(r)){let e=x(r);t.sdk.import({asType:e.name!==`legacy/angular`,module:`./core/BaseHttpRequest`,name:`BaseHttpRequest`})}else t.sdk.import({module:`./core/OpenAPI`,name:`OpenAPI`}),t.sdk.import({alias:`__request`,module:`./core/request`,name:`request`});if(!i){let e=x(r),n=N.constVariable({exportConst:!0,expression:N.callExpression({functionName:`createClient`,parameters:[N.callExpression({functionName:`createConfig`,parameters:[`throwOnError`in e&&e.throwOnError?N.objectExpression({obj:[{key:`throwOnError`,value:!0}]}):void 0]})]}),name:`client`});t.sdk.add(n)}for(let n of e.services)Su({client:e,onClientImport:e=>{t.sdk.import({module:ol({config:r,sourceOutput:`sdk`}),name:e})},onImport:e=>{t.sdk.import({asType:!e.endsWith(`Transformer`),module:`./${t.types.nameWithoutExtension()}`,name:e})},onNode:e=>{t.sdk.add(e)},service:n})},wu=({plugin:e})=>{let t=sl(e.context.config),n=x(e.context.config).name===`@hey-api/client-nuxt`,r=e.registerSymbol({external:t,meta:{kind:`type`},name:`TDataShape`}),i=e.registerSymbol({external:t,meta:{kind:`type`},name:`Client`,selector:e.api.getSelector(`Client`)}),a=e.registerSymbol({external:t,meta:{kind:`type`},name:`Options`}),o=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`Options`,selector:e.api.getSelector(`Options`)}),s=N.typeAliasDeclaration({exportType:o.exported,name:o.placeholder,type:N.typeIntersectionNode({types:[N.typeReferenceNode({typeArguments:n?[N.typeReferenceNode({typeName:`TComposable`}),N.typeReferenceNode({typeName:`TData`}),N.typeReferenceNode({typeName:kc}),N.typeReferenceNode({typeName:Oc})]:[N.typeReferenceNode({typeName:`TData`}),N.typeReferenceNode({typeName:`ThrowOnError`})],typeName:a.placeholder}),N.typeInterfaceNode({properties:[{comment:["You can provide a client instance returned by `createClient()` instead of",`individual options. This might be also useful if you want to implement a`,`custom client.`],isRequired:!e.config.client,name:`client`,type:N.typeReferenceNode({typeName:i.placeholder})},{comment:["You can pass arbitrary values through the `meta` object. This can be",`used to access values that aren't defined as part of the SDK function.`],isRequired:!1,name:`meta`,type:N.typeReferenceNode({typeArguments:[N.keywordTypeNode({keyword:`string`}),N.keywordTypeNode({keyword:`unknown`})],typeName:`Record`})}],useLegacyResolution:!1})]}),typeParameters:n?[N.typeParameterDeclaration({constraint:N.typeReferenceNode({typeName:e.referenceSymbol(e.api.getSelector(`Composable`)).placeholder}),defaultType:N.typeNode(`'$fetch'`),name:`TComposable`}),N.typeParameterDeclaration({constraint:N.typeReferenceNode({typeName:r.placeholder}),defaultType:N.typeReferenceNode({typeName:r.placeholder}),name:`TData`}),N.typeParameterDeclaration({defaultType:N.keywordTypeNode({keyword:`unknown`}),name:kc}),N.typeParameterDeclaration({defaultType:N.keywordTypeNode({keyword:`undefined`}),name:Oc})]:[N.typeParameterDeclaration({constraint:N.typeReferenceNode({typeName:r.placeholder}),defaultType:N.typeReferenceNode({typeName:r.placeholder}),name:`TData`}),N.typeParameterDeclaration({constraint:N.keywordTypeNode({keyword:`boolean`}),defaultType:N.keywordTypeNode({keyword:`boolean`}),name:`ThrowOnError`})]});e.setSymbolValue(o,s)},Tu=({plugin:e})=>{let t=N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:N.this(),name:`_client`}),operator:`=`,right:N.propertyAccessExpression({expression:N.identifier({text:`args`}),name:`client`})})}),n=e.referenceSymbol(e.api.getSelector(`Client`)),r=x(e.context.config),i=r.api&&`getSelector`in r.api?e.getSymbol(r.api.getSelector(`client`)):void 0;return[N.propertyDeclaration({initializer:i?N.identifier({text:i.placeholder}):void 0,modifier:`protected`,name:`_client`,type:N.typeReferenceNode({typeName:n.placeholder})}),N.identifier({text:`
22
22
  `}),N.constructorDeclaration({multiLine:!0,parameters:[{isRequired:!e.config.client,name:`args`,type:N.typeInterfaceNode({properties:[{isRequired:!e.config.client,name:`client`,type:n.placeholder}],useLegacyResolution:!1})}],statements:[e.config.client?N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`args`}),isOptional:!0,name:`client`}),thenStatement:N.block({statements:[t]})}):t]})]},Eu=({plugin:e})=>{let t=x(e.context.config),n=t.name===`@hey-api/client-angular`,r=t.name===`@hey-api/client-nuxt`,i=new Map,a=new Set,o=e.config.instance?Tu({plugin:e}):[];e.forEach(`operation`,({operation:a})=>{let o=zc({context:e.context,operation:a}),s=e.getPluginOrThrow(`@hey-api/typescript`),c=r?e.getSymbol(s.api.getSelector(`response`,a.id)):void 0,l=Pc({context:e.context,operation:a,plugin:e});for(let s of l.values())s.path.forEach((l,u)=>{let d=e.referenceSymbol(e.api.getSelector(`class`,l));i.has(d.id)||i.set(d.id,{className:l,classes:new Set,id:d.id,methods:new Set,nodes:[],root:!u});let f=s.path[u-1];if(f){let t=e.referenceSymbol(e.api.getSelector(`class`,f));if(t.placeholder!==d.placeholder){let e=i.get(t.id);e.classes.add(d.id),i.set(t.id,e)}}if(s.path.length!==u+1)return;let p=i.get(d.id);if(p.methods.has(s.methodName))return;let m=Ic({isRequiredOptions:o,operation:a,plugin:e}),h=Rc({isRequiredOptions:o,opParameters:m,operation:a,plugin:e}),g=N.methodDeclaration({accessLevel:`public`,comment:e.api.createOperationComment({operation:a}),isStatic:n?!1:!e.config.instance,name:s.methodName,parameters:m.parameters,returnType:void 0,statements:h,types:r?[{default:N.ots.string(`$fetch`),extends:N.typeNode(e.referenceSymbol(e.api.getSelector(`Composable`)).placeholder),name:Dc},{default:c?N.typeReferenceNode({typeName:c.placeholder}):N.typeNode(`undefined`),extends:c?N.typeReferenceNode({typeName:c.placeholder}):void 0,name:Oc}]:[{default:(`throwOnError`in t.config?t.config.throwOnError:!1)??!1,extends:`boolean`,name:`ThrowOnError`}]});p.nodes.length?p.nodes.push(N.identifier({text:`
23
- `}),g):p.nodes.push(g),p.methods.add(s.methodName),i.set(d.id,p)})});let s=e.registerSymbol({exported:!1,name:`_HeyApiClient`}),c=t=>{if(a.has(t.id))return;if(t.classes.size)for(let n of t.classes){let r=i.get(n);c(r),t.nodes.push(N.propertyDeclaration({initializer:e.config.instance?N.newExpression({argumentsArray:e.config.instance?[N.objectExpression({multiLine:!1,obj:[{key:`client`,value:N.propertyAccessExpression({expression:N.this(),name:`_client`})}]})]:[],expression:N.identifier({text:e.referenceSymbol(r.id).placeholder})}):N.identifier({text:e.referenceSymbol(r.id).placeholder}),modifier:e.config.instance?void 0:`static`,name:T({case:`camelCase`,value:r.className})}))}let r=e.registerSymbol({exported:!0,name:t.className,selector:e.api.getSelector(`class`,t.className)}),o=N.classDeclaration({decorator:t.root&&n?{args:[{providedIn:`root`}],name:e.referenceSymbol(e.api.getSelector(`Injectable`)).placeholder}:void 0,exportClass:r.exported,extendedClasses:e.config.instance?[s.placeholder]:void 0,name:r.placeholder,nodes:t.nodes});e.setSymbolValue(r,o),a.add(r.id)};if(o.length){let t=N.classDeclaration({exportClass:s.exported,name:s.placeholder,nodes:o});e.setSymbolValue(s,t)}for(let e of i.values())c(e)},Du=({plugin:e})=>{let t=x(e.context.config),n=t.name===`@hey-api/client-nuxt`;e.forEach(`operation`,({operation:r})=>{let i=zc({context:e.context,operation:r}),a=e.getPluginOrThrow(`@hey-api/typescript`),o=n?e.getSymbol(a.api.getSelector(`response`,r.id)):void 0,s=Ic({isRequiredOptions:i,operation:r,plugin:e}),c=Rc({isRequiredOptions:i,opParameters:s,operation:r,plugin:e}),l=e.registerSymbol({name:bu({config:e.context.config,handleIllegal:!0,id:r.id,operation:r}),selector:e.api.getSelector(`function`,r.id)}),u=N.constVariable({comment:e.api.createOperationComment({operation:r}),exportConst:!0,expression:N.arrowFunction({parameters:s.parameters,returnType:void 0,statements:c,types:n?[{default:N.ots.string(`$fetch`),extends:N.typeNode(e.referenceSymbol(e.api.getSelector(`Composable`)).placeholder),name:Dc},{default:o?N.typeReferenceNode({typeName:o.placeholder}):N.typeNode(`undefined`),extends:o?N.typeReferenceNode({typeName:o.placeholder}):void 0,name:Oc}]:[{default:(`throwOnError`in t.config?t.config.throwOnError:!1)??!1,extends:`boolean`,name:`ThrowOnError`}]}),name:l.placeholder});e.setSymbolValue(l,u)})},Ou=({plugin:e})=>{let t=sl(e.context.config);e.registerSymbol({external:t,name:`formDataBodySerializer`,selector:e.api.getSelector(`formDataBodySerializer`)}),e.registerSymbol({external:t,name:`urlSearchParamsBodySerializer`,selector:e.api.getSelector(`urlSearchParamsBodySerializer`)}),e.registerSymbol({external:t,name:`buildClientParams`,selector:e.api.getSelector(`buildClientParams`)});let n=x(e.context.config),r=n.name===`@hey-api/client-angular`;n.name===`@hey-api/client-nuxt`&&e.registerSymbol({external:t,meta:{kind:`type`},name:`Composable`,selector:e.api.getSelector(`Composable`)}),r&&e.config.asClass&&e.registerSymbol({external:`@angular/core`,name:`Injectable`,selector:e.api.getSelector(`Injectable`)}),wu({plugin:e}),e.config.asClass?Eu({plugin:e}):Du({plugin:e})},ku={api:new cu({name:`@hey-api/sdk`}),config:{asClass:!1,auth:!0,classNameBuilder:`{{name}}`,classStructure:`auto`,client:!0,exportFromIndex:!0,instance:!1,operationId:!0,params_EXPERIMENTAL:`default`,response:`body`,responseStyle:`fields`,transformer:!1,validator:!1},dependencies:[`@hey-api/typescript`],handler:Ou,handlerLegacy:Cu,name:`@hey-api/sdk`,resolveConfig:(e,t)=>{e.config.client?(typeof e.config.client==`boolean`&&(e.config.client=t.pluginByTag(`client`,{defaultPlugin:`@hey-api/client-fetch`})),e.dependencies.add(e.config.client)):e.config.client=!1,e.config.transformer?(typeof e.config.transformer==`boolean`&&(e.config.transformer=t.pluginByTag(`transformer`)),e.dependencies.add(e.config.transformer)):e.config.transformer=!1,typeof e.config.validator!=`object`&&(e.config.validator={request:e.config.validator,response:e.config.validator}),e.config.validator.request?(typeof e.config.validator.request==`boolean`&&(e.config.validator.request=t.pluginByTag(`validator`)),e.dependencies.add(e.config.validator.request)):e.config.validator.request=!1,e.config.validator.response?(typeof e.config.validator.response==`boolean`&&(e.config.validator.response=t.pluginByTag(`validator`)),e.dependencies.add(e.config.validator.response)):e.config.validator.response=!1,e.config.instance?(typeof e.config.instance!=`string`&&(e.config.instance=`Sdk`),e.config.asClass=!0):e.config.instance=!1,e.config.classNameBuilder===`{{name}}`&&e.config.client===`@hey-api/client-angular`&&(e.config.classNameBuilder=`{{name}}Service`)}},Au=w(ku);var ju=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Mu=({dataExpression:e,schema:t})=>{if(t.type!==`integer`||t.format!==`int64`)return;let n=e===void 0?void 0:N.callExpression({functionName:`BigInt`,parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:e,name:`toString`})})]});if(n){if(typeof e==`string`)return[n];if(e)return[N.assignment({left:e,right:n})]}},Nu=({dataExpression:e,schema:t})=>{if(t.type!==`string`||!(t.format===`date`||t.format===`date-time`))return;let n=N.identifier({text:`Date`});if(typeof e==`string`)return[N.newExpression({argumentsArray:[N.identifier({text:e})],expression:n})];if(e)return[N.assignment({left:e,right:N.newExpression({argumentsArray:[e],expression:n})})]},Pu=`data`,Fu=e=>e.map(e=>p.default.isStatement(e)?e:N.expressionToStatement({expression:e})),Iu=({node:e})=>e.kind===p.default.SyntaxKind.ReturnStatement,Lu=({plugin:e,schema:t})=>{let n=N.identifier({text:Pu}),r=Ru({dataExpression:n,plugin:e,schema:t});return r.length&&!Iu({node:r[r.length-1]})&&r.push(N.returnStatement({expression:n})),r},Ru=({dataExpression:e,plugin:t,schema:n})=>{if(n.$ref){let r=t.api.getSelector(`response-ref`,n.$ref);if(!t.getSymbol(r)){let e=t.registerSymbol({name:E({config:{case:`camelCase`,name:`{{name}}SchemaResponseTransformer`},name:L(n.$ref)}),selector:r}),i=Lu({plugin:t,schema:t.context.resolveIrRef(n.$ref)});if(i.length){let n=N.constVariable({expression:N.arrowFunction({async:!1,multiLine:!0,parameters:[{name:Pu,type:N.keywordTypeNode({keyword:`any`})}],statements:Fu(i)}),name:e.placeholder});t.setSymbolValue(e,n)}else t.setSymbolValue(e,null)}let i=t.referenceSymbol(r);if(t.getSymbolValue(i)!==null){let t=N.callExpression({functionName:i.placeholder,parameters:[e]});if(e)return typeof e==`string`&&e===`item`?[N.returnStatement({expression:t})]:[typeof e==`string`?t:N.assignment({left:e,right:t})]}return[]}if(n.type===`array`){if(!e||typeof e==`string`)return[];let r=n.items?Ru({dataExpression:`item`,plugin:t,schema:n.items?.[0]?n.items[0]:{...n,type:void 0}}):[];if(!r.length)return[];let i=Fu(r);return i.some(e=>Iu({node:e}))||i.push(N.returnStatement({expression:N.identifier({text:`item`})})),[N.assignment({left:e,right:N.callExpression({functionName:N.propertyAccessExpression({expression:e,name:`map`}),parameters:[N.arrowFunction({multiLine:!0,parameters:[{name:`item`,type:`any`}],statements:i})]})})]}if(n.type===`object`){let r=[],i=n.required??[];for(let a in n.properties){let o=n.properties[a],s=N.propertyAccessExpression({expression:e||Pu,name:a}),c=Ru({dataExpression:s,plugin:t,schema:o});if(!c.length)continue;let l=!o.items?.find(e=>e.type===`null`);i.includes(a)&&l?r=r.concat(c):r.push(N.ifStatement({expression:s,thenStatement:N.block({statements:Fu(c)})}))}return r}if(n.items){if(n.items.length===1)return Ru({dataExpression:`item`,plugin:t,schema:n.items[0]});let r=[];if(n.logicalOperator===`and`||n.items.length===2&&n.items.find(e=>e.type===`null`||e.type===`void`)){for(let i of n.items){let n=Ru({dataExpression:e||`item`,plugin:t,schema:i});if(n.length)if(e)r=r.concat(n);else{let e=N.identifier({text:`item`});r.push(N.ifStatement({expression:e,thenStatement:N.block({statements:Fu(n)})}),N.returnStatement({expression:e}))}}return r}n.type!==`enum`&&((n.items??[]).every(e=>[`boolean`,`integer`,`null`,`number`,`string`].includes(e.type))||console.warn(`❗️ Transformers warning: schema ${JSON.stringify(n)} is too complex and won't be currently processed. This will likely produce an incomplete transformer which is not what you want. Please open an issue if you'd like this improved https://github.com/hey-api/openapi-ts/issues`))}for(let r of t.config.transformers){let i=r({config:t.config,dataExpression:e,schema:n});if(i)return i}return[]},zu=({plugin:e})=>{e.forEach(`operation`,({operation:t})=>{let{response:n}=Kn(t);if(!n)return;if(n.items&&n.items.length>1){e.context.config.logs.level===`debug`&&console.warn(`❗️ Transformers warning: route ${I(t)} has ${n.items.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`);return}let r=e.getPluginOrThrow(`@hey-api/typescript`),i=e.getSymbol(r.api.getSelector(`response`,t.id));if(!i)return;let a=e.registerSymbol({exported:!0,name:E({config:{case:`camelCase`,name:`{{name}}ResponseTransformer`},name:t.id}),selector:e.api.getSelector(`response`,t.id)}),o=Lu({plugin:e,schema:n});if(o.length){let t=N.constVariable({exportConst:a.exported,expression:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:Pu,type:N.keywordTypeNode({keyword:`any`})}],returnType:N.typeReferenceNode({typeArguments:[N.typeReferenceNode({typeName:i.placeholder})],typeName:`Promise`}),statements:Fu(o)}),name:a.placeholder});e.setSymbolValue(a,t)}else e.setSymbolValue(a,null)})},Bu=`$OpenApiTs`,Y={$refs:[],base:``,description:null,enum:[],enums:[],export:`interface`,imports:[],in:``,isDefinition:!1,isNullable:!1,isReadOnly:!1,isRequired:!1,link:null,name:``,properties:[],template:null,type:``},Vu=({comments:e,leadingComment:t,meta:n,obj:r,onNode:i,...a})=>{if(!n)return;let{created:o,name:s}=ks({create:!0,meta:n,...a});if(o){let n=S().plugins[`@hey-api/typescript`];i(N.enumDeclaration({asConst:typeof n?.config.enums==`object`&&n.config.enums.mode===`typescript-const`,comments:e,leadingComment:t,name:s,obj:r}))}},Hu=({comment:e,meta:t,onCreated:n,onNode:r,type:i,...a})=>{if(!t)return{created:!1,name:``};let o=ks({create:!0,meta:t,...a}),{created:s,name:c}=o;return s&&(r(N.typeAliasDeclaration({comment:e,exportType:!0,name:c,type:i})),n?.(c)),o},Uu=e=>{let t=[];Ku(e),e.model.enums.forEach(n=>Gu({...e,model:n,onNode:e=>{t.push(e)}})),t.length&&e.onNode(N.namespaceDeclaration({name:e.model.name,statements:t}))},Wu=({client:e,model:t,onNode:n})=>{let r=S(),i={},a={};t.enum.forEach(e=>{let{key:t,value:n}=_s(e);i[t]=n;let r=e.customDescription||e.description;r&&(a[t]=[O(r)])});let o=[t.description&&O(t.description),t.deprecated&&`@deprecated`],s=r.plugins[`@hey-api/typescript`];if(s?.config&&typeof s.config.enums==`object`&&s.config.enums.enabled&&(s.config.enums.mode===`typescript`||s.config.enums.mode===`typescript-const`)){Vu({asConst:s.config.enums.mode===`typescript-const`,client:e,comments:a,leadingComment:o,meta:t.meta,obj:i,onNode:n});return}Hu({client:e,comment:o,meta:t.meta,onCreated:e=>{let t=r.plugins[`@hey-api/typescript`];if(t?.config&&typeof t.config.enums==`object`&&t.config.enums.enabled&&t.config.enums.mode===`javascript`){let t=N.objectExpression({multiLine:!0,obj:Object.entries(i).map(([e,t])=>({comments:a[e],key:e,value:t})),unescape:!0});n(N.constVariable({assertion:`const`,comment:o,exportConst:!0,expression:t,name:e}))}},onNode:n,type:hs(t.enum)})},Gu=({model:e,onNode:t})=>{let n={},r={};e.enum.forEach(e=>{let{key:t,value:i}=_s(e);n[t]=i;let a=e.customDescription||e.description;a&&(r[t]=[O(a)])});let i=S().plugins[`@hey-api/typescript`];t(N.enumDeclaration({asConst:typeof i?.config.enums==`object`&&i.config.enums.mode===`typescript-const`,comments:r,leadingComment:[e.description&&O(e.description),e.deprecated&&`@deprecated`],name:e.meta?.name||e.name,obj:n}))},Ku=({client:e,model:t,onNode:n})=>{Hu({client:e,comment:[t.description&&O(t.description),t.deprecated&&`@deprecated`],meta:t.meta,onNode:n,type:K(t)})},qu=e=>{switch(e.model.export){case`all-of`:case`any-of`:case`one-of`:case`interface`:return Uu(e);case`enum`:return Wu(e);default:return Ku(e)}},Ju=({client:e,onNode:t})=>{let n={},r=S();if(!r.plugins[`@hey-api/sdk`]&&!r.plugins[`@hey-api/typescript`]?.config.tree)return;let i=C(r);for(let r of e.services)for(let a of r.operations){if(!a.parameters.length&&!a.responses.length)continue;n[a.path]||(n[a.path]={});let r=n[a.path];r[a.method]||(r[a.method]={});let o=r[a.method];if(o.$ref=a.name,a.responses.length>0){if(o.res||={},Array.isArray(o.res))continue;a.responses.forEach(e=>{o.res[e.code]=e})}if(a.parameters.length>0){let n={mediaType:null,...Y,in:`body`,name:`body`,prop:`body`},r=a.parameters.filter(e=>e.in===`body`);r.length||(r=a.parameters.filter(e=>e.in===`formData`)),r.length===1?n={...Y,...r[0],in:`body`,isRequired:r[0].isRequired,name:`body`,prop:`body`}:r.length>1&&(n={...Y,in:`body`,isRequired:r.some(e=>e.isRequired),mediaType:`multipart/form-data`,name:`body`,prop:`body`,properties:r});let s={...Y,in:`header`,isRequired:Ns(a.parameters.filter(e=>e.in===`header`)),mediaType:null,name:i?`header`:`headers`,prop:i?`header`:`headers`,properties:a.parameters.filter(e=>e.in===`header`).sort(fs)},c={...Y,in:`path`,isRequired:Ns(a.parameters.filter(e=>e.in===`path`)),mediaType:null,name:`path`,prop:`path`,properties:a.parameters.filter(e=>e.in===`path`).sort(fs)},l={...Y,in:`query`,isRequired:Ns(a.parameters.filter(e=>e.in===`query`)),mediaType:null,name:`query`,prop:`query`,properties:a.parameters.filter(e=>e.in===`query`).sort(fs)},u=i?ps([...a.parameters]):[n,s,c,l].filter(e=>e.properties.length||e.$refs.length||e.mediaType);o.req=u,Hu({client:e,meta:{$ref:a.name,name:a.name},nameTransformer:du,onNode:t,type:K({...Y,isRequired:!0,properties:u})})}let s=a.responses.filter(e=>e.responseTypes.includes(`success`));if(s.length>0){Hu({client:e,meta:{$ref:a.name,name:a.name},nameTransformer:mu,onNode:t,type:K({...Y,export:`any-of`,isRequired:!0,properties:s})});let n=a.responses.filter(e=>e.responseTypes.includes(`error`));i||Hu({client:e,meta:{$ref:a.name,name:a.name},nameTransformer:fu,onNode:t,type:K(n.length?{...Y,export:`one-of`,isRequired:!0,properties:n}:{...Y,base:`unknown`,isRequired:!0,type:`unknown`})})}}let a=Object.entries(n).map(([t,n])=>{let r=Object.entries(n).map(([t,n])=>{let r=t,i=[];if(n.req){let t=n.$ref,{name:r}=ks({client:e,meta:{$ref:t,name:t},nameTransformer:du}),a={...Y,base:r,export:`reference`,isRequired:!0,name:`req`,properties:[],type:r};i=[...i,a]}if(n.res){let e=Object.entries(n.res).map(([e,t])=>({...Y,...t,isRequired:!0,name:String(e)})),t={...Y,isRequired:!0,name:`res`,properties:e};i=[...i,t]}return{...Y,isRequired:!0,name:r.toLocaleLowerCase(),properties:i}}).filter(Boolean);return{...Y,isRequired:!0,name:`'${t}'`,properties:r}});r.plugins[`@hey-api/typescript`]?.config.tree&&Hu({client:e,meta:{$ref:`@hey-api/openapi-ts`,name:`$OpenApiTs`},onNode:t,type:K({...Y,properties:a})})},Yu=({client:e,files:t,plugin:n})=>{t.types=new eu({dir:S().output.path,exportFromIndex:n.config.exportFromIndex,id:`types`,name:`types.ts`});let r=e=>{t.types?.add(e)};for(let t of e.models)qu({client:e,model:t,onNode:r});Ju({client:e,onNode:r})},Xu=`data`,Zu=e=>e.base===`unknown`&&e.export===`generic`&&e.type===`unknown`,Qu=({client:e,model:t})=>t.$refs.map(t=>{let n=e.models.find(e=>e.meta?.$ref===t);if(!n)throw Error(`Ref ${t} could not be found. Transformers cannot be generated without having access to all refs.`);return n}),$u=e=>{let t=e.model.meta.name,{name:n}=Hu({...e,meta:{$ref:`transformers/${t}`,name:t},nameTransformer:uu,onCreated:n=>{let r=nd({...e,meta:{$ref:`transformers/${t}`,name:n},path:[Xu]});rd({...e,async:!1,name:n,statements:r})},type:`(${Xu}: any) => ${t}`});return{created:!!e.client.types[n],name:n}},ed=e=>{let{model:t}=e,n=Qu(e);if(n.length===1){let{created:t,name:r}=$u({...e,model:n[0]});return t?[N.transformArrayMutation({path:e.path,transformerName:r})]:[]}return xs(t)||t.link&&!Array.isArray(t.link)&&t.link.export===`any-of`&&t.link.properties.find(e=>xs(e))?[N.transformArrayMap({path:e.path,transformExpression:N.conditionalExpression({condition:N.identifier({text:`item`}),whenFalse:N.identifier({text:`item`}),whenTrue:N.transformNewDate({parameterName:`item`})})})]:[]},td=e=>{let{model:t}=e,n=[...e.path,t.name];return t.type===`string`&&t.export!==`array`&&xs(t)?[N.transformDateMutation({path:n})]:nd({...e,model:t,path:n})},nd=e=>{let{model:t}=e;switch(t.export){case`array`:return ed(e);case`interface`:return t.properties.flatMap(t=>td({...e,model:t}));case`reference`:{if(t.$refs.length!==1)return[];let n=Qu(e),{created:r,name:i}=$u({...e,model:n[0]});return r?t.in===`response`?[N.expressionToStatement({expression:N.callExpression({functionName:i,parameters:[Xu]})})]:N.transformFunctionMutation({path:e.path,transformerName:i}):[]}default:return[]}},rd=({async:e,client:t,name:n,onNode:r,onRemoveNode:i,statements:a})=>{let o={created:!1,name:n};if(!a.length)return As({client:t,name:n}),i?.(),o;let s=N.arrowFunction({async:e,multiLine:!0,parameters:[{name:Xu}],statements:[...a,N.returnVariable({expression:Xu})]});return r(N.constVariable({exportConst:!0,expression:s,name:n,typeName:n})),{created:!0,name:n}},id=({client:e,files:t})=>{let n=S(),r=e=>{t.types?.add(e)},i=()=>{t.types?.removeNode_LEGACY()};for(let t of e.services)for(let a of t.operations){let t=a.responses.filter(e=>e.responseTypes.includes(`success`));if(!t.length)continue;let o=t.filter(e=>!Zu(e));if(!o.length)continue;if(o.length>1){n.logs.level===`debug`&&console.warn(`❗️ Transformers warning: route ${I(a)} has ${o.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`);continue}let s=mu(a.name);Hu({client:e,meta:{$ref:`transformers/${s}`,name:s},nameTransformer:pu,onCreated:n=>{rd({async:!0,client:e,name:n,onNode:r,onRemoveNode:i,statements:t.length>1?t.flatMap(t=>{let n=nd({client:e,meta:{$ref:`transformers/${s}`,name:s},model:t,onNode:r,onRemoveNode:i,path:[Xu]});return n.length?[N.ifStatement({expression:N.safeAccessExpression([`data`]),thenStatement:N.block({statements:n})})]:[]}):nd({client:e,meta:{$ref:`transformers/${s}`,name:s},model:t[0],onNode:r,onRemoveNode:i,path:[Xu]})})},onNode:r,type:`(${Xu}: any) => Promise<${s}>`})}},ad={api:new ju({name:`@hey-api/transformers`}),config:{bigInt:!0,dates:!0,exportFromIndex:!1,transformers:[],typeTransformers:[]},dependencies:[`@hey-api/typescript`],handler:zu,handlerLegacy:id,name:`@hey-api/transformers`,resolveConfig:e=>{e.config.transformers||(e.config.transformers=[]),e.config.dates&&(e.config.transformers=[...e.config.transformers,Nu]),e.config.bigInt&&(e.config.transformers=[...e.config.transformers,Mu])},tags:[`transformer`]},od=w(ad),sd=({context:e,name:t})=>(D.lastIndex=0,D.test(t)?t.startsWith(`-`)?p.default.factory.createStringLiteral(t):p.default.factory.createNumericLiteral(t):T({case:e.config.output.case,value:t})),cd=({schema:e})=>{let t=[];return e.title&&t.push(O(e.title)),e.description&&(t.length&&t.push(``),t.push(O(e.description))),e.deprecated&&(t.length&&t.push(``),t.push(`@deprecated`)),t.length?t:void 0},ld=N.keywordTypeNode({keyword:`string`}),ud=({server:e})=>{let t=la(e.url);return t.protocol&&t.host?N.literalTypeNode({literal:N.stringLiteral({text:e.url})}):N.templateLiteralType({value:[t.protocol||ld,`://`,t.host||ld,t.port?`:${t.port}`:``,t.path||``]})},dd=({plugin:e,servers:t,symbolClientOptions:n})=>{let r=x(e.context.config),i=t.map(e=>ud({server:e}));t.length?`strictBaseUrl`in r.config&&r.config.strictBaseUrl||i.push(N.typeIntersectionNode({types:[ld,p.default.factory.createTypeLiteralNode([])]})):i.push(ld);let a=N.typeInterfaceNode({properties:[{name:me(e.context.config),type:N.typeUnionNode({types:i})}],useLegacyResolution:!1}),o=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:a});e.setSymbolValue(n,o)},fd=({plugin:e,schema:t})=>{let n=[];return{obj:(t.items??[]).map((t,r)=>{let i=typeof t.const;n.includes(i)||n.push(i);let a;return a=t.title?t.title:i===`number`||i===`string`?`${t.const}`:i===`boolean`?t.const?`true`:`false`:t.const===null?`null`:`${r}`,a&&(a=T({case:e.config.enums.case,stripLeadingSeparators:!1,value:a}),D.lastIndex=0,D.test(a)&&e.config.enums.enabled&&(e.config.enums.mode===`typescript`||e.config.enums.mode===`typescript-const`)&&(a=`_${a}`)),{comments:cd({schema:t}),key:a,value:t.const}}),typeofItems:n}},pd=({plugin:e,schema:t,symbol:n,type:r})=>{if(t.type===`enum`&&e.config.enums.enabled){let r=fd({plugin:e,schema:t});if(e.config.enums.mode===`javascript`){e.config.enums.constantsIgnoreNull&&r.typeofItems.includes(`object`)&&(r.obj=r.obj.filter(e=>e.value!==null));let i=N.constVariable({assertion:`const`,comment:cd({schema:t}),exportConst:!0,expression:N.objectExpression({multiLine:!0,obj:r.obj}),name:n.placeholder}),a=N.typeOfExpression({text:n.placeholder}),o=N.typeAliasDeclaration({comment:cd({schema:t}),exportType:!0,name:n.placeholder,type:N.indexedAccessTypeNode({indexType:N.typeOperatorNode({operator:`keyof`,type:a}),objectType:a})});e.setSymbolValue(n,[i,o]);return}else if((e.config.enums.mode===`typescript`||e.config.enums.mode===`typescript-const`)&&!r.typeofItems.some(e=>e!==`number`&&e!==`string`)){let i=N.enumDeclaration({asConst:e.config.enums.mode===`typescript-const`,leadingComment:cd({schema:t}),name:n.placeholder,obj:r.obj});e.setSymbolValue(n,i);return}}let i=N.typeAliasDeclaration({comment:cd({schema:t}),exportType:n.exported,name:n.placeholder,type:r});e.setSymbolValue(n,i)},md=({parameters:e})=>{let t={type:`object`};if(e){let n={},r=[];for(let t in e){let i=e[t];n[i.name]=P({detectFormat:!1,schema:i.schema}),i.required&&r.push(i.name)}t.properties=n,r.length&&(t.required=r)}return t},hd=({operation:e,plugin:t})=>{let n={type:`object`},r=[];n.properties||={},e.body?(n.properties.body=e.body.schema,e.body.required&&r.push(`body`)):n.properties.body={type:`never`},e.parameters?.header&&(n.properties.headers=md({parameters:e.parameters.header}),n.properties.headers.required&&r.push(`headers`)),e.parameters?.path?(n.properties.path=md({parameters:e.parameters.path}),n.properties.path.required&&r.push(`path`)):n.properties.path={type:`never`},e.parameters?.query?(n.properties.query=md({parameters:e.parameters.query}),n.properties.query.required&&r.push(`query`)):n.properties.query={type:`never`},n.properties.url={const:e.path,type:`string`},r.push(`url`),n.required=r;let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.requests,name:e.id}),selector:t.api.getSelector(`data`,e.id)}),a=X({plugin:t,schema:n}),o=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:a});t.setSymbolValue(i,o)},gd=({operation:e,plugin:t})=>{hd({operation:e,plugin:t});let{error:n,errors:r,response:i,responses:a}=Kn(e);if(r){let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.errors,name:e.id}),selector:t.api.getSelector(`errors`,e.id)}),a=X({plugin:t,schema:r}),o=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:a});if(t.setSymbolValue(i,o),n){let n=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:t.config.errors.case,name:t.config.errors.error},name:e.id}),selector:t.api.getSelector(`error`,e.id)}),r=N.indexedAccessTypeNode({indexType:N.typeOperatorNode({operator:`keyof`,type:N.typeReferenceNode({typeName:i.placeholder})}),objectType:N.typeReferenceNode({typeName:i.placeholder})}),a=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:r});t.setSymbolValue(n,a)}}if(a){let n=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.responses,name:e.id}),selector:t.api.getSelector(`responses`,e.id)}),r=X({plugin:t,schema:a}),o=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:r});if(t.setSymbolValue(n,o),i){let r=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:t.config.responses.case,name:t.config.responses.response},name:e.id}),selector:t.api.getSelector(`response`,e.id)}),i=N.indexedAccessTypeNode({indexType:N.typeOperatorNode({operator:`keyof`,type:N.typeReferenceNode({typeName:n.placeholder})}),objectType:N.typeReferenceNode({typeName:n.placeholder})}),a=N.typeAliasDeclaration({exportType:r.exported,name:r.placeholder,type:i});t.setSymbolValue(r,a)}}},_d=({operation:e,plugin:t})=>{let n={type:`object`},r=[];if(n.properties||={},e.body){let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:t.config.webhooks.case,name:t.config.webhooks.payload},name:e.id}),selector:t.api.getSelector(`webhook-payload`,e.id)}),a=X({plugin:t,schema:e.body.schema}),o=N.typeAliasDeclaration({comment:cd({schema:e.body.schema}),exportType:i.exported,name:i.placeholder,type:a});t.setSymbolValue(i,o),t.registerSymbol({exported:!0,meta:{kind:`type`},name:i.name,placeholder:i.placeholder,selector:t.api.getSelector(`ref`,i.placeholder)}),n.properties.body={$ref:i.placeholder},r.push(`body`)}else n.properties.body={type:`never`};n.properties.key={const:e.path,type:`string`},r.push(`key`),n.properties.path={type:`never`},n.properties.query={type:`never`},n.required=r;let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.webhooks,name:e.id}),selector:t.api.getSelector(`webhook-request`,e.id)}),a=X({plugin:t,schema:n}),o=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:a});return t.setSymbolValue(i,o),i.placeholder},vd=({operation:e,plugin:t})=>_d({operation:e,plugin:t}),yd=({plugin:e,symbolWebhooks:t,webhookNames:n})=>{if(!n.length)return;let r=N.typeUnionNode({types:n.map(e=>N.typeReferenceNode({typeName:e}))}),i=N.typeAliasDeclaration({exportType:t.exported,name:t.placeholder,type:r});e.setSymbolValue(t,i)},bd=({plugin:e,schema:t})=>{if(!t.items)return N.typeArrayNode(N.keywordTypeNode({keyword:e.config.topType}));t=P({detectFormat:!0,schema:t});let n=[];for(let r of t.items){let t=X({plugin:e,schema:r});n.push(t)}return n.length===1?N.typeArrayNode(n[0]):t.logicalOperator===`and`?N.typeArrayNode(N.typeIntersectionNode({types:n})):N.typeArrayNode(N.typeUnionNode({types:n}))},xd=({schema:e})=>e.const===void 0?N.keywordTypeNode({keyword:`boolean`}):N.literalTypeNode({literal:N.ots.boolean(e.const)}),Sd=({plugin:e,schema:t})=>X({plugin:e,schema:{...t,type:void 0}}),Cd=({plugin:e,schema:t})=>t.const===void 0?t.type===`integer`&&t.format===`int64`&&e.getPlugin(`@hey-api/transformers`)?.config.bigInt?N.typeReferenceNode({typeName:`bigint`}):N.keywordTypeNode({keyword:`number`}):N.literalTypeNode({literal:N.ots.number(t.const)}),wd=({plugin:e,schema:t})=>{let n,r,i=[],a=[],o=t.required??[],s=!1;for(let n in t.properties){let r=t.properties[n],c=X({plugin:e,schema:r}),l=o.includes(n);i.push({comment:cd({schema:r}),isReadOnly:r.accessScope===`read`,isRequired:l,name:sd({context:e.context,name:n}),type:c}),a.push(r),l||(s=!0)}if(t.patternProperties)for(let e in t.patternProperties){let n=t.patternProperties[e];a.unshift(n)}let c=!!t.patternProperties&&Object.keys(t.patternProperties).length>0,l=t.additionalProperties,u=l!==!1&&l?l:void 0;if(c||u&&(u.type!==`never`||!a.length)){let i=u;i&&i.type!==`never`?a.unshift(i):!c&&!a.length&&i&&i.type===`never`&&(a=[i]),s&&a.push({type:`undefined`}),r={isRequired:!t.propertyNames,name:`key`,type:a.length===1?X({plugin:e,schema:a[0]}):X({plugin:e,schema:{items:a,logicalOperator:`or`}})},t.propertyNames?.$ref&&(n=X({plugin:e,schema:{$ref:t.propertyNames.$ref}}))}return N.typeInterfaceNode({indexKey:n,indexProperty:r,properties:i,useLegacyResolution:!1})},Td=({plugin:e,schema:t})=>{if(t.const!==void 0)return N.literalTypeNode({literal:N.stringLiteral({text:t.const})});if(t.format){if(t.format===`binary`)return N.typeUnionNode({types:[N.typeReferenceNode({typeName:`Blob`}),N.typeReferenceNode({typeName:`File`})]});if((t.format===`date-time`||t.format===`date`)&&e.getPlugin(`@hey-api/transformers`)?.config.dates)return N.typeReferenceNode({typeName:`Date`});if(t.format===`typeid`&&typeof t.example==`string`){let n=String(t.example).split(`_`);n.pop();let r=n.join(`_`),i=e.api.getSelector(`TypeID`,r);if(!e.getSymbol(i)){let t=e.api.getSelector(`TypeID`);if(!e.getSymbol(t)){let n=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`TypeID`,selector:t}),r=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:N.templateLiteralType({value:[N.typeReferenceNode({typeName:`T`}),`_`,N.keywordTypeNode({keyword:`string`})]}),typeParameters:[N.typeParameterDeclaration({constraint:N.keywordTypeNode({keyword:`string`}),name:`T`})]});e.setSymbolValue(n,r)}let n=e.referenceSymbol(t),a=e.registerSymbol({exported:!0,meta:{kind:`type`},name:T({case:e.config.case,value:`${r}_id`}),selector:i}),o=N.typeAliasDeclaration({exportType:a.exported,name:a.placeholder,type:N.typeReferenceNode({typeArguments:[N.literalTypeNode({literal:N.stringLiteral({text:r})})],typeName:n.placeholder})});e.setSymbolValue(a,o)}let a=e.referenceSymbol(i);return N.typeReferenceNode({typeName:a.placeholder})}}return N.keywordTypeNode({keyword:`string`})},Ed=({plugin:e,schema:t})=>{let n=[];if(t.const&&Array.isArray(t.const))n=t.const.map(t=>N.valueToExpression({value:t})??N.identifier({text:e.config.topType}));else if(t.items)for(let r of t.items){let t=X({plugin:e,schema:r});n.push(t)}return N.typeTupleNode({types:n})},Dd=({plugin:e,schema:t})=>{let n=e.getPlugin(`@hey-api/transformers`);if(n?.config.typeTransformers)for(let e of n.config.typeTransformers){let n=e({schema:t});if(n)return n}switch(t.type){case`array`:return bd({plugin:e,schema:t});case`boolean`:return xd({schema:t});case`enum`:return Sd({plugin:e,schema:t});case`integer`:case`number`:return Cd({plugin:e,schema:t});case`never`:return N.keywordTypeNode({keyword:`never`});case`null`:return N.literalTypeNode({literal:N.null()});case`object`:return wd({plugin:e,schema:t});case`string`:return Td({plugin:e,schema:t});case`tuple`:return Ed({plugin:e,schema:t});case`undefined`:return N.keywordTypeNode({keyword:`undefined`});case`unknown`:return N.keywordTypeNode({keyword:e.config.topType});case`void`:return N.keywordTypeNode({keyword:`void`})}},X=({plugin:e,schema:t})=>{if(t.$ref){let n=e.referenceSymbol(e.api.getSelector(`ref`,t.$ref));return N.typeReferenceNode({typeName:n.placeholder})}if(t.type)return Dd({plugin:e,schema:t});if(t.items){if(t=P({detectFormat:!1,schema:t}),t.items){let n=[];for(let r of t.items){let t=X({plugin:e,schema:r});n.push(t)}return t.logicalOperator===`and`?N.typeIntersectionNode({types:n}):N.typeUnionNode({types:n})}return X({plugin:e,schema:t})}return Dd({plugin:e,schema:{type:`unknown`}})},Od=({id:e,plugin:t,schema:n})=>{let r=X({plugin:t,schema:n}),i=n.type===`enum`&&t.config.enums.enabled;pd({plugin:t,schema:n,symbol:t.registerSymbol({exported:!0,meta:{kind:i?void 0:`type`},name:E({config:t.config.definitions,name:L(e)}),selector:t.api.getSelector(`ref`,e)}),type:r})},kd=({plugin:e})=>{let t=e.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:e.config.case},name:`ClientOptions`}),selector:e.api.getSelector(`ClientOptions`)}),n=e.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:e.config.case},name:`Webhooks`}),selector:e.api.getSelector(`Webhooks`)}),r=[],i=[];e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`server`,`webhook`,t=>{switch(t.type){case`operation`:gd({operation:t.operation,plugin:e});break;case`parameter`:Od({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:Od({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:Od({id:t.$ref,plugin:e,schema:t.schema});break;case`server`:r.push(t.server);break;case`webhook`:i.push(vd({operation:t.operation,plugin:e}));break}}),dd({plugin:e,servers:r,symbolClientOptions:t}),yd({plugin:e,symbolWebhooks:n,webhookNames:i})};var Ad=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}schemaToType(e){return X(e)}};const jd={api:new Ad({name:`@hey-api/typescript`}),config:{case:`PascalCase`,exportFromIndex:!0,style:`preserve`,topType:`unknown`,tree:!1},handler:kd,handlerLegacy:Yu,name:`@hey-api/typescript`,resolveConfig:(e,t)=>{e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.definitions}),e.config.enums=t.valueToObject({defaultValue:{case:`SCREAMING_SNAKE_CASE`,constantsIgnoreNull:!1,enabled:!!e.config.enums,mode:`javascript`},mappers:{boolean:e=>({enabled:e}),string:e=>({mode:e})},value:e.config.enums}),e.config.errors=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,error:`{{name}}Error`,name:`{{name}}Errors`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.errors}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}Data`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}Responses`,response:`{{name}}Response`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}WebhookRequest`,payload:`{{name}}WebhookPayload`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.webhooks})}},Md=w(jd);var Nd=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Pd=(e,t,n)=>{let r=e.config[n].meta;if(!r)return;let i=r(t);if(Object.keys(i).length)return N.valueToExpression({value:i})},Fd=({operation:e,plugin:t})=>Fc({operation:e,plugin:t.getPluginOrThrow(`@hey-api/sdk`)}),Id=({operation:e,plugin:t})=>{let n=x(t.context.config),r=t.getPluginOrThrow(`@hey-api/typescript`),i=t.getSymbol(r.api.getSelector(`error`,e.id))?.placeholder;return i||=`Error`,n.name===`@hey-api/client-axios`&&(i=`${t.referenceSymbol(t.api.getSelector(`AxiosError`)).placeholder}<${i}>`),i},Ld=({operation:e,plugin:t})=>{let n=t.getPluginOrThrow(`@hey-api/typescript`);return t.getSymbol(n.api.getSelector(`response`,e.id))?.placeholder||`unknown`},Rd=({plugin:e,typeData:t})=>{let n=x(e.context.config).name===`@hey-api/client-nuxt`;return{isNuxtClient:n,strippedTypeData:n?`Omit<${t}, 'composable'>`:t}},zd=({operation:e,plugin:t,queryFn:n})=>{let r=t.referenceSymbol(t.api.getSelector(`UseMutationOptions`)),i=Fd({operation:e,plugin:t}),a=Id({operation:e,plugin:t}),o=Ld({operation:e,plugin:t}),{isNuxtClient:s,strippedTypeData:c}=Rd({plugin:t,typeData:i}),l=s?`${r.placeholder}<${o}, ${c}, ${a}>`:`${r.placeholder}<${o}, ${i}, ${a}>`,u=`fnOptions`,d=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:u},{key:`throwOnError`,value:!0}]})]})}),f=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?f.push(N.returnVariable({expression:d})):f.push(N.constVariable({destructure:!0,expression:d,name:`data`}),N.returnVariable({expression:`data`}));let p=[{key:`mutation`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[s?{name:u,type:`Partial<${c}>`}:{name:u}],statements:f})}],m=Pd(t,e,`mutationOptions`);m&&p.push({key:`meta`,value:m});let h=t.getPluginOrThrow(`@hey-api/sdk`),g=t.registerSymbol({exported:!0,name:E({config:t.config.mutationOptions,name:e.id})}),_=N.constVariable({comment:t.config.comments?h.api.createOperationComment({operation:e}):void 0,exportConst:g.exported,expression:N.arrowFunction({parameters:[{isRequired:!1,name:`options`,type:`Partial<${c}>`}],returnType:l,statements:[N.returnStatement({expression:N.objectExpression({obj:p})})]}),name:g.placeholder});t.setSymbolValue(g.id,_)},Bd=`TOptions`,Vd=N.identifier({text:`options`}),Hd=({plugin:e})=>{let t=e.registerSymbol({name:E({config:{case:e.config.case},name:`createQueryKey`}),selector:e.api.getSelector(`createQueryKey`)}),n=e.referenceSymbol(e.api.getSelector(`QueryKey`)),r=e.referenceSymbol(e.api.getSelector(`_JSONValue`)),i=N.indexedAccessTypeNode({indexType:N.literalTypeNode({literal:N.ots.number(0)}),objectType:N.typeReferenceNode({typeArguments:[N.typeReferenceNode({typeName:Bd})],typeName:n.placeholder})}),a=me(e.context.config),o=e.getPluginOrThrow(`@hey-api/sdk`),s=e.referenceSymbol(o.api.getSelector(`Options`)),c=x(e.context.config),l=c.api&&`getSelector`in c.api?e.getSymbol(c.api.getSelector(`client`)):void 0,u=sl(e.context.config),d=e.registerSymbol({external:u,name:`serializeQueryKeyValue`}),f=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`id`,type:N.typeReferenceNode({typeName:`string`})},{isRequired:!1,name:`options`,type:N.typeReferenceNode({typeName:Bd})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:`ReadonlyArray<string>`})}],returnType:N.typeTupleNode({types:[i]}),statements:[N.constVariable({assertion:i,expression:N.objectExpression({multiLine:!1,obj:[{key:`_id`,value:N.identifier({text:`id`})},{key:a,value:N.identifier({text:`options?.${a} || (options?.client ?? ${l?.placeholder}).getConfig().${a}`})}]}),name:`params`,typeName:i}),N.ifStatement({expression:N.identifier({text:`tags`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`tags`}),right:N.asExpression({expression:N.asExpression({expression:N.identifier({text:`tags`}),type:N.keywordTypeNode({keyword:`unknown`})}),type:N.typeReferenceNode({typeName:r.placeholder})})})})]})}),N.ifStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:Vd,isOptional:!0,name:N.identifier({text:`body`})}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.constVariable({expression:N.callExpression({functionName:d.placeholder,parameters:[N.propertyAccessExpression({expression:`options`,name:`body`})]}),name:`normalizedBody`}),N.ifStatement({expression:N.binaryExpression({left:N.identifier({text:`normalizedBody`}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.identifier({text:`normalizedBody`})})})]})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:Vd,isOptional:!0,name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.propertyAccessExpression({expression:`options`,name:`path`})})})]})}),N.ifStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:Vd,isOptional:!0,name:N.identifier({text:`query`})}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.constVariable({expression:N.callExpression({functionName:d.placeholder,parameters:[N.propertyAccessExpression({expression:`options`,name:`query`})]}),name:`normalizedQuery`}),N.ifStatement({expression:N.binaryExpression({left:N.identifier({text:`normalizedQuery`}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.identifier({text:`normalizedQuery`})})})]})})]})}),N.returnStatement({expression:N.arrayLiteralExpression({elements:[N.identifier({text:`params`})]})})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:s.placeholder})}),name:Bd}]}),name:t.placeholder});e.setSymbolValue(t,f)},Ud=({id:e,operation:t,plugin:n})=>{let r=n.config.queryKeys,i;r.tags&&t.tags&&t.tags.length>0&&(i=N.arrayLiteralExpression({elements:t.tags.map(e=>N.stringLiteral({text:e}))}));let a=n.referenceSymbol(n.api.getSelector(`createQueryKey`));return N.callExpression({functionName:a.placeholder,parameters:[N.ots.string(e),`options`,i]})},Wd=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`_JSONValue`)),n=[{name:`_id`,type:N.keywordTypeNode({keyword:`string`})},{isRequired:!1,name:me(e.context.config),type:N.typeReferenceNode({typeName:t.placeholder})},{isRequired:!1,name:`body`,type:N.typeReferenceNode({typeName:t.placeholder})},{isRequired:!1,name:`query`,type:N.typeReferenceNode({typeName:t.placeholder})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:t.placeholder})}],r=e.getPluginOrThrow(`@hey-api/sdk`),i=e.referenceSymbol(r.api.getSelector(`Options`)),a=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`QueryKey`,selector:e.api.getSelector(`QueryKey`)}),o=N.typeAliasDeclaration({exportType:a.exported,name:a.placeholder,type:N.typeTupleNode({types:[N.typeIntersectionNode({types:[N.typeReferenceNode({typeName:`Pick<${Bd}, 'path'>`}),N.typeInterfaceNode({properties:n,useLegacyResolution:!0})]})]}),typeParameters:[{extends:N.typeReferenceNode({typeName:N.identifier({text:i.placeholder})}),name:Bd}]});e.setSymbolValue(a,o)},Gd=({operation:e,plugin:t,symbol:n})=>{let{strippedTypeData:r}=Rd({plugin:t,typeData:Fd({operation:e,plugin:t})});return N.constVariable({exportConst:n.exported,expression:N.arrowFunction({parameters:[{isRequired:Un(e),name:`options`,type:r}],statements:Ud({id:e.id,operation:e,plugin:t})}),name:n.placeholder})},Kd=`options`,qd=`context`,Jd=({operation:e,plugin:t,queryFn:n})=>{if(Bc({operation:e}))return;let r=zc({context:t.context,operation:e});t.getSymbol(t.api.getSelector(`createQueryKey`))||(Wd({plugin:t}),Hd({plugin:t}));let i;if(t.config.queryKeys.enabled){let n=t.registerSymbol({exported:!0,name:E({config:t.config.queryKeys,name:e.id})}),r=Gd({operation:e,plugin:t,symbol:n});t.setSymbolValue(n,r),i=N.callExpression({functionName:n.placeholder,parameters:[Kd]})}else{let n=t.referenceSymbol(t.api.getSelector(`createQueryKey`)),r;t.config.queryKeys.tags&&e.tags&&e.tags.length>0&&(r=N.arrayLiteralExpression({elements:e.tags.map(e=>N.stringLiteral({text:e}))})),i=N.callExpression({functionName:n.placeholder,parameters:[N.ots.string(e.id),Kd,r]})}let{strippedTypeData:a}=Rd({plugin:t,typeData:Fd({operation:e,plugin:t})}),o=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:Kd},{spread:qd},{key:`throwOnError`,value:!0}]})]})}),s=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?s.push(N.returnVariable({expression:o})):s.push(N.constVariable({destructure:!0,expression:o,name:`data`}),N.returnVariable({expression:`data`}));let c=[{key:`key`,value:i},{key:`query`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:qd}],statements:s})}],l=Pd(t,e,`queryOptions`);l&&c.push({key:`meta`,value:l});let u=t.getPluginOrThrow(`@hey-api/sdk`),d=t.registerSymbol({exported:!0,name:E({config:t.config.queryOptions,name:e.id}),selector:t.api.getSelector(`queryOptionsFn`,e.id)}),f=t.registerSymbol({external:t.name,name:`defineQueryOptions`,selector:t.api.getSelector(`defineQueryOptions`)}),p=N.constVariable({comment:t.config.comments?u.api.createOperationComment({operation:e}):void 0,exportConst:d.exported,expression:N.callExpression({functionName:f.placeholder,parameters:[N.arrowFunction({parameters:[{isRequired:r,name:Kd,type:a}],statements:N.objectExpression({obj:c})})]}),name:d.placeholder});t.setSymbolValue(d,p)},Yd=({plugin:e})=>{e.registerSymbol({external:e.name,meta:{kind:`type`},name:`UseMutationOptions`,selector:e.api.getSelector(`UseMutationOptions`)}),e.registerSymbol({external:e.name,meta:{kind:`type`},name:`UseQueryOptions`,selector:e.api.getSelector(`UseQueryOptions`)}),e.registerSymbol({external:e.name,meta:{kind:`type`},name:`_JSONValue`,selector:e.api.getSelector(`_JSONValue`)}),e.registerSymbol({external:`axios`,meta:{kind:`type`},name:`AxiosError`,selector:e.api.getSelector(`AxiosError`)});let t=e.getPluginOrThrow(`@hey-api/sdk`);e.forEach(`operation`,({operation:n})=>{let r=t.config.asClass?Pc({context:e.context,operation:n,plugin:t}):void 0,i=r?r.values().next().value:void 0,a=i?[e.referenceSymbol(t.api.getSelector(`class`,i.path[0])).placeholder,...i.path.slice(1).map(e=>T({case:`camelCase`,value:e})),i.methodName].filter(Boolean).join(`.`):e.referenceSymbol(t.api.getSelector(`function`,n.id)).placeholder;e.hooks.operation.isQuery(n)&&e.config.queryOptions.enabled&&Jd({operation:n,plugin:e,queryFn:a}),e.hooks.operation.isMutation(n)&&e.config.mutationOptions.enabled&&zd({operation:n,plugin:e,queryFn:a})})},Xd={api:new Nd({name:`@pinia/colada`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/typescript`,`@hey-api/sdk`],handler:Yd,name:`@pinia/colada`,resolveConfig:(e,t)=>{e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Query`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Zd=w(Xd),Qd=(e,t,n)=>{let r=e.config[n].meta;if(!r)return;let i=r(t);if(Object.keys(i).length)return N.valueToExpression({value:i})},$d=({operation:e,plugin:t})=>Fc({operation:e,plugin:t.getPluginOrThrow(`@hey-api/sdk`)}),ef=({operation:e,plugin:t})=>{let n=x(t.context.config),r=t.getPluginOrThrow(`@hey-api/typescript`),i=t.getSymbol(r.api.getSelector(`error`,e.id))?.placeholder;return i||=t.referenceSymbol(t.api.getSelector(`DefaultError`)).placeholder,n.name===`@hey-api/client-axios`&&(i=`${t.referenceSymbol(t.api.getSelector(`AxiosError`)).placeholder}<${i}>`),i},tf=({operation:e,plugin:t})=>{let n=t.getPluginOrThrow(`@hey-api/typescript`);return t.getSymbol(n.api.getSelector(`response`,e.id))?.placeholder||`unknown`},nf=`TOptions`,rf=N.identifier({text:`infinite`}),af=N.identifier({text:`options`}),of=({plugin:e})=>{let t=e.registerSymbol({name:E({config:{case:e.config.case},name:`createQueryKey`}),selector:e.api.getSelector(`createQueryKey`)}),n=e.referenceSymbol(e.api.getSelector(`QueryKey`)),r=N.indexedAccessTypeNode({indexType:N.literalTypeNode({literal:N.ots.number(0)}),objectType:N.typeReferenceNode({typeArguments:[N.typeReferenceNode({typeName:nf})],typeName:n.placeholder})}),i=me(e.context.config),a=x(e.context.config),o=a.api&&`getSelector`in a.api?e.getSymbol(a.api.getSelector(`client`)):void 0,s=e.getPluginOrThrow(`@hey-api/sdk`),c=e.referenceSymbol(s.api.getSelector(`Options`)),l=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`id`,type:N.typeReferenceNode({typeName:`string`})},{isRequired:!1,name:`options`,type:N.typeReferenceNode({typeName:nf})},{isRequired:!1,name:`infinite`,type:N.typeReferenceNode({typeName:`boolean`})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:`ReadonlyArray<string>`})}],returnType:N.typeTupleNode({types:[r]}),statements:[N.constVariable({assertion:r,expression:N.objectExpression({multiLine:!1,obj:[{key:`_id`,value:N.identifier({text:`id`})},{key:i,value:N.identifier({text:`options?.${i} || (options?.client ?? ${o?.placeholder}).getConfig().${i}`})}]}),name:`params`,typeName:r}),N.ifStatement({expression:rf,thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`_infinite`}),right:rf})})]})}),N.ifStatement({expression:N.identifier({text:`tags`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`tags`}),right:N.identifier({text:`tags`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.propertyAccessExpression({expression:`options`,name:`body`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.propertyAccessExpression({expression:`options`,name:`headers`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.propertyAccessExpression({expression:`options`,name:`path`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.propertyAccessExpression({expression:`options`,name:`query`})})})]})}),N.returnStatement({expression:N.arrayLiteralExpression({elements:[N.identifier({text:`params`})]})})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:c.placeholder})}),name:nf}]}),name:t.placeholder});e.setSymbolValue(t,l)},sf=({id:e,isInfinite:t,operation:n,plugin:r})=>{let i=t?r.config.infiniteQueryKeys:r.config.queryKeys,a;i.tags&&n.tags&&n.tags.length>0&&(a=N.arrayLiteralExpression({elements:n.tags.map(e=>N.stringLiteral({text:e}))}));let o=r.referenceSymbol(r.api.getSelector(`createQueryKey`));return N.callExpression({functionName:o.placeholder,parameters:[N.ots.string(e),`options`,t||a?N.ots.boolean(!!t):void 0,a]})},cf=({plugin:e})=>{let t=[{name:`_id`,type:N.keywordTypeNode({keyword:`string`})},{isRequired:!1,name:`_infinite`,type:N.keywordTypeNode({keyword:`boolean`})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:`ReadonlyArray<string>`})}],n=e.getPluginOrThrow(`@hey-api/sdk`),r=e.referenceSymbol(n.api.getSelector(`Options`)),i=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`QueryKey`,selector:e.api.getSelector(`QueryKey`)}),a=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:N.typeTupleNode({types:[N.typeIntersectionNode({types:[N.typeReferenceNode({typeName:`Pick<${nf}, '${me(e.context.config)}' | 'body' | 'headers' | 'path' | 'query'>`}),N.typeInterfaceNode({properties:t,useLegacyResolution:!0})]})]}),typeParameters:[{extends:N.typeReferenceNode({typeName:N.identifier({text:r.placeholder})}),name:nf}]});e.setSymbolValue(i,a)},lf=({isInfinite:e,operation:t,plugin:n,symbol:r,typeQueryKey:i})=>{let a=$d({operation:t,plugin:n});return N.constVariable({exportConst:r.exported,expression:N.arrowFunction({parameters:[{isRequired:Un(t),name:`options`,type:a}],returnType:e?i:void 0,statements:sf({id:t.id,isInfinite:e,operation:t,plugin:n})}),name:r.placeholder})},uf=({plugin:e})=>{let t=e.registerSymbol({name:E({config:{case:e.config.case},name:`createInfiniteParams`}),selector:e.api.getSelector(`createInfiniteParams`)}),n=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`queryKey`,type:N.typeReferenceNode({typeName:`QueryKey<Options>`})},{name:`page`,type:N.typeReferenceNode({typeName:`K`})}],statements:[N.constVariable({expression:N.objectExpression({obj:[{spread:N.propertyAccessExpression({expression:`queryKey`,name:0})}]}),name:`params`}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].body`},{assertion:`any`,spread:`page.body`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].headers`},{spread:`page.headers`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].path`},{assertion:`any`,spread:`page.path`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].query`},{assertion:`any`,spread:`page.query`}]})})})]})}),N.returnVariable({expression:N.asExpression({expression:N.asExpression({expression:N.identifier({text:`params`}),type:N.keywordTypeNode({keyword:`unknown`})}),type:p.default.factory.createTypeQueryNode(N.identifier({text:`page`}))})})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>`})}),name:`K`}]}),name:t.placeholder});e.setSymbolValue(t,n)},df=({operation:e,plugin:t,queryFn:n})=>{let r=Wn({context:t.context,operation:e});if(!r)return;let i=zc({context:t.context,operation:e});t.getSymbol(t.api.getSelector(`createQueryKey`))||(cf({plugin:t}),of({plugin:t})),t.getSymbol(t.api.getSelector(`createInfiniteParams`))||uf({plugin:t});let a=t.referenceSymbol(t.api.getSelector(`infiniteQueryOptions`)),o=t.referenceSymbol(t.api.getSelector(`InfiniteData`)),s=$d({operation:e,plugin:t}),c=ef({operation:e,plugin:t}),l=tf({operation:e,plugin:t}),u=`${t.referenceSymbol(t.api.getSelector(`QueryKey`)).placeholder}<${s}>`,d=`Pick<${u}[0], 'body' | 'headers' | 'path' | 'query'>`,f=t.getPluginOrThrow(`@hey-api/typescript`),p=`${gt({node:f.api.schemaToType({plugin:f,schema:r.schema}),unescape:!0})} | ${d}`,m=t.registerSymbol({exported:!0,name:E({config:t.config.infiniteQueryKeys,name:e.id})}),h=lf({isInfinite:!0,operation:e,plugin:t,symbol:m,typeQueryKey:u});t.setSymbolValue(m,h);let g=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:`params`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),_=t.referenceSymbol(t.api.getSelector(`createInfiniteParams`)),v=[N.constVariable({comment:[{jsdoc:!1,lines:[`@ts-ignore`]}],expression:N.conditionalExpression({condition:N.binaryExpression({left:N.typeOfExpression({text:`pageParam`}),operator:`===`,right:N.ots.string(`object`)}),whenFalse:N.objectExpression({multiLine:!0,obj:[{key:r.in,value:N.objectExpression({multiLine:!0,obj:[{key:r.name,value:N.identifier({text:`pageParam`})}]})}]}),whenTrue:N.identifier({text:`pageParam`})}),name:`page`,typeName:d}),N.constVariable({expression:N.callExpression({functionName:_.placeholder,parameters:[`queryKey`,`page`]}),name:`params`})];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?v.push(N.returnVariable({expression:g})):v.push(N.constVariable({destructure:!0,expression:g,name:`data`}),N.returnVariable({expression:`data`}));let y=[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`pageParam`},{name:`queryKey`},{name:`signal`}]}],statements:v})},{key:`queryKey`,value:N.callExpression({functionName:m.placeholder,parameters:[`options`]})}],b=Qd(t,e,`infiniteQueryOptions`);b&&y.push({key:`meta`,value:b});let ee=t.getPluginOrThrow(`@hey-api/sdk`),te=t.registerSymbol({exported:!0,name:E({config:t.config.infiniteQueryOptions,name:e.id})}),ne=N.constVariable({comment:t.config.comments?ee.api.createOperationComment({operation:e}):void 0,exportConst:te.exported,expression:N.arrowFunction({parameters:[{isRequired:i,name:`options`,type:s}],statements:[N.returnFunctionCall({args:[N.objectExpression({comments:[{jsdoc:!1,lines:[`@ts-ignore`]}],obj:y})],name:a.placeholder,types:[l,c||`unknown`,`${o.placeholder}<${l}>`,u,p]})]}),name:te.placeholder});t.setSymbolValue(te,ne)},ff=({operation:e,plugin:t,queryFn:n})=>{let r=t.referenceSymbol(t.api.getSelector(`MutationOptions`)),i=$d({operation:e,plugin:t}),a=ef({operation:e,plugin:t}),o=tf({operation:e,plugin:t}),s=`${r.placeholder}<${o}, ${a}, ${i}>`,c=`fnOptions`,l=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:c},{key:`throwOnError`,value:!0}]})]})}),u=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?u.push(N.returnVariable({expression:l})):u.push(N.constVariable({destructure:!0,expression:l,name:`data`}),N.returnVariable({expression:`data`}));let d=[{key:`mutationFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:c}],statements:u})}],f=Qd(t,e,`mutationOptions`);f&&d.push({key:`meta`,value:f});let p=t.getPluginOrThrow(`@hey-api/sdk`),m=`mutationOptions`,h=N.arrowFunction({parameters:[{isRequired:!1,name:`options`,type:`Partial<${i}>`}],returnType:s,statements:[N.constVariable({expression:N.objectExpression({obj:d}),name:m,typeName:s}),N.returnVariable({expression:m})]}),g=t.registerSymbol({exported:!0,name:E({config:t.config.mutationOptions,name:e.id})}),_=N.constVariable({comment:t.config.comments?p.api.createOperationComment({operation:e}):void 0,exportConst:g.exported,expression:h,name:g.placeholder});t.setSymbolValue(g,_)},pf=`options`,mf=({operation:e,plugin:t,queryFn:n})=>{if(Bc({operation:e}))return;let r=zc({context:t.context,operation:e});t.getSymbol(t.api.getSelector(`createQueryKey`))||(cf({plugin:t}),of({plugin:t}));let i=t.referenceSymbol(t.api.getSelector(`queryOptions`)),a=t.registerSymbol({exported:!0,name:E({config:t.config.queryKeys,name:e.id})}),o=lf({isInfinite:!1,operation:e,plugin:t,symbol:a});t.setSymbolValue(a,o);let s=$d({operation:e,plugin:t}),c=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:pf},{spread:`queryKey[0]`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),l=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?l.push(N.returnVariable({expression:c})):l.push(N.constVariable({destructure:!0,expression:c,name:`data`}),N.returnVariable({expression:`data`}));let u=[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`queryKey`},{name:`signal`}]}],statements:l})},{key:`queryKey`,value:N.callExpression({functionName:a.placeholder,parameters:[pf]})}],d=Qd(t,e,`queryOptions`);d&&u.push({key:`meta`,value:d});let f=t.getPluginOrThrow(`@hey-api/sdk`),p=t.registerSymbol({exported:t.config.queryOptions.exported,name:E({config:t.config.queryOptions,name:e.id}),selector:t.api.getSelector(`queryOptionsFn`,e.id)}),m=N.constVariable({comment:t.config.comments?f.api.createOperationComment({operation:e}):void 0,exportConst:p.exported,expression:N.arrowFunction({parameters:[{isRequired:r,name:pf,type:s}],statements:[N.returnFunctionCall({args:[N.objectExpression({obj:u})],name:i.placeholder})]}),name:p.placeholder});t.setSymbolValue(p,m)},hf=`options`,gf=({operation:e,plugin:t})=>{if(Bc({operation:e})||!(`useQuery`in t.config))return;let n=t.getPluginOrThrow(`@hey-api/sdk`),r=t.registerSymbol({exported:!0,name:E({config:t.config.useQuery,name:e.id})}),i=t.referenceSymbol(t.api.getSelector(`useQuery`)),a=zc({context:t.context,operation:e}),o=$d({operation:e,plugin:t}),s=t.referenceSymbol(t.api.getSelector(`queryOptionsFn`,e.id)),c=N.constVariable({comment:t.config.comments?n.api.createOperationComment({operation:e}):void 0,exportConst:r.exported,expression:N.arrowFunction({parameters:[{isRequired:a,name:hf,type:o}],statements:[N.returnStatement({expression:N.callExpression({functionName:i.placeholder,parameters:[N.callExpression({functionName:s.placeholder,parameters:[hf]})]})})]}),name:r.placeholder});t.setSymbolValue(r,c)},_f=({plugin:e})=>{e.registerSymbol({external:e.name,meta:{kind:`type`},name:`DefaultError`,selector:e.api.getSelector(`DefaultError`)}),e.registerSymbol({external:e.name,meta:{kind:`type`},name:`InfiniteData`,selector:e.api.getSelector(`InfiniteData`)});let t=e.name===`@tanstack/angular-query-experimental`||e.name===`@tanstack/svelte-query`||e.name===`@tanstack/solid-query`?`MutationOptions`:`UseMutationOptions`;e.registerSymbol({external:e.name,meta:{kind:`type`},name:t,selector:e.api.getSelector(`MutationOptions`)}),e.registerSymbol({external:e.name,name:`infiniteQueryOptions`,selector:e.api.getSelector(`infiniteQueryOptions`)}),e.registerSymbol({external:e.name,name:`queryOptions`,selector:e.api.getSelector(`queryOptions`)}),e.registerSymbol({external:e.name,name:`useQuery`,selector:e.api.getSelector(`useQuery`)}),e.registerSymbol({external:`axios`,meta:{kind:`type`},name:`AxiosError`,selector:e.api.getSelector(`AxiosError`)});let n=e.getPluginOrThrow(`@hey-api/sdk`);e.forEach(`operation`,({operation:t})=>{let r=n.config.asClass?Pc({context:e.context,operation:t,plugin:n}):void 0,i=r?r.values().next().value:void 0,a=i?[e.referenceSymbol(n.api.getSelector(`class`,i.path[0])).placeholder,...i.path.slice(1).map(e=>T({case:`camelCase`,value:e})),i.methodName].filter(Boolean).join(`.`):e.referenceSymbol(n.api.getSelector(`function`,t.id)).placeholder;e.hooks.operation.isQuery(t)&&(e.config.queryOptions.enabled&&mf({operation:t,plugin:e,queryFn:a}),e.config.infiniteQueryOptions.enabled&&df({operation:t,plugin:e,queryFn:a}),`useQuery`in e.config&&e.config.useQuery.enabled&&gf({operation:t,plugin:e})),e.hooks.operation.isMutation(t)&&e.config.mutationOptions.enabled&&ff({operation:t,plugin:e,queryFn:a})})},vf=e=>`${bu({config:S(),id:e.name,operation:e})}InfiniteOptions`,yf=e=>`${bu({config:S(),id:e.name,operation:e})}Mutation`,bf=({config:e,id:t,operation:n})=>`${bu({config:e,id:t,operation:n})}Options`,xf=({config:e,id:t,isInfinite:n,operation:r})=>`${bu({config:e,id:t,operation:r})}${n?`Infinite`:``}QueryKey`,Sf=e=>{switch(e.in){case`formData`:return`body`;case`header`:return`headers`;default:return e.in}},Cf=`createInfiniteParams`,wf=`createQueryKey`,Tf=`infiniteQueryOptions`,Ef=`mutationOptions`,Df=`QueryKey`,Of=`queryOptions`,kf=`TOptions`,Af=({file:e})=>{let t=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`queryKey`,type:N.typeNode(`QueryKey<OptionsLegacyParser>`)},{name:`page`,type:N.typeNode(`K`)}],statements:[N.constVariable({expression:N.identifier({text:`queryKey[0]`}),name:`params`}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].body`},{assertion:`any`,spread:`page.body`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].headers`},{spread:`page.headers`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].path`},{spread:`page.path`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].query`},{spread:`page.query`}]})})})]})}),N.returnVariable({expression:p.default.factory.createAsExpression(p.default.factory.createAsExpression(N.identifier({text:`params`}),p.default.factory.createKeywordTypeNode(p.default.SyntaxKind.UnknownKeyword)),p.default.factory.createTypeQueryNode(N.identifier({text:`page`})))})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`Pick<QueryKey<OptionsLegacyParser>[0], 'body' | 'headers' | 'path' | 'query'>`})}),name:`K`}]}),name:`createInfiniteParams`});e.add(t)},jf=({file:e})=>{let t=N.indexedAccessTypeNode({indexType:N.typeNode(0),objectType:N.typeNode(Df,[N.typeNode(kf)])}),n=N.identifier({text:`infinite`}),r=me(S()),i=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`id`,type:N.typeNode(`string`)},{isRequired:!1,name:`options`,type:N.typeNode(kf)},{isRequired:!1,name:`infinite`,type:N.typeNode(`boolean`)}],returnType:t,statements:[N.constVariable({assertion:t,expression:N.objectExpression({multiLine:!1,obj:[{key:`_id`,value:N.identifier({text:`id`})},{key:r,value:N.identifier({text:`options?.${r} || (options?.client ?? _heyApiClient).getConfig().${r}`})}]}),name:`params`,typeName:t}),N.ifStatement({expression:n,thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`_infinite`}),right:n})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.propertyAccessExpression({expression:`options`,name:`body`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.propertyAccessExpression({expression:`options`,name:`headers`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.propertyAccessExpression({expression:`options`,name:`path`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.propertyAccessExpression({expression:`options`,name:`query`})})})]})}),N.returnVariable({expression:`params`})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`OptionsLegacyParser`})}),name:kf}]}),name:wf});e.add(i)},Mf=({file:e})=>{let t=[{name:`_id`,type:N.keywordTypeNode({keyword:`string`})},{isRequired:!1,name:`_infinite`,type:N.keywordTypeNode({keyword:`boolean`})}],n=N.typeAliasDeclaration({name:Df,type:N.typeTupleNode({types:[N.typeIntersectionNode({types:[N.typeReferenceNode({typeName:`Pick<${kf}, '${me(S())}' | 'body' | 'headers' | 'path' | 'query'>`}),N.typeInterfaceNode({properties:t,useLegacyResolution:!0})]})]}),typeParameters:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`OptionsLegacyParser`})}),name:kf}]});e.add(n)},Nf=({client:e,file:t,operation:n,typesModulePath:r})=>{let{name:i}=lu({client:e,meta:n.parameters.length?{$ref:n.name,name:n.name}:void 0,nameTransformer:du,onImport:e=>{t.import({asType:!0,module:r,name:e})}});return{typeData:hu({importedType:i})}},Pf=({client:e,file:t,operation:n,pluginName:r,typesModulePath:i})=>{let a=S(),{name:o}=lu({client:e,meta:{$ref:n.name,name:n.name},nameTransformer:fu,onImport:e=>{t.import({asType:!0,module:i,name:e})}}),s={asType:!0,name:o};if(s.name||(s=t.import({asType:!0,module:r,name:`DefaultError`})),x(a).name===`@hey-api/client-axios`){let e=t.import({asType:!0,module:`axios`,name:`AxiosError`});s={...e,name:`${e.name}<${s.name}>`}}return{typeError:s}},Ff=({client:e,file:t,operation:n,typesModulePath:r})=>{let{name:i}=lu({client:e,meta:{$ref:n.name,name:n.name},nameTransformer:mu,onImport:e=>{t.import({asType:!0,module:r,name:e})}});return{typeResponse:i||`void`}},If=({id:e,isInfinite:t})=>N.arrayLiteralExpression({elements:[N.callExpression({functionName:wf,parameters:[N.ots.string(e),`options`,t?N.ots.boolean(!0):void 0]})],multiLine:!1}),Lf=({client:e,files:t,plugin:n})=>{let r=S();if(C(r))throw Error(`TanStack Query plugin does not support legacy clients`);let i=t[n.name];i.import({asType:!0,module:ol({config:r,sourceOutput:n.output}),name:`OptionsLegacyParser`});let a=ae({moduleOutput:t.types.nameWithoutExtension(),sourceOutput:n.output}),o=n.name===`@tanstack/angular-query-experimental`||n.name===`@tanstack/svelte-query`||n.name===`@tanstack/solid-query`?`MutationOptions`:`UseMutationOptions`,s,c=!1,l=!1,u=!1,d=!1,f=!1,p=new Map;for(let m of e.services)for(let h of m.operations){let g=I(h);if(p.has(g))continue;p.set(g,!0);let _=[r.plugins[`@hey-api/sdk`]?.config.asClass&&Go({config:r,name:m.name}),bu({config:r,handleIllegal:!r.plugins[`@hey-api/sdk`]?.config.asClass,id:h.name,operation:h})].filter(Boolean).join(`.`),v=!1;if(n.config.queryOptions.enabled&&[`GET`,`POST`].includes(h.method)){f||(f=!0,l||=(Mf({file:i}),jf({file:i}),!0),i.import({module:n.name,name:Of})),v=!0;let{typeData:t}=Nf({client:e,file:i,operation:h,typesModulePath:a}),o=Ns(h.parameters),s=N.constVariable({exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:o,name:`options`,type:t}],statements:If({id:h.name})}),name:xf({config:r,id:h.name,operation:h})});i.add(s);let c=N.constVariable({comment:[],exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:o,name:`options`,type:t}],statements:[N.returnFunctionCall({args:[N.objectExpression({obj:[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`queryKey`},{name:`signal`}]}],statements:[N.constVariable({destructure:!0,expression:N.awaitExpression({expression:N.callExpression({functionName:_,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:`queryKey[0]`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),name:`data`}),N.returnVariable({expression:`data`})]})},{key:`queryKey`,value:N.callExpression({functionName:xf({config:r,id:h.name,operation:h}),parameters:[`options`]})}]})],name:Of})]}),name:bf({config:r,id:h.name,operation:h})});i.add(c)}if(n.config.infiniteQueryOptions&&[`GET`,`POST`].includes(h.method)){let t,o=h.parameters.find(n=>{if(Mi(r.parser.pagination).test(n.name))return t=n,!0;if(n.in===`body`){if(n.export===`reference`){let i=n.$refs[0];return e.models.find(e=>e.meta?.$ref===i)?.properties.find(e=>{if(Mi(r.parser.pagination).test(e.name))return t=e,!0})}return n.properties.find(e=>{if(Mi(r.parser.pagination).test(e.name))return t=e,!0})}});if(o&&t){u||(u=!0,l||=(Mf({file:i}),jf({file:i}),!0),c||=(Af({file:i}),!0),i.import({module:n.name,name:Tf}),s=i.import({asType:!0,module:n.name,name:`InfiniteData`})),v=!0;let{typeData:d}=Nf({client:e,file:i,operation:h,typesModulePath:a}),{typeError:f}=Pf({client:e,file:i,operation:h,pluginName:n.name,typesModulePath:a}),{typeResponse:p}=Ff({client:e,file:i,operation:h,typesModulePath:a}),m=Ns(h.parameters),g=`${Df}<${d}>`,y=`Pick<${g}[0], 'body' | 'headers' | 'path' | 'query'>`,b=`${t.base} | ${y}`,ee=N.constVariable({exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:m,name:`options`,type:d}],returnType:g,statements:If({id:h.name,isInfinite:!0})}),name:xf({config:r,id:h.name,isInfinite:!0,operation:h})});i.add(ee);let te=N.constVariable({comment:[],exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:m,name:`options`,type:d}],statements:[N.returnFunctionCall({args:[N.objectExpression({comments:[{jsdoc:!1,lines:[`@ts-ignore`]}],obj:[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`pageParam`},{name:`queryKey`},{name:`signal`}]}],statements:[N.constVariable({comment:[{jsdoc:!1,lines:[`@ts-ignore`]}],expression:N.conditionalExpression({condition:N.binaryExpression({left:N.typeOfExpression({text:`pageParam`}),operator:`===`,right:N.ots.string(`object`)}),whenFalse:N.objectExpression({multiLine:!0,obj:[{key:Sf(o),value:N.objectExpression({multiLine:!0,obj:[{key:t.name,value:N.identifier({text:`pageParam`})}]})}]}),whenTrue:N.identifier({text:`pageParam`})}),name:`page`,typeName:y}),N.constVariable({expression:N.callExpression({functionName:`createInfiniteParams`,parameters:[`queryKey`,`page`]}),name:`params`}),N.constVariable({destructure:!0,expression:N.awaitExpression({expression:N.callExpression({functionName:_,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:`params`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),name:`data`}),N.returnVariable({expression:`data`})]})},{key:`queryKey`,value:N.callExpression({functionName:xf({config:r,id:h.name,isInfinite:!0,operation:h}),parameters:[`options`]})}]})],name:Tf,types:[p,f.name,`${typeof s==`string`?s:s.name}<${p}>`,g,b]})]}),name:vf(h)});i.add(te)}}if(n.config.mutationOptions&&[`DELETE`,`PATCH`,`POST`,`PUT`].includes(h.method)){d||(d=!0,i.import({asType:!0,module:n.name,name:o})),v=!0;let{typeData:t}=Nf({client:e,file:i,operation:h,typesModulePath:a}),{typeError:r}=Pf({client:e,file:i,operation:h,pluginName:n.name,typesModulePath:a}),{typeResponse:s}=Ff({client:e,file:i,operation:h,typesModulePath:a}),c=`fnOptions`,l=N.arrowFunction({parameters:[{isRequired:!1,name:`options`,type:`Partial<${t}>`}],statements:[N.constVariable({expression:N.objectExpression({obj:[{key:`mutationFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:c}],statements:[N.constVariable({destructure:!0,expression:N.awaitExpression({expression:N.callExpression({functionName:_,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:c},{key:`throwOnError`,value:!0}]})]})}),name:`data`}),N.returnVariable({expression:`data`})]})}]}),name:Ef,typeName:`${o}<${s}, ${r.name}, ${t}>`}),N.returnVariable({expression:Ef})]}),u=N.constVariable({comment:[],exportConst:!0,expression:l,name:yf(h)});i.add(u)}(f||u)&&i.import({alias:`_heyApiClient`,module:ae({moduleOutput:t.client.nameWithoutExtension(),sourceOutput:n.output}),name:`client`}),v&&i.import({module:ae({moduleOutput:t.sdk.nameWithoutExtension(),sourceOutput:n.output}),name:_.split(`.`)[0]})}};var Rf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const zf={api:new Rf({name:`@tanstack/angular-query-experimental`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/angular-query-experimental`,output:`@tanstack/angular-query-experimental`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Bf=w(zf);var Vf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Hf={api:new Vf({name:`@tanstack/react-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/react-query`,output:`@tanstack/react-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions}),e.config.useQuery=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!1,name:`use{{name}}Query`},mappers:{boolean:e=>({enabled:e}),function:e=>({enabled:!0,name:e}),object:e=>({enabled:!0,...e}),string:e=>({enabled:!0,name:e})},value:e.config.useQuery}),e.config.useQuery.enabled&&(e.config.queryOptions.enabled||(e.config.queryOptions.enabled=!0,e.config.queryOptions.exported=!1))}},Uf=w(Hf);var Wf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Gf={api:new Wf({name:`@tanstack/solid-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/solid-query`,output:`@tanstack/solid-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Kf=w(Gf);var qf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Jf={api:new qf({name:`@tanstack/svelte-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/svelte-query`,output:`@tanstack/svelte-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Yf=w(Jf);var Xf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Zf={api:new Xf({name:`@tanstack/vue-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/vue-query`,output:`@tanstack/vue-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Qf=w(Zf);var $f=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const ep=({operation:e,plugin:t})=>{let n=[],r=t.getPluginOrThrow(`@hey-api/typescript`),i=t.getSymbol(r.api.getSelector(`data`,e.id));i&&(e.body&&n.push({isRequired:e.body.required,name:`Body`,type:`${i.placeholder}['body']`}),e.parameters&&(e.parameters.header&&n.push({isRequired:Bn(e.parameters.header),name:`Headers`,type:`${i.placeholder}['headers']`}),e.parameters.path&&n.push({isRequired:Bn(e.parameters.path),name:`Params`,type:`${i.placeholder}['path']`}),e.parameters.query&&n.push({isRequired:Bn(e.parameters.query),name:`Querystring`,type:`${i.placeholder}['query']`})));let{errors:a,responses:o}=Kn(e),s,c=t.getSymbol(r.api.getSelector(`errors`,e.id));if(c&&a&&a.properties){let e=Object.keys(a.properties);if(e.length){if(!e.includes(`default`))s=N.typeReferenceNode({typeName:c.placeholder});else if(e.length>1){let e=N.typeReferenceNode({typeName:c.placeholder}),t=N.literalTypeNode({literal:N.stringLiteral({text:`default`})});s=N.typeReferenceNode({typeArguments:[e,t],typeName:`Omit`})}}}let l,u=t.getSymbol(r.api.getSelector(`responses`,e.id));if(u&&o&&o.properties){let e=Object.keys(o.properties);if(e.length){if(!e.includes(`default`))l=N.typeReferenceNode({typeName:u.placeholder});else if(e.length>1){let e=N.typeReferenceNode({typeName:u.placeholder}),t=N.literalTypeNode({literal:N.stringLiteral({text:`default`})});l=N.typeReferenceNode({typeArguments:[e,t],typeName:`Omit`})}}}let d=[s,l].filter(Boolean);if(d.length&&n.push({name:`Reply`,type:N.typeIntersectionNode({types:d})}),!n.length)return;let f=t.referenceSymbol(t.api.getSelector(`RouteHandler`));return{name:e.id,type:N.typeReferenceNode({typeArguments:[N.typeInterfaceNode({properties:n,useLegacyResolution:!1})],typeName:f.placeholder})}},tp=({plugin:e})=>{e.registerSymbol({external:`fastify`,meta:{kind:`type`},name:`RouteHandler`,selector:e.api.getSelector(`RouteHandler`)});let t=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`RouteHandlers`}),n=[];e.forEach(`operation`,({operation:t})=>{let r=ep({operation:t,plugin:e});r&&n.push(r)});let r=N.typeAliasDeclaration({exportType:t.exported,name:t.placeholder,type:N.typeInterfaceNode({properties:n,useLegacyResolution:!1})});e.setSymbolValue(t,r)},np={api:new $f({name:`fastify`}),config:{exportFromIndex:!1},dependencies:[`@hey-api/typescript`],handler:tp,name:`fastify`},rp=w(np),Z={actions:{args:N.identifier({text:`args`}),base64:N.identifier({text:`base64`}),bic:N.identifier({text:`bic`}),brand:N.identifier({text:`brand`}),bytes:N.identifier({text:`bytes`}),check:N.identifier({text:`check`}),checkItems:N.identifier({text:`checkItems`}),creditCard:N.identifier({text:`creditCard`}),cuid2:N.identifier({text:`cuid2`}),decimal:N.identifier({text:`decimal`}),description:N.identifier({text:`description`}),digits:N.identifier({text:`digits`}),email:N.identifier({text:`email`}),emoji:N.identifier({text:`emoji`}),empty:N.identifier({text:`empty`}),endsWith:N.identifier({text:`endsWith`}),entries:N.identifier({text:`entries`}),everyItem:N.identifier({text:`everyItem`}),excludes:N.identifier({text:`excludes`}),filterItems:N.identifier({text:`filterItems`}),findItem:N.identifier({text:`findItem`}),finite:N.identifier({text:`finite`}),flavor:N.identifier({text:`flavor`}),graphemes:N.identifier({text:`graphemes`}),gtValue:N.identifier({text:`gtValue`}),hash:N.identifier({text:`hash`}),hexColor:N.identifier({text:`hexColor`}),hexadecimal:N.identifier({text:`hexadecimal`}),imei:N.identifier({text:`imei`}),includes:N.identifier({text:`includes`}),integer:N.identifier({text:`integer`}),ip:N.identifier({text:`ip`}),ipv4:N.identifier({text:`ipv4`}),ipv6:N.identifier({text:`ipv6`}),isoDate:N.identifier({text:`isoDate`}),isoDateTime:N.identifier({text:`isoDateTime`}),isoTime:N.identifier({text:`isoTime`}),isoTimeSecond:N.identifier({text:`isoTimeSecond`}),isoTimestamp:N.identifier({text:`isoTimestamp`}),isoWeek:N.identifier({text:`isoWeek`}),length:N.identifier({text:`length`}),ltValue:N.identifier({text:`ltValue`}),mac:N.identifier({text:`mac`}),mac48:N.identifier({text:`mac48`}),mac64:N.identifier({text:`mac64`}),mapItems:N.identifier({text:`mapItems`}),maxBytes:N.identifier({text:`maxBytes`}),maxEntries:N.identifier({text:`maxEntries`}),maxGraphemes:N.identifier({text:`maxGraphemes`}),maxLength:N.identifier({text:`maxLength`}),maxSize:N.identifier({text:`maxSize`}),maxValue:N.identifier({text:`maxValue`}),maxWords:N.identifier({text:`maxWords`}),metadata:N.identifier({text:`metadata`}),mimeType:N.identifier({text:`mimeType`}),minBytes:N.identifier({text:`minBytes`}),minEntries:N.identifier({text:`minEntries`}),minGraphemes:N.identifier({text:`minGraphemes`}),minLength:N.identifier({text:`minLength`}),minSize:N.identifier({text:`minSize`}),minValue:N.identifier({text:`minValue`}),minWords:N.identifier({text:`minWords`}),multipleOf:N.identifier({text:`multipleOf`}),nanoid:N.identifier({text:`nanoid`}),nonEmpty:N.identifier({text:`nonEmpty`}),normalize:N.identifier({text:`normalize`}),notBytes:N.identifier({text:`notBytes`}),notEntries:N.identifier({text:`notEntries`}),notGraphemes:N.identifier({text:`notGraphemes`}),notLength:N.identifier({text:`notLength`}),notSize:N.identifier({text:`notSize`}),notValue:N.identifier({text:`notValue`}),notValues:N.identifier({text:`notValues`}),notWords:N.identifier({text:`notWords`}),octal:N.identifier({text:`octal`}),parseJson:N.identifier({text:`parseJson`}),partialCheck:N.identifier({text:`partialCheck`}),rawCheck:N.identifier({text:`rawCheck`}),rawTransform:N.identifier({text:`rawTransform`}),readonly:N.identifier({text:`readonly`}),reduceItems:N.identifier({text:`reduceItems`}),regex:N.identifier({text:`regex`}),returns:N.identifier({text:`returns`}),rfcEmail:N.identifier({text:`rfcEmail`}),safeInteger:N.identifier({text:`safeInteger`}),size:N.identifier({text:`size`}),slug:N.identifier({text:`slug`}),someItem:N.identifier({text:`someItem`}),sortItems:N.identifier({text:`sortItems`}),startsWith:N.identifier({text:`startsWith`}),stringifyJson:N.identifier({text:`stringifyJson`}),title:N.identifier({text:`title`}),toLowerCase:N.identifier({text:`toLowerCase`}),toMaxValue:N.identifier({text:`toMaxValue`}),toMinValue:N.identifier({text:`toMinValue`}),toUpperCase:N.identifier({text:`toUpperCase`}),transform:N.identifier({text:`transform`}),trim:N.identifier({text:`trim`}),trimEnd:N.identifier({text:`trimEnd`}),trimStart:N.identifier({text:`trimStart`}),ulid:N.identifier({text:`ulid`}),url:N.identifier({text:`url`}),uuid:N.identifier({text:`uuid`}),value:N.identifier({text:`value`}),values:N.identifier({text:`values`}),words:N.identifier({text:`words`})},async:{argsAsync:N.identifier({text:`argsAsync`}),arrayAsync:N.identifier({text:`arrayAsync`}),awaitAsync:N.identifier({text:`awaitAsync`}),checkAsync:N.identifier({text:`checkAsync`}),checkItemsAsync:N.identifier({text:`checkItemsAsync`}),customAsync:N.identifier({text:`customAsync`}),exactOptionalAsync:N.identifier({text:`exactOptionalAsync`}),fallbackAsync:N.identifier({text:`fallbackAsync`}),forwardAsync:N.identifier({text:`forwardAsync`}),getDefaultsAsync:N.identifier({text:`getDefaultsAsync`}),getFallbacksAsync:N.identifier({text:`getFallbacksAsync`}),intersectAsync:N.identifier({text:`intersectAsync`}),lazyAsync:N.identifier({text:`lazyAsync`}),looseObjectAsync:N.identifier({text:`looseObjectAsync`}),looseTupleAsync:N.identifier({text:`looseTupleAsync`}),mapAsync:N.identifier({text:`mapAsync`}),nonNullableAsync:N.identifier({text:`nonNullableAsync`}),nonNullishAsync:N.identifier({text:`nonNullishAsync`}),nonOptionalAsync:N.identifier({text:`nonOptionalAsync`}),nullableAsync:N.identifier({text:`nullableAsync`}),nullishAsync:N.identifier({text:`nullishAsync`}),objectAsync:N.identifier({text:`objectAsync`}),objectWithRestAsync:N.identifier({text:`objectWithRestAsync`}),optionalAsync:N.identifier({text:`optionalAsync`}),parseAsync:N.identifier({text:`parseAsync`}),parserAsync:N.identifier({text:`parserAsync`}),partialAsync:N.identifier({text:`partialAsync`}),partialCheckAsync:N.identifier({text:`partialCheckAsync`}),pipeAsync:N.identifier({text:`pipeAsync`}),rawCheckAsync:N.identifier({text:`rawCheckAsync`}),rawTransformAsync:N.identifier({text:`rawTransformAsync`}),recordAsync:N.identifier({text:`recordAsync`}),requiredAsync:N.identifier({text:`requiredAsync`}),returnsAsync:N.identifier({text:`returnsAsync`}),safeParseAsync:N.identifier({text:`safeParseAsync`}),safeParserAsync:N.identifier({text:`safeParserAsync`}),setAsync:N.identifier({text:`setAsync`}),strictObjectAsync:N.identifier({text:`strictObjectAsync`}),strictTupleAsync:N.identifier({text:`strictTupleAsync`}),transformAsync:N.identifier({text:`transformAsync`}),tupleAsync:N.identifier({text:`tupleAsync`}),tupleWithRestAsync:N.identifier({text:`tupleWithRestAsync`}),undefinedableAsync:N.identifier({text:`undefinedableAsync`}),unionAsync:N.identifier({text:`unionAsync`}),variantAsync:N.identifier({text:`variantAsync`})},methods:{assert:N.identifier({text:`assert`}),config:N.identifier({text:`config`}),fallback:N.identifier({text:`fallback`}),flatten:N.identifier({text:`flatten`}),forward:N.identifier({text:`forward`}),getDefault:N.identifier({text:`getDefault`}),getDefaults:N.identifier({text:`getDefaults`}),getDescription:N.identifier({text:`getDescription`}),getFallback:N.identifier({text:`getFallback`}),getFallbacks:N.identifier({text:`getFallbacks`}),getMetadata:N.identifier({text:`getMetadata`}),getTitle:N.identifier({text:`getTitle`}),is:N.identifier({text:`is`}),keyof:N.identifier({text:`keyof`}),message:N.identifier({text:`message`}),omit:N.identifier({text:`omit`}),parse:N.identifier({text:`parse`}),parser:N.identifier({text:`parser`}),partial:N.identifier({text:`partial`}),pick:N.identifier({text:`pick`}),pipe:N.identifier({text:`pipe`}),required:N.identifier({text:`required`}),safeParse:N.identifier({text:`safeParse`}),safeParser:N.identifier({text:`safeParser`}),summarize:N.identifier({text:`summarize`}),unwrap:N.identifier({text:`unwrap`})},schemas:{any:N.identifier({text:`any`}),array:N.identifier({text:`array`}),bigInt:N.identifier({text:`bigint`}),blob:N.identifier({text:`blob`}),boolean:N.identifier({text:`boolean`}),custom:N.identifier({text:`custom`}),date:N.identifier({text:`date`}),enum:N.identifier({text:`enum`}),exactOptional:N.identifier({text:`exactOptional`}),file:N.identifier({text:`file`}),function:N.identifier({text:`function`}),instance:N.identifier({text:`instance`}),intersect:N.identifier({text:`intersect`}),lazy:N.identifier({text:`lazy`}),literal:N.identifier({text:`literal`}),looseObject:N.identifier({text:`looseObject`}),looseTuple:N.identifier({text:`looseTuple`}),map:N.identifier({text:`map`}),nan:N.identifier({text:`nan`}),never:N.identifier({text:`never`}),nonNullable:N.identifier({text:`nonNullable`}),nonNullish:N.identifier({text:`nonNullish`}),nonOptional:N.identifier({text:`nonOptional`}),null:N.identifier({text:`null`}),nullable:N.identifier({text:`nullable`}),nullish:N.identifier({text:`nullish`}),number:N.identifier({text:`number`}),object:N.identifier({text:`object`}),objectWithRest:N.identifier({text:`objectWithRest`}),optional:N.identifier({text:`optional`}),picklist:N.identifier({text:`picklist`}),promise:N.identifier({text:`promise`}),record:N.identifier({text:`record`}),set:N.identifier({text:`set`}),strictObject:N.identifier({text:`strictObject`}),strictTuple:N.identifier({text:`strictTuple`}),string:N.identifier({text:`string`}),symbol:N.identifier({text:`symbol`}),tuple:N.identifier({text:`tuple`}),tupleWithRest:N.identifier({text:`tupleWithRest`}),undefined:N.identifier({text:`undefined`}),undefinedable:N.identifier({text:`undefinedable`}),union:N.identifier({text:`union`}),unknown:N.identifier({text:`unknown`}),variant:N.identifier({text:`variant`}),void:N.identifier({text:`void`})},storages:{},types:{GenericSchema:N.identifier({text:`GenericSchema`})},utils:{}};var ip=class{constructor(e){this.meta=e}createRequestValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`data`,e.id));if(!n)return;let r=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),i=`data`;return N.arrowFunction({async:!0,parameters:[{name:i}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:Z.async.parseAsync}),parameters:[N.identifier({text:n.placeholder}),N.identifier({text:i})]})})})]})}createResponseValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`responses`,e.id));if(!n)return;let r=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),i=`data`;return N.arrowFunction({async:!0,parameters:[{name:i}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:Z.async.parseAsync}),parameters:[N.identifier({text:n.placeholder}),N.identifier({text:i})]})})})]})}getSelector(...e){return[this.meta.name,...e]}};const ap=e=>{if(e.length>=2){if(e[0]===`components`){if(e[1]===`schemas`)return`schema`;if(e[1]===`parameters`)return`parameter`;if(e[1]===`requestBodies`)return`requestBody`}if(e[0]===`paths`)return`operation`;if(e[0]===`servers`)return`server`;if(e[0]===`webhooks`)return`webhook`}},op={int16:{max:32767,maxError:`Invalid value: Expected int16 to be <= 2^15-1`,min:-32768,minError:`Invalid value: Expected int16 to be >= -2^15`,needsBigInt:!1},int32:{max:2147483647,maxError:`Invalid value: Expected int32 to be <= 2^31-1`,min:-2147483648,minError:`Invalid value: Expected int32 to be >= -2^31`,needsBigInt:!1},int64:{max:`9223372036854775807`,maxError:`Invalid value: Expected int64 to be <= 2^63-1`,min:`-9223372036854775808`,minError:`Invalid value: Expected int64 to be >= -2^63`,needsBigInt:!0},int8:{max:127,maxError:`Invalid value: Expected int8 to be <= 2^7-1`,min:-128,minError:`Invalid value: Expected int8 to be >= -2^7`,needsBigInt:!1},uint16:{max:65535,maxError:`Invalid value: Expected uint16 to be <= 2^16-1`,min:0,minError:`Invalid value: Expected uint16 to be >= 0`,needsBigInt:!1},uint32:{max:4294967295,maxError:`Invalid value: Expected uint32 to be <= 2^32-1`,min:0,minError:`Invalid value: Expected uint32 to be >= 0`,needsBigInt:!1},uint64:{max:`18446744073709551615`,maxError:`Invalid value: Expected uint64 to be <= 2^64-1`,min:`0`,minError:`Invalid value: Expected uint64 to be >= 0`,needsBigInt:!0},uint8:{max:255,maxError:`Invalid value: Expected uint8 to be <= 2^8-1`,min:0,minError:`Invalid value: Expected uint8 to be >= 0`,needsBigInt:!1}},sp=e=>e!==void 0&&e in op,cp=e=>sp(e)&&op[e].needsBigInt,lp=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},up=({_path:e,operation:t,plugin:n,state:r})=>{if(n.config.requests.enabled){let i=new Set,a={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let r in t.parameters.header){let a=t.parameters.header[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`headers`))}Object.keys(e).length&&(a.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let r in t.parameters.path){let a=t.parameters.path[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`path`))}Object.keys(e).length&&(a.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let r in t.parameters.query){let a=t.parameters.query[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`query`))}Object.keys(e).length&&(a.properties.query={properties:e,required:n,type:`object`})}}t.body&&(a.properties.body=t.body.schema,t.body.required&&i.add(`body`)),a.required=[...i],Q({_path:e,plugin:n,schema:a,state:r,symbol:n.registerSymbol({exported:!0,meta:{resourceType:ap(e)},name:E({config:n.config.requests,name:t.id}),selector:n.api.getSelector(`data`,t.id)})})}if(n.config.responses.enabled&&t.responses){let{response:i}=Kn(t);if(i){let a=[...e,`responses`];Q({_path:a,plugin:n,schema:i,state:r,symbol:n.registerSymbol({exported:!0,meta:{resourceType:ap(a)},name:E({config:n.config.responses,name:t.id}),selector:n.api.getSelector(`responses`,t.id)})})}}},dp=({_path:e,operation:t,plugin:n,state:r})=>{if(n.config.webhooks.enabled){let i=new Set,a={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let r in t.parameters.header){let a=t.parameters.header[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`headers`))}Object.keys(e).length&&(a.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let r in t.parameters.path){let a=t.parameters.path[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`path`))}Object.keys(e).length&&(a.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let r in t.parameters.query){let a=t.parameters.query[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`query`))}Object.keys(e).length&&(a.properties.query={properties:e,required:n,type:`object`})}}t.body&&(a.properties.body=t.body.schema,t.body.required&&i.add(`body`)),a.required=[...i],Q({_path:e,plugin:n,schema:a,state:r,symbol:n.registerSymbol({exported:!0,meta:{resourceType:ap(e)},name:E({config:n.config.webhooks,name:t.id}),selector:n.api.getSelector(`webhook-request`,t.id)})})}},fp=({pipes:e,plugin:t})=>{if(e.length===1)return e[0];let n=t.referenceSymbol(t.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.methods.pipe}),parameters:e})},pp=({_path:e,plugin:t,schema:n,state:r})=>{let i=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),a=N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.array}),o=[];if(n.items){n=P({schema:n});let i=n.items.map((n,i)=>fp({pipes:Q({_path:[...e,`items`,i],plugin:t,schema:n,state:r}),plugin:t}));if(i.length===1){let e=N.callExpression({functionName:a,parameters:i});o.push(e)}else{n.logicalOperator;let r=N.callExpression({functionName:a,parameters:[Cp({_path:e,plugin:t,schema:{type:`unknown`}})]});o.push(r)}}else{let n=N.callExpression({functionName:a,parameters:[Cp({_path:e,plugin:t,schema:{type:`unknown`}})]});o.push(n)}if(n.minItems===n.maxItems&&n.minItems!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.actions.length}),parameters:[N.valueToExpression({value:n.minItems})]});o.push(e)}else{if(n.minItems!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.actions.minLength}),parameters:[N.valueToExpression({value:n.minItems})]});o.push(e)}if(n.maxItems!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.actions.maxLength}),parameters:[N.valueToExpression({value:n.maxItems})]});o.push(e)}}return fp({pipes:o,plugin:t})},mp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return typeof t.const==`boolean`?N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.literal}),parameters:[N.ots.boolean(t.const)]}):N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.boolean})})},hp=({_path:e,plugin:t,schema:n})=>{let r=[],i=!1;for(let e of n.items??[])e.type===`string`&&typeof e.const==`string`?r.push(N.stringLiteral({text:e.const})):(e.type===`null`||e.const===null)&&(i=!0);if(!r.length)return Cp({_path:e,plugin:t,schema:{type:`unknown`}});let a=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),o=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:Z.schemas.picklist}),parameters:[N.arrayLiteralExpression({elements:r,multiLine:!1})]});return i&&(o=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:Z.schemas.nullable}),parameters:[o]})),o},gp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.never})})},_p=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.null})})},vp=({plugin:e,schema:t})=>{let n=t.format,r=t.type===`integer`,i=cp(n),a=sp(n)?op[n]:null,o=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));if(t.const!==void 0&&t.const!==null){let e=t.const,r;if(typeof e==`number`&&!n)r=N.ots.number(e);else if(typeof e==`number`&&n)r=i?N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(e.toString())]}):N.ots.number(e);else if(typeof e==`string`&&i){let t=e.endsWith(`n`)?e.slice(0,-1):e;r=N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(t)]})}else if(typeof e==`bigint`){let t=e.toString(),n=t.endsWith(`n`)?t.slice(0,-1):t;r=N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(n)]})}else r=N.valueToExpression({value:e});return N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.literal}),parameters:[r]})}let s=[];if(i){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.union}),parameters:[N.arrayLiteralExpression({elements:[N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.number})}),N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.string})}),N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.bigInt})})],multiLine:!1})]});s.push(e);let t=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.transform}),parameters:[N.arrowFunction({parameters:[{name:`x`}],statements:N.callExpression({functionName:`BigInt`,parameters:[N.identifier({text:`x`})]})})]});s.push(t)}else{let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.number})});s.push(e)}if(!i&&r){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.integer})});s.push(e)}if(a){let e=a.min,t=a.max,n=a.minError,r=a.maxError,c=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.minValue}),parameters:[i?N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(e.toString())]}):N.ots.number(e),N.ots.string(n)]});s.push(c);let l=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.maxValue}),parameters:[i?N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(t.toString())]}):N.ots.number(t),N.ots.string(r)]});s.push(l)}if(t.exclusiveMinimum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.gtValue}),parameters:[lp({isBigInt:i,value:t.exclusiveMinimum})]});s.push(e)}else if(t.minimum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.minValue}),parameters:[lp({isBigInt:i,value:t.minimum})]});s.push(e)}if(t.exclusiveMaximum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.ltValue}),parameters:[lp({isBigInt:i,value:t.exclusiveMaximum})]});s.push(e)}else if(t.maximum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.maxValue}),parameters:[lp({isBigInt:i,value:t.maximum})]});s.push(e)}return fp({pipes:s,plugin:e})},yp=({_path:e,plugin:t,schema:n,state:r})=>{let i=[],a=n.required??[];for(let o in n.properties){let s=n.properties[o],c=a.includes(o),l=Q({_path:[...e,`properties`,o],optional:!c,plugin:t,schema:s,state:r});D.lastIndex=0;let u;u=D.test(o)?o.startsWith(`-`)?p.default.factory.createStringLiteral(o):p.default.factory.createNumericLiteral(o):o,(o.match(/^[0-9]/)&&o.match(/\D+/g)||o.match(/\W/g))&&!o.startsWith(`'`)&&!o.endsWith(`'`)&&(u=`'${o}'`),i.push(N.propertyAssignment({initializer:fp({pipes:l,plugin:t}),name:u}))}let o=t.referenceSymbol(t.api.getSelector(`import`,`valibot`));if(n.additionalProperties&&n.additionalProperties.type===`object`&&!Object.keys(i).length){let i=Q({_path:[...e,`additionalProperties`],plugin:t,schema:n.additionalProperties,state:r});return{anyType:`AnyZodObject`,expression:N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.record}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.string}),parameters:[]}),fp({pipes:i,plugin:t})]})}}let s=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.object}),parameters:[p.default.factory.createObjectLiteralExpression(i,!0)]});return{anyType:Z.types.GenericSchema.text,expression:s}},bp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));if(typeof t.const==`string`)return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.literal}),parameters:[N.ots.string(t.const)]});let r=[],i=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.string})});if(r.push(i),t.format)switch(t.format){case`date`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.isoDate})}));break;case`date-time`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.isoTimestamp})}));break;case`ipv4`:case`ipv6`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.ip})}));break;case`uri`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.url})}));break;case`email`:case`time`:case`uuid`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:N.identifier({text:t.format})})}));break}if(t.minLength===t.maxLength&&t.minLength!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.length}),parameters:[N.valueToExpression({value:t.minLength})]});r.push(e)}else{if(t.minLength!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.minLength}),parameters:[N.valueToExpression({value:t.minLength})]});r.push(e)}if(t.maxLength!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.maxLength}),parameters:[N.valueToExpression({value:t.maxLength})]});r.push(e)}}if(t.pattern){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]});r.push(e)}return fp({pipes:r,plugin:e})},xp=({_path:e,plugin:t,schema:n,state:r})=>{let i=t.referenceSymbol(t.api.getSelector(`import`,`valibot`));if(n.const&&Array.isArray(n.const)){let e=n.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.literal}),parameters:[N.valueToExpression({value:e})]}));return N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]})}if(n.items){let a=n.items.map((n,i)=>fp({pipes:Q({_path:[...e,`items`,i],plugin:t,schema:n,state:r}),plugin:t}));return N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]})}return Cp({_path:e,plugin:t,schema:{type:`unknown`}})},Sp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.undefined})})},Cp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.unknown})})},wp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.void})})},Tp=({_path:e,plugin:t,schema:n,state:r})=>{switch(n.type){case`array`:return{expression:pp({_path:e,plugin:t,schema:n,state:r})};case`boolean`:return{expression:mp({_path:e,plugin:t,schema:n})};case`enum`:return{expression:hp({_path:e,plugin:t,schema:n})};case`integer`:case`number`:return{expression:vp({_path:e,plugin:t,schema:n})};case`never`:return{expression:gp({_path:e,plugin:t,schema:n})};case`null`:return{expression:_p({_path:e,plugin:t,schema:n})};case`object`:return yp({_path:e,plugin:t,schema:n,state:r});case`string`:return n.format===`int64`||n.format===`uint64`?{expression:vp({_path:e,plugin:t,schema:n})}:{expression:bp({_path:e,plugin:t,schema:n})};case`tuple`:return{expression:xp({_path:e,plugin:t,schema:n,state:r})};case`undefined`:return{expression:Sp({_path:e,plugin:t,schema:n})};case`unknown`:return{expression:Cp({_path:e,plugin:t,schema:n})};case`void`:return{expression:wp({_path:e,plugin:t,schema:n})}}},Q=({$ref:e,_path:t=[],optional:n,plugin:r,schema:i,state:a,symbol:o})=>{let s,c=[];if(e&&(a.circularReferenceTracker.add(e),!o)){let t=r.api.getSelector(`ref`,e);r.getSymbol(t)||(o=r.referenceSymbol(t))}let l=r.referenceSymbol(r.api.getSelector(`import`,`valibot`));if(i.$ref){let e=a.circularReferenceTracker.has(i.$ref),t=r.api.getSelector(`ref`,i.$ref),n=r.getSymbol(t);if(!n){let e=r.context.resolveIrRef(i.$ref),o=Q({$ref:i.$ref,_path:ar(i.$ref),plugin:r,schema:e,state:a});c.push(...o),n=r.getSymbol(t)}if(n){let t=N.identifier({text:n.placeholder});if(e){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:t})]})]});c.push(e),a.hasCircularReference=!0}else c.push(t)}}else if(i.type){let e=Tp({_path:t,plugin:r,schema:i,state:a});if(s=e.anyType,c.push(e.expression),r.config.metadata&&i.description){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.actions.metadata}),parameters:[N.objectExpression({obj:[{key:`description`,value:N.stringLiteral({text:i.description})}]})]});c.push(e)}}else if(i.items)if(i=P({schema:i}),i.items){let e=i.items.map((e,n)=>fp({pipes:Q({_path:[...t,`items`,n],plugin:r,schema:e,state:a}),plugin:r}));if(i.logicalOperator===`and`){let t=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.intersect}),parameters:[N.arrayLiteralExpression({elements:e})]});c.push(t)}else{let t=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.union}),parameters:[N.arrayLiteralExpression({elements:e})]});c.push(t)}}else{let e=Q({_path:t,plugin:r,schema:i,state:a});c.push(...e)}else{let e=Tp({_path:t,plugin:r,schema:{type:`unknown`},state:a});s=e.anyType,c.push(e.expression)}if(e&&a.circularReferenceTracker.delete(e),c.length&&i.accessScope===`read`){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.actions.readonly})});c.push(e)}if(c.length){let e;i.default!==void 0&&(e=lp({isBigInt:i.type===`integer`&&i.format===`int64`,value:i.default}),e&&(c=[N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.optional}),parameters:[fp({pipes:c,plugin:r}),e]})])),n&&!e&&(c=[N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.optional}),parameters:[fp({pipes:c,plugin:r})]})])}if(o){e&&(o=r.registerSymbol({exported:!0,meta:{resourceType:ap(t)},name:E({config:{case:a.nameCase,name:a.nameTransformer},name:L(e)}),selector:r.api.getSelector(`ref`,e)}));let n=N.constVariable({comment:r.config.comments?cd({schema:i}):void 0,exportConst:o.exported,expression:fp({pipes:c,plugin:r}),name:o.placeholder,typeName:a.hasCircularReference?N.propertyAccessExpression({expression:l.placeholder,name:s||Z.types.GenericSchema.text}):void 0});return r.setSymbolValue(o,n),[]}return c},Ep=({plugin:e})=>{e.registerSymbol({external:`valibot`,meta:{importKind:`namespace`},name:`v`,selector:e.api.getSelector(`import`,`valibot`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{let n={circularReferenceTracker:new Set,hasCircularReference:!1,nameCase:e.config.definitions.case,nameTransformer:e.config.definitions.name};switch(t.type){case`operation`:up({_path:t._path,operation:t.operation,plugin:e,state:n});break;case`parameter`:Q({$ref:t.$ref,_path:t._path,plugin:e,schema:t.parameter.schema,state:n});break;case`requestBody`:Q({$ref:t.$ref,_path:t._path,plugin:e,schema:t.requestBody.schema,state:n});break;case`schema`:Q({$ref:t.$ref,_path:t._path,plugin:e,schema:t.schema,state:n});break;case`webhook`:dp({_path:t._path,operation:t.operation,plugin:e,state:n});break}})},Dp={api:new ip({name:`valibot`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1,metadata:!1},handler:Ep,name:`valibot`,resolveConfig:(e,t)=>{e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.definitions}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}Data`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}Response`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}WebhookRequest`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.webhooks})},tags:[`validator`]},Op=w(Dp),$={ZodMiniOptional:N.identifier({text:`ZodMiniOptional`}),ZodOptional:N.identifier({text:`ZodOptional`}),_default:N.identifier({text:`_default`}),and:N.identifier({text:`and`}),array:N.identifier({text:`array`}),bigint:N.identifier({text:`bigint`}),boolean:N.identifier({text:`boolean`}),check:N.identifier({text:`check`}),coerce:N.identifier({text:`coerce`}),date:N.identifier({text:`date`}),datetime:N.identifier({text:`datetime`}),default:N.identifier({text:`default`}),describe:N.identifier({text:`describe`}),email:N.identifier({text:`email`}),enum:N.identifier({text:`enum`}),globalRegistry:N.identifier({text:`globalRegistry`}),gt:N.identifier({text:`gt`}),gte:N.identifier({text:`gte`}),infer:N.identifier({text:`infer`}),int:N.identifier({text:`int`}),intersection:N.identifier({text:`intersection`}),ip:N.identifier({text:`ip`}),ipv4:N.identifier({text:`ipv4`}),ipv6:N.identifier({text:`ipv6`}),iso:N.identifier({text:`iso`}),lazy:N.identifier({text:`lazy`}),length:N.identifier({text:`length`}),literal:N.identifier({text:`literal`}),lt:N.identifier({text:`lt`}),lte:N.identifier({text:`lte`}),max:N.identifier({text:`max`}),maxLength:N.identifier({text:`maxLength`}),min:N.identifier({text:`min`}),minLength:N.identifier({text:`minLength`}),never:N.identifier({text:`never`}),null:N.identifier({text:`null`}),nullable:N.identifier({text:`nullable`}),number:N.identifier({text:`number`}),object:N.identifier({text:`object`}),optional:N.identifier({text:`optional`}),parseAsync:N.identifier({text:`parseAsync`}),readonly:N.identifier({text:`readonly`}),record:N.identifier({text:`record`}),regex:N.identifier({text:`regex`}),register:N.identifier({text:`register`}),string:N.identifier({text:`string`}),time:N.identifier({text:`time`}),tuple:N.identifier({text:`tuple`}),undefined:N.identifier({text:`undefined`}),union:N.identifier({text:`union`}),unknown:N.identifier({text:`unknown`}),url:N.identifier({text:`url`}),uuid:N.identifier({text:`uuid`}),void:N.identifier({text:`void`})};var kp=class{constructor(e){this.meta=e}createRequestValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`data`,e.id));if(!n)return;let r=`data`;return N.arrowFunction({async:!0,parameters:[{name:r}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.parseAsync}),parameters:[N.identifier({text:r})]})})})]})}createResponseValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`responses`,e.id));if(!n)return;let r=`data`;return N.arrowFunction({async:!0,parameters:[{name:r}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.parseAsync}),parameters:[N.identifier({text:r})]})})})]})}getSelector(...e){return[this.meta.name,...e]}};const Ap=({plugin:e,schema:t,symbol:n,typeInferSymbol:r,zodSchema:i})=>{let a=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),o=N.constVariable({comment:e.config.comments?cd({schema:t}):void 0,exportConst:n.exported,expression:i.expression,name:n.placeholder,typeName:i.typeName?N.propertyAccessExpression({expression:a.placeholder,name:i.typeName}):void 0});if(e.setSymbolValue(n,o),r){let t=N.typeAliasDeclaration({exportType:r.exported,name:r.placeholder,type:N.typeReferenceNode({typeArguments:[N.typeOfExpression({text:n.placeholder})],typeName:N.propertyAccessExpression({expression:a.placeholder,name:$.infer})})});e.setSymbolValue(r,t)}},jp=({plugin:e})=>{let t=e.package.getVersion(`zod`);if(t&&e.package.satisfies(t,`<4.0.0`))switch(e.config.compatibilityVersion){case 3:default:return`zod`;case 4:return`zod/v4`;case`mini`:return`zod/v4-mini`}switch(e.config.compatibilityVersion){case 3:return`zod/v3`;case 4:default:return`zod`;case`mini`:return`zod/mini`}},Mp=({getZodSchema:e,operation:t,plugin:n})=>{if(n.config.requests.enabled){let r=new Set,i={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let i in t.parameters.header){let a=t.parameters.header[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`headers`))}Object.keys(e).length&&(i.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let i in t.parameters.path){let a=t.parameters.path[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`path`))}Object.keys(e).length&&(i.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let i in t.parameters.query){let a=t.parameters.query[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`query`))}Object.keys(e).length&&(i.properties.query={properties:e,required:n,type:`object`})}}t.body&&(i.properties.body=t.body.schema,t.body.required&&r.add(`body`)),i.required=[...r];let a=e(i);Ap({plugin:n,schema:i,symbol:n.registerSymbol({exported:!0,name:E({config:n.config.requests,name:t.id}),selector:n.api.getSelector(`data`,t.id)}),typeInferSymbol:n.config.requests.types.infer.enabled?n.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:n.config.requests.types.infer,name:t.id}),selector:n.api.getSelector(`type-infer-data`,t.id)}):void 0,zodSchema:a})}if(n.config.responses.enabled&&t.responses){let{response:r}=Kn(t);if(r){let i=e(r);Ap({plugin:n,schema:r,symbol:n.registerSymbol({exported:!0,name:E({config:n.config.responses,name:t.id}),selector:n.api.getSelector(`responses`,t.id)}),typeInferSymbol:n.config.responses.types.infer.enabled?n.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:n.config.responses.types.infer,name:t.id}),selector:n.api.getSelector(`type-infer-responses`,t.id)}):void 0,zodSchema:i})}}},Np=({getZodSchema:e,operation:t,plugin:n})=>{if(n.config.webhooks.enabled){let r=new Set,i={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let i in t.parameters.header){let a=t.parameters.header[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`headers`))}Object.keys(e).length&&(i.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let i in t.parameters.path){let a=t.parameters.path[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`path`))}Object.keys(e).length&&(i.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let i in t.parameters.query){let a=t.parameters.query[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`query`))}Object.keys(e).length&&(i.properties.query={properties:e,required:n,type:`object`})}}t.body&&(i.properties.body=t.body.schema,t.body.required&&r.add(`body`)),i.required=[...r];let a=e(i);Ap({plugin:n,schema:i,symbol:n.registerSymbol({exported:!0,name:E({config:n.config.webhooks,name:t.id}),selector:n.api.getSelector(`webhook-request`,t.id)}),typeInferSymbol:n.config.webhooks.types.infer.enabled?n.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:n.config.webhooks.types.infer,name:t.id}),selector:n.api.getSelector(`type-infer-webhook-request`,t.id)}):void 0,zodSchema:a})}},Pp=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i={},a=N.propertyAccessExpression({expression:r.placeholder,name:$.array});if(!t.items)i.expression=N.callExpression({functionName:a,parameters:[Gp({plugin:e,schema:{type:`unknown`}}).expression]});else{t=P({schema:t});let o=t.items.map(t=>{let r=Jp({plugin:e,schema:t,state:n});return r.hasCircularReference&&(i.hasCircularReference=!0),r.expression});if(o.length===1)i.expression=N.callExpression({functionName:a,parameters:o});else if(t.logicalOperator===`and`){let e=t.items[0],n;if(e.logicalOperator===`or`||e.type&&e.type!==`object`)n=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.intersection}),parameters:o});else{n=o[0];for(let e=1;e<o.length;e++)n=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.intersection}),parameters:[n,o[e]]})}i.expression=N.callExpression({functionName:a,parameters:[n]})}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.array}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:o})]})]})}let o=[];return t.minItems===t.maxItems&&t.minItems!==void 0?o.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.length}),parameters:[N.valueToExpression({value:t.minItems})]})):(t.minItems!==void 0&&o.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.minLength}),parameters:[N.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&o.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.maxLength}),parameters:[N.valueToExpression({value:t.maxItems})]}))),o.length&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.check}),parameters:o})),i},Fp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={};return typeof t.const==`boolean`?(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.boolean(t.const)]}),r):(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.boolean})}),r)},Ip=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={},i=[],a=[],o=!1,s=!0;for(let e of t.items??[])if(e.type===`string`&&typeof e.const==`string`){let t=N.stringLiteral({text:e.const});i.push(t),a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if((e.type===`number`||e.type===`integer`)&&typeof e.const==`number`){s=!1;let t=N.ots.number(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if(e.type===`boolean`&&typeof e.const==`boolean`){s=!1;let t=N.ots.boolean(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else (e.type===`null`||e.const===null)&&(o=!0);return a.length?(s&&i.length>0?r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.enum}),parameters:[N.arrayLiteralExpression({elements:i,multiLine:!1})]}):a.length===1?r.expression=a[0]:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:a,multiLine:a.length>3})]}),o&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.nullable}),parameters:[r.expression]})),r):Gp({plugin:e,schema:{type:`unknown`}})},Lp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.never})}),n},Rp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.null})}),n},zp=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},Bp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={},i=t.type===`integer`&&t.format===`int64`;if(typeof t.const==`number`)return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.number(t.const)]}),r;r.expression=N.callExpression({functionName:i?N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.coerce}),name:$.bigint}):N.propertyAccessExpression({expression:n.placeholder,name:$.number})}),!i&&t.type===`integer`&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.int})}));let a=[];return t.exclusiveMinimum===void 0?t.minimum!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.gte}),parameters:[zp({isBigInt:i,value:t.minimum})]})):a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.gt}),parameters:[zp({isBigInt:i,value:t.exclusiveMinimum})]})),t.exclusiveMaximum===void 0?t.maximum!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.lte}),parameters:[zp({isBigInt:i,value:t.maximum})]})):a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.lt}),parameters:[zp({isBigInt:i,value:t.exclusiveMaximum})]})),a.length&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.check}),parameters:a})),r},Vp=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i={},a=[],o=t.required??[];for(let s in t.properties){let c=t.properties[s],l=Jp({optional:!o.includes(s),plugin:e,schema:c,state:n});l.hasCircularReference&&(i.hasCircularReference=!0),D.lastIndex=0;let u;u=D.test(s)?s.startsWith(`-`)?p.default.factory.createStringLiteral(s):p.default.factory.createNumericLiteral(s):s,(s.match(/^[0-9]/)&&s.match(/\D+/g)||s.match(/\W/g))&&!s.startsWith(`'`)&&!s.endsWith(`'`)&&(u=`'${s}'`),l.hasCircularReference?a.push(N.getAccessorDeclaration({name:u,returnType:l.typeName?N.propertyAccessExpression({expression:r.placeholder,name:l.typeName}):void 0,statements:[N.returnStatement({expression:l.expression})]})):a.push(N.propertyAssignment({initializer:l.expression,name:u}))}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let a=Jp({plugin:e,schema:t.additionalProperties,state:n});return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.record}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.string}),parameters:[]}),a.expression]}),a.hasCircularReference&&(i.hasCircularReference=!0),i}return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.object}),parameters:[p.default.factory.createObjectLiteralExpression(a,!0)]}),i},Hp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={};if(typeof t.const==`string`)return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.string(t.const)]}),r;r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.string})});let i=[];if(e.config.dates.offset&&i.push({key:`offset`,value:!0}),e.config.dates.local&&i.push({key:`local`,value:!0}),t.format)switch(t.format){case`date`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.iso}),name:$.date})});break;case`date-time`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.iso}),name:$.datetime}),parameters:i.length>0?[N.objectExpression({obj:i})]:[]});break;case`email`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.email})});break;case`ipv4`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.ipv4})});break;case`ipv6`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.ipv6})});break;case`time`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.iso}),name:$.time})});break;case`uri`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.url})});break;case`uuid`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.uuid})});break}let a=[];return t.minLength===t.maxLength&&t.minLength!==void 0?a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.length}),parameters:[N.valueToExpression({value:t.minLength})]})):(t.minLength!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.minLength}),parameters:[N.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.maxLength}),parameters:[N.valueToExpression({value:t.maxLength})]}))),t.pattern&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]})),a.length&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.check}),parameters:a})),r},Up=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i={};if(t.const&&Array.isArray(t.const)){let e=t.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.valueToExpression({value:e})]}));return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]}),i}let a=[];for(let r of t.items??[]){let t=Jp({plugin:e,schema:r,state:n});a.push(t.expression),t.hasCircularReference&&(i.hasCircularReference=!0)}return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]}),i},Wp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.undefined})}),n},Gp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.unknown})}),n},Kp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.void})}),n},qp=({plugin:e,schema:t,state:n})=>{switch(t.type){case`array`:return Pp({plugin:e,schema:t,state:n});case`boolean`:return Fp({plugin:e,schema:t});case`enum`:return Ip({plugin:e,schema:t});case`integer`:case`number`:return Bp({plugin:e,schema:t});case`never`:return Lp({plugin:e,schema:t});case`null`:return Rp({plugin:e,schema:t});case`object`:return Vp({plugin:e,schema:t,state:n});case`string`:return Hp({plugin:e,schema:t});case`tuple`:return Up({plugin:e,schema:t,state:n});case`undefined`:return Wp({plugin:e,schema:t});case`unknown`:return Gp({plugin:e,schema:t});case`void`:return Kp({plugin:e,schema:t})}},Jp=({optional:e,plugin:t,schema:n,state:r})=>{let i={},a=t.referenceSymbol(t.api.getSelector(`import`,`zod`));if(n.$ref){let e=r.circularReferenceTracker.includes(n.$ref),o=r.currentReferenceTracker.includes(n.$ref);r.circularReferenceTracker.push(n.$ref),r.currentReferenceTracker.push(n.$ref);let s=t.api.getSelector(`ref`,n.$ref),c=t.getSymbol(s);if(e)c||=t.referenceSymbol(s),o?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({returnType:N.keywordTypeNode({keyword:`any`}),statements:[N.returnStatement({expression:N.identifier({text:c.placeholder})})]})]}):i.expression=N.identifier({text:c.placeholder}),i.hasCircularReference=n.circular;else{if(c)i.hasCircularReference=n.circular;else{let e=t.context.resolveIrRef(n.$ref);Yp({id:n.$ref,plugin:t,schema:e,state:r})}let e=t.referenceSymbol(s);i.expression=N.identifier({text:e.placeholder})}r.circularReferenceTracker.pop(),r.currentReferenceTracker.pop()}else if(n.type){let e=qp({plugin:t,schema:n,state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,t.config.metadata&&n.description&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.register}),parameters:[N.propertyAccessExpression({expression:a.placeholder,name:$.globalRegistry}),N.objectExpression({obj:[{key:`description`,value:N.stringLiteral({text:n.description})}]})]}))}else if(n.items)if(n=P({schema:n}),n.items){let e=n.items.map(e=>Jp({plugin:t,schema:e,state:r}));if(n.logicalOperator===`and`){let t=n.items[0];t.logicalOperator===`or`||t.type&&t.type!==`object`?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:e.map(e=>e.expression)}):(i.expression=e[0].expression,e.slice(1).forEach(e=>{i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:[i.expression,e.hasCircularReference?N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:e.expression})]})]}):e.expression]})}))}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:e.map(e=>e.expression)})]})}else i=Jp({plugin:t,schema:n,state:r});else i.expression=qp({plugin:t,schema:{type:`unknown`},state:r}).expression;if(i.expression&&(n.accessScope===`read`&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.readonly}),parameters:[i.expression]})),e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.optional}),parameters:[i.expression]}),i.typeName=$.ZodMiniOptional),n.default!==void 0)){let e=zp({isBigInt:n.type===`integer`&&n.format===`int64`,value:n.default});e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$._default}),parameters:[i.expression,e]}))}return i},Yp=({id:e,plugin:t,schema:n,state:r})=>{let i={circularReferenceTracker:[e],hasCircularReference:!1,...r,currentReferenceTracker:[e]},a=t.api.getSelector(`ref`,e),o=t.getSymbol(a);if(o&&!t.getSymbolValue(o))return;let s=Jp({plugin:t,schema:n,state:i}),c=L(e);o=t.registerSymbol({exported:!0,name:E({config:t.config.definitions,name:c}),selector:a});let l=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.definitions.types.infer,name:c}),selector:t.api.getSelector(`type-infer-ref`,e)}):void 0;Ap({plugin:t,schema:n,symbol:o,typeInferSymbol:l,zodSchema:s})},Xp=({plugin:e})=>{e.registerSymbol({external:jp({plugin:e}),meta:{importKind:`namespace`},name:`z`,selector:e.api.getSelector(`import`,`zod`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{switch(t.type){case`operation`:Mp({getZodSchema:t=>Jp({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break;case`parameter`:Yp({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:Yp({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:Yp({id:t.$ref,plugin:e,schema:t.schema});break;case`webhook`:Np({getZodSchema:t=>Jp({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break}})},Zp=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=N.propertyAccessExpression({expression:r.placeholder,name:$.array}),a,o=!1;if(!t.items)a=N.callExpression({functionName:i,parameters:[cm({plugin:e,schema:{type:`unknown`}})]});else{t=P({schema:t});let s=t.items.map(t=>{let r=dm({plugin:e,schema:t,state:n});return r.hasCircularReference&&(o=!0),r.expression});if(s.length===1)a=N.callExpression({functionName:i,parameters:s});else if(t.logicalOperator===`and`){let e=t.items[0],n;if(e.logicalOperator===`or`||e.type&&e.type!==`object`)n=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.intersection}),parameters:s});else{n=s[0];for(let e=1;e<s.length;e++)n=N.callExpression({functionName:N.propertyAccessExpression({expression:n,name:$.and}),parameters:[s[e]]})}a=N.callExpression({functionName:i,parameters:[n]})}else a=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.array}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:s})]})]})}return t.minItems===t.maxItems&&t.minItems!==void 0?a=N.callExpression({functionName:N.propertyAccessExpression({expression:a,name:$.length}),parameters:[N.valueToExpression({value:t.minItems})]}):(t.minItems!==void 0&&(a=N.callExpression({functionName:N.propertyAccessExpression({expression:a,name:$.min}),parameters:[N.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&(a=N.callExpression({functionName:N.propertyAccessExpression({expression:a,name:$.max}),parameters:[N.valueToExpression({value:t.maxItems})]}))),{expression:a,hasCircularReference:o}},Qp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return typeof t.const==`boolean`?N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.boolean(t.const)]}):N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.boolean})})},$p=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r=[],i=[],a=!1,o=!0;for(let e of t.items??[])if(e.type===`string`&&typeof e.const==`string`){let t=N.stringLiteral({text:e.const});r.push(t),i.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if((e.type===`number`||e.type===`integer`)&&typeof e.const==`number`){o=!1;let t=N.ots.number(e.const);i.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if(e.type===`boolean`&&typeof e.const==`boolean`){o=!1;let t=N.ots.boolean(e.const);i.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else (e.type===`null`||e.const===null)&&(a=!0);if(!i.length)return cm({plugin:e,schema:{type:`unknown`}});let s;return s=o&&r.length>0?N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.enum}),parameters:[N.arrayLiteralExpression({elements:r,multiLine:!1})]}):i.length===1?i[0]:N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:i,multiLine:i.length>3})]}),a&&(s=N.callExpression({functionName:N.propertyAccessExpression({expression:s,name:$.nullable})})),s},em=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.never})})},tm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.null})})},nm=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},rm=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r=t.type===`integer`&&t.format===`int64`;if(typeof t.const==`number`)return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.number(t.const)]});let i=N.callExpression({functionName:r?N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.coerce}),name:$.bigint}):N.propertyAccessExpression({expression:n.placeholder,name:$.number})});return!r&&t.type===`integer`&&(i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.int})})),t.exclusiveMinimum===void 0?t.minimum!==void 0&&(i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.gte}),parameters:[nm({isBigInt:r,value:t.minimum})]})):i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.gt}),parameters:[nm({isBigInt:r,value:t.exclusiveMinimum})]}),t.exclusiveMaximum===void 0?t.maximum!==void 0&&(i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.lte}),parameters:[nm({isBigInt:r,value:t.maximum})]})):i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.lt}),parameters:[nm({isBigInt:r,value:t.exclusiveMaximum})]}),i},im=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=!1,a=[],o=t.required??[];for(let r in t.properties){let s=t.properties[r],c=dm({optional:!o.includes(r),plugin:e,schema:s,state:n});c.hasCircularReference&&(i=!0),D.lastIndex=0;let l;l=D.test(r)?r.startsWith(`-`)?p.default.factory.createStringLiteral(r):p.default.factory.createNumericLiteral(r):r,(r.match(/^[0-9]/)&&r.match(/\D+/g)||r.match(/\W/g))&&!r.startsWith(`'`)&&!r.endsWith(`'`)&&(l=`'${r}'`),a.push(N.propertyAssignment({initializer:c.expression,name:l}))}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let i=dm({plugin:e,schema:t.additionalProperties,state:n});return{anyType:`AnyZodObject`,expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.record}),parameters:[i.expression]}),hasCircularReference:i.hasCircularReference}}return{anyType:`AnyZodObject`,expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.object}),parameters:[p.default.factory.createObjectLiteralExpression(a,!0)]}),hasCircularReference:i}},am=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));if(typeof t.const==`string`)return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.string(t.const)]});let r=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.string})}),i=[];if(e.config.dates.offset&&i.push({key:`offset`,value:!0}),e.config.dates.local&&i.push({key:`local`,value:!0}),t.format)switch(t.format){case`date`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.date})});break;case`date-time`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.datetime}),parameters:i.length>0?[N.objectExpression({obj:i})]:[]});break;case`email`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.email})});break;case`ipv4`:case`ipv6`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.ip})});break;case`time`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.time})});break;case`uri`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.url})});break;case`uuid`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.uuid})});break}return t.minLength===t.maxLength&&t.minLength!==void 0?r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.length}),parameters:[N.valueToExpression({value:t.minLength})]}):(t.minLength!==void 0&&(r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.min}),parameters:[N.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&(r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.max}),parameters:[N.valueToExpression({value:t.maxLength})]}))),t.pattern&&(r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]})),r},om=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=!1;if(t.const&&Array.isArray(t.const)){let e=t.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.valueToExpression({value:e})]}));return{expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]}),hasCircularReference:i}}let a=[];for(let r of t.items??[]){let t=dm({plugin:e,schema:r,state:n});t.hasCircularReference&&(i=!0),a.push(t.expression)}return{expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]}),hasCircularReference:i}},sm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.undefined})})},cm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.unknown})})},lm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.void})})},um=({plugin:e,schema:t,state:n})=>{switch(t.type){case`array`:return Zp({plugin:e,schema:t,state:n});case`boolean`:return{expression:Qp({plugin:e,schema:t})};case`enum`:return{expression:$p({plugin:e,schema:t})};case`integer`:case`number`:return{expression:rm({plugin:e,schema:t})};case`never`:return{expression:em({plugin:e,schema:t})};case`null`:return{expression:tm({plugin:e,schema:t})};case`object`:return im({plugin:e,schema:t,state:n});case`string`:return{expression:am({plugin:e,schema:t})};case`tuple`:return om({plugin:e,schema:t,state:n});case`undefined`:return{expression:sm({plugin:e,schema:t})};case`unknown`:return{expression:cm({plugin:e,schema:t})};case`void`:return{expression:lm({plugin:e,schema:t})}}},dm=({optional:e,plugin:t,schema:n,state:r})=>{let i={},a=t.referenceSymbol(t.api.getSelector(`import`,`zod`));if(n.$ref){let e=r.circularReferenceTracker.includes(n.$ref);r.circularReferenceTracker.push(n.$ref),r.currentReferenceTracker.push(n.$ref);let o=t.api.getSelector(`ref`,n.$ref),s=t.getSymbol(o);if(e)s||=t.referenceSymbol(o),i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:N.identifier({text:s.placeholder})})]})]}),i.hasCircularReference=n.circular;else{if(s)i.hasCircularReference=n.circular;else{let e=t.context.resolveIrRef(n.$ref);fm({id:n.$ref,plugin:t,schema:e,state:{...r,currentReferenceTracker:[n.$ref]}})}let e=t.referenceSymbol(o);i.expression=N.identifier({text:e.placeholder})}r.circularReferenceTracker.pop(),r.currentReferenceTracker.pop()}else if(n.type){let e=um({plugin:t,schema:n,state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,i.typeName=e.anyType,t.config.metadata&&n.description&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.describe}),parameters:[N.stringLiteral({text:n.description})]}))}else if(n.items)if(n=P({schema:n}),n.items){let e=n.items.map(e=>{let n=dm({plugin:t,schema:e,state:r});return n.hasCircularReference&&(i.hasCircularReference=!0),n.expression});if(n.logicalOperator===`and`){let t=n.items[0];t.logicalOperator===`or`||t.type&&t.type!==`object`?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:e}):(i.expression=e[0],e.slice(1).forEach(e=>{i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.and}),parameters:[e]})}))}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:e})]})}else i=dm({plugin:t,schema:n,state:r});else{let e=um({plugin:t,schema:{type:`unknown`},state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,i.typeName=e.anyType}if(i.expression&&(n.accessScope===`read`&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.readonly})})),e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.optional})})),n.default!==void 0)){let e=nm({isBigInt:n.type===`integer`&&n.format===`int64`,value:n.default});e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.default}),parameters:[e]}))}return i.hasCircularReference?i.typeName||=`ZodTypeAny`:i.typeName&&=void 0,i},fm=({id:e,plugin:t,schema:n,state:r})=>{r||={circularReferenceTracker:[e],currentReferenceTracker:[e],hasCircularReference:!1};let i=t.api.getSelector(`ref`,e),a=t.getSymbol(i);if(a)return;let o=dm({plugin:t,schema:n,state:r}),s=L(e);a=t.registerSymbol({exported:!0,name:E({config:t.config.definitions,name:s}),selector:i});let c=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.definitions.types.infer,name:s}),selector:t.api.getSelector(`type-infer-ref`,e)}):void 0;Ap({plugin:t,schema:n,symbol:a,typeInferSymbol:c,zodSchema:o})},pm=({plugin:e})=>{e.registerSymbol({external:jp({plugin:e}),name:`z`,selector:e.api.getSelector(`import`,`zod`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{switch(t.type){case`operation`:Mp({getZodSchema:t=>dm({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break;case`parameter`:fm({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:fm({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:fm({id:t.$ref,plugin:e,schema:t.schema});break;case`webhook`:Np({getZodSchema:t=>dm({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break}})},mm=({plugin:e,schema:t,state:n})=>{let r={},i=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),a=N.propertyAccessExpression({expression:i.placeholder,name:$.array});if(!t.items)r.expression=N.callExpression({functionName:a,parameters:[Tm({plugin:e,schema:{type:`unknown`}}).expression]});else{t=P({schema:t});let o=t.items.map(t=>{let i=Om({plugin:e,schema:t,state:n});return i.hasCircularReference&&(r.hasCircularReference=!0),i.expression});if(o.length===1)r.expression=N.callExpression({functionName:a,parameters:o});else if(t.logicalOperator===`and`){let e=t.items[0],n;if(e.logicalOperator===`or`||e.type&&e.type!==`object`)n=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.intersection}),parameters:o});else{n=o[0];for(let e=1;e<o.length;e++)n=N.callExpression({functionName:N.propertyAccessExpression({expression:n,name:$.and}),parameters:[o[e]]})}r.expression=N.callExpression({functionName:a,parameters:[n]})}else r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.array}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:o})]})]})}return t.minItems===t.maxItems&&t.minItems!==void 0?r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.length}),parameters:[N.valueToExpression({value:t.minItems})]}):(t.minItems!==void 0&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.min}),parameters:[N.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.max}),parameters:[N.valueToExpression({value:t.maxItems})]}))),r},hm=({plugin:e,schema:t})=>{let n={},r=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return typeof t.const==`boolean`?(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.ots.boolean(t.const)]}),n):(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.boolean})}),n)},gm=({plugin:e,schema:t})=>{let n={},r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=[],a=[],o=!1,s=!0;for(let e of t.items??[])if(e.type===`string`&&typeof e.const==`string`){let t=N.stringLiteral({text:e.const});i.push(t),a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[t]}))}else if((e.type===`number`||e.type===`integer`)&&typeof e.const==`number`){s=!1;let t=N.ots.number(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[t]}))}else if(e.type===`boolean`&&typeof e.const==`boolean`){s=!1;let t=N.ots.boolean(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[t]}))}else (e.type===`null`||e.const===null)&&(o=!0);return a.length?(s&&i.length>0?n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.enum}),parameters:[N.arrayLiteralExpression({elements:i,multiLine:!1})]}):a.length===1?n.expression=a[0]:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:a,multiLine:a.length>3})]}),o&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.nullable}),parameters:[n.expression]})),n):Tm({plugin:e,schema:{type:`unknown`}})},_m=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.never})}),t},vm=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.null})}),t},ym=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},bm=({plugin:e,schema:t})=>{let n={},r=t.type===`integer`&&t.format===`int64`,i=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return typeof t.const==`number`?(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.literal}),parameters:[N.ots.number(t.const)]}),n):(n.expression=N.callExpression({functionName:r?N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:i.placeholder,name:$.coerce}),name:$.bigint}):N.propertyAccessExpression({expression:i.placeholder,name:$.number})}),!r&&t.type===`integer`&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.int})})),t.exclusiveMinimum===void 0?t.minimum!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.gte}),parameters:[ym({isBigInt:r,value:t.minimum})]})):n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.gt}),parameters:[ym({isBigInt:r,value:t.exclusiveMinimum})]}),t.exclusiveMaximum===void 0?t.maximum!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.lte}),parameters:[ym({isBigInt:r,value:t.maximum})]})):n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.lt}),parameters:[ym({isBigInt:r,value:t.exclusiveMaximum})]}),n)},xm=({plugin:e,schema:t,state:n})=>{let r={},i=[],a=t.required??[],o=e.referenceSymbol(e.api.getSelector(`import`,`zod`));for(let s in t.properties){let c=t.properties[s],l=Om({optional:!a.includes(s),plugin:e,schema:c,state:n});l.hasCircularReference&&(r.hasCircularReference=!0),D.lastIndex=0;let u;u=D.test(s)?s.startsWith(`-`)?p.default.factory.createStringLiteral(s):p.default.factory.createNumericLiteral(s):s,(s.match(/^[0-9]/)&&s.match(/\D+/g)||s.match(/\W/g))&&!s.startsWith(`'`)&&!s.endsWith(`'`)&&(u=`'${s}'`),l.hasCircularReference?i.push(N.getAccessorDeclaration({name:u,returnType:l.typeName?N.propertyAccessExpression({expression:o.placeholder,name:l.typeName}):void 0,statements:[N.returnStatement({expression:l.expression})]})):i.push(N.propertyAssignment({initializer:l.expression,name:u}))}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let i=Om({plugin:e,schema:t.additionalProperties,state:n});return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:$.record}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:$.string}),parameters:[]}),i.expression]}),i.hasCircularReference&&(r.hasCircularReference=!0),r.hasCircularReference?{...r,typeName:`ZodType`}:r}return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:$.object}),parameters:[p.default.factory.createObjectLiteralExpression(i,!0)]}),r.hasCircularReference?{...r,typeName:`ZodType`}:r},Sm=({plugin:e,schema:t})=>{let n={},r=e.referenceSymbol(e.api.getSelector(`import`,`zod`));if(typeof t.const==`string`)return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.ots.string(t.const)]}),n;n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.string})});let i=[];if(e.config.dates.offset&&i.push({key:`offset`,value:!0}),e.config.dates.local&&i.push({key:`local`,value:!0}),t.format)switch(t.format){case`date`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:r.placeholder,name:$.iso}),name:$.date})});break;case`date-time`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:r.placeholder,name:$.iso}),name:$.datetime}),parameters:i.length>0?[N.objectExpression({obj:i})]:[]});break;case`email`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.email})});break;case`ipv4`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.ipv4})});break;case`ipv6`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.ipv6})});break;case`time`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:r.placeholder,name:$.iso}),name:$.time})});break;case`uri`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.url})});break;case`uuid`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.uuid})});break}return t.minLength===t.maxLength&&t.minLength!==void 0?n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.length}),parameters:[N.valueToExpression({value:t.minLength})]}):(t.minLength!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.min}),parameters:[N.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.max}),parameters:[N.valueToExpression({value:t.maxLength})]}))),t.pattern&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]})),n},Cm=({plugin:e,schema:t,state:n})=>{let r={},i=e.referenceSymbol(e.api.getSelector(`import`,`zod`));if(t.const&&Array.isArray(t.const)){let e=t.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.literal}),parameters:[N.valueToExpression({value:e})]}));return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]}),r}let a=[];for(let i of t.items??[]){let t=Om({plugin:e,schema:i,state:n});a.push(t.expression),t.hasCircularReference&&(r.hasCircularReference=!0)}return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]}),r},wm=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.undefined})}),t},Tm=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.unknown})}),t},Em=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.void})}),t},Dm=({plugin:e,schema:t,state:n})=>{switch(t.type){case`array`:return mm({plugin:e,schema:t,state:n});case`boolean`:return hm({plugin:e,schema:t});case`enum`:return gm({plugin:e,schema:t});case`integer`:case`number`:return bm({plugin:e,schema:t});case`never`:return _m({plugin:e,schema:t});case`null`:return vm({plugin:e,schema:t});case`object`:return xm({plugin:e,schema:t,state:n});case`string`:return Sm({plugin:e,schema:t});case`tuple`:return Cm({plugin:e,schema:t,state:n});case`undefined`:return wm({plugin:e,schema:t});case`unknown`:return Tm({plugin:e,schema:t});case`void`:return Em({plugin:e,schema:t})}},Om=({optional:e,plugin:t,schema:n,state:r})=>{let i={},a=t.referenceSymbol(t.api.getSelector(`import`,`zod`));if(n.$ref){let e=r.circularReferenceTracker.includes(n.$ref),o=r.currentReferenceTracker.includes(n.$ref);r.circularReferenceTracker.push(n.$ref),r.currentReferenceTracker.push(n.$ref);let s=t.api.getSelector(`ref`,n.$ref),c=t.getSymbol(s);if(e)c||=t.referenceSymbol(s),o?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({returnType:N.keywordTypeNode({keyword:`any`}),statements:[N.returnStatement({expression:N.identifier({text:c.placeholder})})]})]}):i.expression=N.identifier({text:c.placeholder}),i.hasCircularReference=n.circular;else{if(c)i.hasCircularReference=n.circular;else{let e=t.context.resolveIrRef(n.$ref);km({id:n.$ref,plugin:t,schema:e,state:r})}let e=t.referenceSymbol(s);i.expression=N.identifier({text:e.placeholder})}r.circularReferenceTracker.pop(),r.currentReferenceTracker.pop()}else if(n.type){let e=Dm({plugin:t,schema:n,state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,t.config.metadata&&n.description&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.register}),parameters:[N.propertyAccessExpression({expression:a.placeholder,name:$.globalRegistry}),N.objectExpression({obj:[{key:`description`,value:N.stringLiteral({text:n.description})}]})]}))}else if(n.items)if(n=P({schema:n}),n.items){let e=n.items.map(e=>Om({plugin:t,schema:e,state:r}));if(n.logicalOperator===`and`){let t=n.items[0];t.logicalOperator===`or`||t.type&&t.type!==`object`?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:e.map(e=>e.expression)}):(i.expression=e[0].expression,e.slice(1).forEach(e=>{i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.and}),parameters:[e.hasCircularReference?N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:e.expression})]})]}):e.expression]})}))}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:e.map(e=>e.expression)})]})}else i=Om({plugin:t,schema:n,state:r});else i.expression=Dm({plugin:t,schema:{type:`unknown`},state:r}).expression;if(i.expression&&(n.accessScope===`read`&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.readonly})})),e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.optional}),parameters:[i.expression]}),i.typeName=$.ZodOptional),n.default!==void 0)){let e=ym({isBigInt:n.type===`integer`&&n.format===`int64`,value:n.default});e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.default}),parameters:[e]}))}return i},km=({id:e,plugin:t,schema:n,state:r})=>{let i={circularReferenceTracker:[e],hasCircularReference:!1,...r,currentReferenceTracker:[e]},a=t.api.getSelector(`ref`,e),o=t.getSymbol(a);if(o&&!t.getSymbolValue(o))return;let s=Om({plugin:t,schema:n,state:i}),c=L(e);o=t.registerSymbol({exported:!0,name:E({config:t.config.definitions,name:c}),selector:a});let l=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.definitions.types.infer,name:c}),selector:t.api.getSelector(`type-infer-ref`,e)}):void 0;Ap({plugin:t,schema:n,symbol:o,typeInferSymbol:l,zodSchema:s})},Am=({plugin:e})=>{e.registerSymbol({external:jp({plugin:e}),name:`z`,selector:e.api.getSelector(`import`,`zod`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{switch(t.type){case`operation`:Mp({getZodSchema:t=>Om({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break;case`parameter`:km({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:km({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:km({id:t.$ref,plugin:e,schema:t.schema});break;case`webhook`:Np({getZodSchema:t=>Om({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break}})},jm=e=>{let{plugin:t}=e;switch(t.config.compatibilityVersion){case 3:return pm(e);case 4:return Am(e);case`mini`:return Xp(e);default:return Am(e)}},Mm={api:new kp({name:`zod`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1,metadata:!1},handler:jm,name:`zod`,resolveConfig:(e,t)=>{let n=t.package.getVersion(`zod`),r=()=>n&&(n.major===4||n.major===3)?n.major:4,i=e=>{if(!e)return r();if(!n)return e;if((e===4||e===3||e===`mini`)&&!t.package.satisfies(n,`>=3.25.0 <5.0.0`)){let t=r();return console.warn(`🔌 ${l.default.yellow(`Warning:`)} Installed ${l.default.cyan(`zod`)} ${l.default.cyan(`v${n.version}`)} does not support compatibility version ${l.default.yellow(String(e))}, using ${l.default.yellow(String(t))}.`),t}return e};e.config.compatibilityVersion=i(e.config.compatibilityVersion),e.config.dates=t.valueToObject({defaultValue:{local:!1,offset:!1},value:e.config.dates}),e.config.types=t.valueToObject({defaultValue:{infer:{case:`PascalCase`,enabled:!1}},mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.config.types}),e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}ZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.definitions}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}Data`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}DataZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}Response`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}ResponseZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}WebhookRequest`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}WebhookRequestZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.webhooks})},tags:[`validator`]},Nm=w(Mm),Pm={"@angular/common":el,"@hey-api/client-angular":_l,"@hey-api/client-axios":bl,"@hey-api/client-fetch":Cl,"@hey-api/client-next":El,"@hey-api/client-nuxt":kl,"@hey-api/client-ofetch":Ml,"@hey-api/schemas":au,"@hey-api/sdk":ku,"@hey-api/transformers":ad,"@hey-api/typescript":jd,"@pinia/colada":Xd,"@tanstack/angular-query-experimental":zf,"@tanstack/react-query":Hf,"@tanstack/solid-query":Gf,"@tanstack/svelte-query":Jf,"@tanstack/vue-query":Zf,fastify:np,"legacy/angular":Pl,"legacy/axios":Il,"legacy/fetch":Rl,"legacy/node":Bl,"legacy/xhr":Hl,valibot:Dp,zod:Mm},Fm=[`@hey-api/typescript`,`@hey-api/sdk`],Im=({dependencies:e,userPlugins:t,userPluginsConfig:n})=>{let r=new Set,i=new Set,a={},o=s=>{if(r.has(s))throw Error(`Circular reference detected at '${s}'`);if(i.has(s))return;r.add(s);let c=Pm[s],l=n[s];if(!c&&!l)throw Error(`unknown plugin dependency "${s}" - do you need to register a custom plugin with this name?`);let u={...c,...l,config:{...c?.config,...l?.config},dependencies:new Set([...c?.dependencies||[],...l?.dependencies||[]])};if(u.resolveConfig){let r={package:Jn(e),pluginByTag:(e,r={})=>{let{defaultPlugin:i,errorMessage:a}=r;for(let r of t){let t=Pm[r]||n[r];if(t&&t.tags?.includes(e)&&r!==s)return r}if(i){let t=Pm[i]||n[i];if(t&&t.tags?.includes(e)&&i!==s)return i}throw Error(a||`missing plugin - no plugin with tag "${e}" found`)},valueToObject:He};u.resolveConfig(u,r)}for(let e of u.dependencies)o(e);r.delete(s),i.add(s),a[s]=u};for(let e of t)o(e);return{pluginOrder:Array.from(i),plugins:a}},Lm=e=>typeof e==`string`?e.startsWith(`@hey-api/client`)||e.startsWith(`legacy/`):e.name.startsWith(`@hey-api/client`)||e.name.startsWith(`legacy/`)||e.tags&&e.tags.includes(`client`),Rm=({dependencies:e,userConfig:t})=>{let n={},r=Fm;return t.plugins&&(t.plugins=t.plugins.filter(e=>typeof e==`string`&&e||typeof e!=`string`&&e.name),r=t.plugins.length===1&&Lm(t.plugins[0])?[...Fm,...t.plugins]:t.plugins),Im({dependencies:e,userPlugins:r.map(e=>{if(typeof e==`string`)return e;let t=e.name;return t&&(e.handler?n[t]=e:(n[t]={config:{...e}},delete n[t].config.name)),t}).filter(Boolean),userPluginsConfig:n})},zm=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&!process.env.CI&&!process.env.NO_INTERACTIVE&&!process.env.NO_INTERACTION),Bm=async({logger:e,userConfigs:t})=>{let n=[],r={},i=e.timeEvent(`load`);for(let i of t){let t;if(i?.configFile){let e=i.configFile.split(`.`);t=e.slice(0,e.length-1).join(`.`)}let a=e.timeEvent(`c12`),{loadConfig:o}=await import(`c12`),{config:s,configFile:c}=await o({configFile:t,name:`openapi-ts`});a.timeEnd(),Object.keys(r).length||(r=We(Object.keys(s).length?c:void 0));let u=s instanceof Array?s.map(e=>ze(e,i)):[ze(s,i)];for(let e of u){let t=Ie(e);if(e.output instanceof Array){let r=t.length,i=e.output.length;if(i>1)if(r!==i){console.warn(`⚙️ ${l.default.yellow(`Warning:`)} You provided ${l.default.cyan(String(r))} ${l.default.cyan(r===1?`input`:`inputs`)} and ${l.default.yellow(String(i))} ${l.default.yellow(`outputs`)}. This is probably not what you want as it will produce identical output in multiple locations. You most likely want to provide a single output or the same number of outputs as inputs.`);for(let r of e.output)n.push({...e,input:t,output:r})}else e.output.forEach((r,i)=>{n.push({...e,input:t[i],output:r})});else n.push({...e,input:t,output:e.output[0]??``})}else n.push({...e,input:t})}}i.timeEnd();let a=[],o=e.timeEvent(`build`);for(let e of n){let{base:t,configFile:n=``,dryRun:i=!1,experimentalParser:o=!0,exportCore:s=!0,name:c,request:u,useOptions:f=!0}=e,p=e.interactive===void 0?zm():e.interactive,m=Le(e),h=Ie(e),g=Ue(e),_=Ke(e),v=[];h.length||v.push(new oe(`missing input - which OpenAPI specification should we use to generate your output?`)),g.path||v.push(new oe(`missing output - where should we generate your output?`)),!f&&m.level!==`silent`&&console.warn(`❗️ Deprecation warning: useOptions set to false. This setting will be removed in future versions. Please migrate useOptions to true https://heyapi.dev/openapi-ts/migrating.html#v0-27-38`),g.path=d.default.resolve(process.cwd(),g.path);let y;try{y=Rm({dependencies:r,userConfig:e})}catch(e){v.push(e),y={pluginOrder:[],plugins:{}}}let b=ge({...y,base:t,configFile:n,dryRun:i,experimentalParser:o,exportCore:!1,input:h,interactive:p,logs:m,name:c,output:g,parser:_,request:u,useOptions:f});b.exportCore=C(b)?s:!1;let ee=a.length;if(m.level===`debug`){let e=l.default.gray(`[Job ${ee+1}] `);console.warn(`${e}${l.default.cyan(`config:`)}`,b)}a.push({config:b,errors:v,jobIndex:ee})}return o.timeEnd(),{dependencies:r,results:a}},Vm=Object.entries({$body_:`body`,$headers_:`headers`,$path_:`path`,$query_:`query`}),Hm=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},Um=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},Wm=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},Gm=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(Um(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=Hm(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):Km({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},Km=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},qm=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=Wm(r),s=Object.entries(i).map(([t,i])=>Km({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},Jm=({allowReserved:e,array:t,object:n}={})=>r=>{let i=[];if(r&&typeof r==`object`)for(let a in r){let o=r[a];if(o!=null)if(Array.isArray(o)){let n=Gm({allowReserved:e,explode:!0,name:a,style:`form`,value:o,...t});n&&i.push(n)}else if(typeof o==`object`){let t=qm({allowReserved:e,explode:!0,name:a,style:`deepObject`,value:o,...n});t&&i.push(t)}else{let t=Km({allowReserved:e,name:a,value:o});t&&i.push(t)}}return i.join(`&`)},Ym=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},Xm=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?Ym(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},Zm=Jm({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),Qm=async({fetchOptions:e,inputPath:t,timeout:n,watch:r})=>{let i=(0,_.getResolvedInput)({pathOrUrlOrSchema:t}),a,o,s;if(i.type===`url`){if(r.lastValue&&r.isHeadMethodSupported!==!1){try{let t=await(0,_.sendRequest)({fetchOptions:{method:`HEAD`,...e,headers:Xm(e?.headers,r.headers)},timeout:n,url:i.path});if(t.response.status>=300)return{error:`not-ok`,response:t.response};s=t.response}catch(e){return{error:`not-ok`,response:new Response(e.message)}}if(!s.ok&&r.isHeadMethodSupported)return{error:`not-ok`,response:s};if(r.isHeadMethodSupported===void 0&&(r.isHeadMethodSupported=s.ok),s.status===304)return{error:`not-modified`,response:s};if(o===void 0){let e=s.headers.get(`ETag`);e&&(o=e!==r.headers.get(`If-None-Match`),o&&r.headers.set(`If-None-Match`,e))}if(o===void 0){let e=s.headers.get(`Last-Modified`);e&&(o=e!==r.headers.get(`If-Modified-Since`),o&&r.headers.set(`If-Modified-Since`,e))}if(o===!1)return{error:`not-modified`,response:s}}try{let t=await(0,_.sendRequest)({fetchOptions:{method:`GET`,...e},timeout:n,url:i.path});if(t.response.status>=300)return{error:`not-ok`,response:t.response};s=t.response}catch(e){return{error:`not-ok`,response:new Response(e.message)}}if(!s.ok)return{error:`not-ok`,response:s};if(a=s.body?await s.arrayBuffer():new ArrayBuffer(0),o===void 0){let e=new TextDecoder().decode(a);o=e!==r.lastValue,r.lastValue=e}}else r.lastValue?o=!1:r.lastValue=i.type;return o===!1?{error:`not-modified`,response:s}:{arrayBuffer:a,resolvedInput:i}};Object.defineProperty(exports,`ConfigError`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`ConfigValidationError`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`GeneratedFile`,{enumerable:!0,get:function(){return eu}}),Object.defineProperty(exports,`JobError`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`__commonJSMin`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`__toESM`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`clientDefaultConfig`,{enumerable:!0,get:function(){return nl}}),Object.defineProperty(exports,`clientDefaultMeta`,{enumerable:!0,get:function(){return rl}}),Object.defineProperty(exports,`clientPluginHandler`,{enumerable:!0,get:function(){return hl}}),Object.defineProperty(exports,`compiler`,{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(exports,`defaultPaginationKeywords`,{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,`defaultPlugins`,{enumerable:!0,get:function(){return Fm}}),Object.defineProperty(exports,`definePluginConfig`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`ensureDirSync`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`generateClientBundle`,{enumerable:!0,get:function(){return dl}}),Object.defineProperty(exports,`getClientPlugin`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`getConfig`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`getLogs`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,`getSpec`,{enumerable:!0,get:function(){return Qm}}),Object.defineProperty(exports,`initConfigs`,{enumerable:!0,get:function(){return Bm}}),Object.defineProperty(exports,`isLegacyClient`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`legacyNameFromConfig`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`loadPackageJson`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`logCrashReport`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`openGitHubIssueWithCrashReport`,{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,`parseLegacy`,{enumerable:!0,get:function(){return Cc}}),Object.defineProperty(exports,`parseOpenApiSpec`,{enumerable:!0,get:function(){return wc}}),Object.defineProperty(exports,`printCrashReport`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`removeDirSync`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`sanitizeNamespaceIdentifier`,{enumerable:!0,get:function(){return dr}}),Object.defineProperty(exports,`shouldReportCrash`,{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,`sort`,{enumerable:!0,get:function(){return ds}}),Object.defineProperty(exports,`sortByName`,{enumerable:!0,get:function(){return ps}}),Object.defineProperty(exports,`stringCase`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`transformClassName`,{enumerable:!0,get:function(){return Go}}),Object.defineProperty(exports,`tsc`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`unique`,{enumerable:!0,get:function(){return ts}});
24
- //# sourceMappingURL=getSpec-_5jk-wUD.cjs.map
23
+ `}),g):p.nodes.push(g),p.methods.add(s.methodName),i.set(d.id,p)})});let s=e.registerSymbol({exported:!1,name:`_HeyApiClient`}),c=t=>{if(a.has(t.id))return;if(t.classes.size)for(let n of t.classes){let r=i.get(n);c(r),t.nodes.push(N.propertyDeclaration({initializer:e.config.instance?N.newExpression({argumentsArray:e.config.instance?[N.objectExpression({multiLine:!1,obj:[{key:`client`,value:N.propertyAccessExpression({expression:N.this(),name:`_client`})}]})]:[],expression:N.identifier({text:e.referenceSymbol(r.id).placeholder})}):N.identifier({text:e.referenceSymbol(r.id).placeholder}),modifier:e.config.instance?void 0:`static`,name:T({case:`camelCase`,value:r.className})}))}let r=e.registerSymbol({exported:!0,name:t.className,selector:e.api.getSelector(`class`,t.className)}),o=N.classDeclaration({decorator:t.root&&n?{args:[{providedIn:`root`}],name:e.referenceSymbol(e.api.getSelector(`Injectable`)).placeholder}:void 0,exportClass:r.exported,extendedClasses:e.config.instance?[s.placeholder]:void 0,name:r.placeholder,nodes:t.nodes});e.setSymbolValue(r,o),a.add(r.id)};if(o.length){let t=N.classDeclaration({exportClass:s.exported,name:s.placeholder,nodes:o});e.setSymbolValue(s,t)}for(let e of i.values())c(e)},Du=({plugin:e})=>{let t=x(e.context.config),n=t.name===`@hey-api/client-nuxt`;e.forEach(`operation`,({operation:r})=>{let i=zc({context:e.context,operation:r}),a=e.getPluginOrThrow(`@hey-api/typescript`),o=n?e.getSymbol(a.api.getSelector(`response`,r.id)):void 0,s=Ic({isRequiredOptions:i,operation:r,plugin:e}),c=Rc({isRequiredOptions:i,opParameters:s,operation:r,plugin:e}),l=e.registerSymbol({name:bu({config:e.context.config,handleIllegal:!0,id:r.id,operation:r}),selector:e.api.getSelector(`function`,r.id)}),u=N.constVariable({comment:e.api.createOperationComment({operation:r}),exportConst:!0,expression:N.arrowFunction({parameters:s.parameters,returnType:void 0,statements:c,types:n?[{default:N.ots.string(`$fetch`),extends:N.typeNode(e.referenceSymbol(e.api.getSelector(`Composable`)).placeholder),name:Dc},{default:o?N.typeReferenceNode({typeName:o.placeholder}):N.typeNode(`undefined`),extends:o?N.typeReferenceNode({typeName:o.placeholder}):void 0,name:Oc}]:[{default:(`throwOnError`in t.config?t.config.throwOnError:!1)??!1,extends:`boolean`,name:`ThrowOnError`}]}),name:l.placeholder});e.setSymbolValue(l,u)})},Ou=({plugin:e})=>{let t=sl(e.context.config);e.registerSymbol({external:t,name:`formDataBodySerializer`,selector:e.api.getSelector(`formDataBodySerializer`)}),e.registerSymbol({external:t,name:`urlSearchParamsBodySerializer`,selector:e.api.getSelector(`urlSearchParamsBodySerializer`)}),e.registerSymbol({external:t,name:`buildClientParams`,selector:e.api.getSelector(`buildClientParams`)});let n=x(e.context.config),r=n.name===`@hey-api/client-angular`;n.name===`@hey-api/client-nuxt`&&e.registerSymbol({external:t,meta:{kind:`type`},name:`Composable`,selector:e.api.getSelector(`Composable`)}),r&&e.config.asClass&&e.registerSymbol({external:`@angular/core`,name:`Injectable`,selector:e.api.getSelector(`Injectable`)}),wu({plugin:e}),e.config.asClass?Eu({plugin:e}):Du({plugin:e})},ku={api:new cu({name:`@hey-api/sdk`}),config:{asClass:!1,auth:!0,classNameBuilder:`{{name}}`,classStructure:`auto`,client:!0,exportFromIndex:!0,instance:!1,operationId:!0,params_EXPERIMENTAL:`default`,response:`body`,responseStyle:`fields`,transformer:!1,validator:!1},dependencies:[`@hey-api/typescript`],handler:Ou,handlerLegacy:Cu,name:`@hey-api/sdk`,resolveConfig:(e,t)=>{e.config.client?(typeof e.config.client==`boolean`&&(e.config.client=t.pluginByTag(`client`,{defaultPlugin:`@hey-api/client-fetch`})),e.dependencies.add(e.config.client)):e.config.client=!1,e.config.transformer?(typeof e.config.transformer==`boolean`&&(e.config.transformer=t.pluginByTag(`transformer`)),e.dependencies.add(e.config.transformer)):e.config.transformer=!1,typeof e.config.validator!=`object`&&(e.config.validator={request:e.config.validator,response:e.config.validator}),e.config.validator.request?(typeof e.config.validator.request==`boolean`&&(e.config.validator.request=t.pluginByTag(`validator`)),e.dependencies.add(e.config.validator.request)):e.config.validator.request=!1,e.config.validator.response?(typeof e.config.validator.response==`boolean`&&(e.config.validator.response=t.pluginByTag(`validator`)),e.dependencies.add(e.config.validator.response)):e.config.validator.response=!1,e.config.instance?(typeof e.config.instance!=`string`&&(e.config.instance=`Sdk`),e.config.asClass=!0):e.config.instance=!1,e.config.classNameBuilder===`{{name}}`&&e.config.client===`@hey-api/client-angular`&&(e.config.classNameBuilder=`{{name}}Service`)}},Au=w(ku);var ju=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Mu=({dataExpression:e,schema:t})=>{if(t.type!==`integer`||t.format!==`int64`)return;let n=e===void 0?void 0:N.callExpression({functionName:`BigInt`,parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:e,name:`toString`})})]});if(n){if(typeof e==`string`)return[n];if(e)return[N.assignment({left:e,right:n})]}},Nu=({dataExpression:e,schema:t})=>{if(t.type!==`string`||!(t.format===`date`||t.format===`date-time`))return;let n=N.identifier({text:`Date`});if(typeof e==`string`)return[N.newExpression({argumentsArray:[N.identifier({text:e})],expression:n})];if(e)return[N.assignment({left:e,right:N.newExpression({argumentsArray:[e],expression:n})})]},Pu=`data`,Fu=e=>e.map(e=>p.default.isStatement(e)?e:N.expressionToStatement({expression:e})),Iu=({node:e})=>e.kind===p.default.SyntaxKind.ReturnStatement,Lu=({plugin:e,schema:t})=>{let n=N.identifier({text:Pu}),r=Ru({dataExpression:n,plugin:e,schema:t});return r.length&&!Iu({node:r[r.length-1]})&&r.push(N.returnStatement({expression:n})),r},Ru=({dataExpression:e,plugin:t,schema:n})=>{if(n.$ref){let r=t.api.getSelector(`response-ref`,n.$ref);if(!t.getSymbol(r)){let e=t.registerSymbol({name:E({config:{case:`camelCase`,name:`{{name}}SchemaResponseTransformer`},name:L(n.$ref)}),selector:r}),i=Lu({plugin:t,schema:t.context.resolveIrRef(n.$ref)});if(i.length){let n=N.constVariable({expression:N.arrowFunction({async:!1,multiLine:!0,parameters:[{name:Pu,type:N.keywordTypeNode({keyword:`any`})}],statements:Fu(i)}),name:e.placeholder});t.setSymbolValue(e,n)}else t.setSymbolValue(e,null)}let i=t.referenceSymbol(r);if(t.getSymbolValue(i)!==null){let t=N.callExpression({functionName:i.placeholder,parameters:[e]});if(e)return typeof e==`string`&&e===`item`?[N.returnStatement({expression:t})]:[typeof e==`string`?t:N.assignment({left:e,right:t})]}return[]}if(n.type===`array`){if(!e||typeof e==`string`)return[];let r=n.items?Ru({dataExpression:`item`,plugin:t,schema:n.items?.[0]?n.items[0]:{...n,type:void 0}}):[];if(!r.length)return[];let i=Fu(r);return i.some(e=>Iu({node:e}))||i.push(N.returnStatement({expression:N.identifier({text:`item`})})),[N.assignment({left:e,right:N.callExpression({functionName:N.propertyAccessExpression({expression:e,name:`map`}),parameters:[N.arrowFunction({multiLine:!0,parameters:[{name:`item`,type:`any`}],statements:i})]})})]}if(n.type===`object`){let r=[],i=n.required??[];for(let a in n.properties){let o=n.properties[a],s=N.propertyAccessExpression({expression:e||Pu,name:a}),c=Ru({dataExpression:s,plugin:t,schema:o});if(!c.length)continue;let l=!o.items?.find(e=>e.type===`null`);i.includes(a)&&l?r=r.concat(c):r.push(N.ifStatement({expression:s,thenStatement:N.block({statements:Fu(c)})}))}return r}if(n.items){if(n.items.length===1)return Ru({dataExpression:`item`,plugin:t,schema:n.items[0]});let r=[];if(n.logicalOperator===`and`||n.items.length===2&&n.items.find(e=>e.type===`null`||e.type===`void`)){for(let i of n.items){let n=Ru({dataExpression:e||`item`,plugin:t,schema:i});if(n.length)if(e)r=r.concat(n);else{let e=N.identifier({text:`item`});r.push(N.ifStatement({expression:e,thenStatement:N.block({statements:Fu(n)})}),N.returnStatement({expression:e}))}}return r}n.type!==`enum`&&((n.items??[]).every(e=>[`boolean`,`integer`,`null`,`number`,`string`].includes(e.type))||console.warn(`❗️ Transformers warning: schema ${JSON.stringify(n)} is too complex and won't be currently processed. This will likely produce an incomplete transformer which is not what you want. Please open an issue if you'd like this improved https://github.com/hey-api/openapi-ts/issues`))}for(let r of t.config.transformers){let i=r({config:t.config,dataExpression:e,schema:n});if(i)return i}return[]},zu=({plugin:e})=>{e.forEach(`operation`,({operation:t})=>{let{response:n}=Kn(t);if(!n)return;if(n.items&&n.items.length>1){e.context.config.logs.level===`debug`&&console.warn(`❗️ Transformers warning: route ${I(t)} has ${n.items.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`);return}let r=e.getPluginOrThrow(`@hey-api/typescript`),i=e.getSymbol(r.api.getSelector(`response`,t.id));if(!i)return;let a=e.registerSymbol({exported:!0,name:E({config:{case:`camelCase`,name:`{{name}}ResponseTransformer`},name:t.id}),selector:e.api.getSelector(`response`,t.id)}),o=Lu({plugin:e,schema:n});if(o.length){let t=N.constVariable({exportConst:a.exported,expression:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:Pu,type:N.keywordTypeNode({keyword:`any`})}],returnType:N.typeReferenceNode({typeArguments:[N.typeReferenceNode({typeName:i.placeholder})],typeName:`Promise`}),statements:Fu(o)}),name:a.placeholder});e.setSymbolValue(a,t)}else e.setSymbolValue(a,null)})},Bu=`$OpenApiTs`,Y={$refs:[],base:``,description:null,enum:[],enums:[],export:`interface`,imports:[],in:``,isDefinition:!1,isNullable:!1,isReadOnly:!1,isRequired:!1,link:null,name:``,properties:[],template:null,type:``},Vu=({comments:e,leadingComment:t,meta:n,obj:r,onNode:i,...a})=>{if(!n)return;let{created:o,name:s}=ks({create:!0,meta:n,...a});if(o){let n=S().plugins[`@hey-api/typescript`];i(N.enumDeclaration({asConst:typeof n?.config.enums==`object`&&n.config.enums.mode===`typescript-const`,comments:e,leadingComment:t,name:s,obj:r}))}},Hu=({comment:e,meta:t,onCreated:n,onNode:r,type:i,...a})=>{if(!t)return{created:!1,name:``};let o=ks({create:!0,meta:t,...a}),{created:s,name:c}=o;return s&&(r(N.typeAliasDeclaration({comment:e,exportType:!0,name:c,type:i})),n?.(c)),o},Uu=e=>{let t=[];Ku(e),e.model.enums.forEach(n=>Gu({...e,model:n,onNode:e=>{t.push(e)}})),t.length&&e.onNode(N.namespaceDeclaration({name:e.model.name,statements:t}))},Wu=({client:e,model:t,onNode:n})=>{let r=S(),i={},a={};t.enum.forEach(e=>{let{key:t,value:n}=_s(e);i[t]=n;let r=e.customDescription||e.description;r&&(a[t]=[O(r)])});let o=[t.description&&O(t.description),t.deprecated&&`@deprecated`],s=r.plugins[`@hey-api/typescript`];if(s?.config&&typeof s.config.enums==`object`&&s.config.enums.enabled&&(s.config.enums.mode===`typescript`||s.config.enums.mode===`typescript-const`)){Vu({asConst:s.config.enums.mode===`typescript-const`,client:e,comments:a,leadingComment:o,meta:t.meta,obj:i,onNode:n});return}Hu({client:e,comment:o,meta:t.meta,onCreated:e=>{let t=r.plugins[`@hey-api/typescript`];if(t?.config&&typeof t.config.enums==`object`&&t.config.enums.enabled&&t.config.enums.mode===`javascript`){let t=N.objectExpression({multiLine:!0,obj:Object.entries(i).map(([e,t])=>({comments:a[e],key:e,value:t})),unescape:!0});n(N.constVariable({assertion:`const`,comment:o,exportConst:!0,expression:t,name:e}))}},onNode:n,type:hs(t.enum)})},Gu=({model:e,onNode:t})=>{let n={},r={};e.enum.forEach(e=>{let{key:t,value:i}=_s(e);n[t]=i;let a=e.customDescription||e.description;a&&(r[t]=[O(a)])});let i=S().plugins[`@hey-api/typescript`];t(N.enumDeclaration({asConst:typeof i?.config.enums==`object`&&i.config.enums.mode===`typescript-const`,comments:r,leadingComment:[e.description&&O(e.description),e.deprecated&&`@deprecated`],name:e.meta?.name||e.name,obj:n}))},Ku=({client:e,model:t,onNode:n})=>{Hu({client:e,comment:[t.description&&O(t.description),t.deprecated&&`@deprecated`],meta:t.meta,onNode:n,type:K(t)})},qu=e=>{switch(e.model.export){case`all-of`:case`any-of`:case`one-of`:case`interface`:return Uu(e);case`enum`:return Wu(e);default:return Ku(e)}},Ju=({client:e,onNode:t})=>{let n={},r=S();if(!r.plugins[`@hey-api/sdk`]&&!r.plugins[`@hey-api/typescript`]?.config.tree)return;let i=C(r);for(let r of e.services)for(let a of r.operations){if(!a.parameters.length&&!a.responses.length)continue;n[a.path]||(n[a.path]={});let r=n[a.path];r[a.method]||(r[a.method]={});let o=r[a.method];if(o.$ref=a.name,a.responses.length>0){if(o.res||={},Array.isArray(o.res))continue;a.responses.forEach(e=>{o.res[e.code]=e})}if(a.parameters.length>0){let n={mediaType:null,...Y,in:`body`,name:`body`,prop:`body`},r=a.parameters.filter(e=>e.in===`body`);r.length||(r=a.parameters.filter(e=>e.in===`formData`)),r.length===1?n={...Y,...r[0],in:`body`,isRequired:r[0].isRequired,name:`body`,prop:`body`}:r.length>1&&(n={...Y,in:`body`,isRequired:r.some(e=>e.isRequired),mediaType:`multipart/form-data`,name:`body`,prop:`body`,properties:r});let s={...Y,in:`header`,isRequired:Ns(a.parameters.filter(e=>e.in===`header`)),mediaType:null,name:i?`header`:`headers`,prop:i?`header`:`headers`,properties:a.parameters.filter(e=>e.in===`header`).sort(fs)},c={...Y,in:`path`,isRequired:Ns(a.parameters.filter(e=>e.in===`path`)),mediaType:null,name:`path`,prop:`path`,properties:a.parameters.filter(e=>e.in===`path`).sort(fs)},l={...Y,in:`query`,isRequired:Ns(a.parameters.filter(e=>e.in===`query`)),mediaType:null,name:`query`,prop:`query`,properties:a.parameters.filter(e=>e.in===`query`).sort(fs)},u=i?ps([...a.parameters]):[n,s,c,l].filter(e=>e.properties.length||e.$refs.length||e.mediaType);o.req=u,Hu({client:e,meta:{$ref:a.name,name:a.name},nameTransformer:du,onNode:t,type:K({...Y,isRequired:!0,properties:u})})}let s=a.responses.filter(e=>e.responseTypes.includes(`success`));if(s.length>0){Hu({client:e,meta:{$ref:a.name,name:a.name},nameTransformer:mu,onNode:t,type:K({...Y,export:`any-of`,isRequired:!0,properties:s})});let n=a.responses.filter(e=>e.responseTypes.includes(`error`));i||Hu({client:e,meta:{$ref:a.name,name:a.name},nameTransformer:fu,onNode:t,type:K(n.length?{...Y,export:`one-of`,isRequired:!0,properties:n}:{...Y,base:`unknown`,isRequired:!0,type:`unknown`})})}}let a=Object.entries(n).map(([t,n])=>{let r=Object.entries(n).map(([t,n])=>{let r=t,i=[];if(n.req){let t=n.$ref,{name:r}=ks({client:e,meta:{$ref:t,name:t},nameTransformer:du}),a={...Y,base:r,export:`reference`,isRequired:!0,name:`req`,properties:[],type:r};i=[...i,a]}if(n.res){let e=Object.entries(n.res).map(([e,t])=>({...Y,...t,isRequired:!0,name:String(e)})),t={...Y,isRequired:!0,name:`res`,properties:e};i=[...i,t]}return{...Y,isRequired:!0,name:r.toLocaleLowerCase(),properties:i}}).filter(Boolean);return{...Y,isRequired:!0,name:`'${t}'`,properties:r}});r.plugins[`@hey-api/typescript`]?.config.tree&&Hu({client:e,meta:{$ref:`@hey-api/openapi-ts`,name:`$OpenApiTs`},onNode:t,type:K({...Y,properties:a})})},Yu=({client:e,files:t,plugin:n})=>{t.types=new eu({dir:S().output.path,exportFromIndex:n.config.exportFromIndex,id:`types`,name:`types.ts`});let r=e=>{t.types?.add(e)};for(let t of e.models)qu({client:e,model:t,onNode:r});Ju({client:e,onNode:r})},Xu=`data`,Zu=e=>e.base===`unknown`&&e.export===`generic`&&e.type===`unknown`,Qu=({client:e,model:t})=>t.$refs.map(t=>{let n=e.models.find(e=>e.meta?.$ref===t);if(!n)throw Error(`Ref ${t} could not be found. Transformers cannot be generated without having access to all refs.`);return n}),$u=e=>{let t=e.model.meta.name,{name:n}=Hu({...e,meta:{$ref:`transformers/${t}`,name:t},nameTransformer:uu,onCreated:n=>{let r=nd({...e,meta:{$ref:`transformers/${t}`,name:n},path:[Xu]});rd({...e,async:!1,name:n,statements:r})},type:`(${Xu}: any) => ${t}`});return{created:!!e.client.types[n],name:n}},ed=e=>{let{model:t}=e,n=Qu(e);if(n.length===1){let{created:t,name:r}=$u({...e,model:n[0]});return t?[N.transformArrayMutation({path:e.path,transformerName:r})]:[]}return xs(t)||t.link&&!Array.isArray(t.link)&&t.link.export===`any-of`&&t.link.properties.find(e=>xs(e))?[N.transformArrayMap({path:e.path,transformExpression:N.conditionalExpression({condition:N.identifier({text:`item`}),whenFalse:N.identifier({text:`item`}),whenTrue:N.transformNewDate({parameterName:`item`})})})]:[]},td=e=>{let{model:t}=e,n=[...e.path,t.name];return t.type===`string`&&t.export!==`array`&&xs(t)?[N.transformDateMutation({path:n})]:nd({...e,model:t,path:n})},nd=e=>{let{model:t}=e;switch(t.export){case`array`:return ed(e);case`interface`:return t.properties.flatMap(t=>td({...e,model:t}));case`reference`:{if(t.$refs.length!==1)return[];let n=Qu(e),{created:r,name:i}=$u({...e,model:n[0]});return r?t.in===`response`?[N.expressionToStatement({expression:N.callExpression({functionName:i,parameters:[Xu]})})]:N.transformFunctionMutation({path:e.path,transformerName:i}):[]}default:return[]}},rd=({async:e,client:t,name:n,onNode:r,onRemoveNode:i,statements:a})=>{let o={created:!1,name:n};if(!a.length)return As({client:t,name:n}),i?.(),o;let s=N.arrowFunction({async:e,multiLine:!0,parameters:[{name:Xu}],statements:[...a,N.returnVariable({expression:Xu})]});return r(N.constVariable({exportConst:!0,expression:s,name:n,typeName:n})),{created:!0,name:n}},id=({client:e,files:t})=>{let n=S(),r=e=>{t.types?.add(e)},i=()=>{t.types?.removeNode_LEGACY()};for(let t of e.services)for(let a of t.operations){let t=a.responses.filter(e=>e.responseTypes.includes(`success`));if(!t.length)continue;let o=t.filter(e=>!Zu(e));if(!o.length)continue;if(o.length>1){n.logs.level===`debug`&&console.warn(`❗️ Transformers warning: route ${I(a)} has ${o.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`);continue}let s=mu(a.name);Hu({client:e,meta:{$ref:`transformers/${s}`,name:s},nameTransformer:pu,onCreated:n=>{rd({async:!0,client:e,name:n,onNode:r,onRemoveNode:i,statements:t.length>1?t.flatMap(t=>{let n=nd({client:e,meta:{$ref:`transformers/${s}`,name:s},model:t,onNode:r,onRemoveNode:i,path:[Xu]});return n.length?[N.ifStatement({expression:N.safeAccessExpression([`data`]),thenStatement:N.block({statements:n})})]:[]}):nd({client:e,meta:{$ref:`transformers/${s}`,name:s},model:t[0],onNode:r,onRemoveNode:i,path:[Xu]})})},onNode:r,type:`(${Xu}: any) => Promise<${s}>`})}},ad={api:new ju({name:`@hey-api/transformers`}),config:{bigInt:!0,dates:!0,exportFromIndex:!1,transformers:[],typeTransformers:[]},dependencies:[`@hey-api/typescript`],handler:zu,handlerLegacy:id,name:`@hey-api/transformers`,resolveConfig:e=>{e.config.transformers||(e.config.transformers=[]),e.config.dates&&(e.config.transformers=[...e.config.transformers,Nu]),e.config.bigInt&&(e.config.transformers=[...e.config.transformers,Mu])},tags:[`transformer`]},od=w(ad),sd=({context:e,name:t})=>(D.lastIndex=0,D.test(t)?t.startsWith(`-`)?p.default.factory.createStringLiteral(t):p.default.factory.createNumericLiteral(t):T({case:e.config.output.case,value:t})),cd=({schema:e})=>{let t=[];return e.title&&t.push(O(e.title)),e.description&&(t.length&&t.push(``),t.push(O(e.description))),e.deprecated&&(t.length&&t.push(``),t.push(`@deprecated`)),t.length?t:void 0},ld=N.keywordTypeNode({keyword:`string`}),ud=({server:e})=>{let t=la(e.url);return t.protocol&&t.host?N.literalTypeNode({literal:N.stringLiteral({text:e.url})}):N.templateLiteralType({value:[t.protocol||ld,`://`,t.host||ld,t.port?`:${t.port}`:``,t.path||``]})},dd=({plugin:e,servers:t,symbolClientOptions:n})=>{let r=x(e.context.config),i=t.map(e=>ud({server:e}));t.length?`strictBaseUrl`in r.config&&r.config.strictBaseUrl||i.push(N.typeIntersectionNode({types:[ld,p.default.factory.createTypeLiteralNode([])]})):i.push(ld);let a=N.typeInterfaceNode({properties:[{name:me(e.context.config),type:N.typeUnionNode({types:i})}],useLegacyResolution:!1}),o=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:a});e.setSymbolValue(n,o)},fd=({plugin:e,schema:t})=>{let n=[];return{obj:(t.items??[]).map((t,r)=>{let i=typeof t.const;n.includes(i)||n.push(i);let a;return a=t.title?t.title:i===`number`||i===`string`?`${t.const}`:i===`boolean`?t.const?`true`:`false`:t.const===null?`null`:`${r}`,a&&(a=T({case:e.config.enums.case,stripLeadingSeparators:!1,value:a}),D.lastIndex=0,D.test(a)&&e.config.enums.enabled&&(e.config.enums.mode===`typescript`||e.config.enums.mode===`typescript-const`)&&(a=`_${a}`)),{comments:cd({schema:t}),key:a,value:t.const}}),typeofItems:n}},pd=({plugin:e,schema:t,symbol:n,type:r})=>{if(t.type===`enum`&&e.config.enums.enabled){let r=fd({plugin:e,schema:t});if(e.config.enums.mode===`javascript`){e.config.enums.constantsIgnoreNull&&r.typeofItems.includes(`object`)&&(r.obj=r.obj.filter(e=>e.value!==null));let i=N.constVariable({assertion:`const`,comment:cd({schema:t}),exportConst:!0,expression:N.objectExpression({multiLine:!0,obj:r.obj}),name:n.placeholder}),a=N.typeOfExpression({text:n.placeholder}),o=N.typeAliasDeclaration({comment:cd({schema:t}),exportType:!0,name:n.placeholder,type:N.indexedAccessTypeNode({indexType:N.typeOperatorNode({operator:`keyof`,type:a}),objectType:a})});e.setSymbolValue(n,[i,o]);return}else if((e.config.enums.mode===`typescript`||e.config.enums.mode===`typescript-const`)&&!r.typeofItems.some(e=>e!==`number`&&e!==`string`)){let i=N.enumDeclaration({asConst:e.config.enums.mode===`typescript-const`,leadingComment:cd({schema:t}),name:n.placeholder,obj:r.obj});e.setSymbolValue(n,i);return}}let i=N.typeAliasDeclaration({comment:cd({schema:t}),exportType:n.exported,name:n.placeholder,type:r});e.setSymbolValue(n,i)},md=({parameters:e})=>{let t={type:`object`};if(e){let n={},r=[];for(let t in e){let i=e[t];n[i.name]=P({detectFormat:!1,schema:i.schema}),i.required&&r.push(i.name)}t.properties=n,r.length&&(t.required=r)}return t},hd=({operation:e,plugin:t})=>{let n={type:`object`},r=[];n.properties||={},e.body?(n.properties.body=e.body.schema,e.body.required&&r.push(`body`)):n.properties.body={type:`never`},e.parameters?.header&&(n.properties.headers=md({parameters:e.parameters.header}),n.properties.headers.required&&r.push(`headers`)),e.parameters?.path?(n.properties.path=md({parameters:e.parameters.path}),n.properties.path.required&&r.push(`path`)):n.properties.path={type:`never`},e.parameters?.query?(n.properties.query=md({parameters:e.parameters.query}),n.properties.query.required&&r.push(`query`)):n.properties.query={type:`never`},n.properties.url={const:e.path,type:`string`},r.push(`url`),n.required=r;let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.requests,name:e.id}),selector:t.api.getSelector(`data`,e.id)}),a=X({plugin:t,schema:n}),o=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:a});t.setSymbolValue(i,o)},gd=({operation:e,plugin:t})=>{hd({operation:e,plugin:t});let{error:n,errors:r,response:i,responses:a}=Kn(e);if(r){let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.errors,name:e.id}),selector:t.api.getSelector(`errors`,e.id)}),a=X({plugin:t,schema:r}),o=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:a});if(t.setSymbolValue(i,o),n){let n=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:t.config.errors.case,name:t.config.errors.error},name:e.id}),selector:t.api.getSelector(`error`,e.id)}),r=N.indexedAccessTypeNode({indexType:N.typeOperatorNode({operator:`keyof`,type:N.typeReferenceNode({typeName:i.placeholder})}),objectType:N.typeReferenceNode({typeName:i.placeholder})}),a=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:r});t.setSymbolValue(n,a)}}if(a){let n=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.responses,name:e.id}),selector:t.api.getSelector(`responses`,e.id)}),r=X({plugin:t,schema:a}),o=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:r});if(t.setSymbolValue(n,o),i){let r=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:t.config.responses.case,name:t.config.responses.response},name:e.id}),selector:t.api.getSelector(`response`,e.id)}),i=N.indexedAccessTypeNode({indexType:N.typeOperatorNode({operator:`keyof`,type:N.typeReferenceNode({typeName:n.placeholder})}),objectType:N.typeReferenceNode({typeName:n.placeholder})}),a=N.typeAliasDeclaration({exportType:r.exported,name:r.placeholder,type:i});t.setSymbolValue(r,a)}}},_d=({operation:e,plugin:t})=>{let n={type:`object`},r=[];if(n.properties||={},e.body){let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:t.config.webhooks.case,name:t.config.webhooks.payload},name:e.id}),selector:t.api.getSelector(`webhook-payload`,e.id)}),a=X({plugin:t,schema:e.body.schema}),o=N.typeAliasDeclaration({comment:cd({schema:e.body.schema}),exportType:i.exported,name:i.placeholder,type:a});t.setSymbolValue(i,o),t.registerSymbol({exported:!0,meta:{kind:`type`},name:i.name,placeholder:i.placeholder,selector:t.api.getSelector(`ref`,i.placeholder)}),n.properties.body={$ref:i.placeholder},r.push(`body`)}else n.properties.body={type:`never`};n.properties.key={const:e.path,type:`string`},r.push(`key`),n.properties.path={type:`never`},n.properties.query={type:`never`},n.required=r;let i=t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.webhooks,name:e.id}),selector:t.api.getSelector(`webhook-request`,e.id)}),a=X({plugin:t,schema:n}),o=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:a});return t.setSymbolValue(i,o),i.placeholder},vd=({operation:e,plugin:t})=>_d({operation:e,plugin:t}),yd=({plugin:e,symbolWebhooks:t,webhookNames:n})=>{if(!n.length)return;let r=N.typeUnionNode({types:n.map(e=>N.typeReferenceNode({typeName:e}))}),i=N.typeAliasDeclaration({exportType:t.exported,name:t.placeholder,type:r});e.setSymbolValue(t,i)},bd=({plugin:e,schema:t})=>{if(!t.items)return N.typeArrayNode(N.keywordTypeNode({keyword:e.config.topType}));t=P({detectFormat:!0,schema:t});let n=[];for(let r of t.items){let t=X({plugin:e,schema:r});n.push(t)}return n.length===1?N.typeArrayNode(n[0]):t.logicalOperator===`and`?N.typeArrayNode(N.typeIntersectionNode({types:n})):N.typeArrayNode(N.typeUnionNode({types:n}))},xd=({schema:e})=>e.const===void 0?N.keywordTypeNode({keyword:`boolean`}):N.literalTypeNode({literal:N.ots.boolean(e.const)}),Sd=({plugin:e,schema:t})=>X({plugin:e,schema:{...t,type:void 0}}),Cd=({plugin:e,schema:t})=>t.const===void 0?t.type===`integer`&&t.format===`int64`&&e.getPlugin(`@hey-api/transformers`)?.config.bigInt?N.typeReferenceNode({typeName:`bigint`}):N.keywordTypeNode({keyword:`number`}):N.literalTypeNode({literal:N.ots.number(t.const)}),wd=({plugin:e,schema:t})=>{let n,r,i=[],a=[],o=t.required??[],s=!1;for(let n in t.properties){let r=t.properties[n],c=X({plugin:e,schema:r}),l=o.includes(n);i.push({comment:cd({schema:r}),isReadOnly:r.accessScope===`read`,isRequired:l,name:sd({context:e.context,name:n}),type:c}),a.push(r),l||(s=!0)}if(t.patternProperties)for(let e in t.patternProperties){let n=t.patternProperties[e];a.unshift(n)}let c=!!t.patternProperties&&Object.keys(t.patternProperties).length>0,l=t.additionalProperties,u=l!==!1&&l?l:void 0;if(c||u&&(u.type!==`never`||!a.length)){let i=u;i&&i.type!==`never`?a.unshift(i):!c&&!a.length&&i&&i.type===`never`&&(a=[i]),s&&a.push({type:`undefined`}),r={isRequired:!t.propertyNames,name:`key`,type:a.length===1?X({plugin:e,schema:a[0]}):X({plugin:e,schema:{items:a,logicalOperator:`or`}})},t.propertyNames?.$ref&&(n=X({plugin:e,schema:{$ref:t.propertyNames.$ref}}))}return N.typeInterfaceNode({indexKey:n,indexProperty:r,properties:i,useLegacyResolution:!1})},Td=({plugin:e,schema:t})=>{if(t.const!==void 0)return N.literalTypeNode({literal:N.stringLiteral({text:t.const})});if(t.format){if(t.format===`binary`)return N.typeUnionNode({types:[N.typeReferenceNode({typeName:`Blob`}),N.typeReferenceNode({typeName:`File`})]});if((t.format===`date-time`||t.format===`date`)&&e.getPlugin(`@hey-api/transformers`)?.config.dates)return N.typeReferenceNode({typeName:`Date`});if(t.format===`typeid`&&typeof t.example==`string`){let n=String(t.example).split(`_`);n.pop();let r=n.join(`_`),i=e.api.getSelector(`TypeID`,r);if(!e.getSymbol(i)){let t=e.api.getSelector(`TypeID`);if(!e.getSymbol(t)){let n=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`TypeID`,selector:t}),r=N.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:N.templateLiteralType({value:[N.typeReferenceNode({typeName:`T`}),`_`,N.keywordTypeNode({keyword:`string`})]}),typeParameters:[N.typeParameterDeclaration({constraint:N.keywordTypeNode({keyword:`string`}),name:`T`})]});e.setSymbolValue(n,r)}let n=e.referenceSymbol(t),a=e.registerSymbol({exported:!0,meta:{kind:`type`},name:T({case:e.config.case,value:`${r}_id`}),selector:i}),o=N.typeAliasDeclaration({exportType:a.exported,name:a.placeholder,type:N.typeReferenceNode({typeArguments:[N.literalTypeNode({literal:N.stringLiteral({text:r})})],typeName:n.placeholder})});e.setSymbolValue(a,o)}let a=e.referenceSymbol(i);return N.typeReferenceNode({typeName:a.placeholder})}}return N.keywordTypeNode({keyword:`string`})},Ed=({plugin:e,schema:t})=>{let n=[];if(t.const&&Array.isArray(t.const))n=t.const.map(t=>N.valueToExpression({value:t})??N.identifier({text:e.config.topType}));else if(t.items)for(let r of t.items){let t=X({plugin:e,schema:r});n.push(t)}return N.typeTupleNode({types:n})},Dd=({plugin:e,schema:t})=>{let n=e.getPlugin(`@hey-api/transformers`);if(n?.config.typeTransformers)for(let e of n.config.typeTransformers){let n=e({schema:t});if(n)return n}switch(t.type){case`array`:return bd({plugin:e,schema:t});case`boolean`:return xd({schema:t});case`enum`:return Sd({plugin:e,schema:t});case`integer`:case`number`:return Cd({plugin:e,schema:t});case`never`:return N.keywordTypeNode({keyword:`never`});case`null`:return N.literalTypeNode({literal:N.null()});case`object`:return wd({plugin:e,schema:t});case`string`:return Td({plugin:e,schema:t});case`tuple`:return Ed({plugin:e,schema:t});case`undefined`:return N.keywordTypeNode({keyword:`undefined`});case`unknown`:return N.keywordTypeNode({keyword:e.config.topType});case`void`:return N.keywordTypeNode({keyword:`void`})}},X=({plugin:e,schema:t})=>{if(t.$ref){let n=e.referenceSymbol(e.api.getSelector(`ref`,t.$ref));return N.typeReferenceNode({typeName:n.placeholder})}if(t.type)return Dd({plugin:e,schema:t});if(t.items){if(t=P({detectFormat:!1,schema:t}),t.items){let n=[];for(let r of t.items){let t=X({plugin:e,schema:r});n.push(t)}return t.logicalOperator===`and`?N.typeIntersectionNode({types:n}):N.typeUnionNode({types:n})}return X({plugin:e,schema:t})}return Dd({plugin:e,schema:{type:`unknown`}})},Od=({id:e,plugin:t,schema:n})=>{let r=X({plugin:t,schema:n}),i=n.type===`enum`&&t.config.enums.enabled;pd({plugin:t,schema:n,symbol:t.registerSymbol({exported:!0,meta:{kind:i?void 0:`type`},name:E({config:t.config.definitions,name:L(e)}),selector:t.api.getSelector(`ref`,e)}),type:r})},kd=({plugin:e})=>{let t=e.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:e.config.case},name:`ClientOptions`}),selector:e.api.getSelector(`ClientOptions`)}),n=e.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:{case:e.config.case},name:`Webhooks`}),selector:e.api.getSelector(`Webhooks`)}),r=[],i=[];e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`server`,`webhook`,t=>{switch(t.type){case`operation`:gd({operation:t.operation,plugin:e});break;case`parameter`:Od({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:Od({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:Od({id:t.$ref,plugin:e,schema:t.schema});break;case`server`:r.push(t.server);break;case`webhook`:i.push(vd({operation:t.operation,plugin:e}));break}}),dd({plugin:e,servers:r,symbolClientOptions:t}),yd({plugin:e,symbolWebhooks:n,webhookNames:i})};var Ad=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}schemaToType(e){return X(e)}};const jd={api:new Ad({name:`@hey-api/typescript`}),config:{case:`PascalCase`,exportFromIndex:!0,style:`preserve`,topType:`unknown`,tree:!1},handler:kd,handlerLegacy:Yu,name:`@hey-api/typescript`,resolveConfig:(e,t)=>{e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.definitions}),e.config.enums=t.valueToObject({defaultValue:{case:`SCREAMING_SNAKE_CASE`,constantsIgnoreNull:!1,enabled:!!e.config.enums,mode:`javascript`},mappers:{boolean:e=>({enabled:e}),string:e=>({mode:e})},value:e.config.enums}),e.config.errors=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,error:`{{name}}Error`,name:`{{name}}Errors`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.errors}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}Data`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}Responses`,response:`{{name}}Response`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??`PascalCase`,name:`{{name}}WebhookRequest`,payload:`{{name}}WebhookPayload`},mappers:{function:e=>({name:e}),string:e=>({name:e})},value:e.config.webhooks})}},Md=w(jd);var Nd=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Pd=(e,t,n)=>{let r=e.config[n].meta;if(!r)return;let i=r(t);if(Object.keys(i).length)return N.valueToExpression({value:i})},Fd=({operation:e,plugin:t})=>Fc({operation:e,plugin:t.getPluginOrThrow(`@hey-api/sdk`)}),Id=({operation:e,plugin:t})=>{let n=x(t.context.config),r=t.getPluginOrThrow(`@hey-api/typescript`),i=t.getSymbol(r.api.getSelector(`error`,e.id))?.placeholder;return i||=`Error`,n.name===`@hey-api/client-axios`&&(i=`${t.referenceSymbol(t.api.getSelector(`AxiosError`)).placeholder}<${i}>`),i},Ld=({operation:e,plugin:t})=>{let n=t.getPluginOrThrow(`@hey-api/typescript`);return t.getSymbol(n.api.getSelector(`response`,e.id))?.placeholder||`unknown`},Rd=({plugin:e,typeData:t})=>{let n=x(e.context.config).name===`@hey-api/client-nuxt`;return{isNuxtClient:n,strippedTypeData:n?`Omit<${t}, 'composable'>`:t}},zd=({operation:e,plugin:t,queryFn:n})=>{let r=t.referenceSymbol(t.api.getSelector(`UseMutationOptions`)),i=Fd({operation:e,plugin:t}),a=Id({operation:e,plugin:t}),o=Ld({operation:e,plugin:t}),{isNuxtClient:s,strippedTypeData:c}=Rd({plugin:t,typeData:i}),l=s?`${r.placeholder}<${o}, ${c}, ${a}>`:`${r.placeholder}<${o}, ${i}, ${a}>`,u=`fnOptions`,d=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:u},{key:`throwOnError`,value:!0}]})]})}),f=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?f.push(N.returnVariable({expression:d})):f.push(N.constVariable({destructure:!0,expression:d,name:`data`}),N.returnVariable({expression:`data`}));let p=[{key:`mutation`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[s?{name:u,type:`Partial<${c}>`}:{name:u}],statements:f})}],m=Pd(t,e,`mutationOptions`);m&&p.push({key:`meta`,value:m});let h=t.getPluginOrThrow(`@hey-api/sdk`),g=t.registerSymbol({exported:!0,name:E({config:t.config.mutationOptions,name:e.id})}),_=N.constVariable({comment:t.config.comments?h.api.createOperationComment({operation:e}):void 0,exportConst:g.exported,expression:N.arrowFunction({parameters:[{isRequired:!1,name:`options`,type:`Partial<${c}>`}],returnType:l,statements:[N.returnStatement({expression:N.objectExpression({obj:p})})]}),name:g.placeholder});t.setSymbolValue(g.id,_)},Bd=`TOptions`,Vd=N.identifier({text:`options`}),Hd=({plugin:e})=>{let t=e.registerSymbol({name:E({config:{case:e.config.case},name:`createQueryKey`}),selector:e.api.getSelector(`createQueryKey`)}),n=e.referenceSymbol(e.api.getSelector(`QueryKey`)),r=e.referenceSymbol(e.api.getSelector(`_JSONValue`)),i=N.indexedAccessTypeNode({indexType:N.literalTypeNode({literal:N.ots.number(0)}),objectType:N.typeReferenceNode({typeArguments:[N.typeReferenceNode({typeName:Bd})],typeName:n.placeholder})}),a=me(e.context.config),o=e.getPluginOrThrow(`@hey-api/sdk`),s=e.referenceSymbol(o.api.getSelector(`Options`)),c=x(e.context.config),l=c.api&&`getSelector`in c.api?e.getSymbol(c.api.getSelector(`client`)):void 0,u=sl(e.context.config),d=e.registerSymbol({external:u,name:`serializeQueryKeyValue`}),f=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`id`,type:N.typeReferenceNode({typeName:`string`})},{isRequired:!1,name:`options`,type:N.typeReferenceNode({typeName:Bd})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:`ReadonlyArray<string>`})}],returnType:N.typeTupleNode({types:[i]}),statements:[N.constVariable({assertion:i,expression:N.objectExpression({multiLine:!1,obj:[{key:`_id`,value:N.identifier({text:`id`})},{key:a,value:N.identifier({text:`options?.${a} || (options?.client ?? ${l?.placeholder}).getConfig().${a}`})}]}),name:`params`,typeName:i}),N.ifStatement({expression:N.identifier({text:`tags`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`tags`}),right:N.asExpression({expression:N.asExpression({expression:N.identifier({text:`tags`}),type:N.keywordTypeNode({keyword:`unknown`})}),type:N.typeReferenceNode({typeName:r.placeholder})})})})]})}),N.ifStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:Vd,isOptional:!0,name:N.identifier({text:`body`})}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.constVariable({expression:N.callExpression({functionName:d.placeholder,parameters:[N.propertyAccessExpression({expression:`options`,name:`body`})]}),name:`normalizedBody`}),N.ifStatement({expression:N.binaryExpression({left:N.identifier({text:`normalizedBody`}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.identifier({text:`normalizedBody`})})})]})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:Vd,isOptional:!0,name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.propertyAccessExpression({expression:`options`,name:`path`})})})]})}),N.ifStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:Vd,isOptional:!0,name:N.identifier({text:`query`})}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.constVariable({expression:N.callExpression({functionName:d.placeholder,parameters:[N.propertyAccessExpression({expression:`options`,name:`query`})]}),name:`normalizedQuery`}),N.ifStatement({expression:N.binaryExpression({left:N.identifier({text:`normalizedQuery`}),operator:`!==`,right:`undefined`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.identifier({text:`normalizedQuery`})})})]})})]})}),N.returnStatement({expression:N.arrayLiteralExpression({elements:[N.identifier({text:`params`})]})})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:s.placeholder})}),name:Bd}]}),name:t.placeholder});e.setSymbolValue(t,f)},Ud=({id:e,operation:t,plugin:n})=>{let r=n.config.queryKeys,i;r.tags&&t.tags&&t.tags.length>0&&(i=N.arrayLiteralExpression({elements:t.tags.map(e=>N.stringLiteral({text:e}))}));let a=n.referenceSymbol(n.api.getSelector(`createQueryKey`));return N.callExpression({functionName:a.placeholder,parameters:[N.ots.string(e),`options`,i]})},Wd=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`_JSONValue`)),n=[{name:`_id`,type:N.keywordTypeNode({keyword:`string`})},{isRequired:!1,name:me(e.context.config),type:N.typeReferenceNode({typeName:t.placeholder})},{isRequired:!1,name:`body`,type:N.typeReferenceNode({typeName:t.placeholder})},{isRequired:!1,name:`query`,type:N.typeReferenceNode({typeName:t.placeholder})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:t.placeholder})}],r=e.getPluginOrThrow(`@hey-api/sdk`),i=e.referenceSymbol(r.api.getSelector(`Options`)),a=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`QueryKey`,selector:e.api.getSelector(`QueryKey`)}),o=N.typeAliasDeclaration({exportType:a.exported,name:a.placeholder,type:N.typeTupleNode({types:[N.typeIntersectionNode({types:[N.typeReferenceNode({typeName:`Pick<${Bd}, 'path'>`}),N.typeInterfaceNode({properties:n,useLegacyResolution:!0})]})]}),typeParameters:[{extends:N.typeReferenceNode({typeName:N.identifier({text:i.placeholder})}),name:Bd}]});e.setSymbolValue(a,o)},Gd=({operation:e,plugin:t,symbol:n})=>{let{strippedTypeData:r}=Rd({plugin:t,typeData:Fd({operation:e,plugin:t})});return N.constVariable({exportConst:n.exported,expression:N.arrowFunction({parameters:[{isRequired:Un(e),name:`options`,type:r}],statements:Ud({id:e.id,operation:e,plugin:t})}),name:n.placeholder})},Kd=`options`,qd=`context`,Jd=({operation:e,plugin:t,queryFn:n})=>{if(Bc({operation:e}))return;let r=zc({context:t.context,operation:e});t.getSymbol(t.api.getSelector(`createQueryKey`))||(Wd({plugin:t}),Hd({plugin:t}));let i;if(t.config.queryKeys.enabled){let n=t.registerSymbol({exported:!0,name:E({config:t.config.queryKeys,name:e.id})}),r=Gd({operation:e,plugin:t,symbol:n});t.setSymbolValue(n,r),i=N.callExpression({functionName:n.placeholder,parameters:[Kd]})}else{let n=t.referenceSymbol(t.api.getSelector(`createQueryKey`)),r;t.config.queryKeys.tags&&e.tags&&e.tags.length>0&&(r=N.arrayLiteralExpression({elements:e.tags.map(e=>N.stringLiteral({text:e}))})),i=N.callExpression({functionName:n.placeholder,parameters:[N.ots.string(e.id),Kd,r]})}let{strippedTypeData:a}=Rd({plugin:t,typeData:Fd({operation:e,plugin:t})}),o=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:Kd},{spread:qd},{key:`throwOnError`,value:!0}]})]})}),s=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?s.push(N.returnVariable({expression:o})):s.push(N.constVariable({destructure:!0,expression:o,name:`data`}),N.returnVariable({expression:`data`}));let c=[{key:`key`,value:i},{key:`query`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:qd}],statements:s})}],l=Pd(t,e,`queryOptions`);l&&c.push({key:`meta`,value:l});let u=t.getPluginOrThrow(`@hey-api/sdk`),d=t.registerSymbol({exported:!0,name:E({config:t.config.queryOptions,name:e.id}),selector:t.api.getSelector(`queryOptionsFn`,e.id)}),f=t.registerSymbol({external:t.name,name:`defineQueryOptions`,selector:t.api.getSelector(`defineQueryOptions`)}),p=N.constVariable({comment:t.config.comments?u.api.createOperationComment({operation:e}):void 0,exportConst:d.exported,expression:N.callExpression({functionName:f.placeholder,parameters:[N.arrowFunction({parameters:[{isRequired:r,name:Kd,type:a}],statements:N.objectExpression({obj:c})})]}),name:d.placeholder});t.setSymbolValue(d,p)},Yd=({plugin:e})=>{e.registerSymbol({external:e.name,meta:{kind:`type`},name:`UseMutationOptions`,selector:e.api.getSelector(`UseMutationOptions`)}),e.registerSymbol({external:e.name,meta:{kind:`type`},name:`UseQueryOptions`,selector:e.api.getSelector(`UseQueryOptions`)}),e.registerSymbol({external:e.name,meta:{kind:`type`},name:`_JSONValue`,selector:e.api.getSelector(`_JSONValue`)}),e.registerSymbol({external:`axios`,meta:{kind:`type`},name:`AxiosError`,selector:e.api.getSelector(`AxiosError`)});let t=e.getPluginOrThrow(`@hey-api/sdk`);e.forEach(`operation`,({operation:n})=>{let r=t.config.asClass?Pc({context:e.context,operation:n,plugin:t}):void 0,i=r?r.values().next().value:void 0,a=i?[e.referenceSymbol(t.api.getSelector(`class`,i.path[0])).placeholder,...i.path.slice(1).map(e=>T({case:`camelCase`,value:e})),i.methodName].filter(Boolean).join(`.`):e.referenceSymbol(t.api.getSelector(`function`,n.id)).placeholder;e.hooks.operation.isQuery(n)&&e.config.queryOptions.enabled&&Jd({operation:n,plugin:e,queryFn:a}),e.hooks.operation.isMutation(n)&&e.config.mutationOptions.enabled&&zd({operation:n,plugin:e,queryFn:a})})},Xd={api:new Nd({name:`@pinia/colada`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/typescript`,`@hey-api/sdk`],handler:Yd,name:`@pinia/colada`,resolveConfig:(e,t)=>{e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Query`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Zd=w(Xd),Qd=(e,t,n)=>{let r=e.config[n].meta;if(!r)return;let i=r(t);if(Object.keys(i).length)return N.valueToExpression({value:i})},$d=({operation:e,plugin:t})=>Fc({operation:e,plugin:t.getPluginOrThrow(`@hey-api/sdk`)}),ef=({operation:e,plugin:t})=>{let n=x(t.context.config),r=t.getPluginOrThrow(`@hey-api/typescript`),i=t.getSymbol(r.api.getSelector(`error`,e.id))?.placeholder;return i||=t.referenceSymbol(t.api.getSelector(`DefaultError`)).placeholder,n.name===`@hey-api/client-axios`&&(i=`${t.referenceSymbol(t.api.getSelector(`AxiosError`)).placeholder}<${i}>`),i},tf=({operation:e,plugin:t})=>{let n=t.getPluginOrThrow(`@hey-api/typescript`);return t.getSymbol(n.api.getSelector(`response`,e.id))?.placeholder||`unknown`},nf=`TOptions`,rf=N.identifier({text:`infinite`}),af=N.identifier({text:`options`}),of=({plugin:e})=>{let t=e.registerSymbol({name:E({config:{case:e.config.case},name:`createQueryKey`}),selector:e.api.getSelector(`createQueryKey`)}),n=e.referenceSymbol(e.api.getSelector(`QueryKey`)),r=N.indexedAccessTypeNode({indexType:N.literalTypeNode({literal:N.ots.number(0)}),objectType:N.typeReferenceNode({typeArguments:[N.typeReferenceNode({typeName:nf})],typeName:n.placeholder})}),i=me(e.context.config),a=x(e.context.config),o=a.api&&`getSelector`in a.api?e.getSymbol(a.api.getSelector(`client`)):void 0,s=e.getPluginOrThrow(`@hey-api/sdk`),c=e.referenceSymbol(s.api.getSelector(`Options`)),l=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`id`,type:N.typeReferenceNode({typeName:`string`})},{isRequired:!1,name:`options`,type:N.typeReferenceNode({typeName:nf})},{isRequired:!1,name:`infinite`,type:N.typeReferenceNode({typeName:`boolean`})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:`ReadonlyArray<string>`})}],returnType:N.typeTupleNode({types:[r]}),statements:[N.constVariable({assertion:r,expression:N.objectExpression({multiLine:!1,obj:[{key:`_id`,value:N.identifier({text:`id`})},{key:i,value:N.identifier({text:`options?.${i} || (options?.client ?? ${o?.placeholder}).getConfig().${i}`})}]}),name:`params`,typeName:r}),N.ifStatement({expression:rf,thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`_infinite`}),right:rf})})]})}),N.ifStatement({expression:N.identifier({text:`tags`}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`tags`}),right:N.identifier({text:`tags`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.propertyAccessExpression({expression:`options`,name:`body`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.propertyAccessExpression({expression:`options`,name:`headers`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.propertyAccessExpression({expression:`options`,name:`path`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:af,isOptional:!0,name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.propertyAccessExpression({expression:`options`,name:`query`})})})]})}),N.returnStatement({expression:N.arrayLiteralExpression({elements:[N.identifier({text:`params`})]})})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:c.placeholder})}),name:nf}]}),name:t.placeholder});e.setSymbolValue(t,l)},sf=({id:e,isInfinite:t,operation:n,plugin:r})=>{let i=t?r.config.infiniteQueryKeys:r.config.queryKeys,a;i.tags&&n.tags&&n.tags.length>0&&(a=N.arrayLiteralExpression({elements:n.tags.map(e=>N.stringLiteral({text:e}))}));let o=r.referenceSymbol(r.api.getSelector(`createQueryKey`));return N.callExpression({functionName:o.placeholder,parameters:[N.ots.string(e),`options`,t||a?N.ots.boolean(!!t):void 0,a]})},cf=({plugin:e})=>{let t=[{name:`_id`,type:N.keywordTypeNode({keyword:`string`})},{isRequired:!1,name:`_infinite`,type:N.keywordTypeNode({keyword:`boolean`})},{isRequired:!1,name:`tags`,type:N.typeReferenceNode({typeName:`ReadonlyArray<string>`})}],n=e.getPluginOrThrow(`@hey-api/sdk`),r=e.referenceSymbol(n.api.getSelector(`Options`)),i=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`QueryKey`,selector:e.api.getSelector(`QueryKey`)}),a=N.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:N.typeTupleNode({types:[N.typeIntersectionNode({types:[N.typeReferenceNode({typeName:`Pick<${nf}, '${me(e.context.config)}' | 'body' | 'headers' | 'path' | 'query'>`}),N.typeInterfaceNode({properties:t,useLegacyResolution:!0})]})]}),typeParameters:[{extends:N.typeReferenceNode({typeName:N.identifier({text:r.placeholder})}),name:nf}]});e.setSymbolValue(i,a)},lf=({isInfinite:e,operation:t,plugin:n,symbol:r,typeQueryKey:i})=>{let a=$d({operation:t,plugin:n});return N.constVariable({exportConst:r.exported,expression:N.arrowFunction({parameters:[{isRequired:Un(t),name:`options`,type:a}],returnType:e?i:void 0,statements:sf({id:t.id,isInfinite:e,operation:t,plugin:n})}),name:r.placeholder})},uf=({plugin:e})=>{let t=e.registerSymbol({name:E({config:{case:e.config.case},name:`createInfiniteParams`}),selector:e.api.getSelector(`createInfiniteParams`)}),n=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`queryKey`,type:N.typeReferenceNode({typeName:`QueryKey<Options>`})},{name:`page`,type:N.typeReferenceNode({typeName:`K`})}],statements:[N.constVariable({expression:N.objectExpression({obj:[{spread:N.propertyAccessExpression({expression:`queryKey`,name:0})}]}),name:`params`}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].body`},{assertion:`any`,spread:`page.body`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].headers`},{spread:`page.headers`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].path`},{assertion:`any`,spread:`page.path`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].query`},{assertion:`any`,spread:`page.query`}]})})})]})}),N.returnVariable({expression:N.asExpression({expression:N.asExpression({expression:N.identifier({text:`params`}),type:N.keywordTypeNode({keyword:`unknown`})}),type:p.default.factory.createTypeQueryNode(N.identifier({text:`page`}))})})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>`})}),name:`K`}]}),name:t.placeholder});e.setSymbolValue(t,n)},df=({operation:e,plugin:t,queryFn:n})=>{let r=Wn({context:t.context,operation:e});if(!r)return;let i=zc({context:t.context,operation:e});t.getSymbol(t.api.getSelector(`createQueryKey`))||(cf({plugin:t}),of({plugin:t})),t.getSymbol(t.api.getSelector(`createInfiniteParams`))||uf({plugin:t});let a=t.referenceSymbol(t.api.getSelector(`infiniteQueryOptions`)),o=t.referenceSymbol(t.api.getSelector(`InfiniteData`)),s=$d({operation:e,plugin:t}),c=ef({operation:e,plugin:t}),l=tf({operation:e,plugin:t}),u=`${t.referenceSymbol(t.api.getSelector(`QueryKey`)).placeholder}<${s}>`,d=`Pick<${u}[0], 'body' | 'headers' | 'path' | 'query'>`,f=t.getPluginOrThrow(`@hey-api/typescript`),p=`${gt({node:f.api.schemaToType({plugin:f,schema:r.schema}),unescape:!0})} | ${d}`,m=t.registerSymbol({exported:!0,name:E({config:t.config.infiniteQueryKeys,name:e.id})}),h=lf({isInfinite:!0,operation:e,plugin:t,symbol:m,typeQueryKey:u});t.setSymbolValue(m,h);let g=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:`params`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),_=t.referenceSymbol(t.api.getSelector(`createInfiniteParams`)),v=[N.constVariable({comment:[{jsdoc:!1,lines:[`@ts-ignore`]}],expression:N.conditionalExpression({condition:N.binaryExpression({left:N.typeOfExpression({text:`pageParam`}),operator:`===`,right:N.ots.string(`object`)}),whenFalse:N.objectExpression({multiLine:!0,obj:[{key:r.in,value:N.objectExpression({multiLine:!0,obj:[{key:r.name,value:N.identifier({text:`pageParam`})}]})}]}),whenTrue:N.identifier({text:`pageParam`})}),name:`page`,typeName:d}),N.constVariable({expression:N.callExpression({functionName:_.placeholder,parameters:[`queryKey`,`page`]}),name:`params`})];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?v.push(N.returnVariable({expression:g})):v.push(N.constVariable({destructure:!0,expression:g,name:`data`}),N.returnVariable({expression:`data`}));let y=[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`pageParam`},{name:`queryKey`},{name:`signal`}]}],statements:v})},{key:`queryKey`,value:N.callExpression({functionName:m.placeholder,parameters:[`options`]})}],b=Qd(t,e,`infiniteQueryOptions`);b&&y.push({key:`meta`,value:b});let ee=t.getPluginOrThrow(`@hey-api/sdk`),te=t.registerSymbol({exported:!0,name:E({config:t.config.infiniteQueryOptions,name:e.id})}),ne=N.constVariable({comment:t.config.comments?ee.api.createOperationComment({operation:e}):void 0,exportConst:te.exported,expression:N.arrowFunction({parameters:[{isRequired:i,name:`options`,type:s}],statements:[N.returnFunctionCall({args:[N.objectExpression({comments:[{jsdoc:!1,lines:[`@ts-ignore`]}],obj:y})],name:a.placeholder,types:[l,c||`unknown`,`${o.placeholder}<${l}>`,u,p]})]}),name:te.placeholder});t.setSymbolValue(te,ne)},ff=({operation:e,plugin:t,queryFn:n})=>{let r=t.referenceSymbol(t.api.getSelector(`MutationOptions`)),i=$d({operation:e,plugin:t}),a=ef({operation:e,plugin:t}),o=tf({operation:e,plugin:t}),s=`${r.placeholder}<${o}, ${a}, ${i}>`,c=`fnOptions`,l=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:c},{key:`throwOnError`,value:!0}]})]})}),u=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?u.push(N.returnVariable({expression:l})):u.push(N.constVariable({destructure:!0,expression:l,name:`data`}),N.returnVariable({expression:`data`}));let d=[{key:`mutationFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:c}],statements:u})}],f=Qd(t,e,`mutationOptions`);f&&d.push({key:`meta`,value:f});let p=t.getPluginOrThrow(`@hey-api/sdk`),m=`mutationOptions`,h=N.arrowFunction({parameters:[{isRequired:!1,name:`options`,type:`Partial<${i}>`}],returnType:s,statements:[N.constVariable({expression:N.objectExpression({obj:d}),name:m,typeName:s}),N.returnVariable({expression:m})]}),g=t.registerSymbol({exported:!0,name:E({config:t.config.mutationOptions,name:e.id})}),_=N.constVariable({comment:t.config.comments?p.api.createOperationComment({operation:e}):void 0,exportConst:g.exported,expression:h,name:g.placeholder});t.setSymbolValue(g,_)},pf=`options`,mf=({operation:e,plugin:t,queryFn:n})=>{if(Bc({operation:e}))return;let r=zc({context:t.context,operation:e});t.getSymbol(t.api.getSelector(`createQueryKey`))||(cf({plugin:t}),of({plugin:t}));let i=t.referenceSymbol(t.api.getSelector(`queryOptions`)),a=t.registerSymbol({exported:!0,name:E({config:t.config.queryKeys,name:e.id})}),o=lf({isInfinite:!1,operation:e,plugin:t,symbol:a});t.setSymbolValue(a,o);let s=$d({operation:e,plugin:t}),c=N.awaitExpression({expression:N.callExpression({functionName:n,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:pf},{spread:`queryKey[0]`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),l=[];t.getPluginOrThrow(`@hey-api/sdk`).config.responseStyle===`data`?l.push(N.returnVariable({expression:c})):l.push(N.constVariable({destructure:!0,expression:c,name:`data`}),N.returnVariable({expression:`data`}));let u=[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`queryKey`},{name:`signal`}]}],statements:l})},{key:`queryKey`,value:N.callExpression({functionName:a.placeholder,parameters:[pf]})}],d=Qd(t,e,`queryOptions`);d&&u.push({key:`meta`,value:d});let f=t.getPluginOrThrow(`@hey-api/sdk`),p=t.registerSymbol({exported:t.config.queryOptions.exported,name:E({config:t.config.queryOptions,name:e.id}),selector:t.api.getSelector(`queryOptionsFn`,e.id)}),m=N.constVariable({comment:t.config.comments?f.api.createOperationComment({operation:e}):void 0,exportConst:p.exported,expression:N.arrowFunction({parameters:[{isRequired:r,name:pf,type:s}],statements:[N.returnFunctionCall({args:[N.objectExpression({obj:u})],name:i.placeholder})]}),name:p.placeholder});t.setSymbolValue(p,m)},hf=`options`,gf=({operation:e,plugin:t})=>{if(Bc({operation:e})||!(`useQuery`in t.config))return;let n=t.getPluginOrThrow(`@hey-api/sdk`),r=t.registerSymbol({exported:!0,name:E({config:t.config.useQuery,name:e.id})}),i=t.referenceSymbol(t.api.getSelector(`useQuery`)),a=zc({context:t.context,operation:e}),o=$d({operation:e,plugin:t}),s=t.referenceSymbol(t.api.getSelector(`queryOptionsFn`,e.id)),c=N.constVariable({comment:t.config.comments?n.api.createOperationComment({operation:e}):void 0,exportConst:r.exported,expression:N.arrowFunction({parameters:[{isRequired:a,name:hf,type:o}],statements:[N.returnStatement({expression:N.callExpression({functionName:i.placeholder,parameters:[N.callExpression({functionName:s.placeholder,parameters:[hf]})]})})]}),name:r.placeholder});t.setSymbolValue(r,c)},_f=({plugin:e})=>{e.registerSymbol({external:e.name,meta:{kind:`type`},name:`DefaultError`,selector:e.api.getSelector(`DefaultError`)}),e.registerSymbol({external:e.name,meta:{kind:`type`},name:`InfiniteData`,selector:e.api.getSelector(`InfiniteData`)});let t=e.name===`@tanstack/angular-query-experimental`||e.name===`@tanstack/svelte-query`||e.name===`@tanstack/solid-query`?`MutationOptions`:`UseMutationOptions`;e.registerSymbol({external:e.name,meta:{kind:`type`},name:t,selector:e.api.getSelector(`MutationOptions`)}),e.registerSymbol({external:e.name,name:`infiniteQueryOptions`,selector:e.api.getSelector(`infiniteQueryOptions`)}),e.registerSymbol({external:e.name,name:`queryOptions`,selector:e.api.getSelector(`queryOptions`)}),e.registerSymbol({external:e.name,name:`useQuery`,selector:e.api.getSelector(`useQuery`)}),e.registerSymbol({external:`axios`,meta:{kind:`type`},name:`AxiosError`,selector:e.api.getSelector(`AxiosError`)});let n=e.getPluginOrThrow(`@hey-api/sdk`);e.forEach(`operation`,({operation:t})=>{let r=n.config.asClass?Pc({context:e.context,operation:t,plugin:n}):void 0,i=r?r.values().next().value:void 0,a=i?[e.referenceSymbol(n.api.getSelector(`class`,i.path[0])).placeholder,...i.path.slice(1).map(e=>T({case:`camelCase`,value:e})),i.methodName].filter(Boolean).join(`.`):e.referenceSymbol(n.api.getSelector(`function`,t.id)).placeholder;e.hooks.operation.isQuery(t)&&(e.config.queryOptions.enabled&&mf({operation:t,plugin:e,queryFn:a}),e.config.infiniteQueryOptions.enabled&&df({operation:t,plugin:e,queryFn:a}),`useQuery`in e.config&&e.config.useQuery.enabled&&gf({operation:t,plugin:e})),e.hooks.operation.isMutation(t)&&e.config.mutationOptions.enabled&&ff({operation:t,plugin:e,queryFn:a})})},vf=e=>`${bu({config:S(),id:e.name,operation:e})}InfiniteOptions`,yf=e=>`${bu({config:S(),id:e.name,operation:e})}Mutation`,bf=({config:e,id:t,operation:n})=>`${bu({config:e,id:t,operation:n})}Options`,xf=({config:e,id:t,isInfinite:n,operation:r})=>`${bu({config:e,id:t,operation:r})}${n?`Infinite`:``}QueryKey`,Sf=e=>{switch(e.in){case`formData`:return`body`;case`header`:return`headers`;default:return e.in}},Cf=`createInfiniteParams`,wf=`createQueryKey`,Tf=`infiniteQueryOptions`,Ef=`mutationOptions`,Df=`QueryKey`,Of=`queryOptions`,kf=`TOptions`,Af=({file:e})=>{let t=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`queryKey`,type:N.typeNode(`QueryKey<OptionsLegacyParser>`)},{name:`page`,type:N.typeNode(`K`)}],statements:[N.constVariable({expression:N.identifier({text:`queryKey[0]`}),name:`params`}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.objectExpression({multiLine:!0,obj:[{assertion:`any`,spread:`queryKey[0].body`},{assertion:`any`,spread:`page.body`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].headers`},{spread:`page.headers`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].path`},{spread:`page.path`}]})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`page`}),name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.objectExpression({multiLine:!0,obj:[{spread:`queryKey[0].query`},{spread:`page.query`}]})})})]})}),N.returnVariable({expression:p.default.factory.createAsExpression(p.default.factory.createAsExpression(N.identifier({text:`params`}),p.default.factory.createKeywordTypeNode(p.default.SyntaxKind.UnknownKeyword)),p.default.factory.createTypeQueryNode(N.identifier({text:`page`})))})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`Pick<QueryKey<OptionsLegacyParser>[0], 'body' | 'headers' | 'path' | 'query'>`})}),name:`K`}]}),name:`createInfiniteParams`});e.add(t)},jf=({file:e})=>{let t=N.indexedAccessTypeNode({indexType:N.typeNode(0),objectType:N.typeNode(Df,[N.typeNode(kf)])}),n=N.identifier({text:`infinite`}),r=me(S()),i=N.constVariable({expression:N.arrowFunction({multiLine:!0,parameters:[{name:`id`,type:N.typeNode(`string`)},{isRequired:!1,name:`options`,type:N.typeNode(kf)},{isRequired:!1,name:`infinite`,type:N.typeNode(`boolean`)}],returnType:t,statements:[N.constVariable({assertion:t,expression:N.objectExpression({multiLine:!1,obj:[{key:`_id`,value:N.identifier({text:`id`})},{key:r,value:N.identifier({text:`options?.${r} || (options?.client ?? _heyApiClient).getConfig().${r}`})}]}),name:`params`,typeName:t}),N.ifStatement({expression:n,thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`_infinite`}),right:n})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`body`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`body`}),right:N.propertyAccessExpression({expression:`options`,name:`body`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`headers`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`headers`}),right:N.propertyAccessExpression({expression:`options`,name:`headers`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`path`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`path`}),right:N.propertyAccessExpression({expression:`options`,name:`path`})})})]})}),N.ifStatement({expression:N.propertyAccessExpression({expression:N.identifier({text:`options`}),isOptional:!0,name:N.identifier({text:`query`})}),thenStatement:N.block({statements:[N.expressionToStatement({expression:N.binaryExpression({left:N.propertyAccessExpression({expression:`params`,name:`query`}),right:N.propertyAccessExpression({expression:`options`,name:`query`})})})]})}),N.returnVariable({expression:`params`})],types:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`OptionsLegacyParser`})}),name:kf}]}),name:wf});e.add(i)},Mf=({file:e})=>{let t=[{name:`_id`,type:N.keywordTypeNode({keyword:`string`})},{isRequired:!1,name:`_infinite`,type:N.keywordTypeNode({keyword:`boolean`})}],n=N.typeAliasDeclaration({name:Df,type:N.typeTupleNode({types:[N.typeIntersectionNode({types:[N.typeReferenceNode({typeName:`Pick<${kf}, '${me(S())}' | 'body' | 'headers' | 'path' | 'query'>`}),N.typeInterfaceNode({properties:t,useLegacyResolution:!0})]})]}),typeParameters:[{extends:N.typeReferenceNode({typeName:N.identifier({text:`OptionsLegacyParser`})}),name:kf}]});e.add(n)},Nf=({client:e,file:t,operation:n,typesModulePath:r})=>{let{name:i}=lu({client:e,meta:n.parameters.length?{$ref:n.name,name:n.name}:void 0,nameTransformer:du,onImport:e=>{t.import({asType:!0,module:r,name:e})}});return{typeData:hu({importedType:i})}},Pf=({client:e,file:t,operation:n,pluginName:r,typesModulePath:i})=>{let a=S(),{name:o}=lu({client:e,meta:{$ref:n.name,name:n.name},nameTransformer:fu,onImport:e=>{t.import({asType:!0,module:i,name:e})}}),s={asType:!0,name:o};if(s.name||(s=t.import({asType:!0,module:r,name:`DefaultError`})),x(a).name===`@hey-api/client-axios`){let e=t.import({asType:!0,module:`axios`,name:`AxiosError`});s={...e,name:`${e.name}<${s.name}>`}}return{typeError:s}},Ff=({client:e,file:t,operation:n,typesModulePath:r})=>{let{name:i}=lu({client:e,meta:{$ref:n.name,name:n.name},nameTransformer:mu,onImport:e=>{t.import({asType:!0,module:r,name:e})}});return{typeResponse:i||`void`}},If=({id:e,isInfinite:t})=>N.arrayLiteralExpression({elements:[N.callExpression({functionName:wf,parameters:[N.ots.string(e),`options`,t?N.ots.boolean(!0):void 0]})],multiLine:!1}),Lf=({client:e,files:t,plugin:n})=>{let r=S();if(C(r))throw Error(`TanStack Query plugin does not support legacy clients`);let i=t[n.name];i.import({asType:!0,module:ol({config:r,sourceOutput:n.output}),name:`OptionsLegacyParser`});let a=ae({moduleOutput:t.types.nameWithoutExtension(),sourceOutput:n.output}),o=n.name===`@tanstack/angular-query-experimental`||n.name===`@tanstack/svelte-query`||n.name===`@tanstack/solid-query`?`MutationOptions`:`UseMutationOptions`,s,c=!1,l=!1,u=!1,d=!1,f=!1,p=new Map;for(let m of e.services)for(let h of m.operations){let g=I(h);if(p.has(g))continue;p.set(g,!0);let _=[r.plugins[`@hey-api/sdk`]?.config.asClass&&Go({config:r,name:m.name}),bu({config:r,handleIllegal:!r.plugins[`@hey-api/sdk`]?.config.asClass,id:h.name,operation:h})].filter(Boolean).join(`.`),v=!1;if(n.config.queryOptions.enabled&&[`GET`,`POST`].includes(h.method)){f||(f=!0,l||=(Mf({file:i}),jf({file:i}),!0),i.import({module:n.name,name:Of})),v=!0;let{typeData:t}=Nf({client:e,file:i,operation:h,typesModulePath:a}),o=Ns(h.parameters),s=N.constVariable({exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:o,name:`options`,type:t}],statements:If({id:h.name})}),name:xf({config:r,id:h.name,operation:h})});i.add(s);let c=N.constVariable({comment:[],exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:o,name:`options`,type:t}],statements:[N.returnFunctionCall({args:[N.objectExpression({obj:[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`queryKey`},{name:`signal`}]}],statements:[N.constVariable({destructure:!0,expression:N.awaitExpression({expression:N.callExpression({functionName:_,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:`queryKey[0]`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),name:`data`}),N.returnVariable({expression:`data`})]})},{key:`queryKey`,value:N.callExpression({functionName:xf({config:r,id:h.name,operation:h}),parameters:[`options`]})}]})],name:Of})]}),name:bf({config:r,id:h.name,operation:h})});i.add(c)}if(n.config.infiniteQueryOptions&&[`GET`,`POST`].includes(h.method)){let t,o=h.parameters.find(n=>{if(Mi(r.parser.pagination).test(n.name))return t=n,!0;if(n.in===`body`){if(n.export===`reference`){let i=n.$refs[0];return e.models.find(e=>e.meta?.$ref===i)?.properties.find(e=>{if(Mi(r.parser.pagination).test(e.name))return t=e,!0})}return n.properties.find(e=>{if(Mi(r.parser.pagination).test(e.name))return t=e,!0})}});if(o&&t){u||(u=!0,l||=(Mf({file:i}),jf({file:i}),!0),c||=(Af({file:i}),!0),i.import({module:n.name,name:Tf}),s=i.import({asType:!0,module:n.name,name:`InfiniteData`})),v=!0;let{typeData:d}=Nf({client:e,file:i,operation:h,typesModulePath:a}),{typeError:f}=Pf({client:e,file:i,operation:h,pluginName:n.name,typesModulePath:a}),{typeResponse:p}=Ff({client:e,file:i,operation:h,typesModulePath:a}),m=Ns(h.parameters),g=`${Df}<${d}>`,y=`Pick<${g}[0], 'body' | 'headers' | 'path' | 'query'>`,b=`${t.base} | ${y}`,ee=N.constVariable({exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:m,name:`options`,type:d}],returnType:g,statements:If({id:h.name,isInfinite:!0})}),name:xf({config:r,id:h.name,isInfinite:!0,operation:h})});i.add(ee);let te=N.constVariable({comment:[],exportConst:!0,expression:N.arrowFunction({parameters:[{isRequired:m,name:`options`,type:d}],statements:[N.returnFunctionCall({args:[N.objectExpression({comments:[{jsdoc:!1,lines:[`@ts-ignore`]}],obj:[{key:`queryFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{destructure:[{name:`pageParam`},{name:`queryKey`},{name:`signal`}]}],statements:[N.constVariable({comment:[{jsdoc:!1,lines:[`@ts-ignore`]}],expression:N.conditionalExpression({condition:N.binaryExpression({left:N.typeOfExpression({text:`pageParam`}),operator:`===`,right:N.ots.string(`object`)}),whenFalse:N.objectExpression({multiLine:!0,obj:[{key:Sf(o),value:N.objectExpression({multiLine:!0,obj:[{key:t.name,value:N.identifier({text:`pageParam`})}]})}]}),whenTrue:N.identifier({text:`pageParam`})}),name:`page`,typeName:y}),N.constVariable({expression:N.callExpression({functionName:`createInfiniteParams`,parameters:[`queryKey`,`page`]}),name:`params`}),N.constVariable({destructure:!0,expression:N.awaitExpression({expression:N.callExpression({functionName:_,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:`params`},{key:`signal`,shorthand:!0,value:N.identifier({text:`signal`})},{key:`throwOnError`,value:!0}]})]})}),name:`data`}),N.returnVariable({expression:`data`})]})},{key:`queryKey`,value:N.callExpression({functionName:xf({config:r,id:h.name,isInfinite:!0,operation:h}),parameters:[`options`]})}]})],name:Tf,types:[p,f.name,`${typeof s==`string`?s:s.name}<${p}>`,g,b]})]}),name:vf(h)});i.add(te)}}if(n.config.mutationOptions&&[`DELETE`,`PATCH`,`POST`,`PUT`].includes(h.method)){d||(d=!0,i.import({asType:!0,module:n.name,name:o})),v=!0;let{typeData:t}=Nf({client:e,file:i,operation:h,typesModulePath:a}),{typeError:r}=Pf({client:e,file:i,operation:h,pluginName:n.name,typesModulePath:a}),{typeResponse:s}=Ff({client:e,file:i,operation:h,typesModulePath:a}),c=`fnOptions`,l=N.arrowFunction({parameters:[{isRequired:!1,name:`options`,type:`Partial<${t}>`}],statements:[N.constVariable({expression:N.objectExpression({obj:[{key:`mutationFn`,value:N.arrowFunction({async:!0,multiLine:!0,parameters:[{name:c}],statements:[N.constVariable({destructure:!0,expression:N.awaitExpression({expression:N.callExpression({functionName:_,parameters:[N.objectExpression({multiLine:!0,obj:[{spread:`options`},{spread:c},{key:`throwOnError`,value:!0}]})]})}),name:`data`}),N.returnVariable({expression:`data`})]})}]}),name:Ef,typeName:`${o}<${s}, ${r.name}, ${t}>`}),N.returnVariable({expression:Ef})]}),u=N.constVariable({comment:[],exportConst:!0,expression:l,name:yf(h)});i.add(u)}(f||u)&&i.import({alias:`_heyApiClient`,module:ae({moduleOutput:t.client.nameWithoutExtension(),sourceOutput:n.output}),name:`client`}),v&&i.import({module:ae({moduleOutput:t.sdk.nameWithoutExtension(),sourceOutput:n.output}),name:_.split(`.`)[0]})}};var Rf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const zf={api:new Rf({name:`@tanstack/angular-query-experimental`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/angular-query-experimental`,output:`@tanstack/angular-query-experimental`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Bf=w(zf);var Vf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Hf={api:new Vf({name:`@tanstack/react-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/react-query`,output:`@tanstack/react-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions}),e.config.useQuery=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!1,name:`use{{name}}Query`},mappers:{boolean:e=>({enabled:e}),function:e=>({enabled:!0,name:e}),object:e=>({enabled:!0,...e}),string:e=>({enabled:!0,name:e})},value:e.config.useQuery}),e.config.useQuery.enabled&&(e.config.queryOptions.enabled||(e.config.queryOptions.enabled=!0,e.config.queryOptions.exported=!1))}},Uf=w(Hf);var Wf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Gf={api:new Wf({name:`@tanstack/solid-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/solid-query`,output:`@tanstack/solid-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Kf=w(Gf);var qf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Jf={api:new qf({name:`@tanstack/svelte-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/svelte-query`,output:`@tanstack/svelte-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Yf=w(Jf);var Xf=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const Zf={api:new Xf({name:`@tanstack/vue-query`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1},dependencies:[`@hey-api/sdk`,`@hey-api/typescript`],handler:_f,handlerLegacy:Lf,name:`@tanstack/vue-query`,output:`@tanstack/vue-query`,resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteQueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}InfiniteOptions`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}Mutation`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`{{name}}QueryKey`,tags:!1},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,exported:!0,name:`{{name}}Options`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.queryOptions})}},Qf=w(Zf);var $f=class{constructor(e){this.meta=e}getSelector(...e){return[this.meta.name,...e]}};const ep=({operation:e,plugin:t})=>{let n=[],r=t.getPluginOrThrow(`@hey-api/typescript`),i=t.getSymbol(r.api.getSelector(`data`,e.id));i&&(e.body&&n.push({isRequired:e.body.required,name:`Body`,type:`${i.placeholder}['body']`}),e.parameters&&(e.parameters.header&&n.push({isRequired:Bn(e.parameters.header),name:`Headers`,type:`${i.placeholder}['headers']`}),e.parameters.path&&n.push({isRequired:Bn(e.parameters.path),name:`Params`,type:`${i.placeholder}['path']`}),e.parameters.query&&n.push({isRequired:Bn(e.parameters.query),name:`Querystring`,type:`${i.placeholder}['query']`})));let{errors:a,responses:o}=Kn(e),s,c=t.getSymbol(r.api.getSelector(`errors`,e.id));if(c&&a&&a.properties){let e=Object.keys(a.properties);if(e.length){if(!e.includes(`default`))s=N.typeReferenceNode({typeName:c.placeholder});else if(e.length>1){let e=N.typeReferenceNode({typeName:c.placeholder}),t=N.literalTypeNode({literal:N.stringLiteral({text:`default`})});s=N.typeReferenceNode({typeArguments:[e,t],typeName:`Omit`})}}}let l,u=t.getSymbol(r.api.getSelector(`responses`,e.id));if(u&&o&&o.properties){let e=Object.keys(o.properties);if(e.length){if(!e.includes(`default`))l=N.typeReferenceNode({typeName:u.placeholder});else if(e.length>1){let e=N.typeReferenceNode({typeName:u.placeholder}),t=N.literalTypeNode({literal:N.stringLiteral({text:`default`})});l=N.typeReferenceNode({typeArguments:[e,t],typeName:`Omit`})}}}let d=[s,l].filter(Boolean);if(d.length&&n.push({name:`Reply`,type:N.typeIntersectionNode({types:d})}),!n.length)return;let f=t.referenceSymbol(t.api.getSelector(`RouteHandler`));return{name:e.id,type:N.typeReferenceNode({typeArguments:[N.typeInterfaceNode({properties:n,useLegacyResolution:!1})],typeName:f.placeholder})}},tp=({plugin:e})=>{e.registerSymbol({external:`fastify`,meta:{kind:`type`},name:`RouteHandler`,selector:e.api.getSelector(`RouteHandler`)});let t=e.registerSymbol({exported:!0,meta:{kind:`type`},name:`RouteHandlers`}),n=[];e.forEach(`operation`,({operation:t})=>{let r=ep({operation:t,plugin:e});r&&n.push(r)});let r=N.typeAliasDeclaration({exportType:t.exported,name:t.placeholder,type:N.typeInterfaceNode({properties:n,useLegacyResolution:!1})});e.setSymbolValue(t,r)},np={api:new $f({name:`fastify`}),config:{exportFromIndex:!1},dependencies:[`@hey-api/typescript`],handler:tp,name:`fastify`},rp=w(np),Z={actions:{args:N.identifier({text:`args`}),base64:N.identifier({text:`base64`}),bic:N.identifier({text:`bic`}),brand:N.identifier({text:`brand`}),bytes:N.identifier({text:`bytes`}),check:N.identifier({text:`check`}),checkItems:N.identifier({text:`checkItems`}),creditCard:N.identifier({text:`creditCard`}),cuid2:N.identifier({text:`cuid2`}),decimal:N.identifier({text:`decimal`}),description:N.identifier({text:`description`}),digits:N.identifier({text:`digits`}),email:N.identifier({text:`email`}),emoji:N.identifier({text:`emoji`}),empty:N.identifier({text:`empty`}),endsWith:N.identifier({text:`endsWith`}),entries:N.identifier({text:`entries`}),everyItem:N.identifier({text:`everyItem`}),excludes:N.identifier({text:`excludes`}),filterItems:N.identifier({text:`filterItems`}),findItem:N.identifier({text:`findItem`}),finite:N.identifier({text:`finite`}),flavor:N.identifier({text:`flavor`}),graphemes:N.identifier({text:`graphemes`}),gtValue:N.identifier({text:`gtValue`}),hash:N.identifier({text:`hash`}),hexColor:N.identifier({text:`hexColor`}),hexadecimal:N.identifier({text:`hexadecimal`}),imei:N.identifier({text:`imei`}),includes:N.identifier({text:`includes`}),integer:N.identifier({text:`integer`}),ip:N.identifier({text:`ip`}),ipv4:N.identifier({text:`ipv4`}),ipv6:N.identifier({text:`ipv6`}),isoDate:N.identifier({text:`isoDate`}),isoDateTime:N.identifier({text:`isoDateTime`}),isoTime:N.identifier({text:`isoTime`}),isoTimeSecond:N.identifier({text:`isoTimeSecond`}),isoTimestamp:N.identifier({text:`isoTimestamp`}),isoWeek:N.identifier({text:`isoWeek`}),length:N.identifier({text:`length`}),ltValue:N.identifier({text:`ltValue`}),mac:N.identifier({text:`mac`}),mac48:N.identifier({text:`mac48`}),mac64:N.identifier({text:`mac64`}),mapItems:N.identifier({text:`mapItems`}),maxBytes:N.identifier({text:`maxBytes`}),maxEntries:N.identifier({text:`maxEntries`}),maxGraphemes:N.identifier({text:`maxGraphemes`}),maxLength:N.identifier({text:`maxLength`}),maxSize:N.identifier({text:`maxSize`}),maxValue:N.identifier({text:`maxValue`}),maxWords:N.identifier({text:`maxWords`}),metadata:N.identifier({text:`metadata`}),mimeType:N.identifier({text:`mimeType`}),minBytes:N.identifier({text:`minBytes`}),minEntries:N.identifier({text:`minEntries`}),minGraphemes:N.identifier({text:`minGraphemes`}),minLength:N.identifier({text:`minLength`}),minSize:N.identifier({text:`minSize`}),minValue:N.identifier({text:`minValue`}),minWords:N.identifier({text:`minWords`}),multipleOf:N.identifier({text:`multipleOf`}),nanoid:N.identifier({text:`nanoid`}),nonEmpty:N.identifier({text:`nonEmpty`}),normalize:N.identifier({text:`normalize`}),notBytes:N.identifier({text:`notBytes`}),notEntries:N.identifier({text:`notEntries`}),notGraphemes:N.identifier({text:`notGraphemes`}),notLength:N.identifier({text:`notLength`}),notSize:N.identifier({text:`notSize`}),notValue:N.identifier({text:`notValue`}),notValues:N.identifier({text:`notValues`}),notWords:N.identifier({text:`notWords`}),octal:N.identifier({text:`octal`}),parseJson:N.identifier({text:`parseJson`}),partialCheck:N.identifier({text:`partialCheck`}),rawCheck:N.identifier({text:`rawCheck`}),rawTransform:N.identifier({text:`rawTransform`}),readonly:N.identifier({text:`readonly`}),reduceItems:N.identifier({text:`reduceItems`}),regex:N.identifier({text:`regex`}),returns:N.identifier({text:`returns`}),rfcEmail:N.identifier({text:`rfcEmail`}),safeInteger:N.identifier({text:`safeInteger`}),size:N.identifier({text:`size`}),slug:N.identifier({text:`slug`}),someItem:N.identifier({text:`someItem`}),sortItems:N.identifier({text:`sortItems`}),startsWith:N.identifier({text:`startsWith`}),stringifyJson:N.identifier({text:`stringifyJson`}),title:N.identifier({text:`title`}),toLowerCase:N.identifier({text:`toLowerCase`}),toMaxValue:N.identifier({text:`toMaxValue`}),toMinValue:N.identifier({text:`toMinValue`}),toUpperCase:N.identifier({text:`toUpperCase`}),transform:N.identifier({text:`transform`}),trim:N.identifier({text:`trim`}),trimEnd:N.identifier({text:`trimEnd`}),trimStart:N.identifier({text:`trimStart`}),ulid:N.identifier({text:`ulid`}),url:N.identifier({text:`url`}),uuid:N.identifier({text:`uuid`}),value:N.identifier({text:`value`}),values:N.identifier({text:`values`}),words:N.identifier({text:`words`})},async:{argsAsync:N.identifier({text:`argsAsync`}),arrayAsync:N.identifier({text:`arrayAsync`}),awaitAsync:N.identifier({text:`awaitAsync`}),checkAsync:N.identifier({text:`checkAsync`}),checkItemsAsync:N.identifier({text:`checkItemsAsync`}),customAsync:N.identifier({text:`customAsync`}),exactOptionalAsync:N.identifier({text:`exactOptionalAsync`}),fallbackAsync:N.identifier({text:`fallbackAsync`}),forwardAsync:N.identifier({text:`forwardAsync`}),getDefaultsAsync:N.identifier({text:`getDefaultsAsync`}),getFallbacksAsync:N.identifier({text:`getFallbacksAsync`}),intersectAsync:N.identifier({text:`intersectAsync`}),lazyAsync:N.identifier({text:`lazyAsync`}),looseObjectAsync:N.identifier({text:`looseObjectAsync`}),looseTupleAsync:N.identifier({text:`looseTupleAsync`}),mapAsync:N.identifier({text:`mapAsync`}),nonNullableAsync:N.identifier({text:`nonNullableAsync`}),nonNullishAsync:N.identifier({text:`nonNullishAsync`}),nonOptionalAsync:N.identifier({text:`nonOptionalAsync`}),nullableAsync:N.identifier({text:`nullableAsync`}),nullishAsync:N.identifier({text:`nullishAsync`}),objectAsync:N.identifier({text:`objectAsync`}),objectWithRestAsync:N.identifier({text:`objectWithRestAsync`}),optionalAsync:N.identifier({text:`optionalAsync`}),parseAsync:N.identifier({text:`parseAsync`}),parserAsync:N.identifier({text:`parserAsync`}),partialAsync:N.identifier({text:`partialAsync`}),partialCheckAsync:N.identifier({text:`partialCheckAsync`}),pipeAsync:N.identifier({text:`pipeAsync`}),rawCheckAsync:N.identifier({text:`rawCheckAsync`}),rawTransformAsync:N.identifier({text:`rawTransformAsync`}),recordAsync:N.identifier({text:`recordAsync`}),requiredAsync:N.identifier({text:`requiredAsync`}),returnsAsync:N.identifier({text:`returnsAsync`}),safeParseAsync:N.identifier({text:`safeParseAsync`}),safeParserAsync:N.identifier({text:`safeParserAsync`}),setAsync:N.identifier({text:`setAsync`}),strictObjectAsync:N.identifier({text:`strictObjectAsync`}),strictTupleAsync:N.identifier({text:`strictTupleAsync`}),transformAsync:N.identifier({text:`transformAsync`}),tupleAsync:N.identifier({text:`tupleAsync`}),tupleWithRestAsync:N.identifier({text:`tupleWithRestAsync`}),undefinedableAsync:N.identifier({text:`undefinedableAsync`}),unionAsync:N.identifier({text:`unionAsync`}),variantAsync:N.identifier({text:`variantAsync`})},methods:{assert:N.identifier({text:`assert`}),config:N.identifier({text:`config`}),fallback:N.identifier({text:`fallback`}),flatten:N.identifier({text:`flatten`}),forward:N.identifier({text:`forward`}),getDefault:N.identifier({text:`getDefault`}),getDefaults:N.identifier({text:`getDefaults`}),getDescription:N.identifier({text:`getDescription`}),getFallback:N.identifier({text:`getFallback`}),getFallbacks:N.identifier({text:`getFallbacks`}),getMetadata:N.identifier({text:`getMetadata`}),getTitle:N.identifier({text:`getTitle`}),is:N.identifier({text:`is`}),keyof:N.identifier({text:`keyof`}),message:N.identifier({text:`message`}),omit:N.identifier({text:`omit`}),parse:N.identifier({text:`parse`}),parser:N.identifier({text:`parser`}),partial:N.identifier({text:`partial`}),pick:N.identifier({text:`pick`}),pipe:N.identifier({text:`pipe`}),required:N.identifier({text:`required`}),safeParse:N.identifier({text:`safeParse`}),safeParser:N.identifier({text:`safeParser`}),summarize:N.identifier({text:`summarize`}),unwrap:N.identifier({text:`unwrap`})},schemas:{any:N.identifier({text:`any`}),array:N.identifier({text:`array`}),bigInt:N.identifier({text:`bigint`}),blob:N.identifier({text:`blob`}),boolean:N.identifier({text:`boolean`}),custom:N.identifier({text:`custom`}),date:N.identifier({text:`date`}),enum:N.identifier({text:`enum`}),exactOptional:N.identifier({text:`exactOptional`}),file:N.identifier({text:`file`}),function:N.identifier({text:`function`}),instance:N.identifier({text:`instance`}),intersect:N.identifier({text:`intersect`}),lazy:N.identifier({text:`lazy`}),literal:N.identifier({text:`literal`}),looseObject:N.identifier({text:`looseObject`}),looseTuple:N.identifier({text:`looseTuple`}),map:N.identifier({text:`map`}),nan:N.identifier({text:`nan`}),never:N.identifier({text:`never`}),nonNullable:N.identifier({text:`nonNullable`}),nonNullish:N.identifier({text:`nonNullish`}),nonOptional:N.identifier({text:`nonOptional`}),null:N.identifier({text:`null`}),nullable:N.identifier({text:`nullable`}),nullish:N.identifier({text:`nullish`}),number:N.identifier({text:`number`}),object:N.identifier({text:`object`}),objectWithRest:N.identifier({text:`objectWithRest`}),optional:N.identifier({text:`optional`}),picklist:N.identifier({text:`picklist`}),promise:N.identifier({text:`promise`}),record:N.identifier({text:`record`}),set:N.identifier({text:`set`}),strictObject:N.identifier({text:`strictObject`}),strictTuple:N.identifier({text:`strictTuple`}),string:N.identifier({text:`string`}),symbol:N.identifier({text:`symbol`}),tuple:N.identifier({text:`tuple`}),tupleWithRest:N.identifier({text:`tupleWithRest`}),undefined:N.identifier({text:`undefined`}),undefinedable:N.identifier({text:`undefinedable`}),union:N.identifier({text:`union`}),unknown:N.identifier({text:`unknown`}),variant:N.identifier({text:`variant`}),void:N.identifier({text:`void`})},storages:{},types:{GenericSchema:N.identifier({text:`GenericSchema`})},utils:{}};var ip=class{constructor(e){this.meta=e}createRequestValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`data`,e.id));if(!n)return;let r=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),i=`data`;return N.arrowFunction({async:!0,parameters:[{name:i}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:Z.async.parseAsync}),parameters:[N.identifier({text:n.placeholder}),N.identifier({text:i})]})})})]})}createResponseValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`responses`,e.id));if(!n)return;let r=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),i=`data`;return N.arrowFunction({async:!0,parameters:[{name:i}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:Z.async.parseAsync}),parameters:[N.identifier({text:n.placeholder}),N.identifier({text:i})]})})})]})}getSelector(...e){return[this.meta.name,...e]}};const ap=e=>{if(e.length>=2){if(e[0]===`components`){if(e[1]===`schemas`)return`schema`;if(e[1]===`parameters`)return`parameter`;if(e[1]===`requestBodies`)return`requestBody`}if(e[0]===`paths`)return`operation`;if(e[0]===`servers`)return`server`;if(e[0]===`webhooks`)return`webhook`}},op={int16:{max:32767,maxError:`Invalid value: Expected int16 to be <= 2^15-1`,min:-32768,minError:`Invalid value: Expected int16 to be >= -2^15`,needsBigInt:!1},int32:{max:2147483647,maxError:`Invalid value: Expected int32 to be <= 2^31-1`,min:-2147483648,minError:`Invalid value: Expected int32 to be >= -2^31`,needsBigInt:!1},int64:{max:`9223372036854775807`,maxError:`Invalid value: Expected int64 to be <= 2^63-1`,min:`-9223372036854775808`,minError:`Invalid value: Expected int64 to be >= -2^63`,needsBigInt:!0},int8:{max:127,maxError:`Invalid value: Expected int8 to be <= 2^7-1`,min:-128,minError:`Invalid value: Expected int8 to be >= -2^7`,needsBigInt:!1},uint16:{max:65535,maxError:`Invalid value: Expected uint16 to be <= 2^16-1`,min:0,minError:`Invalid value: Expected uint16 to be >= 0`,needsBigInt:!1},uint32:{max:4294967295,maxError:`Invalid value: Expected uint32 to be <= 2^32-1`,min:0,minError:`Invalid value: Expected uint32 to be >= 0`,needsBigInt:!1},uint64:{max:`18446744073709551615`,maxError:`Invalid value: Expected uint64 to be <= 2^64-1`,min:`0`,minError:`Invalid value: Expected uint64 to be >= 0`,needsBigInt:!0},uint8:{max:255,maxError:`Invalid value: Expected uint8 to be <= 2^8-1`,min:0,minError:`Invalid value: Expected uint8 to be >= 0`,needsBigInt:!1}},sp=e=>e!==void 0&&e in op,cp=e=>sp(e)&&op[e].needsBigInt,lp=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},up=({_path:e,operation:t,plugin:n,state:r})=>{if(n.config.requests.enabled){let i=new Set,a={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let r in t.parameters.header){let a=t.parameters.header[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`headers`))}Object.keys(e).length&&(a.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let r in t.parameters.path){let a=t.parameters.path[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`path`))}Object.keys(e).length&&(a.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let r in t.parameters.query){let a=t.parameters.query[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`query`))}Object.keys(e).length&&(a.properties.query={properties:e,required:n,type:`object`})}}t.body&&(a.properties.body=t.body.schema,t.body.required&&i.add(`body`)),a.required=[...i],Q({_path:e,plugin:n,schema:a,state:r,symbol:n.registerSymbol({exported:!0,meta:{resourceType:ap(e)},name:E({config:n.config.requests,name:t.id}),selector:n.api.getSelector(`data`,t.id)})})}if(n.config.responses.enabled&&t.responses){let{response:i}=Kn(t);if(i){let a=[...e,`responses`];Q({_path:a,plugin:n,schema:i,state:r,symbol:n.registerSymbol({exported:!0,meta:{resourceType:ap(a)},name:E({config:n.config.responses,name:t.id}),selector:n.api.getSelector(`responses`,t.id)})})}}},dp=({_path:e,operation:t,plugin:n,state:r})=>{if(n.config.webhooks.enabled){let i=new Set,a={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let r in t.parameters.header){let a=t.parameters.header[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`headers`))}Object.keys(e).length&&(a.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let r in t.parameters.path){let a=t.parameters.path[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`path`))}Object.keys(e).length&&(a.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let r in t.parameters.query){let a=t.parameters.query[r];e[a.name]=a.schema,a.required&&(n.push(a.name),i.add(`query`))}Object.keys(e).length&&(a.properties.query={properties:e,required:n,type:`object`})}}t.body&&(a.properties.body=t.body.schema,t.body.required&&i.add(`body`)),a.required=[...i],Q({_path:e,plugin:n,schema:a,state:r,symbol:n.registerSymbol({exported:!0,meta:{resourceType:ap(e)},name:E({config:n.config.webhooks,name:t.id}),selector:n.api.getSelector(`webhook-request`,t.id)})})}},fp=({pipes:e,plugin:t})=>{if(e.length===1)return e[0];let n=t.referenceSymbol(t.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.methods.pipe}),parameters:e})},pp=({_path:e,plugin:t,schema:n,state:r})=>{let i=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),a=N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.array}),o=[];if(n.items){n=P({schema:n});let i=n.items.map((n,i)=>fp({pipes:Q({_path:[...e,`items`,i],plugin:t,schema:n,state:r}),plugin:t}));if(i.length===1){let e=N.callExpression({functionName:a,parameters:i});o.push(e)}else{n.logicalOperator;let r=N.callExpression({functionName:a,parameters:[Cp({_path:e,plugin:t,schema:{type:`unknown`}})]});o.push(r)}}else{let n=N.callExpression({functionName:a,parameters:[Cp({_path:e,plugin:t,schema:{type:`unknown`}})]});o.push(n)}if(n.minItems===n.maxItems&&n.minItems!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.actions.length}),parameters:[N.valueToExpression({value:n.minItems})]});o.push(e)}else{if(n.minItems!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.actions.minLength}),parameters:[N.valueToExpression({value:n.minItems})]});o.push(e)}if(n.maxItems!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.actions.maxLength}),parameters:[N.valueToExpression({value:n.maxItems})]});o.push(e)}}return fp({pipes:o,plugin:t})},mp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return typeof t.const==`boolean`?N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.literal}),parameters:[N.ots.boolean(t.const)]}):N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.boolean})})},hp=({_path:e,plugin:t,schema:n})=>{let r=[],i=!1;for(let e of n.items??[])e.type===`string`&&typeof e.const==`string`?r.push(N.stringLiteral({text:e.const})):(e.type===`null`||e.const===null)&&(i=!0);if(!r.length)return Cp({_path:e,plugin:t,schema:{type:`unknown`}});let a=t.referenceSymbol(t.api.getSelector(`import`,`valibot`)),o=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:Z.schemas.picklist}),parameters:[N.arrayLiteralExpression({elements:r,multiLine:!1})]});return i&&(o=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:Z.schemas.nullable}),parameters:[o]})),o},gp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.never})})},_p=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.null})})},vp=({plugin:e,schema:t})=>{let n=t.format,r=t.type===`integer`,i=cp(n),a=sp(n)?op[n]:null,o=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));if(t.const!==void 0&&t.const!==null){let e=t.const,r;if(typeof e==`number`&&!n)r=N.ots.number(e);else if(typeof e==`number`&&n)r=i?N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(e.toString())]}):N.ots.number(e);else if(typeof e==`string`&&i){let t=e.endsWith(`n`)?e.slice(0,-1):e;r=N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(t)]})}else if(typeof e==`bigint`){let t=e.toString(),n=t.endsWith(`n`)?t.slice(0,-1):t;r=N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(n)]})}else r=N.valueToExpression({value:e});return N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.literal}),parameters:[r]})}let s=[];if(i){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.union}),parameters:[N.arrayLiteralExpression({elements:[N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.number})}),N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.string})}),N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.bigInt})})],multiLine:!1})]});s.push(e);let t=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.transform}),parameters:[N.arrowFunction({parameters:[{name:`x`}],statements:N.callExpression({functionName:`BigInt`,parameters:[N.identifier({text:`x`})]})})]});s.push(t)}else{let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.number})});s.push(e)}if(!i&&r){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.integer})});s.push(e)}if(a){let e=a.min,t=a.max,n=a.minError,r=a.maxError,c=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.minValue}),parameters:[i?N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(e.toString())]}):N.ots.number(e),N.ots.string(n)]});s.push(c);let l=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.maxValue}),parameters:[i?N.callExpression({functionName:`BigInt`,parameters:[N.ots.string(t.toString())]}):N.ots.number(t),N.ots.string(r)]});s.push(l)}if(t.exclusiveMinimum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.gtValue}),parameters:[lp({isBigInt:i,value:t.exclusiveMinimum})]});s.push(e)}else if(t.minimum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.minValue}),parameters:[lp({isBigInt:i,value:t.minimum})]});s.push(e)}if(t.exclusiveMaximum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.ltValue}),parameters:[lp({isBigInt:i,value:t.exclusiveMaximum})]});s.push(e)}else if(t.maximum!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.actions.maxValue}),parameters:[lp({isBigInt:i,value:t.maximum})]});s.push(e)}return fp({pipes:s,plugin:e})},yp=({_path:e,plugin:t,schema:n,state:r})=>{let i=[],a=n.required??[];for(let o in n.properties){let s=n.properties[o],c=a.includes(o),l=Q({_path:[...e,`properties`,o],optional:!c,plugin:t,schema:s,state:r});D.lastIndex=0;let u;u=D.test(o)?o.startsWith(`-`)?p.default.factory.createStringLiteral(o):p.default.factory.createNumericLiteral(o):o,(o.match(/^[0-9]/)&&o.match(/\D+/g)||o.match(/\W/g))&&!o.startsWith(`'`)&&!o.endsWith(`'`)&&(u=`'${o}'`),i.push(N.propertyAssignment({initializer:fp({pipes:l,plugin:t}),name:u}))}let o=t.referenceSymbol(t.api.getSelector(`import`,`valibot`));if(n.additionalProperties&&n.additionalProperties.type===`object`&&!Object.keys(i).length){let i=Q({_path:[...e,`additionalProperties`],plugin:t,schema:n.additionalProperties,state:r});return{anyType:`AnyZodObject`,expression:N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.record}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.string}),parameters:[]}),fp({pipes:i,plugin:t})]})}}let s=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:Z.schemas.object}),parameters:[p.default.factory.createObjectLiteralExpression(i,!0)]});return{anyType:Z.types.GenericSchema.text,expression:s}},bp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));if(typeof t.const==`string`)return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.literal}),parameters:[N.ots.string(t.const)]});let r=[],i=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.schemas.string})});if(r.push(i),t.format)switch(t.format){case`date`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.isoDate})}));break;case`date-time`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.isoTimestamp})}));break;case`ipv4`:case`ipv6`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.ip})}));break;case`uri`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.url})}));break;case`email`:case`time`:case`uuid`:r.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:N.identifier({text:t.format})})}));break}if(t.minLength===t.maxLength&&t.minLength!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.length}),parameters:[N.valueToExpression({value:t.minLength})]});r.push(e)}else{if(t.minLength!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.minLength}),parameters:[N.valueToExpression({value:t.minLength})]});r.push(e)}if(t.maxLength!==void 0){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.maxLength}),parameters:[N.valueToExpression({value:t.maxLength})]});r.push(e)}}if(t.pattern){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:Z.actions.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]});r.push(e)}return fp({pipes:r,plugin:e})},xp=({_path:e,plugin:t,schema:n,state:r})=>{let i=t.referenceSymbol(t.api.getSelector(`import`,`valibot`));if(n.const&&Array.isArray(n.const)){let e=n.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.literal}),parameters:[N.valueToExpression({value:e})]}));return N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]})}if(n.items){let a=n.items.map((n,i)=>fp({pipes:Q({_path:[...e,`items`,i],plugin:t,schema:n,state:r}),plugin:t}));return N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:Z.schemas.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]})}return Cp({_path:e,plugin:t,schema:{type:`unknown`}})},Sp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.undefined})})},Cp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.unknown})})},wp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`valibot`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:Z.schemas.void})})},Tp=({_path:e,plugin:t,schema:n,state:r})=>{switch(n.type){case`array`:return{expression:pp({_path:e,plugin:t,schema:n,state:r})};case`boolean`:return{expression:mp({_path:e,plugin:t,schema:n})};case`enum`:return{expression:hp({_path:e,plugin:t,schema:n})};case`integer`:case`number`:return{expression:vp({_path:e,plugin:t,schema:n})};case`never`:return{expression:gp({_path:e,plugin:t,schema:n})};case`null`:return{expression:_p({_path:e,plugin:t,schema:n})};case`object`:return yp({_path:e,plugin:t,schema:n,state:r});case`string`:return n.format===`int64`||n.format===`uint64`?{expression:vp({_path:e,plugin:t,schema:n})}:{expression:bp({_path:e,plugin:t,schema:n})};case`tuple`:return{expression:xp({_path:e,plugin:t,schema:n,state:r})};case`undefined`:return{expression:Sp({_path:e,plugin:t,schema:n})};case`unknown`:return{expression:Cp({_path:e,plugin:t,schema:n})};case`void`:return{expression:wp({_path:e,plugin:t,schema:n})}}},Q=({$ref:e,_path:t=[],optional:n,plugin:r,schema:i,state:a,symbol:o})=>{let s,c=[];if(e&&(a.circularReferenceTracker.add(e),!o)){let t=r.api.getSelector(`ref`,e);r.getSymbol(t)||(o=r.referenceSymbol(t))}let l=r.referenceSymbol(r.api.getSelector(`import`,`valibot`));if(i.$ref){let e=a.circularReferenceTracker.has(i.$ref),t=r.api.getSelector(`ref`,i.$ref),n=r.getSymbol(t);if(!n){let e=r.context.resolveIrRef(i.$ref),o=Q({$ref:i.$ref,_path:ar(i.$ref),plugin:r,schema:e,state:a});c.push(...o),n=r.getSymbol(t)}if(n){let t=N.identifier({text:n.placeholder});if(e){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:t})]})]});c.push(e),a.hasCircularReference=!0}else c.push(t)}}else if(i.type){let e=Tp({_path:t,plugin:r,schema:i,state:a});if(s=e.anyType,c.push(e.expression),r.config.metadata&&i.description){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.actions.metadata}),parameters:[N.objectExpression({obj:[{key:`description`,value:N.stringLiteral({text:i.description})}]})]});c.push(e)}}else if(i.items)if(i=P({schema:i}),i.items){let e=i.items.map((e,n)=>fp({pipes:Q({_path:[...t,`items`,n],plugin:r,schema:e,state:a}),plugin:r}));if(i.logicalOperator===`and`){let t=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.intersect}),parameters:[N.arrayLiteralExpression({elements:e})]});c.push(t)}else{let t=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.union}),parameters:[N.arrayLiteralExpression({elements:e})]});c.push(t)}}else{let e=Q({_path:t,plugin:r,schema:i,state:a});c.push(...e)}else{let e=Tp({_path:t,plugin:r,schema:{type:`unknown`},state:a});s=e.anyType,c.push(e.expression)}if(e&&a.circularReferenceTracker.delete(e),c.length&&i.accessScope===`read`){let e=N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.actions.readonly})});c.push(e)}if(c.length){let e;i.default!==void 0&&(e=lp({isBigInt:i.type===`integer`&&i.format===`int64`,value:i.default}),e&&(c=[N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.optional}),parameters:[fp({pipes:c,plugin:r}),e]})])),n&&!e&&(c=[N.callExpression({functionName:N.propertyAccessExpression({expression:l.placeholder,name:Z.schemas.optional}),parameters:[fp({pipes:c,plugin:r})]})])}if(o){e&&(o=r.registerSymbol({exported:!0,meta:{resourceType:ap(t)},name:E({config:{case:a.nameCase,name:a.nameTransformer},name:L(e)}),selector:r.api.getSelector(`ref`,e)}));let n=N.constVariable({comment:r.config.comments?cd({schema:i}):void 0,exportConst:o.exported,expression:fp({pipes:c,plugin:r}),name:o.placeholder,typeName:a.hasCircularReference?N.propertyAccessExpression({expression:l.placeholder,name:s||Z.types.GenericSchema.text}):void 0});return r.setSymbolValue(o,n),[]}return c},Ep=({plugin:e})=>{e.registerSymbol({external:`valibot`,meta:{importKind:`namespace`},name:`v`,selector:e.api.getSelector(`import`,`valibot`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{let n={circularReferenceTracker:new Set,hasCircularReference:!1,nameCase:e.config.definitions.case,nameTransformer:e.config.definitions.name};switch(t.type){case`operation`:up({_path:t._path,operation:t.operation,plugin:e,state:n});break;case`parameter`:Q({$ref:t.$ref,_path:t._path,plugin:e,schema:t.parameter.schema,state:n});break;case`requestBody`:Q({$ref:t.$ref,_path:t._path,plugin:e,schema:t.requestBody.schema,state:n});break;case`schema`:Q({$ref:t.$ref,_path:t._path,plugin:e,schema:t.schema,state:n});break;case`webhook`:dp({_path:t._path,operation:t.operation,plugin:e,state:n});break}})},Dp={api:new ip({name:`valibot`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1,metadata:!1},handler:Ep,name:`valibot`,resolveConfig:(e,t)=>{e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.definitions}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}Data`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}Response`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`v{{name}}WebhookRequest`},mappers:{boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})},value:e.config.webhooks})},tags:[`validator`]},Op=w(Dp),$={ZodMiniOptional:N.identifier({text:`ZodMiniOptional`}),ZodOptional:N.identifier({text:`ZodOptional`}),_default:N.identifier({text:`_default`}),and:N.identifier({text:`and`}),array:N.identifier({text:`array`}),bigint:N.identifier({text:`bigint`}),boolean:N.identifier({text:`boolean`}),check:N.identifier({text:`check`}),coerce:N.identifier({text:`coerce`}),date:N.identifier({text:`date`}),datetime:N.identifier({text:`datetime`}),default:N.identifier({text:`default`}),describe:N.identifier({text:`describe`}),email:N.identifier({text:`email`}),enum:N.identifier({text:`enum`}),globalRegistry:N.identifier({text:`globalRegistry`}),gt:N.identifier({text:`gt`}),gte:N.identifier({text:`gte`}),infer:N.identifier({text:`infer`}),int:N.identifier({text:`int`}),intersection:N.identifier({text:`intersection`}),ip:N.identifier({text:`ip`}),ipv4:N.identifier({text:`ipv4`}),ipv6:N.identifier({text:`ipv6`}),iso:N.identifier({text:`iso`}),lazy:N.identifier({text:`lazy`}),length:N.identifier({text:`length`}),literal:N.identifier({text:`literal`}),lt:N.identifier({text:`lt`}),lte:N.identifier({text:`lte`}),max:N.identifier({text:`max`}),maxLength:N.identifier({text:`maxLength`}),min:N.identifier({text:`min`}),minLength:N.identifier({text:`minLength`}),never:N.identifier({text:`never`}),null:N.identifier({text:`null`}),nullable:N.identifier({text:`nullable`}),number:N.identifier({text:`number`}),object:N.identifier({text:`object`}),optional:N.identifier({text:`optional`}),parseAsync:N.identifier({text:`parseAsync`}),readonly:N.identifier({text:`readonly`}),record:N.identifier({text:`record`}),regex:N.identifier({text:`regex`}),register:N.identifier({text:`register`}),string:N.identifier({text:`string`}),time:N.identifier({text:`time`}),tuple:N.identifier({text:`tuple`}),undefined:N.identifier({text:`undefined`}),union:N.identifier({text:`union`}),unknown:N.identifier({text:`unknown`}),url:N.identifier({text:`url`}),uuid:N.identifier({text:`uuid`}),void:N.identifier({text:`void`})};var kp=class{constructor(e){this.meta=e}createRequestValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`data`,e.id));if(!n)return;let r=`data`;return N.arrowFunction({async:!0,parameters:[{name:r}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.parseAsync}),parameters:[N.identifier({text:r})]})})})]})}createResponseValidator({operation:e,plugin:t}){let n=t.getSymbol(t.api.getSelector(`responses`,e.id));if(!n)return;let r=`data`;return N.arrowFunction({async:!0,parameters:[{name:r}],statements:[N.returnStatement({expression:N.awaitExpression({expression:N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.parseAsync}),parameters:[N.identifier({text:r})]})})})]})}getSelector(...e){return[this.meta.name,...e]}};const Ap=({plugin:e,schema:t,symbol:n,typeInferSymbol:r,zodSchema:i})=>{let a=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),o=N.constVariable({comment:e.config.comments?cd({schema:t}):void 0,exportConst:n.exported,expression:i.expression,name:n.placeholder,typeName:i.typeName?N.propertyAccessExpression({expression:a.placeholder,name:i.typeName}):void 0});if(e.setSymbolValue(n,o),r){let t=N.typeAliasDeclaration({exportType:r.exported,name:r.placeholder,type:N.typeReferenceNode({typeArguments:[N.typeOfExpression({text:n.placeholder})],typeName:N.propertyAccessExpression({expression:a.placeholder,name:$.infer})})});e.setSymbolValue(r,t)}},jp=({plugin:e})=>{let t=e.package.getVersion(`zod`);if(t&&e.package.satisfies(t,`<4.0.0`))switch(e.config.compatibilityVersion){case 3:default:return`zod`;case 4:return`zod/v4`;case`mini`:return`zod/v4-mini`}switch(e.config.compatibilityVersion){case 3:return`zod/v3`;case 4:default:return`zod`;case`mini`:return`zod/mini`}},Mp=({getZodSchema:e,operation:t,plugin:n})=>{if(n.config.requests.enabled){let r=new Set,i={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let i in t.parameters.header){let a=t.parameters.header[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`headers`))}Object.keys(e).length&&(i.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let i in t.parameters.path){let a=t.parameters.path[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`path`))}Object.keys(e).length&&(i.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let i in t.parameters.query){let a=t.parameters.query[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`query`))}Object.keys(e).length&&(i.properties.query={properties:e,required:n,type:`object`})}}t.body&&(i.properties.body=t.body.schema,t.body.required&&r.add(`body`)),i.required=[...r];let a=e(i);Ap({plugin:n,schema:i,symbol:n.registerSymbol({exported:!0,name:E({config:n.config.requests,name:t.id}),selector:n.api.getSelector(`data`,t.id)}),typeInferSymbol:n.config.requests.types.infer.enabled?n.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:n.config.requests.types.infer,name:t.id}),selector:n.api.getSelector(`type-infer-data`,t.id)}):void 0,zodSchema:a})}if(n.config.responses.enabled&&t.responses){let{response:r}=Kn(t);if(r){let i=e(r);Ap({plugin:n,schema:r,symbol:n.registerSymbol({exported:!0,name:E({config:n.config.responses,name:t.id}),selector:n.api.getSelector(`responses`,t.id)}),typeInferSymbol:n.config.responses.types.infer.enabled?n.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:n.config.responses.types.infer,name:t.id}),selector:n.api.getSelector(`type-infer-responses`,t.id)}):void 0,zodSchema:i})}}},Np=({getZodSchema:e,operation:t,plugin:n})=>{if(n.config.webhooks.enabled){let r=new Set,i={properties:{body:{type:`never`},path:{type:`never`},query:{type:`never`}},type:`object`};if(t.parameters){if(t.parameters.header){let e={},n=[];for(let i in t.parameters.header){let a=t.parameters.header[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`headers`))}Object.keys(e).length&&(i.properties.headers={properties:e,required:n,type:`object`})}if(t.parameters.path){let e={},n=[];for(let i in t.parameters.path){let a=t.parameters.path[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`path`))}Object.keys(e).length&&(i.properties.path={properties:e,required:n,type:`object`})}if(t.parameters.query){let e={},n=[];for(let i in t.parameters.query){let a=t.parameters.query[i];e[a.name]=a.schema,a.required&&(n.push(a.name),r.add(`query`))}Object.keys(e).length&&(i.properties.query={properties:e,required:n,type:`object`})}}t.body&&(i.properties.body=t.body.schema,t.body.required&&r.add(`body`)),i.required=[...r];let a=e(i);Ap({plugin:n,schema:i,symbol:n.registerSymbol({exported:!0,name:E({config:n.config.webhooks,name:t.id}),selector:n.api.getSelector(`webhook-request`,t.id)}),typeInferSymbol:n.config.webhooks.types.infer.enabled?n.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:n.config.webhooks.types.infer,name:t.id}),selector:n.api.getSelector(`type-infer-webhook-request`,t.id)}):void 0,zodSchema:a})}},Pp=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i={},a=N.propertyAccessExpression({expression:r.placeholder,name:$.array});if(!t.items)i.expression=N.callExpression({functionName:a,parameters:[Gp({plugin:e,schema:{type:`unknown`}}).expression]});else{t=P({schema:t});let o=t.items.map(t=>{let r=Jp({plugin:e,schema:t,state:n});return r.hasCircularReference&&(i.hasCircularReference=!0),r.expression});if(o.length===1)i.expression=N.callExpression({functionName:a,parameters:o});else if(t.logicalOperator===`and`){let e=t.items[0],n;if(e.logicalOperator===`or`||e.type&&e.type!==`object`)n=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.intersection}),parameters:o});else{n=o[0];for(let e=1;e<o.length;e++)n=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.intersection}),parameters:[n,o[e]]})}i.expression=N.callExpression({functionName:a,parameters:[n]})}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.array}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:o})]})]})}let o=[];return t.minItems===t.maxItems&&t.minItems!==void 0?o.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.length}),parameters:[N.valueToExpression({value:t.minItems})]})):(t.minItems!==void 0&&o.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.minLength}),parameters:[N.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&o.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.maxLength}),parameters:[N.valueToExpression({value:t.maxItems})]}))),o.length&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.check}),parameters:o})),i},Fp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={};return typeof t.const==`boolean`?(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.boolean(t.const)]}),r):(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.boolean})}),r)},Ip=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={},i=[],a=[],o=!1,s=!0;for(let e of t.items??[])if(e.type===`string`&&typeof e.const==`string`){let t=N.stringLiteral({text:e.const});i.push(t),a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if((e.type===`number`||e.type===`integer`)&&typeof e.const==`number`){s=!1;let t=N.ots.number(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if(e.type===`boolean`&&typeof e.const==`boolean`){s=!1;let t=N.ots.boolean(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else (e.type===`null`||e.const===null)&&(o=!0);return a.length?(s&&i.length>0?r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.enum}),parameters:[N.arrayLiteralExpression({elements:i,multiLine:!1})]}):a.length===1?r.expression=a[0]:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:a,multiLine:a.length>3})]}),o&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.nullable}),parameters:[r.expression]})),r):Gp({plugin:e,schema:{type:`unknown`}})},Lp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.never})}),n},Rp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.null})}),n},zp=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},Bp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={},i=t.type===`integer`&&t.format===`int64`;if(typeof t.const==`number`)return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.number(t.const)]}),r;r.expression=N.callExpression({functionName:i?N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.coerce}),name:$.bigint}):N.propertyAccessExpression({expression:n.placeholder,name:$.number})}),!i&&t.type===`integer`&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.int})}));let a=[];return t.exclusiveMinimum===void 0?t.minimum!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.gte}),parameters:[zp({isBigInt:i,value:t.minimum})]})):a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.gt}),parameters:[zp({isBigInt:i,value:t.exclusiveMinimum})]})),t.exclusiveMaximum===void 0?t.maximum!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.lte}),parameters:[zp({isBigInt:i,value:t.maximum})]})):a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.lt}),parameters:[zp({isBigInt:i,value:t.exclusiveMaximum})]})),a.length&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.check}),parameters:a})),r},Vp=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i={},a=[],o=t.required??[];for(let s in t.properties){let c=t.properties[s],l=Jp({optional:!o.includes(s),plugin:e,schema:c,state:n});l.hasCircularReference&&(i.hasCircularReference=!0),D.lastIndex=0;let u;u=D.test(s)?s.startsWith(`-`)?p.default.factory.createStringLiteral(s):p.default.factory.createNumericLiteral(s):s,(s.match(/^[0-9]/)&&s.match(/\D+/g)||s.match(/\W/g))&&!s.startsWith(`'`)&&!s.endsWith(`'`)&&(u=`'${s}'`),l.hasCircularReference?a.push(N.getAccessorDeclaration({name:u,returnType:l.typeName?N.propertyAccessExpression({expression:r.placeholder,name:l.typeName}):void 0,statements:[N.returnStatement({expression:l.expression})]})):a.push(N.propertyAssignment({initializer:l.expression,name:u}))}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let a=Jp({plugin:e,schema:t.additionalProperties,state:n});return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.record}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.string}),parameters:[]}),a.expression]}),a.hasCircularReference&&(i.hasCircularReference=!0),i}return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.object}),parameters:[p.default.factory.createObjectLiteralExpression(a,!0)]}),i},Hp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r={};if(typeof t.const==`string`)return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.string(t.const)]}),r;r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.string})});let i=[];if(e.config.dates.offset&&i.push({key:`offset`,value:!0}),e.config.dates.local&&i.push({key:`local`,value:!0}),t.format)switch(t.format){case`date`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.iso}),name:$.date})});break;case`date-time`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.iso}),name:$.datetime}),parameters:i.length>0?[N.objectExpression({obj:i})]:[]});break;case`email`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.email})});break;case`ipv4`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.ipv4})});break;case`ipv6`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.ipv6})});break;case`time`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.iso}),name:$.time})});break;case`uri`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.url})});break;case`uuid`:r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.uuid})});break}let a=[];return t.minLength===t.maxLength&&t.minLength!==void 0?a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.length}),parameters:[N.valueToExpression({value:t.minLength})]})):(t.minLength!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.minLength}),parameters:[N.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.maxLength}),parameters:[N.valueToExpression({value:t.maxLength})]}))),t.pattern&&a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]})),a.length&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.check}),parameters:a})),r},Up=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i={};if(t.const&&Array.isArray(t.const)){let e=t.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.valueToExpression({value:e})]}));return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]}),i}let a=[];for(let r of t.items??[]){let t=Jp({plugin:e,schema:r,state:n});a.push(t.expression),t.hasCircularReference&&(i.hasCircularReference=!0)}return i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]}),i},Wp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.undefined})}),n},Gp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.unknown})}),n},Kp=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),n={};return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.void})}),n},qp=({plugin:e,schema:t,state:n})=>{switch(t.type){case`array`:return Pp({plugin:e,schema:t,state:n});case`boolean`:return Fp({plugin:e,schema:t});case`enum`:return Ip({plugin:e,schema:t});case`integer`:case`number`:return Bp({plugin:e,schema:t});case`never`:return Lp({plugin:e,schema:t});case`null`:return Rp({plugin:e,schema:t});case`object`:return Vp({plugin:e,schema:t,state:n});case`string`:return Hp({plugin:e,schema:t});case`tuple`:return Up({plugin:e,schema:t,state:n});case`undefined`:return Wp({plugin:e,schema:t});case`unknown`:return Gp({plugin:e,schema:t});case`void`:return Kp({plugin:e,schema:t})}},Jp=({optional:e,plugin:t,schema:n,state:r})=>{let i={},a=t.referenceSymbol(t.api.getSelector(`import`,`zod`));if(n.$ref){let e=r.circularReferenceTracker.includes(n.$ref),o=r.currentReferenceTracker.includes(n.$ref);r.circularReferenceTracker.push(n.$ref),r.currentReferenceTracker.push(n.$ref);let s=t.api.getSelector(`ref`,n.$ref),c=t.getSymbol(s);if(e)c||=t.referenceSymbol(s),o?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({returnType:N.keywordTypeNode({keyword:`any`}),statements:[N.returnStatement({expression:N.identifier({text:c.placeholder})})]})]}):i.expression=N.identifier({text:c.placeholder}),i.hasCircularReference=n.circular;else{if(c)i.hasCircularReference=n.circular;else{let e=t.context.resolveIrRef(n.$ref);Yp({id:n.$ref,plugin:t,schema:e,state:r})}let e=t.referenceSymbol(s);i.expression=N.identifier({text:e.placeholder})}r.circularReferenceTracker.pop(),r.currentReferenceTracker.pop()}else if(n.type){let e=qp({plugin:t,schema:n,state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,t.config.metadata&&n.description&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.register}),parameters:[N.propertyAccessExpression({expression:a.placeholder,name:$.globalRegistry}),N.objectExpression({obj:[{key:`description`,value:N.stringLiteral({text:n.description})}]})]}))}else if(n.items)if(n=P({schema:n}),n.items){let e=n.items.map(e=>Jp({plugin:t,schema:e,state:r}));if(n.logicalOperator===`and`){let t=n.items[0];t.logicalOperator===`or`||t.type&&t.type!==`object`?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:e.map(e=>e.expression)}):(i.expression=e[0].expression,e.slice(1).forEach(e=>{i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:[i.expression,e.hasCircularReference?N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:e.expression})]})]}):e.expression]})}))}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:e.map(e=>e.expression)})]})}else i=Jp({plugin:t,schema:n,state:r});else i.expression=qp({plugin:t,schema:{type:`unknown`},state:r}).expression;if(i.expression&&(n.accessScope===`read`&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.readonly}),parameters:[i.expression]})),e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.optional}),parameters:[i.expression]}),i.typeName=$.ZodMiniOptional),n.default!==void 0)){let e=zp({isBigInt:n.type===`integer`&&n.format===`int64`,value:n.default});e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$._default}),parameters:[i.expression,e]}))}return i},Yp=({id:e,plugin:t,schema:n,state:r})=>{let i={circularReferenceTracker:[e],hasCircularReference:!1,...r,currentReferenceTracker:[e]},a=t.api.getSelector(`ref`,e),o=t.getSymbol(a);if(o&&!t.getSymbolValue(o))return;let s=Jp({plugin:t,schema:n,state:i}),c=L(e);o=t.registerSymbol({exported:!0,name:E({config:t.config.definitions,name:c}),selector:a});let l=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.definitions.types.infer,name:c}),selector:t.api.getSelector(`type-infer-ref`,e)}):void 0;Ap({plugin:t,schema:n,symbol:o,typeInferSymbol:l,zodSchema:s})},Xp=({plugin:e})=>{e.registerSymbol({external:jp({plugin:e}),meta:{importKind:`namespace`},name:`z`,selector:e.api.getSelector(`import`,`zod`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{switch(t.type){case`operation`:Mp({getZodSchema:t=>Jp({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break;case`parameter`:Yp({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:Yp({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:Yp({id:t.$ref,plugin:e,schema:t.schema});break;case`webhook`:Np({getZodSchema:t=>Jp({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break}})},Zp=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=N.propertyAccessExpression({expression:r.placeholder,name:$.array}),a,o=!1;if(!t.items)a=N.callExpression({functionName:i,parameters:[cm({plugin:e,schema:{type:`unknown`}})]});else{t=P({schema:t});let s=t.items.map(t=>{let r=dm({plugin:e,schema:t,state:n});return r.hasCircularReference&&(o=!0),r.expression});if(s.length===1)a=N.callExpression({functionName:i,parameters:s});else if(t.logicalOperator===`and`){let e=t.items[0],n;if(e.logicalOperator===`or`||e.type&&e.type!==`object`)n=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.intersection}),parameters:s});else{n=s[0];for(let e=1;e<s.length;e++)n=N.callExpression({functionName:N.propertyAccessExpression({expression:n,name:$.and}),parameters:[s[e]]})}a=N.callExpression({functionName:i,parameters:[n]})}else a=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.array}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:s})]})]})}return t.minItems===t.maxItems&&t.minItems!==void 0?a=N.callExpression({functionName:N.propertyAccessExpression({expression:a,name:$.length}),parameters:[N.valueToExpression({value:t.minItems})]}):(t.minItems!==void 0&&(a=N.callExpression({functionName:N.propertyAccessExpression({expression:a,name:$.min}),parameters:[N.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&(a=N.callExpression({functionName:N.propertyAccessExpression({expression:a,name:$.max}),parameters:[N.valueToExpression({value:t.maxItems})]}))),{expression:a,hasCircularReference:o}},Qp=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return typeof t.const==`boolean`?N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.boolean(t.const)]}):N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.boolean})})},$p=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r=[],i=[],a=!1,o=!0;for(let e of t.items??[])if(e.type===`string`&&typeof e.const==`string`){let t=N.stringLiteral({text:e.const});r.push(t),i.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if((e.type===`number`||e.type===`integer`)&&typeof e.const==`number`){o=!1;let t=N.ots.number(e.const);i.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else if(e.type===`boolean`&&typeof e.const==`boolean`){o=!1;let t=N.ots.boolean(e.const);i.push(N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[t]}))}else (e.type===`null`||e.const===null)&&(a=!0);if(!i.length)return cm({plugin:e,schema:{type:`unknown`}});let s;return s=o&&r.length>0?N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.enum}),parameters:[N.arrayLiteralExpression({elements:r,multiLine:!1})]}):i.length===1?i[0]:N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:i,multiLine:i.length>3})]}),a&&(s=N.callExpression({functionName:N.propertyAccessExpression({expression:s,name:$.nullable})})),s},em=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.never})})},tm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.null})})},nm=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},rm=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),r=t.type===`integer`&&t.format===`int64`;if(typeof t.const==`number`)return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.number(t.const)]});let i=N.callExpression({functionName:r?N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:n.placeholder,name:$.coerce}),name:$.bigint}):N.propertyAccessExpression({expression:n.placeholder,name:$.number})});return!r&&t.type===`integer`&&(i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.int})})),t.exclusiveMinimum===void 0?t.minimum!==void 0&&(i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.gte}),parameters:[nm({isBigInt:r,value:t.minimum})]})):i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.gt}),parameters:[nm({isBigInt:r,value:t.exclusiveMinimum})]}),t.exclusiveMaximum===void 0?t.maximum!==void 0&&(i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.lte}),parameters:[nm({isBigInt:r,value:t.maximum})]})):i=N.callExpression({functionName:N.propertyAccessExpression({expression:i,name:$.lt}),parameters:[nm({isBigInt:r,value:t.exclusiveMaximum})]}),i},im=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=!1,a=[],o=t.required??[];for(let r in t.properties){let s=t.properties[r],c=dm({optional:!o.includes(r),plugin:e,schema:s,state:n});c.hasCircularReference&&(i=!0),D.lastIndex=0;let l;l=D.test(r)?r.startsWith(`-`)?p.default.factory.createStringLiteral(r):p.default.factory.createNumericLiteral(r):r,(r.match(/^[0-9]/)&&r.match(/\D+/g)||r.match(/\W/g))&&!r.startsWith(`'`)&&!r.endsWith(`'`)&&(l=`'${r}'`),a.push(N.propertyAssignment({initializer:c.expression,name:l}))}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let i=dm({plugin:e,schema:t.additionalProperties,state:n});return{anyType:`AnyZodObject`,expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.record}),parameters:[i.expression]}),hasCircularReference:i.hasCircularReference}}return{anyType:`AnyZodObject`,expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.object}),parameters:[p.default.factory.createObjectLiteralExpression(a,!0)]}),hasCircularReference:i}},am=({plugin:e,schema:t})=>{let n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));if(typeof t.const==`string`)return N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.literal}),parameters:[N.ots.string(t.const)]});let r=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.string})}),i=[];if(e.config.dates.offset&&i.push({key:`offset`,value:!0}),e.config.dates.local&&i.push({key:`local`,value:!0}),t.format)switch(t.format){case`date`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.date})});break;case`date-time`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.datetime}),parameters:i.length>0?[N.objectExpression({obj:i})]:[]});break;case`email`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.email})});break;case`ipv4`:case`ipv6`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.ip})});break;case`time`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.time})});break;case`uri`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.url})});break;case`uuid`:r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.uuid})});break}return t.minLength===t.maxLength&&t.minLength!==void 0?r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.length}),parameters:[N.valueToExpression({value:t.minLength})]}):(t.minLength!==void 0&&(r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.min}),parameters:[N.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&(r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.max}),parameters:[N.valueToExpression({value:t.maxLength})]}))),t.pattern&&(r=N.callExpression({functionName:N.propertyAccessExpression({expression:r,name:$.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]})),r},om=({plugin:e,schema:t,state:n})=>{let r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=!1;if(t.const&&Array.isArray(t.const)){let e=t.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.valueToExpression({value:e})]}));return{expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]}),hasCircularReference:i}}let a=[];for(let r of t.items??[]){let t=dm({plugin:e,schema:r,state:n});t.hasCircularReference&&(i=!0),a.push(t.expression)}return{expression:N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]}),hasCircularReference:i}},sm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.undefined})})},cm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.unknown})})},lm=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return N.callExpression({functionName:N.propertyAccessExpression({expression:t.placeholder,name:$.void})})},um=({plugin:e,schema:t,state:n})=>{switch(t.type){case`array`:return Zp({plugin:e,schema:t,state:n});case`boolean`:return{expression:Qp({plugin:e,schema:t})};case`enum`:return{expression:$p({plugin:e,schema:t})};case`integer`:case`number`:return{expression:rm({plugin:e,schema:t})};case`never`:return{expression:em({plugin:e,schema:t})};case`null`:return{expression:tm({plugin:e,schema:t})};case`object`:return im({plugin:e,schema:t,state:n});case`string`:return{expression:am({plugin:e,schema:t})};case`tuple`:return om({plugin:e,schema:t,state:n});case`undefined`:return{expression:sm({plugin:e,schema:t})};case`unknown`:return{expression:cm({plugin:e,schema:t})};case`void`:return{expression:lm({plugin:e,schema:t})}}},dm=({optional:e,plugin:t,schema:n,state:r})=>{let i={},a=t.referenceSymbol(t.api.getSelector(`import`,`zod`));if(n.$ref){let e=r.circularReferenceTracker.includes(n.$ref);r.circularReferenceTracker.push(n.$ref),r.currentReferenceTracker.push(n.$ref);let o=t.api.getSelector(`ref`,n.$ref),s=t.getSymbol(o);if(e)s||=t.referenceSymbol(o),i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:N.identifier({text:s.placeholder})})]})]}),i.hasCircularReference=n.circular;else{if(s)i.hasCircularReference=n.circular;else{let e=t.context.resolveIrRef(n.$ref);fm({id:n.$ref,plugin:t,schema:e,state:{...r,currentReferenceTracker:[n.$ref]}})}let e=t.referenceSymbol(o);i.expression=N.identifier({text:e.placeholder})}r.circularReferenceTracker.pop(),r.currentReferenceTracker.pop()}else if(n.type){let e=um({plugin:t,schema:n,state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,i.typeName=e.anyType,t.config.metadata&&n.description&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.describe}),parameters:[N.stringLiteral({text:n.description})]}))}else if(n.items)if(n=P({schema:n}),n.items){let e=n.items.map(e=>{let n=dm({plugin:t,schema:e,state:r});return n.hasCircularReference&&(i.hasCircularReference=!0),n.expression});if(n.logicalOperator===`and`){let t=n.items[0];t.logicalOperator===`or`||t.type&&t.type!==`object`?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:e}):(i.expression=e[0],e.slice(1).forEach(e=>{i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.and}),parameters:[e]})}))}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:e})]})}else i=dm({plugin:t,schema:n,state:r});else{let e=um({plugin:t,schema:{type:`unknown`},state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,i.typeName=e.anyType}if(i.expression&&(n.accessScope===`read`&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.readonly})})),e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.optional})})),n.default!==void 0)){let e=nm({isBigInt:n.type===`integer`&&n.format===`int64`,value:n.default});e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.default}),parameters:[e]}))}return i.hasCircularReference?i.typeName||=`ZodTypeAny`:i.typeName&&=void 0,i},fm=({id:e,plugin:t,schema:n,state:r})=>{r||={circularReferenceTracker:[e],currentReferenceTracker:[e],hasCircularReference:!1};let i=t.api.getSelector(`ref`,e),a=t.getSymbol(i);if(a)return;let o=dm({plugin:t,schema:n,state:r}),s=L(e);a=t.registerSymbol({exported:!0,name:E({config:t.config.definitions,name:s}),selector:i});let c=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.definitions.types.infer,name:s}),selector:t.api.getSelector(`type-infer-ref`,e)}):void 0;Ap({plugin:t,schema:n,symbol:a,typeInferSymbol:c,zodSchema:o})},pm=({plugin:e})=>{e.registerSymbol({external:jp({plugin:e}),name:`z`,selector:e.api.getSelector(`import`,`zod`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{switch(t.type){case`operation`:Mp({getZodSchema:t=>dm({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break;case`parameter`:fm({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:fm({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:fm({id:t.$ref,plugin:e,schema:t.schema});break;case`webhook`:Np({getZodSchema:t=>dm({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break}})},mm=({plugin:e,schema:t,state:n})=>{let r={},i=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),a=N.propertyAccessExpression({expression:i.placeholder,name:$.array});if(!t.items)r.expression=N.callExpression({functionName:a,parameters:[Tm({plugin:e,schema:{type:`unknown`}}).expression]});else{t=P({schema:t});let o=t.items.map(t=>{let i=Om({plugin:e,schema:t,state:n});return i.hasCircularReference&&(r.hasCircularReference=!0),i.expression});if(o.length===1)r.expression=N.callExpression({functionName:a,parameters:o});else if(t.logicalOperator===`and`){let e=t.items[0],n;if(e.logicalOperator===`or`||e.type&&e.type!==`object`)n=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.intersection}),parameters:o});else{n=o[0];for(let e=1;e<o.length;e++)n=N.callExpression({functionName:N.propertyAccessExpression({expression:n,name:$.and}),parameters:[o[e]]})}r.expression=N.callExpression({functionName:a,parameters:[n]})}else r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.array}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:o})]})]})}return t.minItems===t.maxItems&&t.minItems!==void 0?r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.length}),parameters:[N.valueToExpression({value:t.minItems})]}):(t.minItems!==void 0&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.min}),parameters:[N.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&(r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.expression,name:$.max}),parameters:[N.valueToExpression({value:t.maxItems})]}))),r},hm=({plugin:e,schema:t})=>{let n={},r=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return typeof t.const==`boolean`?(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.ots.boolean(t.const)]}),n):(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.boolean})}),n)},gm=({plugin:e,schema:t})=>{let n={},r=e.referenceSymbol(e.api.getSelector(`import`,`zod`)),i=[],a=[],o=!1,s=!0;for(let e of t.items??[])if(e.type===`string`&&typeof e.const==`string`){let t=N.stringLiteral({text:e.const});i.push(t),a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[t]}))}else if((e.type===`number`||e.type===`integer`)&&typeof e.const==`number`){s=!1;let t=N.ots.number(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[t]}))}else if(e.type===`boolean`&&typeof e.const==`boolean`){s=!1;let t=N.ots.boolean(e.const);a.push(N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[t]}))}else (e.type===`null`||e.const===null)&&(o=!0);return a.length?(s&&i.length>0?n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.enum}),parameters:[N.arrayLiteralExpression({elements:i,multiLine:!1})]}):a.length===1?n.expression=a[0]:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:a,multiLine:a.length>3})]}),o&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.nullable}),parameters:[n.expression]})),n):Tm({plugin:e,schema:{type:`unknown`}})},_m=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.never})}),t},vm=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.null})}),t},ym=({isBigInt:e,value:t})=>{let n=N.valueToExpression({value:t});return e&&(typeof t==`bigint`||typeof t==`number`||typeof t==`string`||typeof t==`boolean`)?N.callExpression({functionName:`BigInt`,parameters:[n]}):n},bm=({plugin:e,schema:t})=>{let n={},r=t.type===`integer`&&t.format===`int64`,i=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return typeof t.const==`number`?(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.literal}),parameters:[N.ots.number(t.const)]}),n):(n.expression=N.callExpression({functionName:r?N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:i.placeholder,name:$.coerce}),name:$.bigint}):N.propertyAccessExpression({expression:i.placeholder,name:$.number})}),!r&&t.type===`integer`&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.int})})),t.exclusiveMinimum===void 0?t.minimum!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.gte}),parameters:[ym({isBigInt:r,value:t.minimum})]})):n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.gt}),parameters:[ym({isBigInt:r,value:t.exclusiveMinimum})]}),t.exclusiveMaximum===void 0?t.maximum!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.lte}),parameters:[ym({isBigInt:r,value:t.maximum})]})):n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.lt}),parameters:[ym({isBigInt:r,value:t.exclusiveMaximum})]}),n)},xm=({plugin:e,schema:t,state:n})=>{let r={},i=[],a=t.required??[],o=e.referenceSymbol(e.api.getSelector(`import`,`zod`));for(let s in t.properties){let c=t.properties[s],l=Om({optional:!a.includes(s),plugin:e,schema:c,state:n});l.hasCircularReference&&(r.hasCircularReference=!0),D.lastIndex=0;let u;u=D.test(s)?s.startsWith(`-`)?p.default.factory.createStringLiteral(s):p.default.factory.createNumericLiteral(s):s,(s.match(/^[0-9]/)&&s.match(/\D+/g)||s.match(/\W/g))&&!s.startsWith(`'`)&&!s.endsWith(`'`)&&(u=`'${s}'`),l.hasCircularReference?i.push(N.getAccessorDeclaration({name:u,returnType:l.typeName?N.propertyAccessExpression({expression:o.placeholder,name:l.typeName}):void 0,statements:[N.returnStatement({expression:l.expression})]})):i.push(N.propertyAssignment({initializer:l.expression,name:u}))}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let i=Om({plugin:e,schema:t.additionalProperties,state:n});return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:$.record}),parameters:[N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:$.string}),parameters:[]}),i.expression]}),i.hasCircularReference&&(r.hasCircularReference=!0),r.hasCircularReference?{...r,typeName:`ZodType`}:r}return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:o.placeholder,name:$.object}),parameters:[p.default.factory.createObjectLiteralExpression(i,!0)]}),r.hasCircularReference?{...r,typeName:`ZodType`}:r},Sm=({plugin:e,schema:t})=>{let n={},r=e.referenceSymbol(e.api.getSelector(`import`,`zod`));if(typeof t.const==`string`)return n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.literal}),parameters:[N.ots.string(t.const)]}),n;n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.string})});let i=[];if(e.config.dates.offset&&i.push({key:`offset`,value:!0}),e.config.dates.local&&i.push({key:`local`,value:!0}),t.format)switch(t.format){case`date`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:r.placeholder,name:$.iso}),name:$.date})});break;case`date-time`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:r.placeholder,name:$.iso}),name:$.datetime}),parameters:i.length>0?[N.objectExpression({obj:i})]:[]});break;case`email`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.email})});break;case`ipv4`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.ipv4})});break;case`ipv6`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.ipv6})});break;case`time`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:N.propertyAccessExpression({expression:r.placeholder,name:$.iso}),name:$.time})});break;case`uri`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.url})});break;case`uuid`:n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:r.placeholder,name:$.uuid})});break}return t.minLength===t.maxLength&&t.minLength!==void 0?n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.length}),parameters:[N.valueToExpression({value:t.minLength})]}):(t.minLength!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.min}),parameters:[N.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.max}),parameters:[N.valueToExpression({value:t.maxLength})]}))),t.pattern&&(n.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.expression,name:$.regex}),parameters:[N.regularExpressionLiteral({text:t.pattern})]})),n},Cm=({plugin:e,schema:t,state:n})=>{let r={},i=e.referenceSymbol(e.api.getSelector(`import`,`zod`));if(t.const&&Array.isArray(t.const)){let e=t.const.map(e=>N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.literal}),parameters:[N.valueToExpression({value:e})]}));return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:e})]}),r}let a=[];for(let i of t.items??[]){let t=Om({plugin:e,schema:i,state:n});a.push(t.expression),t.hasCircularReference&&(r.hasCircularReference=!0)}return r.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.placeholder,name:$.tuple}),parameters:[N.arrayLiteralExpression({elements:a})]}),r},wm=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.undefined})}),t},Tm=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.unknown})}),t},Em=({plugin:e})=>{let t={},n=e.referenceSymbol(e.api.getSelector(`import`,`zod`));return t.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:n.placeholder,name:$.void})}),t},Dm=({plugin:e,schema:t,state:n})=>{switch(t.type){case`array`:return mm({plugin:e,schema:t,state:n});case`boolean`:return hm({plugin:e,schema:t});case`enum`:return gm({plugin:e,schema:t});case`integer`:case`number`:return bm({plugin:e,schema:t});case`never`:return _m({plugin:e,schema:t});case`null`:return vm({plugin:e,schema:t});case`object`:return xm({plugin:e,schema:t,state:n});case`string`:return Sm({plugin:e,schema:t});case`tuple`:return Cm({plugin:e,schema:t,state:n});case`undefined`:return wm({plugin:e,schema:t});case`unknown`:return Tm({plugin:e,schema:t});case`void`:return Em({plugin:e,schema:t})}},Om=({optional:e,plugin:t,schema:n,state:r})=>{let i={},a=t.referenceSymbol(t.api.getSelector(`import`,`zod`));if(n.$ref){let e=r.circularReferenceTracker.includes(n.$ref),o=r.currentReferenceTracker.includes(n.$ref);r.circularReferenceTracker.push(n.$ref),r.currentReferenceTracker.push(n.$ref);let s=t.api.getSelector(`ref`,n.$ref),c=t.getSymbol(s);if(e)c||=t.referenceSymbol(s),o?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({returnType:N.keywordTypeNode({keyword:`any`}),statements:[N.returnStatement({expression:N.identifier({text:c.placeholder})})]})]}):i.expression=N.identifier({text:c.placeholder}),i.hasCircularReference=n.circular;else{if(c)i.hasCircularReference=n.circular;else{let e=t.context.resolveIrRef(n.$ref);km({id:n.$ref,plugin:t,schema:e,state:r})}let e=t.referenceSymbol(s);i.expression=N.identifier({text:e.placeholder})}r.circularReferenceTracker.pop(),r.currentReferenceTracker.pop()}else if(n.type){let e=Dm({plugin:t,schema:n,state:r});i.expression=e.expression,i.hasCircularReference=e.hasCircularReference,t.config.metadata&&n.description&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.register}),parameters:[N.propertyAccessExpression({expression:a.placeholder,name:$.globalRegistry}),N.objectExpression({obj:[{key:`description`,value:N.stringLiteral({text:n.description})}]})]}))}else if(n.items)if(n=P({schema:n}),n.items){let e=n.items.map(e=>Om({plugin:t,schema:e,state:r}));if(n.logicalOperator===`and`){let t=n.items[0];t.logicalOperator===`or`||t.type&&t.type!==`object`?i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.intersection}),parameters:e.map(e=>e.expression)}):(i.expression=e[0].expression,e.slice(1).forEach(e=>{i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.and}),parameters:[e.hasCircularReference?N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.lazy}),parameters:[N.arrowFunction({statements:[N.returnStatement({expression:e.expression})]})]}):e.expression]})}))}else i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.union}),parameters:[N.arrayLiteralExpression({elements:e.map(e=>e.expression)})]})}else i=Om({plugin:t,schema:n,state:r});else i.expression=Dm({plugin:t,schema:{type:`unknown`},state:r}).expression;if(i.expression&&(n.accessScope===`read`&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.readonly})})),e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:a.placeholder,name:$.optional}),parameters:[i.expression]}),i.typeName=$.ZodOptional),n.default!==void 0)){let e=ym({isBigInt:n.type===`integer`&&n.format===`int64`,value:n.default});e&&(i.expression=N.callExpression({functionName:N.propertyAccessExpression({expression:i.expression,name:$.default}),parameters:[e]}))}return i},km=({id:e,plugin:t,schema:n,state:r})=>{let i={circularReferenceTracker:[e],hasCircularReference:!1,...r,currentReferenceTracker:[e]},a=t.api.getSelector(`ref`,e),o=t.getSymbol(a);if(o&&!t.getSymbolValue(o))return;let s=Om({plugin:t,schema:n,state:i}),c=L(e);o=t.registerSymbol({exported:!0,name:E({config:t.config.definitions,name:c}),selector:a});let l=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:!0,meta:{kind:`type`},name:E({config:t.config.definitions.types.infer,name:c}),selector:t.api.getSelector(`type-infer-ref`,e)}):void 0;Ap({plugin:t,schema:n,symbol:o,typeInferSymbol:l,zodSchema:s})},Am=({plugin:e})=>{e.registerSymbol({external:jp({plugin:e}),name:`z`,selector:e.api.getSelector(`import`,`zod`)}),e.forEach(`operation`,`parameter`,`requestBody`,`schema`,`webhook`,t=>{switch(t.type){case`operation`:Mp({getZodSchema:t=>Om({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break;case`parameter`:km({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case`requestBody`:km({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case`schema`:km({id:t.$ref,plugin:e,schema:t.schema});break;case`webhook`:Np({getZodSchema:t=>Om({plugin:e,schema:t,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:!1}}),operation:t.operation,plugin:e});break}})},jm=e=>{let{plugin:t}=e;switch(t.config.compatibilityVersion){case 3:return pm(e);case 4:return Am(e);case`mini`:return Xp(e);default:return Am(e)}},Mm={api:new kp({name:`zod`}),config:{case:`camelCase`,comments:!0,exportFromIndex:!1,metadata:!1},handler:jm,name:`zod`,resolveConfig:(e,t)=>{let n=t.package.getVersion(`zod`),r=()=>n&&(n.major===4||n.major===3)?n.major:4,i=e=>{if(!e)return r();if(!n)return e;if((e===4||e===3||e===`mini`)&&!t.package.satisfies(n,`>=3.25.0 <5.0.0`)){let t=r();return console.warn(`🔌 ${l.default.yellow(`Warning:`)} Installed ${l.default.cyan(`zod`)} ${l.default.cyan(`v${n.version}`)} does not support compatibility version ${l.default.yellow(String(e))}, using ${l.default.yellow(String(t))}.`),t}return e};e.config.compatibilityVersion=i(e.config.compatibilityVersion),e.config.dates=t.valueToObject({defaultValue:{local:!1,offset:!1},value:e.config.dates}),e.config.types=t.valueToObject({defaultValue:{infer:{case:`PascalCase`,enabled:!1}},mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.config.types}),e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}ZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.definitions}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}Data`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}DataZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}Response`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}ResponseZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??`camelCase`,enabled:!0,name:`z{{name}}WebhookRequest`,types:{...e.config.types,infer:{...e.config.types.infer,name:`{{name}}WebhookRequestZodType`}}},mappers:{...qe,object:(e,n)=>({...e,types:t.valueToObject({defaultValue:n.types,mappers:{object:(e,n)=>({...e,infer:t.valueToObject({defaultValue:{...n.infer,enabled:e.infer===void 0?n.infer.enabled:!!e.infer},mappers:qe,value:e.infer})})},value:e.types})})},value:e.config.webhooks})},tags:[`validator`]},Nm=w(Mm),Pm={"@angular/common":el,"@hey-api/client-angular":_l,"@hey-api/client-axios":bl,"@hey-api/client-fetch":Cl,"@hey-api/client-next":El,"@hey-api/client-nuxt":kl,"@hey-api/client-ofetch":Ml,"@hey-api/schemas":au,"@hey-api/sdk":ku,"@hey-api/transformers":ad,"@hey-api/typescript":jd,"@pinia/colada":Xd,"@tanstack/angular-query-experimental":zf,"@tanstack/react-query":Hf,"@tanstack/solid-query":Gf,"@tanstack/svelte-query":Jf,"@tanstack/vue-query":Zf,fastify:np,"legacy/angular":Pl,"legacy/axios":Il,"legacy/fetch":Rl,"legacy/node":Bl,"legacy/xhr":Hl,valibot:Dp,zod:Mm},Fm=[`@hey-api/typescript`,`@hey-api/sdk`],Im=({dependencies:e,userPlugins:t,userPluginsConfig:n})=>{let r=new Set,i=new Set,a={},o=s=>{if(r.has(s))throw Error(`Circular reference detected at '${s}'`);if(i.has(s))return;r.add(s);let c=Pm[s],l=n[s];if(!c&&!l)throw Error(`unknown plugin dependency "${s}" - do you need to register a custom plugin with this name?`);let u={...c,...l,config:{...c?.config,...l?.config},dependencies:new Set([...c?.dependencies||[],...l?.dependencies||[]])};if(u.resolveConfig){let r={package:Jn(e),pluginByTag:(e,r={})=>{let{defaultPlugin:i,errorMessage:a}=r;for(let r of t){let t=Pm[r]||n[r];if(t&&t.tags?.includes(e)&&r!==s)return r}if(i){let t=Pm[i]||n[i];if(t&&t.tags?.includes(e)&&i!==s)return i}throw Error(a||`missing plugin - no plugin with tag "${e}" found`)},valueToObject:He};u.resolveConfig(u,r)}for(let e of u.dependencies)o(e);r.delete(s),i.add(s),a[s]=u};for(let e of t)o(e);return{pluginOrder:Array.from(i),plugins:a}},Lm=e=>typeof e==`string`?e.startsWith(`@hey-api/client`)||e.startsWith(`legacy/`):e.name.startsWith(`@hey-api/client`)||e.name.startsWith(`legacy/`)||e.tags&&e.tags.includes(`client`),Rm=({dependencies:e,userConfig:t})=>{let n={},r=Fm;return t.plugins&&(t.plugins=t.plugins.filter(e=>typeof e==`string`&&e||typeof e!=`string`&&e.name),r=t.plugins.length===1&&Lm(t.plugins[0])?[...Fm,...t.plugins]:t.plugins),Im({dependencies:e,userPlugins:r.map(e=>{if(typeof e==`string`)return e;let t=e.name;return t&&(e.handler?n[t]=e:(n[t]={config:{...e}},delete n[t].config.name)),t}).filter(Boolean),userPluginsConfig:n})},zm=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&!process.env.CI&&!process.env.NO_INTERACTIVE&&!process.env.NO_INTERACTION),Bm=async({logger:e,userConfigs:t})=>{let n=[],r={},i=e.timeEvent(`load`);for(let i of t){let t;if(i?.configFile){let e=i.configFile.split(`.`);t=e.slice(0,e.length-1).join(`.`)}let a=e.timeEvent(`c12`),{loadConfig:o}=await import(`c12`),{config:s,configFile:c}=await o({configFile:t,name:`openapi-ts`});a.timeEnd(),Object.keys(r).length||(r=We(Object.keys(s).length?c:void 0));let u=s instanceof Array?s.map(e=>ze(e,i)):[ze(s,i)];for(let e of u){let t=Ie(e);if(e.output instanceof Array){let r=t.length,i=e.output.length;if(i>1)if(r!==i){console.warn(`⚙️ ${l.default.yellow(`Warning:`)} You provided ${l.default.cyan(String(r))} ${l.default.cyan(r===1?`input`:`inputs`)} and ${l.default.yellow(String(i))} ${l.default.yellow(`outputs`)}. This is probably not what you want as it will produce identical output in multiple locations. You most likely want to provide a single output or the same number of outputs as inputs.`);for(let r of e.output)n.push({...e,input:t,output:r})}else e.output.forEach((r,i)=>{n.push({...e,input:t[i],output:r})});else n.push({...e,input:t,output:e.output[0]??``})}else n.push({...e,input:t})}}i.timeEnd();let a=[],o=e.timeEvent(`build`);for(let e of n){let{base:t,configFile:n=``,dryRun:i=!1,experimentalParser:o=!0,exportCore:s=!0,name:c,request:u,useOptions:f=!0}=e,p=e.interactive===void 0?zm():e.interactive,m=Le(e),h=Ie(e),g=Ue(e),_=Ke(e),v=[];h.length||v.push(new oe(`missing input - which OpenAPI specification should we use to generate your output?`)),g.path||v.push(new oe(`missing output - where should we generate your output?`)),!f&&m.level!==`silent`&&console.warn(`❗️ Deprecation warning: useOptions set to false. This setting will be removed in future versions. Please migrate useOptions to true https://heyapi.dev/openapi-ts/migrating.html#v0-27-38`),g.path=d.default.resolve(process.cwd(),g.path);let y;try{y=Rm({dependencies:r,userConfig:e})}catch(e){v.push(e),y={pluginOrder:[],plugins:{}}}let b=ge({...y,base:t,configFile:n,dryRun:i,experimentalParser:o,exportCore:!1,input:h,interactive:p,logs:m,name:c,output:g,parser:_,request:u,useOptions:f});b.exportCore=C(b)?s:!1;let ee=a.length;if(m.level===`debug`){let e=l.default.gray(`[Job ${ee+1}] `);console.warn(`${e}${l.default.cyan(`config:`)}`,b)}a.push({config:b,errors:v,jobIndex:ee})}return o.timeEnd(),{dependencies:r,results:a}},Vm=Object.entries({$body_:`body`,$headers_:`headers`,$path_:`path`,$query_:`query`}),Hm=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},Um=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},Wm=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},Gm=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(Um(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=Hm(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):Km({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},Km=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},qm=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=Wm(r),s=Object.entries(i).map(([t,i])=>Km({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},Jm=({allowReserved:e,array:t,object:n}={})=>r=>{let i=[];if(r&&typeof r==`object`)for(let a in r){let o=r[a];if(o!=null)if(Array.isArray(o)){let n=Gm({allowReserved:e,explode:!0,name:a,style:`form`,value:o,...t});n&&i.push(n)}else if(typeof o==`object`){let t=qm({allowReserved:e,explode:!0,name:a,style:`deepObject`,value:o,...n});t&&i.push(t)}else{let t=Km({allowReserved:e,name:a,value:o});t&&i.push(t)}}return i.join(`&`)},Ym=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},Xm=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?Ym(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},Zm=Jm({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),Qm=async({fetchOptions:e,inputPath:t,timeout:n,watch:r})=>{let i=(0,_.getResolvedInput)({pathOrUrlOrSchema:t}),a,o,s;if(i.type===`url`){if(r.lastValue&&r.isHeadMethodSupported!==!1){try{let t=await(0,_.sendRequest)({fetchOptions:{method:`HEAD`,...e,headers:Xm(e?.headers,r.headers)},timeout:n,url:i.path});if(t.response.status>=300)return{error:`not-ok`,response:t.response};s=t.response}catch(e){return{error:`not-ok`,response:new Response(e.message)}}if(!s.ok&&r.isHeadMethodSupported)return{error:`not-ok`,response:s};if(r.isHeadMethodSupported===void 0&&(r.isHeadMethodSupported=s.ok),s.status===304)return{error:`not-modified`,response:s};if(o===void 0){let e=s.headers.get(`ETag`);e&&(o=e!==r.headers.get(`If-None-Match`),o&&r.headers.set(`If-None-Match`,e))}if(o===void 0){let e=s.headers.get(`Last-Modified`);e&&(o=e!==r.headers.get(`If-Modified-Since`),o&&r.headers.set(`If-Modified-Since`,e))}if(o===!1)return{error:`not-modified`,response:s}}try{let t=await(0,_.sendRequest)({fetchOptions:{method:`GET`,...e},timeout:n,url:i.path});if(t.response.status>=300)return{error:`not-ok`,response:t.response};s=t.response}catch(e){return{error:`not-ok`,response:new Response(e.message)}}if(!s.ok)return{error:`not-ok`,response:s};if(a=s.body?await s.arrayBuffer():new ArrayBuffer(0),o===void 0){let e=new TextDecoder().decode(a);o=e!==r.lastValue,r.lastValue=e}}else r.lastValue?o=!1:r.lastValue=i.type;return o===!1?{error:`not-modified`,response:s}:{arrayBuffer:a,resolvedInput:i}};Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`L`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return hl}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return rl}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return ds}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return ps}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return dr}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return eu}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return Cc}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return Go}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Bm}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return dl}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return ts}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Fm}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return nl}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Qm}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return wc}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return w}});
24
+ //# sourceMappingURL=getSpec-D8vjI0RE.cjs.map