"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeOptions=void 0;const theme_1=require("@redocly/theme"),constants_1=require("../../constants"),utils_1=require("../../utils"),helpers_1=require("./helpers"),constants_2=require("../code-samples/constants");function normalizeOptions(e,o){var n,s,i,a,l,t,r,d,u,c,p;e=Object.assign(Object.assign(Object.assign({},o),e),{markdocOptions:Object.assign(Object.assign({},null==e?void 0:e.markdocOptions),{components:Object.assign(Object.assign({},null===(n=null==o?void 0:o.markdocOptions)||void 0===n?void 0:n.components),null===(s=null==e?void 0:e.markdocOptions)||void 0===s?void 0:s.components),tags:Object.assign(Object.assign({},null===(i=null==o?void 0:o.markdocOptions)||void 0===i?void 0:i.tags),null===(a=null==e?void 0:e.markdocOptions)||void 0===a?void 0:a.tags),nodes:Object.assign(Object.assign(Object.assign({},null===(l=null==o?void 0:o.markdocOptions)||void 0===l?void 0:l.nodes),null===(t=null==e?void 0:e.markdocOptions)||void 0===t?void 0:t.nodes),{heading:(null===(d=null===(r=null==o?void 0:o.markdocOptions)||void 0===r?void 0:r.nodes)||void 0===d?void 0:d.heading)||(null===(u=null==e?void 0:e.markdocOptions)||void 0===u?void 0:u.nodes.heading)})})});const m=Array.isArray(e.ignoreNamedSchemas)?e.ignoreNamedSchemas:null===(c=e.ignoreNamedSchemas)||void 0===c?void 0:c.split(",").map((e=>e.trim()));return{downloadUrls:e.downloadUrls,schemaDefinitionsTagName:e.schemaDefinitionsTagName,corsProxyUrl:e.corsProxyUrl&&(0,theme_1.addTrailingSlash)(e.corsProxyUrl),hideSidebar:(0,utils_1.argValueToBoolean)(e.hideSidebar,!1),jsonSamplesExpandLevel:(0,utils_1.argValueToExpandLevel)(e.jsonSamplesExpandLevel,2),generatedSamplesMaxDepth:(0,utils_1.argValueToInt)(e.generatedSamplesMaxDepth,8),hideDownloadButtons:(0,utils_1.argValueToBoolean)(e.hideDownloadButtons,!1),hideInfoMetadata:(0,utils_1.argValueToBoolean)(e.hideInfoMetadata,!1),hideLoading:(0,utils_1.argValueToBoolean)(e.hideLoading,!1),hideSchemaTitles:(0,utils_1.argValueToBoolean)(e.hideSchemaTitles,!1),maxDisplayedEnumValues:(0,utils_1.argValueToNumber)(e.maxDisplayedEnumValues),mockServer:(null===(p=e.mockServer)||void 0===p?void 0:p.url)?{url:e.mockServer.url,position:e.mockServer.position||"first",description:e.mockServer.description||"Mock server"}:void 0,hideReplay:(0,utils_1.argValueToBoolean)(e.hideReplay,!1),oAuth2RedirectURI:e.oAuth2RedirectURI||null,onlyRequiredInSamples:(0,utils_1.argValueToBoolean)(e.onlyRequiredInSamples,!1),onDeepLinkClick:e.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK),requestInterceptor:e.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.REQUEST_INTERCEPTOR),routingBasePath:(0,theme_1.isUndefined)(e.disableRouter)?"":e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",schemasExpansionLevel:(0,utils_1.argValueToExpandLevel)(e.schemasExpansionLevel),feedback:e.feedback||{hide:!1},sortRequiredPropsFirst:(0,utils_1.argValueToBoolean)(e.sortRequiredPropsFirst,!1),scrollYOffset:(0,helpers_1.normalizeScrollYOffset)(e.scrollYOffset),showExtensions:(0,helpers_1.normalizeShowExtensions)(e.showExtensions),sanitize:(0,utils_1.argValueToBoolean)(e.sanitize,!1),skipBundle:(0,utils_1.argValueToBoolean)(e.skipBundle,!1),ignoreNamedSchemas:new Set(m),markdocOptions:null==e?void 0:e.markdocOptions,codeSamples:e.codeSamples||{languages:Object.values(constants_2.Languages).map((e=>({lang:e})))},layout:e.layout||theme_1.LayoutVariant.THREE_PANEL,events:e.events||{},unstable_hooks:e.unstable_hooks||(0,utils_1.getWindowReferenceOptions)(constants_1.WindowReferenceOptions.HOOKS)||{},unstable_externalCodeSamples:e.unstable_externalCodeSamples||[],hidePropertiesPrefix:(0,utils_1.argValueToBoolean)(null==e?void 0:e.hidePropertiesPrefix,!1)}}exports.normalizeOptions=normalizeOptions;
//# sourceMappingURL=normalizeOptions.js.map