let n = e; for (const e of this.plugins) if (void 0 !== e.typeExtension) switch (t) { case s.OasVersion.Version3_0: case s.OasVersion.Version3_1: if (!e.typeExtension.oas3) continue; n = e.typeExtension.oas3(n, t); case s.OasVersion.Version2: if (!e.typeExtension.oas2) continue; n = e.typeExtension.oas2(n, t); default: throw new Error('Not implemented'); } return n; } getRuleSettings(e, t) { this._usedRules.add(e), this._usedVersions.add(t); const n = this.rules[t][e] || 'off'; return 'string' == typeof n ? { severity: n } : Object.assign({ severity: 'error' }, n); } getPreprocessorSettings(e, t) { this._usedRules.add(e), this._usedVersions.add(t); const n = this.preprocessors[t][e] || 'off'; return 'string' == typeof n ? { severity: 'on' === n ? 'error' : n } : Object.assign({ severity: 'error' }, n); } getDecoratorSettings(e, t) { this._usedRules.add(e), this._usedVersions.add(t); const n = this.decorators[t][e] || 'off'; return 'string' == typeof n ? { severity: 'on' === n ? 'error' : n } : Object.assign({ severity: 'error' }, n); } getUnusedRules() { const e = [], t = [], n = []; for (const r of Array.from(this._usedVersions)) e.push( ...Object.keys(this.rules[r]).filter( e => !this._usedRules.has(e) ) ), t.push( ...Object.keys(this.decorators[r]).filter( e => !this._usedRules.has(e) ) ), n.push( ...Object.keys(this.preprocessors[r]).filter( e => !this._usedRules.has(e) ) ); return { rules: e, preprocessors: n, decorators: t }; } getRulesForOasVersion(e) { switch (e) { case s.OasMajorVersion.Version3: const e = []; return ( this.plugins.forEach(t => { var n; return ( (null === (n = t.preprocessors) || void 0 === n ? void 0 : n.oas3) && e.push(t.preprocessors.oas3) ); }), this.plugins.forEach(t => { var n; return ( (null === (n = t.rules) || void 0 === n ? void 0 : n.oas3) && e.push(t.rules.oas3) ); }), this.plugins.forEach(t => { var n; return ( (null === (n = t.decorators) || void 0 === n ? void 0 : n.oas3) && e.push(t.decorators.oas3) ); }), e ); case s.OasMajorVersion.Version2: const t = []; return ( this.plugins.forEach(e => { var n; return ( (null === (n = e.preprocessors) || void 0 === n ? void 0 : n.oas2) && t.push(e.preprocessors.oas2) ); }), this.plugins.forEach(e => { var n; return ( (null === (n = e.rules) || void 0 === n ? void 0 : n.oas2) && t.push(e.rules.oas2) ); }), this.plugins.forEach(e => { var n; return ( (null === (n = e.decorators) || void 0 === n ? void 0 : n.oas2) && t.push(e.decorators.oas2) ); }), t ); } } skipRules(e) { for (const t of e || []) for (const e of Object.values(s.OasVersion)) this.rules[e][t] && (this.rules[e][t] = 'off'); } skipPreprocessors(e) { for (const t of e || []) for (const e of Object.values(s.OasVersion)) this.preprocessors[e][t] && (this.preprocessors[e][t] = 'off'); } skipDecorators(e) { for (const t of e || []) for (const e of Object.values(s.OasVersion)) this.decorators[e][t] && (this.decorators[e][t] = 'off'); } } (t.LintConfig = c), (t.Config = class { constructor(e, t) { (this.rawConfig = e), (this.configFile = t), (this.apis = e.apis || {}), (this.lint = new c(e.lint || {}, t)), (this['features.openapi'] = e['features.openapi'] || {}), (this['features.mockServer'] = e['features.mockServer'] || {}), (this.resolve = l.getResolveConfig( null == e ? void 0 : e.resolve )), (this.region = e.region), (this.organization = e.organization); } }); }, 8698: function (e, t, n) { 'use strict'; var r = (this && this.__createBinding) || (Object.create ? function (e, t, n, r) { void 0 === r && (r = n), Object.defineProperty(e, r, { enumerable: !0, get: function () { return t[n]; } }); } : function (e, t, n, r) { void 0 === r && (r = n), (e[r] = t[n]); }), o = (this && this.__exportStar) || function (e, t) { for (var n in e) 'default' === n || Object.prototype.hasOwnProperty.call(t, n) || r(t, e, n); }; Object.defineProperty(t, '__esModule', { value: !0 }), o(n(3777), t), o(n(3865), t), o(n(5030), t), o(n(6242), t), o(n(9129), t), o(n(2565), t), o(n(7040), t); }, 9129: function (e, t, n) { 'use strict'; var r = (this && this.__awaiter) || function (e, t, n, r) { return new (n || (n = Promise))(function (o, i) { function a(e) { try { l(r.next(e)); } catch (e) { i(e); } } function s(e) { try { l(r.throw(e)); } catch (e) { i(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((r = r.apply(e, t || [])).next()); }); }; Object.defineProperty(t, '__esModule', { value: !0 }), (t.getConfig = t.findConfig = t.CONFIG_FILE_NAMES = t.loadConfig = void 0); const o = n(5101), i = n(6470), a = n(1094), s = n(771), l = n(3777), c = n(2565), u = n(7040); function p(e) { if (!o.hasOwnProperty('existsSync')) return; const n = t.CONFIG_FILE_NAMES.map(t => e ? i.resolve(e, t) : t ).filter(o.existsSync); if (n.length > 1) throw new Error( \`\\n Multiple configuration files are not allowed. \\n Found the following files: \${n.join( ', ' )}. \\n Please use 'redocly.yaml' instead.\\n \` ); return n[0]; } function d(e = p()) { return r(this, void 0, void 0, function* () { if (!e) return {}; try { const t = (yield s.loadYaml(e)) || {}; return c.transformConfig(t); } catch (t) { throw new Error( \`Error parsing config file at '\${e}': \${t.message}\` ); } }); } (t.loadConfig = function (e = p(), t, n) { return r(this, void 0, void 0, function* () { const o = yield d(e); return ( 'function' == typeof n && (yield n(o)), yield (function ({ rawConfig: e, customExtends: t, configPath: n }) { var o; return r(this, void 0, void 0, function* () { void 0 !== t ? ((e.lint = e.lint || {}), (e.lint.extends = t)) : s.isEmptyObject(e); const r = new a.RedoclyClient(), i = yield r.getTokens(); if (i.length) { e.resolve || (e.resolve = {}), e.resolve.http || (e.resolve.http = {}), (e.resolve.http.headers = [ ...(null !== (o = e.resolve.http.headers) && void 0 !== o ? o : []) ]); for (const t of i) { const n = l.DOMAINS[t.region]; e.resolve.http.headers.push( { matches: \`https://api.\${n}/registry/**\`, name: 'Authorization', envVariable: void 0, value: t.token }, ...('us' === t.region ? [ { matches: 'https://api.redoc.ly/registry/**', name: 'Authorization', envVariable: void 0, value: t.token } ] : []) ); } } return u.resolveConfig(e, n); }); })({ rawConfig: o, customExtends: t, configPath: e }) ); }); }), (t.CONFIG_FILE_NAMES = [ 'redocly.yaml', 'redocly.yml', '.redocly.yaml', '.redocly.yml' ]), (t.findConfig = p), (t.getConfig = d); }, 9016: function (e, t) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = { rules: { 'info-description': 'warn', 'info-contact': 'off', 'info-license': 'off', 'info-license-url': 'off', 'tag-description': 'warn', 'tags-alphabetical': 'off', 'parameter-description': 'off', 'no-path-trailing-slash': 'warn', 'no-identical-paths': 'warn', 'no-ambiguous-paths': 'warn', 'path-declaration-must-exist': 'warn', 'path-not-include-query': 'warn', 'path-parameters-defined': 'warn', 'operation-description': 'off', 'operation-2xx-response': 'warn', 'operation-4xx-response': 'off', assertions: 'warn', 'operation-operationId': 'warn', 'operation-summary': 'warn', 'operation-operationId-unique': 'warn', 'operation-parameters-unique': 'warn', 'operation-tag-defined': 'off', 'operation-security-defined': 'warn', 'operation-operationId-url-safe': 'warn', 'operation-singular-tag': 'off', 'no-unresolved-refs': 'error', 'no-enum-type-mismatch': 'warn', 'boolean-parameter-prefixes': 'off', 'paths-kebab-case': 'off', spec: 'error' }, oas3_0Rules: { 'no-invalid-media-type-examples': { severity: 'warn', disallowAdditionalProperties: !0 }, 'no-server-example.com': 'warn', 'no-server-trailing-slash': 'error', 'no-empty-servers': 'warn', 'no-example-value-and-externalValue': 'warn', 'no-unused-components': 'warn', 'no-undefined-server-variable': 'warn', 'no-servers-empty-enum': 'error' }, oas3_1Rules: { 'no-server-example.com': 'warn', 'no-server-trailing-slash': 'error', 'no-empty-servers': 'warn', 'no-example-value-and-externalValue': 'warn', 'no-unused-components': 'warn', 'no-undefined-server-variable': 'warn', 'no-servers-empty-enum': 'error' } }); }, 8057: function (e, t) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = { rules: { 'info-description': 'warn', 'info-contact': 'off', 'info-license': 'warn', 'info-license-url': 'warn', 'tag-description': 'warn', 'tags-alphabetical': 'off', 'parameter-description': 'off', 'no-path-trailing-slash': 'error', 'no-identical-paths': 'error', 'no-ambiguous-paths': 'warn', 'path-declaration-must-exist': 'error', 'path-not-include-query': 'error', 'path-parameters-defined': 'error', 'operation-description': 'off', 'operation-2xx-response': 'warn', assertions: 'warn', 'operation-4xx-response': 'warn', 'operation-operationId': 'warn', 'operation-summary': 'error', 'operation-operationId-unique': 'error', 'operation-operationId-url-safe': 'error', 'operation-parameters-unique': 'error', 'operation-tag-defined': 'off', 'operation-security-defined': 'error', 'operation-singular-tag': 'off', 'no-unresolved-refs': 'error', 'no-enum-type-mismatch': 'error', 'boolean-parameter-prefixes': 'off', 'paths-kebab-case': 'off', spec: 'error' }, oas3_0Rules: { 'no-invalid-media-type-examples': { severity: 'warn', disallowAdditionalProperties: !0 }, 'no-server-example.com': 'warn', 'no-server-trailing-slash': 'error', 'no-empty-servers': 'error', 'no-example-value-and-externalValue': 'error', 'no-unused-components': 'warn', 'no-undefined-server-variable': 'error', 'no-servers-empty-enum': 'error' }, oas3_1Rules: { 'no-server-example.com': 'warn', 'no-server-trailing-slash': 'error', 'no-empty-servers': 'error', 'no-example-value-and-externalValue': 'error', 'no-unused-components': 'warn', 'no-undefined-server-variable': 'error', 'no-servers-empty-enum': 'error' } }); }, 5030: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.initRules = void 0); const r = n(771); t.initRules = function (e, t, n, o) { return e .flatMap(e => Object.keys(e).map(r => { const i = e[r], a = 'rules' === n ? t.getRuleSettings(r, o) : 'preprocessors' === n ? t.getPreprocessorSettings(r, o) : t.getDecoratorSettings(r, o); if ('off' === a.severity) return; const s = i(a); return Array.isArray(s) ? s.map(e => ({ severity: a.severity, ruleId: r, visitor: e })) : { severity: a.severity, ruleId: r, visitor: s }; }) ) .flatMap(e => e) .filter(r.notUndefined); }; }, 3865: function (e, t) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }); }, 2565: function (e, t, n) { 'use strict'; var r = (this && this.__rest) || function (e, t) { var n = {}; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]); if ( null != e && 'function' == typeof Object.getOwnPropertySymbols ) { var o = 0; for (r = Object.getOwnPropertySymbols(e); o < r.length; o++) t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]); } return n; }; Object.defineProperty(t, '__esModule', { value: !0 }), (t.getUniquePlugins = t.getResolveConfig = t.transformConfig = t.getMergedConfig = t.mergeExtends = t.prefixRules = t.transformApiDefinitionsToApis = t.parsePresetName = void 0); const o = n(6212), i = n(771), a = n(3777); function s(e = {}) { let t = {}; for (const [n, r] of Object.entries(e)) t[n] = { root: r }; return t; } (t.parsePresetName = function (e) { if (e.indexOf('/') > -1) { const [t, n] = e.split('/'); return { pluginId: t, configName: n }; } return { pluginId: '', configName: e }; }), (t.transformApiDefinitionsToApis = s), (t.prefixRules = function (e, t) { if (!t) return e; const n = {}; for (const r of Object.keys(e)) n[\`\${t}/\${r}\`] = e[r]; return n; }), (t.mergeExtends = function (e) { const t = { rules: {}, oas2Rules: {}, oas3_0Rules: {}, oas3_1Rules: {}, preprocessors: {}, oas2Preprocessors: {}, oas3_0Preprocessors: {}, oas3_1Preprocessors: {}, decorators: {}, oas2Decorators: {}, oas3_0Decorators: {}, oas3_1Decorators: {}, plugins: [], pluginPaths: [], extendPaths: [] }; for (let n of e) { if (n.extends) throw new Error( \`\\\`extends\\\` is not supported in shared configs yet: \${JSON.stringify( n, null, 2 )}.\` ); Object.assign(t.rules, n.rules), Object.assign(t.oas2Rules, n.oas2Rules), i.assignExisting(t.oas2Rules, n.rules || {}), Object.assign(t.oas3_0Rules, n.oas3_0Rules), i.assignExisting(t.oas3_0Rules, n.rules || {}), Object.assign(t.oas3_1Rules, n.oas3_1Rules), i.assignExisting(t.oas3_1Rules, n.rules || {}), Object.assign(t.preprocessors, n.preprocessors), Object.assign(t.oas2Preprocessors, n.oas2Preprocessors), i.assignExisting(t.oas2Preprocessors, n.preprocessors || {}), Object.assign(t.oas3_0Preprocessors, n.oas3_0Preprocessors), i.assignExisting( t.oas3_0Preprocessors, n.preprocessors || {} ), Object.assign(t.oas3_1Preprocessors, n.oas3_1Preprocessors), i.assignExisting( t.oas3_1Preprocessors, n.preprocessors || {} ), Object.assign(t.decorators, n.decorators), Object.assign(t.oas2Decorators, n.oas2Decorators), i.assignExisting(t.oas2Decorators, n.decorators || {}), Object.assign(t.oas3_0Decorators, n.oas3_0Decorators), i.assignExisting(t.oas3_0Decorators, n.decorators || {}), Object.assign(t.oas3_1Decorators, n.oas3_1Decorators), i.assignExisting(t.oas3_1Decorators, n.decorators || {}), t.plugins.push(...(n.plugins || [])), t.pluginPaths.push(...(n.pluginPaths || [])), t.extendPaths.push(...new Set(n.extendPaths)); } return t; }), (t.getMergedConfig = function (e, t) { var n, r, o, i, s, l; const c = [ ...Object.values(e.apis).map(e => { var t; return null === (t = null == e ? void 0 : e.lint) || void 0 === t ? void 0 : t.extendPaths; }), null === (r = null === (n = e.rawConfig) || void 0 === n ? void 0 : n.lint) || void 0 === r ? void 0 : r.extendPaths ] .flat() .filter(Boolean), u = [ ...Object.values(e.apis).map(e => { var t; return null === (t = null == e ? void 0 : e.lint) || void 0 === t ? void 0 : t.pluginPaths; }), null === (i = null === (o = e.rawConfig) || void 0 === o ? void 0 : o.lint) || void 0 === i ? void 0 : i.pluginPaths ] .flat() .filter(Boolean); return t ? new a.Config( Object.assign(Object.assign({}, e.rawConfig), { lint: Object.assign( Object.assign( {}, e.apis[t] ? e.apis[t].lint : e.rawConfig.lint ), { extendPaths: c, pluginPaths: u } ), 'features.openapi': Object.assign( Object.assign({}, e['features.openapi']), null === (s = e.apis[t]) || void 0 === s ? void 0 : s['features.openapi'] ), 'features.mockServer': Object.assign( Object.assign({}, e['features.mockServer']), null === (l = e.apis[t]) || void 0 === l ? void 0 : l['features.mockServer'] ) }), e.configFile ) : e; }), (t.transformConfig = function (e) { if (e.apis && e.apiDefinitions) throw new Error( "Do not use 'apiDefinitions' field. Use 'apis' instead.\\n" ); if (e['features.openapi'] && e.referenceDocs) throw new Error( "Do not use 'referenceDocs' field. Use 'features.openapi' instead.\\n" ); const t = e, { apiDefinitions: n, referenceDocs: i } = t, a = r(t, ['apiDefinitions', 'referenceDocs']); return ( n && process.stderr.write( \`The \${o.yellow( 'apiDefinitions' )} field is deprecated. Use \${o.green( 'apis' )} instead. Read more about this change: https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties\\n\` ), i && process.stderr.write( \`The \${o.yellow( 'referenceDocs' )} field is deprecated. Use \${o.green( 'features.openapi' )} instead. Read more about this change: https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties\\n\` ), Object.assign({ 'features.openapi': i, apis: s(n) }, a) ); }), (t.getResolveConfig = function (e) { var t, n; return { http: { headers: null !== (n = null === (t = null == e ? void 0 : e.http) || void 0 === t ? void 0 : t.headers) && void 0 !== n ? n : [], customFetch: void 0 } }; }), (t.getUniquePlugins = function (e) { const t = new Set(), n = []; for (const r of e) t.has(r.id) ? r.id && process.stderr.write( \`Duplicate plugin id "\${o.yellow(r.id)}".\\n\` ) : (n.push(r), t.add(r.id)); return n; }); }, 1988: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.checkIfMatchByStrategy = t.filter = void 0); const r = n(7468), o = n(771); function i(e) { return Array.isArray(e) ? e : [e]; } (t.filter = function (e, t, n) { const { parent: i, key: a } = t; let s = !1; if (Array.isArray(e)) for (let o = 0; o < e.length; o++) r.isRef(e[o]) && n(t.resolve(e[o]).node) && (e.splice(o, 1), (s = !0), o--), n(e[o]) && (e.splice(o, 1), (s = !0), o--); else if (o.isPlainObject(e)) for (const o of Object.keys(e)) r.isRef(e[o]) && n(t.resolve(e[o]).node) && (delete e[o], (s = !0)), n(e[o]) && (delete e[o], (s = !0)); s && (o.isEmptyObject(e) || o.isEmptyArray(e)) && delete i[a]; }), (t.checkIfMatchByStrategy = function (e, t, n) { return ( void 0 !== e && void 0 !== t && (Array.isArray(t) || Array.isArray(e) ? ((t = i(t)), (e = i(e)), 'any' === n ? t.some(t => e.includes(t)) : 'all' === n && t.every(t => e.includes(t))) : e === t) ); }); }, 9244: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.FilterIn = void 0); const r = n(1988); t.FilterIn = ({ property: e, value: t, matchStrategy: n }) => { const o = n || 'any', i = n => (null == n ? void 0 : n[e]) && !r.checkIfMatchByStrategy(null == n ? void 0 : n[e], t, o); return { any: { enter: (e, t) => { r.filter(e, t, i); } } }; }; }, 8623: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.FilterOut = void 0); const r = n(1988); t.FilterOut = ({ property: e, value: t, matchStrategy: n }) => { const o = n || 'any', i = n => r.checkIfMatchByStrategy(null == n ? void 0 : n[e], t, o); return { any: { enter: (e, t) => { r.filter(e, t, i); } } }; }; }, 4555: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.InfoDescriptionOverride = void 0); const r = n(771); t.InfoDescriptionOverride = ({ filePath: e }) => ({ Info: { leave(t, { report: n, location: o }) { if (!e) throw new Error( 'Parameter "filePath" is not provided for "info-description-override" rule' ); try { t.description = r.readFileAsStringSync(e); } catch (e) { n({ message: \`Failed to read markdown override file for "info.description".\\n\${e.message}\`, location: o.child('description') }); } } } }); }, 7802: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.OperationDescriptionOverride = void 0); const r = n(771); t.OperationDescriptionOverride = ({ operationIds: e }) => ({ Operation: { leave(t, { report: n, location: o }) { if (!t.operationId) return; if (!e) throw new Error( 'Parameter "operationIds" is not provided for "operation-description-override" rule' ); const i = t.operationId; if (e[i]) try { t.description = r.readFileAsStringSync(e[i]); } catch (e) { n({ message: \`Failed to read markdown override file for operation "\${i}".\\n\${e.message}\`, location: o.child('operationId').key() }); } } } }); }, 2287: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.RegistryDependencies = void 0); const r = n(1094); t.RegistryDependencies = () => { let e = new Set(); return { DefinitionRoot: { leave(t, n) { n.getVisitorData().links = Array.from(e); } }, ref(t) { if (t.$ref) { const n = t.$ref.split('#/')[0]; r.isRedoclyRegistryURL(n) && e.add(n); } } }; }; }, 5830: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.RemoveXInternal = void 0); const r = n(771), o = n(7468); t.RemoveXInternal = ({ internalFlagProperty: e }) => { const t = e || 'x-internal'; return { any: { enter: (e, n) => { !(function (e, n) { var i, a, s, l; const { parent: c, key: u } = n; let p = !1; if (Array.isArray(e)) for (let r = 0; r < e.length; r++) o.isRef(e[r]) && (null === (i = n.resolve(e[r]).node) || void 0 === i ? void 0 : i[t]) && (e.splice(r, 1), (p = !0), r--), (null === (a = e[r]) || void 0 === a ? void 0 : a[t]) && (e.splice(r, 1), (p = !0), r--); else if (r.isPlainObject(e)) for (const r of Object.keys(e)) o.isRef(e[r]) && (null === (s = n.resolve(e[r]).node) || void 0 === s ? void 0 : s[t]) && (delete e[r], (p = !0)), (null === (l = e[r]) || void 0 === l ? void 0 : l[t]) && (delete e[r], (p = !0)); p && (r.isEmptyObject(e) || r.isEmptyArray(e)) && delete c[u]; })(e, n); } } }; }; }, 423: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.TagDescriptionOverride = void 0); const r = n(771); t.TagDescriptionOverride = ({ tagNames: e }) => ({ Tag: { leave(t, { report: n }) { if (!e) throw new Error( 'Parameter "tagNames" is not provided for "tag-description-override" rule' ); if (e[t.name]) try { t.description = r.readFileAsStringSync(e[t.name]); } catch (e) { n({ message: \`Failed to read markdown override file for tag "\${t.name}".\\n\${e.message}\` }); } } } }); }, 7060: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.decorators = void 0); const r = n(2287), o = n(7802), i = n(423), a = n(4555), s = n(5830), l = n(9244), c = n(8623); t.decorators = { 'registry-dependencies': r.RegistryDependencies, 'operation-description-override': o.OperationDescriptionOverride, 'tag-description-override': i.TagDescriptionOverride, 'info-description-override': a.InfoDescriptionOverride, 'remove-x-internal': s.RemoveXInternal, 'filter-in': l.FilterIn, 'filter-out': c.FilterOut }; }, 1753: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.decorators = void 0); const r = n(2287), o = n(7802), i = n(423), a = n(4555), s = n(5830), l = n(9244), c = n(8623); t.decorators = { 'registry-dependencies': r.RegistryDependencies, 'operation-description-override': o.OperationDescriptionOverride, 'tag-description-override': i.TagDescriptionOverride, 'info-description-override': a.InfoDescriptionOverride, 'remove-x-internal': s.RemoveXInternal, 'filter-in': l.FilterIn, 'filter-out': c.FilterOut }; }, 5273: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.stringifyYaml = t.parseYaml = void 0); const r = n(3320), o = r.JSON_SCHEMA.extend({ implicit: [r.types.merge], explicit: [ r.types.binary, r.types.omap, r.types.pairs, r.types.set ] }); (t.parseYaml = (e, t) => r.load(e, Object.assign({ schema: o }, t))), (t.stringifyYaml = (e, t) => r.dump(e, t)); }, 1510: function (e, t) { 'use strict'; var n, r; Object.defineProperty(t, '__esModule', { value: !0 }), (t.openAPIMajor = t.detectOpenAPI = t.OasMajorVersion = t.OasVersion = void 0), (function (e) { (e.Version2 = 'oas2'), (e.Version3_0 = 'oas3_0'), (e.Version3_1 = 'oas3_1'); })((n = t.OasVersion || (t.OasVersion = {}))), (function (e) { (e.Version2 = 'oas2'), (e.Version3 = 'oas3'); })((r = t.OasMajorVersion || (t.OasMajorVersion = {}))), (t.detectOpenAPI = function (e) { if ('object' != typeof e) throw new Error( 'Document must be JSON object, got ' + typeof e ); if (!e.openapi && !e.swagger) throw new Error( 'This doesn\u2019t look like an OpenAPI document.\\n' ); if (e.openapi && 'string' != typeof e.openapi) throw new Error( \`Invalid OpenAPI version: should be a string but got "\${typeof e.openapi}"\` ); if (e.openapi && e.openapi.startsWith('3.0')) return n.Version3_0; if (e.openapi && e.openapi.startsWith('3.1')) return n.Version3_1; if (e.swagger && '2.0' === e.swagger) return n.Version2; throw new Error( \`Unsupported OpenAPI Version: \${e.openapi || e.swagger}\` ); }), (t.openAPIMajor = function (e) { return e === n.Version2 ? r.Version2 : r.Version3; }); }, 1094: function (e, t, n) { 'use strict'; var r = (this && this.__awaiter) || function (e, t, n, r) { return new (n || (n = Promise))(function (o, i) { function a(e) { try { l(r.next(e)); } catch (e) { i(e); } } function s(e) { try { l(r.throw(e)); } catch (e) { i(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((r = r.apply(e, t || [])).next()); }); }; Object.defineProperty(t, '__esModule', { value: !0 }), (t.isRedoclyRegistryURL = t.RedoclyClient = void 0); const o = n(2116), i = n(6470), a = n(6918), s = n(8836), l = n(1390), c = n(3777), u = n(771), p = '.redocly-config.json'; (t.RedoclyClient = class { constructor(e) { (this.accessTokens = {}), (this.region = this.loadRegion(e)), this.loadTokens(), (this.domain = e ? c.DOMAINS[e] : c.env.REDOCLY_DOMAIN || c.DOMAINS[c.DEFAULT_REGION]), (c.env.REDOCLY_DOMAIN = this.domain), (this.registryApi = new l.RegistryApi( this.accessTokens, this.region )); } loadRegion(e) { if (e && !c.DOMAINS[e]) throw new Error( \`Invalid argument: region in config file.\\nGiven: \${s.green( e )}, choices: "us", "eu".\` ); return c.env.REDOCLY_DOMAIN ? c.AVAILABLE_REGIONS.find( e => c.DOMAINS[e] === c.env.REDOCLY_DOMAIN ) || c.DEFAULT_REGION : e || c.DEFAULT_REGION; } getRegion() { return this.region; } hasTokens() { return u.isNotEmptyObject(this.accessTokens); } hasToken() { return !!this.accessTokens[this.region]; } getAuthorizationHeader() { return r(this, void 0, void 0, function* () { return this.accessTokens[this.region]; }); } setAccessTokens(e) { this.accessTokens = e; } loadTokens() { const e = i.resolve(a.homedir(), p), t = this.readCredentialsFile(e); u.isNotEmptyObject(t) && this.setAccessTokens( Object.assign( Object.assign({}, t), t.token && !t[this.region] && { [this.region]: t.token } ) ), c.env.REDOCLY_AUTHORIZATION && this.setAccessTokens( Object.assign(Object.assign({}, this.accessTokens), { [this.region]: c.env.REDOCLY_AUTHORIZATION }) ); } getAllTokens() { return Object.entries(this.accessTokens) .filter(([e]) => c.AVAILABLE_REGIONS.includes(e)) .map(([e, t]) => ({ region: e, token: t })); } getValidTokens() { return r(this, void 0, void 0, function* () { const e = this.getAllTokens(), t = yield Promise.allSettled( e.map(({ token: e, region: t }) => this.verifyToken(e, t)) ); return e .filter((e, n) => 'fulfilled' === t[n].status) .map(({ token: e, region: t }) => ({ token: e, region: t, valid: !0 })); }); } getTokens() { return r(this, void 0, void 0, function* () { return this.hasTokens() ? yield this.getValidTokens() : []; }); } isAuthorizedWithRedoclyByRegion() { return r(this, void 0, void 0, function* () { if (!this.hasTokens()) return !1; const e = this.accessTokens[this.region]; if (!e) return !1; try { return yield this.verifyToken(e, this.region), !0; } catch (e) { return !1; } }); } isAuthorizedWithRedocly() { return r(this, void 0, void 0, function* () { return ( this.hasTokens() && u.isNotEmptyObject(yield this.getValidTokens()) ); }); } readCredentialsFile(e) { return o.existsSync(e) ? JSON.parse(o.readFileSync(e, 'utf-8')) : {}; } verifyToken(e, t, n = !1) { return r(this, void 0, void 0, function* () { return this.registryApi.authStatus(e, t, n); }); } login(e, t = !1) { return r(this, void 0, void 0, function* () { const n = i.resolve(a.homedir(), p); try { yield this.verifyToken(e, this.region, t); } catch (e) { throw new Error( 'Authorization failed. Please check if you entered a valid API key.' ); } const r = Object.assign( Object.assign({}, this.readCredentialsFile(n)), { [this.region]: e, token: e } ); (this.accessTokens = r), this.registryApi.setAccessTokens(r), o.writeFileSync(n, JSON.stringify(r, null, 2)); }); } logout() { const e = i.resolve(a.homedir(), p); o.existsSync(e) && o.unlinkSync(e); } }), (t.isRedoclyRegistryURL = function (e) { const t = c.env.REDOCLY_DOMAIN || c.DOMAINS[c.DEFAULT_REGION], n = 'redocly.com' === t ? 'redoc.ly' : t; return !( !e.startsWith(\`https://api.\${t}/registry/\`) && !e.startsWith(\`https://api.\${n}/registry/\`) ); }); }, 1390: function (e, t, n) { 'use strict'; var r = (this && this.__awaiter) || function (e, t, n, r) { return new (n || (n = Promise))(function (o, i) { function a(e) { try { l(r.next(e)); } catch (e) { i(e); } } function s(e) { try { l(r.throw(e)); } catch (e) { i(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((r = r.apply(e, t || [])).next()); }); }; Object.defineProperty(t, '__esModule', { value: !0 }), (t.RegistryApi = void 0); const o = n(8150), i = n(3777), a = n(771), s = n(3244).i8; t.RegistryApi = class { constructor(e, t) { (this.accessTokens = e), (this.region = t); } get accessToken() { return ( a.isNotEmptyObject(this.accessTokens) && this.accessTokens[this.region] ); } getBaseUrl(e = i.DEFAULT_REGION) { return \`https://api.\${i.DOMAINS[e]}/registry\`; } setAccessTokens(e) { return (this.accessTokens = e), this; } request(e = '', t = {}, n) { return r(this, void 0, void 0, function* () { const r = Object.assign({}, t.headers || {}, { 'x-redocly-cli-version': s }); if (!r.hasOwnProperty('authorization')) throw new Error('Unauthorized'); const i = yield o.default( \`\${this.getBaseUrl(n)}\${e}\`, Object.assign({}, t, { headers: r }) ); if (401 === i.status) throw new Error('Unauthorized'); if (404 === i.status) { const e = yield i.json(); throw new Error(e.code); } return i; }); } authStatus(e, t, n = !1) { return r(this, void 0, void 0, function* () { try { const n = yield this.request( '', { headers: { authorization: e } }, t ); return yield n.json(); } catch (e) { throw (n && console.log(e), e); } }); } prepareFileUpload({ organizationId: e, name: t, version: n, filesHash: o, filename: i, isUpsert: a }) { return r(this, void 0, void 0, function* () { const r = yield this.request( \`/\${e}/\${t}/\${n}/prepare-file-upload\`, { method: 'POST', headers: { 'content-type': 'application/json', authorization: this.accessToken }, body: JSON.stringify({ filesHash: o, filename: i, isUpsert: a }) }, this.region ); if (r.ok) return r.json(); throw new Error('Could not prepare file upload'); }); } pushApi({ organizationId: e, name: t, version: n, rootFilePath: o, filePaths: i, branch: a, isUpsert: s, isPublic: l, batchId: c, batchSize: u }) { return r(this, void 0, void 0, function* () { if ( !(yield this.request( \`/\${e}/\${t}/\${n}\`, { method: 'PUT', headers: { 'content-type': 'application/json', authorization: this.accessToken }, body: JSON.stringify({ rootFilePath: o, filePaths: i, branch: a, isUpsert: s, isPublic: l, batchId: c, batchSize: u }) }, this.region )).ok ) throw new Error('Could not push api'); }); } }; }, 7468: function (e, t) { 'use strict'; function n(e, t) { return ( '' === e && (e = '#/'), '/' === e[e.length - 1] ? e + t : e + '/' + t ); } Object.defineProperty(t, '__esModule', { value: !0 }), (t.isMappingRef = t.isAbsoluteUrl = t.refBaseName = t.pointerBaseName = t.parsePointer = t.parseRef = t.escapePointer = t.unescapePointer = t.Location = t.isRef = t.joinPointer = void 0), (t.joinPointer = n), (t.isRef = function (e) { return e && 'string' == typeof e.$ref; }); class r { constructor(e, t) { (this.source = e), (this.pointer = t); } child(e) { return new r( this.source, n(this.pointer, (Array.isArray(e) ? e : [e]).map(i).join('/')) ); } key() { return Object.assign(Object.assign({}, this), { reportOnKey: !0 }); } get absolutePointer() { return ( this.source.absoluteRef + ('#/' === this.pointer ? '' : this.pointer) ); } } function o(e) { return decodeURIComponent( e.replace(/~1/g, '/').replace(/~0/g, '~') ); } function i(e) { return 'number' == typeof e ? e : e.replace(/~/g, '~0').replace(/\\//g, '~1'); } (t.Location = r), (t.unescapePointer = o), (t.escapePointer = i), (t.parseRef = function (e) { const [t, n] = e.split('#/'); return { uri: t || null, pointer: n ? n.split('/').map(o).filter(Boolean) : [] }; }), (t.parsePointer = function (e) { return e.substr(2).split('/').map(o); }), (t.pointerBaseName = function (e) { const t = e.split('/'); return t[t.length - 1]; }), (t.refBaseName = function (e) { const t = e.split(/[\\/\\\\]/); return t[t.length - 1].replace(/\\.[^.]+$/, ''); }), (t.isAbsoluteUrl = function (e) { return e.startsWith('http://') || e.startsWith('https://'); }), (t.isMappingRef = function (e) { return ( e.startsWith('#') || e.startsWith('https://') || e.startsWith('http://') || e.startsWith('./') || e.startsWith('../') || e.indexOf('/') > -1 ); }); }, 4182: function (e, t, n) { 'use strict'; var r = (this && this.__awaiter) || function (e, t, n, r) { return new (n || (n = Promise))(function (o, i) { function a(e) { try { l(r.next(e)); } catch (e) { i(e); } } function s(e) { try { l(r.throw(e)); } catch (e) { i(e); } } function l(e) { var t; e.done ? o(e.value) : ((t = e.value), t instanceof n ? t : new n(function (e) { e(t); })).then(a, s); } l((r = r.apply(e, t || [])).next()); }); }; Object.defineProperty(t, '__esModule', { value: !0 }), (t.resolveDocument = t.BaseResolver = t.makeDocumentFromString = t.makeRefId = t.YamlParseError = t.ResolveError = t.Source = void 0); const o = n(3197), i = n(6470), a = n(7468), s = n(5220), l = n(771); class c { constructor(e, t, n) { (this.absoluteRef = e), (this.body = t), (this.mimeType = n); } getAst(e) { var t; return ( void 0 === this._ast && ((this._ast = null !== (t = e(this.body, { filename: this.absoluteRef })) && void 0 !== t ? t : void 0), this._ast && 0 === this._ast.kind && '' === this._ast.value && 1 !== this._ast.startPosition && ((this._ast.startPosition = 1), (this._ast.endPosition = 1))), this._ast ); } getLines() { return ( void 0 === this._lines && (this._lines = this.body.split(/\\r\\n|[\\n\\r]/g)), this._lines ); } } t.Source = c; class u extends Error { constructor(e) { super(e.message), (this.originalError = e), Object.setPrototypeOf(this, u.prototype); } } t.ResolveError = u; const p = /\\((\\d+):(\\d+)\\)$/; class d extends Error { constructor(e, t) { super(e.message.split('\\n')[0]), (this.originalError = e), (this.source = t), Object.setPrototypeOf(this, d.prototype); const [, n, r] = this.message.match(p) || []; (this.line = parseInt(n, 10)), (this.col = parseInt(r, 10)); } } function f(e, t) { return e + '::' + t; } function h(e, t) { return { prev: e, node: t }; } (t.YamlParseError = d), (t.makeRefId = f), (t.makeDocumentFromString = function (e, t) { const n = new c(t, e); try { return { source: n, parsed: l.parseYaml(e, { filename: t }) }; } catch (e) { throw new d(e, n); } }), (t.BaseResolver = class { constructor(e = { http: { headers: [] } }) { (this.config = e), (this.cache = new Map()); } getFiles() { return new Set(Array.from(this.cache.keys())); } resolveExternalRef(e, t) { return a.isAbsoluteUrl(t) ? t : e && a.isAbsoluteUrl(e) ? new URL(t, e).href : i.resolve(e ? i.dirname(e) : process.cwd(), t); } loadExternalRef(e) { return r(this, void 0, void 0, function* () { try { if (a.isAbsoluteUrl(e)) { const { body: t, mimeType: n } = yield l.readFileFromUrl( e, this.config.http ); return new c(e, t, n); } return new c(e, yield o.promises.readFile(e, 'utf-8')); } catch (e) { throw new u(e); } }); } parseDocument(e, t = !1) { var n; const r = e.absoluteRef.substr(e.absoluteRef.lastIndexOf('.')); if ( !['.json', '.json', '.yml', '.yaml'].includes(r) && !(null === (n = e.mimeType) || void 0 === n ? void 0 : n.match(/(json|yaml|openapi)/)) && !t ) return { source: e, parsed: e.body }; try { return { source: e, parsed: l.parseYaml(e.body, { filename: e.absoluteRef }) }; } catch (t) { throw new d(t, e); } } resolveDocument(e, t, n = !1) { return r(this, void 0, void 0, function* () { const r = this.resolveExternalRef(e, t), o = this.cache.get(r); if (o) return o; const i = this.loadExternalRef(r).then(e => this.parseDocument(e, n)