class i{#n;constructor(t){this.#n=t}extract({component:t,definition:p,openapiOperation:e,visitedRefs:r=new Set}){if("content"in t)return t?.content??{};const n=t?.$ref;if(!n)return{};if(r.has(n))return this.#n.warn(`Circular reference detected: ${n} for operation: ${e.operationId}`),{};r.add(n);const s=/^#\/components\/(?<componentType>.+)\/(?<componentName>.+)$/,c=n.match(s);if(!c?.groups?.componentType||!c?.groups?.componentName)return this.#n.warn(`Invalid component reference format: ${n}. Should be #/components/<componentType>/<componentName>`),{};const{componentType:m,componentName:a}=c.groups,o=p.definition.components?.[m]?.[a];return o?"$ref"in o?this.extract({component:o,definition:p,openapiOperation:e,visitedRefs:r}):"content"in o?o.content??{}:{}:(this.#n.warn(`Component not found: ${m}/${a} for operation: ${e.operationId}`),{})}}export{i as OpenapiComponentContentExtractor};
