var __awaiter=this&&this.__awaiter||function(e,n,t,i){return new(t||(t=Promise))((function(o,r){function u(e){try{s(i.next(e))}catch(e){r(e)}}function c(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}s((i=i.apply(e,n||[])).next())}))};import{useRef}from"react";import isDeepEqual from"fast-deep-equal";import{loadAndBundleDefinition}from"../../utils/loadAndBundleSpec";import{safeSlugify}from"../../utils/string";export function fixSpec(e){const n=e.components&&e.components.securitySchemes||{};for(const e of Object.keys(n)){const t=n[e];t["x-type"]&&(t.type=t["x-type"]),t["x-scheme"]&&(t.scheme=t["x-scheme"])}}export function loadSingle(e,n,t){return __awaiter(this,void 0,void 0,(function*(){let i;if(null==t?void 0:t.skipBundle){if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');i=e}else i=yield loadAndBundleDefinition(e||n);try{fixSpec(i)}catch(e){}return i}))}export function loadAndBundleSpecOrMd(e,n){return e.endsWith(".md")?loadAndBundleDefinition({openapi:"3.0.0",info:{title:n||"",version:"1.0",description:{$ref:e}},paths:{}}):loadAndBundleDefinition(e)}export function useDeepCompareMemoize(e){const n=useRef(null),t=useRef(0);return isDeepEqual(e,n.current)||(n.current=e,t.current+=1),[t.current]}export function getMarkdownHeaderId(e){return"string"==typeof e[0]?`section/${safeSlugify(e[0])}`:e.children?getMarkdownHeaderId(e[0]):void 0}
//# sourceMappingURL=utils.js.map