From a9fa945903f410e0c6e2239c5b058265e4ff1b7e Mon Sep 17 00:00:00 2001 From: Wolfgang Werner Date: Tue, 9 Jul 2024 12:06:58 +0200 Subject: [PATCH] Go back to minified version --- about.json | 2 +- assets/rapidoc.js | 20474 -------------------------------------------- 2 files changed, 1 insertion(+), 20475 deletions(-) delete mode 100644 assets/rapidoc.js diff --git a/about.json b/about.json index 6920173..1cbcf9f 100644 --- a/about.json +++ b/about.json @@ -2,7 +2,7 @@ "about_url": "https://github.com/wwerner/discourse-rapidoc-theme-component", "license_url": "https://github.com/wwerner/discourse-rapidoc-theme-component/blob/main/LICENSE", "assets": { - "rapidoc_js": "assets/rapidoc.js" + "rapidoc_js": "assets/rapidoc-9.3.4.min.js" }, "name": "Discourse Rapidoc", "component": true diff --git a/assets/rapidoc.js b/assets/rapidoc.js deleted file mode 100644 index d4e5f34..0000000 --- a/assets/rapidoc.js +++ /dev/null @@ -1,20474 +0,0 @@ - -/** -* @preserve -* RapiDoc 9.3.5-beta - WebComponent to View OpenAPI docs -* License: MIT -* Repo : https://github.com/rapi-doc/RapiDoc -* Author : Mrinmoy Majumdar -*/ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 656: -/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => { - -"use strict"; - -// UNUSED EXPORTS: JsonSchemaViewer, OAuthReceiver, RapiDocMini, default - -;// CONCATENATED MODULE: ./node_modules/@lit/reactive-element/css-tag.js -/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ -const css_tag_t=window,e=css_tag_t.ShadowRoot&&(void 0===css_tag_t.ShadyCSS||css_tag_t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),n=new WeakMap;class o{constructor(t,e,n){if(this._$cssResult$=!0,n!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new o("string"==typeof t?t:t+"",void 0,s),i=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[n+1]),t[0]);return new o(n,t,s)},S=(s,n)=>{e?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),o=css_tag_t.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=e.cssText,s.appendChild(n)}))},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t; -//# sourceMappingURL=css-tag.js.map - -;// CONCATENATED MODULE: ./node_modules/@lit/reactive-element/reactive-element.js - -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */var reactive_element_s;const reactive_element_e=window,reactive_element_r=reactive_element_e.trustedTypes,h=reactive_element_r?reactive_element_r.emptyScript:"",reactive_element_o=reactive_element_e.reactiveElementPolyfillSupport,reactive_element_n={toAttribute(t,i){switch(i){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},a=(t,i)=>i!==t&&(i==i||t==t),l={attribute:!0,type:String,converter:reactive_element_n,reflect:!1,hasChanged:a},d="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),t}static createProperty(t,i=l){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l}static finalize(){if(this.hasOwnProperty(d))return!1;this[d]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(c(i))}else void 0!==i&&s.push(c(i));return s}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return S(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$EO(t,i,s=l){var e;const r=this.constructor._$Ep(t,s);if(void 0!==r&&!0===s.reflect){const h=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:reactive_element_n).toAttribute(i,s.type);this._$El=t,null==h?this.removeAttribute(r):this.setAttribute(r,h),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,r=e._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=e.getPropertyOptions(r),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:reactive_element_n;this._$El=r,this[r]=h.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||a)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}u[d]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==reactive_element_o||reactive_element_o({ReactiveElement:u}),(null!==(reactive_element_s=reactive_element_e.reactiveElementVersions)&&void 0!==reactive_element_s?reactive_element_s:reactive_element_e.reactiveElementVersions=[]).push("1.6.2"); -//# sourceMappingURL=reactive-element.js.map - -;// CONCATENATED MODULE: ./node_modules/lit-html/lit-html.js -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ -var lit_html_t;const lit_html_i=window,lit_html_s=lit_html_i.trustedTypes,lit_html_e=lit_html_s?lit_html_s.createPolicy("lit-html",{createHTML:t=>t}):void 0,lit_html_o="$lit$",lit_html_n=`lit$${(Math.random()+"").slice(9)}$`,lit_html_l="?"+lit_html_n,lit_html_h=`<${lit_html_l}>`,lit_html_r=document,lit_html_d=()=>lit_html_r.createComment(""),lit_html_u=t=>null===t||"object"!=typeof t&&"function"!=typeof t,lit_html_c=Array.isArray,v=t=>lit_html_c(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),lit_html_a="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${lit_html_a}(?:([^\\s"'>=/]+)(${lit_html_a}*=${lit_html_a}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,w=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),lit_html_x=w(1),b=w(2),T=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),E=new WeakMap,C=lit_html_r.createTreeWalker(lit_html_r,129,null,!1),P=(t,i)=>{const s=t.length-1,l=[];let r,d=2===i?"":"",u=f;for(let i=0;i"===c[0]?(u=null!=r?r:f,v=-1):void 0===c[1]?v=-2:(v=u.lastIndex-c[2].length,e=c[1],u=void 0===c[3]?p:'"'===c[3]?$:g):u===$||u===g?u=p:u===_||u===m?u=f:(u=p,r=void 0);const w=u===p&&t[i+1].startsWith("/>")?" ":"";d+=u===f?s+lit_html_h:v>=0?(l.push(e),s.slice(0,v)+lit_html_o+s.slice(v)+lit_html_n+w):s+lit_html_n+(-2===v?(l.push(void 0),i):w)}const c=d+(t[s]||"")+(2===i?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==lit_html_e?lit_html_e.createHTML(c):c,l]};class V{constructor({strings:t,_$litType$:i},e){let h;this.parts=[];let r=0,u=0;const c=t.length-1,v=this.parts,[a,f]=P(t,i);if(this.el=V.createElement(a,e),C.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(h=C.nextNode())&&v.length0){h.textContent=lit_html_s?lit_html_s.emptyScript:"";for(let s=0;s2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=N(this,t,i,0),n=!lit_html_u(t)||t!==this._$AH&&t!==T,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new M(i.insertBefore(lit_html_d(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l}; -//# sourceMappingURL=lit-html.js.map - -;// CONCATENATED MODULE: ./node_modules/lit-element/lit-element.js - -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */var lit_element_l,lit_element_o;const lit_element_r=(/* unused pure expression or super */ null && (t));class lit_element_s extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return T}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(lit_element_l=globalThis.litElementHydrateSupport)||void 0===lit_element_l||lit_element_l.call(globalThis,{LitElement:lit_element_s});const lit_element_n=globalThis.litElementPolyfillSupport;null==lit_element_n||lit_element_n({LitElement:lit_element_s});const lit_element_h={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(lit_element_o=globalThis.litElementVersions)&&void 0!==lit_element_o?lit_element_o:globalThis.litElementVersions=[]).push("3.3.2"); -//# sourceMappingURL=lit-element.js.map - -;// CONCATENATED MODULE: ./node_modules/lit/index.js - -//# sourceMappingURL=index.js.map - -;// CONCATENATED MODULE: ./node_modules/marked/lib/marked.esm.js -/** - * marked v5.1.0 - a markdown parser - * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) - * https://github.com/markedjs/marked - */ - -/** - * DO NOT EDIT THIS FILE - * The code in this file is generated from files in ./src/ - */ - -function getDefaults() { - return { - async: false, - baseUrl: null, - breaks: false, - extensions: null, - gfm: true, - headerIds: true, - headerPrefix: '', - highlight: null, - hooks: null, - langPrefix: 'language-', - mangle: true, - pedantic: false, - renderer: null, - sanitize: false, - sanitizer: null, - silent: false, - smartypants: false, - tokenizer: null, - walkTokens: null, - xhtml: false - }; -} - -let defaults = getDefaults(); - -function changeDefaults(newDefaults) { - defaults = newDefaults; -} - -/** - * Helpers - */ -const escapeTest = /[&<>"']/; -const escapeReplace = new RegExp(escapeTest.source, 'g'); -const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/; -const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g'); -const escapeReplacements = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' -}; -const getEscapeReplacement = (ch) => escapeReplacements[ch]; -function marked_esm_escape(html, encode) { - if (encode) { - if (escapeTest.test(html)) { - return html.replace(escapeReplace, getEscapeReplacement); - } - } else { - if (escapeTestNoEncode.test(html)) { - return html.replace(escapeReplaceNoEncode, getEscapeReplacement); - } - } - - return html; -} - -const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; - -/** - * @param {string} html - */ -function marked_esm_unescape(html) { - // explicitly match decimal, hex, and named HTML entities - return html.replace(unescapeTest, (_, n) => { - n = n.toLowerCase(); - if (n === 'colon') return ':'; - if (n.charAt(0) === '#') { - return n.charAt(1) === 'x' - ? String.fromCharCode(parseInt(n.substring(2), 16)) - : String.fromCharCode(+n.substring(1)); - } - return ''; - }); -} - -const caret = /(^|[^\[])\^/g; - -/** - * @param {string | RegExp} regex - * @param {string} opt - */ -function edit(regex, opt) { - regex = typeof regex === 'string' ? regex : regex.source; - opt = opt || ''; - const obj = { - replace: (name, val) => { - val = val.source || val; - val = val.replace(caret, '$1'); - regex = regex.replace(name, val); - return obj; - }, - getRegex: () => { - return new RegExp(regex, opt); - } - }; - return obj; -} - -const nonWordAndColonTest = /[^\w:]/g; -const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; - -/** - * @param {boolean} sanitize - * @param {string} base - * @param {string} href - */ -function cleanUrl(sanitize, base, href) { - if (sanitize) { - let prot; - try { - prot = decodeURIComponent(marked_esm_unescape(href)) - .replace(nonWordAndColonTest, '') - .toLowerCase(); - } catch (e) { - return null; - } - if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) { - return null; - } - } - if (base && !originIndependentUrl.test(href)) { - href = resolveUrl(base, href); - } - try { - href = encodeURI(href).replace(/%25/g, '%'); - } catch (e) { - return null; - } - return href; -} - -const baseUrls = {}; -const justDomain = /^[^:]+:\/*[^/]*$/; -const protocol = /^([^:]+:)[\s\S]*$/; -const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/; - -/** - * @param {string} base - * @param {string} href - */ -function resolveUrl(base, href) { - if (!baseUrls[' ' + base]) { - // we can ignore everything in base after the last slash of its path component, - // but we might need to add _that_ - // https://tools.ietf.org/html/rfc3986#section-3 - if (justDomain.test(base)) { - baseUrls[' ' + base] = base + '/'; - } else { - baseUrls[' ' + base] = rtrim(base, '/', true); - } - } - base = baseUrls[' ' + base]; - const relativeBase = base.indexOf(':') === -1; - - if (href.substring(0, 2) === '//') { - if (relativeBase) { - return href; - } - return base.replace(protocol, '$1') + href; - } else if (href.charAt(0) === '/') { - if (relativeBase) { - return href; - } - return base.replace(domain, '$1') + href; - } else { - return base + href; - } -} - -const noopTest = { exec: function noopTest() {} }; - -function splitCells(tableRow, count) { - // ensure that every cell-delimiting pipe has a space - // before it to distinguish it from an escaped pipe - const row = tableRow.replace(/\|/g, (match, offset, str) => { - let escaped = false, - curr = offset; - while (--curr >= 0 && str[curr] === '\\') escaped = !escaped; - if (escaped) { - // odd number of slashes means | is escaped - // so we leave it alone - return '|'; - } else { - // add space before unescaped | - return ' |'; - } - }), - cells = row.split(/ \|/); - let i = 0; - - // First/last cell in a row cannot be empty if it has no leading/trailing pipe - if (!cells[0].trim()) { cells.shift(); } - if (cells.length > 0 && !cells[cells.length - 1].trim()) { cells.pop(); } - - if (cells.length > count) { - cells.splice(count); - } else { - while (cells.length < count) cells.push(''); - } - - for (; i < cells.length; i++) { - // leading or trailing whitespace is ignored per the gfm spec - cells[i] = cells[i].trim().replace(/\\\|/g, '|'); - } - return cells; -} - -/** - * Remove trailing 'c's. Equivalent to str.replace(/c*$/, ''). - * /c*$/ is vulnerable to REDOS. - * - * @param {string} str - * @param {string} c - * @param {boolean} invert Remove suffix of non-c chars instead. Default falsey. - */ -function rtrim(str, c, invert) { - const l = str.length; - if (l === 0) { - return ''; - } - - // Length of suffix matching the invert condition. - let suffLen = 0; - - // Step left until we fail to match the invert condition. - while (suffLen < l) { - const currChar = str.charAt(l - suffLen - 1); - if (currChar === c && !invert) { - suffLen++; - } else if (currChar !== c && invert) { - suffLen++; - } else { - break; - } - } - - return str.slice(0, l - suffLen); -} - -function findClosingBracket(str, b) { - if (str.indexOf(b[1]) === -1) { - return -1; - } - const l = str.length; - let level = 0, - i = 0; - for (; i < l; i++) { - if (str[i] === '\\') { - i++; - } else if (str[i] === b[0]) { - level++; - } else if (str[i] === b[1]) { - level--; - if (level < 0) { - return i; - } - } - } - return -1; -} - -function checkDeprecations(opt, callback) { - if (!opt || opt.silent) { - return; - } - - if (callback) { - console.warn('marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async'); - } - - if (opt.sanitize || opt.sanitizer) { - console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options'); - } - - if (opt.highlight || opt.langPrefix !== 'language-') { - console.warn('marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.'); - } - - if (opt.mangle) { - console.warn('marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.'); - } - - if (opt.baseUrl) { - console.warn('marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.'); - } - - if (opt.smartypants) { - console.warn('marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.'); - } - - if (opt.xhtml) { - console.warn('marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.'); - } - - if (opt.headerIds || opt.headerPrefix) { - console.warn('marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.'); - } -} - -function outputLink(cap, link, raw, lexer) { - const href = link.href; - const title = link.title ? marked_esm_escape(link.title) : null; - const text = cap[1].replace(/\\([\[\]])/g, '$1'); - - if (cap[0].charAt(0) !== '!') { - lexer.state.inLink = true; - const token = { - type: 'link', - raw, - href, - title, - text, - tokens: lexer.inlineTokens(text) - }; - lexer.state.inLink = false; - return token; - } - return { - type: 'image', - raw, - href, - title, - text: marked_esm_escape(text) - }; -} - -function indentCodeCompensation(raw, text) { - const matchIndentToCode = raw.match(/^(\s+)(?:```)/); - - if (matchIndentToCode === null) { - return text; - } - - const indentToCode = matchIndentToCode[1]; - - return text - .split('\n') - .map(node => { - const matchIndentInNode = node.match(/^\s+/); - if (matchIndentInNode === null) { - return node; - } - - const [indentInNode] = matchIndentInNode; - - if (indentInNode.length >= indentToCode.length) { - return node.slice(indentToCode.length); - } - - return node; - }) - .join('\n'); -} - -/** - * Tokenizer - */ -class Tokenizer { - constructor(options) { - this.options = options || defaults; - } - - space(src) { - const cap = this.rules.block.newline.exec(src); - if (cap && cap[0].length > 0) { - return { - type: 'space', - raw: cap[0] - }; - } - } - - code(src) { - const cap = this.rules.block.code.exec(src); - if (cap) { - const text = cap[0].replace(/^ {1,4}/gm, ''); - return { - type: 'code', - raw: cap[0], - codeBlockStyle: 'indented', - text: !this.options.pedantic - ? rtrim(text, '\n') - : text - }; - } - } - - fences(src) { - const cap = this.rules.block.fences.exec(src); - if (cap) { - const raw = cap[0]; - const text = indentCodeCompensation(raw, cap[3] || ''); - - return { - type: 'code', - raw, - lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2], - text - }; - } - } - - heading(src) { - const cap = this.rules.block.heading.exec(src); - if (cap) { - let text = cap[2].trim(); - - // remove trailing #s - if (/#$/.test(text)) { - const trimmed = rtrim(text, '#'); - if (this.options.pedantic) { - text = trimmed.trim(); - } else if (!trimmed || / $/.test(trimmed)) { - // CommonMark requires space before trailing #s - text = trimmed.trim(); - } - } - - return { - type: 'heading', - raw: cap[0], - depth: cap[1].length, - text, - tokens: this.lexer.inline(text) - }; - } - } - - hr(src) { - const cap = this.rules.block.hr.exec(src); - if (cap) { - return { - type: 'hr', - raw: cap[0] - }; - } - } - - blockquote(src) { - const cap = this.rules.block.blockquote.exec(src); - if (cap) { - const text = cap[0].replace(/^ *>[ \t]?/gm, ''); - const top = this.lexer.state.top; - this.lexer.state.top = true; - const tokens = this.lexer.blockTokens(text); - this.lexer.state.top = top; - return { - type: 'blockquote', - raw: cap[0], - tokens, - text - }; - } - } - - list(src) { - let cap = this.rules.block.list.exec(src); - if (cap) { - let raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, - line, nextLine, rawLine, itemContents, endEarly; - - let bull = cap[1].trim(); - const isordered = bull.length > 1; - - const list = { - type: 'list', - raw: '', - ordered: isordered, - start: isordered ? +bull.slice(0, -1) : '', - loose: false, - items: [] - }; - - bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`; - - if (this.options.pedantic) { - bull = isordered ? bull : '[*+-]'; - } - - // Get next list item - const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`); - - // Check if current bullet point can start a new List Item - while (src) { - endEarly = false; - if (!(cap = itemRegex.exec(src))) { - break; - } - - if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?) - break; - } - - raw = cap[0]; - src = src.substring(raw.length); - - line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length)); - nextLine = src.split('\n', 1)[0]; - - if (this.options.pedantic) { - indent = 2; - itemContents = line.trimLeft(); - } else { - indent = cap[2].search(/[^ ]/); // Find first non-space char - indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent - itemContents = line.slice(indent); - indent += cap[1].length; - } - - blankLine = false; - - if (!line && /^ *$/.test(nextLine)) { // Items begin with at most one blank line - raw += nextLine + '\n'; - src = src.substring(nextLine.length + 1); - endEarly = true; - } - - if (!endEarly) { - const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`); - const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`); - const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`); - const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`); - - // Check if following lines should be included in List Item - while (src) { - rawLine = src.split('\n', 1)[0]; - nextLine = rawLine; - - // Re-align to follow commonmark nesting rules - if (this.options.pedantic) { - nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' '); - } - - // End list item if found code fences - if (fencesBeginRegex.test(nextLine)) { - break; - } - - // End list item if found start of new heading - if (headingBeginRegex.test(nextLine)) { - break; - } - - // End list item if found start of new bullet - if (nextBulletRegex.test(nextLine)) { - break; - } - - // Horizontal rule found - if (hrRegex.test(src)) { - break; - } - - if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible - itemContents += '\n' + nextLine.slice(indent); - } else { - // not enough indentation - if (blankLine) { - break; - } - - // paragraph continuation unless last line was a different block level element - if (line.search(/[^ ]/) >= 4) { // indented code block - break; - } - if (fencesBeginRegex.test(line)) { - break; - } - if (headingBeginRegex.test(line)) { - break; - } - if (hrRegex.test(line)) { - break; - } - - itemContents += '\n' + nextLine; - } - - if (!blankLine && !nextLine.trim()) { // Check if current line is blank - blankLine = true; - } - - raw += rawLine + '\n'; - src = src.substring(rawLine.length + 1); - line = nextLine.slice(indent); - } - } - - if (!list.loose) { - // If the previous item ended with a blank line, the list is loose - if (endsWithBlankLine) { - list.loose = true; - } else if (/\n *\n *$/.test(raw)) { - endsWithBlankLine = true; - } - } - - // Check for task list items - if (this.options.gfm) { - istask = /^\[[ xX]\] /.exec(itemContents); - if (istask) { - ischecked = istask[0] !== '[ ] '; - itemContents = itemContents.replace(/^\[[ xX]\] +/, ''); - } - } - - list.items.push({ - type: 'list_item', - raw, - task: !!istask, - checked: ischecked, - loose: false, - text: itemContents - }); - - list.raw += raw; - } - - // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic - list.items[list.items.length - 1].raw = raw.trimRight(); - list.items[list.items.length - 1].text = itemContents.trimRight(); - list.raw = list.raw.trimRight(); - - const l = list.items.length; - - // Item child tokens handled here at end because we needed to have the final item to trim it first - for (i = 0; i < l; i++) { - this.lexer.state.top = false; - list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []); - - if (!list.loose) { - // Check if list should be loose - const spacers = list.items[i].tokens.filter(t => t.type === 'space'); - const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw)); - - list.loose = hasMultipleLineBreaks; - } - } - - // Set all items to loose if list is loose - if (list.loose) { - for (i = 0; i < l; i++) { - list.items[i].loose = true; - } - } - - return list; - } - } - - html(src) { - const cap = this.rules.block.html.exec(src); - if (cap) { - const token = { - type: 'html', - block: true, - raw: cap[0], - pre: !this.options.sanitizer - && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), - text: cap[0] - }; - if (this.options.sanitize) { - const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : marked_esm_escape(cap[0]); - token.type = 'paragraph'; - token.text = text; - token.tokens = this.lexer.inline(text); - } - return token; - } - } - - def(src) { - const cap = this.rules.block.def.exec(src); - if (cap) { - const tag = cap[1].toLowerCase().replace(/\s+/g, ' '); - const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : ''; - const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3]; - return { - type: 'def', - tag, - raw: cap[0], - href, - title - }; - } - } - - table(src) { - const cap = this.rules.block.table.exec(src); - if (cap) { - const item = { - type: 'table', - header: splitCells(cap[1]).map(c => { return { text: c }; }), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : [] - }; - - if (item.header.length === item.align.length) { - item.raw = cap[0]; - - let l = item.align.length; - let i, j, k, row; - for (i = 0; i < l; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - l = item.rows.length; - for (i = 0; i < l; i++) { - item.rows[i] = splitCells(item.rows[i], item.header.length).map(c => { return { text: c }; }); - } - - // parse child tokens inside headers and cells - - // header child tokens - l = item.header.length; - for (j = 0; j < l; j++) { - item.header[j].tokens = this.lexer.inline(item.header[j].text); - } - - // cell child tokens - l = item.rows.length; - for (j = 0; j < l; j++) { - row = item.rows[j]; - for (k = 0; k < row.length; k++) { - row[k].tokens = this.lexer.inline(row[k].text); - } - } - - return item; - } - } - } - - lheading(src) { - const cap = this.rules.block.lheading.exec(src); - if (cap) { - return { - type: 'heading', - raw: cap[0], - depth: cap[2].charAt(0) === '=' ? 1 : 2, - text: cap[1], - tokens: this.lexer.inline(cap[1]) - }; - } - } - - paragraph(src) { - const cap = this.rules.block.paragraph.exec(src); - if (cap) { - const text = cap[1].charAt(cap[1].length - 1) === '\n' - ? cap[1].slice(0, -1) - : cap[1]; - return { - type: 'paragraph', - raw: cap[0], - text, - tokens: this.lexer.inline(text) - }; - } - } - - text(src) { - const cap = this.rules.block.text.exec(src); - if (cap) { - return { - type: 'text', - raw: cap[0], - text: cap[0], - tokens: this.lexer.inline(cap[0]) - }; - } - } - - escape(src) { - const cap = this.rules.inline.escape.exec(src); - if (cap) { - return { - type: 'escape', - raw: cap[0], - text: marked_esm_escape(cap[1]) - }; - } - } - - tag(src) { - const cap = this.rules.inline.tag.exec(src); - if (cap) { - if (!this.lexer.state.inLink && /^/i.test(cap[0])) { - this.lexer.state.inLink = false; - } - if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { - this.lexer.state.inRawBlock = true; - } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { - this.lexer.state.inRawBlock = false; - } - - return { - type: this.options.sanitize - ? 'text' - : 'html', - raw: cap[0], - inLink: this.lexer.state.inLink, - inRawBlock: this.lexer.state.inRawBlock, - block: false, - text: this.options.sanitize - ? (this.options.sanitizer - ? this.options.sanitizer(cap[0]) - : marked_esm_escape(cap[0])) - : cap[0] - }; - } - } - - link(src) { - const cap = this.rules.inline.link.exec(src); - if (cap) { - const trimmedUrl = cap[2].trim(); - if (!this.options.pedantic && /^$/.test(trimmedUrl))) { - return; - } - - // ending angle bracket cannot be escaped - const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\'); - if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { - return; - } - } else { - // find closing parenthesis - const lastParenIndex = findClosingBracket(cap[2], '()'); - if (lastParenIndex > -1) { - const start = cap[0].indexOf('!') === 0 ? 5 : 4; - const linkLen = start + cap[1].length + lastParenIndex; - cap[2] = cap[2].substring(0, lastParenIndex); - cap[0] = cap[0].substring(0, linkLen).trim(); - cap[3] = ''; - } - } - let href = cap[2]; - let title = ''; - if (this.options.pedantic) { - // split pedantic href and title - const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); - - if (link) { - href = link[1]; - title = link[3]; - } - } else { - title = cap[3] ? cap[3].slice(1, -1) : ''; - } - - href = href.trim(); - if (/^$/.test(trimmedUrl))) { - // pedantic allows starting angle bracket without ending angle bracket - href = href.slice(1); - } else { - href = href.slice(1, -1); - } - } - return outputLink(cap, { - href: href ? href.replace(this.rules.inline._escapes, '$1') : href, - title: title ? title.replace(this.rules.inline._escapes, '$1') : title - }, cap[0], this.lexer); - } - } - - reflink(src, links) { - let cap; - if ((cap = this.rules.inline.reflink.exec(src)) - || (cap = this.rules.inline.nolink.exec(src))) { - let link = (cap[2] || cap[1]).replace(/\s+/g, ' '); - link = links[link.toLowerCase()]; - if (!link) { - const text = cap[0].charAt(0); - return { - type: 'text', - raw: text, - text - }; - } - return outputLink(cap, link, cap[0], this.lexer); - } - } - - emStrong(src, maskedSrc, prevChar = '') { - let match = this.rules.inline.emStrong.lDelim.exec(src); - if (!match) return; - - // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well - if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return; - - const nextChar = match[1] || match[2] || ''; - - if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) { - const lLength = match[0].length - 1; - let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0; - - const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd; - endReg.lastIndex = 0; - - // Clip maskedSrc to same section of string as src (move to lexer?) - maskedSrc = maskedSrc.slice(-1 * src.length + lLength); - - while ((match = endReg.exec(maskedSrc)) != null) { - rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6]; - - if (!rDelim) continue; // skip single * in __abc*abc__ - - rLength = rDelim.length; - - if (match[3] || match[4]) { // found another Left Delim - delimTotal += rLength; - continue; - } else if (match[5] || match[6]) { // either Left or Right Delim - if (lLength % 3 && !((lLength + rLength) % 3)) { - midDelimTotal += rLength; - continue; // CommonMark Emphasis Rules 9-10 - } - } - - delimTotal -= rLength; - - if (delimTotal > 0) continue; // Haven't found enough closing delimiters - - // Remove extra characters. *a*** -> *a* - rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); - - const raw = src.slice(0, lLength + match.index + rLength + 1); - - // Create `em` if smallest delimiter has odd char count. *a*** - if (Math.min(lLength, rLength) % 2) { - const text = raw.slice(1, -1); - return { - type: 'em', - raw, - text, - tokens: this.lexer.inlineTokens(text) - }; - } - - // Create 'strong' if smallest delimiter has even char count. **a*** - const text = raw.slice(2, -2); - return { - type: 'strong', - raw, - text, - tokens: this.lexer.inlineTokens(text) - }; - } - } - } - - codespan(src) { - const cap = this.rules.inline.code.exec(src); - if (cap) { - let text = cap[2].replace(/\n/g, ' '); - const hasNonSpaceChars = /[^ ]/.test(text); - const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text); - if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { - text = text.substring(1, text.length - 1); - } - text = marked_esm_escape(text, true); - return { - type: 'codespan', - raw: cap[0], - text - }; - } - } - - br(src) { - const cap = this.rules.inline.br.exec(src); - if (cap) { - return { - type: 'br', - raw: cap[0] - }; - } - } - - del(src) { - const cap = this.rules.inline.del.exec(src); - if (cap) { - return { - type: 'del', - raw: cap[0], - text: cap[2], - tokens: this.lexer.inlineTokens(cap[2]) - }; - } - } - - autolink(src, mangle) { - const cap = this.rules.inline.autolink.exec(src); - if (cap) { - let text, href; - if (cap[2] === '@') { - text = marked_esm_escape(this.options.mangle ? mangle(cap[1]) : cap[1]); - href = 'mailto:' + text; - } else { - text = marked_esm_escape(cap[1]); - href = text; - } - - return { - type: 'link', - raw: cap[0], - text, - href, - tokens: [ - { - type: 'text', - raw: text, - text - } - ] - }; - } - } - - url(src, mangle) { - let cap; - if (cap = this.rules.inline.url.exec(src)) { - let text, href; - if (cap[2] === '@') { - text = marked_esm_escape(this.options.mangle ? mangle(cap[0]) : cap[0]); - href = 'mailto:' + text; - } else { - // do extended autolink path validation - let prevCapZero; - do { - prevCapZero = cap[0]; - cap[0] = this.rules.inline._backpedal.exec(cap[0])[0]; - } while (prevCapZero !== cap[0]); - text = marked_esm_escape(cap[0]); - if (cap[1] === 'www.') { - href = 'http://' + cap[0]; - } else { - href = cap[0]; - } - } - return { - type: 'link', - raw: cap[0], - text, - href, - tokens: [ - { - type: 'text', - raw: text, - text - } - ] - }; - } - } - - inlineText(src, smartypants) { - const cap = this.rules.inline.text.exec(src); - if (cap) { - let text; - if (this.lexer.state.inRawBlock) { - text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : marked_esm_escape(cap[0])) : cap[0]; - } else { - text = marked_esm_escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]); - } - return { - type: 'text', - raw: cap[0], - text - }; - } - } -} - -/** - * Block-Level Grammar - */ -const block = { - newline: /^(?: *(?:\n|$))+/, - code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, - fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, - hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, - heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, - blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, - list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/, - html: '^ {0,3}(?:' // optional indentation - + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' // (1) - + '|comment[^\\n]*(\\n+|$)' // (2) - + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3) - + '|\\n*|$)' // (4) - + '|\\n*|$)' // (5) - + '|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6) - + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag - + '|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag - + ')', - def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/, - table: noopTest, - lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, - // regex template, placeholders will be replaced according to different paragraph - // interruption rules of commonmark and the original markdown spec: - _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, - text: /^[^\n]+/ -}; - -block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/; -block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; -block.def = edit(block.def) - .replace('label', block._label) - .replace('title', block._title) - .getRegex(); - -block.bullet = /(?:[*+-]|\d{1,9}[.)])/; -block.listItemStart = edit(/^( *)(bull) */) - .replace('bull', block.bullet) - .getRegex(); - -block.list = edit(block.list) - .replace(/bull/g, block.bullet) - .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))') - .replace('def', '\\n+(?=' + block.def.source + ')') - .getRegex(); - -block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' - + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' - + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' - + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' - + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' - + '|track|ul'; -block._comment = /|$)/; -block.html = edit(block.html, 'i') - .replace('comment', block._comment) - .replace('tag', block._tag) - .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) - .getRegex(); - -block.lheading = edit(block.lheading) - .replace(/bull/g, block.bullet) // lists can interrupt - .getRegex(); - -block.paragraph = edit(block._paragraph) - .replace('hr', block.hr) - .replace('heading', ' {0,3}#{1,6} ') - .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs - .replace('|table', '') - .replace('blockquote', ' {0,3}>') - .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') - .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt - .replace('html', ')|<(?:script|pre|style|textarea|!--)') - .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks - .getRegex(); - -block.blockquote = edit(block.blockquote) - .replace('paragraph', block.paragraph) - .getRegex(); - -/** - * Normal Block Grammar - */ - -block.normal = { ...block }; - -/** - * GFM Block Grammar - */ - -block.gfm = { - ...block.normal, - table: '^ *([^\\n ].*\\|.*)\\n' // Header - + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align - + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells -}; - -block.gfm.table = edit(block.gfm.table) - .replace('hr', block.hr) - .replace('heading', ' {0,3}#{1,6} ') - .replace('blockquote', ' {0,3}>') - .replace('code', ' {4}[^\\n]') - .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') - .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt - .replace('html', ')|<(?:script|pre|style|textarea|!--)') - .replace('tag', block._tag) // tables can be interrupted by type (6) html blocks - .getRegex(); - -block.gfm.paragraph = edit(block._paragraph) - .replace('hr', block.hr) - .replace('heading', ' {0,3}#{1,6} ') - .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs - .replace('table', block.gfm.table) // interrupt paragraphs with table - .replace('blockquote', ' {0,3}>') - .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') - .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt - .replace('html', ')|<(?:script|pre|style|textarea|!--)') - .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks - .getRegex(); -/** - * Pedantic grammar (original John Gruber's loose markdown specification) - */ - -block.pedantic = { - ...block.normal, - html: edit( - '^ *(?:comment *(?:\\n|\\s*$)' - + '|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' // closed tag - + '|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))') - .replace('comment', block._comment) - .replace(/tag/g, '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' - + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' - + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') - .getRegex(), - def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, - heading: /^(#{1,6})(.*)(?:\n+|$)/, - fences: noopTest, // fences not supported - lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, - paragraph: edit(block.normal._paragraph) - .replace('hr', block.hr) - .replace('heading', ' *#{1,6} *[^\n]') - .replace('lheading', block.lheading) - .replace('blockquote', ' {0,3}>') - .replace('|fences', '') - .replace('|list', '') - .replace('|html', '') - .getRegex() -}; - -/** - * Inline-Level Grammar - */ -const inline = { - escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, - autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, - url: noopTest, - tag: '^comment' - + '|^' // self-closing tag - + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag - + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. - + '|^' // declaration, e.g. - + '|^', // CDATA section - link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/, - reflink: /^!?\[(label)\]\[(ref)\]/, - nolink: /^!?\[(ref)\](?:\[\])?/, - reflinkSearch: 'reflink|nolink(?!\\()', - emStrong: { - lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, - // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right. - // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a - rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/, - rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/ // ^- Not allowed for _ - }, - code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, - br: /^( {2,}|\\)\n(?!\s*$)/, - del: noopTest, - text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`^|~'; -inline.punctuation = edit(inline.punctuation, 'u').replace(/punctuation/g, inline._punctuation).getRegex(); - -// sequences em should skip over [title](link), `code`, -inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g; -inline.anyPunctuation = /\\[punct]/g; -inline._escapes = /\\([punct])/g; - -inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex(); - -inline.emStrong.lDelim = edit(inline.emStrong.lDelim, 'u') - .replace(/punct/g, inline._punctuation) - .getRegex(); - -inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'gu') - .replace(/punct/g, inline._punctuation) - .getRegex(); - -inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'gu') - .replace(/punct/g, inline._punctuation) - .getRegex(); - -inline.anyPunctuation = edit(inline.anyPunctuation, 'gu') - .replace(/punct/g, inline._punctuation) - .getRegex(); - -inline._escapes = edit(inline._escapes, 'gu') - .replace(/punct/g, inline._punctuation) - .getRegex(); - -inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; -inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; -inline.autolink = edit(inline.autolink) - .replace('scheme', inline._scheme) - .replace('email', inline._email) - .getRegex(); - -inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; - -inline.tag = edit(inline.tag) - .replace('comment', inline._comment) - .replace('attribute', inline._attribute) - .getRegex(); - -inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; -inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/; -inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; - -inline.link = edit(inline.link) - .replace('label', inline._label) - .replace('href', inline._href) - .replace('title', inline._title) - .getRegex(); - -inline.reflink = edit(inline.reflink) - .replace('label', inline._label) - .replace('ref', block._label) - .getRegex(); - -inline.nolink = edit(inline.nolink) - .replace('ref', block._label) - .getRegex(); - -inline.reflinkSearch = edit(inline.reflinkSearch, 'g') - .replace('reflink', inline.reflink) - .replace('nolink', inline.nolink) - .getRegex(); - -/** - * Normal Inline Grammar - */ - -inline.normal = { ...inline }; - -/** - * Pedantic Inline Grammar - */ - -inline.pedantic = { - ...inline.normal, - strong: { - start: /^__|\*\*/, - middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - endAst: /\*\*(?!\*)/g, - endUnd: /__(?!_)/g - }, - em: { - start: /^_|\*/, - middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/, - endAst: /\*(?!\*)/g, - endUnd: /_(?!_)/g - }, - link: edit(/^!?\[(label)\]\((.*?)\)/) - .replace('label', inline._label) - .getRegex(), - reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/) - .replace('label', inline._label) - .getRegex() -}; - -/** - * GFM Inline Grammar - */ - -inline.gfm = { - ...inline.normal, - escape: edit(inline.escape).replace('])', '~|])').getRegex(), - _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, - url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, - _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, - del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, - text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ 0.5) { - ch = 'x' + ch.toString(16); - } - out += '&#' + ch + ';'; - } - - return out; -} - -/** - * Block Lexer - */ -class Lexer { - constructor(options) { - this.tokens = []; - this.tokens.links = Object.create(null); - this.options = options || defaults; - this.options.tokenizer = this.options.tokenizer || new Tokenizer(); - this.tokenizer = this.options.tokenizer; - this.tokenizer.options = this.options; - this.tokenizer.lexer = this; - this.inlineQueue = []; - this.state = { - inLink: false, - inRawBlock: false, - top: true - }; - - const rules = { - block: block.normal, - inline: inline.normal - }; - - if (this.options.pedantic) { - rules.block = block.pedantic; - rules.inline = inline.pedantic; - } else if (this.options.gfm) { - rules.block = block.gfm; - if (this.options.breaks) { - rules.inline = inline.breaks; - } else { - rules.inline = inline.gfm; - } - } - this.tokenizer.rules = rules; - } - - /** - * Expose Rules - */ - static get rules() { - return { - block, - inline - }; - } - - /** - * Static Lex Method - */ - static lex(src, options) { - const lexer = new Lexer(options); - return lexer.lex(src); - } - - /** - * Static Lex Inline Method - */ - static lexInline(src, options) { - const lexer = new Lexer(options); - return lexer.inlineTokens(src); - } - - /** - * Preprocessing - */ - lex(src) { - src = src - .replace(/\r\n|\r/g, '\n'); - - this.blockTokens(src, this.tokens); - - let next; - while (next = this.inlineQueue.shift()) { - this.inlineTokens(next.src, next.tokens); - } - - return this.tokens; - } - - /** - * Lexing - */ - blockTokens(src, tokens = []) { - if (this.options.pedantic) { - src = src.replace(/\t/g, ' ').replace(/^ +$/gm, ''); - } else { - src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => { - return leading + ' '.repeat(tabs.length); - }); - } - - let token, lastToken, cutSrc, lastParagraphClipped; - - while (src) { - if (this.options.extensions - && this.options.extensions.block - && this.options.extensions.block.some((extTokenizer) => { - if (token = extTokenizer.call({ lexer: this }, src, tokens)) { - src = src.substring(token.raw.length); - tokens.push(token); - return true; - } - return false; - })) { - continue; - } - - // newline - if (token = this.tokenizer.space(src)) { - src = src.substring(token.raw.length); - if (token.raw.length === 1 && tokens.length > 0) { - // if there's a single \n as a spacer, it's terminating the last line, - // so move it there so that we don't get unecessary paragraph tags - tokens[tokens.length - 1].raw += '\n'; - } else { - tokens.push(token); - } - continue; - } - - // code - if (token = this.tokenizer.code(src)) { - src = src.substring(token.raw.length); - lastToken = tokens[tokens.length - 1]; - // An indented code block cannot interrupt a paragraph. - if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) { - lastToken.raw += '\n' + token.raw; - lastToken.text += '\n' + token.text; - this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; - } else { - tokens.push(token); - } - continue; - } - - // fences - if (token = this.tokenizer.fences(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // heading - if (token = this.tokenizer.heading(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // hr - if (token = this.tokenizer.hr(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // blockquote - if (token = this.tokenizer.blockquote(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // list - if (token = this.tokenizer.list(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // html - if (token = this.tokenizer.html(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // def - if (token = this.tokenizer.def(src)) { - src = src.substring(token.raw.length); - lastToken = tokens[tokens.length - 1]; - if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) { - lastToken.raw += '\n' + token.raw; - lastToken.text += '\n' + token.raw; - this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; - } else if (!this.tokens.links[token.tag]) { - this.tokens.links[token.tag] = { - href: token.href, - title: token.title - }; - } - continue; - } - - // table (gfm) - if (token = this.tokenizer.table(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // lheading - if (token = this.tokenizer.lheading(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // top-level paragraph - // prevent paragraph consuming extensions by clipping 'src' to extension start - cutSrc = src; - if (this.options.extensions && this.options.extensions.startBlock) { - let startIndex = Infinity; - const tempSrc = src.slice(1); - let tempStart; - this.options.extensions.startBlock.forEach(function(getStartIndex) { - tempStart = getStartIndex.call({ lexer: this }, tempSrc); - if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); } - }); - if (startIndex < Infinity && startIndex >= 0) { - cutSrc = src.substring(0, startIndex + 1); - } - } - if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) { - lastToken = tokens[tokens.length - 1]; - if (lastParagraphClipped && lastToken.type === 'paragraph') { - lastToken.raw += '\n' + token.raw; - lastToken.text += '\n' + token.text; - this.inlineQueue.pop(); - this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; - } else { - tokens.push(token); - } - lastParagraphClipped = (cutSrc.length !== src.length); - src = src.substring(token.raw.length); - continue; - } - - // text - if (token = this.tokenizer.text(src)) { - src = src.substring(token.raw.length); - lastToken = tokens[tokens.length - 1]; - if (lastToken && lastToken.type === 'text') { - lastToken.raw += '\n' + token.raw; - lastToken.text += '\n' + token.text; - this.inlineQueue.pop(); - this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; - } else { - tokens.push(token); - } - continue; - } - - if (src) { - const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); - if (this.options.silent) { - console.error(errMsg); - break; - } else { - throw new Error(errMsg); - } - } - } - - this.state.top = true; - return tokens; - } - - inline(src, tokens = []) { - this.inlineQueue.push({ src, tokens }); - return tokens; - } - - /** - * Lexing/Compiling - */ - inlineTokens(src, tokens = []) { - let token, lastToken, cutSrc; - - // String with links masked to avoid interference with em and strong - let maskedSrc = src; - let match; - let keepPrevChar, prevChar; - - // Mask out reflinks - if (this.tokens.links) { - const links = Object.keys(this.tokens.links); - if (links.length > 0) { - while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { - if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) { - maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); - } - } - } - } - // Mask out other blocks - while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { - maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); - } - - // Mask out escaped characters - while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) { - maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); - } - - while (src) { - if (!keepPrevChar) { - prevChar = ''; - } - keepPrevChar = false; - - // extensions - if (this.options.extensions - && this.options.extensions.inline - && this.options.extensions.inline.some((extTokenizer) => { - if (token = extTokenizer.call({ lexer: this }, src, tokens)) { - src = src.substring(token.raw.length); - tokens.push(token); - return true; - } - return false; - })) { - continue; - } - - // escape - if (token = this.tokenizer.escape(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // tag - if (token = this.tokenizer.tag(src)) { - src = src.substring(token.raw.length); - lastToken = tokens[tokens.length - 1]; - if (lastToken && token.type === 'text' && lastToken.type === 'text') { - lastToken.raw += token.raw; - lastToken.text += token.text; - } else { - tokens.push(token); - } - continue; - } - - // link - if (token = this.tokenizer.link(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // reflink, nolink - if (token = this.tokenizer.reflink(src, this.tokens.links)) { - src = src.substring(token.raw.length); - lastToken = tokens[tokens.length - 1]; - if (lastToken && token.type === 'text' && lastToken.type === 'text') { - lastToken.raw += token.raw; - lastToken.text += token.text; - } else { - tokens.push(token); - } - continue; - } - - // em & strong - if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // code - if (token = this.tokenizer.codespan(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // br - if (token = this.tokenizer.br(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // del (gfm) - if (token = this.tokenizer.del(src)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // autolink - if (token = this.tokenizer.autolink(src, mangle)) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // url (gfm) - if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) { - src = src.substring(token.raw.length); - tokens.push(token); - continue; - } - - // text - // prevent inlineText consuming extensions by clipping 'src' to extension start - cutSrc = src; - if (this.options.extensions && this.options.extensions.startInline) { - let startIndex = Infinity; - const tempSrc = src.slice(1); - let tempStart; - this.options.extensions.startInline.forEach(function(getStartIndex) { - tempStart = getStartIndex.call({ lexer: this }, tempSrc); - if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); } - }); - if (startIndex < Infinity && startIndex >= 0) { - cutSrc = src.substring(0, startIndex + 1); - } - } - if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { - src = src.substring(token.raw.length); - if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started - prevChar = token.raw.slice(-1); - } - keepPrevChar = true; - lastToken = tokens[tokens.length - 1]; - if (lastToken && lastToken.type === 'text') { - lastToken.raw += token.raw; - lastToken.text += token.text; - } else { - tokens.push(token); - } - continue; - } - - if (src) { - const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); - if (this.options.silent) { - console.error(errMsg); - break; - } else { - throw new Error(errMsg); - } - } - } - - return tokens; - } -} - -/** - * Renderer - */ -class Renderer { - constructor(options) { - this.options = options || defaults; - } - - code(code, infostring, escaped) { - const lang = (infostring || '').match(/\S*/)[0]; - if (this.options.highlight) { - const out = this.options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } - } - - code = code.replace(/\n$/, '') + '\n'; - - if (!lang) { - return '
'
-        + (escaped ? code : marked_esm_escape(code, true))
-        + '
\n'; - } - - return '
'
-      + (escaped ? code : marked_esm_escape(code, true))
-      + '
\n'; - } - - /** - * @param {string} quote - */ - blockquote(quote) { - return `
\n${quote}
\n`; - } - - html(html, block) { - return html; - } - - /** - * @param {string} text - * @param {string} level - * @param {string} raw - * @param {any} slugger - */ - heading(text, level, raw, slugger) { - if (this.options.headerIds) { - const id = this.options.headerPrefix + slugger.slug(raw); - return `${text}\n`; - } - - // ignore IDs - return `${text}\n`; - } - - hr() { - return this.options.xhtml ? '
\n' : '
\n'; - } - - list(body, ordered, start) { - const type = ordered ? 'ol' : 'ul', - startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; - return '<' + type + startatt + '>\n' + body + '\n'; - } - - /** - * @param {string} text - */ - listitem(text) { - return `
  • ${text}
  • \n`; - } - - checkbox(checked) { - return ' '; - } - - /** - * @param {string} text - */ - paragraph(text) { - return `

    ${text}

    \n`; - } - - /** - * @param {string} header - * @param {string} body - */ - table(header, body) { - if (body) body = `${body}`; - - return '\n' - + '\n' - + header - + '\n' - + body - + '
    \n'; - } - - /** - * @param {string} content - */ - tablerow(content) { - return `\n${content}\n`; - } - - tablecell(content, flags) { - const type = flags.header ? 'th' : 'td'; - const tag = flags.align - ? `<${type} align="${flags.align}">` - : `<${type}>`; - return tag + content + `\n`; - } - - /** - * span level renderer - * @param {string} text - */ - strong(text) { - return `${text}`; - } - - /** - * @param {string} text - */ - em(text) { - return `${text}`; - } - - /** - * @param {string} text - */ - codespan(text) { - return `${text}`; - } - - br() { - return this.options.xhtml ? '
    ' : '
    '; - } - - /** - * @param {string} text - */ - del(text) { - return `${text}`; - } - - /** - * @param {string} href - * @param {string} title - * @param {string} text - */ - link(href, title, text) { - href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); - if (href === null) { - return text; - } - let out = '
    '; - return out; - } - - /** - * @param {string} href - * @param {string} title - * @param {string} text - */ - image(href, title, text) { - href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); - if (href === null) { - return text; - } - - let out = `${text}' : '>'; - return out; - } - - text(text) { - return text; - } -} - -/** - * TextRenderer - * returns only the textual part of the token - */ -class TextRenderer { - // no need for block level renderers - strong(text) { - return text; - } - - em(text) { - return text; - } - - codespan(text) { - return text; - } - - del(text) { - return text; - } - - html(text) { - return text; - } - - text(text) { - return text; - } - - link(href, title, text) { - return '' + text; - } - - image(href, title, text) { - return '' + text; - } - - br() { - return ''; - } -} - -/** - * Slugger generates header id - */ -class Slugger { - constructor() { - this.seen = {}; - } - - /** - * @param {string} value - */ - serialize(value) { - return value - .toLowerCase() - .trim() - // remove html tags - .replace(/<[!\/a-z].*?>/ig, '') - // remove unwanted chars - .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '') - .replace(/\s/g, '-'); - } - - /** - * Finds the next safe (unique) slug to use - * @param {string} originalSlug - * @param {boolean} isDryRun - */ - getNextSafeSlug(originalSlug, isDryRun) { - let slug = originalSlug; - let occurenceAccumulator = 0; - if (this.seen.hasOwnProperty(slug)) { - occurenceAccumulator = this.seen[originalSlug]; - do { - occurenceAccumulator++; - slug = originalSlug + '-' + occurenceAccumulator; - } while (this.seen.hasOwnProperty(slug)); - } - if (!isDryRun) { - this.seen[originalSlug] = occurenceAccumulator; - this.seen[slug] = 0; - } - return slug; - } - - /** - * Convert string to unique id - * @param {object} [options] - * @param {boolean} [options.dryrun] Generates the next unique slug without - * updating the internal accumulator. - */ - slug(value, options = {}) { - const slug = this.serialize(value); - return this.getNextSafeSlug(slug, options.dryrun); - } -} - -/** - * Parsing & Compiling - */ -class Parser { - constructor(options) { - this.options = options || defaults; - this.options.renderer = this.options.renderer || new Renderer(); - this.renderer = this.options.renderer; - this.renderer.options = this.options; - this.textRenderer = new TextRenderer(); - this.slugger = new Slugger(); - } - - /** - * Static Parse Method - */ - static parse(tokens, options) { - const parser = new Parser(options); - return parser.parse(tokens); - } - - /** - * Static Parse Inline Method - */ - static parseInline(tokens, options) { - const parser = new Parser(options); - return parser.parseInline(tokens); - } - - /** - * Parse Loop - */ - parse(tokens, top = true) { - let out = '', - i, - j, - k, - l2, - l3, - row, - cell, - header, - body, - token, - ordered, - start, - loose, - itemBody, - item, - checked, - task, - checkbox, - ret; - - const l = tokens.length; - for (i = 0; i < l; i++) { - token = tokens[i]; - - // Run any renderer extensions - if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { - ret = this.options.extensions.renderers[token.type].call({ parser: this }, token); - if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) { - out += ret || ''; - continue; - } - } - - switch (token.type) { - case 'space': { - continue; - } - case 'hr': { - out += this.renderer.hr(); - continue; - } - case 'heading': { - out += this.renderer.heading( - this.parseInline(token.tokens), - token.depth, - marked_esm_unescape(this.parseInline(token.tokens, this.textRenderer)), - this.slugger); - continue; - } - case 'code': { - out += this.renderer.code(token.text, - token.lang, - token.escaped); - continue; - } - case 'table': { - header = ''; - - // header - cell = ''; - l2 = token.header.length; - for (j = 0; j < l2; j++) { - cell += this.renderer.tablecell( - this.parseInline(token.header[j].tokens), - { header: true, align: token.align[j] } - ); - } - header += this.renderer.tablerow(cell); - - body = ''; - l2 = token.rows.length; - for (j = 0; j < l2; j++) { - row = token.rows[j]; - - cell = ''; - l3 = row.length; - for (k = 0; k < l3; k++) { - cell += this.renderer.tablecell( - this.parseInline(row[k].tokens), - { header: false, align: token.align[k] } - ); - } - - body += this.renderer.tablerow(cell); - } - out += this.renderer.table(header, body); - continue; - } - case 'blockquote': { - body = this.parse(token.tokens); - out += this.renderer.blockquote(body); - continue; - } - case 'list': { - ordered = token.ordered; - start = token.start; - loose = token.loose; - l2 = token.items.length; - - body = ''; - for (j = 0; j < l2; j++) { - item = token.items[j]; - checked = item.checked; - task = item.task; - - itemBody = ''; - if (item.task) { - checkbox = this.renderer.checkbox(checked); - if (loose) { - if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') { - item.tokens[0].text = checkbox + ' ' + item.tokens[0].text; - if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') { - item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text; - } - } else { - item.tokens.unshift({ - type: 'text', - text: checkbox - }); - } - } else { - itemBody += checkbox; - } - } - - itemBody += this.parse(item.tokens, loose); - body += this.renderer.listitem(itemBody, task, checked); - } - - out += this.renderer.list(body, ordered, start); - continue; - } - case 'html': { - out += this.renderer.html(token.text, token.block); - continue; - } - case 'paragraph': { - out += this.renderer.paragraph(this.parseInline(token.tokens)); - continue; - } - case 'text': { - body = token.tokens ? this.parseInline(token.tokens) : token.text; - while (i + 1 < l && tokens[i + 1].type === 'text') { - token = tokens[++i]; - body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text); - } - out += top ? this.renderer.paragraph(body) : body; - continue; - } - - default: { - const errMsg = 'Token with "' + token.type + '" type was not found.'; - if (this.options.silent) { - console.error(errMsg); - return; - } else { - throw new Error(errMsg); - } - } - } - } - - return out; - } - - /** - * Parse Inline Tokens - */ - parseInline(tokens, renderer) { - renderer = renderer || this.renderer; - let out = '', - i, - token, - ret; - - const l = tokens.length; - for (i = 0; i < l; i++) { - token = tokens[i]; - - // Run any renderer extensions - if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { - ret = this.options.extensions.renderers[token.type].call({ parser: this }, token); - if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) { - out += ret || ''; - continue; - } - } - - switch (token.type) { - case 'escape': { - out += renderer.text(token.text); - break; - } - case 'html': { - out += renderer.html(token.text); - break; - } - case 'link': { - out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer)); - break; - } - case 'image': { - out += renderer.image(token.href, token.title, token.text); - break; - } - case 'strong': { - out += renderer.strong(this.parseInline(token.tokens, renderer)); - break; - } - case 'em': { - out += renderer.em(this.parseInline(token.tokens, renderer)); - break; - } - case 'codespan': { - out += renderer.codespan(token.text); - break; - } - case 'br': { - out += renderer.br(); - break; - } - case 'del': { - out += renderer.del(this.parseInline(token.tokens, renderer)); - break; - } - case 'text': { - out += renderer.text(token.text); - break; - } - default: { - const errMsg = 'Token with "' + token.type + '" type was not found.'; - if (this.options.silent) { - console.error(errMsg); - return; - } else { - throw new Error(errMsg); - } - } - } - } - return out; - } -} - -class Hooks { - constructor(options) { - this.options = options || defaults; - } - - static passThroughHooks = new Set([ - 'preprocess', - 'postprocess' - ]); - - /** - * Process markdown before marked - */ - preprocess(markdown) { - return markdown; - } - - /** - * Process HTML after marked is finished - */ - postprocess(html) { - return html; - } -} - -class Marked { - defaults = getDefaults(); - options = this.setOptions; - - parse = this.#parseMarkdown(Lexer.lex, Parser.parse); - parseInline = this.#parseMarkdown(Lexer.lexInline, Parser.parseInline); - - Parser = Parser; - parser = Parser.parse; - Renderer = Renderer; - TextRenderer = TextRenderer; - Lexer = Lexer; - lexer = Lexer.lex; - Tokenizer = Tokenizer; - Slugger = Slugger; - Hooks = Hooks; - - constructor(...args) { - this.use(...args); - } - - walkTokens(tokens, callback) { - let values = []; - for (const token of tokens) { - values = values.concat(callback.call(this, token)); - switch (token.type) { - case 'table': { - for (const cell of token.header) { - values = values.concat(this.walkTokens(cell.tokens, callback)); - } - for (const row of token.rows) { - for (const cell of row) { - values = values.concat(this.walkTokens(cell.tokens, callback)); - } - } - break; - } - case 'list': { - values = values.concat(this.walkTokens(token.items, callback)); - break; - } - default: { - if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) { // Walk any extensions - this.defaults.extensions.childTokens[token.type].forEach((childTokens) => { - values = values.concat(this.walkTokens(token[childTokens], callback)); - }); - } else if (token.tokens) { - values = values.concat(this.walkTokens(token.tokens, callback)); - } - } - } - } - return values; - } - - use(...args) { - const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} }; - - args.forEach((pack) => { - // copy options to new object - const opts = { ...pack }; - - // set async to true if it was set to true before - opts.async = this.defaults.async || opts.async || false; - - // ==-- Parse "addon" extensions --== // - if (pack.extensions) { - pack.extensions.forEach((ext) => { - if (!ext.name) { - throw new Error('extension name required'); - } - if (ext.renderer) { // Renderer extensions - const prevRenderer = extensions.renderers[ext.name]; - if (prevRenderer) { - // Replace extension with func to run new extension but fall back if false - extensions.renderers[ext.name] = function(...args) { - let ret = ext.renderer.apply(this, args); - if (ret === false) { - ret = prevRenderer.apply(this, args); - } - return ret; - }; - } else { - extensions.renderers[ext.name] = ext.renderer; - } - } - if (ext.tokenizer) { // Tokenizer Extensions - if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) { - throw new Error("extension level must be 'block' or 'inline'"); - } - if (extensions[ext.level]) { - extensions[ext.level].unshift(ext.tokenizer); - } else { - extensions[ext.level] = [ext.tokenizer]; - } - if (ext.start) { // Function to check for start of token - if (ext.level === 'block') { - if (extensions.startBlock) { - extensions.startBlock.push(ext.start); - } else { - extensions.startBlock = [ext.start]; - } - } else if (ext.level === 'inline') { - if (extensions.startInline) { - extensions.startInline.push(ext.start); - } else { - extensions.startInline = [ext.start]; - } - } - } - } - if (ext.childTokens) { // Child tokens to be visited by walkTokens - extensions.childTokens[ext.name] = ext.childTokens; - } - }); - opts.extensions = extensions; - } - - // ==-- Parse "overwrite" extensions --== // - if (pack.renderer) { - const renderer = this.defaults.renderer || new Renderer(this.defaults); - for (const prop in pack.renderer) { - const prevRenderer = renderer[prop]; - // Replace renderer with func to run extension, but fall back if false - renderer[prop] = (...args) => { - let ret = pack.renderer[prop].apply(renderer, args); - if (ret === false) { - ret = prevRenderer.apply(renderer, args); - } - return ret; - }; - } - opts.renderer = renderer; - } - if (pack.tokenizer) { - const tokenizer = this.defaults.tokenizer || new Tokenizer(this.defaults); - for (const prop in pack.tokenizer) { - const prevTokenizer = tokenizer[prop]; - // Replace tokenizer with func to run extension, but fall back if false - tokenizer[prop] = (...args) => { - let ret = pack.tokenizer[prop].apply(tokenizer, args); - if (ret === false) { - ret = prevTokenizer.apply(tokenizer, args); - } - return ret; - }; - } - opts.tokenizer = tokenizer; - } - - // ==-- Parse Hooks extensions --== // - if (pack.hooks) { - const hooks = this.defaults.hooks || new Hooks(); - for (const prop in pack.hooks) { - const prevHook = hooks[prop]; - if (Hooks.passThroughHooks.has(prop)) { - hooks[prop] = (arg) => { - if (this.defaults.async) { - return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then(ret => { - return prevHook.call(hooks, ret); - }); - } - - const ret = pack.hooks[prop].call(hooks, arg); - return prevHook.call(hooks, ret); - }; - } else { - hooks[prop] = (...args) => { - let ret = pack.hooks[prop].apply(hooks, args); - if (ret === false) { - ret = prevHook.apply(hooks, args); - } - return ret; - }; - } - } - opts.hooks = hooks; - } - - // ==-- Parse WalkTokens extensions --== // - if (pack.walkTokens) { - const walkTokens = this.defaults.walkTokens; - opts.walkTokens = function(token) { - let values = []; - values.push(pack.walkTokens.call(this, token)); - if (walkTokens) { - values = values.concat(walkTokens.call(this, token)); - } - return values; - }; - } - - this.defaults = { ...this.defaults, ...opts }; - }); - - return this; - } - - setOptions(opt) { - this.defaults = { ...this.defaults, ...opt }; - return this; - } - - #parseMarkdown(lexer, parser) { - return (src, opt, callback) => { - if (typeof opt === 'function') { - callback = opt; - opt = null; - } - - const origOpt = { ...opt }; - opt = { ...this.defaults, ...origOpt }; - const throwError = this.#onError(opt.silent, opt.async, callback); - - // throw error in case of non string input - if (typeof src === 'undefined' || src === null) { - return throwError(new Error('marked(): input parameter is undefined or null')); - } - if (typeof src !== 'string') { - return throwError(new Error('marked(): input parameter is of type ' - + Object.prototype.toString.call(src) + ', string expected')); - } - - checkDeprecations(opt, callback); - - if (opt.hooks) { - opt.hooks.options = opt; - } - - if (callback) { - const highlight = opt.highlight; - let tokens; - - try { - if (opt.hooks) { - src = opt.hooks.preprocess(src); - } - tokens = lexer(src, opt); - } catch (e) { - return throwError(e); - } - - const done = (err) => { - let out; - - if (!err) { - try { - if (opt.walkTokens) { - this.walkTokens(tokens, opt.walkTokens); - } - out = parser(tokens, opt); - if (opt.hooks) { - out = opt.hooks.postprocess(out); - } - } catch (e) { - err = e; - } - } - - opt.highlight = highlight; - - return err - ? throwError(err) - : callback(null, out); - }; - - if (!highlight || highlight.length < 3) { - return done(); - } - - delete opt.highlight; - - if (!tokens.length) return done(); - - let pending = 0; - this.walkTokens(tokens, (token) => { - if (token.type === 'code') { - pending++; - setTimeout(() => { - highlight(token.text, token.lang, (err, code) => { - if (err) { - return done(err); - } - if (code != null && code !== token.text) { - token.text = code; - token.escaped = true; - } - - pending--; - if (pending === 0) { - done(); - } - }); - }, 0); - } - }); - - if (pending === 0) { - done(); - } - - return; - } - - if (opt.async) { - return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src) - .then(src => lexer(src, opt)) - .then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens) - .then(tokens => parser(tokens, opt)) - .then(html => opt.hooks ? opt.hooks.postprocess(html) : html) - .catch(throwError); - } - - try { - if (opt.hooks) { - src = opt.hooks.preprocess(src); - } - const tokens = lexer(src, opt); - if (opt.walkTokens) { - this.walkTokens(tokens, opt.walkTokens); - } - let html = parser(tokens, opt); - if (opt.hooks) { - html = opt.hooks.postprocess(html); - } - return html; - } catch (e) { - return throwError(e); - } - }; - } - - #onError(silent, async, callback) { - return (e) => { - e.message += '\nPlease report this to https://github.com/markedjs/this.'; - - if (silent) { - const msg = '

    An error occurred:

    '
    -          + marked_esm_escape(e.message + '', true)
    -          + '
    '; - if (async) { - return Promise.resolve(msg); - } - if (callback) { - callback(null, msg); - return; - } - return msg; - } - - if (async) { - return Promise.reject(e); - } - if (callback) { - callback(e); - return; - } - throw e; - }; - } -} - -const markedInstance = new Marked(defaults); - -/** - * Marked - */ -function marked(src, opt, callback) { - return markedInstance.parse(src, opt, callback); -} - -/** - * Options - */ - -marked.options = -marked.setOptions = function(opt) { - markedInstance.setOptions(opt); - marked.defaults = markedInstance.defaults; - changeDefaults(marked.defaults); - return marked; -}; - -marked.getDefaults = getDefaults; - -marked.defaults = defaults; - -/** - * Use Extension - */ - -marked.use = function(...args) { - markedInstance.use(...args); - marked.defaults = markedInstance.defaults; - changeDefaults(marked.defaults); - return marked; -}; - -/** - * Run callback for every token - */ - -marked.walkTokens = function(tokens, callback) { - return markedInstance.walkTokens(tokens, callback); -}; - -/** - * Parse Inline - * @param {string} src - */ -marked.parseInline = markedInstance.parseInline; - -/** - * Expose - */ -marked.Parser = Parser; -marked.parser = Parser.parse; -marked.Renderer = Renderer; -marked.TextRenderer = TextRenderer; -marked.Lexer = Lexer; -marked.lexer = Lexer.lex; -marked.Tokenizer = Tokenizer; -marked.Slugger = Slugger; -marked.Hooks = Hooks; -marked.parse = marked; - -const options = marked.options; -const setOptions = marked.setOptions; -const use = marked.use; -const walkTokens = marked.walkTokens; -const parseInline = marked.parseInline; -const parse = (/* unused pure expression or super */ null && (marked)); -const parser = Parser.parse; -const lexer = Lexer.lex; - - - -// EXTERNAL MODULE: ./node_modules/prismjs/prism.js -var prism = __webpack_require__(660); -var prism_default = /*#__PURE__*/__webpack_require__.n(prism); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-css.js -var prism_css = __webpack_require__(251); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-yaml.js -var prism_yaml = __webpack_require__(358); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-go.js -var prism_go = __webpack_require__(46); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-java.js -var prism_java = __webpack_require__(503); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-json.js -var prism_json = __webpack_require__(277); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-bash.js -var prism_bash = __webpack_require__(874); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-python.js -var prism_python = __webpack_require__(366); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-http.js -var prism_http = __webpack_require__(57); -// EXTERNAL MODULE: ./node_modules/prismjs/components/prism-csharp.js -var prism_csharp = __webpack_require__(16); -;// CONCATENATED MODULE: ./src/styles/font-styles.js - -/* harmony default export */ const font_styles = (i` - .hover-bg:hover{ - background: var(--bg3); - } - ::selection { - background: var(--selection-bg); - color: var(--selection-fg); - } - .regular-font{ - font-family:var(--font-regular); - } - .mono-font { - font-family:var(--font-mono); - } - .title { - font-size: calc(var(--font-size-small) + 18px); - font-weight: normal - } - .sub-title{ font-size: 20px;} - .req-res-title { - font-family: var(--font-regular); - font-size: calc(var(--font-size-small) + 4px); - font-weight:bold; - margin-bottom:8px; - text-align:left; - } - .tiny-title { - font-size:calc(var(--font-size-small) + 1px); - font-weight:bold; - } - .regular-font-size { font-size: var(--font-size-regular); } - .small-font-size { font-size: var(--font-size-small); } - .upper { text-transform: uppercase; } - .primary-text{ color: var(--primary-color); } - .bold-text { font-weight:bold; } - .gray-text { color: var(--light-fg); } - .red-text {color: var(--red)} - .blue-text {color: var(--blue)} - .multiline { - overflow: scroll; - max-height: var(--resp-area-height, 400px); - color: var(--fg3); - } - .method-fg.put { color: var(--orange); } - .method-fg.post { color: var(--green); } - .method-fg.get { color: var(--blue); } - .method-fg.delete { color: var(--red); } - .method-fg.options, - .method-fg.head, - .method-fg.patch { - color: var(--yellow); - } - - h1{ font-family:var(--font-regular); font-size:28px; padding-top: 10px; letter-spacing:normal; font-weight:normal; } - h2{ font-family:var(--font-regular); font-size:24px; padding-top: 10px; letter-spacing:normal; font-weight:normal; } - h3{ font-family:var(--font-regular); font-size:18px; padding-top: 10px; letter-spacing:normal; font-weight:normal; } - h4{ font-family:var(--font-regular); font-size:16px; padding-top: 10px; letter-spacing:normal; font-weight:normal; } - h5{ font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; } - h6{ font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; } - - h1,h2,h3,h4,h5,h5{ - margin-block-end: 0.2em; - } - p { margin-block-start: 0.5em; } - a { color: var(--blue); cursor:pointer; } - a.inactive-link { - color:var(--fg); - text-decoration: none; - cursor:text; - } - - code, - pre { - margin: 0px; - font-family: var(--font-mono); - font-size: calc(var(--font-size-mono) - 1px); - } - - .m-markdown, - .m-markdown-small { - display:block; - } - - .m-markdown p, - .m-markdown span { - font-size: var(--font-size-regular); - line-height:calc(var(--font-size-regular) + 8px); - } - .m-markdown li { - font-size: var(--font-size-regular); - line-height:calc(var(--font-size-regular) + 10px); - } - - .m-markdown-small p, - .m-markdown-small span, - .m-markdown-small li { - font-size: var(--font-size-small); - line-height: calc(var(--font-size-small) + 6px); - } - .m-markdown-small li { - line-height: calc(var(--font-size-small) + 8px); - } - - .m-markdown p:not(:first-child) { - margin-block-start: 24px; - } - - .m-markdown-small p:not(:first-child) { - margin-block-start: 12px; - } - .m-markdown-small p:first-child { - margin-block-start: 0; - } - - .m-markdown p, - .m-markdown-small p { - margin-block-end: 0 - } - - .m-markdown code span { - font-size:var(--font-size-mono); - } - - .m-markdown-small code, - .m-markdown code { - padding: 1px 6px; - border-radius: 2px; - color: var(--inline-code-fg); - background-color: var(--bg3); - font-size: calc(var(--font-size-mono)); - line-height: 1.2; - } - - .m-markdown-small code { - font-size: calc(var(--font-size-mono) - 1px); - } - - .m-markdown-small pre, - .m-markdown pre { - white-space: pre-wrap; - overflow-x: auto; - line-height: normal; - border-radius: 2px; - border: 1px solid var(--code-border-color); - } - - .m-markdown pre { - padding: 12px; - background-color: var(--code-bg); - color:var(--code-fg); - } - - .m-markdown-small pre { - margin-top: 4px; - padding: 2px 4px; - background-color: var(--bg3); - color: var(--fg2); - } - - .m-markdown-small pre code, - .m-markdown pre code { - border:none; - padding:0; - } - - .m-markdown pre code { - color: var(--code-fg); - background-color: var(--code-bg); - background-color: transparent; - } - - .m-markdown-small pre code { - color: var(--fg2); - background-color: var(--bg3); - } - - .m-markdown ul, - .m-markdown ol { - padding-inline-start: 30px; - } - - .m-markdown-small ul, - .m-markdown-small ol { - padding-inline-start: 20px; - } - - .m-markdown-small a, - .m-markdown a { - color:var(--blue); - } - - .m-markdown-small img, - .m-markdown img { - max-width: 100%; - } - - /* Markdown table */ - - .m-markdown-small table, - .m-markdown table { - border-spacing: 0; - margin: 10px 0; - border-collapse: separate; - border: 1px solid var(--border-color); - border-radius: var(--border-radius); - font-size: calc(var(--font-size-small) + 1px); - line-height: calc(var(--font-size-small) + 4px); - max-width: 100%; - } - - .m-markdown-small table { - font-size: var(--font-size-small); - line-height: calc(var(--font-size-small) + 2px); - margin: 8px 0; - } - - .m-markdown-small td, - .m-markdown-small th, - .m-markdown td, - .m-markdown th { - vertical-align: top; - border-top: 1px solid var(--border-color); - line-height: calc(var(--font-size-small) + 4px); - } - - .m-markdown-small tr:first-child th, - .m-markdown tr:first-child th { - border-top: 0 none; - } - - .m-markdown th, - .m-markdown td { - padding: 10px 12px; - } - - .m-markdown-small th, - .m-markdown-small td { - padding: 8px 8px; - } - - .m-markdown th, - .m-markdown-small th { - font-weight: 600; - background-color: var(--bg2); - vertical-align: middle; - } - - .m-markdown-small table code { - font-size: calc(var(--font-size-mono) - 2px); - } - - .m-markdown table code { - font-size: calc(var(--font-size-mono) - 1px); - } - - .m-markdown blockquote, - .m-markdown-small blockquote { - margin-inline-start: 0; - margin-inline-end: 0; - border-left: 3px solid var(--border-color); - padding: 6px 0 6px 6px; - } - .m-markdown hr{ - border: 1px solid var(--border-color); - } -`); -;// CONCATENATED MODULE: ./src/styles/input-styles.js - - -/* eslint-disable max-len */ -/* harmony default export */ const input_styles = (i` -/* Button */ -.m-btn { - border-radius: var(--border-radius); - font-weight: 600; - display: inline-block; - padding: 6px 16px; - font-size: var(--font-size-small); - outline: 0; - line-height: 1; - text-align: center; - white-space: nowrap; - border: 2px solid var(--primary-color); - background-color:transparent; - transition: background-color 0.2s; - user-select: none; - cursor: pointer; - box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); -} -.m-btn.primary { - background-color: var(--primary-color); - color: var(--primary-color-invert); -} -.m-btn.thin-border { border-width: 1px; } -.m-btn.large { padding:8px 14px; } -.m-btn.small { padding:5px 12px; } -.m-btn.tiny { padding:5px 6px; } -.m-btn.circle { border-radius: 50%; } -.m-btn:hover { - background-color: var(--primary-color); - color: var(--primary-color-invert); -} -.m-btn.nav { border: 2px solid var(--nav-accent-color); } -.m-btn.nav:hover { - background-color: var(--nav-accent-color); -} -.m-btn:disabled{ - background-color: var(--bg3); - color: var(--fg3); - border-color: var(--fg3); - cursor: not-allowed; - opacity: 0.4; -} -.toolbar-btn{ - cursor: pointer; - padding: 4px; - margin:0 2px; - font-size: var(--font-size-small); - min-width: 50px; - color: var(--primary-color-invert); - border-radius: 2px; - border: none; - background-color: var(--primary-color); -} - -input, textarea, select, button, pre { - color:var(--fg); - outline: none; - background-color: var(--input-bg); - border: 1px solid var(--border-color); - border-radius: var(--border-radius); -} -button { - font-family: var(--font-regular); -} - -/* Form Inputs */ -pre, -select, -textarea, -input[type="file"], -input[type="text"], -input[type="password"] { - font-family: var(--font-mono); - font-weight: 400; - font-size: var(--font-size-small); - transition: border .2s; - padding: 6px 5px; -} - -select { - font-family: var(--font-regular); - padding: 5px 30px 5px 5px; - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E"); - background-position: calc(100% - 5px) center; - background-repeat: no-repeat; - background-size: 10px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - cursor: pointer; -} - -select:hover { - border-color: var(--primary-color); -} - -textarea::placeholder, -input[type="text"]::placeholder, -input[type="password"]::placeholder { - color: var(--placeholder-color); - opacity:1; -} - - -input[type="file"]{ - font-family: var(--font-regular); - padding:2px; - cursor:pointer; - border: 1px solid var(--primary-color); - min-height: calc(var(--font-size-small) + 18px); -} - -input[type="file"]::-webkit-file-upload-button { - font-family: var(--font-regular); - font-size: var(--font-size-small); - outline: none; - cursor:pointer; - padding: 3px 8px; - border: 1px solid var(--primary-color); - background-color: var(--primary-color); - color: var(--primary-color-invert); - border-radius: var(--border-radius);; - -webkit-appearance: none; -} - -pre, -textarea { - scrollbar-width: thin; - scrollbar-color: var(--border-color) var(--input-bg); -} - -pre::-webkit-scrollbar, -textarea::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -pre::-webkit-scrollbar-track, -textarea::-webkit-scrollbar-track { - background:var(--input-bg); -} - -pre::-webkit-scrollbar-thumb, -textarea::-webkit-scrollbar-thumb { - border-radius: 2px; - background-color: var(--border-color); -} - -.link { - font-size:var(--font-size-small); - text-decoration: underline; - color:var(--blue); - font-family:var(--font-mono); - margin-bottom:2px; -} - -/* Toggle Body */ -input[type="checkbox"] { - appearance: none; - display: inline-block; - background-color: var(--light-bg); - border: 1px solid var(--light-bg); - border-radius: 9px; - cursor: pointer; - height: 18px; - position: relative; - transition: border .25s .15s, box-shadow .25s .3s, padding .25s; - min-width: 36px; - width: 36px; - vertical-align: top; -} -/* Toggle Thumb */ -input[type="checkbox"]:after { - position: absolute; - background-color: var(--bg); - border: 1px solid var(--light-bg); - border-radius: 8px; - content: ''; - top: 0px; - left: 0px; - right: 16px; - display: block; - height: 16px; - transition: border .25s .15s, left .25s .1s, right .15s .175s; -} - -/* Toggle Body - Checked */ -input[type="checkbox"]:checked { - background-color: var(--green); - border-color: var(--green); -} -/* Toggle Thumb - Checked*/ -input[type="checkbox"]:checked:after { - border: 1px solid var(--green); - left: 16px; - right: 1px; - transition: border .25s, left .15s .25s, right .25s .175s; -}`); -;// CONCATENATED MODULE: ./src/styles/flex-styles.js - -/* harmony default export */ const flex_styles = (i` -.row, .col{ - display:flex; -} -.row { - align-items:center; - flex-direction: row; -} -.col { - align-items:stretch; - flex-direction: column; -} -`); -;// CONCATENATED MODULE: ./src/styles/table-styles.js - -/* harmony default export */ const table_styles = (i` -.m-table { - border-spacing: 0; - border-collapse: separate; - border: 1px solid var(--light-border-color); - border-radius: var(--border-radius); - margin: 0; - max-width: 100%; - direction: ltr; -} -.m-table tr:first-child td, -.m-table tr:first-child th { - border-top: 0 none; -} -.m-table td, -.m-table th { - font-size: var(--font-size-small); - line-height: calc(var(--font-size-small) + 4px); - padding: 4px 5px 4px; - vertical-align: top; -} - -.m-table.padded-12 td, -.m-table.padded-12 th { - padding: 12px; -} - -.m-table td:not([align]), -.m-table th:not([align]) { - text-align: left; -} - -.m-table th { - color: var(--fg2); - font-size: var(--font-size-small); - line-height: calc(var(--font-size-small) + 18px); - font-weight: 600; - letter-spacing: normal; - background-color: var(--bg2); - vertical-align: bottom; - border-bottom: 1px solid var(--light-border-color); -} - -.m-table > tbody > tr > td, -.m-table > tr > td { - border-top: 1px solid var(--light-border-color); - text-overflow: ellipsis; - overflow: hidden; -} -.table-title { - font-size:var(--font-size-small); - font-weight:bold; - vertical-align: middle; - margin: 12px 0 4px 0; -} -`); -;// CONCATENATED MODULE: ./src/styles/endpoint-styles.js - -/* harmony default export */ const endpoint_styles = (i` -.only-large-screen { display:none; } -.endpoint-head .path{ - display: flex; - font-family:var(--font-mono); - font-size: var(--font-size-small); - align-items: center; - overflow-wrap: break-word; - word-break: break-all; -} - -.endpoint-head .descr { - font-size: var(--font-size-small); - color:var(--light-fg); - font-weight:400; - align-items: center; - overflow-wrap: break-word; - word-break: break-all; - display:none; -} - -.m-endpoint.expanded{margin-bottom:16px; } -.m-endpoint > .endpoint-head{ - border-width:1px 1px 1px 5px; - border-style:solid; - border-color:transparent; - border-top-color:var(--light-border-color); - display:flex; - padding:6px 16px; - align-items: center; - cursor: pointer; -} -.m-endpoint > .endpoint-head.put:hover, -.m-endpoint > .endpoint-head.put.expanded{ - border-color:var(--orange); - background-color:var(--light-orange); -} -.m-endpoint > .endpoint-head.post:hover, -.m-endpoint > .endpoint-head.post.expanded { - border-color:var(--green); - background-color:var(--light-green); -} -.m-endpoint > .endpoint-head.get:hover, -.m-endpoint > .endpoint-head.get.expanded { - border-color:var(--blue); - background-color:var(--light-blue); -} -.m-endpoint > .endpoint-head.delete:hover, -.m-endpoint > .endpoint-head.delete.expanded { - border-color:var(--red); - background-color:var(--light-red); -} - -.m-endpoint > .endpoint-head.head:hover, -.m-endpoint > .endpoint-head.head.expanded, -.m-endpoint > .endpoint-head.patch:hover, -.m-endpoint > .endpoint-head.patch.expanded, -.m-endpoint > .endpoint-head.options:hover, -.m-endpoint > .endpoint-head.options.expanded { - border-color:var(--yellow); - background-color:var(--light-yellow); -} - -.m-endpoint > .endpoint-head.deprecated:hover, -.m-endpoint > .endpoint-head.deprecated.expanded { - border-color:var(--border-color); - filter:opacity(0.6); -} - -.m-endpoint .endpoint-body { - flex-wrap:wrap; - padding:16px 0px 0 0px; - border-width:0px 1px 1px 5px; - border-style:solid; - box-shadow: 0px 4px 3px -3px rgba(0, 0, 0, 0.15); -} -.m-endpoint .endpoint-body.delete{ border-color:var(--red); } -.m-endpoint .endpoint-body.put{ border-color:var(--orange); } -.m-endpoint .endpoint-body.post{border-color:var(--green);} -.m-endpoint .endpoint-body.get{ border-color:var(--blue); } -.m-endpoint .endpoint-body.head, -.m-endpoint .endpoint-body.patch, -.m-endpoint .endpoint-body.options { - border-color:var(--yellow); -} - -.m-endpoint .endpoint-body.deprecated{ - border-color:var(--border-color); - filter:opacity(0.6); -} - -.endpoint-head .deprecated{ - color: var(--light-fg); - filter:opacity(0.6); -} - -.summary{ - padding:8px 8px; -} -.summary .title{ - font-size:calc(var(--font-size-regular) + 2px); - margin-bottom: 6px; - word-break: break-all; -} - -.endpoint-head .method{ - padding:2px 5px; - vertical-align: middle; - font-size:var(--font-size-small); - height: calc(var(--font-size-small) + 16px); - line-height: calc(var(--font-size-small) + 8px); - width: 60px; - border-radius: 2px; - display:inline-block; - text-align: center; - font-weight: bold; - text-transform:uppercase; - margin-right:5px; -} -.endpoint-head .method.delete{ border: 2px solid var(--red);} -.endpoint-head .method.put{ border: 2px solid var(--orange); } -.endpoint-head .method.post{ border: 2px solid var(--green); } -.endpoint-head .method.get{ border: 2px solid var(--blue); } -.endpoint-head .method.get.deprecated{ border: 2px solid var(--border-color); } -.endpoint-head .method.head, -.endpoint-head .method.patch, -.endpoint-head .method.options { - border: 2px solid var(--yellow); -} - -.req-resp-container { - display: flex; - margin-top:16px; - align-items: stretch; - flex-wrap: wrap; - flex-direction: column; - border-top:1px solid var(--light-border-color); -} - -.view-mode-request, -api-response.view-mode { - flex:1; - min-height:100px; - padding:16px 8px; - overflow:hidden; -} -.view-mode-request { - border-width:0 0 1px 0; - border-style:dashed; -} - -.head .view-mode-request, -.patch .view-mode-request, -.options .view-mode-request { - border-color:var(--yellow); -} -.put .view-mode-request { - border-color:var(--orange); -} -.post .view-mode-request { - border-color:var(--green); -} -.get .view-mode-request { - border-color:var(--blue); -} -.delete .view-mode-request { - border-color:var(--red); -} - -@media only screen and (min-width: 1024px) { - .only-large-screen { display:block; } - .endpoint-head .path{ - font-size: var(--font-size-regular); - } - .endpoint-head .descr{ - display: flex; - } - .endpoint-head .m-markdown-small, - .descr .m-markdown-small{ - display:block; - } - .req-resp-container{ - flex-direction: var(--layout, row); - flex-wrap: nowrap; - } - api-response.view-mode { - padding:16px; - } - .view-mode-request.row-layout { - border-width:0 1px 0 0; - padding:16px; - } - .summary{ - padding:8px 16px; - } -} -`); -;// CONCATENATED MODULE: ./src/styles/prism-styles.js - -/* harmony default export */ const prism_styles = (i` -code[class*="language-"], -pre[class*="language-"] { - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - tab-size: 2; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"] { - white-space: normal; -} - -.token.comment, -.token.block-comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: var(--light-fg) -} - -.token.punctuation { - color: var(--fg); -} - -.token.tag, -.token.attr-name, -.token.namespace, -.token.deleted { - color:var(--pink); -} - -.token.function-name { - color: var(--blue); -} - -.token.boolean, -.token.number, -.token.function { - color: var(--red); -} - -.token.property, -.token.class-name, -.token.constant, -.token.symbol { - color: var(--code-property-color); -} - -.token.selector, -.token.important, -.token.atrule, -.token.keyword, -.token.builtin { - color: var(--code-keyword-color); -} - -.token.string, -.token.char, -.token.attr-value, -.token.regex, -.token.variable { - color: var(--green); -} - -.token.operator, -.token.entity, -.token.url { - color: var(--code-operator-color); -} - -.token.important, -.token.bold { - font-weight: bold; -} -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} - -.token.inserted { - color: green; -} -`); -;// CONCATENATED MODULE: ./src/styles/tab-styles.js - -/* harmony default export */ const tab_styles = (i` -.tab-panel { - border: none; -} -.tab-buttons { - height:30px; - padding: 4px 4px 0 4px; - border-bottom: 1px solid var(--light-border-color) ; - align-items: stretch; - overflow-y: hidden; - overflow-x: auto; - scrollbar-width: thin; -} -.tab-buttons::-webkit-scrollbar { - height: 1px; - background-color: var(--border-color); -} -.tab-btn { - border: none; - border-bottom: 3px solid transparent; - color: var(--light-fg); - background-color: transparent; - white-space: nowrap; - cursor:pointer; - outline:none; - font-family:var(--font-regular); - font-size:var(--font-size-small); - margin-right:16px; - padding:1px; -} -.tab-btn.active { - border-bottom: 3px solid var(--primary-color); - font-weight:bold; - color:var(--primary-color); -} - -.tab-btn:hover { - color:var(--primary-color); -} -.tab-content { - margin:-1px 0 0 0; - position:relative; - min-height: 50px; -} -`); -;// CONCATENATED MODULE: ./src/styles/nav-styles.js - -/* harmony default export */ const nav_styles = (i` -.nav-bar-info:focus-visible, -.nav-bar-tag:focus-visible, -.nav-bar-path:focus-visible { - outline: 1px solid; - box-shadow: none; - outline-offset: -4px; -} -.nav-bar-expand-all:focus-visible, -.nav-bar-collapse-all:focus-visible, -.nav-bar-tag-icon:focus-visible { - outline: 1px solid; - box-shadow: none; - outline-offset: 2px; -} -.nav-bar { - width:0; - height:100%; - overflow: hidden; - color:var(--nav-text-color); - background-color: var(--nav-bg-color); - background-blend-mode: multiply; - line-height: calc(var(--font-size-small) + 4px); - display:none; - position:relative; - flex-direction:column; - flex-wrap:nowrap; - word-break:break-word; -} -::slotted([slot=nav-logo]){ - padding:16px 16px 0 16px; -} -.nav-scroll { - overflow-x: hidden; - overflow-y: auto; - overflow-y: overlay; - scrollbar-width: thin; - scrollbar-color: var(--nav-hover-bg-color) transparent; -} - -.nav-bar-tag { - display: flex; - align-items: center; - justify-content: space-between; - flex-direction: row; -} -.nav-bar.read .nav-bar-tag-icon { - display:none; -} -.nav-bar-paths-under-tag { - overflow:hidden; - transition: max-height .2s ease-out, visibility .3s; -} -.collapsed .nav-bar-paths-under-tag { - visibility: hidden; -} - -.nav-bar-expand-all { - transform: rotate(90deg); - cursor:pointer; - margin-right:10px; -} -.nav-bar-collapse-all { - transform: rotate(270deg); - cursor:pointer; -} -.nav-bar-expand-all:hover, .nav-bar-collapse-all:hover { - color: var(--primary-color); -} - -.nav-bar-tag-icon { - color: var(--nav-text-color); - font-size: 20px; -} -.nav-bar-tag-icon:hover { - color:var(--nav-hover-text-color); -} -.nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-tag-icon::after { - content: '⌵'; - width:16px; - height:16px; - text-align: center; - display: inline-block; - transform: rotate(-90deg); - transition: transform 0.2s ease-out 0s; -} -.nav-bar.focused .nav-bar-tag-and-paths.expanded .nav-bar-tag-icon::after { - content: '⌵'; - width:16px; - height:16px; - text-align: center; - display: inline-block; - transition: transform 0.2s ease-out 0s; -} -.nav-scroll::-webkit-scrollbar { - width: var(--scroll-bar-width, 8px); -} -.nav-scroll::-webkit-scrollbar-track { - background:transparent; -} -.nav-scroll::-webkit-scrollbar-thumb { - background-color: var(--nav-hover-bg-color); -} - -.nav-bar-tag { - font-size: var(--font-size-regular); - color: var(--nav-accent-color); - border-left:4px solid transparent; - font-weight:bold; - padding: 15px 15px 15px 10px; - text-transform: capitalize; -} - -.nav-bar-components, -.nav-bar-h1, -.nav-bar-h2, -.nav-bar-info, -.nav-bar-tag, -.nav-bar-path { - display:flex; - cursor: pointer; - width: 100%; - border: none; - border-radius:4px; - color: var(--nav-text-color); - background: transparent; - border-left:4px solid transparent; -} - -.nav-bar-h1, -.nav-bar-h2, -.nav-bar-path { - font-size: calc(var(--font-size-small) + 1px); - padding: var(--nav-item-padding); -} -.nav-bar-path.small-font { - font-size: var(--font-size-small); -} - -.nav-bar-info { - font-size: var(--font-size-regular); - padding: 16px 10px; - font-weight:bold; -} -.nav-bar-section { - display: flex; - flex-direction: row; - justify-content: space-between; - font-size: var(--font-size-small); - color: var(--nav-text-color); - padding: var(--nav-item-padding); - font-weight:bold; -} -.nav-bar-section.operations { - cursor:pointer; -} -.nav-bar-section.operations:hover { - color:var(--nav-hover-text-color); - background-color:var(--nav-hover-bg-color); -} - -.nav-bar-section:first-child { - display: none; -} -.nav-bar-h2 {margin-left:12px;} - -.nav-bar-h1.left-bar.active, -.nav-bar-h2.left-bar.active, -.nav-bar-info.left-bar.active, -.nav-bar-tag.left-bar.active, -.nav-bar-path.left-bar.active, -.nav-bar-section.left-bar.operations.active { - border-left:4px solid var(--nav-accent-color); - color:var(--nav-hover-text-color); -} - -.nav-bar-h1.colored-block.active, -.nav-bar-h2.colored-block.active, -.nav-bar-info.colored-block.active, -.nav-bar-tag.colored-block.active, -.nav-bar-path.colored-block.active, -.nav-bar-section.colored-block.operations.active { - background-color: var(--nav-accent-color); - color: var(--nav-accent-text-color); - border-radius: 0; -} - -.nav-bar-h1:hover, -.nav-bar-h2:hover, -.nav-bar-info:hover, -.nav-bar-tag:hover, -.nav-bar-path:hover { - color:var(--nav-hover-text-color); - background-color:var(--nav-hover-bg-color); -} -`); -;// CONCATENATED MODULE: ./src/styles/info-styles.js - -/* harmony default export */ const info_styles = (i` -#api-info { - font-size: calc(var(--font-size-regular) - 1px); - margin-top: 8px; - margin-left: -15px; -} - -#api-info span:before { - content: "|"; - display: inline-block; - opacity: 0.5; - width: 15px; - text-align: center; -} -#api-info span:first-child:before { - content: ""; - width: 0px; -} -`); -;// CONCATENATED MODULE: ./src/styles/custom-styles.js - - -/* -This file is reserved for any custom css that developers want to add to -customize their theme. Simply add your css to this file and yarn build. -*/ - -/* harmony default export */ const custom_styles = (i` - -`); -;// CONCATENATED MODULE: ./src/utils/common-utils.js -/* For Delayed Event Handler Execution */ -function debounce(fn, delay) { - let timeoutID = null; - return (...args) => { - clearTimeout(timeoutID); - const that = this; - timeoutID = setTimeout(() => { - fn.apply(that, args); - }, delay); - }; -} -const invalidCharsRegEx = /[\s#:?&={}]/g; // used for generating valid html element ids by replacing the invalid chars with hyphen (-) -const rapidocApiKey = '_rapidoc_api_key'; -function sleep(ms) { - // eslint-disable-next-line no-promise-executor-return - return new Promise(resolve => setTimeout(resolve, ms)); -} -function copyToClipboard(data, e) { - const btnEl = e.target; - const textArea = document.createElement('textarea'); - textArea.value = data; - textArea.style.position = 'fixed'; // avoid scrolling to bottom - document.body.appendChild(textArea); - textArea.focus(); - textArea.select(); - try { - document.execCommand('copy'); - btnEl.innerText = 'Copied'; - setTimeout(() => { - btnEl.innerText = 'Copy'; - }, 5000); - } catch (err) { - console.error('Unable to copy', err); // eslint-disable-line no-console - } - - document.body.removeChild(textArea); -} -function getBaseUrlFromUrl(url) { - const pathArray = url.split('/'); - return `${pathArray[0]}//${pathArray[2]}`; -} -async function wait(ms) { - return new Promise(resolve => { - setTimeout(resolve, ms); - }); -} -function componentIsInSearch(searchVal, component) { - return component.name.toLowerCase().includes(searchVal.toLowerCase()); -} -function pathIsInSearch(searchVal, path, matchType = 'includes') { - if (matchType === 'includes') { - const stringToSearch = `${path.method} ${path.path} ${path.summary || path.description || ''} ${path.operationId || ''}`.toLowerCase(); - return stringToSearch.includes(searchVal.toLowerCase()); - } - const regex = new RegExp(searchVal, 'i'); - return regex.test(`${path.method} ${path.path}`); -} -function schemaKeys(schemaProps, result = new Set()) { - if (!schemaProps) { - return result; - } - Object.keys(schemaProps).forEach(key => { - var _schemaProps$key$item; - result.add(key); - if (schemaProps[key].properties) { - schemaKeys(schemaProps[key].properties, result); - } else if ((_schemaProps$key$item = schemaProps[key].items) !== null && _schemaProps$key$item !== void 0 && _schemaProps$key$item.properties) { - var _schemaProps$key$item2; - schemaKeys((_schemaProps$key$item2 = schemaProps[key].items) === null || _schemaProps$key$item2 === void 0 ? void 0 : _schemaProps$key$item2.properties, result); - } - }); - return result; -} -function advancedSearch(searchVal, allSpecTags, searchOptions = []) { - if (!searchVal.trim() || searchOptions.length === 0) { - return; - } - const pathsMatched = []; - allSpecTags.forEach(tag => { - tag.paths.forEach(path => { - let stringToSearch = ''; - if (searchOptions.includes('search-api-path')) { - stringToSearch = path.path; - } - if (searchOptions.includes('search-api-descr')) { - stringToSearch = `${stringToSearch} ${path.summary || path.description || ''}`; - } - if (searchOptions.includes('search-api-params')) { - var _path$parameters; - stringToSearch = `${stringToSearch} ${((_path$parameters = path.parameters) === null || _path$parameters === void 0 ? void 0 : _path$parameters.map(v => v.name).join(' ')) || ''}`; - } - if (searchOptions.includes('search-api-request-body') && path.requestBody) { - let schemaKeySet = new Set(); - for (const contentType in (_path$requestBody = path.requestBody) === null || _path$requestBody === void 0 ? void 0 : _path$requestBody.content) { - var _path$requestBody, _path$requestBody$con; - if ((_path$requestBody$con = path.requestBody.content[contentType].schema) !== null && _path$requestBody$con !== void 0 && _path$requestBody$con.properties) { - var _path$requestBody$con2; - schemaKeySet = schemaKeys((_path$requestBody$con2 = path.requestBody.content[contentType].schema) === null || _path$requestBody$con2 === void 0 ? void 0 : _path$requestBody$con2.properties); - } - stringToSearch = `${stringToSearch} ${[...schemaKeySet].join(' ')}`; - } - } - if (searchOptions.includes('search-api-resp-descr')) { - stringToSearch = `${stringToSearch} ${Object.values(path.responses).map(v => v.description || '').join(' ')}`; - } - if (stringToSearch.toLowerCase().includes(searchVal.trim().toLowerCase())) { - pathsMatched.push({ - elementId: path.elementId, - method: path.method, - path: path.path, - summary: path.summary || path.description || '', - deprecated: path.deprecated - }); - } - }); - }); - return pathsMatched; -} - -/* -export function prettyXml(sourceXmlString) { - const xmlDoc = new DOMParser().parseFromString(sourceXmlString, 'text/xml'); - const xsltDoc = new DOMParser().parseFromString([ - // describes how we want to modify the XML - indent everything - ` - - - - - - - - - `, - ].join('\n'), 'application/xml'); - const xsltProcessor = new XSLTProcessor(); - xsltProcessor.importStylesheet(xsltDoc); - const resultDoc = xsltProcessor.transformToDocument(xmlDoc); - return new XMLSerializer().serializeToString(resultDoc); -} -*/ - -function downloadResource(url, fileName) { - if (url) { - const a = document.createElement('a'); - document.body.appendChild(a); - a.style = 'display: none'; - a.href = url; - a.download = fileName; - a.click(); - a.remove(); - } -} -function viewResource(url) { - if (url) { - const a = document.createElement('a'); - document.body.appendChild(a); - a.style = 'display: none'; - a.href = url; - a.target = '_blank'; - a.click(); - a.remove(); - } -} -;// CONCATENATED MODULE: ./node_modules/@apitools/openapi-parser/dist/openapi-parser.mjs -function openapi_parser_e(e){return e&&e.t&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function openapi_parser_t(e){if(e.t)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];n.push.apply(n,arguments);var r=Function.bind.apply(t,n);return new r}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"t",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var openapi_parser_n=function(e){return e&&e.Math==Math&&e},openapi_parser_r=openapi_parser_n("object"==typeof globalThis&&globalThis)||openapi_parser_n("object"==typeof window&&window)||openapi_parser_n("object"==typeof self&&self)||openapi_parser_n("object"==typeof openapi_parser_r&&openapi_parser_r)||function(){return this}()||globalThis||Function("return this")(),openapi_parser_i=function(e){try{return!!e()}catch(e){return!0}},openapi_parser_s=!openapi_parser_i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),openapi_parser_o=openapi_parser_s,openapi_parser_c=Function.prototype,openapi_parser_a=openapi_parser_c.apply,openapi_parser_u=openapi_parser_c.call,openapi_parser_f="object"==typeof Reflect&&Reflect.apply||(openapi_parser_o?openapi_parser_u.bind(openapi_parser_a):function(){return openapi_parser_u.apply(openapi_parser_a,arguments)}),openapi_parser_l=openapi_parser_s,openapi_parser_h=Function.prototype,openapi_parser_p=openapi_parser_h.call,openapi_parser_m=openapi_parser_l&&openapi_parser_h.bind.bind(openapi_parser_p,openapi_parser_p),openapi_parser_d=openapi_parser_l?openapi_parser_m:function(e){return function(){return openapi_parser_p.apply(e,arguments)}},openapi_parser_v=openapi_parser_d,openapi_parser_y=openapi_parser_v({}.toString),openapi_parser_b=openapi_parser_v("".slice),openapi_parser_j=function(e){return openapi_parser_b(openapi_parser_y(e),8,-1)},openapi_parser_g=openapi_parser_j,openapi_parser_w=openapi_parser_d,O=function(e){if("Function"===openapi_parser_g(e))return openapi_parser_w(e)},openapi_parser_E="object"==typeof document&&document.all,x={all:openapi_parser_E,IS_HTMLDDA:void 0===openapi_parser_E&&void 0!==openapi_parser_E},openapi_parser_S=x.all,openapi_parser_P=x.IS_HTMLDDA?function(e){return"function"==typeof e||e===openapi_parser_S}:function(e){return"function"==typeof e},openapi_parser_$={},openapi_parser_A=!openapi_parser_i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),openapi_parser_T=openapi_parser_s,openapi_parser_R=Function.prototype.call,openapi_parser_I=openapi_parser_T?openapi_parser_R.bind(openapi_parser_R):function(){return openapi_parser_R.apply(openapi_parser_R,arguments)},openapi_parser_k={},F={}.propertyIsEnumerable,openapi_parser_M=Object.getOwnPropertyDescriptor,openapi_parser_N=openapi_parser_M&&!F.call({1:2},1);openapi_parser_k.f=openapi_parser_N?function(e){var t=openapi_parser_M(this,e);return!!t&&t.enumerable}:F;var openapi_parser_C,D,q=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},openapi_parser_=openapi_parser_i,openapi_parser_B=openapi_parser_j,openapi_parser_L=Object,U=openapi_parser_d("".split),J=openapi_parser_((function(){return!openapi_parser_L("z").propertyIsEnumerable(0)}))?function(e){return"String"==openapi_parser_B(e)?U(e,""):openapi_parser_L(e)}:openapi_parser_L,openapi_parser_V=function(e){return null==e},G=openapi_parser_V,openapi_parser_z=TypeError,openapi_parser_H=function(e){if(G(e))throw openapi_parser_z("Can't call method on "+e);return e},W=J,X=openapi_parser_H,Y=function(e){return W(X(e))},K=openapi_parser_P,Q=x.all,openapi_parser_Z=x.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:K(e)||e===Q}:function(e){return"object"==typeof e?null!==e:K(e)},ee={},te=ee,ne=openapi_parser_r,re=openapi_parser_P,ie=function(e){return re(e)?e:void 0},se=function(e,t){return arguments.length<2?ie(te[e])||ie(ne[e]):te[e]&&te[e][t]||ne[e]&&ne[e][t]},oe=openapi_parser_d({}.isPrototypeOf),ce=openapi_parser_r,ae="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ue=ce.process,fe=ce.Deno,le=ue&&ue.versions||fe&&fe.version,he=le&&le.v8;he&&(D=(openapi_parser_C=he.split("."))[0]>0&&openapi_parser_C[0]<4?1:+(openapi_parser_C[0]+openapi_parser_C[1])),!D&&ae&&(!(openapi_parser_C=ae.match(/Edge\/(\d+)/))||openapi_parser_C[1]>=74)&&(openapi_parser_C=ae.match(/Chrome\/(\d+)/))&&(D=+openapi_parser_C[1]);var pe=D,me=pe,de=openapi_parser_i,ve=openapi_parser_r.String,ye=!!Object.getOwnPropertySymbols&&!de((function(){var e=Symbol();return!ve(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&me&&me<41})),be=ye&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,je=se,ge=openapi_parser_P,we=oe,Oe=Object,Ee=be?function(e){return"symbol"==typeof e}:function(e){var t=je("Symbol");return ge(t)&&we(t.prototype,Oe(e))},xe=String,Se=function(e){try{return xe(e)}catch(e){return"Object"}},Pe=openapi_parser_P,$e=Se,Ae=TypeError,Te=function(e){if(Pe(e))return e;throw Ae($e(e)+" is not a function")},Re=Te,Ie=openapi_parser_V,ke=openapi_parser_I,Fe=openapi_parser_P,Me=openapi_parser_Z,Ne=TypeError,Ce={exports:{}},De=openapi_parser_r,qe=Object.defineProperty,_e=function(e,t){try{qe(De,e,{value:t,configurable:!0,writable:!0})}catch(n){De[e]=t}return t},Be=openapi_parser_r["u"]||_e("__core-js_shared__",{}),Le=Be;(Ce.exports=function(e,t){return Le[e]||(Le[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Ue=Ce.exports,Je=openapi_parser_H,Ve=Object,Ge=function(e){return Ve(Je(e))},ze=Ge,He=openapi_parser_d({}.hasOwnProperty),We=Object.hasOwn||function(e,t){return He(ze(e),t)},Xe=openapi_parser_d,Ye=0,Ke=Math.random(),Qe=Xe(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Qe(++Ye+Ke,36)},et=Ue,tt=We,nt=Ze,rt=ye,it=be,st=openapi_parser_r.Symbol,ot=et("wks"),ct=it?st.for||st:st&&st.withoutSetter||nt,at=function(e){return tt(ot,e)||(ot[e]=rt&&tt(st,e)?st[e]:ct("Symbol."+e)),ot[e]},ut=openapi_parser_I,ft=openapi_parser_Z,lt=Ee,ht=function(e,t){var n=e[t];return Ie(n)?void 0:Re(n)},pt=function(e,t){var n,r;if("string"===t&&Fe(n=e.toString)&&!Me(r=ke(n,e)))return r;if(Fe(n=e.valueOf)&&!Me(r=ke(n,e)))return r;if("string"!==t&&Fe(n=e.toString)&&!Me(r=ke(n,e)))return r;throw Ne("Can't convert object to primitive value")},mt=TypeError,dt=at("toPrimitive"),vt=function(e,t){if(!ft(e)||lt(e))return e;var n,r=ht(e,dt);if(r){if(void 0===t&&(t="default"),n=ut(r,e,t),!ft(n)||lt(n))return n;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),pt(e,t)},yt=Ee,bt=function(e){var t=vt(e,"string");return yt(t)?t:t+""},jt=openapi_parser_Z,gt=openapi_parser_r.document,wt=jt(gt)&&jt(gt.createElement),Ot=function(e){return wt?gt.createElement(e):{}},Et=Ot,xt=!openapi_parser_A&&!openapi_parser_i((function(){return 7!=Object.defineProperty(Et("div"),"a",{get:function(){return 7}}).a})),St=openapi_parser_A,Pt=openapi_parser_I,$t=openapi_parser_k,At=q,Tt=Y,Rt=bt,It=We,kt=xt,Ft=Object.getOwnPropertyDescriptor;openapi_parser_$.f=St?Ft:function(e,t){if(e=Tt(e),t=Rt(t),kt)try{return Ft(e,t)}catch(e){}if(It(e,t))return At(!Pt($t.f,e,t),e[t])};var Mt=openapi_parser_i,Nt=openapi_parser_P,Ct=/#|\.prototype\./,Dt=function(e,t){var n=_t[qt(e)];return n==Lt||n!=Bt&&(Nt(t)?Mt(t):!!t)},qt=Dt.normalize=function(e){return String(e).replace(Ct,".").toLowerCase()},_t=Dt.data={},Bt=Dt.NATIVE="N",Lt=Dt.POLYFILL="P",Ut=Dt,Jt=Te,Vt=openapi_parser_s,Gt=O(O.bind),zt=function(e,t){return Jt(e),void 0===t?e:Vt?Gt(e,t):function(){return e.apply(t,arguments)}},Ht={},Wt=openapi_parser_A&&openapi_parser_i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xt=openapi_parser_Z,Yt=String,Kt=TypeError,Qt=function(e){if(Xt(e))return e;throw Kt(Yt(e)+" is not an object")},Zt=openapi_parser_A,en=xt,tn=Wt,nn=Qt,rn=bt,sn=TypeError,on=Object.defineProperty,cn=Object.getOwnPropertyDescriptor;Ht.f=Zt?tn?function(e,t,n){if(nn(e),t=rn(t),nn(n),"function"==typeof e&&"prototype"===t&&"value"in n&&"writable"in n&&!n.writable){var r=cn(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:"configurable"in n?n.configurable:r.configurable,enumerable:"enumerable"in n?n.enumerable:r.enumerable,writable:!1})}return on(e,t,n)}:on:function(e,t,n){if(nn(e),t=rn(t),nn(n),en)try{return on(e,t,n)}catch(e){}if("get"in n||"set"in n)throw sn("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var an=Ht,un=q,fn=openapi_parser_A?function(e,t,n){return an.f(e,t,un(1,n))}:function(e,t,n){return e[t]=n,e},ln=openapi_parser_r,hn=openapi_parser_f,pn=O,mn=openapi_parser_P,dn=openapi_parser_$.f,vn=Ut,yn=ee,bn=zt,jn=fn,gn=We,wn=function(e){var t=function(n,r,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,r)}return new e(n,r,i)}return hn(e,this,arguments)};return t.prototype=e.prototype,t},On=function(e,t){var n,r,i,s,o,c,a,u,f,l=e.target,h=e.global,p=e.stat,m=e.proto,d=h?ln:p?ln[l]:(ln[l]||{}).prototype,v=h?yn:yn[l]||jn(yn,l,{})[l],y=v.prototype;for(s in t)r=!(n=vn(h?s:l+(p?".":"#")+s,e.forced))&&d&&gn(d,s),c=v[s],r&&(a=e.dontCallGetSet?(f=dn(d,s))&&f.value:d[s]),o=r&&a?a:t[s],r&&typeof c==typeof o||(u=e.bind&&r?bn(o,ln):e.wrap&&r?wn(o):m&&mn(o)?pn(o):o,(e.sham||o&&o.sham||c&&c.sham)&&jn(u,"sham",!0),jn(v,s,u),m&&(gn(yn,i=l+"Prototype")||jn(yn,i,{}),jn(yn[i],s,o),e.real&&y&&(n||!y[s])&&jn(y,s,o)))},En=Math.ceil,xn=Math.floor,Sn=Math.trunc||function(e){var t=+e;return(t>0?xn:En)(t)},Pn=function(e){var t=+e;return t!=t||0===t?0:Sn(t)},$n=Pn,An=Math.max,Tn=Math.min,Rn=function(e,t){var n=$n(e);return n<0?An(n+t,0):Tn(n,t)},In=Pn,kn=Math.min,Fn=function(e){return e>0?kn(In(e),9007199254740991):0},Mn=function(e){return Fn(e.length)},Nn=Y,Cn=Rn,Dn=Mn,qn=function(e){return function(t,n,r){var i,s=Nn(t),o=Dn(s),c=Cn(r,o);if(e&&n!=n){for(;o>c;)if((i=s[c++])!=i)return!0}else for(;o>c;c++)if((e||c in s)&&s[c]===n)return e||c||0;return!e&&-1}},_n={includes:qn(!0),indexOf:qn(!1)},Bn={},Ln=We,Un=Y,Jn=_n.indexOf,Vn=Bn,Gn=openapi_parser_d([].push),zn=function(e,t){var n,r=Un(e),i=0,s=[];for(n in r)!Ln(Vn,n)&&Ln(r,n)&&Gn(s,n);for(;t.length>i;)Ln(r,n=t[i++])&&(~Jn(s,n)||Gn(s,n));return s},Hn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Wn=zn,Xn=Hn,Yn=Object.keys||function(e){return Wn(e,Xn)},Kn=Ge,Qn=Yn;On({target:"Object",stat:!0,forced:openapi_parser_i((function(){Qn(1)}))},{keys:function(e){return Qn(Kn(e))}});const Zn=openapi_parser_e(ee.Object.keys);var er={};er[at("toStringTag")]="z";var tr="[object z]"===String(er),nr=tr,rr=openapi_parser_P,ir=openapi_parser_j,sr=at("toStringTag"),or=Object,cr="Arguments"==ir(function(){return arguments}()),ar=nr?ir:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=or(e),sr))?n:cr?ir(t):"Object"==(r=ir(t))&&rr(t.callee)?"Arguments":r},ur=ar,fr=String,lr=function(e){if("Symbol"===ur(e))throw TypeError("Cannot convert a Symbol value to a string");return fr(e)},hr={},pr=openapi_parser_A,mr=Wt,dr=Ht,vr=Qt,yr=Y,br=Yn;hr.f=pr&&!mr?Object.defineProperties:function(e,t){vr(e);for(var n,r=yr(t),i=br(t),s=i.length,o=0;s>o;)dr.f(e,n=i[o++],r[n]);return e};var jr,gr=se("document","documentElement"),wr=Ze,Or=Ue("keys"),Er=function(e){return Or[e]||(Or[e]=wr(e))},xr=Qt,Sr=hr,Pr=Hn,$r=Bn,Ar=gr,Tr=Ot,Rr=Er("IE_PROTO"),Ir=function(){},kr=function(e){return"